aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/views')
-rwxr-xr-xjs/document/views/design.js32
1 files changed, 27 insertions, 5 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 6cce229c..8c6ace8e 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -65,7 +65,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
65 //////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////
66 // 66 //
67 render: { 67 render: {
68 value: function (callback) { 68 value: function (callback, template) {//TODO: Add support for templates
69 //Storing callback for dispatch ready 69 //Storing callback for dispatch ready
70 this._callback = callback; 70 this._callback = callback;
71 //Adding listener to know when template is loaded to then load user content 71 //Adding listener to know when template is loaded to then load user content
@@ -116,6 +116,8 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
116 this.document.head.appendChild(this._headFragment.childNodes[i]); 116 this.document.head.appendChild(this._headFragment.childNodes[i]);
117 } 117 }
118 } 118 }
119 //Garbage collection
120 this._headFragment = null;
119 } 121 }
120 }, 122 },
121 //////////////////////////////////////////////////////////////////// 123 ////////////////////////////////////////////////////////////////////
@@ -129,13 +131,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
129 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); 131 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]);
130 //Getting style and link tags in document 132 //Getting style and link tags in document
131 var stags = this.document.getElementsByTagName('style'), 133 var stags = this.document.getElementsByTagName('style'),
132 ltags = this.document.getElementsByTagName('link'); 134 ltags = this.document.getElementsByTagName('link'),
135 scripttags = this.document.getElementsByTagName('script'),
136 i, n, webgldata;
133 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles) 137 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles)
134 this.ninjaDisableAttribute(stags); 138 this.ninjaDisableAttribute(stags);
135 this.ninjaDisableAttribute(ltags); 139 this.ninjaDisableAttribute(ltags);
136 //Looping through all link tags to reload into style tags 140 //Looping through all link tags to reload into style tags
137 if(ltags.length > 0) { 141 if(ltags.length > 0) {
138 for (var i = 0; i < ltags.length; i++) { 142 for (i = 0; i < ltags.length; i++) {
139 // 143 //
140 if (ltags[i].href) { 144 if (ltags[i].href) {
141 //TODO: Verify this works for tags in body as well (working in head) 145 //TODO: Verify this works for tags in body as well (working in head)
@@ -148,8 +152,26 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
148 } 152 }
149 } 153 }
150 } 154 }
151 155 //Checking for webGL Data
152 //TODO: Load webGL (blocking) 156 for (var w in scripttags) {
157 //
158 webgldata = null;
159 //
160 if (scripttags[w].getAttribute) {
161 if (scripttags[w].getAttribute('data-ninja-webgl') !== null) {
162 //TODO: Add logic to handle more than one data tag
163 webgldata = JSON.parse((scripttags[w].innerHTML.replace("(", "")).replace(")", ""));
164 }
165 //
166 if (webgldata) {
167 for (n = 0; webgldata.data[n]; n++) {
168 webgldata.data[n] = unescape(webgldata.data[n]);
169 }
170 //this._templateDocument.webgl = webgldata.data;
171 this.model.glData = webgldata.data;
172 }
173 }
174 }
153 175
154 //TODO: Load Montage Components (blocking) 176 //TODO: Load Montage Components (blocking)
155 177