aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/io-mediator.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-29 11:29:09 -0800
committerJose Antonio Marquez2012-02-29 11:29:09 -0800
commit98f1cfc58f545702a18166ab216362d667c18915 (patch)
treed7e20e1b5bb83cc1a85b49b9b02b413b0aa9b002 /js/mediators/io-mediator.js
parentda83f44b0ecf379b0950a88d1c378fbedb80e386 (diff)
parentbb3e42b531848b400670df6caf0f3ce02adf1243 (diff)
downloadninja-98f1cfc58f545702a18166ab216362d667c18915.tar.gz
Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate
Diffstat (limited to 'js/mediators/io-mediator.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 ////////////////////////////////////////////////////////////////////