diff options
Diffstat (limited to 'js/lib')
29 files changed, 183 insertions, 183 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index e924e1b8..b7cb28e9 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -39,7 +39,7 @@ var Montage = require("montage/core/core").Montage, | |||
39 | exports.NJUtils = Montage.create(Component, { | 39 | exports.NJUtils = Montage.create(Component, { |
40 | 40 | ||
41 | /* =============== DOM Access ================ */ | 41 | /* =============== DOM Access ================ */ |
42 | 42 | ||
43 | ///// Quick "getElementById" | 43 | ///// Quick "getElementById" |
44 | $ : { | 44 | $ : { |
45 | value: function(id, doc) { | 45 | value: function(id, doc) { |
@@ -47,7 +47,7 @@ exports.NJUtils = Montage.create(Component, { | |||
47 | return doc.getElementById(id); | 47 | return doc.getElementById(id); |
48 | } | 48 | } |
49 | }, | 49 | }, |
50 | 50 | ||
51 | ///// Quick "getElementsByClassName" which also returns as an Array | 51 | ///// Quick "getElementsByClassName" which also returns as an Array |
52 | ///// Can return as NodeList by passing true as second argument | 52 | ///// Can return as NodeList by passing true as second argument |
53 | $$ : { | 53 | $$ : { |
@@ -57,7 +57,7 @@ exports.NJUtils = Montage.create(Component, { | |||
57 | return (asNodeList) ? list : this.toArray(list); | 57 | return (asNodeList) ? list : this.toArray(list); |
58 | } | 58 | } |
59 | }, | 59 | }, |
60 | 60 | ||
61 | ///// Get child nodes of element | 61 | ///// Get child nodes of element |
62 | ///// Omit filter to only return element nodes | 62 | ///// Omit filter to only return element nodes |
63 | ///// Pass in filter function to minimize collection, or | 63 | ///// Pass in filter function to minimize collection, or |
@@ -70,9 +70,9 @@ exports.NJUtils = Montage.create(Component, { | |||
70 | return this.toArray(el.childNodes).filter(f); | 70 | return this.toArray(el.childNodes).filter(f); |
71 | } | 71 | } |
72 | }, | 72 | }, |
73 | 73 | ||
74 | /* ============= DOM Manipulation ============= */ | 74 | /* ============= DOM Manipulation ============= */ |
75 | 75 | ||
76 | ///// Creates and returns text node from string | 76 | ///// Creates and returns text node from string |
77 | textNode : { | 77 | textNode : { |
78 | value: function(text) { | 78 | value: function(text) { |
@@ -95,7 +95,7 @@ exports.NJUtils = Montage.create(Component, { | |||
95 | return el; | 95 | return el; |
96 | } | 96 | } |
97 | }, | 97 | }, |
98 | 98 | ||
99 | decor: { | 99 | decor: { |
100 | value: function(el, attr) { | 100 | value: function(el, attr) { |
101 | if (typeof attr === 'object') { | 101 | if (typeof attr === 'object') { |
@@ -183,7 +183,7 @@ exports.NJUtils = Montage.create(Component, { | |||
183 | return node; | 183 | return node; |
184 | } | 184 | } |
185 | }, | 185 | }, |
186 | 186 | ||
187 | queryParentSelector : { | 187 | queryParentSelector : { |
188 | value: function(el, strSelector) { | 188 | value: function(el, strSelector) { |
189 | // queryParentSelector: | 189 | // queryParentSelector: |
@@ -191,7 +191,7 @@ exports.NJUtils = Montage.create(Component, { | |||
191 | // and find the first parent that matches selector strSelector (required). | 191 | // and find the first parent that matches selector strSelector (required). |
192 | // Returns: The element that matches, or false if there is no match | 192 | // Returns: The element that matches, or false if there is no match |
193 | // or if insufficient parameters are supplied. | 193 | // or if insufficient parameters are supplied. |
194 | 194 | ||
195 | if ((typeof(el) === "undefined") || (typeof(strSelector) === "undefined")) { | 195 | if ((typeof(el) === "undefined") || (typeof(strSelector) === "undefined")) { |
196 | // Parameters are required, m'kay? | 196 | // Parameters are required, m'kay? |
197 | return false; | 197 | return false; |
@@ -199,26 +199,26 @@ exports.NJUtils = Montage.create(Component, { | |||
199 | // You also have to use the right parameters. | 199 | // You also have to use the right parameters. |
200 | return false; | 200 | return false; |
201 | } | 201 | } |
202 | 202 | ||
203 | // First, get an empty clone of the parent. | 203 | // First, get an empty clone of the parent. |
204 | var myParent = el.parentNode; | 204 | var myParent = el.parentNode; |
205 | var clone = myParent.cloneNode(false); | 205 | var clone = myParent.cloneNode(false); |
206 | if (clone === null) { | 206 | if (clone === null) { |
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | 209 | ||
210 | // If we're at the top of the DOM, our clone will be an htmlDocument. | 210 | // If we're at the top of the DOM, our clone will be an htmlDocument. |
211 | // htmlDocument has no tagName. | 211 | // htmlDocument has no tagName. |
212 | if (typeof(clone.tagName) !== "undefined") { | 212 | if (typeof(clone.tagName) !== "undefined") { |
213 | // create a bogus div to use as a base for querySelector | 213 | // create a bogus div to use as a base for querySelector |
214 | var temp = document.createElement("div"); | 214 | var temp = document.createElement("div"); |
215 | 215 | ||
216 | // Append the clone to the bogus div | 216 | // Append the clone to the bogus div |
217 | temp.appendChild(clone); | 217 | temp.appendChild(clone); |
218 | 218 | ||
219 | // Now we can use querySelector! Sweet. | 219 | // Now we can use querySelector! Sweet. |
220 | var selectorTest = temp.querySelector(strSelector); | 220 | var selectorTest = temp.querySelector(strSelector); |
221 | 221 | ||
222 | // What has querySelector returned? | 222 | // What has querySelector returned? |
223 | if (selectorTest === null) { | 223 | if (selectorTest === null) { |
224 | // No match, so recurse. | 224 | // No match, so recurse. |
@@ -232,7 +232,7 @@ exports.NJUtils = Montage.create(Component, { | |||
232 | return false; | 232 | return false; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | }, | 236 | }, |
237 | 237 | ||
238 | // Returns the numerical value and unit string from a string. | 238 | // Returns the numerical value and unit string from a string. |
@@ -257,14 +257,14 @@ exports.NJUtils = Montage.create(Component, { | |||
257 | }, | 257 | }, |
258 | 258 | ||
259 | /* ================= Style methods ================= */ | 259 | /* ================= Style methods ================= */ |
260 | 260 | ||
261 | ///// Get computed height of element | 261 | ///// Get computed height of element |
262 | height : { | 262 | height : { |
263 | value: function(node, pseudo) { | 263 | value: function(node, pseudo) { |
264 | return node.ownerDocument.defaultView.getComputedStyle(node, pseudo).getPropertyValue('height'); | 264 | return node.ownerDocument.defaultView.getComputedStyle(node, pseudo).getPropertyValue('height'); |
265 | } | 265 | } |
266 | }, | 266 | }, |
267 | 267 | ||
268 | /* ================= Array methods ================= */ | 268 | /* ================= Array methods ================= */ |
269 | 269 | ||
270 | ///// Return an array from an array-like object | 270 | ///// Return an array from an array-like object |
@@ -273,9 +273,9 @@ exports.NJUtils = Montage.create(Component, { | |||
273 | return Array.prototype.slice.call(arrayLikeObj); | 273 | return Array.prototype.slice.call(arrayLikeObj); |
274 | } | 274 | } |
275 | }, | 275 | }, |
276 | 276 | ||
277 | /* ================= String methods ================= */ | 277 | /* ================= String methods ================= */ |
278 | 278 | ||
279 | ///// Return the last part of a path (e.g. filename) | 279 | ///// Return the last part of a path (e.g. filename) |
280 | getFileNameFromPath : { | 280 | getFileNameFromPath : { |
281 | value: function(path) { | 281 | value: function(path) { |
@@ -310,9 +310,9 @@ exports.NJUtils = Montage.create(Component, { | |||
310 | value: function(len) { | 310 | value: function(len) { |
311 | var length; | 311 | var length; |
312 | len ? length = len : length = 8; | 312 | len ? length = len : length = 8; |
313 | 313 | ||
314 | return Uuid.generate().substring(0,length); | 314 | return Uuid.generate().substring(0,length); |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | }); | 318 | }); |
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index b20b0a5d..08f9d319 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -68,7 +68,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { | |||
68 | { | 68 | { |
69 | this._2DContext = canvas.getContext( "2d" ); | 69 | this._2DContext = canvas.getContext( "2d" ); |
70 | } | 70 | } |
71 | 71 | ||
72 | this._viewportWidth = canvas.width; | 72 | this._viewportWidth = canvas.width; |
73 | this._viewportHeight = canvas.height; | 73 | this._viewportHeight = canvas.height; |
74 | 74 | ||
@@ -152,7 +152,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { | |||
152 | 152 | ||
153 | // Flag to play/pause animation at authortime | 153 | // Flag to play/pause animation at authortime |
154 | this._previewAnimation = true; | 154 | this._previewAnimation = true; |
155 | 155 | ||
156 | //////////////////////////////////////////////////////////////////////////////////// |