aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-07 19:32:38 -0800
committerValerio Virgillito2012-03-07 19:32:38 -0800
commit0637a6d9cc9fbe074145ad6beaa4725f5e7eb212 (patch)
tree63617bf47ad77ad26b5cd56c720ccad4205887a5 /js/document
parentcef07085443b7c31e878daaad083b7408c57e104 (diff)
parentd9813946dc28d8c28033a68b68300b9d9eda115c (diff)
downloadninja-0637a6d9cc9fbe074145ad6beaa4725f5e7eb212.tar.gz
Merge pull request #103 from joseeight/FileIO-Build-Candidate
File I/O Fixed
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 1c5cec91..b9b68972 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -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 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -614,12 +617,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
614 } 617 }
615 } 618 }
616 } 619 }
617
618
619
620
621 /* 620 /*
622//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
623 var xhr = new XMLHttpRequest(); 623 var xhr = new XMLHttpRequest();
624 xhr.open("GET", this._document.styleSheets[i].href, true); 624 xhr.open("GET", this._document.styleSheets[i].href, true);
625 xhr.send(); 625 xhr.send();
@@ -627,20 +627,24 @@ exports.HTMLDocument = Montage.create(TextDocument, {
627 if (xhr.readyState === 4) { 627 if (xhr.readyState === 4) {
628 console.log(xhr); 628 console.log(xhr);
629 } 629 }
630*/
631 //tag.innerHTML = xhr.responseText //xhr.response; 630 //tag.innerHTML = xhr.responseText //xhr.response;
632 tag.innerHTML = 'noRULEjustHACK{background: #000}' 631 */
633 //Currently no external styles will load if unable to load via XHR request 632 //Temp rule so it's registered in the array
634 633 tag.innerHTML = 'noRULEjustHACK{background: #000}';
635 //Disabling external style sheets 634 //Disabling external style sheets
636 query = this._templateDocument.html.querySelectorAll(['link']); 635 query = this._templateDocument.html.querySelectorAll(['link']);
637 for (var k in query) { 636 for (var k in query) {
638 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
639 //Disabling style sheet to reload via inserting in style tag 643 //Disabling style sheet to reload via inserting in style tag
640 var tempCSS = query[k].cloneNode(true); 644 //var tempCSS = query[k].cloneNode(true);
641 tempCSS.setAttribute('data-ninja-template', 'true'); 645 //tempCSS.setAttribute('data-ninja-template', 'true');
642 query[k].setAttribute('disabled', 'true'); 646 query[k].setAttribute('disabled', 'true');
643 this.iframe.contentWindow.document.head.appendChild(tempCSS); 647 //this.iframe.contentWindow.document.head.appendChild(tempCSS);
644 //Inserting tag 648 //Inserting tag
645 this._templateDocument.head.insertBefore(tag, query[k]); 649 this._templateDocument.head.insertBefore(tag, query[k]);
646 } 650 }