diff options
author | Valerio Virgillito | 2012-02-29 12:10:03 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-29 12:10:03 -0800 |
commit | 052d9805a6f0a3a90d6849eb94eabffb7ec26962 (patch) | |
tree | f420f7ca8313343ee27244aef1ff600bfb0eab58 /js/mediators/io-mediator.js | |
parent | 3d233f25cff057fff5c5a75e4c4b40e88c22a8f5 (diff) | |
parent | 2f3e4d12aa15077d3cc9794862156e57b7815e68 (diff) | |
download | ninja-052d9805a6f0a3a90d6849eb94eabffb7ec26962.tar.gz |
Merge branch 'integration-candidate' of github.com:Motorola-Mobility/ninja-internal into integration-candidate
Diffstat (limited to 'js/mediators/io-mediator.js')
-rw-r--r-- | js/mediators/io-mediator.js | 17 |
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 | //////////////////////////////////////////////////////////////////// |