aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-26 11:32:10 -0800
committerJose Antonio Marquez2012-02-26 11:32:10 -0800
commit3638492098a21aef63842366fbfc035fc6414fb0 (patch)
tree9270e3e7f2bb638fd1c9a126d6410ac0b30ba680 /js/mediators
parentd4ac479796f0341163e02ba50fa892773212a445 (diff)
downloadninja-3638492098a21aef63842366fbfc035fc6414fb0.tar.gz
Fixed issue with losing track of Ninja template css
Also cleaned up URL getter for app in cleaning string code.
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 315fb6a7..c33ccced 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -205,11 +205,11 @@ exports.IoMediator = Montage.create(Component, {
205 //Getting all CSS (style or link) tags 205 //Getting all CSS (style or link) tags
206 var styletags = template.document.content.document.getElementsByTagName('style'), 206 var styletags = template.document.content.document.getElementsByTagName('style'),
207 linktags = template.document.content.document.getElementsByTagName('link'), 207 linktags = template.document.content.document.getElementsByTagName('link'),
208 url = new RegExp(window.location.protocol+'//'+window.location.host+'/js/document/templates/montage-html/', 'gi'); 208 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi');
209 //Looping through link tags and removing file recreated elements 209 //Looping through link tags and removing file recreated elements
210 for (var j in styletags) { 210 for (var j in styletags) {
211 if (styletags[j].getAttribute) { 211 if (styletags[j].getAttribute) {
212 if(styletags[j].getAttribute('data-ninja-uri') !== null) {//TODO: Use querySelectorAll 212 if(styletags[j].getAttribute('data-ninja-uri') !== null && !styletags[j].getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll
213 try { 213 try {
214 //Checking head first 214 //Checking head first
215 template.document.content.document.head.removeChild(styletags[j]); 215 template.document.content.document.head.removeChild(styletags[j]);
@@ -241,7 +241,7 @@ exports.IoMediator = Montage.create(Component, {
241 if (template.styles[i].ownerNode) { 241 if (template.styles[i].ownerNode) {
242 if (template.styles[i].ownerNode.getAttribute) { 242 if (template.styles[i].ownerNode.getAttribute) {
243 //Checking for node not to be loaded from file 243 //Checking for node not to be loaded from file
244 if (template.styles[i].ownerNode.getAttribute('data-ninja-uri') === null) { 244 if (template.styles[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.styles[i].ownerNode.getAttribute('data-ninja-template')) {
245 //Inseting data from rules array into tag as string 245 //Inseting data from rules array into tag as string
246 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.styles[i].cssRules); 246 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.styles[i].cssRules);
247 //Syncing <style> tags count since it might be mixed with <link> 247 //Syncing <style> tags count since it might be mixed with <link>
@@ -258,7 +258,7 @@ exports.IoMediator = Montage.create(Component, {
258 for(var i in template.css) { 258 for(var i in template.css) {
259 if (template.css[i].ownerNode) { 259 if (template.css[i].ownerNode) {
260 if (template.css[i].ownerNode.getAttribute) { 260 if (template.css[i].ownerNode.getAttribute) {
261 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null) {//TODO: Use querySelectorAll 261 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.css[i].ownerNode.getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll
262 //Inseting data from rules array into <style> as string 262 //Inseting data from rules array into <style> as string
263 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules); 263 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules);
264 styleCounter++; 264 styleCounter++;
@@ -327,7 +327,7 @@ exports.IoMediator = Montage.create(Component, {
327 } 327 }
328 } 328 }
329 //TODO: Add better logic for creating this string 329 //TODO: Add better logic for creating this string
330 url = new RegExp(window.location.protocol+'//'+window.location.host+'/js/document/templates/montage-html/', 'gi'); 330 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi');
331 //Returning the CSS string 331 //Returning the CSS string
332 return this.getPretyCss(css.replace(url, '')); 332 return this.getPretyCss(css.replace(url, ''));
333 } 333 }