From 250420d8c6154172b27fe53aff30e78c227e8a67 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 7 Mar 2012 14:26:37 -0800 Subject: minor fixes Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 12 ++++++------ js/controllers/selection-controller.js | 14 -------------- js/document/html-document.js | 25 ++++++++++++++----------- js/stage/layout.js | 4 ++-- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index ca3cd585..87e93465 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -166,7 +166,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, //////////////////////////////////////////////////////////////////// handleExecuteFileClose:{ value: function(event) { - if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ + if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ this.closeDocument(this.activeDocument.uuid); } } @@ -372,11 +372,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); - doc.stopVideos(); + if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();} this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ - if(typeof this.activeDocument.pauseVideos !== "undefined"){ - this.activeDocument.pauseVideos(true); + if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ + this.activeDocument.pauseAndStopVideos(); } this.activeDocument = null; this._removeDocumentView(doc.container); @@ -385,8 +385,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.hideCanvas(true); }else{//closing inactive document tab - just clear DOM - if(typeof doc.pauseVideos !== "undefined"){ - doc.pauseVideos(true); + if(typeof doc.pauseAndStopVideos !== "undefined"){ + doc.pauseAndStopVideos(); } this._removeDocumentView(doc.container); } diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index eff9c91a..c713b6e5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -100,20 +100,6 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = false; } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); - - this._selectionContainer = this.application.ninja.currentSelectedContainer; - } - } - }, - - handleCloseDocument:{ - value: function() { - //clear selections if all documents are closed - if(this.application.ninja.documentController._documents.length === 0){ - this._selectedItems.length =0; - this.application.ninja.selectedElements.length =0; - this._isDocument = true; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } } }, 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, { }, //////////////////////////////////////////////////////////////////// /** - *pause videos on switching or closing the document, so that the browser does not keep downloading the media data - *removeSrc : boolean to remove the src if the video... set only in the close document flow + *pause videos on switching or closing the document */ pauseVideos:{ - value:function(removeSrc){ - //console.log("$$$ pauseVideos"); + value:function(){ var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; for(i=0;i