From c82ac0c0a0120f45c9bb4a42bdd2502d0cc77bdb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:38:25 -0700 Subject: cleanup and making the webgl-helper only loop canvas on file save Signed-off-by: Valerio Virgillito --- js/document/helpers/webgl-helper.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/document') diff --git a/js/document/helpers/webgl-helper.js b/js/document/helpers/webgl-helper.js index 84ddc547..6d9ced14 100755 --- a/js/document/helpers/webgl-helper.js +++ b/js/document/helpers/webgl-helper.js @@ -40,7 +40,7 @@ exports.webGlDocumentHelper = Montage.create(Component, { if (elt) { var matLib = MaterialsModel.exportMaterials(); this._glData = [matLib]; - this.collectGLData(elt, this._glData ); + this.collectGLData(this.iframe.contentWindow.document, this._glData ); } else { this._glData = null } @@ -96,10 +96,6 @@ exports.webGlDocumentHelper = Montage.create(Component, { canvas = this.findCanvasWithID(id, elt); // if (canvas) { - // - if (!canvas.elementModel) { - NJUtils.makeElementModel(canvas, "Canvas", "shape", true); - } // if (canvas.elementModel) { if (canvas.elementModel.shapeModel.GLWorld) { @@ -194,6 +190,13 @@ exports.webGlDocumentHelper = Montage.create(Component, { // collectGLData: { value: function( elt, dataArray ) { + Array.prototype.slice.call(elt.querySelectorAll('[data-RDGE-id]'),0).forEach(function(glCanvas) { + dataArray.push(glCanvas.elementModel.shapeModel.GLWorld.exportJSON()); + }); + + // Removing the old loop that went through all the elements. + // TODO: Remove the following code once QE has tested it. +/* // var i, data, nKids, child; // @@ -209,6 +212,7 @@ exports.webGlDocumentHelper = Montage.create(Component, { this.collectGLData( child, dataArray ); } } + */ } } //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From e28eb9158a50d7e6d97dbc68066e591ac600c241 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:40:44 -0700 Subject: removing all model creators. The elementModel is now a getter that will create a new model when needed. Signed-off-by: Valerio Virgillito --- js/document/document-html.js | 10 +++++++--- js/document/models/html.js | 23 ----------------------- js/document/templates/banner/index.html | 24 +++++++++++++++++++++--- js/document/templates/html/index.html | 27 +++++++++++++++++++++++---- js/document/views/design.js | 30 ++++++++++++++++++++++++++---- 5 files changed, 77 insertions(+), 37 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index 33a41a8e..4a8d5d41 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -88,7 +88,7 @@ exports.HtmlDocument = Montage.create(Component, { //Adding observer to know when template is ready this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); this._observer.observe(this.model.views.design.document.head, {childList: true}); - }.bind(this), template); + }.bind(this), template, {viewCallback: this.handleViewReady, context: this}); } else { //TODO: Identify default view (probably code) } @@ -101,10 +101,14 @@ exports.HtmlDocument = Montage.create(Component, { //Removing observer, only needed on initial load this._observer.disconnect(); this._observer = null; - //Making callback after view is loaded - this.loaded.callback.call(this.loaded.context, this); } }, + handleViewReady: { + value: function() { + //Making callback after view is loaded + this.loaded.callback.call(this.loaded.context, this); + } + }, //////////////////////////////////////////////////////////////////// // closeDocument: { diff --git a/js/document/models/html.js b/js/document/models/html.js index 9aa0d27e..a367f95f 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -62,33 +62,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { webGlHelper: { value: null }, - //////////////////////////////////////////////////////////////////// - // - userComponents: { - value: {} - }, //////////////////////////////////////////////////////////////////// // documentRoot: { value: null - }, - //////////////////////////////////////////////////////////////////// - //Add a reference to a component instance to the userComponents hash using the element UUID - setComponentInstance: { - value: function(instance, el) { - this.userComponents[el.uuid] = instance; - } - }, - //////////////////////////////////////////////////////////////////// - //Returns the component instance obj from the element - getComponentFromElement: { - value: function(el) { - if(el) { - if(el.uuid) return this.userComponents[el.uuid]; - } else { - return null; - } - } } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html index f1ee3d98..08a998e5 100755 --- a/js/document/templates/banner/index.html +++ b/js/document/templates/banner/index.html @@ -74,9 +74,27 @@ diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index 70187900..c74a7251 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html @@ -57,13 +57,32 @@ .nj-element-highlight { outline: 4px solid #ff0000; - } + } diff --git a/js/document/views/design.js b/js/document/views/design.js index f7fbf3c5..0e42dcc2 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -7,7 +7,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // var Montage = require("montage/core/core").Montage, - BaseDocumentView = require("js/document/views/base").BaseDocumentView; + BaseDocumentView = require("js/document/views/base").BaseDocumentView, + ElementModel = require("js/models/element-model"); //////////////////////////////////////////////////////////////////////// // exports.DesignDocumentView = Montage.create(BaseDocumentView, { @@ -21,6 +22,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { _callback: { value: null }, + //////////////////////////////////////////////////////////////////// + // + _viewCallback: { + value: null + }, //////////////////////////////////////////////////////////////////// // _template: { @@ -104,12 +110,13 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // render: { - value: function (callback, template) { + value: function (callback, template, viewCallback) { //TODO: Remove, this is a temp patch for webRequest API gate this.application.ninja.documentController.redirectRequests = false; //Storing callback for dispatch ready this._callback = callback; this._template = template; + this._viewCallback = viewCallback; //Adding listener to know when template is loaded to then load user content this.iframe.addEventListener("load", this.onTemplateLoad.bind(this), false); //TODO: Add source parameter and root (optional) @@ -264,6 +271,10 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } } } + + // Assign the modelGenerator reference from the template to our own modelGenerator + this.document.modelGenerator = ElementModel.modelGenerator; + //Checking for script tags then parsing check for montage and webgl if (scripttags.length > 0) { //Checking and initializing webGL @@ -272,6 +283,9 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { this.initMontage(scripttags); } else { //Else there is not data to parse + if(this._viewCallback) { + this._viewCallback.viewCallback.call(this._viewCallback.context); + } } //TODO: Verify appropiate location for this operation if (this._template && this._template.type === 'banner') { @@ -287,8 +301,9 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { for (var n in orgNodes) { if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); } - //Initiliazing document model - document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); + + + //Makign callback if specified if (this._callback) this._callback(); } @@ -395,6 +410,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { // initMontage: { value: function (scripttags) { + var self = this; // this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { //Initializing template with user's seriliazation @@ -406,6 +422,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //Forcing draw on components template._deserializer._objects[c].needsDraw = true; } + + // Now call the view callback + if(self._viewCallback) { + self._viewCallback.viewCallback.call(self._viewCallback.context); + } + }); }.bind(this), false); } -- cgit v1.2.3 From 6a0f150f49be656e0725bc77b452a3141dddd47c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 6 Jun 2012 13:46:02 -0700 Subject: Cleaning up Removed reference of model in design view, clean up slightly, need to implement binding later. --- js/document/document-html.js | 4 +++- js/document/models/base.js | 37 ++++++++++++++++++++--------------- js/document/models/html.js | 25 ++++++++++++++---------- js/document/views/design.js | 46 +++++++++++++++++++++++++++++++------------- 4 files changed, 72 insertions(+), 40 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index 33a41a8e..c9acd2e0 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -68,6 +68,8 @@ exports.HtmlDocument = Montage.create(Component, { if (this.model.views.design.initialize(this.model.parentContainer)) { //Hiding iFrame, just initiliazing this.model.views.design.hide(); + //Setting the iFrame property for reference in helper class + this.model.webGlHelper.iframe = this.model.views.design.iframe; } else { //ERROR: Design View not initialized } @@ -82,7 +84,7 @@ exports.HtmlDocument = Montage.create(Component, { this.model.views.design.iframe.style.opacity = 0; this.model.views.design.content = this.model.file.content; //TODO: Improve reference (probably through binding values) - this.model.views.design.model = this.model; + this.model.views.design._webGlHelper = this.model.webGlHelper; //Rendering design view, using observers to know when template is ready this.model.views.design.render(function () { //Adding observer to know when template is ready diff --git a/js/document/models/base.js b/js/document/models/base.js index 0957145a..a3644815 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -65,7 +65,8 @@ exports.BaseDocumentModel = Montage.create(Component, { _selection: { value: [] }, - + //////////////////////////////////////////////////////////////////// + // selection: { get: function() { return this._selection; @@ -134,20 +135,22 @@ exports.BaseDocumentModel = Montage.create(Component, { } }, //////////////////////////////////////////////////////////////////// - // + //Gets all stylesheets in document getStyleSheets: { value: function () { - // + //Array to store styles (style and link tags) var styles = []; - // + //Looping through document sytles for (var k in this.views.design.iframe.contentWindow.document.styleSheets) { + //Check for styles to has proper propeties if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode && this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute) { + //Check for ninja-template styles, if so, exclude if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute('data-ninja-template') === null) { styles.push(this.views.design.iframe.contentWindow.document.styleSheets[k]); } } } - // + //Returning filtered results return styles; } }, @@ -155,7 +158,7 @@ exports.BaseDocumentModel = Montage.create(Component, { // save: { value: function (callback, libCopyCallback) { - // + //TODO: Implement on demand logic if (this.needsSave) { //Save } else { @@ -184,7 +187,7 @@ exports.BaseDocumentModel = Montage.create(Component, { // saveAll: { value: function (callback, libCopyCallback) { - // + //TODO: Implement on demand logic if (this.needsSave) { //Save } else { @@ -214,47 +217,49 @@ exports.BaseDocumentModel = Montage.create(Component, { // saveAs: { value: function (callback) { - // + //TODO: Implement on demand logic if (this.needsSave) { //Save current file on memory } else { //Copy file from disk } + //TODO: Add functionality } }, //////////////////////////////////////////////////////////////////// // handleSaved: { value: function (result) { - // + //Checking for success code in save if (result.status === 204) { + //Clearing flag with successful save this.model.needsSave = false; } - // + //Making callback call if specifed with results of operation if (this.callback) this.callback(result); } }, //////////////////////////////////////////////////////////////////// - // + //TODO: Implement better logic to include different views on single document close: { value: function (view, callback) { //Outcome of close (pending on save logic) var success; // if (this.needsSave) { - //Prompt user to save of lose data + //TODO: Prompt user to save or lose data } else { //Close file success = true; } - // + //Checking for view mode to close if (this.views.design && (!view || view === 'design')) { - // + //TODO: Create a destroy method, this is messy + this.views.design.pauseAndStopVideos(); this.parentContainer.removeChild(this.views.design.iframe); - this.views.design.pauseAndStopVideos(); this.views.design = null; } - // + //Returning result of operation return success; } } diff --git a/js/document/models/html.js b/js/document/models/html.js index 9aa0d27e..0f88229d 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -40,22 +40,32 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { scrollLeft: { value: null }, - + //////////////////////////////////////////////////////////////////// + // scrollTop: { value: null }, - + //////////////////////////////////////////////////////////////////// + // userContentLeft: { value: null }, - + //////////////////////////////////////////////////////////////////// + // userContentTop: { value: null }, //////////////////////////////////////////////////////////////////// - // + //TODO: Convert to bindings + documentRoot: { + get: function() {return this.views.design._documentRoot;}, + set: function(value) {this.views.design._documentRoot = value;} + }, + //////////////////////////////////////////////////////////////////// + //TODO: Convert to bindings baseHref: { - value: null + get: function() {return this.views.design._baseHref;}, + set: function(value) {this.views.design._baseHref = value;} }, //////////////////////////////////////////////////////////////////// // @@ -66,11 +76,6 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { // userComponents: { value: {} - }, - //////////////////////////////////////////////////////////////////// - // - documentRoot: { - value: null }, //////////////////////////////////////////////////////////////////// //Add a reference to a component instance to the userComponents hash using the element UUID diff --git a/js/document/views/design.js b/js/document/views/design.js index f7fbf3c5..53590944 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -51,11 +51,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { content: { value: null }, - //////////////////////////////////////////////////////////////////// - //TODO: Remove usage - model: { - value: null - }, //////////////////////////////////////////////////////////////////// // document: { @@ -69,6 +64,33 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { }, //////////////////////////////////////////////////////////////////// // + _baseHref: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + baseHref: { + get: function() {return this._baseHref;}, + set: function(value) {this._baseHref = value;} + }, + //////////////////////////////////////////////////////////////////// + // + _documentRoot: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + documentRoot: { + get: function() {return this._documentRoot;}, + set: function(value) {this._documentRoot = value;} + }, + //////////////////////////////////////////////////////////////////// + // + _webGlHelper: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // getLiveNodeList: { value: function(useFilter) { if(useFilter) { @@ -142,7 +164,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { if (basetag.length) { if (basetag[basetag.length-1].getAttribute && basetag[basetag.length-1].getAttribute('href')) { //Setting base HREF in model - this.model.baseHref = basetag[basetag.length-1].getAttribute('href'); + this.baseHref = basetag[basetag.length-1].getAttribute('href'); } } //Checking to content to be template @@ -275,12 +297,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } //TODO: Verify appropiate location for this operation if (this._template && this._template.type === 'banner') { - this.model.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; + this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; } else { - this.model.documentRoot = this.document.body; + this.documentRoot = this.document.body; } //Storing node list for reference (might need to store in the model) - this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); + this._liveNodeList = this.documentRoot.getElementsByTagName('*'); //Getting list of original nodes orgNodes = this.document.getElementsByTagName('*'); //TODO: Figure out if this is ideal for identifying nodes created by Ninja @@ -288,7 +310,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); } //Initiliazing document model - document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); + document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); //Makign callback if specified if (this._callback) this._callback(); } @@ -358,8 +380,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { value: function (scripttags) { // 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 for (var w in scripttags) { // @@ -385,7 +405,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { webgldata.data[n] = unescape(webgldata.data[n]); } //TODO: Improve setter of webGL and reference - this.model.webGlHelper.glData = webgldata.data; + this._webGlHelper.glData = webgldata.data; } } } -- cgit v1.2.3 From 98d8cf7fdc1b14a6ac4eaa54f9086a558f3a60cb Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 6 Jun 2012 13:50:05 -0700 Subject: Cleaning more. --- js/document/views/design.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'js/document') diff --git a/js/document/views/design.js b/js/document/views/design.js index 53590944..5af24546 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -26,11 +26,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { _template: { value: null }, - //////////////////////////////////////////////////////////////////// - // - _document: { - value: null - }, //////////////////////////////////////////////////////////////////// // _bodyFragment: { @@ -52,14 +47,13 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { value: null }, //////////////////////////////////////////////////////////////////// - // - document: { - get: function() {return this._document;}, - set: function(value) {this._document = value;} + // + _liveNodeList: { + value: null }, //////////////////////////////////////////////////////////////////// // - _liveNodeList: { + _webGlHelper: { value: null }, //////////////////////////////////////////////////////////////////// @@ -73,6 +67,17 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { get: function() {return this._baseHref;}, set: function(value) {this._baseHref = value;} }, + //////////////////////////////////////////////////////////////////// + // + _document: { + value: null + }, + //////////////////////////////////////////////////////////////////// + // + document: { + get: function() {return this._document;}, + set: function(value) {this._document = value;} + }, //////////////////////////////////////////////////////////////////// // _documentRoot: { @@ -86,11 +91,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { }, //////////////////////////////////////////////////////////////////// // - _webGlHelper: { - value: null - }, - //////////////////////////////////////////////////////////////////// - // getLiveNodeList: { value: function(useFilter) { if(useFilter) { -- cgit v1.2.3 From 0efbbf8287517b755be1774f6aa49947bed50a0d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 7 Jun 2012 11:24:29 -0700 Subject: Adding unique ID to canvas data folders Also set up for tracking ID created, will be adding support for parsing files without saving later, but flag is now present. --- js/document/mediators/template.js | 49 ++++++++++++++++++++++----------------- js/document/models/base.js | 33 ++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 23 deletions(-) (limited to 'js/document') diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 068a1f48..c9d46f79 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js @@ -8,7 +8,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot // var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, - TemplateCreator = require("node_modules/tools/template/template-creator").TemplateCreator; + TemplateCreator = require("node_modules/tools/template/template-creator").TemplateCreator, + ClassUuid = require("js/components/core/class-uuid").ClassUuid; //////////////////////////////////////////////////////////////////////// // exports.TemplateDocumentMediator = Montage.create(Component, { @@ -93,7 +94,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //TODO: Expand to allow more templates, clean up variables parseNinjaTemplateToHtml: { - value: function (template, ninjaWrapper, libCopyCallback) { + value: function (saveExternalData, template, ninjaWrapper, libCopyCallback) { //TODO: Improve reference for rootUrl var regexRootUrl, rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), @@ -328,7 +329,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { - //TODO: Make proper webGL/Canvas method + // var webgltag, webgllibtag, webglrdgetag, mjstag, mjslibtag, matchingtags = [], @@ -357,19 +358,33 @@ exports.TemplateDocumentMediator = Montage.create(Component, { } } } + + + + + //TODO: Make proper webGL/Canvas method + + //Checking for webGL elements in document if (template.webgl && template.webgl.length > 1) {//TODO: Should be length 0, hack for a temp fix var rdgeDirName, rdgeVersion, cvsDataDir = this.getCanvasDirectory(template.file.root), fileCvsDir, fileCvsDirAppend, cvsDirCounter = 1, fileOrgDataSrc; // if (cvsDataDir && !matchingtags.length && !webgllibtag) { - fileCvsDir = cvsDataDir+template.file.name.split('.'+template.file.extension)[0]; + + if (template.libs.canvasId) { + libsobserver.canvasId = template.libs.canvasId; + } else { + libsobserver.canvasId = ClassUuid.generate(); + } + + //Creating data directory, will include materials at a later time + fileCvsDir = cvsDataDir+template.file.name.split('.'+template.file.extension)[0]+'_'+libsobserver.canvasId; + if (!this._getUserDirectory(fileCvsDir)) { - fileCvsDirAppend = fileCvsDir+cvsDirCounter; - while (!this._getUserDirectory(fileCvsDirAppend)) { - fileCvsDirAppend = fileCvsDir+(cvsDirCounter++); - } + //TODO: create proper logic not to overwrite files + console.log('error'); } - //TODO: Allow user overwrite + fileCvsDir += '/'; } else if (webgllibtag && webgllibtag.getAttribute && webgllibtag.getAttribute('data-ninja-canvas-json') !== null) { fileOrgDataSrc = template.file.root+webgllibtag.getAttribute('data-ninja-canvas-json'); @@ -437,17 +452,9 @@ exports.TemplateDocumentMediator = Montage.create(Component, { //Looping through data to create escaped array for (var j = 0; template.webgl[j]; j++) { if (j === 0) { - //if (fileCvsDir) { - // json += '\n\t\t\t"' + template.webgl[j] + '"'; - //} else { - json += '\n\t\t\t"' + escape(template.webgl[j]) + '"'; - //} + json += '\n\t\t\t"' + escape(template.webgl[j]) + '"'; } else { - //if (fileCvsDir) { - // json += ',\n\t\t\t"' + template.webgl[j] + '"'; - //} else { - json += ',\n\t\t\t"' + escape(template.webgl[j]) + '"'; - //} + json += ',\n\t\t\t"' + escape(template.webgl[j]) + '"'; } } //Closing array (make-shift JSON string to validate data in