diff options
author | Jose Antonio Marquez | 2012-05-22 00:03:32 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-22 00:03:32 -0700 |
commit | ff57e780d17e35dfdbfa6044bc0416145851f5c9 (patch) | |
tree | 57289f739376b08e295e3ce225321b0cc7ac0a0c | |
parent | 0fbece034966094adf750f8be7148b503e801709 (diff) | |
download | ninja-ff57e780d17e35dfdbfa6044bc0416145851f5c9.tar.gz |
Adding support for reading webgl external files
For author-time, run-time is already checked in and supported.
-rwxr-xr-x | js/document/views/design.js | 11 |
1 files changed, 10 insertions, 1 deletions
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, { | |||
324 | initWebGl: { | 324 | initWebGl: { |
325 | value: function (scripttags) { | 325 | value: function (scripttags) { |
326 | // | 326 | // |
327 | var n, webgldata; | 327 | var n, webgldata, fileRead; |
328 | //Setting the iFrame property for reference in helper class | 328 | //Setting the iFrame property for reference in helper class |
329 | this.model.webGlHelper.iframe = this.model.views.design.iframe; | 329 | this.model.webGlHelper.iframe = this.model.views.design.iframe; |
330 | //Checking for webGL Data | 330 | //Checking for webGL Data |
@@ -336,6 +336,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
336 | if (scripttags[w].getAttribute('data-ninja-webgl') !== null) { | 336 | if (scripttags[w].getAttribute('data-ninja-webgl') !== null) { |
337 | //TODO: Add logic to handle more than one data tag | 337 | //TODO: Add logic to handle more than one data tag |
338 | webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", "")); | 338 | webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", "")); |
339 | } else if (scripttags[w].getAttribute('data-ninja-canvas-json') !== null) { | ||
340 | //TODO: Add check for hardcoded URL | ||
341 | fileRead = this.application.ninja.ioMediator.fio.readFile({uri: this.application.ninja.documentController.documentHackReference.root+scripttags[w].getAttribute('data-ninja-canvas-json')}); | ||
342 | // | ||
343 | if (fileRead.status === 204) { | ||
344 | webgldata = JSON.parse((fileRead.file.content.replace("(", "")).replace(")", "")); | ||
345 | } else { | ||
346 | //Error | ||
347 | } | ||
339 | } | 348 | } |
340 | //Checking for webGL data and building data array | 349 | //Checking for webGL data and building data array |
341 | if (webgldata && webgldata.data) { | 350 | if (webgldata && webgldata.data) { |