aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 277b3a1b..ffae0192 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,14 @@ 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*/
445 } 459 }
446 //Cleaning URLs from HTML 460 //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)); 461 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));