diff options
Diffstat (limited to 'js')
62 files changed, 478 insertions, 12887 deletions
diff --git a/js/components/focus-manager.reel/focus-manager.js b/js/components/focus-manager.reel/focus-manager.js new file mode 100644 index 00000000..65a84bc1 --- /dev/null +++ b/js/components/focus-manager.reel/focus-manager.js | |||
@@ -0,0 +1,49 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.FocusManager = Montage.create(Component, { | ||
11 | |||
12 | hasTemplate: { | ||
13 | value: false | ||
14 | }, | ||
15 | |||
16 | element: { | ||
17 | serializable: true, | ||
18 | enumerable: true, | ||
19 | get: function() { | ||
20 | return this._element; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | // call super set | ||
24 | Object.getPropertyDescriptor(Component, "element").set.call(this, value); | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | hiddenInput: { | ||
29 | value: null | ||
30 | }, | ||
31 | |||
32 | prepareForDraw: { | ||
33 | value: function() { | ||
34 | this.hiddenInput = document.createElement("input"); | ||
35 | this.hiddenInput.type = "text"; | ||
36 | |||
37 | this.element.appendChild(this.hiddenInput); | ||
38 | |||
39 | } | ||
40 | }, | ||
41 | |||
42 | setFocus: { | ||
43 | value: function() { | ||
44 | this.hiddenInput.focus(); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | }); | ||
49 | |||
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 9f00604f..70aba54e 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -51,23 +51,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
51 | 51 | ||
52 | setAttribute: { | 52 | setAttribute: { |
53 | value: function(el, att, value) { | 53 | value: function(el, att, value) { |
54 | if(att === "id") { | ||
55 | if(value === "") { | ||
56 | el.setAttribute(att, value); | ||
57 | return; | ||
58 | } | ||
59 | |||
60 | // Then check if this is a valid id by the following spec: http://www.w3.org/TR/REC-html40/types.html#h-6.2 | ||
61 | var regexID = /^([a-zA-Z])+([a-zA-Z0-9_\.\:\-])+/; | ||
62 | if(!regexID.test(value)) { | ||
63 | alert("Invalid ID"); | ||
64 | return; | ||
65 | } else if (this.application.ninja.currentDocument._document.getElementById(value) !== null) { | ||
66 | alert("The following ID: " + value + " is already in Use"); | ||
67 | } | ||
68 | |||
69 | } | ||
70 | |||
71 | el.setAttribute(att, value); | 54 | el.setAttribute(att, value); |
72 | } | 55 | } |
73 | }, | 56 | }, |
diff --git a/js/document/html-document.js b/js/document/html-document.js index 051490f5..d4db6e2f 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -207,9 +207,18 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
207 | }, | 207 | }, |
208 | set: function(value) { | 208 | set: function(value) { |
209 | var elt = this.documentRoot; | 209 | var elt = this.documentRoot; |
210 | if (elt) { | 210 | if (elt) |
211 | { | ||
211 | var nWorlds= value.length; | 212 | var nWorlds= value.length; |
212 | for (var i=0; i<nWorlds; i++) { | 213 | for (var i=0; i<nWorlds; i++) |
214 | { | ||
215 | /* | ||
216 | // Use this code to test the runtime version of WebGL | ||
217 | var cdm = new CanvasDataManager(); | ||
218 | cdm.loadGLData(elt, value, null ); | ||
219 | */ | ||
220 | |||
221 | // /* | ||
213 | var importStr = value[i]; | 222 | var importStr = value[i]; |
214 | var startIndex = importStr.indexOf( "id: " ); | 223 | var startIndex = importStr.indexOf( "id: " ); |
215 | if (startIndex >= 0) { | 224 | if (startIndex >= 0) { |
@@ -236,6 +245,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
236 | } | 245 | } |
237 | } | 246 | } |