aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/document/html-document.js10
-rw-r--r--js/mediators/io-mediator.js2
2 files changed, 7 insertions, 5 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']);
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 64210a02..0a851a4d 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -338,7 +338,7 @@ exports.IoMediator = Montage.create(Component, {
338 // 338 //
339 regex = new RegExp(fileCouldDirUrl.replace(/\//gi, '\\\/'), 'gi'); 339 regex = new RegExp(fileCouldDirUrl.replace(/\//gi, '\\\/'), 'gi');
340 // 340 //
341 if (local.split('/').length > 1) { 341 if (local.split('/').length > 2) {
342 adjCss = adjCss.replace(regex, '../'); 342 adjCss = adjCss.replace(regex, '../');
343 } else { 343 } else {
344 adjCss = adjCss.replace(regex, ''); 344 adjCss = adjCss.replace(regex, '');