From bb83bfb7af1e82dfbce7661fe2eb7612ff730c6f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 7 Mar 2012 18:36:31 -0800 Subject: Removing temp viewing of CDN styles It's not done correctly, we really need the proxy for this. --- js/document/html-document.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index 1c5cec91..6e1f654b 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -637,10 +637,10 @@ exports.HTMLDocument = Montage.create(TextDocument, { for (var k in query) { if (query[k].href === this._document.styleSheets[i].href) { //Disabling style sheet to reload via inserting in style tag - var tempCSS = query[k].cloneNode(true); - tempCSS.setAttribute('data-ninja-template', 'true'); + //var tempCSS = query[k].cloneNode(true); + //tempCSS.setAttribute('data-ninja-template', 'true'); query[k].setAttribute('disabled', 'true'); - this.iframe.contentWindow.document.head.appendChild(tempCSS); + //this.iframe.contentWindow.document.head.appendChild(tempCSS); //Inserting tag this._templateDocument.head.insertBefore(tag, query[k]); } -- cgit v1.2.3 From 8b0988b6dd2fe7f5977f70f651f7155c78ee872b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 7 Mar 2012 19:04:19 -0800 Subject: Adding To-do comments for CDN stylesheets Removed inserting CDN styles into head as it was proper because the hierarchy would be lost, and there is no current fast-alternative to achieve a preview. --- js/document/html-document.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index 6e1f654b..a05219bc 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -614,12 +614,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } } - - - - /* -//TODO: Figure out cross-domain XHR issue, might need cloud to handle + + //TODO: Figure out cross-domain XHR issue, might need cloud to handle var xhr = new XMLHttpRequest(); xhr.open("GET", this._document.styleSheets[i].href, true); xhr.send(); @@ -627,15 +624,19 @@ exports.HTMLDocument = Montage.create(TextDocument, { if (xhr.readyState === 4) { console.log(xhr); } -*/ //tag.innerHTML = xhr.responseText //xhr.response; - tag.innerHTML = 'noRULEjustHACK{background: #000}' - //Currently no external styles will load if unable to load via XHR request - + */ + //Temp rule so it's registered in the array + tag.innerHTML = 'noRULEjustHACK{background: #000}'; //Disabling external style sheets query = this._templateDocument.html.querySelectorAll(['link']); for (var k in query) { if (query[k].href === this._document.styleSheets[i].href) { + + //TODO: Removed the temp insertion of the stylesheet + //because it wasn't the proper way to do it + //need to be handled via XHR with proxy in Cloud Sim + //Disabling style sheet to reload via inserting in style tag //var tempCSS = query[k].cloneNode(true); //tempCSS.setAttribute('data-ninja-template', 'true'); -- cgit v1.2.3 From d9813946dc28d8c28033a68b68300b9d9eda115c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 7 Mar 2012 19:22:05 -0800 Subject: Image data fix on Open Fixed a bug with data-uris not opening correctly. --- js/document/html-document.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index a05219bc..b9b68972 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -451,9 +451,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { // function ninjaUrlPrepend (url) { var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); - return '"'+docRootUrl+url.replace(/\"/gi, '')+'"'; + if (url.indexOf('data:image') !== -1) { + return url; + } else { + return '"'+docRootUrl+url.replace(/\"/gi, '')+'"'; + } } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 130cd6d4b99c9db344ec0ab44a54a59d11b31d2f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 8 Mar 2012 13:29:58 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video Signed-off-by: Ananya Sen --- js/document/html-document.js | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'js/document') 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, { this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start + + //pause videos on switching or closing the document, so that the browser does not keep downloading the media data + this.pauseVideos(); } }, @@ -870,6 +873,44 @@ exports.HTMLDocument = Montage.create(TextDocument, { } - } + }, //////////////////////////////////////////////////////////////////// + /** + *pause videos on switching or closing the document, so that the browser does not keep downloading the media data + */ + pauseVideos:{ + value:function(){ + var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; + for(i=0;i