diff options
author | Ananya Sen | 2012-03-07 14:26:37 -0800 |
---|---|---|
committer | Ananya Sen | 2012-03-07 14:26:37 -0800 |
commit | 250420d8c6154172b27fe53aff30e78c227e8a67 (patch) | |
tree | f4cad44f6145ad9f0fdba2667f04df166f9f1f37 /js/document | |
parent | 8020dc6e99e3bf0aad605f66a175bc2245da534b (diff) | |
download | ninja-250420d8c6154172b27fe53aff30e78c227e8a67.tar.gz |
minor fixes
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/html-document.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index 83f91c19..f730b853 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -872,22 +872,15 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
872 | }, | 872 | }, |
873 | //////////////////////////////////////////////////////////////////// | 873 | //////////////////////////////////////////////////////////////////// |
874 | /** | 874 | /** |
875 | *pause videos on switching or closing the document, so that the browser does not keep downloading the media data | 875 | *pause videos on switching or closing the document |
876 | *removeSrc : boolean to remove the src if the video... set only in the close document flow | ||
877 | */ | 876 | */ |
878 | pauseVideos:{ | 877 | pauseVideos:{ |
879 | value:function(removeSrc){ | 878 | value:function(){ |
880 | //console.log("$$$ pauseVideos"); | ||
881 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | 879 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; |
882 | for(i=0;i<videosArr.length;i++){ | 880 | for(i=0;i<videosArr.length;i++){ |
883 | if(!videosArr[i].paused){ | 881 | if(!videosArr[i].paused){ |
884 | videosArr[i].pause(); | 882 | videosArr[i].pause(); |
885 | } | 883 | } |
886 | //console.log("$$$ Paused ", videosArr[i]); | ||
887 | if((typeof removeSrc !== "undefined") && (removeSrc === true)){ | ||
888 | videosArr[i].src = ""; | ||
889 | //console.log("$$$ stopped "); | ||
890 | } | ||
891 | } | 884 | } |
892 | } | 885 | } |
893 | }, | 886 | }, |
@@ -897,11 +890,21 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
897 | */ | 890 | */ |
898 | stopVideos:{ | 891 | stopVideos:{ |
899 | value:function(){ | 892 | value:function(){ |
900 | //console.log("$$$ stopVideos"); | ||
901 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | 893 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; |
902 | for(i=0;i<videosArr.length;i++){ | 894 | for(i=0;i<videosArr.length;i++){ |
903 | videosArr[i].src = ""; | 895 | videosArr[i].src = ""; |
904 | //console.log("$$$ stopped ", videosArr[i]); | 896 | } |
897 | } | ||
898 | }, | ||
899 | |||
900 | pauseAndStopVideos:{ | ||
901 | value:function(){ | ||
902 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
903 | for(i=0;i<videosArr.length;i++){ | ||
904 | if(!videosArr[i].paused){ | ||
905 | videosArr[i].pause(); | ||
906 | } | ||
907 | videosArr[i].src = ""; | ||
905 | } | 908 | } |
906 | } | 909 | } |
907 | } | 910 | } |