aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorJonathan Duran2012-03-08 19:51:23 -0800
committerJonathan Duran2012-03-08 19:51:23 -0800
commitb96c5803a90e028af20f8ebce441d7a57608b99e (patch)
tree40825a2f6ed82b015aaf76b1b79238e269a89ea6 /js/document
parent59d3aac11d2ba19f2541ef60064d01a2fd4fb75c (diff)
downloadninja-b96c5803a90e028af20f8ebce441d7a57608b99e.tar.gz
Squashed commit of the following:
commit 3a9c7a57a227a36ec47c6635fc6a0bd4c4b7f9c3 Merge: 5940b22 caa0825 Author: Valerio Virgillito <valerio@motorola.com> Date: Thu Mar 8 15:51:58 2012 -0800 Merge pull request #102 from dhg637/Panels Fixed Some Calculation issues and bugs & appended disabled state when no documents exist commit 5940b22e01de4fc36e5c5de5f3ed074f08fadb07 Merge: 9b006ac 130cd6d Author: Valerio Virgillito <valerio@motorola.com> Date: Thu Mar 8 13:39:11 2012 -0800 Merge pull request #104 from ananyasen/integration-candidate IKNINJA-1270: fixed browser crashing when you close a document while playing a video commit 130cd6d4b99c9db344ec0ab44a54a59d11b31d2f Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Thu Mar 8 13:29:58 2012 -0800 IKNINJA-1270: fixed browser crashing when you close a document while playing a video Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit caa08250663007bea76faf555f166b42cf4c76fb Author: Armen Kesablyan <armen@motorola.com> Date: Thu Mar 8 12:09:13 2012 -0800 Disabled State is now darker Signed-off-by: Armen Kesablyan <armen@motorola.com> commit 21cb7af351e738f446458af5b896c84e03fa5c17 Author: Armen Kesablyan <armen@motorola.com> Date: Thu Mar 8 12:05:43 2012 -0800 Z-Index issue of disabled state with file open dialog Signed-off-by: Armen Kesablyan <armen@motorola.com> commit 9b006acf1f6c2be5abc54f94a8bee7e684f106f9 Merge: 0637a6d 1c61c69 Author: Valerio Virgillito <valerio@motorola.com> Date: Thu Mar 8 11:04:02 2012 -0800 Merge pull request #100 from imix23ways/TimelineUber Timeline uber commit 0637a6d9cc9fbe074145ad6beaa4725f5e7eb212 Merge: cef0708 d981394 Author: Valerio Virgillito <valerio@motorola.com> Date: Wed Mar 7 19:32:38 2012 -0800 Merge pull request #103 from joseeight/FileIO-Build-Candidate File I/O Fixed commit d9813946dc28d8c28033a68b68300b9d9eda115c Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Wed Mar 7 19:22:05 2012 -0800 Image data fix on Open Fixed a bug with data-uris not opening correctly. commit 8b0988b6dd2fe7f5977f70f651f7155c78ee872b Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Wed Mar 7 19:04:19 2012 -0800 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. commit bb83bfb7af1e82dfbce7661fe2eb7612ff730c6f Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Wed Mar 7 18:36:31 2012 -0800 Removing temp viewing of CDN styles It's not done correctly, we really need the proxy for this. commit 1c61c69265b9c0230b834c0d4d7c78a11f9d5b19 Author: Kruti Shah <kruti.shah@motorola.com> Date: Wed Mar 7 16:19:05 2012 -0800 Timeline Bug Fix: IKNINJA-1283 Signed-off-by: Kruti Shah <kruti.shah@motorola.com> commit 84931583f1da8da29784074978f146b281b8efa3 Author: Armen Kesablyan <armen@motorola.com> Date: Wed Mar 7 16:08:36 2012 -0800 Disabled state for panels Signed-off-by: Armen Kesablyan <armen@motorola.com> commit d18d91946627c53c646a6f167855551a1891f8f4 Author: Armen Kesablyan <armen@motorola.com> Date: Wed Mar 7 14:33:09 2012 -0800 Reordering and resizing now works Signed-off-by: Armen Kesablyan <armen@motorola.com> commit e3a5626b21ac8b906638bed9eb96aca5fadd26d8 Author: Armen Kesablyan <armen@motorola.com> Date: Wed Mar 7 11:41:10 2012 -0800 Fixed: Collapsed panels would collapse panels below Signed-off-by: Armen Kesablyan <armen@motorola.com> commit c7b07a9663ac1553fb10d8541b25274e522e07f7 Author: Armen Kesablyan <armen@motorola.com> Date: Wed Mar 7 10:39:23 2012 -0800 Fixed Collapsing and resizing window with panels Signed-off-by: Armen Kesablyan <armen@motorola.com> commit cef07085443b7c31e878daaad083b7408c57e104 Merge: 2e3943a fca9290 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Mar 6 17:08:28 2012 -0800 Merge pull request #99 from joseeight/FileIO-Build-Candidate File IO Updates commit fca92904597895675ddd216399cd235f3c5a7cfa Merge: ec7cbc9 eebb7de Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 17:02:44 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit eebb7de4d19cddec9c763a073d8cf41d76fe70f7 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 17:02:37 2012 -0800 Adding CDN support for URLs in linked CSS commit f6a60f50ca9cd09713baa27f2990eda9346496fc Merge: 7271c25 2e3943a Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 16:19:59 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO Conflicts: js/controllers/selection-controller.js commit 7271c25bf34917b1751f433d284f21485057425b Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 3c4967fa93b3abc529fc404115707307ba72d5cd Merge: bee2df0 84332ab Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:18:30 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO commit ec7cbc95de031d2be667c2a8629a9d63e91f7e1a Merge: 97176d4 bee2df0 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:05:04 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit bee2df0d4da72677aaa2adae669ffdd4ac210dd6 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:04:52 2012 -0800 Changing length of characters per line (pretty function) commit 97176d466bb0d217f1bc5f45e362ed15c3066507 Merge: de26ba9 887e555 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 23:35:08 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit 887e555d00939a99fd13d0fc8fe081a4feb5d677 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 23:34:54 2012 -0800 CSS on CDN preview fix commit de26ba991c1d6351dfed4a81c246f62d40f075d6 Merge: 478c50e 4f274aa Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 23:19:08 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit 4f274aa5beff735f63905704e52e6ea938c140d9 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 23:18:49 2012 -0800 Temp support for CDN CSS Added a temp fix for allow the viewing of CSS on a CDN, however, the styles should not be editable, but will allow for accurate preview of styles. Need to coordinate with the CSS panel and styles manager to insert styles in the appropriate files or tags that have write permission. commit 478c50ee0ce0291c13c4f1e469a234b64946413e Merge: 869f5f1 a68fe3f Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 22:24:20 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit a68fe3f0180f5ab3304ff201be8da40c4432bd40 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 22:23:59 2012 -0800 Minor Fix Forgot to comment out the return, therefore preventing to save. commit 869f5f1ca66b976ba07049b1180882cb8ccb9630 Merge: 0913cd5 4c4d49a Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 20:07:10 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit 4c4d49ae7958e2c87764f9319665189cf69c5c0a Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 20:06:32 2012 -0800 Fixed URL parsing issue on actual opened document Still need to implement CSS loaded from a CDN, currently this would break Ninja. commit 0913cd53a13083119a6e6bfc2ee939e6becd40e0 Merge: 4505203 56efed8 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 16:16:34 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit 56efed8b1ed9974aade615fce2d96bc214d21540 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Mon Mar 5 15:55:30 2012 -0800 Resolved URL path issues in document and CSS Added logic to allow for files opened and assets linked in any order all under the cloud server root. commit 195624da6d0c5d15bcde8a8655355544687ef58a Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Sun Mar 4 19:21:34 2012 -0800 Setting up document level URL parsing Set up logic to parse URLs document level (href, src, url) still need to add functionality to return proper value, currently only detecting current value. commit b2de52888a7c976cc9ae40518e3653cec0aac296 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Sun Mar 4 11:15:27 2012 -0800 Improved CSS URL cleaned Added logic to accommodate any URLs in a CSS file inside the opened document root. Need to add logic for handling linked references above the root. Also need to reformat into a reusable method as it might be needed besides CSS. commit 5c49635cc44815364f9a0296ffaa7acc34254937 Merge: 5c97959 13f52cf Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 19:06:37 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO commit 45052033e018ecc0cba582f84c0431d3bd4020fe Merge: 940b9fc 13f52cf Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 19:06:17 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO-Build-Candidate commit 940b9fc0bf71845bcae39de637e85697e5911eea Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 15:54:12 2012 -0800 Formatting fixes commit 5c9795958b08c233eb2c4afab8054d55c3a33d98 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 14:52:18 2012 -0800 Minor logic fixes for URL resolution in CSS commit 4d35a90ba032d51ce701eebec323117d02e827fa Merge: e24631e 0aeb400 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 14:20:46 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO commit e24631ecac0772fc51756fe4aff9638de3b95faf Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 14:11:08 2012 -0800 Fixing CSS URL issues Only partially, supporting unquoted files under same root. commit c4bfc8b79820b55cc86d755fe590ee649813232a Merge: ff77f86 ff0a956 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 10:34:57 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO commit ff77f861fba349dd36d6c15c9a545459c3a76583 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Fri Mar 2 10:34:01 2012 -0800 Fixing IO RegEx Fixed parsing files to have correct URLs with RegEx, inner content of CSS files still needs to be fixed. commit 66bc1f46938afc696b11878ebbb97d1fd361386e Merge: 80ac930 61dd921 Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Thu Mar 1 18:13:18 2012 -0800 Merge branch 'refs/heads/Ninja-Internal' into FileIO commit 80ac930684255dd24cecae70b488285a6058488e Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Thu Mar 1 13:34:45 2012 -0800 Optimizing URL intercepting detection Modified the way the webRequest maps to the file. commit 13aca03d4e0d11729d691db0b7f0d2f2a6899cf6 Merge: b09956e 8fee7d6 Author: Jose Antonio Marquez Russo <jose@eightyearproject.com> Date: Wed Feb 29 15:41:12 2012 -0800 Merge pull request #24 from ananyasen/FileIO undo/redo per document , codemirror 2.22 update commit 8fee7d6bdb55ba18f396c3523081b18499fa1e30 Merge: 5d4f1aa b09956e Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 15:21:31 2012 -0800 Merge branch 'refs/heads/ninja-internal-master' into FileIO Conflicts: js/controllers/selection-controller.js js/document/html-document.js js/panels/properties/content.reel/content.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 5d4f1aad01737695238582c704e6d4f2c3a2f317 Merge: ccedeef 551e1f2 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 14:53:13 2012 -0800 Merge branch 'refs/heads/ninja-internal-master' into FileIO commit ccedeef38d6eb2e55d1782b82401828f3c99dd9c Merge: 7a259f8 84d6f6f Author: Ananya Sen <xhdq84@motorola.com> Date: Wed Feb 29 13:56:35 2012 -0800 Merge pull request #4 from mqg734/AnanyaFileIO Fix for selection bug due to bad scrollLeft and scrollTop values when switching between documents. commit 84d6f6f5518e5ef8fc3d68be7e41c510f57b597a Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Wed Feb 29 13:53:45 2012 -0800 Fixing typo. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 0cd17b6cf9231e60083958d85759d4796f505342 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Wed Feb 29 13:48:11 2012 -0800 Fix for selection bug due to bad scrollLeft and scrollTop values when switching between documents. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 7a259f8c78a2394e32c62654623285ee595c6249 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 13:25:35 2012 -0800 IKNINJA-1217: use encodeURI instead to save into sessionStorage Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 4e21db069b28c79236c8c7fd19dcc7810d28c5cb Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 12:18:09 2012 -0800 set selectionContainer before restoring selected elements Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 03ea76700cb8bee3f4f58acf3e3503b0642d13fb Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 11:46:19 2012 -0800 fixed selection which click after switching to a document Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 7a9c2a91dfbbdd0cd7c79d81be5aeecd7887e7f1 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Wed Feb 29 10:12:38 2012 -0800 handle selections for switching documents Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 1c7e86b6c2c802d720cc3075f75c7a61866ebc07 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 16:41:18 2012 -0800 fix for creatingNewFile flag Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit e0fab951e4f3869b04fd4a01f429a6654991cd68 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 15:33:35 2012 -0800 minor fixes in saving undo/redo stacks per document Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 1766c6b17e2311fcd21c2be6608c7dcdc0a9b23a Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 15:07:49 2012 -0800 persist selections while switching documents Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 866df4801b9e77a0155ffbfb87adbc79a94ce9a5 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 12:34:33 2012 -0800 reverted null check as per request Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit ada597016685a83f2c9a8b25b28589b9221569c0 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 12:26:52 2012 -0800 reverting null checks as per request Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit bca9189a076432f35f99fc90f271c45ec00c0f1c Merge: 2edcdd8 6af71de Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Tue Feb 28 10:06:48 2012 -0800 Merge branch 'refs/heads/FileIO-jose' into FileIO commit 2edcdd88ffc2f6ff0ea836e4da3e1fd2cb3e856f Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Mon Feb 27 17:39:26 2012 -0800 persist undo/redo stack per html document Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> commit 51ed781953bc44bba3c70938aa57b856394cbc88 Author: Ananya Sen <Ananya.Sen@motorola.com> Date: Mon Feb 27 14:41:21 2012 -0800 updating to codemirror 2.22 Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js97
1 files changed, 78 insertions, 19 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 80930af2..23b55e92 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -437,8 +437,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
437 } else if (prop.indexOf('url') !== -1) { //From CSS property 437 } else if (prop.indexOf('url') !== -1) { //From CSS property
438 //TODO: Add functionality 438 //TODO: Add functionality
439 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); 439 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/'));
440 prop = prop.replace(/[^()\\""\\'']+/g, test); 440 prop = prop.replace(/[^()\\""\\'']+/g, cssUrlToNinjaUrl);
441 function test (s) { 441 function cssUrlToNinjaUrl (s) {
442 if (s !== 'url') { 442 if (s !== 'url') {
443 s = docRootUrl + s; 443 s = docRootUrl + s;
444 } 444 }
@@ -451,9 +451,12 @@ exports.HTMLDocument = Montage.create(TextDocument, {
451 // 451 //
452 function ninjaUrlPrepend (url) { 452 function ninjaUrlPrepend (url) {
453 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); 453 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/'));
454 return '"'+docRootUrl+url.replace(/\"/gi, '')+'"'; 454 if (url.indexOf('data:image') !== -1) {
455 return url;
456 } else {
457 return '"'+docRootUrl+url.replace(/\"/gi, '')+'"';
458 }
455 } 459 }
456
457 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 460 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
458 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 461 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
459 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 462 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -570,8 +573,22 @@ exports.HTMLDocument = Montage.create(TextDocument, {
570 } 573 }
571 // 574 //
572 fileCouldDirUrl = this._document.styleSheets[i].href.split(this._document.styleSheets[i].href.split('/')[this._document.styleSheets[i].href.split('/').length-1])[0]; 575 fileCouldDirUrl = this._document.styleSheets[i].href.split(this._document.styleSheets[i].href.split('/')[this._document.styleSheets[i].href.split('/').length-1])[0];
573 prefixUrl = 'url('+fileCouldDirUrl; //This should be re-written with better RegEx 576
574 tag.innerHTML = cssData.content.replace(/url\(/gi, prefixUrl); 577 tag.innerHTML = cssData.content.replace(/url\(()(.+?)\1\)/g, detectUrl);
578
579 function detectUrl (prop) {
580 return prop.replace(/[^()\\""\\'']+/g, prefixUrl);;
581 }
582
583 function prefixUrl (url) {
584 if (url !== 'url') {
585 if (!url.match(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi)) {
586 url = fileCouldDirUrl+url;
587 }
588 }
589 return url;
590 }
591
575 //Looping through DOM to insert style tag at location of link element 592 //Looping through DOM to insert style tag at location of link element
576 query = this._templateDocument.html.querySelectorAll(['link']); 593 query = this._templateDocument.html.querySelectorAll(['link']);
577 for (var j in query) { 594 for (var j in query) {
@@ -600,12 +617,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
600 } 617 }
601 } 618 }
602 } 619 }
603
604
605
606
607 /* 620 /*
608//TODO: Figure out cross-domain XHR issue, might need cloud to handle 621
622 //TODO: Figure out cross-domain XHR issue, might need cloud to handle
609 var xhr = new XMLHttpRequest(); 623 var xhr = new XMLHttpRequest();
610 xhr.open("GET", this._document.styleSheets[i].href, true); 624 xhr.open("GET", this._document.styleSheets[i].href, true);
611 xhr.send(); 625 xhr.send();
@@ -613,20 +627,24 @@ exports.HTMLDocument = Montage.create(TextDocument, {
613 if (xhr.readyState === 4) { 627 if (xhr.readyState === 4) {
614 console.log(xhr); 628 console.log(xhr);
615 } 629 }
616*/
617 //tag.innerHTML = xhr.responseText //xhr.response; 630 //tag.innerHTML = xhr.responseText //xhr.response;
618 tag.innerHTML = 'noRULEjustHACK{background: #000}' 631 */
619 //Currently no external styles will load if unable to load via XHR request 632 //Temp rule so it's registered in the array
620 633 tag.innerHTML = 'noRULEjustHACK{background: #000}';
621 //Disabling external style sheets 634 //Disabling external style sheets
622 query = this._templateDocument.html.querySelectorAll(['link']); 635 query = this._templateDocument.html.querySelectorAll(['link']);
623 for (var k in query) { 636 for (var k in query) {
624 if (query[k].href === this._document.styleSheets[i].href) { 637 if (query[k].href === this._document.styleSheets[i].href) {
638
639 //TODO: Removed the temp insertion of the stylesheet
640 //because it wasn't the proper way to do it
641 //need to be handled via XHR with proxy in Cloud Sim
642
625 //Disabling style sheet to reload via inserting in style tag 643 //Disabling style sheet to reload via inserting in style tag
626 var tempCSS = query[k].cloneNode(true); 644 //var tempCSS = query[k].cloneNode(true);
627 tempCSS.setAttribute('data-ninja-template', 'true'); 645 //tempCSS.setAttribute('data-ninja-template', 'true');
628 query[k].setAttribute('disabled', 'true'); 646 query[k].setAttribute('disabled', 'true');
629 this.iframe.contentWindow.document.head.appendChild(tempCSS); 647 //this.iframe.contentWindow.document.head.appendChild(tempCSS);
630 //Inserting tag 648 //Inserting tag
631 this._templateDocument.head.insertBefore(tag, query[k]); 649 this._templateDocument.head.insertBefore(tag, query[k]);
632 } 650 }
@@ -824,6 +842,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
824 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); 842 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
825 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); 843 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
826 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();
827 } 848 }
828 }, 849 },
829 850
@@ -852,6 +873,44 @@ exports.HTMLDocument = Montage.create(TextDocument, {
852 873
853 874
854 } 875 }
855 } 876 },
856 //////////////////////////////////////////////////////////////////// 877 ////////////////////////////////////////////////////////////////////
878 /**
879 *pause videos on switching or closing the document, so that the browser does not keep downloading the media data
880 */