From 5c9795958b08c233eb2c4afab8054d55c3a33d98 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 2 Mar 2012 14:52:18 -0800 Subject: Minor logic fixes for URL resolution in CSS --- js/document/html-document.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js/document/html-document.js') 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, { 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, '/')); + + //TODO: Fix regEx to have logic for all possible URLs strings (currently prefixing all url()) + prefixUrl = 'url('+fileCouldDirUrl; + tag.innerHTML = cssData.content.replace(/url\(/gi, prefixUrl); - //TODO: Fix regEx to have logic for all possible URLs strings - prefixUrl = '('+fileCouldDirUrl+'../'; - tag.innerHTML = cssData.content.replace(/\(\.\.\//gi, prefixUrl); - + //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')) + //console.log(tag.innerHTML); //Looping through DOM to insert style tag at location of link element query = this._templateDocument.html.querySelectorAll(['link']); -- cgit v1.2.3