aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/io-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators/io-mediator.js')
-rw-r--r--js/mediators/io-mediator.js28
1 files changed, 7 insertions, 21 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 472b3004..d81f4543 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -408,7 +408,7 @@ exports.IoMediator = Montage.create(Component, {
408 if (!webgllibtag) { 408 if (!webgllibtag) {
409 webgllibtag = template.document.content.document.createElement('script'); 409 webgllibtag = template.document.content.document.createElement('script');
410 webgllibtag.setAttribute('type', 'text/javascript'); 410 webgllibtag.setAttribute('type', 'text/javascript');
411 webgllibtag.setAttribute('src', rdgeDirName+'/CanvasRuntime.js'); 411 webgllibtag.setAttribute('src', rdgeDirName+'/canvas-runtime.js');
412 webgllibtag.setAttribute('data-ninja-webgl-lib', 'true'); 412 webgllibtag.setAttribute('data-ninja-webgl-lib', 'true');
413 template.document.content.document.head.appendChild(webgllibtag); 413 template.document.content.document.head.appendChild(webgllibtag);
414 } 414 }
@@ -425,31 +425,17 @@ exports.IoMediator = Montage.create(Component, {
425 webgljstag.setAttribute('data-ninja-webgl-js', 'true'); 425 webgljstag.setAttribute('data-ninja-webgl-js', 'true');
426 template.document.content.document.head.appendChild(webgljstag); 426 template.document.content.document.head.appendChild(webgljstag);
427 } 427 }
428
429 /////////////////////////////////////////////////////////////////////////////
430 /////////////////////////////////////////////////////////////////////////////
431 //TODO: Decide if this should be over-writter or only written on creation 428 //TODO: Decide if this should be over-writter or only written on creation
429 var rootElement = 'document.body'; //TODO: Set actual root element
432 webgljstag.innerHTML = "\ 430 webgljstag.innerHTML = "\
433//Loading webGL/canvas data on window load\n\ 431//Loading webGL/canvas data on window load\n\
434window.addEventListener('load', initWebGl, false);\n\ 432window.addEventListener('load', loadWebGL, false);\n\
435function initWebGl (e) {\n\ 433function loadWebGL (e) {\n\
436 window.removeEventListener('load', initWebGl, false);\n\ 434 window.removeEventListener('load', loadWebGL, false);\n\
437 var cvsDataMngr, ninjaWebGlData = JSON.parse((document.querySelectorAll(['script[data-ninja-webgl]'])[0].innerHTML.replace(\"(\", \"\")).replace(\")\", \"\"));\n\ 435 //Calling method to initialize all webGL/canvas(es)\n\
438 if (ninjaWebGlData && ninjaWebGlData.data) {\n\ 436 initWebGl("+rootElement+", '"+rdgeDirName+"/');\n\
439 for (var n=0; ninjaWebGlData.data[n]; n++) {\n\
440 ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]);\n\
441 }\n\
442 }\n\
443 //Creating data manager\n\
444 cvsDataMngr = new CanvasDataManager();\n\
445 //Loading data to canvas(es)\n\
446 cvsDataMngr.loadGLData(document.body, ninjaWebGlData.data, '"+rdgeDirName+"/');\n\
447}\ 437}\
448 "; 438 ";
449 /////////////////////////////////////////////////////////////////////////////
450 /////////////////////////////////////////////////////////////////////////////
451 /////////////////////////////////////////////////////////////////////////////
452
453 //TODO: This data should be saved to a JSON file eventually 439 //TODO: This data should be saved to a JSON file eventually
454 json = '\n({\n\t"version": "'+rdgeVersion+'",\n\t"directory": "'+rdgeDirName+'/",\n\t"data": ['; 440 json = '\n({\n\t"version": "'+rdgeVersion+'",\n\t"directory": "'+rdgeDirName+'/",\n\t"data": [';
455 //Looping through data to create escaped array 441 //Looping through data to create escaped array