aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorhwc4872012-03-09 14:31:18 -0800
committerhwc4872012-03-09 14:31:18 -0800
commitba0e84e74293c10817f9377f66c9dcfa0a15ce60 (patch)
tree0cde5f80f0b1a1da904cbab84418ae480cd8abb5 /js/mediators
parenta5d4d57a3575bb3b97fe692ddffca3127463ae94 (diff)
parent30c20960190e76cdcff0a3b2036c881dc751e05e (diff)
downloadninja-ba0e84e74293c10817f9377f66c9dcfa0a15ce60.tar.gz
Merge branch 'FileIO-Integration' of github.com:joseeight/ninja-internal into integration
Conflicts: js/document/html-document.js
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 277b3a1b..d26c7a88 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -361,7 +361,7 @@ exports.IoMediator = Montage.create(Component, {
361 } 361 }
362 } 362 }
363 // 363 //
364 var json, matchingtags = [], webgltag, scripts = template.document.content.document.getElementsByTagName('script'), webgljstag, webgllibtag; 364 var json, matchingtags = [], webgltag, scripts = template.document.content.document.getElementsByTagName('script'), webgljstag, webgllibtag, webglrdgetag;
365 // 365 //
366 for (var i in scripts) { 366 for (var i in scripts) {
367 if (scripts[i].getAttribute) { 367 if (scripts[i].getAttribute) {
@@ -374,6 +374,9 @@ exports.IoMediator = Montage.create(Component, {
374 if (scripts[i].getAttribute('data-ninja-webgl-lib') !== null) { 374 if (scripts[i].getAttribute('data-ninja-webgl-lib') !== null) {
375 webgllibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags 375 webgllibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags
376 } 376 }
377 if (scripts[i].getAttribute('data-ninja-webgl-rdge') !== null) {
378 webglrdgetag = scripts[i]; // TODO: Add logic to delete unneccesary tags
379 }
377 } 380 }
378 } 381 }
379 // 382 //
@@ -386,6 +389,14 @@ exports.IoMediator = Montage.create(Component, {
386 } 389 }
387 } 390 }
388 // 391 //
392 if (!webglrdgetag) {
393 webglrdgetag = template.document.content.document.createElement('script');
394 webglrdgetag.setAttribute('type', 'text/javascript');
395 webglrdgetag.setAttribute('src', rdgeDirName+'/rdge-compiled.js');
396 webglrdgetag.setAttribute('data-ninja-webgl-rdge', 'true');
397 template.document.content.document.head.appendChild(webglrdgetag);
398 }
399 //
389 if (!webgllibtag) { 400 if (!webgllibtag) {
390 webgllibtag = template.document.content.document.createElement('script'); 401 webgllibtag = template.document.content.document.createElement('script');
391 webgllibtag.setAttribute('type', 'text/javascript'); 402 webgllibtag.setAttribute('type', 'text/javascript');
@@ -421,7 +432,7 @@ function initWebGl (e) {\n\
421 //Creating data manager\n\ 432 //Creating data manager\n\
422 cvsDataMngr = new CanvasDataManager();\n\ 433 cvsDataMngr = new CanvasDataManager();\n\
423 //Loading data to canvas(es)\n\ 434 //Loading data to canvas(es)\n\
424 cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data);\n\ 435 cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\
425}\ 436}\
426 "; 437 ";
427 //TODO: Add version and other data for RDGE 438 //TODO: Add version and other data for RDGE
@@ -437,11 +448,16 @@ function initWebGl (e) {\n\
437 //Closing array (make-shift JSON string to validate data in <script> tag) 448 //Closing array (make-shift JSON string to validate data in <script> tag)
438 json += '\n\t\t]\n})\n'; 449 json += '\n\t\t]\n})\n';
439 //Setting string in tag 450 //Setting string in tag
440 webgltag.innerHTML = json.replace(/assets\//gi, webGlDirSwap); 451 webgltag.innerHTML = json;
452 /*
453webgltag.innerHTML = json.replace(/assets\//gi, webGlDirSwap);
441 // 454 //
442 function webGlDirSwap (dir) { 455 function webGlDirSwap (dir) {
443 return rdgeDirName+'/'; 456 return rdgeDirName+'/';
444 } 457 }
458 //
459 console.log(webgltag.innerHTML);
460*/
445 } 461 }
446 //Cleaning URLs from HTML 462 //Cleaning URLs from HTML
447 var cleanHTML = template.document.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); 463 var cleanHTML = template.document.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this));