diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/html-document.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index e40656a3..1691e3e4 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -486,11 +486,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
486 | if(this._document.styleSheets[i].rules === null) { | 486 | if(this._document.styleSheets[i].rules === null) { |
487 | //TODO: Revisit URLs and URI creation logic, very hack right now | 487 | //TODO: Revisit URLs and URI creation logic, very hack right now |
488 | var fileUri, cssUrl, cssData, tag, query; | 488 | var fileUri, cssUrl, cssData, tag, query; |
489 | if (this._document.styleSheets[i].href.indexOf('js/document/templates/montage-html') !== -1) { | 489 | //TODO: Parse out relative URLs and map them to absolute |
490 | if (this._document.styleSheets[i].href.indexOf(chrome.extension.getURL('')) !== -1) { | ||
490 | //Getting the url of the CSS file | 491 | //Getting the url of the CSS file |
491 | cssUrl = this._document.styleSheets[i].href.split('js/document/templates/montage-html')[1]; | 492 | cssUrl = this._document.styleSheets[i].href.split('js/document/templates/montage-html')[1];//TODO: Parse out relative URLs and map them to absolute |
492 | //Creating the URI of the file (this is wrong should not be splitting cssUrl) | 493 | //Creating the URI of the file (this is wrong should not be splitting cssUrl) |
493 | fileUri = this.application.ninja.coreIoApi.cloudData.root+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl.split('/')[1]; | 494 | fileUri = this.application.ninja.coreIoApi.cloudData.root+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl; |
494 | //Loading the data from the file | 495 | //Loading the data from the file |
495 | cssData = this.application.ninja.coreIoApi.readFile({uri: fileUri}); | 496 | cssData = this.application.ninja.coreIoApi.readFile({uri: fileUri}); |
496 | //Creating tag with file content | 497 | //Creating tag with file content |
@@ -506,6 +507,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
506 | tag.setAttribute(this._document.styleSheets[i].ownerNode.attributes[n].name, this._document.styleSheets[i].ownerNode.attributes[n].value); | 507 | tag.setAttribute(this._document.styleSheets[i].ownerNode.attributes[n].name, this._document.styleSheets[i].ownerNode.attributes[n].value); |
507 | } | 508 | } |
508 | } | 509 | } |
510 | //TODO: Parse out relative URLs and map them to absolute | ||
511 | //console.log(cssData.content); | ||
509 | tag.innerHTML = cssData.content; | 512 | tag.innerHTML = cssData.content; |
510 | //Looping through DOM to insert style tag at location of link element | 513 | //Looping through DOM to insert style tag at location of link element |
511 | query = this._templateDocument.html.querySelectorAll(['link']); | 514 | query = this._templateDocument.html.querySelectorAll(['link']); |