diff options
author | Nivesh Rajbhandari | 2012-03-09 09:28:08 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-09 09:28:08 -0800 |
commit | c792c7a82a6247524d3c5bfab5eaa1258931a401 (patch) | |
tree | df06b94977920daa6450406b1edca380f8731b90 /js/document/html-document.js | |
parent | 86784888a98a05523dbedcbe32fd4dea336878e7 (diff) | |
parent | 3a9c7a57a227a36ec47c6635fc6a0bd4c4b7f9c3 (diff) | |
download | ninja-c792c7a82a6247524d3c5bfab5eaa1258931a401.tar.gz |
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-x | js/document/html-document.js | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index b9b68972..23b55e92 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -842,6 +842,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
842 | this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); | 842 | this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); |
843 | this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); | 843 | this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); |
844 | this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start | 844 | this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start |
845 | |||
846 | //pause videos on switching or closing the document, so that the browser does not keep downloading the media data | ||
847 | this.pauseVideos(); | ||
845 | } | 848 | } |
846 | }, | 849 | }, |
847 | 850 | ||
@@ -870,6 +873,44 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
870 | 873 | ||
871 | 874 | ||
872 | } | 875 | } |
873 | } | 876 | }, |
874 | //////////////////////////////////////////////////////////////////// | 877 | //////////////////////////////////////////////////////////////////// |
878 | /** | ||
879 | *pause videos on switching or closing the document, so that the browser does not keep downloading the media data | ||
880 | */ | ||
881 | pauseVideos:{ | ||
882 | value:function(){ | ||
883 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
884 | for(i=0;i<videosArr.length;i++){ | ||
885 | if(!videosArr[i].paused){ | ||
886 | videosArr[i].pause(); | ||
887 | } | ||
888 | } | ||
889 | } | ||
890 | }, | ||
891 | |||
892 | /** | ||
893 | * remove the video src on closing the document, so that the browser does not keep downloading the media data, if the tag does not get garbage collected | ||
894 | *removeSrc : boolean to remove the src if the video... set only in the close document flow | ||
895 | */ | ||
896 | stopVideos:{ | ||
897 | value:function(){ | ||
898 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
899 | for(i=0;i<videosArr.length;i++){ | ||
900 | videosArr[i].src = ""; | ||
901 | } | ||
902 | } | ||
903 | }, | ||
904 | pauseAndStopVideos:{ | ||
905 | value:function(){ | ||
906 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
907 | for(i=0;i<videosArr.length;i++){ | ||
908 | if(!videosArr[i].paused){ | ||
909 | videosArr[i].pause(); | ||
910 | } | ||
911 | videosArr[i].src = ""; | ||
912 | } | ||
913 | } | ||
914 | } | ||
915 | //////////////////////////////////////////////////////////////////// | ||
875 | }); \ No newline at end of file | 916 | }); \ No newline at end of file |