aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/io-mediator.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-05 23:18:49 -0800
committerJose Antonio Marquez2012-03-05 23:18:49 -0800
commit4f274aa5beff735f63905704e52e6ea938c140d9 (patch)
tree3849000a0cbb26894257343b0afc639af6547232 /js/mediators/io-mediator.js
parenta68fe3f0180f5ab3304ff201be8da40c4432bd40 (diff)
downloadninja-4f274aa5beff735f63905704e52e6ea938c140d9.tar.gz
Temp support for CDN CSS
Added a temp fix for allow the viewing of CSS on a CDN, however, the styles should not be editable, but will allow for accurate preview of styles. Need to coordinate with the CSS panel and styles manager to insert styles in the appropriate files or tags that have write permission.
Diffstat (limited to 'js/mediators/io-mediator.js')
-rw-r--r--js/mediators/io-mediator.js48
1 files changed, 1 insertions, 47 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 07a139c0..6c2147c8 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -260,17 +260,6 @@ exports.IoMediator = Montage.create(Component, {
260 } 260 }
261 } 261 }
262 } 262 }
263
264
265 /////////////////////////////////////////////////////////////////////////////////////////
266 /////////////////////////////////////////////////////////////////////////////////////////
267
268 //TODO: Add logic for parse CSS string correct URLs since referencing is lost
269
270 /////////////////////////////////////////////////////////////////////////////////////////
271 /////////////////////////////////////////////////////////////////////////////////////////
272
273
274 //Checking for type of save: styles = <style> only | css = <style> and <link> (all CSS) 263 //Checking for type of save: styles = <style> only | css = <style> and <link> (all CSS)
275 if (template.styles) { 264 if (template.styles) {
276 //Getting all style tags 265 //Getting all style tags
@@ -313,7 +302,7 @@ exports.IoMediator = Montage.create(Component, {
313 if (template.css[i].ownerNode.getAttribute) { 302 if (template.css[i].ownerNode.getAttribute) {
314 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.css[i].ownerNode.getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll 303 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.css[i].ownerNode.getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll
315 //Inseting data from rules array into <style> as string 304 //Inseting data from rules array into <style> as string
316 if (docStyles[styleCounter]) { 305 if (docStyles[styleCounter] && !template.css[i].ownerNode.getAttribute('data-ninja-external-url')) {
317 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules); 306 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules);
318 styleCounter++; 307 styleCounter++;
319 } 308 }
@@ -349,41 +338,6 @@ exports.IoMediator = Montage.create(Component, {
349 return this.getUrlfromNinjaUrl(url, fileRootUrl, fileUrl); 338 return this.getUrlfromNinjaUrl(url, fileRootUrl, fileUrl);
350 } 339 }
351 340
352 /*
353function parseNinjaUrl (url) {
354 //console.log("Getting: " + url);
355 //
356 if (url.indexOf(fileRootUrl) !== -1) {
357 url = url.replace(new RegExp(fileRootUrl.replace(/\//gi, '\\\/'), 'gi'), '');
358 } else {
359 var assetsDirs = (url.replace(new RegExp((this.application.ninja.coreIoApi.rootUrl).replace(/\//gi, '\\\/'), 'gi'), '')).split('/');
360 var fileDirs = (fileUrl.split(fileUrl.split('/')[fileUrl.split('/').length-1])[0]).split('/');
361 var counter = 0;
362 var path = '';
363 var newURL = '';
364 //
365 for (var p=0; p < fileDirs.length-1; p++) {
366 if (fileDirs[p] === assetsDirs[p]) {
367 counter++;
368 }
369 }
370 //
371 for (var p=0; p < (fileDirs.length-counter)-1; p++) {
372 path += '../';
373 }
374 //
375 for (var p=counter; p < assetsDirs.length; p++) {
376 newURL += '/'+assetsDirs[p];
377 }
378 //
379 url = (path+newURL).replace(/\/\//gi, '/');
380 }
381 //console.log("Returning: " + url);
382 //console.log("-----");
383 return url;
384 }
385*/
386
387 /////////////////////////////////////////////////////////////////////////////////////////// 341 ///////////////////////////////////////////////////////////////////////////////////////////
388 /////////////////////////////////////////////////////////////////////////////////////////// 342 ///////////////////////////////////////////////////////////////////////////////////////////
389 343