aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-02 14:52:18 -0800
committerJose Antonio Marquez2012-03-02 14:52:18 -0800
commit5c9795958b08c233eb2c4afab8054d55c3a33d98 (patch)
treeca1bd25080d7f881068b7992e589a81443671c7e /js/document
parent4d35a90ba032d51ce701eebec323117d02e827fa (diff)
downloadninja-5c9795958b08c233eb2c4afab8054d55c3a33d98.tar.gz
Minor logic fixes for URL resolution in CSS
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 54647d65..a56a7e3c 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -511,12 +511,14 @@ exports.HTMLDocument = Montage.create(TextDocument, {
511 511
512 fileCouldDirUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl.split(cssUrl.split('/')[cssUrl.split('/').length-1])[0]).replace(/\/\//gi, '/')); 512 fileCouldDirUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl.split(cssUrl.split('/')[cssUrl.split('/').length-1])[0]).replace(/\/\//gi, '/'));
513 513
514
515 //TODO: Fix regEx to have logic for all possible URLs strings (currently prefixing all url())
516 prefixUrl = 'url('+fileCouldDirUrl;
517 tag.innerHTML = cssData.content.replace(/url\(/gi, prefixUrl);
514 518
515 //TODO: Fix regEx to have logic for all possible URLs strings 519 //console.log(("http://hello.com, https://google.com").replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, 'hello'))
516 prefixUrl = '('+fileCouldDirUrl+'../';
517 tag.innerHTML = cssData.content.replace(/\(\.\.\//gi, prefixUrl);
518
519 520
521 //console.log(tag.innerHTML);
520 522
521 //Looping through DOM to insert style tag at location of link element 523 //Looping through DOM to insert style tag at location of link element
522 query = this._templateDocument.html.querySelectorAll(['link']); 524 query = this._templateDocument.html.querySelectorAll(['link']);