From ff57e780d17e35dfdbfa6044bc0416145851f5c9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 22 May 2012 00:03:32 -0700 Subject: Adding support for reading webgl external files For author-time, run-time is already checked in and supported. --- js/document/views/design.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/document/views/design.js b/js/document/views/design.js index 3f58650e..76a36323 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -324,7 +324,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { initWebGl: { value: function (scripttags) { // - var n, webgldata; + var n, webgldata, fileRead; //Setting the iFrame property for reference in helper class this.model.webGlHelper.iframe = this.model.views.design.iframe; //Checking for webGL Data @@ -336,6 +336,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { if (scripttags[w].getAttribute('data-ninja-webgl') !== null) { //TODO: Add logic to handle more than one data tag webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", "")); + } else if (scripttags[w].getAttribute('data-ninja-canvas-json') !== null) { + //TODO: Add check for hardcoded URL + fileRead = this.application.ninja.ioMediator.fio.readFile({uri: this.application.ninja.documentController.documentHackReference.root+scripttags[w].getAttribute('data-ninja-canvas-json')}); + // + if (fileRead.status === 204) { + webgldata = JSON.parse((fileRead.file.content.replace("(", "")).replace(")", "")); + } else { + //Error + } } //Checking for webGL data and building data array if (webgldata && webgldata.data) { -- cgit v1.2.3