aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-29 10:07:53 -0800
committerJose Antonio Marquez2012-02-29 10:07:53 -0800
commit795329d2225ff3b760f7f0ea3bb6b5e68f6c6b5b (patch)
tree4e6102810a1a1012744676e1309e46b47407289d /js
parent2ce9f65c3a34937928f08690606962af3085c74f (diff)
downloadninja-795329d2225ff3b760f7f0ea3bb6b5e68f6c6b5b.tar.gz
Making class level url template variable
Created a class level variable for the URL to be parsed out of the user files.
Diffstat (limited to 'js')
-rw-r--r--js/mediators/io-mediator.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 6b26668b..e763c67c 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -39,6 +39,12 @@ exports.IoMediator = Montage.create(Component, {
39 enumerable: false, 39 enumerable: false,
40 value: ProjectIo 40 value: ProjectIo
41 }, 41 },
42 ////////////////////////////////////////////////////////////////////
43 //
44 appTemplatesUrl: {
45 enumerable: false,
46 value: new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi')
47 },
42 //////////////////////////////////////////////////////////////////// 48 ////////////////////////////////////////////////////////////////////
43 // 49 //
44 fileNew: { 50 fileNew: {
@@ -209,8 +215,7 @@ exports.IoMediator = Montage.create(Component, {
209 template.document.content.document.head.innerHTML = template.head; 215 template.document.content.document.head.innerHTML = template.head;
210 //Getting all CSS (style or link) tags 216 //Getting all CSS (style or link) tags
211 var styletags = template.document.content.document.getElementsByTagName('style'), 217 var styletags = template.document.content.document.getElementsByTagName('style'),
212 linktags = template.document.content.document.getElementsByTagName('link'), 218 linktags = template.document.content.document.getElementsByTagName('link');
213 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi'); //TODO: Make public into var
214 //Looping through link tags and removing file recreated elements 219 //Looping through link tags and removing file recreated elements
215 for (var j in styletags) { 220 for (var j in styletags) {
216 if (styletags[j].getAttribute) { 221 if (styletags[j].getAttribute) {
@@ -345,7 +350,7 @@ exports.IoMediator = Montage.create(Component, {
345 webgltag.innerHTML = json; 350 webgltag.innerHTML = json;
346 } 351 }
347 // 352 //
348 return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(url, '')); 353 return this.getPrettyHtml(template.document.content.document.documentElement.outerHTML.replace(this.appTemplatesUrl, ''));
349 } 354 }
350 }, 355 },
351 //////////////////////////////////////////////////////////////////// 356 ////////////////////////////////////////////////////////////////////
@@ -354,7 +359,7 @@ exports.IoMediator = Montage.create(Component, {
354 enumerable: false, 359 enumerable: false,
355 value: function (list) { 360 value: function (list) {
356 //Variable to store CSS definitions 361 //Variable to store CSS definitions
357 var i, str, url, css = ''; 362 var i, str, css = '';
358 //Looping through list 363 //Looping through list
359 if (list && list.length > 0) { 364 if (list && list.length > 0) {
360 //Adding each list item to string and also adding breaks 365 //Adding each list item to string and also adding breaks
@@ -362,10 +367,8 @@ exports.IoMediator = Montage.create(Component, {
362 css += list[i].cssText; 367 css += list[i].cssText;
363 } 368 }
364 } 369 }
365 //TODO: Add better logic for creating this string
366 url = new RegExp(chrome.extension.getURL('js/document/templates/montage-html/'), 'gi');
367 //Returning the CSS string 370 //Returning the CSS string
368 return this.getPrettyCss(css.replace(url, '')); 371 return this.getPrettyCss(css.replace(this.appTemplatesUrl, ''));
369 } 372 }
370 }, 373 },
371 //////////////////////////////////////////////////////////////////// 374 ////////////////////////////////////////////////////////////////////