author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2012-03-17 21:08:23 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2012-03-17 21:08:23 (UTC) |
commit | 928f3f3ed3981f7f81b69ed94f2a315205db39fa (patch) (unidiff) | |
tree | 8a47229b56e4c906de8512baf0c5ca100bc03dfb | |
parent | bf7d8191a3a6dbd092a88911098a3e7f6cf30cf7 (diff) | |
download | clipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.zip clipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.tar.gz clipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.tar.bz2 |
Fixed frontend properties and updated MochiKit version
43 files changed, 623 insertions, 526 deletions
diff --git a/frontend/beta/properties/beta.properties.json b/frontend/beta/properties/beta.properties.json index 7b0c1f9..476becd 100644 --- a/frontend/beta/properties/beta.properties.json +++ b/frontend/beta/properties/beta.properties.json | |||
@@ -1,37 +1,40 @@ | |||
1 | { | 1 | { |
2 | "copyright.values": { | 2 | "copyright.values": { |
3 | "mochikit.repository": "http://svn.mochikit.com/mochikit/trunk/", | 3 | "mochikit.repository": "http://svn.mochikit.com/mochikit/trunk/", |
4 | "mochikit.version": "1249" | 4 | "mochikit.version": "1249" |
5 | }, | 5 | }, |
6 | |||
7 | "html.template": "index_template.html", | ||
8 | |||
6 | "js": [ | 9 | "js": [ |
7 | "MochiKit/Base.js", | 10 | "MochiKit/Base.js", |
8 | "MochiKit/Iter.js", | 11 | "MochiKit/Iter.js", |
9 | "MochiKit/DOM.js", | 12 | "MochiKit/DOM.js", |
10 | "MochiKit/Style.js", | 13 | "MochiKit/Style.js", |
11 | "MochiKit/Signal.js", | 14 | "MochiKit/Signal.js", |
12 | "MochiKit/Format.js", | 15 | "MochiKit/Format.js", |
13 | "MochiKit/Async.js", | 16 | "MochiKit/Async.js", |
14 | "MochiKit/Selector.js", | 17 | "MochiKit/Selector.js", |
15 | "MochiKit/Logging.js", | 18 | "MochiKit/Logging.js", |
16 | "MochiKit/LoggingPane.js", | 19 | "MochiKit/LoggingPane.js", |
17 | 20 | ||
18 | "YUI/yahoo.js", | 21 | "YUI/yahoo.js", |
19 | "YUI/animation.js", | 22 | "YUI/animation.js", |
20 | "YUI/event.js", | 23 | "YUI/event.js", |
21 | "YUI/dom.js", | 24 | "YUI/dom.js", |
22 | "YUI/dragdrop.js", | 25 | "YUI/dragdrop.js", |
23 | "YUI/logger.js", | 26 | "YUI/logger.js", |
24 | 27 | ||
25 | "YUI-extensions/yutil.js", | 28 | "YUI-extensions/yutil.js", |
26 | "YUI-extensions/Bench.js", | 29 | "YUI-extensions/Bench.js", |
27 | "YUI-extensions/Date.js", | 30 | "YUI-extensions/Date.js", |
28 | "YUI-extensions/DomHelper.js", | 31 | "YUI-extensions/DomHelper.js", |
29 | "YUI-extensions/Element.js", | 32 | "YUI-extensions/Element.js", |
30 | "YUI-extensions/CompositeElement.js", | 33 | "YUI-extensions/CompositeElement.js", |
31 | "YUI-extensions/State.js", | 34 | "YUI-extensions/State.js", |
32 | "YUI-extensions/EventManager.js", | 35 | "YUI-extensions/EventManager.js", |
33 | "YUI-extensions/KeyMap.js", | 36 | "YUI-extensions/KeyMap.js", |
34 | "YUI-extensions/Layer.js", | 37 | "YUI-extensions/Layer.js", |
35 | "YUI-extensions/MixedCollection.js", | 38 | "YUI-extensions/MixedCollection.js", |
36 | "YUI-extensions/State.js", | 39 | "YUI-extensions/State.js", |
37 | "YUI-extensions/UpdateManager.js", | 40 | "YUI-extensions/UpdateManager.js", |
diff --git a/frontend/gamma/js/MochiKit/Async.js b/frontend/gamma/js/MochiKit/Async.js index c7408e7..cc43835 100644 --- a/frontend/gamma/js/MochiKit/Async.js +++ b/frontend/gamma/js/MochiKit/Async.js | |||
@@ -1,212 +1,245 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Async 1.5 | 3 | MochiKit.Async 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Async', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'Async', '1.5', ['Base']); |
12 | 12 | ||
13 | /** @id MochiKit.Async.Deferred */ | 13 | /** @id MochiKit.Async.Deferred */ |
14 | MochiKit.Async.Deferred = function (/* optional */ canceller) { | 14 | MochiKit.Async.Deferred = function (/* optional */ canceller) { |
15 | this.chain = []; | 15 | this.chain = []; |
16 | this.id = this._nextId(); | 16 | this.id = this._nextId(); |
17 | this.fired = -1; | 17 | this.fired = -1; |
18 | this.paused = 0; | 18 | this.paused = 0; |
19 | this.results = [null, null]; | 19 | this.results = [null, null]; |
20 | this.canceller = canceller; | 20 | this.canceller = canceller; |
21 | this.silentlyCancelled = false; | 21 | this.silentlyCancelled = false; |
22 | this.chained = false; | 22 | this.chained = false; |
23 | this.finalized = false; | ||
23 | }; | 24 | }; |
24 | 25 | ||
25 | MochiKit.Async.Deferred.prototype = { | 26 | MochiKit.Async.Deferred.prototype = { |
26 | /** @id MochiKit.Async.Deferred.prototype.repr */ | 27 | /** @id MochiKit.Async.Deferred.prototype.repr */ |
27 | repr: function () { | 28 | repr: function () { |
28 | var state; | 29 | return 'Deferred(' + this.id + ', ' + this.state() + ')'; |
29 | if (this.fired == -1) { | ||
30 | state = 'unfired'; | ||
31 | } else if (this.fired === 0) { | ||
32 | state = 'success'; | ||
33 | } else { | ||
34 | state = 'error'; | ||
35 | } | ||
36 | return 'Deferred(' + this.id + ', ' + state + ')'; | ||
37 | }, | 30 | }, |
38 | 31 | ||
39 | toString: MochiKit.Base.forwardCall("repr"), | 32 | toString: MochiKit.Base.forwardCall("repr"), |
40 | 33 | ||
41 | _nextId: MochiKit.Base.counter(), | 34 | _nextId: MochiKit.Base.counter(), |
42 | 35 | ||
36 | /** @id MochiKit.Async.Deferred.prototype.state */ | ||
37 | state: function () { | ||
38 | if (this.fired == -1) { | ||
39 | return 'unfired'; | ||
40 | } else if (this.fired === 0) { | ||
41 | return 'success'; | ||
42 | } else { | ||
43 | return 'error'; | ||
44 | } | ||
45 | }, | ||
46 | |||
43 | /** @id MochiKit.Async.Deferred.prototype.cancel */ | 47 | /** @id MochiKit.Async.Deferred.prototype.cancel */ |
44 | cancel: function () { | 48 | cancel: function (e) { |
45 | var self = MochiKit.Async; | 49 | var self = MochiKit.Async; |
46 | if (this.fired == -1) { | 50 | if (this.fired == -1) { |
47 | if (this.canceller) { | 51 | if (this.canceller) { |
48 | this.canceller(this); | 52 | this.canceller(this); |
49 | } else { | 53 | } else { |
50 | this.silentlyCancelled = true; | 54 | this.silentlyCancelled = true; |
51 | } | 55 | } |
52 | if (this.fired == -1) { | 56 | if (this.fired == -1) { |
53 | this.errback(new self.CancelledError(this)); | 57 | if (typeof(e) === 'string') { |
58 | e = new self.GenericError(e); | ||
59 | } else if (!(e instanceof Error)) { | ||
60 | e = new self.CancelledError(this); | ||
61 | } | ||
62 | this.errback(e); | ||
54 | } | 63 | } |
55 | } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) { | 64 | } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) { |
56 | this.results[0].cancel(); | 65 | this.results[0].cancel(e); |
57 | } | 66 | } |
58 | }, | 67 | }, |
59 | 68 | ||
60 | _resback: function (res) { | 69 | _resback: function (res) { |
61 | /*** | 70 | /*** |
62 | 71 | ||
63 | The primitive that means either callback or errback | 72 | The primitive that means either callback or errback |
64 | 73 | ||
65 | ***/ | 74 | ***/ |
66 | this.fired = ((res instanceof Error) ? 1 : 0); | 75 | this.fired = ((res instanceof Error) ? 1 : 0); |
67 | this.results[this.fired] = res; | 76 | this.results[this.fired] = res; |
68 | this._fire(); | 77 | if (this.paused === 0) { |
78 | this._fire(); | ||
79 | } | ||
69 | }, | 80 | }, |
70 | 81 | ||
71 | _check: function () { | 82 | _check: function () { |
72 | if (this.fired != -1) { | 83 | if (this.fired != -1) { |
73 | if (!this.silentlyCancelled) { | 84 | if (!this.silentlyCancelled) { |
74 | throw new MochiKit.Async.AlreadyCalledError(this); | 85 | throw new MochiKit.Async.AlreadyCalledError(this); |
75 | } | 86 | } |
76 | this.silentlyCancelled = false; | 87 | this.silentlyCancelled = false; |
77 | return; | 88 | return; |
78 | } | 89 | } |
79 | }, | 90 | }, |
80 | 91 | ||
81 | /** @id MochiKit.Async.Deferred.prototype.callback */ | 92 | /** @id MochiKit.Async.Deferred.prototype.callback */ |
82 | callback: function (res) { | 93 | callback: function (res) { |
83 | this._check(); | 94 | this._check(); |
84 | if (res instanceof MochiKit.Async.Deferred) { | 95 | if (res instanceof MochiKit.Async.Deferred) { |
85 | throw new Error("Deferred instances can only be chained if they are the result of a callback"); | 96 | throw new Error("Deferred instances can only be chained if they are the result of a callback"); |
86 | } | 97 | } |
87 | this._resback(res); | 98 | this._resback(res); |
88 | }, | 99 | }, |
89 | 100 | ||
90 | /** @id MochiKit.Async.Deferred.prototype.errback */ | 101 | /** @id MochiKit.Async.Deferred.prototype.errback */ |
91 | errback: function (res) { | 102 | errback: function (res) { |
92 | this._check(); | 103 | this._check(); |
93 | var self = MochiKit.Async; | 104 | var self = MochiKit.Async; |
94 | if (res instanceof self.Deferred) { | 105 | if (res instanceof self.Deferred) { |
95 | throw new Error("Deferred instances can only be chained if they are the result of a callback"); | 106 | throw new Error("Deferred instances can only be chained if they are the result of a callback"); |
96 | } | 107 | } |
97 | if (!(res instanceof Error)) { | 108 | if (!(res instanceof Error)) { |
98 | res = new self.GenericError(res); | 109 | res = new self.GenericError(res); |
99 | } | 110 | } |
100 | this._resback(res); | 111 | this._resback(res); |
101 | }, | 112 | }, |
102 | 113 | ||
103 | /** @id MochiKit.Async.Deferred.prototype.addBoth */ | 114 | /** @id MochiKit.Async.Deferred.prototype.addBoth */ |
104 | addBoth: function (fn) { | 115 | addBoth: function (fn) { |
105 | if (arguments.length > 1) { | 116 | if (arguments.length > 1) { |
106 | fn = MochiKit.Base.partial.apply(null, arguments); | 117 | fn = MochiKit.Base.partial.apply(null, arguments); |
107 | } | 118 | } |
108 | return this.addCallbacks(fn, fn); | 119 | return this.addCallbacks(fn, fn); |
109 | }, | 120 | }, |
110 | 121 | ||
111 | /** @id MochiKit.Async.Deferred.prototype.addCallback */ | 122 | /** @id MochiKit.Async.Deferred.prototype.addCallback */ |
112 | addCallback: function (fn) { | 123 | addCallback: function (fn) { |
113 | if (arguments.length > 1) { | 124 | if (arguments.length > 1) { |
114 | fn = MochiKit.Base.partial.apply(null, arguments); | 125 | fn = MochiKit.Base.partial.apply(null, arguments); |
115 | } | 126 | } |
116 | return this.addCallbacks(fn, null); | 127 | return this.addCallbacks(fn, null); |
117 | }, | 128 | }, |
118 | 129 | ||
119 | /** @id MochiKit.Async.Deferred.prototype.addErrback */ | 130 | /** @id MochiKit.Async.Deferred.prototype.addErrback */ |
120 | addErrback: function (fn) { | 131 | addErrback: function (fn) { |
121 | if (arguments.length > 1) { | 132 | if (arguments.length > 1) { |
122 | fn = MochiKit.Base.partial.apply(null, arguments); | 133 | fn = MochiKit.Base.partial.apply(null, arguments); |
123 | } | 134 | } |
124 | return this.addCallbacks(null, fn); | 135 | return this.addCallbacks(null, fn); |
125 | }, | 136 | }, |
126 | 137 | ||
127 | /** @id MochiKit.Async.Deferred.prototype.addCallbacks */ | 138 | /** @id MochiKit.Async.Deferred.prototype.addCallbacks */ |
128 | addCallbacks: function (cb, eb) { | 139 | addCallbacks: function (cb, eb) { |
129 | if (this.chained) { | 140 | if (this.chained) { |
130 | throw new Error("Chained Deferreds can not be re-used"); | 141 | throw new Error("Chained Deferreds can not be re-used"); |
131 | } | 142 | } |
143 | if (this.finalized) { | ||
144 | throw new Error("Finalized Deferreds can not be re-used"); | ||
145 | } | ||
132 | this.chain.push([cb, eb]); | 146 | this.chain.push([cb, eb]); |
133 | if (this.fired >= 0) { | 147 | if (this.fired >= 0) { |
134 | this._fire(); | 148 | this._fire(); |
135 | } | 149 | } |
136 | return this; | 150 | return this; |
137 | }, | 151 | }, |
138 | 152 | ||
153 | /** @id MochiKit.Async.Deferred.prototype.setFinalizer */ | ||
154 | setFinalizer: function (fn) { | ||
155 | if (this.chained) { | ||
156 | throw new Error("Chained Deferreds can not be re-used"); | ||
157 | } | ||
158 | if (this.finalized) { | ||
159 | throw new Error("Finalized Deferreds can not be re-used"); | ||
160 | } | ||
161 | if (arguments.length > 1) { | ||
162 | fn = MochiKit.Base.partial.apply(null, arguments); | ||
163 | } | ||
164 | this._finalizer = fn; | ||
165 | if (this.fired >= 0) { | ||
166 | this._fire(); | ||
167 | } | ||
168 | return this; | ||
169 | }, | ||
170 | |||
139 | _fire: function () { | 171 | _fire: function () { |
140 | /*** | 172 | /*** |
141 | 173 | ||
142 | Used internally to exhaust the callback sequence when a result | 174 | Used internally to exhaust the callback sequence when a result |
143 | is available. | 175 | is available. |
144 | 176 | ||
145 | ***/ | 177 | ***/ |
146 | var chain = this.chain; | 178 | var chain = this.chain; |
147 | var fired = this.fired; | 179 | var fired = this.fired; |
148 | var res = this.results[fired]; | 180 | var res = this.results[fired]; |
149 | var self = this; | 181 | var self = this; |
150 | var cb = null; | 182 | var cb = null; |
151 | while (chain.length > 0 && this.paused === 0) { | 183 | while (chain.length > 0 && this.paused === 0) { |
152 | // Array | 184 | // Array |
153 | var pair = chain.shift(); | 185 | var pair = chain.shift(); |
154 | var f = pair[fired]; | 186 | var f = pair[fired]; |
155 | if (f === null) { | 187 | if (f === null) { |
156 | continue; | 188 | continue; |
157 | } | 189 | } |
158 | try { | 190 | try { |
159 | res = f(res); | 191 | res = f(res); |
160 | fired = ((res instanceof Error) ? 1 : 0); | 192 | fired = ((res instanceof Error) ? 1 : 0); |
161 | if (res instanceof MochiKit.Async.Deferred) { | 193 | if (res instanceof MochiKit.Async.Deferred) { |
162 | cb = function (res) { | 194 | cb = function (res) { |
163 | self._resback(res); | ||
164 | self.paused--; | 195 | self.paused--; |
165 | if ((self.paused === 0) && (self.fired >= 0)) { | 196 | self._resback(res); |
166 | self._fire(); | ||
167 | } | ||
168 | }; | 197 | }; |
169 | this.paused++; | 198 | this.paused++; |
170 | } | 199 | } |
171 | } catch (err) { | 200 | } catch (err) { |
172 | fired = 1; | 201 | fired = 1; |
173 | if (!(err instanceof Error)) { | 202 | if (!(err instanceof Error)) { |
174 | err = new MochiKit.Async.GenericError(err); | 203 | err = new MochiKit.Async.GenericError(err); |
175 | } | 204 | } |
176 | res = err; | 205 | res = err; |
177 | } | 206 | } |
178 | } | 207 | } |
179 | this.fired = fired; | 208 | this.fired = fired; |
180 | this.results[fired] = res; | 209 | this.results[fired] = res; |
210 | if (this.chain.length == 0 && this.paused === 0 && this._finalizer) { | ||
211 | this.finalized = true; | ||
212 | this._finalizer(res); | ||
213 | } | ||
181 | if (cb && this.paused) { | 214 | if (cb && this.paused) { |
182 | // this is for "tail recursion" in case the dependent deferred | 215 | // this is for "tail recursion" in case the dependent deferred |
183 | // is already fired | 216 | // is already fired |
184 | res.addBoth(cb); | 217 | res.addBoth(cb); |
185 | res.chained = true; | 218 | res.chained = true; |
186 | } | 219 | } |
187 | } | 220 | } |
188 | }; | 221 | }; |
189 | 222 | ||
190 | MochiKit.Base.update(MochiKit.Async, { | 223 | MochiKit.Base.update(MochiKit.Async, { |
191 | /** @id MochiKit.Async.evalJSONRequest */ | 224 | /** @id MochiKit.Async.evalJSONRequest */ |
192 | evalJSONRequest: function (req) { | 225 | evalJSONRequest: function (req) { |
193 | return MochiKit.Base.evalJSON(req.responseText); | 226 | return MochiKit.Base.evalJSON(req.responseText); |
194 | }, | 227 | }, |
195 | 228 | ||
196 | /** @id MochiKit.Async.succeed */ | 229 | /** @id MochiKit.Async.succeed */ |
197 | succeed: function (/* optional */result) { | 230 | succeed: function (/* optional */result) { |
198 | var d = new MochiKit.Async.Deferred(); | 231 | var d = new MochiKit.Async.Deferred(); |
199 | d.callback.apply(d, arguments); | 232 | d.callback.apply(d, arguments); |
200 | return d; | 233 | return d; |
201 | }, | 234 | }, |
202 | 235 | ||
203 | /** @id MochiKit.Async.fail */ | 236 | /** @id MochiKit.Async.fail */ |
204 | fail: function (/* optional */result) { | 237 | fail: function (/* optional */result) { |
205 | var d = new MochiKit.Async.Deferred(); | 238 | var d = new MochiKit.Async.Deferred(); |
206 | d.errback.apply(d, arguments); | 239 | d.errback.apply(d, arguments); |
207 | return d; | 240 | return d; |
208 | }, | 241 | }, |
209 | 242 | ||
210 | /** @id MochiKit.Async.getXMLHttpRequest */ | 243 | /** @id MochiKit.Async.getXMLHttpRequest */ |
211 | getXMLHttpRequest: function () { | 244 | getXMLHttpRequest: function () { |
212 | var self = arguments.callee; | 245 | var self = arguments.callee; |
@@ -220,65 +253,65 @@ MochiKit.Base.update(MochiKit.Async, { | |||
220 | throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); | 253 | throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); |
221 | } | 254 | } |
222 | ]; | 255 | ]; |
223 | for (var i = 0; i < tryThese.length; i++) { | 256 | for (var i = 0; i < tryThese.length; i++) { |
224 | var func = tryThese[i]; | 257 | var func = tryThese[i]; |
225 | try { | 258 | try { |
226 | self.XMLHttpRequest = func; | 259 | self.XMLHttpRequest = func; |
227 | return func(); | 260 | return func(); |
228 | } catch (e) { | 261 | } catch (e) { |
229 | // pass | 262 | // pass |
230 | } | 263 | } |
231 | } | 264 | } |
232 | } | 265 | } |
233 | return self.XMLHttpRequest(); | 266 | return self.XMLHttpRequest(); |
234 | }, | 267 | }, |
235 | 268 | ||
236 | _xhr_onreadystatechange: function (d) { | 269 | _xhr_onreadystatechange: function (d) { |
237 | // MochiKit.Logging.logDebug('this.readyState', this.readyState); | 270 | // MochiKit.Logging.logDebug('this.readyState', this.readyState); |
238 | var m = MochiKit.Base; | 271 | var m = MochiKit.Base; |
239 | if (this.readyState == 4) { | 272 | if (this.readyState == 4) { |
240 | // IE SUCKS | 273 | // IE SUCKS |
241 | try { | 274 | try { |
242 | this.onreadystatechange = null; | 275 | this.onreadystatechange = null; |
243 | } catch (e) { | 276 | } catch (e) { |
244 | try { | 277 | try { |
245 | this.onreadystatechange = m.noop; | 278 | this.onreadystatechange = m.noop; |
246 | } catch (e) { | 279 | } catch (e) { |
247 | } | 280 | } |
248 | } | 281 | } |
249 | var status = null; | 282 | var status = null; |
250 | try { | 283 | try { |
251 | status = this.status; | 284 | status = this.status; |
252 | if (!status && m.isNotEmpty(this.responseText)) { | 285 | if (!status && (this.response || m.isNotEmpty(this.responseText))) { |
253 | // 0 or undefined seems to mean cached or local | 286 | // 0 or undefined seems to mean cached or local |
254 | status = 304; | 287 | status = 304; |
255 | } | 288 | } |
256 | } catch (e) { | 289 | } catch (e) { |
257 | // pass | 290 | // pass |
258 | // MochiKit.Logging.logDebug('error getting status?', repr(items(e))); | 291 | // MochiKit.Logging.logDebug('error getting status?', repr(items(e))); |
259 | } | 292 | } |
260 | // 200 is OK, 201 is CREATED, 204 is NO CONTENT | 293 | // 200 is OK, 201 is CREATED, 204 is NO CONTENT |
261 | // 304 is NOT MODIFIED, 1223 is apparently a bug in IE | 294 | // 304 is NOT MODIFIED, 1223 is apparently a bug in IE |
262 | if (status == 200 || status == 201 || status == 204 || | 295 | if (status == 200 || status == 201 || status == 204 || |
263 | status == 304 || status == 1223) { | 296 | status == 304 || status == 1223) { |
264 | d.callback(this); | 297 | d.callback(this); |
265 | } else { | 298 | } else { |
266 | var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed"); | 299 | var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed"); |
267 | if (err.number) { | 300 | if (err.number) { |
268 | // XXX: This seems to happen on page change | 301 | // XXX: This seems to happen on page change |
269 | d.errback(err); | 302 | d.errback(err); |
270 | } else { | 303 | } else { |
271 | // XXX: this seems to happen when the server is unreachable | 304 | // XXX: this seems to happen when the server is unreachable |
272 | d.errback(err); | 305 | d.errback(err); |
273 | } | 306 | } |
274 | } | 307 | } |
275 | } | 308 | } |
276 | }, | 309 | }, |
277 | 310 | ||
278 | _xhr_canceller: function (req) { | 311 | _xhr_canceller: function (req) { |
279 | // IE SUCKS | 312 | // IE SUCKS |
280 | try { | 313 | try { |
281 | req.onreadystatechange = null; | 314 | req.onreadystatechange = null; |
282 | } catch (e) { | 315 | } catch (e) { |
283 | try { | 316 | try { |
284 | req.onreadystatechange = MochiKit.Base.noop; | 317 | req.onreadystatechange = MochiKit.Base.noop; |
@@ -308,141 +341,173 @@ MochiKit.Base.update(MochiKit.Async, { | |||
308 | req.onreadystatechange = null; | 341 | req.onreadystatechange = null; |
309 | } catch (ignore) { | 342 | } catch (ignore) { |
310 | // pass | 343 | // pass |
311 | } | 344 | } |
312 | d.errback(e); | 345 | d.errback(e); |
313 | } | 346 | } |
314 | 347 | ||
315 | return d; | 348 | return d; |
316 | 349 | ||
317 | }, | 350 | }, |
318 | 351 | ||
319 | /** @id MochiKit.Async.doXHR */ | 352 | /** @id MochiKit.Async.doXHR */ |
320 | doXHR: function (url, opts) { | 353 | doXHR: function (url, opts) { |
321 | /* | 354 | /* |
322 | Work around a Firefox bug by dealing with XHR during | 355 | Work around a Firefox bug by dealing with XHR during |
323 | the next event loop iteration. Maybe it's this one: | 356 | the next event loop iteration. Maybe it's this one: |
324 | https://bugzilla.mozilla.org/show_bug.cgi?id=249843 | 357 | https://bugzilla.mozilla.org/show_bug.cgi?id=249843 |
325 | */ | 358 | */ |
326 | var self = MochiKit.Async; | 359 | var self = MochiKit.Async; |
327 | return self.callLater(0, self._doXHR, url, opts); | 360 | return self.callLater(0, self._doXHR, url, opts); |
328 | }, | 361 | }, |
329 | 362 | ||
330 | _doXHR: function (url, opts) { | 363 | _doXHR: function (url, opts) { |
331 | var m = MochiKit.Base; | 364 | var m = MochiKit.Base; |
332 | opts = m.update({ | 365 | opts = m.update({ |
333 | method: 'GET', | 366 | method: 'GET', |
334 | sendContent: '' | 367 | sendContent: '' |
335 | /* | 368 | /* |
336 | queryString: undefined, | 369 | queryString: undefined, |
337 | username: undefined, | 370 | username: undefined, |
338 | password: undefined, | 371 | password: undefined, |
339 | headers: undefined, | 372 | headers: undefined, |
340 | mimeType: undefined | 373 | mimeType: undefined, |
374 | responseType: undefined | ||
341 | */ | 375 | */ |
342 | }, opts); | 376 | }, opts); |
343 | var self = MochiKit.Async; | 377 | var self = MochiKit.Async; |
344 | var req = self.getXMLHttpRequest(); | 378 | var req = self.getXMLHttpRequest(); |
345 | if (opts.queryString) { | 379 | if (opts.queryString) { |
346 | var qs = m.queryString(opts.queryString); | 380 | var qs = m.queryString(opts.queryString); |
347 | if (qs) { | 381 | if (qs) { |
348 | url += "?" + qs; | 382 | url += "?" + qs; |
349 | } | 383 | } |
350 | } | 384 | } |
351 | // Safari will send undefined:undefined, so we have to check. | 385 | // Safari will send undefined:undefined, so we have to check. |
352 | // We can't use apply, since the function is native. | 386 | // We can't use apply, since the function is native. |
353 | if ('username' in opts) { | 387 | if ('username' in opts) { |
354 | req.open(opts.method, url, true, opts.username, opts.password); | 388 | req.open(opts.method, url, true, opts.username, opts.password); |
355 | } else { | 389 | } else { |
356 | req.open(opts.method, url, true); | 390 | req.open(opts.method, url, true); |
357 | } | 391 | } |
358 | if (req.overrideMimeType && opts.mimeType) { | 392 | if (req.overrideMimeType && opts.mimeType) { |
359 | req.overrideMimeType(opts.mimeType); | 393 | req.overrideMimeType(opts.mimeType); |
360 | } | 394 | } |
361 | req.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | 395 | req.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
362 | if (opts.headers) { | 396 | if (opts.headers) { |
363 | var headers = opts.headers; | 397 | var headers = opts.headers; |
364 | if (!m.isArrayLike(headers)) { | 398 | if (!m.isArrayLike(headers)) { |
365 | headers = m.items(headers); | 399 | headers = m.items(headers); |
366 | } | 400 | } |
367 | for (var i = 0; i < headers.length; i++) { | 401 | for (var i = 0; i < headers.length; i++) { |
368 | var header = headers[i]; | 402 | var header = headers[i]; |
369 | var name = header[0]; | 403 | var name = header[0]; |
370 | var value = header[1]; | 404 | var value = header[1]; |
371 | req.setRequestHeader(name, value); | 405 | req.setRequestHeader(name, value); |
372 | } | 406 | } |
373 | } | 407 | } |
408 | if ("responseType" in opts && "responseType" in req) { | ||
409 | req.responseType = opts.responseType; | ||
410 | } | ||
374 | return self.sendXMLHttpRequest(req, opts.sendContent); | 411 | return self.sendXMLHttpRequest(req, opts.sendContent); |
375 | }, | 412 | }, |
376 | 413 | ||
377 | _buildURL: function (url/*, ...*/) { | 414 | _buildURL: function (url/*, ...*/) { |
378 | if (arguments.length > 1) { | 415 | if (arguments.length > 1) { |
379 | var m = MochiKit.Base; | 416 | var m = MochiKit.Base; |
380 | var qs = m.queryString.apply(null, m.extend(null, arguments, 1)); | 417 | var qs = m.queryString.apply(null, m.extend(null, arguments, 1)); |
381 | if (qs) { | 418 | if (qs) { |
382 | return url + "?" + qs; | 419 | return url + "?" + qs; |
383 | } | 420 | } |
384 | } | 421 | } |
385 | return url; | 422 | return url; |
386 | }, | 423 | }, |
387 | 424 | ||
388 | /** @id MochiKit.Async.doSimpleXMLHttpRequest */ | 425 | /** @id MochiKit.Async.doSimpleXMLHttpRequest */ |
389 | doSimpleXMLHttpRequest: function (url/*, ...*/) { | 426 | doSimpleXMLHttpRequest: function (url/*, ...*/) { |
390 | var self = MochiKit.Async; | 427 | var self = MochiKit.Async; |
391 | url = self._buildURL.apply(self, arguments); | 428 | url = self._buildURL.apply(self, arguments); |
392 | return self.doXHR(url); | 429 | return self.doXHR(url); |
393 | }, | 430 | }, |
394 | 431 | ||
395 | /** @id MochiKit.Async.loadJSONDoc */ | 432 | /** @id MochiKit.Async.loadJSONDoc */ |
396 | loadJSONDoc: function (url/*, ...*/) { | 433 | loadJSONDoc: function (url/*, ...*/) { |
397 | var self = MochiKit.Async; | 434 | var self = MochiKit.Async; |
398 | url = self._buildURL.apply(self, arguments); | 435 | url = self._buildURL.apply(self, arguments); |
399 | var d = self.doXHR(url, { | 436 | var d = self.doXHR(url, { |
400 | 'mimeType': 'text/plain', | 437 | 'mimeType': 'text/plain', |
401 | 'headers': [['Accept', 'application/json']] | 438 | 'headers': [['Accept', 'application/json']] |
402 | }); | 439 | }); |
403 | d = d.addCallback(self.evalJSONRequest); | 440 | d = d.addCallback(self.evalJSONRequest); |
404 | return d; | 441 | return d; |
405 | }, | 442 | }, |
406 | 443 | ||
444 | /** @id MochiKit.Async.loadScript */ | ||
445 | loadScript: function (url) { | ||
446 | var d = new MochiKit.Async.Deferred(); | ||
447 | var script = document.createElement("script"); | ||
448 | script.type = "text/javascript"; | ||
449 | script.src = url; | ||
450 | script.onload = function () { | ||
451 | script.onload = null; | ||
452 | script.onerror = null; | ||
453 | script.onreadystatechange = null; | ||
454 | script = null; | ||
455 | d.callback(); | ||
456 | }; | ||
457 | script.onerror = function (msg) { | ||
458 | script.onload = null; | ||
459 | script.onerror = null; | ||
460 | script.onreadystatechange = null; | ||
461 | script = null; | ||
462 | msg = "Failed to load script at " + url + ": " + msg; | ||
463 | d.errback(new URIError(msg, url)); | ||
464 | } | ||
465 | script.onreadystatechange = function () { | ||
466 | if (script.readyState == "loaded" || script.readyState == "complete") { | ||
467 | script.onload(); | ||
468 | } else { | ||
469 | // IE doesn't bother to report errors... | ||
470 | MochiKit.Async.callLater(10, script.onerror, "Script loading timed out") | ||
471 | } | ||
472 | }; | ||
473 | document.getElementsByTagName("head")[0].appendChild(script); | ||
474 | return d; | ||
475 | }, | ||
476 | |||
407 | /** @id MochiKit.Async.wait */ | 477 | /** @id MochiKit.Async.wait */ |
408 | wait: function (seconds, /* optional */value) { | 478 | wait: function (seconds, /* optional */value) { |
409 | var d = new MochiKit.Async.Deferred(); | 479 | var d = new MochiKit.Async.Deferred(); |
410 | var m = MochiKit.Base; | 480 | var cb = MochiKit.Base.bind("callback", d, value); |
411 | if (typeof(value) != 'undefined') { | 481 | var timeout = setTimeout(cb, Math.floor(seconds * 1000)); |
412 | d.addCallback(function () { return value; }); | ||
413 | } | ||
414 | var timeout = setTimeout( | ||
415 | m.bind("callback", d), | ||
416 | Math.floor(seconds * 1000)); | ||
417 | d.canceller = function () { | 482 | d.canceller = function () { |
418 | try { | 483 | try { |
419 | clearTimeout(timeout); | 484 | clearTimeout(timeout); |
420 | } catch (e) { | 485 | } catch (e) { |
421 | // pass | 486 | // pass |
422 | } | 487 | } |
423 | }; | 488 | }; |
424 | return d; | 489 | return d; |
425 | }, | 490 | }, |
426 | 491 | ||
427 | /** @id MochiKit.Async.callLater */ | 492 | /** @id MochiKit.Async.callLater */ |
428 | callLater: function (seconds, func) { | 493 | callLater: function (seconds, func) { |
429 | var m = MochiKit.Base; | 494 | var m = MochiKit.Base; |
430 | var pfunc = m.partial.apply(m, m.extend(null, arguments, 1)); | 495 | var pfunc = m.partial.apply(m, m.extend(null, arguments, 1)); |
431 | return MochiKit.Async.wait(seconds).addCallback( | 496 | return MochiKit.Async.wait(seconds).addCallback( |
432 | function (res) { return pfunc(); } | 497 | function (res) { return pfunc(); } |
433 | ); | 498 | ); |
434 | } | 499 | } |
435 | }); | 500 | }); |
436 | 501 | ||
437 | 502 | ||
438 | /** @id MochiKit.Async.DeferredLock */ | 503 | /** @id MochiKit.Async.DeferredLock */ |
439 | MochiKit.Async.DeferredLock = function () { | 504 | MochiKit.Async.DeferredLock = function () { |
440 | this.waiting = []; | 505 | this.waiting = []; |
441 | this.locked = false; | 506 | this.locked = false; |
442 | this.id = this._nextId(); | 507 | this.id = this._nextId(); |
443 | }; | 508 | }; |
444 | 509 | ||
445 | MochiKit.Async.DeferredLock.prototype = { | 510 | MochiKit.Async.DeferredLock.prototype = { |
446 | __class__: MochiKit.Async.DeferredLock, | 511 | __class__: MochiKit.Async.DeferredLock, |
447 | /** @id MochiKit.Async.DeferredLock.prototype.acquire */ | 512 | /** @id MochiKit.Async.DeferredLock.prototype.acquire */ |
448 | acquire: function () { | 513 | acquire: function () { |
@@ -481,64 +546,65 @@ MochiKit.Async.DeferredLock.prototype = { | |||
481 | }; | 546 | }; |
482 | 547 | ||
483 | /** @id MochiKit.Async.DeferredList */ | 548 | /** @id MochiKit.Async.DeferredList */ |
484 | MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) { | 549 | MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) { |
485 | 550 | ||
486 | // call parent constructor | 551 | // call parent constructor |
487 | MochiKit.Async.Deferred.apply(this, [canceller]); | 552 | MochiKit.Async.Deferred.apply(this, [canceller]); |
488 | 553 | ||
489 | this.list = list; | 554 | this.list = list; |
490 | var resultList = []; | 555 | var resultList = []; |
491 | this.resultList = resultList; | 556 | this.resultList = resultList; |
492 | 557 | ||
493 | this.finishedCount = 0; | 558 | this.finishedCount = 0; |
494 | this.fireOnOneCallback = fireOnOneCallback; | 559 | this.fireOnOneCallback = fireOnOneCallback; |
495 | this.fireOnOneErrback = fireOnOneErrback; | 560 | this.fireOnOneErrback = fireOnOneErrback; |
496 | this.consumeErrors = consumeErrors; | 561 | this.consumeErrors = consumeErrors; |
497 | 562 | ||
498 | var cb = MochiKit.Base.bind(this._cbDeferred, this); | 563 | var cb = MochiKit.Base.bind(this._cbDeferred, this); |
499 | for (var i = 0; i < list.length; i++) { | 564 | for (var i = 0; i < list.length; i++) { |
500 | var d = list[i]; | 565 | var d = list[i]; |
501 | resultList.push(undefined); | 566 | resultList.push(undefined); |
502 | d.addCallback(cb, i, true); | 567 | d.addCallback(cb, i, true); |
503 | d.addErrback(cb, i, false); | 568 | d.addErrback(cb, i, false); |
504 | } | 569 | } |
505 | 570 | ||
506 | if (list.length === 0 && !fireOnOneCallback) { | 571 | if (list.length === 0 && !fireOnOneCallback) { |
507 | this.callback(this.resultList); | 572 | this.callback(this.resultList); |
508 | } | 573 | } |
509 | 574 | ||
510 | }; | 575 | }; |
511 | 576 | ||
512 | MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred(); | 577 | MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred(); |
578 | MochiKit.Async.DeferredList.prototype.constructor = MochiKit.Async.DeferredList; | ||
513 | 579 | ||
514 | MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) { | 580 | MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) { |
515 | this.resultList[index] = [succeeded, result]; | 581 | this.resultList[index] = [succeeded, result]; |
516 | this.finishedCount += 1; | 582 | this.finishedCount += 1; |
517 | if (this.fired == -1) { | 583 | if (this.fired == -1) { |
518 | if (succeeded && this.fireOnOneCallback) { | 584 | if (succeeded && this.fireOnOneCallback) { |
519 | this.callback([index, result]); | 585 | this.callback([index, result]); |
520 | } else if (!succeeded && this.fireOnOneErrback) { | 586 | } else if (!succeeded && this.fireOnOneErrback) { |
521 | this.errback(result); | 587 | this.errback(result); |
522 | } else if (this.finishedCount == this.list.length) { | 588 | } else if (this.finishedCount == this.list.length) { |
523 | this.callback(this.resultList); | 589 | this.callback(this.resultList); |
524 | } | 590 | } |
525 | } | 591 | } |
526 | if (!succeeded && this.consumeErrors) { | 592 | if (!succeeded && this.consumeErrors) { |
527 | result = null; | 593 | result = null; |
528 | } | 594 | } |
529 | return result; | 595 | return result; |
530 | }; | 596 | }; |
531 | 597 | ||
532 | /** @id MochiKit.Async.gatherResults */ | 598 | /** @id MochiKit.Async.gatherResults */ |
533 | MochiKit.Async.gatherResults = function (deferredList) { | 599 | MochiKit.Async.gatherResults = function (deferredList) { |
534 | var d = new MochiKit.Async.DeferredList(deferredList, false, true, false); | 600 | var d = new MochiKit.Async.DeferredList(deferredList, false, true, false); |
535 | d.addCallback(function (results) { | 601 | d.addCallback(function (results) { |
536 | var ret = []; | 602 | var ret = []; |
537 | for (var i = 0; i < results.length; i++) { | 603 | for (var i = 0; i < results.length; i++) { |
538 | ret.push(results[i][1]); | 604 | ret.push(results[i][1]); |
539 | } | 605 | } |
540 | return ret; | 606 | return ret; |
541 | }); | 607 | }); |
542 | return d; | 608 | return d; |
543 | }; | 609 | }; |
544 | 610 | ||
diff --git a/frontend/gamma/js/MochiKit/Base.js b/frontend/gamma/js/MochiKit/Base.js index d33c269..ca1734c 100644 --- a/frontend/gamma/js/MochiKit/Base.js +++ b/frontend/gamma/js/MochiKit/Base.js | |||
@@ -1,84 +1,95 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Base 1.5 | 3 | MochiKit.Base 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | if (typeof(MochiKit) == 'undefined') { | 11 | |
12 | MochiKit = {}; | 12 | // MochiKit module (namespace) |
13 | } | 13 | var MochiKit = MochiKit || {}; |
14 | if (typeof(MochiKit.__export__) == "undefined") { | 14 | if (typeof(MochiKit.__export__) == "undefined") { |
15 | MochiKit.__export__ = true; | 15 | MochiKit.__export__ = true; |
16 | } | 16 | } |
17 | if (typeof(MochiKit.Base) == 'undefined') { | 17 | MochiKit.NAME = "MochiKit"; |
18 | MochiKit.Base = {}; | 18 | MochiKit.VERSION = "1.5"; |
19 | } | 19 | MochiKit.__repr__ = function () { |
20 | return "[" + this.NAME + " " + this.VERSION + "]"; | ||
21 | }; | ||
22 | MochiKit.toString = function () { | ||
23 | return this.__repr__(); | ||
24 | }; | ||
25 | |||
26 | |||
27 | // MochiKit.Base module | ||
28 | MochiKit.Base = MochiKit.Base || {}; | ||
20 | 29 | ||
21 | /** | 30 | /** |
22 | * Registers a new MochiKit module. This function will insert a new | 31 | * Creates a new module in a parent namespace. This function will |
23 | * property into the "MochiKit" object, making sure that all | 32 | * create a new empty module object with "NAME", "VERSION", |
24 | * dependency modules have already been inserted. It will also make | 33 | * "toString" and "__repr__" properties. This object will be inserted into the parent object |
25 | * sure that the appropriate properties and default module functions | 34 | * using the specified name (i.e. parent[name] = module). It will |
26 | * are defined. | 35 | * also verify that all the dependency modules are defined in the |
36 | * parent, or an error will be thrown. | ||
27 | * | 37 | * |
38 | * @param {Object} parent the parent module (use "this" or "window" for | ||
39 | * a global module) | ||
28 | * @param {String} name the module name, e.g. "Base" | 40 | * @param {String} name the module name, e.g. "Base" |
29 | * @param {String} version the module version, e.g. "1.5" | 41 | * @param {String} version the module version, e.g. "1.5" |
30 | * @param {Array} deps the array of module dependencies (as strings) | 42 | * @param {Array} [deps] the array of module dependencies (as strings) |
31 | */ | 43 | */ |
32 | MochiKit.Base._module = function (name, version, deps) { | 44 | MochiKit.Base.module = function (parent, name, version, deps) { |
33 | if (!(name in MochiKit)) { | 45 | var module = parent[name] = parent[name] || {}; |
34 | MochiKit[name] = {}; | 46 | var prefix = (parent.NAME ? parent.NAME + "." : ""); |
35 | } | 47 | module.NAME = prefix + name; |
36 | var module = MochiKit[name]; | ||
37 | module.NAME = "MochiKit." + name; | ||
38 | module.VERSION = version; | 48 | module.VERSION = version; |
39 | module.__repr__ = function () { | 49 | module.__repr__ = function () { |
40 | return "[" + this.NAME + " " + this.VERSION + "]"; | 50 | return "[" + this.NAME + " " + this.VERSION + "]"; |
41 | }; | 51 | }; |
42 | module.toString = function () { | 52 | module.toString = function () { |
43 | return this.__repr__(); | 53 | return this.__repr__(); |
44 | }; | 54 | }; |
45 | for (var i = 0; i < deps.length; i++) { | 55 | for (var i = 0; deps != null && i < deps.length; i++) { |
46 | if (!(deps[i] in MochiKit)) { | 56 | if (!(deps[i] in parent)) { |
47 | throw 'MochiKit.' + name + ' depends on MochiKit.' + deps[i] + '!'; | 57 | throw module.NAME + ' depends on ' + prefix + deps[i] + '!'; |
48 | } | 58 | } |
49 | } | 59 | } |
50 | } | 60 | return module; |
61 | }; | ||
51 | 62 | ||
52 | MochiKit.Base._module("Base", "1.5", []); | 63 | MochiKit.Base.module(MochiKit, "Base", "1.5", []); |
53 | 64 | ||
54 | /** @id MochiKit.Base.update */ | 65 | /** @id MochiKit.Base.update */ |
55 | MochiKit.Base.update = function (self, obj/*, ... */) { | 66 | MochiKit.Base.update = function (self, obj/*, ... */) { |
56 | if (self === null || self === undefined) { | 67 | if (self === null || self === undefined) { |
57 | self = {}; | 68 | self = {}; |
58 | } | 69 | } |
59 | for (var i = 1; i < arguments.length; i++) { | 70 | for (var i = 1; i < arguments.length; i++) { |
60 | var o = arguments[i]; | 71 | var o = arguments[i]; |
61 | if (typeof(o) != 'undefined' && o !== null) { | 72 | if (typeof(o) != 'undefined' && o !== null) { |
62 | for (var k in o) { | 73 | for (var k in o) { |
63 | self[k] = o[k]; | 74 | self[k] = o[k]; |
64 | } | 75 | } |
65 | } | 76 | } |
66 | } | 77 | } |
67 | return self; | 78 | return self; |
68 | }; | 79 | }; |
69 | 80 | ||
70 | MochiKit.Base.update(MochiKit.Base, { | 81 | MochiKit.Base.update(MochiKit.Base, { |
71 | /** @id MochiKit.Base.camelize */ | 82 | /** @id MochiKit.Base.camelize */ |
72 | camelize: function (selector) { | 83 | camelize: function (selector) { |
73 | /* from dojo.style.toCamelCase */ | 84 | /* from dojo.style.toCamelCase */ |
74 | var arr = selector.split('-'); | 85 | var arr = selector.split('-'); |
75 | var cc = arr[0]; | 86 | var cc = arr[0]; |
76 | for (var i = 1; i < arr.length; i++) { | 87 | for (var i = 1; i < arr.length; i++) { |
77 | cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1); | 88 | cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1); |
78 | } | 89 | } |
79 | return cc; | 90 | return cc; |
80 | }, | 91 | }, |
81 | 92 | ||
82 | /** @id MochiKit.Base.counter */ | 93 | /** @id MochiKit.Base.counter */ |
83 | counter: function (n/* = 1 */) { | 94 | counter: function (n/* = 1 */) { |
84 | if (arguments.length === 0) { | 95 | if (arguments.length === 0) { |
@@ -211,64 +222,65 @@ MochiKit.Base.update(MochiKit.Base, { | |||
211 | } | 222 | } |
212 | return rval; | 223 | return rval; |
213 | }, | 224 | }, |
214 | 225 | ||
215 | /** @id MochiKit.Base.values */ | 226 | /** @id MochiKit.Base.values */ |
216 | values: function (obj) { | 227 | values: function (obj) { |
217 | var rval = []; | 228 | var rval = []; |
218 | for (var prop in obj) { | 229 | for (var prop in obj) { |
219 | rval.push(obj[prop]); | 230 | rval.push(obj[prop]); |
220 | } | 231 | } |
221 | return rval; | 232 | return rval; |
222 | }, | 233 | }, |
223 | 234 | ||
224 | /** @id MochiKit.Base.items */ | 235 | /** @id MochiKit.Base.items */ |
225 | items: function (obj) { | 236 | items: function (obj) { |
226 | var rval = []; | 237 | var rval = []; |
227 | var e; | 238 | var e; |
228 | for (var prop in obj) { | 239 | for (var prop in obj) { |
229 | var v; | 240 | var v; |
230 | try { | 241 | try { |
231 | v = obj[prop]; | 242 | v = obj[prop]; |
232 | } catch (e) { | 243 | } catch (e) { |
233 | continue; | 244 | continue; |
234 | } | 245 | } |
235 | rval.push([prop, v]); | 246 | rval.push([prop, v]); |
236 | } | 247 | } |
237 | return rval; | 248 | return rval; |
238 | }, | 249 | }, |
239 | 250 | ||
240 | 251 | ||
241 | _newNamedError: function (module, name, func) { | 252 | _newNamedError: function (module, name, func) { |
242 | func.prototype = new MochiKit.Base.NamedError(module.NAME + "." + name); | 253 | func.prototype = new MochiKit.Base.NamedError(module.NAME + "." + name); |
254 | func.prototype.constructor = func; | ||
243 | module[name] = func; | 255 | module[name] = func; |
244 | }, | 256 | }, |
245 | 257 | ||
246 | 258 | ||
247 | /** @id MochiKit.Base.operator */ | 259 | /** @id MochiKit.Base.operator */ |
248 | operator: { | 260 | operator: { |
249 | // unary logic operators | 261 | // unary logic operators |
250 | /** @id MochiKit.Base.truth */ | 262 | /** @id MochiKit.Base.truth */ |
251 | truth: function (a) { return !!a; }, | 263 | truth: function (a) { return !!a; }, |
252 | /** @id MochiKit.Base.lognot */ | 264 | /** @id MochiKit.Base.lognot */ |
253 | lognot: function (a) { return !a; }, | 265 | lognot: function (a) { return !a; }, |
254 | /** @id MochiKit.Base.identity */ | 266 | /** @id MochiKit.Base.identity */ |
255 | identity: function (a) { return a; }, | 267 | identity: function (a) { return a; }, |
256 | 268 | ||
257 | // bitwise unary operators | 269 | // bitwise unary operators |
258 | /** @id MochiKit.Base.not */ | 270 | /** @id MochiKit.Base.not */ |
259 | not: function (a) { return ~a; }, | 271 | not: function (a) { return ~a; }, |
260 | /** @id MochiKit.Base.neg */ | 272 | /** @id MochiKit.Base.neg */ |
261 | neg: function (a) { return -a; }, | 273 | neg: function (a) { return -a; }, |
262 | 274 | ||
263 | // binary operators | 275 | // binary operators |
264 | /** @id MochiKit.Base.add */ | 276 | /** @id MochiKit.Base.add */ |
265 | add: function (a, b) { return a + b; }, | 277 | add: function (a, b) { return a + b; }, |
266 | /** @id MochiKit.Base.sub */ | 278 | /** @id MochiKit.Base.sub */ |
267 | sub: function (a, b) { return a - b; }, | 279 | sub: function (a, b) { return a - b; }, |
268 | /** @id MochiKit.Base.div */ | 280 | /** @id MochiKit.Base.div */ |
269 | div: function (a, b) { return a / b; }, | 281 | div: function (a, b) { return a / b; }, |
270 | /** @id MochiKit.Base.mod */ | 282 | /** @id MochiKit.Base.mod */ |
271 | mod: function (a, b) { return a % b; }, | 283 | mod: function (a, b) { return a % b; }, |
272 | /** @id MochiKit.Base.mul */ | 284 | /** @id MochiKit.Base.mul */ |
273 | mul: function (a, b) { return a * b; }, | 285 | mul: function (a, b) { return a * b; }, |
274 | 286 | ||
@@ -322,65 +334,65 @@ MochiKit.Base.update(MochiKit.Base, { | |||
322 | /** @id MochiKit.Base.logand */ | 334 | /** @id MochiKit.Base.logand */ |
323 | logand: function (a, b) { return a && b; }, | 335 | logand: function (a, b) { return a && b; }, |
324 | /** @id MochiKit.Base.logor */ | 336 | /** @id MochiKit.Base.logor */ |
325 | logor: function (a, b) { return a || b; }, | 337 | logor: function (a, b) { return a || b; }, |
326 | /** @id MochiKit.Base.contains */ | 338 | /** @id MochiKit.Base.contains */ |
327 | contains: function (a, b) { return b in a; } | 339 | contains: function (a, b) { return b in a; } |
328 | }, | 340 | }, |
329 | 341 | ||
330 | /** @id MochiKit.Base.forwardCall */ | 342 | /** @id MochiKit.Base.forwardCall */ |
331 | forwardCall: function (func) { | 343 | forwardCall: function (func) { |
332 | return function () { | 344 | return function () { |
333 | return this[func].apply(this, arguments); | 345 | return this[func].apply(this, arguments); |
334 | }; | 346 | }; |
335 | }, | 347 | }, |
336 | 348 | ||
337 | /** @id MochiKit.Base.itemgetter */ | 349 | /** @id MochiKit.Base.itemgetter */ |
338 | itemgetter: function (func) { | 350 | itemgetter: function (func) { |
339 | return function (arg) { | 351 | return function (arg) { |
340 | return arg[func]; | 352 | return arg[func]; |
341 | }; | 353 | }; |
342 | }, | 354 | }, |
343 | 355 | ||
344 | /** @id MochiKit.Base.bool */ | 356 | /** @id MochiKit.Base.bool */ |
345 | bool: function (value) { | 357 | bool: function (value) { |
346 | if (typeof(value) === "boolean" || value instanceof Boolean) { | 358 | if (typeof(value) === "boolean" || value instanceof Boolean) { |
347 | return value.valueOf(); | 359 | return value.valueOf(); |
348 | } else if (typeof(value) === "string" || value instanceof String) { | 360 | } else if (typeof(value) === "string" || value instanceof String) { |
349 | return value.length > 0 && value != "false" && value != "null" && | 361 | return value.length > 0 && value != "false" && value != "null" && |
350 | value != "undefined" && value != "0"; | 362 | value != "undefined" && value != "0"; |
351 | } else if (typeof(value) === "number" || value instanceof Number) { | 363 | } else if (typeof(value) === "number" || value instanceof Number) { |
352 | return !isNaN(value) && value != 0; | 364 | return !isNaN(value) && value != 0; |
353 | } else if (value != null && typeof(value.length) === "number") { | 365 | } else if (value != null && typeof(value.length) === "number") { |
354 | return value.length !== 0 | 366 | return value.length !== 0; |
355 | } else { | 367 | } else { |
356 | return value != null; | 368 | return value != null; |
357 | } | 369 | } |
358 | }, | 370 | }, |
359 | 371 | ||
360 | /** @id MochiKit.Base.typeMatcher */ | 372 | /** @id MochiKit.Base.typeMatcher */ |
361 | typeMatcher: function (/* typ */) { | 373 | typeMatcher: function (/* typ */) { |
362 | var types = {}; | 374 | var types = {}; |
363 | for (var i = 0; i < arguments.length; i++) { | 375 | for (var i = 0; i < arguments.length; i++) { |
364 | var typ = arguments[i]; | 376 | var typ = arguments[i]; |
365 | types[typ] = typ; | 377 | types[typ] = typ; |
366 | } | 378 | } |
367 | return function () { | 379 | return function () { |
368 | for (var i = 0; i < arguments.length; i++) { | 380 | for (var i = 0; i < arguments.length; i++) { |
369 | if (!(typeof(arguments[i]) in types)) { | 381 | if (!(typeof(arguments[i]) in types)) { |
370 | return false; | 382 | return false; |
371 | } | 383 | } |
372 | } | 384 | } |
373 | return true; | 385 | return true; |
374 | }; | 386 | }; |
375 | }, | 387 | }, |
376 | 388 | ||
377 | /** @id MochiKit.Base.isNull */ | 389 | /** @id MochiKit.Base.isNull */ |
378 | isNull: function (/* ... */) { | 390 | isNull: function (/* ... */) { |
379 | for (var i = 0; i < arguments.length; i++) { | 391 | for (var i = 0; i < arguments.length; i++) { |
380 | if (arguments[i] !== null) { | 392 | if (arguments[i] !== null) { |
381 | return false; | 393 | return false; |
382 | } | 394 | } |
383 | } | 395 | } |
384 | return true; | 396 | return true; |
385 | }, | 397 | }, |
386 | 398 | ||
@@ -646,64 +658,67 @@ MochiKit.Base.update(MochiKit.Base, { | |||
646 | // this is for cases where JavaScript sucks ass and gives you a | 658 | // this is for cases where JavaScript sucks ass and gives you a |
647 | // really dumb built-in function like alert() that doesn't have | 659 | // really dumb built-in function like alert() that doesn't have |
648 | // an apply | 660 | // an apply |
649 | func = m._wrapDumbFunction(func); | 661 | func = m._wrapDumbFunction(func); |
650 | } | 662 | } |
651 | if (typeof(im_func) != 'function') { | 663 | if (typeof(im_func) != 'function') { |
652 | im_func = func; | 664 | im_func = func; |
653 | } | 665 | } |
654 | if (typeof(self) != 'undefined') { | 666 | if (typeof(self) != 'undefined') { |
655 | im_self = self; | 667 | im_self = self; |
656 | } | 668 | } |
657 | if (typeof(im_preargs) == 'undefined') { | 669 | if (typeof(im_preargs) == 'undefined') { |
658 | im_preargs = []; | 670 | im_preargs = []; |
659 | } else { | 671 | } else { |
660 | im_preargs = im_preargs.slice(); | 672 | im_preargs = im_preargs.slice(); |
661 | } | 673 | } |
662 | m.extend(im_preargs, arguments, 2); | 674 | m.extend(im_preargs, arguments, 2); |
663 | var newfunc = function () { | 675 | var newfunc = function () { |
664 | var args = arguments; | 676 | var args = arguments; |
665 | var me = arguments.callee; | 677 | var me = arguments.callee; |
666 | if (me.im_preargs.length > 0) { | 678 | if (me.im_preargs.length > 0) { |
667 | args = m.concat(me.im_preargs, args); | 679 | args = m.concat(me.im_preargs, args); |
668 | } | 680 | } |
669 | var self = me.im_self; | 681 | var self = me.im_self; |
670 | if (!self) { | 682 | if (!self) { |
671 | self = this; | 683 | self = this; |
672 | } | 684 | } |
673 | return me.im_func.apply(self, args); | 685 | return me.im_func.apply(self, args); |
674 | }; | 686 | }; |
675 | newfunc.im_self = im_self; | 687 | newfunc.im_self = im_self; |
676 | newfunc.im_func = im_func; | 688 | newfunc.im_func = im_func; |
677 | newfunc.im_preargs = im_preargs; | 689 | newfunc.im_preargs = im_preargs; |
690 | if (typeof(im_func.NAME) == 'string') { | ||
691 | newfunc.NAME = "bind(" + im_func.NAME + ",...)"; | ||
692 | } | ||
678 | return newfunc; | 693 | return newfunc; |
679 | }, | 694 | }, |
680 | 695 | ||
681 | /** @id MochiKit.Base.bindLate */ | 696 | /** @id MochiKit.Base.bindLate */ |
682 | bindLate: function (func, self/* args... */) { | 697 | bindLate: function (func, self/* args... */) { |
683 | var m = MochiKit.Base; | 698 | var m = MochiKit.Base; |
684 | var args = arguments; | 699 | var args = arguments; |
685 | if (typeof(func) === "string") { | 700 | if (typeof(func) === "string") { |
686 | args = m.extend([m.forwardCall(func)], arguments, 1); | 701 | args = m.extend([m.forwardCall(func)], arguments, 1); |
687 | return m.bind.apply(this, args); | 702 | return m.bind.apply(this, args); |
688 | } | 703 | } |
689 | return m.bind.apply(this, args); | 704 | return m.bind.apply(this, args); |
690 | }, | 705 | }, |
691 | 706 | ||
692 | /** @id MochiKit.Base.bindMethods */ | 707 | /** @id MochiKit.Base.bindMethods */ |
693 | bindMethods: function (self) { | 708 | bindMethods: function (self) { |
694 | var bind = MochiKit.Base.bind; | 709 | var bind = MochiKit.Base.bind; |
695 | for (var k in self) { | 710 | for (var k in self) { |
696 | var func = self[k]; | 711 | var func = self[k]; |
697 | if (typeof(func) == 'function') { | 712 | if (typeof(func) == 'function') { |
698 | self[k] = bind(func, self); | 713 | self[k] = bind(func, self); |
699 | } | 714 | } |
700 | } | 715 | } |
701 | }, | 716 | }, |
702 | 717 | ||
703 | /** @id MochiKit.Base.registerComparator */ | 718 | /** @id MochiKit.Base.registerComparator */ |
704 | registerComparator: function (name, check, comparator, /* optional */ override) { | 719 | registerComparator: function (name, check, comparator, /* optional */ override) { |
705 | MochiKit.Base.comparatorRegistry.register(name, check, comparator, override); | 720 | MochiKit.Base.comparatorRegistry.register(name, check, comparator, override); |
706 | }, | 721 | }, |
707 | 722 | ||
708 | _primitives: {'boolean': true, 'string': true, 'number': true}, | 723 | _primitives: {'boolean': true, 'string': true, 'number': true}, |
709 | 724 | ||
@@ -759,170 +774,176 @@ MochiKit.Base.update(MochiKit.Base, { | |||
759 | } else if (count < b.length) { | 774 | } else if (count < b.length) { |
760 | rval = -1; | 775 | rval = -1; |
761 | } | 776 | } |
762 | for (var i = 0; i < count; i++) { | 777 | for (var i = 0; i < count; i++) { |
763 | var cmp = compare(a[i], b[i]); | 778 | var cmp = compare(a[i], b[i]); |
764 | if (cmp) { | 779 | if (cmp) { |
765 | return cmp; | 780 | return cmp; |
766 | } | 781 | } |
767 | } | 782 | } |
768 | return rval; | 783 | return rval; |
769 | }, | 784 | }, |
770 | 785 | ||
771 | /** @id MochiKit.Base.registerRepr */ | 786 | /** @id MochiKit.Base.registerRepr */ |
772 | registerRepr: function (name, check, wrap, /* optional */override) { | 787 | registerRepr: function (name, check, wrap, /* optional */override) { |
773 | MochiKit.Base.reprRegistry.register(name, check, wrap, override); | 788 | MochiKit.Base.reprRegistry.register(name, check, wrap, override); |
774 | }, | 789 | }, |
775 | 790 | ||
776 | /** @id MochiKit.Base.repr */ | 791 | /** @id MochiKit.Base.repr */ |
777 | repr: function (o) { | 792 | repr: function (o) { |
778 | if (typeof(o) == "undefined") { | 793 | if (typeof(o) == "undefined") { |
779 | return "undefined"; | 794 | return "undefined"; |
780 | } else if (o === null) { | 795 | } else if (o === null) { |
781 | return "null"; | 796 | return "null"; |
782 | } | 797 | } |
783 | try { | 798 | try { |
784 | if (typeof(o.__repr__) == 'function') { | 799 | if (typeof(o.__repr__) == 'function') { |
785 | return o.__repr__(); | 800 | return o.__repr__(); |
786 | } else if (typeof(o.repr) == 'function' && o.repr != arguments.callee) { | 801 | } else if (typeof(o.repr) == 'function' && o.repr != arguments.callee) { |
787 | return o.repr(); | 802 | return o.repr(); |
788 | } | 803 | } |
789 | return MochiKit.Base.reprRegistry.match(o); | 804 | return MochiKit.Base.reprRegistry.match(o); |
790 | } catch (e) { | 805 | } catch (e) { |
791 | if (typeof(o.NAME) == 'string' && ( | 806 | try { |
792 | o.toString == Function.prototype.toString || | 807 | if (typeof(o.NAME) == 'string' && ( |
793 | o.toString == Object.prototype.toString | 808 | o.toString == Function.prototype.toString || |
794 | )) { | 809 | o.toString == Object.prototype.toString |
795 | return o.NAME; | 810 | )) { |
811 | return o.NAME; | ||
812 | } | ||
813 | } catch (ignore) { | ||
796 | } | 814 | } |
797 | } | 815 | } |
798 | try { | 816 | try { |
799 | var ostring = (o + ""); | 817 | var ostring = (o + ""); |
800 | } catch (e) { | 818 | } catch (e) { |
801 | return "[" + typeof(o) + "]"; | 819 | return "[" + typeof(o) + "]"; |
802 | } | 820 | } |
803 | if (typeof(o) == "function") { | 821 | if (typeof(o) == "function") { |
804 | ostring = ostring.replace(/^\s+/, "").replace(/\s+/g, " "); | 822 | ostring = ostring.replace(/^\s+/, "").replace(/\s+/g, " "); |
805 | ostring = ostring.replace(/,(\S)/, ", $1"); | 823 | ostring = ostring.replace(/,(\S)/, ", $1"); |
806 | var idx = ostring.indexOf("{"); | 824 | var idx = ostring.indexOf("{"); |
807 | if (idx != -1) { | 825 | if (idx != -1) { |
808 | ostring = ostring.substr(0, idx) + "{...}"; | 826 | ostring = ostring.substr(0, idx) + "{...}"; |
809 | } | 827 | } |
810 | } | 828 | } |
811 | return ostring; | 829 | return ostring; |
812 | }, | 830 | }, |
813 | 831 | ||
814 | /** @id MochiKit.Base.reprArrayLike */ | 832 | /** @id MochiKit.Base.reprArrayLike */ |
815 | reprArrayLike: function (o) { | 833 | reprArrayLike: function (o) { |
816 | var m = MochiKit.Base; | 834 | var m = MochiKit.Base; |
817 | return "[" + m.map(m.repr, o).join(", ") + "]"; | 835 | return "[" + m.map(m.repr, o).join(", ") + "]"; |
818 | }, | 836 | }, |
819 | 837 | ||
820 | /** @id MochiKit.Base.reprString */ | 838 | /** @id MochiKit.Base.reprString */ |
821 | reprString: function (o) { | 839 | reprString: function (o) { |
822 | return ('"' + o.replace(/(["\\])/g, '\\$1') + '"' | 840 | return ('"' + o.replace(/(["\\])/g, '\\$1') + '"' |
823 | ).replace(/[\f]/g, "\\f" | 841 | ).replace(/[\f]/g, "\\f" |
824 | ).replace(/[\b]/g, "\\b" | 842 | ).replace(/[\b]/g, "\\b" |
825 | ).replace(/[\n]/g, "\\n" | 843 | ).replace(/[\n]/g, "\\n" |
826 | ).replace(/[\t]/g, "\\t" | 844 | ).replace(/[\t]/g, "\\t" |
827 | ).replace(/[\v]/g, "\\v" | 845 | ).replace(/[\v]/g, "\\v" |
828 | ).replace(/[\r]/g, "\\r"); | 846 | ).replace(/[\r]/g, "\\r"); |
829 | }, | 847 | }, |
830 | 848 | ||
831 | /** @id MochiKit.Base.reprNumber */ | 849 | /** @id MochiKit.Base.reprNumber */ |
832 | reprNumber: function (o) { | 850 | reprNumber: function (o) { |
833 | return o + ""; | 851 | return o + ""; |
834 | }, | 852 | }, |
835 | 853 | ||
836 | /** @id MochiKit.Base.registerJSON */ | 854 | /** @id MochiKit.Base.registerJSON */ |
837 | registerJSON: function (name, check, wrap, /* optional */override) { | 855 | registerJSON: function (name, check, wrap, /* optional */override) { |
838 | MochiKit.Base.jsonRegistry.register(name, check, wrap, override); | 856 | MochiKit.Base.jsonRegistry.register(name, check, wrap, override); |
839 | }, | 857 | }, |
840 | 858 | ||
841 | 859 | ||
842 | /** @id MochiKit.Base.evalJSON */ | 860 | /** @id MochiKit.Base.evalJSON */ |
843 | evalJSON: function () { | 861 | evalJSON: function (jsonText) { |
844 | return eval("(" + MochiKit.Base._filterJSON(arguments[0]) + ")"); | 862 | return eval("(" + MochiKit.Base._filterJSON(jsonText) + ")"); |
845 | }, | 863 | }, |
846 | 864 | ||
847 | _filterJSON: function (s) { | 865 | _filterJSON: function (s) { |
848 | var m = s.match(/^\s*\/\*(.*)\*\/\s*$/); | 866 | var m = s.match(/^\s*\/\*(.*)\*\/\s*$/); |
849 | if (m) { | 867 | return (m) ? m[1] : s; |
850 | return m[1]; | ||
851 | } | ||
852 | return s; | ||
853 | }, | 868 | }, |
854 | 869 | ||
855 | /** @id MochiKit.Base.serializeJSON */ | 870 | /** @id MochiKit.Base.serializeJSON */ |
856 | serializeJSON: function (o) { | 871 | serializeJSON: function (o) { |
857 | var objtype = typeof(o); | 872 | var objtype = typeof(o); |
858 | if (objtype == "number" || objtype == "boolean") { | 873 | if (objtype == "number" || objtype == "boolean") { |
859 | return o + ""; | 874 | return o + ""; |
860 | } else if (o === null) { | 875 | } else if (o === null) { |
861 | return "null"; | 876 | return "null"; |
862 | } else if (objtype == "string") { | 877 | } else if (objtype == "string") { |
863 | var res = ""; | 878 | var res = ""; |
864 | for (var i = 0; i < o.length; i++) { | 879 | for (var i = 0; i < o.length; i++) { |
865 | var c = o.charAt(i); | 880 | var c = o.charAt(i); |
866 | if (c == '\"') { | 881 | if (c == '\"') { |
867 | res += '\\"'; | 882 | res += '\\"'; |
868 | } else if (c == '\\') { | 883 | } else if (c == '\\') { |
869 | res += '\\\\'; | 884 | res += '\\\\'; |
870 | } else if (c == '\b') { | 885 | } else if (c == '\b') { |
871 | res += '\\b'; | 886 | res += '\\b'; |
872 | } else if (c == '\f') { | 887 | } else if (c == '\f') { |
873 | res += '\\f'; | 888 | res += '\\f'; |
874 | } else if (c == '\n') { | 889 | } else if (c == '\n') { |
875 | res += '\\n'; | 890 | res += '\\n'; |
876 | } else if (c == '\r') { | 891 | } else if (c == '\r') { |
877 | res += '\\r'; | 892 | res += '\\r'; |
878 | } else if (c == '\t') { | 893 | } else if (c == '\t') { |
879 | res += '\\t'; | 894 | res += '\\t'; |
880 | } else if (o.charCodeAt(i) <= 0x1F) { | 895 | } else if (o.charCodeAt(i) <= 0x1F) { |
881 | var hex = o.charCodeAt(i).toString(16); | 896 | var hex = o.charCodeAt(i).toString(16); |
882 | if (hex.length < 2) { | 897 | if (hex.length < 2) { |
883 | hex = '0' + hex; | 898 | hex = '0' + hex; |
884 | } | 899 | } |
885 | res += '\\u00' + hex.toUpperCase(); | 900 | res += '\\u00' + hex.toUpperCase(); |
886 | } else { | 901 | } else { |
887 | res += c; | 902 | res += c; |
888 | } | 903 | } |
889 | } | 904 | } |
890 | return '"' + res + '"'; | 905 | return '"' + res + '"'; |
891 | } | 906 | } |
892 | // recurse | 907 | // recurse |
893 | var me = arguments.callee; | 908 | var me = arguments.callee; |
894 | // short-circuit for objects that support "json" serialization | 909 | // short-circuit for objects that support "json" serialization |
895 | // if they return "self" then just pass-through... | 910 | // if they return "self" then just pass-through... |
896 | var newObj; | 911 | var newObj; |
912 | if (typeof(o.toJSON) == "function") { | ||
913 | newObj = o.toJSON(); | ||
914 | if (o !== newObj) { | ||
915 | return me(newObj); | ||
916 | } | ||
917 | } | ||
897 | if (typeof(o.__json__) == "function") { | 918 | if (typeof(o.__json__) == "function") { |
898 | newObj = o.__json__(); | 919 | newObj = o.__json__(); |
899 | if (o !== newObj) { | 920 | if (o !== newObj) { |
900 | return me(newObj); | 921 | return me(newObj); |
901 | } | 922 | } |
902 | } | 923 | } |
903 | if (typeof(o.json) == "function") { | 924 | if (typeof(o.json) == "function") { |
904 | newObj = o.json(); | 925 | newObj = o.json(); |
905 | if (o !== newObj) { | 926 | if (o !== newObj) { |
906 | return me(newObj); | 927 | return me(newObj); |
907 | } | 928 | } |
908 | } | 929 | } |
909 | // array | 930 | // array |
910 | if (objtype != "function" && typeof(o.length) == "number") { | 931 | if (objtype != "function" && typeof(o.length) == "number") { |
911 | var res = []; | 932 | var res = []; |
912 | for (var i = 0; i < o.length; i++) { | 933 | for (var i = 0; i < o.length; i++) { |
913 | var val = me(o[i]); | 934 | var val = me(o[i]); |
914 | if (typeof(val) != "string") { | 935 | if (typeof(val) != "string") { |
915 | // skip non-serializable values | 936 | // skip non-serializable values |
916 | continue; | 937 | continue; |
917 | } | 938 | } |
918 | res.push(val); | 939 | res.push(val); |
919 | } | 940 | } |
920 | return "[" + res.join(", ") + "]"; | 941 | return "[" + res.join(", ") + "]"; |
921 | } | 942 | } |
922 | // look in the registry | 943 | // look in the registry |
923 | var m = MochiKit.Base; | 944 | var m = MochiKit.Base; |
924 | try { | 945 | try { |
925 | newObj = m.jsonRegistry.match(o); | 946 | newObj = m.jsonRegistry.match(o); |
926 | if (o !== newObj) { | 947 | if (o !== newObj) { |
927 | return me(newObj); | 948 | return me(newObj); |
928 | } | 949 | } |
@@ -1071,65 +1092,65 @@ MochiKit.Base.update(MochiKit.Base, { | |||
1071 | var sum = 0; | 1092 | var sum = 0; |
1072 | 1093 | ||
1073 | var m = MochiKit.Base; | 1094 | var m = MochiKit.Base; |
1074 | var args = m.extend(null, arguments); | 1095 | var args = m.extend(null, arguments); |
1075 | var count = args.length; | 1096 | var count = args.length; |
1076 | 1097 | ||
1077 | while (args.length) { | 1098 | while (args.length) { |
1078 | var o = args.shift(); | 1099 | var o = args.shift(); |
1079 | if (o && typeof(o) == "object" && typeof(o.length) == "number") { | 1100 | if (o && typeof(o) == "object" && typeof(o.length) == "number") { |
1080 | count += o.length - 1; | 1101 | count += o.length - 1; |
1081 | for (var i = o.length - 1; i >= 0; i--) { | 1102 | for (var i = o.length - 1; i >= 0; i--) { |
1082 | sum += o[i]; | 1103 | sum += o[i]; |
1083 | } | 1104 | } |
1084 | } else { | 1105 | } else { |
1085 | sum += o; | 1106 | sum += o; |
1086 | } | 1107 | } |
1087 | } | 1108 | } |
1088 | 1109 | ||
1089 | if (count <= 0) { | 1110 | if (count <= 0) { |
1090 | throw new TypeError('mean() requires at least one argument'); | 1111 | throw new TypeError('mean() requires at least one argument'); |
1091 | } | 1112 | } |
1092 | 1113 | ||
1093 | return sum/count; | 1114 | return sum/count; |
1094 | }, | 1115 | }, |
1095 | 1116 | ||
1096 | /** @id MochiKit.Base.median */ | 1117 | /** @id MochiKit.Base.median */ |
1097 | median: function(/* lst... */) { | 1118 | median: function(/* lst... */) { |
1098 | /* http://www.nist.gov/dads/HTML/median.html */ | 1119 | /* http://www.nist.gov/dads/HTML/median.html */ |
1099 | var data = MochiKit.Base.flattenArguments(arguments); | 1120 | var data = MochiKit.Base.flattenArguments(arguments); |
1100 | if (data.length === 0) { | 1121 | if (data.length === 0) { |
1101 | throw new TypeError('median() requires at least one argument'); | 1122 | throw new TypeError('median() requires at least one argument'); |
1102 | } | 1123 | } |
1103 | data.sort(compare); | 1124 | data.sort(MochiKit.Base.compare); |
1104 | if (data.length % 2 == 0) { | 1125 | if (data.length % 2 == 0) { |
1105 | var upper = data.length / 2; | 1126 | var upper = data.length / 2; |
1106 | return (data[upper] + data[upper - 1]) / 2; | 1127 | return (data[upper] + data[upper - 1]) / 2; |
1107 | } else { | 1128 | } else { |
1108 | return data[(data.length - 1) / 2]; | 1129 | return data[(data.length - 1) / 2]; |
1109 | } | 1130 | } |
1110 | }, | 1131 | }, |
1111 | 1132 | ||
1112 | /** @id MochiKit.Base.findValue */ | 1133 | /** @id MochiKit.Base.findValue */ |
1113 | findValue: function (lst, value, start/* = 0 */, /* optional */end) { | 1134 | findValue: function (lst, value, start/* = 0 */, /* optional */end) { |
1114 | if (typeof(end) == "undefined" || end === null) { | 1135 | if (typeof(end) == "undefined" || end === null) { |
1115 | end = lst.length; | 1136 | end = lst.length; |
1116 | } | 1137 | } |
1117 | if (typeof(start) == "undefined" || start === null) { | 1138 | if (typeof(start) == "undefined" || start === null) { |
1118 | start = 0; | 1139 | start = 0; |
1119 | } | 1140 | } |
1120 | var cmp = MochiKit.Base.compare; | 1141 | var cmp = MochiKit.Base.compare; |
1121 | for (var i = start; i < end; i++) { | 1142 | for (var i = start; i < end; i++) { |
1122 | if (cmp(lst[i], value) === 0) { | 1143 | if (cmp(lst[i], value) === 0) { |
1123 | return i; | 1144 | return i; |
1124 | } | 1145 | } |
1125 | } | 1146 | } |
1126 | return -1; | 1147 | return -1; |
1127 | }, | 1148 | }, |
1128 | 1149 | ||
1129 | /** @id MochiKit.Base.nodeWalk */ | 1150 | /** @id MochiKit.Base.nodeWalk */ |
1130 | nodeWalk: function (node, visitor) { | 1151 | nodeWalk: function (node, visitor) { |
1131 | var nodes = [node]; | 1152 | var nodes = [node]; |
1132 | var extend = MochiKit.Base.extend; | 1153 | var extend = MochiKit.Base.extend; |
1133 | while (nodes.length) { | 1154 | while (nodes.length) { |
1134 | var res = visitor(nodes.shift()); | 1155 | var res = visitor(nodes.shift()); |
1135 | if (res) { | 1156 | if (res) { |
@@ -1261,183 +1282,210 @@ MochiKit.Base.AdapterRegistry.prototype = { | |||
1261 | register: function (name, check, wrap, /* optional */ override) { | 1282 | register: function (name, check, wrap, /* optional */ override) { |
1262 | if (override) { | 1283 | if (override) { |
1263 | this.pairs.unshift([name, check, wrap]); | 1284 | this.pairs.unshift([name, check, wrap]); |
1264 | } else { | 1285 | } else { |
1265 | this.pairs.push([name, check, wrap]); | 1286 | this.pairs.push([name, check, wrap]); |
1266 | } | 1287 | } |
1267 | }, | 1288 | }, |
1268 | 1289 | ||
1269 | /** @id MochiKit.Base.AdapterRegistry.prototype.match */ | 1290 | /** @id MochiKit.Base.AdapterRegistry.prototype.match */ |
1270 | match: function (/* ... */) { | 1291 | match: function (/* ... */) { |
1271 | for (var i = 0; i < this.pairs.length; i++) { | 1292 | for (var i = 0; i < this.pairs.length; i++) { |
1272 | var pair = this.pairs[i]; | 1293 | var pair = this.pairs[i]; |
1273 | if (pair[1].apply(this, arguments)) { | 1294 | if (pair[1].apply(this, arguments)) { |
1274 | return pair[2].apply(this, arguments); | 1295 | return pair[2].apply(this, arguments); |
1275 | } | 1296 | } |
1276 | } | 1297 | } |
1277 | throw MochiKit.Base.NotFound; | 1298 | throw MochiKit.Base.NotFound; |
1278 | }, | 1299 | }, |
1279 | 1300 | ||
1280 | /** @id MochiKit.Base.AdapterRegistry.prototype.unregister */ | 1301 | /** @id MochiKit.Base.AdapterRegistry.prototype.unregister */ |
1281 | unregister: function (name) { | 1302 | unregister: function (name) { |
1282 | for (var i = 0; i < this.pairs.length; i++) { | 1303 | for (var i = 0; i < this.pairs.length; i++) { |
1283 | var pair = this.pairs[i]; | 1304 | var pair = this.pairs[i]; |
1284 | if (pair[0] == name) { | 1305 | if (pair[0] == name) { |
1285 | this.pairs.splice(i, 1); | 1306 | this.pairs.splice(i, 1); |
1286 | return true; | 1307 | return true; |
1287 | } | 1308 | } |
1288 | } | 1309 | } |
1289 | return false; | 1310 | return false; |
1290 | } | 1311 | } |
1291 | }; | 1312 | }; |
1292 | 1313 | ||
1293 | MochiKit.Base._exportSymbols = function (globals, module) { | 1314 | /** |
1294 | if (MochiKit.__export__ === false || module.__export__ === false) { | 1315 | * Exports all symbols from one or more modules into the specified |
1295 | return; | 1316 | * namespace (or scope). This is similar to MochiKit.Base.update(), |
1296 | } | 1317 | * except for special handling of the "__export__" flag, contained |
1297 | for (var k in module) { | 1318 | * sub-modules (exported recursively), and names starting with "_". |
1298 | var v = module[k]; | 1319 | * |
1299 | if (v != null) { | 1320 | * @param {Object} namespace the object or scope to modify |
1300 | var okName = (k[0] !== "_" && k !== "toString"); | 1321 | * @param {Object} module the module to export |
1301 | if (v.__export__ === true || (v.__export__ !== false && okName)) { | 1322 | */ |
1302 | globals[k] = module[k]; | 1323 | MochiKit.Base.moduleExport = function (namespace, module/*, ...*/) { |
1324 | var SKIP = { toString: true, NAME: true, VERSION: true }; | ||
1325 | var mods = MochiKit.Base.extend([], arguments, 1); | ||
1326 | while ((module = mods.shift()) != null) { | ||
1327 | for (var k in module) { | ||
1328 | var v = module[k]; | ||
1329 | if (v != null) { | ||
1330 | var flagSet = (typeof(v.__export__) == 'boolean'); | ||
1331 | var nameValid = (k[0] !== "_" && !SKIP[k]); | ||
1332 | if (flagSet ? v.__export__ : nameValid) { | ||
1333 | if (typeof(v) == 'object' && v.NAME && v.VERSION) { | ||
1334 | mods.push(v); | ||
1335 | } else { | ||
1336 | namespace[k] = module[k]; | ||
1337 | } | ||
1338 | } | ||
1303 | } | 1339 | } |
1304 | } | 1340 | } |
1305 | } | 1341 | } |
1342 | return namespace; | ||
1343 | }; | ||
1344 | |||
1345 | /** | ||
1346 | * Identical to moduleExport, but also considers the global and | ||
1347 | * module-specific "__export__" flag. | ||
1348 | */ | ||
1349 | MochiKit.Base._exportSymbols = function (namespace, module) { | ||
1350 | if (MochiKit.__export__ !== false && module.__export__ !== false) { | ||
1351 | MochiKit.Base.moduleExport(namespace, module); | ||
1352 | } | ||
1306 | }; | 1353 | }; |
1307 | 1354 | ||
1308 | /** | 1355 | /** |
1309 | * Creates a deprecated function alias in the specified module. The | 1356 | * Creates a deprecated function alias in the specified module. The |
1310 | * deprecated function will forward all calls and arguments to a | 1357 | * deprecated function will forward all calls and arguments to a |
1311 | * target function, while also logging a debug message on the first | 1358 | * target function, while also logging a debug message on the first |
1312 | * call (if MochiKit.Logging is loaded). The destination function may | 1359 | * call (if MochiKit.Logging is loaded). The destination function may |
1313 | * be located in another module, which must be loaded, or an | 1360 | * be located in another module, which must be loaded, or an |
1314 | * exception will be thrown. | 1361 | * exception will be thrown. |
1315 | * | 1362 | * |
1316 | * @param {Object/String} module the source module or module name | 1363 | * @param {Object/String} module the source module or module name |
1317 | * (e.g. 'DOM' or 'MochiKit.DOM') | 1364 | * (e.g. 'DOM' or 'MochiKit.DOM') |
1318 | * @param {String} name the deprecated function name (e.g. 'getStyle') | 1365 | * @param {String} name the deprecated function name (e.g. 'getStyle') |
1319 | * @param {String} target the fully qualified name of the target | 1366 | * @param {String} target the fully qualified name of the target |
1320 | * function (e.g. 'MochiKit.Style.getStyle') | 1367 | * function (e.g. 'MochiKit.Style.getStyle') |
1321 | * @param {String} version the first version when the source function | 1368 | * @param {String} version the first version when the source function |
1322 | * was deprecated (e.g. '1.4') | 1369 | * was deprecated (e.g. '1.4') |
1323 | * @param {Boolean} [exportable] the exportable function flag, | 1370 | * @param {Boolean} [exportable] the exportable function flag, |
1324 | * defaults to true | 1371 | * defaults to false |
1325 | */ | 1372 | */ |
1326 | MochiKit.Base._deprecated = function (module, name, target, version, exportable) { | 1373 | MochiKit.Base._deprecated = function (module, name, target, version, exportable) { |
1327 | if (typeof(module) === 'string') { | 1374 | if (typeof(module) === 'string') { |
1328 | if (module.indexOf('MochiKit.') === 0) { | 1375 | if (module.indexOf('MochiKit.') === 0) { |
1329 | module = module.substring(9); | 1376 | module = module.substring(9); |
1330 | } | 1377 | } |
1331 | module = MochiKit[module]; | 1378 | module = MochiKit[module]; |
1332 | } | 1379 | } |
1333 | var targetModule = target.split('.')[1]; | 1380 | var targetModule = target.split('.')[1]; |
1334 | var targetName = target.split('.')[2]; | 1381 | var targetName = target.split('.')[2]; |
1335 | var func = function () { | 1382 | var func = function () { |
1336 | var self = arguments.callee; | 1383 | var self = arguments.callee; |
1337 | var msg = module.NAME + '.' + name + ' is deprecated since version ' + | 1384 | var msg = module.NAME + '.' + name + ' is deprecated since version ' + |
1338 | version + '. Use ' + target + ' instead.'; | 1385 | version + '. Use ' + target + ' instead.'; |
1339 | if (self.logged !== true) { | 1386 | if (self.logged !== true) { |
1340 | self.logged = true; | 1387 | self.logged = true; |
1341 | if (MochiKit.Logging) { | 1388 | if (MochiKit.Logging) { |
1342 | MochiKit.Logging.logDebug(msg); | 1389 | MochiKit.Logging.logDebug(msg); |
1343 | } else if (console && console.log) { | 1390 | } else if (console && console.log) { |
1344 | console.log(msg); | 1391 | console.log(msg); |
1345 | } | 1392 | } |
1346 | } | 1393 | } |
1347 | if (!MochiKit[targetModule]) { | 1394 | if (!MochiKit[targetModule]) { |
1348 | throw new Error(msg); | 1395 | throw new Error(msg); |
1349 | } | 1396 | } |
1350 | return MochiKit[targetModule][targetName].apply(this, arguments); | 1397 | return MochiKit[targetModule][targetName].apply(this, arguments); |
1351 | }; | 1398 | }; |
1352 | if (exportable === false) { | 1399 | func.__export__ = (exportable === true); |
1353 | func.__export__ = false; | ||
1354 | } | ||
1355 | module[name] = func; | 1400 | module[name] = func; |
1356 | } | 1401 | }; |
1357 | 1402 | ||
1358 | MochiKit.Base.__new__ = function () { | 1403 | MochiKit.Base.__new__ = function () { |
1359 | var m = this; | 1404 | var m = this; |
1360 | 1405 | ||
1361 | /** @id MochiKit.Base.noop */ | 1406 | /** @id MochiKit.Base.noop */ |
1362 | m.noop = m.operator.identity; | 1407 | m.noop = m.operator.identity; |
1363 | 1408 | ||
1364 | // Backwards compat | 1409 | // Backwards compat |
1365 | m._deprecated(m, 'forward', 'MochiKit.Base.forwardCall', '1.3', false); | 1410 | m._deprecated(m, 'forward', 'MochiKit.Base.forwardCall', '1.3'); |
1366 | m._deprecated(m, 'find', 'MochiKit.Base.findValue', '1.3', false); | 1411 | m._deprecated(m, 'find', 'MochiKit.Base.findValue', '1.3'); |
1367 | 1412 | ||
1368 | if (typeof(encodeURIComponent) != "undefined") { | 1413 | if (typeof(encodeURIComponent) != "undefined") { |
1369 | /** @id MochiKit.Base.urlEncode */ | 1414 | /** @id MochiKit.Base.urlEncode */ |
1370 | m.urlEncode = function (unencoded) { | 1415 | m.urlEncode = function (unencoded) { |
1371 | return encodeURIComponent(unencoded).replace(/\'/g, '%27'); | 1416 | return encodeURIComponent(unencoded).replace(/\'/g, '%27'); |
1372 | }; | 1417 | }; |
1373 | } else { | 1418 | } else { |
1374 | m.urlEncode = function (unencoded) { | 1419 | m.urlEncode = function (unencoded) { |
1375 | return escape(unencoded | 1420 | return escape(unencoded |
1376 | ).replace(/\+/g, '%2B' | 1421 | ).replace(/\+/g, '%2B' |
1377 | ).replace(/\"/g,'%22' | 1422 | ).replace(/\"/g,'%22' |
1378 | ).rval.replace(/\'/g, '%27'); | 1423 | ).replace(/\'/g, '%27'); |
1379 | }; | 1424 | }; |
1380 | } | 1425 | } |
1381 | 1426 | ||
1382 | /** @id MochiKit.Base.NamedError */ | 1427 | /** @id MochiKit.Base.NamedError */ |
1383 | m.NamedError = function (name) { | 1428 | m.NamedError = function (name) { |
1384 | this.message = name; | 1429 | this.message = name; |
1385 | this.name = name; | 1430 | this.name = name; |
1386 | }; | 1431 | }; |
1387 | m.NamedError.prototype = new Error(); | 1432 | m.NamedError.prototype = new Error(); |
1433 | m.NamedError.prototype.constructor = m.NamedError; | ||
1388 | m.update(m.NamedError.prototype, { | 1434 | m.update(m.NamedError.prototype, { |
1389 | repr: function () { | 1435 | repr: function () { |
1390 | if (this.message && this.message != this.name) { | 1436 | if (this.message && this.message != this.name) { |
1391 | return this.name + "(" + m.repr(this.message) + ")"; | 1437 | return this.name + "(" + m.repr(this.message) + ")"; |
1392 | } else { | 1438 | } else { |
1393 | return this.name + "()"; | 1439 | return this.name + "()"; |
1394 | } | 1440 | } |
1395 | }, | 1441 | }, |
1396 | toString: m.forwardCall("repr") | 1442 | toString: m.forwardCall("repr") |
1397 | }); | 1443 | }); |
1398 | 1444 | ||
1399 | /** @id MochiKit.Base.NotFound */ | 1445 | /** @id MochiKit.Base.NotFound */ |
1400 | m.NotFound = new m.NamedError("MochiKit.Base.NotFound"); | 1446 | m.NotFound = new m.NamedError("MochiKit.Base.NotFound"); |
1401 | 1447 | ||
1402 | 1448 | ||
1403 | /** @id MochiKit.Base.listMax */ | 1449 | /** @id MochiKit.Base.listMax */ |
1404 | m.listMax = m.partial(m.listMinMax, 1); | 1450 | m.listMax = m.partial(m.listMinMax, 1); |
1405 | /** @id MochiKit.Base.listMin */ | 1451 | /** @id MochiKit.Base.listMin */ |
1406 | m.listMin = m.partial(m.listMinMax, -1); | 1452 | m.listMin = m.partial(m.listMinMax, -1); |
1407 | 1453 | ||
1408 | /** @id MochiKit.Base.isCallable */ | 1454 | /** @id MochiKit.Base.isCallable */ |
1409 | m.isCallable = m.typeMatcher('function'); | 1455 | m.isCallable = m.typeMatcher('function'); |
1410 | /** @id MochiKit.Base.isUndefined */ | 1456 | /** @id MochiKit.Base.isUndefined */ |
1411 | m.isUndefined = m.typeMatcher('undefined'); | 1457 | m.isUndefined = m.typeMatcher('undefined'); |
1458 | /** @id MochiKit.Base.isValue */ | ||
1459 | m.isValue = m.typeMatcher('boolean', 'number', 'string'); | ||
1412 | 1460 | ||
1413 | /** @id MochiKit.Base.merge */ | 1461 | /** @id MochiKit.Base.merge */ |
1414 | m.merge = m.partial(m.update, null); | 1462 | m.merge = m.partial(m.update, null); |
1415 | /** @id MochiKit.Base.zip */ | 1463 | /** @id MochiKit.Base.zip */ |
1416 | m.zip = m.partial(m.map, null); | 1464 | m.zip = m.partial(m.map, null); |
1417 | 1465 | ||
1418 | /** @id MochiKit.Base.average */ | 1466 | /** @id MochiKit.Base.average */ |
1419 | m.average = m.mean; | 1467 | m.average = m.mean; |
1420 | 1468 | ||
1421 | /** @id MochiKit.Base.comparatorRegistry */ | 1469 | /** @id MochiKit.Base.comparatorRegistry */ |
1422 | m.comparatorRegistry = new m.AdapterRegistry(); | 1470 | m.comparatorRegistry = new m.AdapterRegistry(); |
1423 | m.registerComparator("dateLike", m.isDateLike, m.compareDateLike); | 1471 | m.registerComparator("dateLike", m.isDateLike, m.compareDateLike); |
1424 | m.registerComparator("arrayLike", m.isArrayLike, m.compareArrayLike); | 1472 | m.registerComparator("arrayLike", m.isArrayLike, m.compareArrayLike); |
1425 | 1473 | ||
1426 | /** @id MochiKit.Base.reprRegistry */ | 1474 | /** @id MochiKit.Base.reprRegistry */ |
1427 | m.reprRegistry = new m.AdapterRegistry(); | 1475 | m.reprRegistry = new m.AdapterRegistry(); |
1428 | m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike); | 1476 | m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike); |
1429 | m.registerRepr("string", m.typeMatcher("string"), m.reprString); | 1477 | m.registerRepr("string", m.typeMatcher("string"), m.reprString); |
1430 | m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber); | 1478 | m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber); |
1431 | 1479 | ||
1432 | /** @id MochiKit.Base.jsonRegistry */ | 1480 | /** @id MochiKit.Base.jsonRegistry */ |
1433 | m.jsonRegistry = new m.AdapterRegistry(); | 1481 | m.jsonRegistry = new m.AdapterRegistry(); |
1434 | 1482 | ||
1435 | m.nameFunctions(this); | 1483 | m.nameFunctions(this); |
1436 | 1484 | ||
1437 | }; | 1485 | }; |
1438 | 1486 | ||
1439 | MochiKit.Base.__new__(); | 1487 | MochiKit.Base.__new__(); |
1440 | 1488 | ||
1441 | // | 1489 | // |
1442 | // XXX: Internet Explorer blows | 1490 | // XXX: Internet Explorer blows |
1443 | // | 1491 | // |
diff --git a/frontend/gamma/js/MochiKit/Color.js b/frontend/gamma/js/MochiKit/Color.js index 27dc2d0..f2a0f67 100644 --- a/frontend/gamma/js/MochiKit/Color.js +++ b/frontend/gamma/js/MochiKit/Color.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Color 1.5 | 3 | MochiKit.Color 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Color', '1.5', ['Base', 'DOM', 'Style']); | 11 | MochiKit.Base.module(MochiKit, 'Color', '1.5', ['Base', 'DOM', 'Style']); |
12 | 12 | ||
13 | /** @id MochiKit.Color.Color */ | 13 | /** @id MochiKit.Color.Color */ |
14 | MochiKit.Color.Color = function (red, green, blue, alpha) { | 14 | MochiKit.Color.Color = function (red, green, blue, alpha) { |
15 | if (typeof(alpha) == 'undefined' || alpha === null) { | 15 | if (typeof(alpha) == 'undefined' || alpha === null) { |
16 | alpha = 1.0; | 16 | alpha = 1.0; |
17 | } | 17 | } |
18 | this.rgb = { | 18 | this.rgb = { |
19 | r: red, | 19 | r: red, |
20 | g: green, | 20 | g: green, |
21 | b: blue, | 21 | b: blue, |
22 | a: alpha | 22 | a: alpha |
23 | }; | 23 | }; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | 26 | ||
27 | // Prototype methods | 27 | // Prototype methods |
28 | 28 | ||
29 | MochiKit.Color.Color.prototype = { | 29 | MochiKit.Color.Color.prototype = { |
30 | 30 | ||
31 | __class__: MochiKit.Color.Color, | 31 | __class__: MochiKit.Color.Color, |
32 | 32 | ||
33 | /** @id MochiKit.Color.Color.prototype.colorWithAlpha */ | 33 | /** @id MochiKit.Color.Color.prototype.colorWithAlpha */ |
34 | colorWithAlpha: function (alpha) { | 34 | colorWithAlpha: function (alpha) { |
35 | var rgb = this.rgb; | 35 | var rgb = this.rgb; |
36 | var m = MochiKit.Color; | 36 | var m = MochiKit.Color; |
37 | return m.Color.fromRGB(rgb.r, rgb.g, rgb.b, alpha); | 37 | return m.Color.fromRGB(rgb.r, rgb.g, rgb.b, alpha); |
38 | }, | 38 | }, |
39 | 39 | ||
40 | /** @id MochiKit.Color.Color.prototype.colorWithHue */ | 40 | /** @id MochiKit.Color.Color.prototype.colorWithHue */ |
41 | colorWithHue: function (hue) { | 41 | colorWithHue: function (hue) { |
42 | // get an HSL model, and set the new hue... | 42 | // get an HSL model, and set the new hue... |
43 | var hsl = this.asHSL(); | 43 | var hsl = this.asHSL(); |
@@ -83,65 +83,65 @@ MochiKit.Color.Color.prototype = { | |||
83 | return m.Color.fromHSL(hsl); | 83 | return m.Color.fromHSL(hsl); |
84 | }, | 84 | }, |
85 | 85 | ||
86 | /** @id MochiKit.Color.Color.prototype.blendedColor */ | 86 | /** @id MochiKit.Color.Color.prototype.blendedColor */ |
87 | blendedColor: function (other, /* optional */ fraction) { | 87 | blendedColor: function (other, /* optional */ fraction) { |
88 | if (typeof(fraction) == 'undefined' || fraction === null) { | 88 | if (typeof(fraction) == 'undefined' || fraction === null) { |
89 | fraction = 0.5; | 89 | fraction = 0.5; |
90 | } | 90 | } |
91 | var sf = 1.0 - fraction; | 91 | var sf = 1.0 - fraction; |
92 | var s = this.rgb; | 92 | var s = this.rgb; |
93 | var d = other.rgb; | 93 | var d = other.rgb; |
94 | var df = fraction; | 94 | var df = fraction; |
95 | return MochiKit.Color.Color.fromRGB( | 95 | return MochiKit.Color.Color.fromRGB( |
96 | (s.r * sf) + (d.r * df), | 96 | (s.r * sf) + (d.r * df), |
97 | (s.g * sf) + (d.g * df), | 97 | (s.g * sf) + (d.g * df), |
98 | (s.b * sf) + (d.b * df), | 98 | (s.b * sf) + (d.b * df), |
99 | (s.a * sf) + (d.a * df) | 99 | (s.a * sf) + (d.a * df) |
100 | ); | 100 | ); |
101 | }, | 101 | }, |
102 | 102 | ||
103 | /** @id MochiKit.Color.Color.prototype.compareRGB */ | 103 | /** @id MochiKit.Color.Color.prototype.compareRGB */ |
104 | compareRGB: function (other) { | 104 | compareRGB: function (other) { |
105 | var a = this.asRGB(); | 105 | var a = this.asRGB(); |
106 | var b = other.asRGB(); | 106 | var b = other.asRGB(); |
107 | return MochiKit.Base.compare( | 107 | return MochiKit.Base.compare( |
108 | [a.r, a.g, a.b, a.a], | 108 | [a.r, a.g, a.b, a.a], |
109 | [b.r, b.g, b.b, b.a] | 109 | [b.r, b.g, b.b, b.a] |
110 | ); | 110 | ); |
111 | }, | 111 | }, |
112 | 112 | ||
113 | /** @id MochiKit.Color.Color.prototype.isLight */ | 113 | /** @id MochiKit.Color.Color.prototype.isLight */ |
114 | isLight: function () { | 114 | isLight: function () { |
115 | return this.asHSL().b > 0.5; | 115 | return this.asHSL().l > 0.5; |
116 | }, | 116 | }, |
117 | 117 | ||
118 | /** @id MochiKit.Color.Color.prototype.isDark */ | 118 | /** @id MochiKit.Color.Color.prototype.isDark */ |
119 | isDark: function () { | 119 | isDark: function () { |
120 | return (!this.isLight()); | 120 | return (!this.isLight()); |
121 | }, | 121 | }, |
122 | 122 | ||
123 | /** @id MochiKit.Color.Color.prototype.toHSLString */ | 123 | /** @id MochiKit.Color.Color.prototype.toHSLString */ |
124 | toHSLString: function () { | 124 | toHSLString: function () { |
125 | var c = this.asHSL(); | 125 | var c = this.asHSL(); |
126 | var ccc = MochiKit.Color.clampColorComponent; | 126 | var ccc = MochiKit.Color.clampColorComponent; |
127 | var rval = this._hslString; | 127 | var rval = this._hslString; |
128 | if (!rval) { | 128 | if (!rval) { |
129 | var mid = ( | 129 | var mid = ( |
130 | ccc(c.h, 360).toFixed(0) | 130 | ccc(c.h, 360).toFixed(0) |
131 | + "," + ccc(c.s, 100).toPrecision(4) + "%" | 131 | + "," + ccc(c.s, 100).toPrecision(4) + "%" |
132 | + "," + ccc(c.l, 100).toPrecision(4) + "%" | 132 | + "," + ccc(c.l, 100).toPrecision(4) + "%" |
133 | ); | 133 | ); |
134 | var a = c.a; | 134 | var a = c.a; |
135 | if (a >= 1) { | 135 | if (a >= 1) { |
136 | a = 1; | 136 | a = 1; |
137 | rval = "hsl(" + mid + ")"; | 137 | rval = "hsl(" + mid + ")"; |
138 | } else { | 138 | } else { |
139 | if (a <= 0) { | 139 | if (a <= 0) { |
140 | a = 0; | 140 | a = 0; |
141 | } | 141 | } |
142 | rval = "hsla(" + mid + "," + a + ")"; | 142 | rval = "hsla(" + mid + "," + a + ")"; |
143 | } | 143 | } |
144 | this._hslString = rval; | 144 | this._hslString = rval; |
145 | } | 145 | } |
146 | return rval; | 146 | return rval; |
147 | }, | 147 | }, |
@@ -612,77 +612,68 @@ MochiKit.Base.update(MochiKit.Color, { | |||
612 | /** @id MochiKit.Color.blackColor */ | 612 | /** @id MochiKit.Color.blackColor */ |
613 | black: [0, 0, 0], | 613 | black: [0, 0, 0], |
614 | /** @id MochiKit.Color.blueColor */ | 614 | /** @id MochiKit.Color.blueColor */ |
615 | blue: [0, 0, 1], | 615 | blue: [0, 0, 1], |
616 | /** @id MochiKit.Color.brownColor */ | 616 | /** @id MochiKit.Color.brownColor */ |
617 | brown: [0.6, 0.4, 0.2], | 617 | brown: [0.6, 0.4, 0.2], |
618 | /** @id MochiKit.Color.cyanColor */ | 618 | /** @id MochiKit.Color.cyanColor */ |
619 | cyan: [0, 1, 1], | 619 | cyan: [0, 1, 1], |
620 | /** @id MochiKit.Color.darkGrayColor */ | 620 | /** @id MochiKit.Color.darkGrayColor */ |
621 | darkGray: [third, third, third], | 621 | darkGray: [third, third, third], |
622 | /** @id MochiKit.Color.grayColor */ | 622 | /** @id MochiKit.Color.grayColor */ |
623 | gray: [0.5, 0.5, 0.5], | 623 | gray: [0.5, 0.5, 0.5], |
624 | /** @id MochiKit.Color.greenColor */ | 624 | /** @id MochiKit.Color.greenColor */ |
625 | green: [0, 1, 0], | 625 | green: [0, 1, 0], |
626 | /** @id MochiKit.Color.lightGrayColor */ | 626 | /** @id MochiKit.Color.lightGrayColor */ |
627 | lightGray: [2 * third, 2 * third, 2 * third], | 627 | lightGray: [2 * third, 2 * third, 2 * third], |
628 | /** @id MochiKit.Color.magentaColor */ | 628 | /** @id MochiKit.Color.magentaColor */ |
629 | magenta: [1, 0, 1], | 629 | magenta: [1, 0, 1], |
630 | /** @id MochiKit.Color.orangeColor */ | 630 | /** @id MochiKit.Color.orangeColor */ |
631 | orange: [1, 0.5, 0], | 631 | orange: [1, 0.5, 0], |
632 | /** @id MochiKit.Color.purpleColor */ | 632 | /** @id MochiKit.Color.purpleColor */ |
633 | purple: [0.5, 0, 0.5], | 633 | purple: [0.5, 0, 0.5], |
634 | /** @id MochiKit.Color.redColor */ | 634 | /** @id MochiKit.Color.redColor */ |
635 | red: [1, 0, 0], | 635 | red: [1, 0, 0], |
636 | /** @id MochiKit.Color.transparentColor */ | 636 | /** @id MochiKit.Color.transparentColor */ |
637 | transparent: [0, 0, 0, 0], | 637 | transparent: [0, 0, 0, 0], |
638 | /** @id MochiKit.Color.whiteColor */ | 638 | /** @id MochiKit.Color.whiteColor */ |
639 | white: [1, 1, 1], | 639 | white: [1, 1, 1], |
640 | /** @id MochiKit.Color.yellowColor */ | 640 | /** @id MochiKit.Color.yellowColor */ |
641 | yellow: [1, 1, 0] | 641 | yellow: [1, 1, 0] |
642 | }; | 642 | }; |
643 | 643 | ||
644 | var makeColor = function (name, r, g, b, a) { | ||
645 | var rval = this.fromRGB(r, g, b, a); | ||
646 | this[name] = function () { return rval; }; | ||
647 | return rval; | ||
648 | }; | ||
649 | |||
650 | for (var k in colors) { | 644 | for (var k in colors) { |
651 | var name = k + "Color"; | 645 | var name = k + "Color"; |
652 | var bindArgs = m.concat( | 646 | var value = this.Color.fromRGB.apply(this.Color, colors[k]); |
653 | [makeColor, this.Color, name], | 647 | this.Color[name] = m.partial(m.operator.identity, value); |
654 | colors[k] | ||
655 | ); | ||
656 | this.Color[name] = m.bind.apply(null, bindArgs); | ||
657 | } | 648 | } |
658 | 649 | ||
659 | var isColor = function () { | 650 | var isColor = function () { |
660 | for (var i = 0; i < arguments.length; i++) { | 651 | for (var i = 0; i < arguments.length; i++) { |
661 | if (!(arguments[i] instanceof MochiKit.Color.Color)) { | 652 | if (!(arguments[i] instanceof MochiKit.Color.Color)) { |
662 | return false; | 653 | return false; |
663 | } | 654 | } |
664 | } | 655 | } |
665 | return true; | 656 | return true; |
666 | }; | 657 | }; |
667 | 658 | ||
668 | var compareColor = function (a, b) { | 659 | var compareColor = function (a, b) { |
669 | return a.compareRGB(b); | 660 | return a.compareRGB(b); |
670 | }; | 661 | }; |
671 | 662 | ||
672 | m.nameFunctions(this); | 663 | m.nameFunctions(this); |
673 | 664 | ||
674 | m.registerComparator(this.Color.NAME, isColor, compareColor); | 665 | m.registerComparator(this.Color.NAME, isColor, compareColor); |
675 | } | 666 | } |
676 | }); | 667 | }); |
677 | 668 | ||
678 | MochiKit.Color.__new__(); | 669 | MochiKit.Color.__new__(); |
679 | 670 | ||
680 | // Full table of css3 X11 colors <http://www.w3.org/TR/css3-color/#X11COLORS> | 671 | // Full table of css3 X11 colors <http://www.w3.org/TR/css3-color/#X11COLORS> |
681 | 672 | ||
682 | MochiKit.Color.Color._namedColors = { | 673 | MochiKit.Color.Color._namedColors = { |
683 | aliceblue: "#f0f8ff", | 674 | aliceblue: "#f0f8ff", |
684 | antiquewhite: "#faebd7", | 675 | antiquewhite: "#faebd7", |
685 | aqua: "#00ffff", | 676 | aqua: "#00ffff", |
686 | aquamarine: "#7fffd4", | 677 | aquamarine: "#7fffd4", |
687 | azure: "#f0ffff", | 678 | azure: "#f0ffff", |
688 | beige: "#f5f5dc", | 679 | beige: "#f5f5dc", |
diff --git a/frontend/gamma/js/MochiKit/DOM.js b/frontend/gamma/js/MochiKit/DOM.js index af5d46f..944ab78 100644 --- a/frontend/gamma/js/MochiKit/DOM.js +++ b/frontend/gamma/js/MochiKit/DOM.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.DOM 1.5 | 3 | MochiKit.DOM 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('DOM', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'DOM', '1.5', ['Base']); |
12 | 12 | ||
13 | MochiKit.Base.update(MochiKit.DOM, { | 13 | MochiKit.Base.update(MochiKit.DOM, { |
14 | 14 | ||
15 | /** @id MochiKit.DOM.currentWindow */ | 15 | /** @id MochiKit.DOM.currentWindow */ |
16 | currentWindow: function () { | 16 | currentWindow: function () { |
17 | return MochiKit.DOM._window; | 17 | return MochiKit.DOM._window; |
18 | }, | 18 | }, |
19 | 19 | ||
20 | /** @id MochiKit.DOM.currentDocument */ | 20 | /** @id MochiKit.DOM.currentDocument */ |
21 | currentDocument: function () { | 21 | currentDocument: function () { |
22 | return MochiKit.DOM._document; | 22 | return MochiKit.DOM._document; |
23 | }, | 23 | }, |
24 | 24 | ||
25 | /** @id MochiKit.DOM.withWindow */ | 25 | /** @id MochiKit.DOM.withWindow */ |
26 | withWindow: function (win, func) { | 26 | withWindow: function (win, func) { |
27 | var self = MochiKit.DOM; | 27 | var self = MochiKit.DOM; |
28 | var oldDoc = self._document; | 28 | var oldDoc = self._document; |
29 | var oldWin = self._window; | 29 | var oldWin = self._window; |
30 | var rval; | 30 | var rval; |
31 | try { | 31 | try { |
32 | self._window = win; | 32 | self._window = win; |
33 | self._document = win.document; | 33 | self._document = win.document; |
34 | rval = func(); | 34 | rval = func(); |
35 | } catch (e) { | 35 | } catch (e) { |
36 | self._window = oldWin; | 36 | self._window = oldWin; |
37 | self._document = oldDoc; | 37 | self._document = oldDoc; |
38 | throw e; | 38 | throw e; |
39 | } | 39 | } |
40 | self._window = oldWin; | 40 | self._window = oldWin; |
41 | self._document = oldDoc; | 41 | self._document = oldDoc; |
42 | return rval; | 42 | return rval; |
43 | }, | 43 | }, |
@@ -268,119 +268,119 @@ MochiKit.Base.update(MochiKit.DOM, { | |||
268 | return node[rename]; | 268 | return node[rename]; |
269 | } | 269 | } |
270 | var value = node.getAttribute(attr); | 270 | var value = node.getAttribute(attr); |
271 | if (value != ignoreValue) { | 271 | if (value != ignoreValue) { |
272 | return value; | 272 | return value; |
273 | } | 273 | } |
274 | } catch (e) { | 274 | } catch (e) { |
275 | // pass | 275 | // pass |
276 | } | 276 | } |
277 | return null; | 277 | return null; |
278 | }, | 278 | }, |
279 | 279 | ||
280 | /** @id MochiKit.DOM.removeNodeAttribute */ | 280 | /** @id MochiKit.DOM.removeNodeAttribute */ |
281 | removeNodeAttribute: function (node, attr) { | 281 | removeNodeAttribute: function (node, attr) { |
282 | var self = MochiKit.DOM; | 282 | var self = MochiKit.DOM; |
283 | var rename = self.attributeArray.renames[attr]; | 283 | var rename = self.attributeArray.renames[attr]; |
284 | node = self.getElement(node); | 284 | node = self.getElement(node); |
285 | try { | 285 | try { |
286 | if (rename) { | 286 | if (rename) { |
287 | return node[rename]; | 287 | return node[rename]; |
288 | } | 288 | } |
289 | return node.removeAttribute(attr); | 289 | return node.removeAttribute(attr); |
290 | } catch (e) { | 290 | } catch (e) { |
291 | // pass | 291 | // pass |
292 | } | 292 | } |
293 | return null; | 293 | return null; |
294 | }, | 294 | }, |
295 | 295 | ||
296 | /** @id MochiKit.DOM.updateNodeAttributes */ | 296 | /** @id MochiKit.DOM.updateNodeAttributes */ |
297 | updateNodeAttributes: function (node, attrs) { | 297 | updateNodeAttributes: function (node, attrs) { |
298 | var elem = node; | 298 | var elem = node; |
299 | var self = MochiKit.DOM; | 299 | var self = MochiKit.DOM; |
300 | var base = MochiKit.Base; | ||
300 | if (typeof(node) == 'string') { | 301 | if (typeof(node) == 'string') { |
301 | elem = self.getElement(node); | 302 | elem = self.getElement(node); |
302 | } | 303 | } |
303 | if (attrs) { | 304 | if (attrs) { |
304 | var updatetree = MochiKit.Base.updatetree; | ||
305 | if (self.attributeArray.compliant) { | 305 | if (self.attributeArray.compliant) { |
306 | // not IE, good. | 306 | // not IE, good. |
307 | for (var k in attrs) { | 307 | for (var k in attrs) { |
308 | var v = attrs[k]; | 308 | var v = attrs[k]; |
309 | if (typeof(v) == 'object' && typeof(elem[k]) == 'object') { | 309 | if (typeof(v) == 'object' && typeof(elem[k]) == 'object') { |
310 | if (k == "style" && MochiKit.Style) { | 310 | if (k == "style" && MochiKit.Style) { |
311 | MochiKit.Style.setStyle(elem, v); | 311 | MochiKit.Style.setStyle(elem, v); |
312 | } else { | 312 | } else { |
313 | updatetree(elem[k], v); | 313 | base.updatetree(elem[k], v); |
314 | } | 314 | } |
315 | } else if (k.substring(0, 2) == "on") { | 315 | } else if (k.substring(0, 2) == "on") { |
316 | if (typeof(v) == "string") { | 316 | if (typeof(v) == "string") { |
317 | v = new Function(v); | 317 | v = new Function(v); |
318 | } | 318 | } |
319 | elem[k] = v; | 319 | elem[k] = v; |
320 | } else { | 320 | } else { |
321 | elem.setAttribute(k, v); | 321 | elem.setAttribute(k, v); |
322 | } | 322 | } |
323 | if (typeof(elem[k]) == "string" && elem[k] != v) { | 323 | if (base.isValue(elem[k]) && elem[k] != v) { |
324 | // Also set property for weird attributes (see #302) | 324 | // Also set property for weird attributes (see #302 & #335) |
325 | elem[k] = v; | 325 | elem[k] = v; |
326 | } | 326 | } |
327 | } | 327 | } |
328 | } else { | 328 | } else { |
329 | // IE is insane in the membrane | 329 | // IE is insane in the membrane |
330 | var renames = self.attributeArray.renames; | 330 | var renames = self.attributeArray.renames; |
331 | for (var k in attrs) { | 331 | for (var k in attrs) { |
332 | v = attrs[k]; | 332 | v = attrs[k]; |
333 | var renamed = renames[k]; | 333 | var renamed = renames[k]; |
334 | if (k == "style" && typeof(v) == "string") { | 334 | if (k == "style" && typeof(v) == "string") { |
335 | elem.style.cssText = v; | 335 | elem.style.cssText = v; |
336 | } else if (typeof(renamed) == "string") { | 336 | } else if (typeof(renamed) == "string") { |
337 | elem[renamed] = v; | 337 | elem[renamed] = v; |
338 | } else if (typeof(elem[k]) == 'object' | 338 | } else if (typeof(elem[k]) == 'object' |
339 | && typeof(v) == 'object') { | 339 | && typeof(v) == 'object') { |
340 | if (k == "style" && MochiKit.Style) { | 340 | if (k == "style" && MochiKit.Style) { |
341 | MochiKit.Style.setStyle(elem, v); | 341 | MochiKit.Style.setStyle(elem, v); |
342 | } else { | 342 | } else { |
343 | updatetree(elem[k], v); | 343 | base.updatetree(elem[k], v); |
344 | } | 344 | } |
345 | } else if (k.substring(0, 2) == "on") { | 345 | } else if (k.substring(0, 2) == "on") { |
346 | if (typeof(v) == "string") { | 346 | if (typeof(v) == "string") { |
347 | v = new Function(v); | 347 | v = new Function(v); |
348 | } | 348 | } |
349 | elem[k] = v; | 349 | elem[k] = v; |
350 | } else { | 350 | } else { |
351 | elem.setAttribute(k, v); | 351 | elem.setAttribute(k, v); |
352 | } | 352 | } |
353 | if (typeof(elem[k]) == "string" && elem[k] != v) { | 353 | if (base.isValue(elem[k]) && elem[k] != v) { |
354 | // Also set property for weird attributes (see #302) | 354 | // Also set property for weird attributes (see #302 & #335) |
355 | elem[k] = v; | 355 | elem[k] = v; |
356 | } | 356 | } |
357 | } | 357 | } |
358 | } | 358 | } |
359 | } | 359 | } |
360 | return elem; | 360 | return elem; |
361 | }, | 361 | }, |
362 | 362 | ||
363 | /** @id MochiKit.DOM.appendChildNodes */ | 363 | /** @id MochiKit.DOM.appendChildNodes */ |
364 | appendChildNodes: function (node/*, nodes...*/) { | 364 | appendChildNodes: function (node/*, nodes...*/) { |
365 | var elem = node; | 365 | var elem = node; |
366 | var self = MochiKit.DOM; | 366 | var self = MochiKit.DOM; |
367 | if (typeof(node) == 'string') { | 367 | if (typeof(node) == 'string') { |
368 | elem = self.getElement(node); | 368 | elem = self.getElement(node); |
369 | } | 369 | } |
370 | var nodeStack = [ | 370 | var nodeStack = [ |
371 | self.coerceToDOM( | 371 | self.coerceToDOM( |
372 | MochiKit.Base.extend(null, arguments, 1), | 372 | MochiKit.Base.extend(null, arguments, 1), |
373 | elem | 373 | elem |
374 | ) | 374 | ) |
375 | ]; | 375 | ]; |
376 | var concat = MochiKit.Base.concat; | 376 | var concat = MochiKit.Base.concat; |
377 | while (nodeStack.length) { | 377 | while (nodeStack.length) { |
378 | var n = nodeStack.shift(); | 378 | var n = nodeStack.shift(); |
379 | if (typeof(n) == 'undefined' || n === null) { | 379 | if (typeof(n) == 'undefined' || n === null) { |
380 | // pass | 380 | // pass |
381 | } else if (typeof(n.nodeType) == 'number') { | 381 | } else if (typeof(n.nodeType) == 'number') { |
382 | elem.appendChild(n); | 382 | elem.appendChild(n); |
383 | } else { | 383 | } else { |
384 | nodeStack = concat(n, nodeStack); | 384 | nodeStack = concat(n, nodeStack); |
385 | } | 385 | } |
386 | } | 386 | } |
@@ -961,184 +961,219 @@ MochiKit.Base.update(MochiKit.DOM, { | |||
961 | if (__tmpElement && __tmpElement.attributes && | 961 | if (__tmpElement && __tmpElement.attributes && |
962 | __tmpElement.attributes.length > 0) { | 962 | __tmpElement.attributes.length > 0) { |
963 | // for braindead browsers (IE) that insert extra junk | 963 | // for braindead browsers (IE) that insert extra junk |
964 | var filter = m.filter; | 964 | var filter = m.filter; |
965 | attributeArray = function (node) { | 965 | attributeArray = function (node) { |
966 | /*** | 966 | /*** |
967 | 967 | ||
968 | Return an array of attributes for a given node, | 968 | Return an array of attributes for a given node, |
969 | filtering out attributes that don't belong for | 969 | filtering out attributes that don't belong for |
970 | that are inserted by "Certain Browsers". | 970 | that are inserted by "Certain Browsers". |
971 | 971 | ||
972 | ***/ | 972 | ***/ |
973 | return filter(attributeArray.ignoreAttrFilter, node.attributes); | 973 | return filter(attributeArray.ignoreAttrFilter, node.attributes); |
974 | }; | 974 | }; |
975 | attributeArray.ignoreAttr = {}; | 975 | attributeArray.ignoreAttr = {}; |
976 | var attrs = __tmpElement.attributes; | 976 | var attrs = __tmpElement.attributes; |
977 | var ignoreAttr = attributeArray.ignoreAttr; | 977 | var ignoreAttr = attributeArray.ignoreAttr; |
978 | for (var i = 0; i < attrs.length; i++) { | 978 | for (var i = 0; i < attrs.length; i++) { |
979 | var a = attrs[i]; | 979 | var a = attrs[i]; |
980 | ignoreAttr[a.name] = a.value; | 980 | ignoreAttr[a.name] = a.value; |
981 | } | 981 | } |
982 | attributeArray.ignoreAttrFilter = function (a) { | 982 | attributeArray.ignoreAttrFilter = function (a) { |
983 | return (attributeArray.ignoreAttr[a.name] != a.value); | 983 | return (attributeArray.ignoreAttr[a.name] != a.value); |
984 | }; | 984 | }; |
985 | attributeArray.compliant = false; | 985 | attributeArray.compliant = false; |
986 | attributeArray.renames = { | 986 | attributeArray.renames = { |
987 | "class": "className", | 987 | "class": "className", |
988 | "checked": "defaultChecked", | 988 | "checked": "defaultChecked", |
989 | "usemap": "useMap", | 989 | "usemap": "useMap", |
990 | "for": "htmlFor", | 990 | "for": "htmlFor", |
991 | "readonly": "readOnly", | 991 | "readonly": "readOnly", |
992 | "colspan": "colSpan", | 992 | "colspan": "colSpan", |
993 | "rowspan": "rowSpan", | ||
993 | "bgcolor": "bgColor", | 994 | "bgcolor": "bgColor", |
994 | "cellspacing": "cellSpacing", | 995 | "cellspacing": "cellSpacing", |
995 | "cellpadding": "cellPadding" | 996 | "cellpadding": "cellPadding" |
996 | }; | 997 | }; |
997 | } else { | 998 | } else { |
998 | attributeArray = function (node) { | 999 | attributeArray = function (node) { |
999 | return node.attributes; | 1000 | return node.attributes; |
1000 | }; | 1001 | }; |
1001 | attributeArray.compliant = true; | 1002 | attributeArray.compliant = true; |
1002 | attributeArray.ignoreAttr = {}; | 1003 | attributeArray.ignoreAttr = {}; |
1003 | attributeArray.renames = {}; | 1004 | attributeArray.renames = {}; |
1004 | } | 1005 | } |
1005 | attributeArray.__export__ = false; | 1006 | attributeArray.__export__ = false; |
1006 | this.attributeArray = attributeArray; | 1007 | this.attributeArray = attributeArray; |
1007 | 1008 | ||
1008 | // Backwards compatibility aliases | 1009 | // Backwards compatibility aliases |
1009 | /** @id MochiKit.DOM.computedStyle */ | 1010 | /** @id MochiKit.DOM.computedStyle */ |
1010 | m._deprecated(this, 'computedStyle', 'MochiKit.Style.getStyle', '1.4'); | 1011 | m._deprecated(this, 'computedStyle', 'MochiKit.Style.getStyle', '1.4', true); |
1011 | /** @id MochiKit.DOM.elementDimensions */ | 1012 | /** @id MochiKit.DOM.elementDimensions */ |
1012 | m._deprecated(this, 'elementDimensions', 'MochiKit.Style.getElementDimensions', '1.4'); | 1013 | m._deprecated(this, 'elementDimensions', 'MochiKit.Style.getElementDimensions', '1.4'); |
1013 | /** @id MochiKit.DOM.elementPosition */ | 1014 | /** @id MochiKit.DOM.elementPosition */ |
1014 | m._deprecated(this, 'elementPosition', 'MochiKit.Style.getElementPosition', '1.4'); | 1015 | m._deprecated(this, 'elementPosition', 'MochiKit.Style.getElementPosition', '1.4'); |
1015 | /** @id MochiKit.DOM.getViewportDimensions */ | 1016 | /** @id MochiKit.DOM.getViewportDimensions */ |
1016 | m._deprecated(this, 'getViewportDimensions', 'MochiKit.Style.getViewportDimensions', '1.4'); | 1017 | m._deprecated(this, 'getViewportDimensions', 'MochiKit.Style.getViewportDimensions', '1.4'); |
1017 | /** @id MochiKit.DOM.hideElement */ | 1018 | /** @id MochiKit.DOM.hideElement */ |
1018 | m._deprecated(this, 'hideElement', 'MochiKit.Style.hideElement', '1.4'); | 1019 | m._deprecated(this, 'hideElement', 'MochiKit.Style.hideElement', '1.4'); |
1019 | /** @id MochiKit.DOM.makeClipping */ | 1020 | /** @id MochiKit.DOM.makeClipping */ |
1020 | m._deprecated(this, 'makeClipping', 'MochiKit.Style.makeClipping', '1.4.1'); | 1021 | m._deprecated(this, 'makeClipping', 'MochiKit.Style.makeClipping', '1.4.1'); |
1021 | /** @id MochiKit.DOM.makePositioned */ | 1022 | /** @id MochiKit.DOM.makePositioned */ |
1022 | m._deprecated(this, 'makePositioned', 'MochiKit.Style.makePositioned', '1.4.1'); | 1023 | m._deprecated(this, 'makePositioned', 'MochiKit.Style.makePositioned', '1.4.1'); |
1023 | /** @id MochiKit.DOM.setElementDimensions */ | 1024 | /** @id MochiKit.DOM.setElementDimensions */ |
1024 | m._deprecated(this, 'setElementDimensions', 'MochiKit.Style.setElementDimensions', '1.4'); | 1025 | m._deprecated(this, 'setElementDimensions', 'MochiKit.Style.setElementDimensions', '1.4'); |
1025 | /** @id MochiKit.DOM.setElementPosition */ | 1026 | /** @id MochiKit.DOM.setElementPosition */ |
1026 | m._deprecated(this, 'setElementPosition', 'MochiKit.Style.setElementPosition', '1.4'); | 1027 | m._deprecated(this, 'setElementPosition', 'MochiKit.Style.setElementPosition', '1.4'); |
1027 | /** @id MochiKit.DOM.setDisplayForElement */ | 1028 | /** @id MochiKit.DOM.setDisplayForElement */ |
1028 | m._deprecated(this, 'setDisplayForElement', 'MochiKit.Style.setDisplayForElement', '1.4'); | 1029 | m._deprecated(this, 'setDisplayForElement', 'MochiKit.Style.setDisplayForElement', '1.4'); |
1029 | /** @id MochiKit.DOM.setOpacity */ | 1030 | /** @id MochiKit.DOM.setOpacity */ |
1030 | m._deprecated(this, 'setOpacity', 'MochiKit.Style.setOpacity', '1.4'); | 1031 | m._deprecated(this, 'setOpacity', 'MochiKit.Style.setOpacity', '1.4'); |
1031 | /** @id MochiKit.DOM.showElement */ | 1032 | /** @id MochiKit.DOM.showElement */ |
1032 | m._deprecated(this, 'showElement', 'MochiKit.Style.showElement', '1.4'); | 1033 | m._deprecated(this, 'showElement', 'MochiKit.Style.showElement', '1.4'); |
1033 | /** @id MochiKit.DOM.undoClipping */ | 1034 | /** @id MochiKit.DOM.undoClipping */ |
1034 | m._deprecated(this, 'undoClipping', 'MochiKit.Style.undoClipping', '1.4.1'); | 1035 | m._deprecated(this, 'undoClipping', 'MochiKit.Style.undoClipping', '1.4.1'); |
1035 | /** @id MochiKit.DOM.undoPositioned */ | 1036 | /** @id MochiKit.DOM.undoPositioned */ |
1036 | m._deprecated(this, 'undoPositioned', 'MochiKit.Style.undoPositioned', '1.4.1'); | 1037 | m._deprecated(this, 'undoPositioned', 'MochiKit.Style.undoPositioned', '1.4.1'); |
1037 | /** @id MochiKit.DOM.Coordinates */ | 1038 | /** @id MochiKit.DOM.Coordinates */ |
1038 | m._deprecated(this, 'Coordinates', 'MochiKit.Style.Coordinates', '1.4'); | 1039 | m._deprecated(this, 'Coordinates', 'MochiKit.Style.Coordinates', '1.4'); |
1039 | /** @id MochiKit.DOM.Dimensions */ | 1040 | /** @id MochiKit.DOM.Dimensions */ |
1040 | m._deprecated(this, 'Dimensions', 'MochiKit.Style.Dimensions', '1.4'); | 1041 | m._deprecated(this, 'Dimensions', 'MochiKit.Style.Dimensions', '1.4'); |
1041 | 1042 | ||
1042 | // shorthand for createDOM syntax | 1043 | // shorthand for createDOM syntax |
1043 | var createDOMFunc = this.createDOMFunc; | 1044 | var createDOMFunc = this.createDOMFunc; |
1044 | /** @id MochiKit.DOM.UL */ | ||
1045 | this.UL = createDOMFunc("ul"); | ||
1046 | /** @id MochiKit.DOM.OL */ | ||
1047 | this.OL = createDOMFunc("ol"); | ||
1048 | /** @id MochiKit.DOM.LI */ | ||
1049 | this.LI = createDOMFunc("li"); | ||
1050 | /** @id MochiKit.DOM.DL */ | ||
1051 | this.DL = createDOMFunc("dl"); | ||
1052 | /** @id MochiKit.DOM.DT */ | ||
1053 | this.DT = createDOMFunc("dt"); | ||
1054 | /** @id MochiKit.DOM.DD */ | ||
1055 | this.DD = createDOMFunc("dd"); | ||
1056 | /** @id MochiKit.DOM.TD */ | ||
1057 | this.TD = createDOMFunc("td"); | ||
1058 | /** @id MochiKit.DOM.TR */ | ||
1059 | this.TR = createDOMFunc("tr"); | ||
1060 | /** @id MochiKit.DOM.TBODY */ | ||
1061 | this.TBODY = createDOMFunc("tbody"); | ||
1062 | /** @id MochiKit.DOM.THEAD */ | ||
1063 | this.THEAD = createDOMFunc("thead"); | ||
1064 | /** @id MochiKit.DOM.TFOOT */ | ||
1065 | this.TFOOT = createDOMFunc("tfoot"); | ||
1066 | /** @id MochiKit.DOM.TABLE */ | ||
1067 | this.TABLE = createDOMFunc("table"); | ||
1068 | /** @id MochiKit.DOM.TH */ | ||
1069 | this.TH = createDOMFunc("th"); | ||
1070 | /** @id MochiKit.DOM.INPUT */ | ||
1071 | this.INPUT = createDOMFunc("input"); | ||
1072 | /** @id MochiKit.DOM.SPAN */ | ||
1073 | this.SPAN = createDOMFunc("span"); | ||
1074 | /** @id MochiKit.DOM.A */ | 1045 | /** @id MochiKit.DOM.A */ |
1075 | this.A = createDOMFunc("a"); | 1046 | this.A = createDOMFunc("a"); |
1076 | /** @id MochiKit.DOM.DIV */ | 1047 | /** @id MochiKit.DOM.ARTICLE */ |
1077 | this.DIV = createDOMFunc("div"); | 1048 | this.ARTICLE = createDOMFunc("article"); |
1078 | /** @id MochiKit.DOM.IMG */ | 1049 | /** @id MochiKit.DOM.ASIDE */ |
1079 | this.IMG = createDOMFunc("img"); | 1050 | this.ASIDE = createDOMFunc("aside"); |
1051 | /** @id MochiKit.DOM.BR */ | ||
1052 | this.BR = createDOMFunc("br"); | ||
1080 | /** @id MochiKit.DOM.BUTTON */ | 1053 | /** @id MochiKit.DOM.BUTTON */ |
1081 | this.BUTTON = createDOMFunc("button"); | 1054 | this.BUTTON = createDOMFunc("button"); |
1082 | /** @id MochiKit.DOM.TT */ | 1055 | /** @id MochiKit.DOM.CANVAS */ |
1083 | this.TT = createDOMFunc("tt"); | 1056 | this.CANVAS = createDOMFunc("canvas"); |
1084 | /** @id MochiKit.DOM.PRE */ | 1057 | /** @id MochiKit.DOM.CAPTION */ |
1085 | this.PRE = createDOMFunc("pre"); | 1058 | this.CAPTION = createDOMFunc("caption"); |
1059 | /** @id MochiKit.DOM.DD */ | ||
1060 | this.DD = createDOMFunc("dd"); | ||
1061 | /** @id MochiKit.DOM.DIV */ | ||
1062 | this.DIV = createDOMFunc("div"); | ||
1063 | /** @id MochiKit.DOM.DL */ | ||
1064 | this.DL = createDOMFunc("dl"); | ||
1065 | /** @id MochiKit.DOM.DT */ | ||
1066 | this.DT = createDOMFunc("dt"); | ||
1067 | /** @id MochiKit.DOM.FIELDSET */ | ||
1068 | this.FIELDSET = createDOMFunc("fieldset"); | ||
1069 | /** @id MochiKit.DOM.FIGURE */ | ||
1070 | this.FIGURE = createDOMFunc("figure"); | ||
1071 | /** @id MochiKit.DOM.FIGCAPTION */ | ||
1072 | this.FIGCAPTION = createDOMFunc("figcaption"); | ||
1073 | /** @id MochiKit.DOM.FOOTER */ | ||
1074 | this.FOOTER = createDOMFunc("footer"); | ||
1075 | /** @id MochiKit.DOM.FORM */ | ||
1076 | this.FORM = createDOMFunc("form"); | ||
1086 | /** @id MochiKit.DOM.H1 */ | 1077 | /** @id MochiKit.DOM.H1 */ |
1087 | this.H1 = createDOMFunc("h1"); | 1078 | this.H1 = createDOMFunc("h1"); |
1088 | /** @id MochiKit.DOM.H2 */ | 1079 | /** @id MochiKit.DOM.H2 */ |
1089 | this.H2 = createDOMFunc("h2"); | 1080 | this.H2 = createDOMFunc("h2"); |
1090 | /** @id MochiKit.DOM.H3 */ | 1081 | /** @id MochiKit.DOM.H3 */ |
1091 | this.H3 = createDOMFunc("h3"); | 1082 | this.H3 = createDOMFunc("h3"); |
1092 | /** @id MochiKit.DOM.H4 */ | 1083 | /** @id MochiKit.DOM.H4 */ |
1093 | this.H4 = createDOMFunc("h4"); | 1084 | this.H4 = createDOMFunc("h4"); |
1094 | /** @id MochiKit.DOM.H5 */ | 1085 | /** @id MochiKit.DOM.H5 */ |
1095 | this.H5 = createDOMFunc("h5"); | 1086 | this.H5 = createDOMFunc("h5"); |
1096 | /** @id MochiKit.DOM.H6 */ | 1087 | /** @id MochiKit.DOM.H6 */ |
1097 | this.H6 = createDOMFunc("h6"); | 1088 | this.H6 = createDOMFunc("h6"); |
1098 | /** @id MochiKit.DOM.BR */ | 1089 | /** @id MochiKit.DOM.HEADER */ |
1099 | this.BR = createDOMFunc("br"); | 1090 | this.HEADER = createDOMFunc("header"); |
1091 | /** @id MochiKit.DOM.HGROUP */ | ||
1092 | this.HGROUP = createDOMFunc("hgroup"); | ||
1100 | /** @id MochiKit.DOM.HR */ | 1093 | /** @id MochiKit.DOM.HR */ |
1101 | this.HR = createDOMFunc("hr"); | 1094 | this.HR = createDOMFunc("hr"); |
1095 | /** @id MochiKit.DOM.IFRAME */ | ||
1096 | this.IFRAME = createDOMFunc("iframe"); | ||
1097 | /** @id MochiKit.DOM.IMG */ | ||
1098 | this.IMG = createDOMFunc("img"); | ||
1099 | /** @id MochiKit.DOM.INPUT */ | ||
1100 | this.INPUT = createDOMFunc("input"); | ||
1102 | /** @id MochiKit.DOM.LABEL */ | 1101 | /** @id MochiKit.DOM.LABEL */ |
1103 | this.LABEL = createDOMFunc("label"); | 1102 | this.LABEL = createDOMFunc("label"); |
1104 | /** @id MochiKit.DOM.TEXTAREA */ | 1103 | /** @id MochiKit.DOM.LEGEND */ |
1105 | this.TEXTAREA = createDOMFunc("textarea"); | 1104 | this.LEGEND = createDOMFunc("legend"); |
1106 | /** @id MochiKit.DOM.FORM */ | 1105 | /** @id MochiKit.DOM.LI */ |
1107 | this.FORM = createDOMFunc("form"); | 1106 | this.LI = createDOMFunc("li"); |
1107 | /** @id MochiKit.DOM.LINK */ | ||
1108 | this.LINK = createDOMFunc("link"); | ||
1109 | /** @id MochiKit.DOM.MARK */ | ||
1110 | this.MARK = createDOMFunc("mark"); | ||
1111 | /** @id MochiKit.DOM.METER */ | ||
1112 | this.METER = createDOMFunc("meter"); | ||
1113 | /** @id MochiKit.DOM.NAV */ | ||
1114 | this.NAV = createDOMFunc("nav"); | ||
1115 | /** @id MochiKit.DOM.OL */ | ||
1116 | this.OL = createDOMFunc("ol"); | ||
1117 | /** @id MochiKit.DOM.OPTGROUP */ | ||
1118 | this.OPTGROUP = createDOMFunc("optgroup"); | ||
1119 | /** @id MochiKit.DOM.OPTION */ | ||
1120 | this.OPTION = createDOMFunc("option"); | ||
1108 | /** @id MochiKit.DOM.P */ | 1121 | /** @id MochiKit.DOM.P */ |
1109 | this.P = createDOMFunc("p"); | 1122 | this.P = createDOMFunc("p"); |
1123 | /** @id MochiKit.DOM.PRE */ | ||
1124 | this.PRE = createDOMFunc("pre"); | ||
1125 | /** @id MochiKit.DOM.PROGRESS */ | ||
1126 | this.PROGRESS = createDOMFunc("progress"); | ||
1127 | /** @id MochiKit.DOM.SCRIPT */ | ||
1128 | this.SCRIPT = createDOMFunc("script"); | ||
1129 | /** @id MochiKit.DOM.SECTION */ | ||
1130 | this.SECTION = createDOMFunc("section"); | ||
1110 | /** @id MochiKit.DOM.SELECT */ | 1131 | /** @id MochiKit.DOM.SELECT */ |
1111 | this.SELECT = createDOMFunc("select"); | 1132 | this.SELECT = createDOMFunc("select"); |
1112 | /** @id MochiKit.DOM.OPTION */ | 1133 | /** @id MochiKit.DOM.SPAN */ |
1113 | this.OPTION = createDOMFunc("option"); | 1134 | this.SPAN = createDOMFunc("span"); |
1114 | /** @id MochiKit.DOM.OPTGROUP */ | ||
1115 | this.OPTGROUP = createDOMFunc("optgroup"); | ||
1116 | /** @id MochiKit.DOM.LEGEND */ | ||
1117 | this.LEGEND = createDOMFunc("legend"); | ||
1118 | /** @id MochiKit.DOM.FIELDSET */ | ||
1119 | this.FIELDSET = createDOMFunc("fieldset"); | ||
1120 | /** @id MochiKit.DOM.STRONG */ | 1135 | /** @id MochiKit.DOM.STRONG */ |
1121 | this.STRONG = createDOMFunc("strong"); | 1136 | this.STRONG = createDOMFunc("strong"); |
1122 | /** @id MochiKit.DOM.CANVAS */ | 1137 | /** @id MochiKit.DOM.STYLE */ |
1123 | this.CANVAS = createDOMFunc("canvas"); | 1138 | this.STYLE = createDOMFunc("style"); |
1124 | 1139 | /** @id MochiKit.DOM.TABLE */ | |
1140 | this.TABLE = createDOMFunc("table"); | ||
1141 | /** @id MochiKit.DOM.TBODY */ | ||
1142 | this.TBODY = createDOMFunc("tbody"); | ||
1143 | /** @id MochiKit.DOM.TD */ | ||
1144 | this.TD = createDOMFunc("td"); | ||
1145 | /** @id MochiKit.DOM.TEXTAREA */ | ||
1146 | this.TEXTAREA = createDOMFunc("textarea"); | ||
1147 | /** @id MochiKit.DOM.TFOOT */ | ||
1148 | this.TFOOT = createDOMFunc("tfoot"); | ||
1149 | /** @id MochiKit.DOM.TH */ | ||
1150 | this.TH = createDOMFunc("th"); | ||
1151 | /** @id MochiKit.DOM.THEAD */ | ||
1152 | this.THEAD = createDOMFunc("thead"); | ||
1153 | /** @id MochiKit.DOM.TR */ | ||
1154 | this.TR = createDOMFunc("tr"); | ||
1155 | /** @id MochiKit.DOM.TT */ | ||
1156 | this.TT = createDOMFunc("tt"); | ||
1157 | /** @id MochiKit.DOM.UL */ | ||
1158 | this.UL = createDOMFunc("ul"); | ||
1159 | /** @id MochiKit.DOM.NBSP */ | ||
1160 | this.NBSP = "\u00a0"; | ||
1125 | /** @id MochiKit.DOM.$ */ | 1161 | /** @id MochiKit.DOM.$ */ |
1126 | this.$ = this.getElement; | 1162 | this.$ = this.getElement; |
1127 | 1163 | ||
1128 | m.nameFunctions(this); | 1164 | m.nameFunctions(this); |
1129 | |||
1130 | } | 1165 | } |
1131 | }); | 1166 | }); |
1132 | 1167 | ||
1133 | 1168 | ||
1134 | MochiKit.DOM.__new__(((typeof(window) == "undefined") ? this : window)); | 1169 | MochiKit.DOM.__new__(((typeof(window) == "undefined") ? this : window)); |
1135 | 1170 | ||
1136 | // | 1171 | // |
1137 | // XXX: Internet Explorer blows | 1172 | // XXX: Internet Explorer blows |
1138 | // | 1173 | // |
1139 | if (MochiKit.__export__) { | 1174 | if (MochiKit.__export__) { |
1140 | withWindow = MochiKit.DOM.withWindow; | 1175 | withWindow = MochiKit.DOM.withWindow; |
1141 | withDocument = MochiKit.DOM.withDocument; | 1176 | withDocument = MochiKit.DOM.withDocument; |
1142 | } | 1177 | } |
1143 | 1178 | ||
1144 | MochiKit.Base._exportSymbols(this, MochiKit.DOM); | 1179 | MochiKit.Base._exportSymbols(this, MochiKit.DOM); |
diff --git a/frontend/gamma/js/MochiKit/DateTime.js b/frontend/gamma/js/MochiKit/DateTime.js index c7b2d25..658084c 100644 --- a/frontend/gamma/js/MochiKit/DateTime.js +++ b/frontend/gamma/js/MochiKit/DateTime.js | |||
@@ -1,173 +1,176 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.DateTime 1.5 | 3 | MochiKit.DateTime 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('DateTime', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'DateTime', '1.5', ['Base']); |
12 | 12 | ||
13 | /** @id MochiKit.DateTime.isoDate */ | 13 | /** @id MochiKit.DateTime.isoDate */ |
14 | MochiKit.DateTime.isoDate = function (str) { | 14 | MochiKit.DateTime.isoDate = function (str) { |
15 | str = str + ""; | 15 | str = str + ""; |
16 | if (typeof(str) != "string" || str.length === 0) { | 16 | if (typeof(str) != "string" || str.length === 0) { |
17 | return null; | 17 | return null; |
18 | } | 18 | } |
19 | var iso = str.split('-'); | 19 | var iso = str.split('-'); |
20 | if (iso.length === 0) { | 20 | if (iso.length === 0) { |
21 | return null; | 21 | return null; |
22 | } | 22 | } |
23 | var date = new Date(iso[0], iso[1] - 1, iso[2]); | 23 | var date = new Date(parseInt(iso[0], 10), parseInt(iso[1], 10) - 1, parseInt(iso[2], 10)); |
24 | date.setFullYear(iso[0]); | 24 | date.setFullYear(iso[0]); |
25 | date.setMonth(iso[1] - 1); | 25 | date.setMonth(iso[1] - 1); |
26 | date.setDate(iso[2]); | 26 | date.setDate(iso[2]); |
27 | return date; | 27 | return date; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; | 30 | MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; |
31 | 31 | ||
32 | /** @id MochiKit.DateTime.isoTimestamp */ | 32 | /** @id MochiKit.DateTime.isoTimestamp */ |
33 | MochiKit.DateTime.isoTimestamp = function (str) { | 33 | MochiKit.DateTime.isoTimestamp = function (str) { |
34 | str = str + ""; | 34 | str = str + ""; |
35 | if (typeof(str) != "string" || str.length === 0) { | 35 | if (typeof(str) != "string" || str.length === 0) { |
36 | return null; | 36 | return null; |
37 | } | 37 | } |
38 | var res = str.match(MochiKit.DateTime._isoRegexp); | 38 | var res = str.match(MochiKit.DateTime._isoRegexp); |
39 | if (typeof(res) == "undefined" || res === null) { | 39 | if (typeof(res) == "undefined" || res === null) { |
40 | return null; | 40 | return null; |
41 | } | 41 | } |
42 | var year, month, day, hour, min, sec, msec; | 42 | var year, month, day, hour, min, sec, msec; |
43 | year = parseInt(res[1], 10); | 43 | year = parseInt(res[1], 10); |
44 | if (typeof(res[2]) == "undefined" || res[2] === '') { | 44 | if (typeof(res[2]) == "undefined" || res[2] === '') { |
45 | return new Date(year); | 45 | return new Date(year); |
46 | } | 46 | } |
47 | month = parseInt(res[2], 10) - 1; | 47 | month = parseInt(res[2], 10) - 1; |
48 | day = parseInt(res[3], 10); | 48 | day = parseInt(res[3], 10); |
49 | if (typeof(res[4]) == "undefined" || res[4] === '') { | 49 | if (typeof(res[4]) == "undefined" || res[4] === '') { |
50 | return new Date(year, month, day); | 50 | return new Date(year, month, day); |
51 | } | 51 | } |
52 | hour = parseInt(res[4], 10); | 52 | hour = parseInt(res[4], 10); |
53 | min = parseInt(res[5], 10); | 53 | min = parseInt(res[5], 10); |
54 | sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0; | 54 | sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0; |
55 | if (typeof(res[7]) != "undefined" && res[7] !== '') { | 55 | if (typeof(res[7]) != "undefined" && res[7] !== '') { |
56 | msec = Math.round(1000.0 * parseFloat("0." + res[7])); | 56 | msec = Math.round(1000.0 * parseFloat("0." + res[7])); |
57 | } else { | 57 | } else { |
58 | msec = 0; | 58 | msec = 0; |
59 | } | 59 | } |
60 | if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) { | 60 | if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) { |
61 | return new Date(year, month, day, hour, min, sec, msec); | 61 | return new Date(year, month, day, hour, min, sec, msec); |
62 | } | 62 | } |
63 | var ofs; | 63 | var ofs; |
64 | if (typeof(res[9]) != "undefined" && res[9] !== '') { | 64 | if (typeof(res[9]) != "undefined" && res[9] !== '') { |
65 | ofs = parseInt(res[10], 10) * 3600000; | 65 | ofs = parseInt(res[10], 10) * 3600000; |
66 | if (typeof(res[11]) != "undefined" && res[11] !== '') { | 66 | if (typeof(res[11]) != "undefined" && res[11] !== '') { |
67 | ofs += parseInt(res[11], 10) * 60000; | 67 | ofs += parseInt(res[11], 10) * 60000; |
68 | } | 68 | } |
69 | if (res[9] == "-") { | 69 | if (res[9] == "-") { |
70 | ofs = -ofs; | 70 | ofs = -ofs; |
71 | } | 71 | } |
72 | } else { | 72 | } else { |
73 | ofs = 0; | 73 | ofs = 0; |
74 | } | 74 | } |
75 | return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs); | 75 | return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | /** @id MochiKit.DateTime.toISOTime */ | 78 | /** @id MochiKit.DateTime.toISOTime */ |
79 | MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) { | 79 | MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) { |
80 | if (typeof(date) == "undefined" || date === null) { | 80 | if (typeof(date) == "undefined" || date === null) { |
81 | return null; | 81 | return null; |
82 | } | 82 | } |
83 | var hh = date.getHours(); | 83 | var _padTwo = MochiKit.DateTime._padTwo; |
84 | var mm = date.getMinutes(); | 84 | if (realISO) { |
85 | var ss = date.getSeconds(); | 85 | // adjust date for UTC timezone |
86 | date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); | ||
87 | } | ||
86 | var lst = [ | 88 | var lst = [ |
87 | ((realISO && (hh < 10)) ? "0" + hh : hh), | 89 | (realISO ? _padTwo(date.getHours()) : date.getHours()), |
88 | ((mm < 10) ? "0" + mm : mm), | 90 | _padTwo(date.getMinutes()), |
89 | ((ss < 10) ? "0" + ss : ss) | 91 | _padTwo(date.getSeconds()) |
90 | ]; | 92 | ]; |
91 | return lst.join(":"); | 93 | return lst.join(":") + (realISO ? "Z" : ""); |
92 | }; | 94 | }; |
93 | 95 | ||
94 | /** @id MochiKit.DateTime.toISOTimeStamp */ | 96 | /** @id MochiKit.DateTime.toISOTimeStamp */ |
95 | MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) { | 97 | MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) { |
96 | if (typeof(date) == "undefined" || date === null) { | 98 | if (typeof(date) == "undefined" || date === null) { |
97 | return null; | 99 | return null; |
98 | } | 100 | } |
101 | var time = MochiKit.DateTime.toISOTime(date, realISO); | ||
99 | var sep = realISO ? "T" : " "; | 102 | var sep = realISO ? "T" : " "; |
100 | var foot = realISO ? "Z" : ""; | ||
101 | if (realISO) { | 103 | if (realISO) { |
104 | // adjust date for UTC timezone | ||
102 | date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); | 105 | date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); |
103 | } | 106 | } |
104 | return MochiKit.DateTime.toISODate(date) + sep + MochiKit.DateTime.toISOTime(date, realISO) + foot; | 107 | return MochiKit.DateTime.toISODate(date) + sep + time; |
105 | }; | 108 | }; |
106 | 109 | ||
107 | /** @id MochiKit.DateTime.toISODate */ | 110 | /** @id MochiKit.DateTime.toISODate */ |
108 | MochiKit.DateTime.toISODate = function (date) { | 111 | MochiKit.DateTime.toISODate = function (date) { |
109 | if (typeof(date) == "undefined" || date === null) { | 112 | if (typeof(date) == "undefined" || date === null) { |
110 | return null; | 113 | return null; |
111 | } | 114 | } |
112 | var _padTwo = MochiKit.DateTime._padTwo; | 115 | var _padTwo = MochiKit.DateTime._padTwo; |
113 | var _padFour = MochiKit.DateTime._padFour; | 116 | var _padFour = MochiKit.DateTime._padFour; |
114 | return [ | 117 | return [ |
115 | _padFour(date.getFullYear()), | 118 | _padFour(date.getFullYear()), |
116 | _padTwo(date.getMonth() + 1), | 119 | _padTwo(date.getMonth() + 1), |
117 | _padTwo(date.getDate()) | 120 | _padTwo(date.getDate()) |
118 | ].join("-"); | 121 | ].join("-"); |
119 | }; | 122 | }; |
120 | 123 | ||
121 | /** @id MochiKit.DateTime.americanDate */ | 124 | /** @id MochiKit.DateTime.americanDate */ |
122 | MochiKit.DateTime.americanDate = function (d) { | 125 | MochiKit.DateTime.americanDate = function (d) { |
123 | d = d + ""; | 126 | d = d + ""; |
124 | if (typeof(d) != "string" || d.length === 0) { | 127 | if (typeof(d) != "string" || d.length === 0) { |
125 | return null; | 128 | return null; |
126 | } | 129 | } |
127 | var a = d.split('/'); | 130 | var a = d.split('/'); |
128 | return new Date(a[2], a[0] - 1, a[1]); | 131 | return new Date(a[2], a[0] - 1, a[1]); |
129 | }; | 132 | }; |
130 | 133 | ||
131 | MochiKit.DateTime._padTwo = function (n) { | 134 | MochiKit.DateTime._padTwo = function (n) { |
132 | return (n > 9) ? n : "0" + n; | 135 | return (n > 9) ? n : "0" + n; |
133 | }; | 136 | }; |
134 | 137 | ||
135 | MochiKit.DateTime._padFour = function(n) { | 138 | MochiKit.DateTime._padFour = function(n) { |
136 | switch(n.toString().length) { | 139 | switch(n.toString().length) { |
137 | case 1: return "000" + n; break; | 140 | case 1: return "000" + n; break; |
138 | case 2: return "00" + n; break; | 141 | case 2: return "00" + n; break; |
139 | case 3: return "0" + n; break; | 142 | case 3: return "0" + n; break; |
140 | case 4: | 143 | case 4: |
141 | default: | 144 | default: |
142 | return n; | 145 | return n; |
143 | } | 146 | } |
144 | }; | 147 | }; |
145 | 148 | ||
146 | /** @id MochiKit.DateTime.toPaddedAmericanDate */ | 149 | /** @id MochiKit.DateTime.toPaddedAmericanDate */ |
147 | MochiKit.DateTime.toPaddedAmericanDate = function (d) { | 150 | MochiKit.DateTime.toPaddedAmericanDate = function (d) { |
148 | if (typeof(d) == "undefined" || d === null) { | 151 | if (typeof(d) == "undefined" || d === null) { |
149 | return null; | 152 | return null; |
150 | } | 153 | } |
151 | var _padTwo = MochiKit.DateTime._padTwo; | 154 | var _padTwo = MochiKit.DateTime._padTwo; |
152 | return [ | 155 | return [ |
153 | _padTwo(d.getMonth() + 1), | 156 | _padTwo(d.getMonth() + 1), |
154 | _padTwo(d.getDate()), | 157 | _padTwo(d.getDate()), |
155 | d.getFullYear() | 158 | d.getFullYear() |
156 | ].join('/'); | 159 | ].join('/'); |
157 | }; | 160 | }; |
158 | 161 | ||
159 | /** @id MochiKit.DateTime.toAmericanDate */ | 162 | /** @id MochiKit.DateTime.toAmericanDate */ |
160 | MochiKit.DateTime.toAmericanDate = function (d) { | 163 | MochiKit.DateTime.toAmericanDate = function (d) { |
161 | if (typeof(d) == "undefined" || d === null) { | 164 | if (typeof(d) == "undefined" || d === null) { |
162 | return null; | 165 | return null; |
163 | } | 166 | } |
164 | return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/'); | 167 | return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/'); |
165 | }; | 168 | }; |
166 | 169 | ||
167 | MochiKit.DateTime.__new__ = function () { | 170 | MochiKit.DateTime.__new__ = function () { |
168 | MochiKit.Base.nameFunctions(this); | 171 | MochiKit.Base.nameFunctions(this); |
169 | }; | 172 | }; |
170 | 173 | ||
171 | MochiKit.DateTime.__new__(); | 174 | MochiKit.DateTime.__new__(); |
172 | 175 | ||
173 | MochiKit.Base._exportSymbols(this, MochiKit.DateTime); | 176 | MochiKit.Base._exportSymbols(this, MochiKit.DateTime); |
diff --git a/frontend/gamma/js/MochiKit/DragAndDrop.js b/frontend/gamma/js/MochiKit/DragAndDrop.js index 62777c5..cf84f77 100644 --- a/frontend/gamma/js/MochiKit/DragAndDrop.js +++ b/frontend/gamma/js/MochiKit/DragAndDrop.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | MochiKit.DragAndDrop 1.5 | 2 | MochiKit.DragAndDrop 1.5 |
3 | 3 | ||
4 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 4 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
5 | 5 | ||
6 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) | 6 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
7 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) | 7 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); | 11 | MochiKit.Base.module(MochiKit, 'DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); |
12 | 12 | ||
13 | MochiKit.DragAndDrop.Droppables = { | 13 | MochiKit.DragAndDrop.Droppables = { |
14 | /*** | 14 | /*** |
15 | 15 | ||
16 | Manage all droppables. Shouldn't be used, use the Droppable object instead. | 16 | Manage all droppables. Shouldn't be used, use the Droppable object instead. |
17 | 17 | ||
18 | ***/ | 18 | ***/ |
19 | drops: [], | 19 | drops: [], |
20 | 20 | ||
21 | remove: function (element) { | 21 | remove: function (element) { |
22 | this.drops = MochiKit.Base.filter(function (d) { | 22 | this.drops = MochiKit.Base.filter(function (d) { |
23 | return d.element != MochiKit.DOM.getElement(element); | 23 | return d.element != MochiKit.DOM.getElement(element); |
24 | }, this.drops); | 24 | }, this.drops); |
25 | }, | 25 | }, |
26 | 26 | ||
27 | register: function (drop) { | 27 | register: function (drop) { |
28 | this.drops.push(drop); | 28 | this.drops.push(drop); |
29 | }, | 29 | }, |
30 | 30 | ||
31 | unregister: function (drop) { | 31 | unregister: function (drop) { |
32 | this.drops = MochiKit.Base.filter(function (d) { | 32 | this.drops = MochiKit.Base.filter(function (d) { |
33 | return d != drop; | 33 | return d != drop; |
34 | }, this.drops); | 34 | }, this.drops); |
35 | }, | 35 | }, |
36 | 36 | ||
37 | prepare: function (element) { | 37 | prepare: function (element) { |
38 | MochiKit.Base.map(function (drop) { | 38 | MochiKit.Base.map(function (drop) { |
39 | if (drop.isAccepted(element)) { | 39 | if (drop.isAccepted(element)) { |
40 | if (drop.options.activeclass) { | 40 | if (drop.options.activeclass) { |
41 | MochiKit.DOM.addElementClass(drop.element, | 41 | MochiKit.DOM.addElementClass(drop.element, |
42 | drop.options.activeclass); | 42 | drop.options.activeclass); |
43 | } | 43 | } |
@@ -277,66 +277,67 @@ MochiKit.DragAndDrop.Draggables = { | |||
277 | }, | 277 | }, |
278 | 278 | ||
279 | unregister: function (draggable) { | 279 | unregister: function (draggable) { |
280 | this.drags = MochiKit.Base.filter(function (d) { | 280 | this.drags = MochiKit.Base.filter(function (d) { |
281 | return d != draggable; | 281 | return d != draggable; |
282 | }, this.drags); | 282 | }, this.drags); |
283 | if (this.drags.length === 0) { | 283 | if (this.drags.length === 0) { |
284 | var disc = MochiKit.Signal.disconnect; | 284 | var disc = MochiKit.Signal.disconnect; |
285 | disc(this.eventMouseUp); | 285 | disc(this.eventMouseUp); |
286 | disc(this.eventMouseMove); | 286 | disc(this.eventMouseMove); |
287 | disc(this.eventKeypress); | 287 | disc(this.eventKeypress); |
288 | } | 288 | } |
289 | }, | 289 | }, |
290 | 290 | ||
291 | activate: function (draggable) { | 291 | activate: function (draggable) { |
292 | // allows keypress events if window is not currently focused | 292 | // allows keypress events if window is not currently focused |
293 | // fails for Safari | 293 | // fails for Safari |
294 | window.focus(); | 294 | window.focus(); |
295 | this.activeDraggable = draggable; | 295 | this.activeDraggable = draggable; |
296 | }, | 296 | }, |
297 | 297 | ||
298 | deactivate: function () { | 298 | deactivate: function () { |
299 | this.activeDraggable = null; | 299 | this.activeDraggable = null; |
300 | }, | 300 | }, |
301 | 301 | ||
302 | updateDrag: function (event) { | 302 | updateDrag: function (event) { |
303 | if (!this.activeDraggable) { | 303 | if (!this.activeDraggable) { |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | var pointer = event.mouse(); | 306 | var pointer = event.mouse(); |
307 | // Mozilla-based browsers fire successive mousemove events with | 307 | // Mozilla-based browsers fire successive mousemove events with |
308 | // the same coordinates, prevent needless redrawing (moz bug?) | 308 | // the same coordinates, prevent needless redrawing (moz bug?) |
309 | if (this._lastPointer && (MochiKit.Base.repr(this._lastPointer.page) == | 309 | if (this._lastPointer && |
310 | MochiKit.Base.repr(pointer.page))) { | 310 | this._lastPointer.page.x == pointer.page.x && |
311 | this._lastPointer.page.y == pointer.page.y) { | ||
311 | return; | 312 | return; |
312 | } | 313 | } |
313 | this._lastPointer = pointer; | 314 | this._lastPointer = pointer; |
314 | this.activeDraggable.updateDrag(event, pointer); | 315 | this.activeDraggable.updateDrag(event, pointer); |
315 | }, | 316 | }, |
316 | 317 | ||
317 | endDrag: function (event) { | 318 | endDrag: function (event) { |
318 | if (!this.activeDraggable) { | 319 | if (!this.activeDraggable) { |
319 | return; | 320 | return; |
320 | } | 321 | } |
321 | this._lastPointer = null; | 322 | this._lastPointer = null; |
322 | this.activeDraggable.endDrag(event); | 323 | this.activeDraggable.endDrag(event); |
323 | this.activeDraggable = null; | 324 | this.activeDraggable = null; |
324 | }, | 325 | }, |
325 | 326 | ||
326 | keyPress: function (event) { | 327 | keyPress: function (event) { |
327 | if (this.activeDraggable) { | 328 | if (this.activeDraggable) { |
328 | this.activeDraggable.keyPress(event); | 329 | this.activeDraggable.keyPress(event); |
329 | } | 330 | } |
330 | }, | 331 | }, |
331 | 332 | ||
332 | notify: function (eventName, draggable, event) { | 333 | notify: function (eventName, draggable, event) { |
333 | MochiKit.Signal.signal(this, eventName, draggable, event); | 334 | MochiKit.Signal.signal(this, eventName, draggable, event); |
334 | } | 335 | } |
335 | }; | 336 | }; |
336 | 337 | ||
337 | /** @id MochiKit.DragAndDrop.Draggable */ | 338 | /** @id MochiKit.DragAndDrop.Draggable */ |
338 | MochiKit.DragAndDrop.Draggable = function (element, options) { | 339 | MochiKit.DragAndDrop.Draggable = function (element, options) { |
339 | var cls = arguments.callee; | 340 | var cls = arguments.callee; |
340 | if (!(this instanceof cls)) { | 341 | if (!(this instanceof cls)) { |
341 | return new cls(element, options); | 342 | return new cls(element, options); |
342 | } | 343 | } |
@@ -413,105 +414,104 @@ MochiKit.DragAndDrop.Draggable.prototype = { | |||
413 | this.handle = d.getElement(options.handle); | 414 | this.handle = d.getElement(options.handle); |
414 | } | 415 | } |
415 | if (!this.handle) { | 416 | if (!this.handle) { |
416 | this.handle = this.element; | 417 | this.handle = this.element; |
417 | } | 418 | } |
418 | 419 | ||
419 | if (options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { | 420 | if (options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { |
420 | options.scroll = d.getElement(options.scroll); | 421 | options.scroll = d.getElement(options.scroll); |
421 | this._isScrollChild = MochiKit.DOM.isChildNode(this.element, options.scroll); | 422 | this._isScrollChild = MochiKit.DOM.isChildNode(this.element, options.scroll); |
422 | } | 423 | } |
423 | 424 | ||
424 | MochiKit.Style.makePositioned(this.element); // fix IE | 425 | MochiKit.Style.makePositioned(this.element); // fix IE |
425 | 426 | ||
426 | this.delta = this.currentDelta(); | 427 | this.delta = this.currentDelta(); |
427 | this.options = options; | 428 | this.options = options; |
428 | this.dragging = false; | 429 | this.dragging = false; |
429 | 430 | ||
430 | this.eventMouseDown = MochiKit.Signal.connect(this.handle, | 431 | this.eventMouseDown = MochiKit.Signal.connect(this.handle, |
431 | 'onmousedown', this, this.initDrag); | 432 | 'onmousedown', this, this.initDrag); |
432 | MochiKit.DragAndDrop.Draggables.register(this); | 433 | MochiKit.DragAndDrop.Draggables.register(this); |
433 | }, | 434 | }, |
434 | 435 | ||
435 | /** @id MochiKit.DragAndDrop.destroy */ | 436 | /** @id MochiKit.DragAndDrop.destroy */ |
436 | destroy: function () { | 437 | destroy: function () { |
437 | MochiKit.Signal.disconnect(this.eventMouseDown); | 438 | MochiKit.Signal.disconnect(this.eventMouseDown); |
438 | MochiKit.DragAndDrop.Draggables.unregister(this); | 439 | MochiKit.DragAndDrop.Draggables.unregister(this); |
439 | }, | 440 | }, |
440 | 441 | ||
441 | /** @id MochiKit.DragAndDrop.currentDelta */ | 442 | /** @id MochiKit.DragAndDrop.currentDelta */ |
442 | currentDelta: function () { | 443 | currentDelta: function () { |
443 | var s = MochiKit.Style.getStyle; | 444 | var s = MochiKit.Style.getStyle; |
444 | return [ | 445 | return [ |
445 | parseInt(s(this.element, 'left') || '0'), | 446 | parseInt(s(this.element, 'left') || '0', 10), |
446 | parseInt(s(this.element, 'top') || '0')]; | 447 | parseInt(s(this.element, 'top') || '0', 10)]; |
447 | }, | 448 | }, |
448 | 449 | ||
449 | /** @id MochiKit.DragAndDrop.initDrag */ | 450 | /** @id MochiKit.DragAndDrop.initDrag */ |
450 | initDrag: function (event) { | 451 | initDrag: function (event) { |
451 | if (!event.mouse().button.left) { | 452 | if (!event.mouse().button.left) { |
452 | return; | 453 | return; |
453 | } | 454 | } |
454 | // abort on form elements, fixes a Firefox issue | 455 | // abort on form elements, fixes a Firefox issue |
455 | var src = event.target(); | 456 | var src = event.target(); |
456 | var tagName = (src.tagName || '').toUpperCase(); | 457 | var tagName = (src.tagName || '').toUpperCase(); |
457 | if (tagName === 'INPUT' || tagName === 'SELECT' || | 458 | if (tagName === 'INPUT' || tagName === 'SELECT' || |
458 | tagName === 'OPTION' || tagName === 'BUTTON' || | 459 | tagName === 'OPTION' || tagName === 'BUTTON' || |
459 | tagName === 'TEXTAREA') { | 460 | tagName === 'TEXTAREA') { |
460 | return; | 461 | return; |
461 | } | 462 | } |
462 | 463 | ||
463 | if (this._revert) { | 464 | if (this._revert) { |
464 | this._revert.cancel(); | 465 | this._revert.cancel(); |
465 | this._revert = null; | 466 | this._revert = null; |
466 | } | 467 | } |
467 | 468 | ||
468 | var pointer = event.mouse(); | 469 | var pointer = event.mouse(); |
469 | var pos = MochiKit.Position.cumulativeOffset(this.element); | 470 | var pos = MochiKit.Position.cumulativeOffset(this.element); |
470 | this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y]; | 471 | this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y]; |
471 | 472 | ||
472 | MochiKit.DragAndDrop.Draggables.activate(this); | 473 | MochiKit.DragAndDrop.Draggables.activate(this); |
473 | event.stop(); | 474 | event.stop(); |
474 | }, | 475 | }, |
475 | 476 | ||
476 | /** @id MochiKit.DragAndDrop.startDrag */ | 477 | /** @id MochiKit.DragAndDrop.startDrag */ |
477 | startDrag: function (event) { | 478 | startDrag: function (event) { |
478 | this.dragging = true; | 479 | this.dragging = true; |
479 | if (this.options.selectclass) { | 480 | if (this.options.selectclass) { |
480 | MochiKit.DOM.addElementClass(this.element, | 481 | MochiKit.DOM.addElementClass(this.element, |
481 | this.options.selectclass); | 482 | this.options.selectclass); |
482 | } | 483 | } |
483 | if (this.options.zindex) { | 484 | if (this.options.zindex) { |
484 | this.originalZ = parseInt(MochiKit.Style.getStyle(this.element, | 485 | this.originalZ = MochiKit.Style.getStyle(this.element, 'z-index'); |
485 | 'z-index') || '0'); | ||
486 | this.element.style.zIndex = this.options.zindex; | 486 | this.element.style.zIndex = this.options.zindex; |
487 | } | 487 | } |
488 | 488 | ||
489 | if (this.options.ghosting) { | 489 | if (this.options.ghosting) { |
490 | this._clone = this.element.cloneNode(true); | 490 | this._clone = this.element.cloneNode(true); |
491 | this.ghostPosition = MochiKit.Position.absolutize(this.element); | 491 | this.ghostPosition = MochiKit.Position.absolutize(this.element); |
492 | this.element.parentNode.insertBefore(this._clone, this.element); | 492 | this.element.parentNode.insertBefore(this._clone, this.element); |
493 | } | 493 | } |
494 | 494 | ||
495 | if (this.options.scroll) { | 495 | if (this.options.scroll) { |
496 | if (this.options.scroll == window) { | 496 | if (this.options.scroll == window) { |
497 | var where = this._getWindowScroll(this.options.scroll); | 497 | var where = this._getWindowScroll(this.options.scroll); |
498 | this.originalScrollLeft = where.left; | 498 | this.originalScrollLeft = where.left; |
499 | this.originalScrollTop = where.top; | 499 | this.originalScrollTop = where.top; |
500 | } else { | 500 | } else { |
501 | this.originalScrollLeft = this.options.scroll.scrollLeft; | 501 | this.originalScrollLeft = this.options.scroll.scrollLeft; |
502 | this.originalScrollTop = this.options.scroll.scrollTop; | 502 | this.originalScrollTop = this.options.scroll.scrollTop; |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | MochiKit.DragAndDrop.Droppables.prepare(this.element); | 506 | MochiKit.DragAndDrop.Droppables.prepare(this.element); |
507 | MochiKit.DragAndDrop.Draggables.notify('start', this, event); | 507 | MochiKit.DragAndDrop.Draggables.notify('start', this, event); |
508 | if (this.options.starteffect) { | 508 | if (this.options.starteffect) { |
509 | this.options.starteffect(this.element); | 509 | this.options.starteffect(this.element); |
510 | } | 510 | } |
511 | }, | 511 | }, |
512 | 512 | ||
513 | /** @id MochiKit.DragAndDrop.updateDrag */ | 513 | /** @id MochiKit.DragAndDrop.updateDrag */ |
514 | updateDrag: function (event, pointer) { | 514 | updateDrag: function (event, pointer) { |
515 | if (!this.dragging) { | 515 | if (!this.dragging) { |
516 | this.startDrag(event); | 516 | this.startDrag(event); |
517 | } | 517 | } |
diff --git a/frontend/gamma/js/MochiKit/Format.js b/frontend/gamma/js/MochiKit/Format.js index 122845e..58877e7 100644 --- a/frontend/gamma/js/MochiKit/Format.js +++ b/frontend/gamma/js/MochiKit/Format.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Format 1.5 | 3 | MochiKit.Format 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Format', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'Format', '1.5', ['Base']); |
12 | 12 | ||
13 | MochiKit.Format._numberFormatter = function (placeholder, header, footer, locale, isPercent, precision, leadingZeros, separatorAt, trailingZeros) { | 13 | MochiKit.Format._numberFormatter = function (placeholder, header, footer, locale, isPercent, precision, leadingZeros, separatorAt, trailingZeros) { |
14 | return function (num) { | 14 | return function (num) { |
15 | num = parseFloat(num); | 15 | num = parseFloat(num); |
16 | if (typeof(num) == "undefined" || num === null || isNaN(num)) { | 16 | if (typeof(num) == "undefined" || num === null || isNaN(num)) { |
17 | return placeholder; | 17 | return placeholder; |
18 | } | 18 | } |
19 | var curheader = header; | 19 | var curheader = header; |
20 | var curfooter = footer; | 20 | var curfooter = footer; |
21 | if (num < 0) { | 21 | if (num < 0) { |
22 | num = -num; | 22 | num = -num; |
23 | } else { | 23 | } else { |
24 | curheader = curheader.replace(/-/, ""); | 24 | curheader = curheader.replace(/-/, ""); |
25 | } | 25 | } |
26 | var me = arguments.callee; | 26 | var me = arguments.callee; |
27 | var fmt = MochiKit.Format.formatLocale(locale); | 27 | var fmt = MochiKit.Format.formatLocale(locale); |
28 | if (isPercent) { | 28 | if (isPercent) { |
29 | num = num * 100.0; | 29 | num = num * 100.0; |
30 | curfooter = fmt.percent + curfooter; | 30 | curfooter = fmt.percent + curfooter; |
31 | } | 31 | } |
32 | num = MochiKit.Format.roundToFixed(num, precision); | 32 | num = MochiKit.Format.roundToFixed(num, precision); |
33 | var parts = num.split(/\./); | 33 | var parts = num.split(/\./); |
34 | var whole = parts[0]; | 34 | var whole = parts[0]; |
35 | var frac = (parts.length == 1) ? "" : parts[1]; | 35 | var frac = (parts.length == 1) ? "" : parts[1]; |
36 | var res = ""; | 36 | var res = ""; |
37 | while (whole.length < leadingZeros) { | 37 | while (whole.length < leadingZeros) { |
38 | whole = "0" + whole; | 38 | whole = "0" + whole; |
39 | } | 39 | } |
40 | if (separatorAt) { | 40 | if (separatorAt) { |
41 | while (whole.length > separatorAt) { | 41 | while (whole.length > separatorAt) { |
42 | var i = whole.length - separatorAt; | 42 | var i = whole.length - separatorAt; |
43 | //res = res + fmt.separator + whole.substring(i, whole.length); | 43 | //res = res + fmt.separator + whole.substring(i, whole.length); |
@@ -75,235 +75,235 @@ MochiKit.Format.numberFormatter = function (pattern, placeholder/* = "" */, loca | |||
75 | var footer = pattern.substr(match.index + match[0].length); | 75 | var footer = pattern.substr(match.index + match[0].length); |
76 | if (header.search(/-/) == -1) { | 76 | if (header.search(/-/) == -1) { |
77 | header = header + "-"; | 77 | header = header + "-"; |
78 | } | 78 | } |
79 | var whole = match[1]; | 79 | var whole = match[1]; |
80 | var frac = (typeof(match[2]) == "string" && match[2] != "") ? match[2] : ""; | 80 | var frac = (typeof(match[2]) == "string" && match[2] != "") ? match[2] : ""; |
81 | var isPercent = (typeof(match[3]) == "string" && match[3] != ""); | 81 | var isPercent = (typeof(match[3]) == "string" && match[3] != ""); |
82 | var tmp = whole.split(/,/); | 82 | var tmp = whole.split(/,/); |
83 | var separatorAt; | 83 | var separatorAt; |
84 | if (typeof(locale) == "undefined") { | 84 | if (typeof(locale) == "undefined") { |
85 | locale = "default"; | 85 | locale = "default"; |
86 | } | 86 | } |
87 | if (tmp.length == 1) { | 87 | if (tmp.length == 1) { |
88 | separatorAt = null; | 88 | separatorAt = null; |
89 | } else { | 89 | } else { |
90 | separatorAt = tmp[1].length; | 90 | separatorAt = tmp[1].length; |
91 | } | 91 | } |
92 | var leadingZeros = whole.length - whole.replace(/0/g, "").length; | 92 | var leadingZeros = whole.length - whole.replace(/0/g, "").length; |
93 | var trailingZeros = frac.length - frac.replace(/0/g, "").length; | 93 | var trailingZeros = frac.length - frac.replace(/0/g, "").length; |
94 | var precision = frac.length; | 94 | var precision = frac.length; |
95 | var rval = MochiKit.Format._numberFormatter( | 95 | var rval = MochiKit.Format._numberFormatter( |
96 | placeholder, header, footer, locale, isPercent, precision, | 96 | placeholder, header, footer, locale, isPercent, precision, |
97 | leadingZeros, separatorAt, trailingZeros | 97 | leadingZeros, separatorAt, trailingZeros |
98 | ); | 98 | ); |
99 | var m = MochiKit.Base; | 99 | var m = MochiKit.Base; |
100 | if (m) { | 100 | if (m) { |
101 | var fn = arguments.callee; | 101 | var fn = arguments.callee; |
102 | var args = m.concat(arguments); | 102 | var args = m.concat(arguments); |
103 | rval.repr = function () { | 103 | rval.repr = function () { |
104 | return [ | 104 | return [ |
105 | self.NAME, | 105 | self.NAME, |
106 | "(", | 106 | "(", |
107 | map(m.repr, args).join(", "), | 107 | m.map(m.repr, args).join(", "), |
108 | ")" | 108 | ")" |
109 | ].join(""); | 109 | ].join(""); |
110 | }; | 110 | }; |
111 | } | 111 | } |
112 | return rval; | 112 | return rval; |
113 | }; | 113 | }; |
114 | 114 | ||
115 | /** @id MochiKit.Format.formatLocale */ | 115 | /** @id MochiKit.Format.formatLocale */ |
116 | MochiKit.Format.formatLocale = function (locale) { | 116 | MochiKit.Format.formatLocale = function (locale) { |
117 | if (typeof(locale) == "undefined" || locale === null) { | 117 | if (typeof(locale) == "undefined" || locale === null) { |
118 | locale = "default"; | 118 | locale = "default"; |
119 | } | 119 | } |
120 | if (typeof(locale) == "string") { | 120 | if (typeof(locale) == "string") { |
121 | var rval = MochiKit.Format.LOCALE[locale]; | 121 | var rval = MochiKit.Format.LOCALE[locale]; |
122 | if (typeof(rval) == "string") { | 122 | if (typeof(rval) == "string") { |
123 | rval = arguments.callee(rval); | 123 | rval = arguments.callee(rval); |
124 | MochiKit.Format.LOCALE[locale] = rval; | 124 | MochiKit.Format.LOCALE[locale] = rval; |
125 | } | 125 | } |
126 | return rval; | 126 | return rval; |
127 | } else { | 127 | } else { |
128 | return locale; | 128 | return locale; |
129 | } | 129 | } |
130 | }; | 130 | }; |
131 | 131 | ||
132 | /** @id MochiKit.Format.twoDigitAverage */ | 132 | /** @id MochiKit.Format.twoDigitAverage */ |
133 | MochiKit.Format.twoDigitAverage = function (numerator, denominator) { | 133 | MochiKit.Format.twoDigitAverage = function (numerator, denominator) { |
134 | if (denominator) { | 134 | if (denominator) { |
135 | var res = numerator / denominator; | 135 | var res = numerator / denominator; |
136 | if (!isNaN(res)) { | 136 | if (!isNaN(res)) { |
137 | return MochiKit.Format.twoDigitFloat(res); | 137 | return MochiKit.Format.twoDigitFloat(res); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | return "0"; | 140 | return "0"; |
141 | }; | 141 | }; |
142 | 142 | ||
143 | /** @id MochiKit.Format.twoDigitFloat */ | 143 | /** @id MochiKit.Format.twoDigitFloat */ |
144 | MochiKit.Format.twoDigitFloat = function (aNumber) { | 144 | MochiKit.Format.twoDigitFloat = function (aNumber) { |
145 | var res = roundToFixed(aNumber, 2); | 145 | var res = MochiKit.Format.roundToFixed(aNumber, 2); |
146 | if (res.indexOf(".00") > 0) { | 146 | if (res.indexOf(".00") > 0) { |
147 | return res.substring(0, res.length - 3); | 147 | return res.substring(0, res.length - 3); |
148 | } else if (res.charAt(res.length - 1) == "0") { | 148 | } else if (res.charAt(res.length - 1) == "0") { |
149 | return res.substring(0, res.length - 1); | 149 | return res.substring(0, res.length - 1); |
150 | } else { | 150 | } else { |
151 | return res; | 151 | return res; |
152 | } | 152 | } |
153 | }; | 153 | }; |
154 | 154 | ||
155 | /** @id MochiKit.Format.lstrip */ | 155 | /** @id MochiKit.Format.lstrip */ |
156 | MochiKit.Format.lstrip = function (str, /* optional */chars) { | 156 | MochiKit.Format.lstrip = function (str, /* optional */chars) { |
157 | str = str + ""; | 157 | str = str + ""; |
158 | if (typeof(str) != "string") { | 158 | if (typeof(str) != "string") { |
159 | return null; | 159 | return null; |
160 | } | 160 | } |
161 | if (!chars) { | 161 | if (!chars) { |
162 | return str.replace(/^\s+/, ""); | 162 | return str.replace(/^\s+/, ""); |
163 | } else { | 163 | } else { |
164 | return str.replace(new RegExp("^[" + chars + "]+"), ""); | 164 | return str.replace(new RegExp("^[" + chars + "]+"), ""); |
165 | } | 165 | } |
166 | }; | 166 | }; |
167 | 167 | ||
168 | /** @id MochiKit.Format.rstrip */ | 168 | /** @id MochiKit.Format.rstrip */ |
169 | MochiKit.Format.rstrip = function (str, /* optional */chars) { | 169 | MochiKit.Format.rstrip = function (str, /* optional */chars) { |
170 | str = str + ""; | 170 | str = str + ""; |
171 | if (typeof(str) != "string") { | 171 | if (typeof(str) != "string") { |
172 | return null; | 172 | return null; |
173 | } | 173 | } |
174 | if (!chars) { | 174 | if (!chars) { |
175 | return str.replace(/\s+$/, ""); | 175 | return str.replace(/\s+$/, ""); |
176 | } else { | 176 | } else { |
177 | return str.replace(new RegExp("[" + chars + "]+$"), ""); | 177 | return str.replace(new RegExp("[" + chars + "]+$"), ""); |
178 | } | 178 | } |
179 | }; | 179 | }; |
180 | 180 | ||
181 | /** @id MochiKit.Format.strip */ | 181 | /** @id MochiKit.Format.strip */ |
182 | MochiKit.Format.strip = function (str, /* optional */chars) { | 182 | MochiKit.Format.strip = function (str, /* optional */chars) { |
183 | var self = MochiKit.Format; | 183 | var self = MochiKit.Format; |
184 | return self.rstrip(self.lstrip(str, chars), chars); | 184 | return self.rstrip(self.lstrip(str, chars), chars); |
185 | }; | 185 | }; |
186 | 186 | ||
187 | /** @id MochiKit.Format.truncToFixed */ | 187 | /** @id MochiKit.Format.truncToFixed */ |
188 | MochiKit.Format.truncToFixed = function (aNumber, precision) { | 188 | MochiKit.Format.truncToFixed = function (aNumber, precision) { |
189 | var fixed = MochiKit.Format._numberToFixed(aNumber, precision); | 189 | var fixed = MochiKit.Format._numberToFixed(aNumber, precision); |
190 | var fracPos = fixed.indexOf("."); | 190 | var fracPos = fixed.indexOf("."); |
191 | if (fracPos > 0 && fracPos + precision + 1 < fixed.length) { | 191 | if (fracPos > 0 && fracPos + precision + 1 < fixed.length) { |
192 | fixed = fixed.substring(0, fracPos + precision + 1); | 192 | fixed = fixed.substring(0, fracPos + precision + 1); |
193 | fixed = MochiKit.Format._shiftNumber(fixed, 0); | 193 | fixed = MochiKit.Format._shiftNumber(fixed, 0); |
194 | } | 194 | } |
195 | return fixed; | 195 | return fixed; |
196 | } | 196 | }; |
197 | 197 | ||
198 | /** @id MochiKit.Format.roundToFixed */ | 198 | /** @id MochiKit.Format.roundToFixed */ |
199 | MochiKit.Format.roundToFixed = function (aNumber, precision) { | 199 | MochiKit.Format.roundToFixed = function (aNumber, precision) { |
200 | var fixed = MochiKit.Format._numberToFixed(aNumber, precision); | 200 | var fixed = MochiKit.Format._numberToFixed(aNumber, precision); |
201 | var fracPos = fixed.indexOf("."); | 201 | var fracPos = fixed.indexOf("."); |
202 | if (fracPos > 0 && fracPos + precision + 1 < fixed.length) { | 202 | if (fracPos > 0 && fracPos + precision + 1 < fixed.length) { |
203 | var str = MochiKit.Format._shiftNumber(fixed, precision); | 203 | var str = MochiKit.Format._shiftNumber(fixed, precision); |
204 | str = MochiKit.Format._numberToFixed(Math.round(parseFloat(str)), 0); | 204 | str = MochiKit.Format._numberToFixed(Math.round(parseFloat(str)), 0); |
205 | fixed = MochiKit.Format._shiftNumber(str, -precision); | 205 | fixed = MochiKit.Format._shiftNumber(str, -precision); |
206 | } | 206 | } |
207 | return fixed; | 207 | return fixed; |
208 | } | 208 | }; |
209 | 209 | ||
210 | /** | 210 | /** |
211 | * Converts a number to a fixed format string. This function handles | 211 | * Converts a number to a fixed format string. This function handles |
212 | * conversion of exponents by shifting the decimal point to the left | 212 | * conversion of exponents by shifting the decimal point to the left |
213 | * or the right. It also guarantees a specified minimum number of | 213 | * or the right. It also guarantees a specified minimum number of |
214 | * fractional digits (but no maximum). | 214 | * fractional digits (but no maximum). |
215 | * | 215 | * |
216 | * @param {Number} aNumber the number to convert | 216 | * @param {Number} aNumber the number to convert |
217 | * @param {Number} precision the minimum number of decimal digits | 217 | * @param {Number} precision the minimum number of decimal digits |
218 | * | 218 | * |
219 | * @return {String} the fixed format number string | 219 | * @return {String} the fixed format number string |
220 | */ | 220 | */ |
221 | MochiKit.Format._numberToFixed = function (aNumber, precision) { | 221 | MochiKit.Format._numberToFixed = function (aNumber, precision) { |
222 | var str = aNumber.toString(); | 222 | var str = aNumber.toString(); |
223 | var parts = str.split(/[eE]/); | 223 | var parts = str.split(/[eE]/); |
224 | var exp = (parts.length === 1) ? 0 : parseInt(parts[1]) || 0; | 224 | var exp = (parts.length === 1) ? 0 : parseInt(parts[1], 10) || 0; |
225 | var fixed = MochiKit.Format._shiftNumber(parts[0], exp); | 225 | var fixed = MochiKit.Format._shiftNumber(parts[0], exp); |
226 | parts = fixed.split(/\./); | 226 | parts = fixed.split(/\./); |
227 | var whole = parts[0]; | 227 | var whole = parts[0]; |
228 | var frac = (parts.length === 1) ? "" : parts[1]; | 228 | var frac = (parts.length === 1) ? "" : parts[1]; |
229 | while (frac.length < precision) { | 229 | while (frac.length < precision) { |
230 | frac += "0"; | 230 | frac += "0"; |
231 | } | 231 | } |
232 | if (frac.length > 0) { | 232 | if (frac.length > 0) { |
233 | return whole + "." + frac; | 233 | return whole + "." + frac; |
234 | } else { | 234 | } else { |
235 | return whole; | 235 | return whole; |
236 | } | 236 | } |
237 | } | 237 | }; |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * Shifts the decimal dot location in a fixed format number string. | 240 | * Shifts the decimal dot location in a fixed format number string. |
241 | * This function handles negative values and will add and remove | 241 | * This function handles negative values and will add and remove |
242 | * leading and trailing zeros as needed. | 242 | * leading and trailing zeros as needed. |
243 | * | 243 | * |
244 | * @param {String} num the fixed format number string | 244 | * @param {String} num the fixed format number string |
245 | * @param {Number} exp the base-10 exponent to apply | 245 | * @param {Number} exp the base-10 exponent to apply |
246 | * | 246 | * |
247 | * @return {String} the new fixed format number string | 247 | * @return {String} the new fixed format number string |
248 | */ | 248 | */ |
249 | MochiKit.Format._shiftNumber = function (num, exp) { | 249 | MochiKit.Format._shiftNumber = function (num, exp) { |
250 | var pos = num.indexOf("."); | 250 | var pos = num.indexOf("."); |
251 | if (pos < 0) { | 251 | if (pos < 0) { |
252 | pos = num.length; | 252 | pos = num.length; |
253 | } else { | 253 | } else { |
254 | num = num.substring(0, pos) + num.substring(pos + 1); | 254 | num = num.substring(0, pos) + num.substring(pos + 1); |
255 | } | 255 | } |
256 | pos += exp; | 256 | pos += exp; |
257 | while (pos <= 0 || (pos <= 1 && num.charAt(0) === "-")) { | 257 | while (pos <= 0 || (pos <= 1 && num.charAt(0) === "-")) { |
258 | if (num.charAt(0) === "-") { | 258 | if (num.charAt(0) === "-") { |
259 | num = "-0" + num.substring(1); | 259 | num = "-0" + num.substring(1); |
260 | } else { | 260 | } else { |
261 | num = "0" + num; | 261 | num = "0" + num; |
262 | } | 262 | } |
263 | pos++; | 263 | pos++; |
264 | } | 264 | } |
265 | while (pos > num.length) { | 265 | while (pos > num.length) { |
266 | num += "0"; | 266 | num += "0"; |
267 | } | 267 | } |
268 | if (pos < num.length) { | 268 | if (pos < num.length) { |
269 | num = num.substring(0, pos) + "." + num.substring(pos); | 269 | num = num.substring(0, pos) + "." + num.substring(pos); |
270 | } | 270 | } |
271 | while (/^0[^.]/.test(num)) { | 271 | while (/^0[^.]/.test(num)) { |
272 | num = num.substring(1); | 272 | num = num.substring(1); |
273 | } | 273 | } |
274 | while (/^-0[^.]/.test(num)) { | 274 | while (/^-0[^.]/.test(num)) { |
275 | num = "-" + num.substring(2); | 275 | num = "-" + num.substring(2); |
276 | } | 276 | } |
277 | return num; | 277 | return num; |
278 | } | 278 | }; |
279 | 279 | ||
280 | /** @id MochiKit.Format.percentFormat */ | 280 | /** @id MochiKit.Format.percentFormat */ |
281 | MochiKit.Format.percentFormat = function (aNumber) { | 281 | MochiKit.Format.percentFormat = function (aNumber) { |
282 | return MochiKit.Format.twoDigitFloat(100 * aNumber) + '%'; | 282 | return MochiKit.Format.twoDigitFloat(100 * aNumber) + '%'; |
283 | }; | 283 | }; |
284 | 284 | ||
285 | MochiKit.Format.LOCALE = { | 285 | MochiKit.Format.LOCALE = { |
286 | en_US: {separator: ",", decimal: ".", percent: "%"}, | 286 | en_US: {separator: ",", decimal: ".", percent: "%"}, |
287 | de_DE: {separator: ".", decimal: ",", percent: "%"}, | 287 | de_DE: {separator: ".", decimal: ",", percent: "%"}, |
288 | pt_BR: {separator: ".", decimal: ",", percent: "%"}, | 288 | pt_BR: {separator: ".", decimal: ",", percent: "%"}, |
289 | fr_FR: {separator: " ", decimal: ",", percent: "%"}, | 289 | fr_FR: {separator: " ", decimal: ",", percent: "%"}, |
290 | "default": "en_US", | 290 | "default": "en_US", |
291 | __export__: false | 291 | __export__: false |
292 | }; | 292 | }; |
293 | 293 | ||
294 | MochiKit.Format.__new__ = function () { | 294 | MochiKit.Format.__new__ = function () { |
295 | MochiKit.Base.nameFunctions(this); | 295 | MochiKit.Base.nameFunctions(this); |
296 | var base = this.NAME + "."; | 296 | var base = this.NAME + "."; |
297 | var k, v, o; | 297 | var k, v, o; |
298 | for (k in this.LOCALE) { | 298 | for (k in this.LOCALE) { |
299 | o = this.LOCALE[k]; | 299 | o = this.LOCALE[k]; |
300 | if (typeof(o) == "object") { | 300 | if (typeof(o) == "object") { |
301 | o.repr = function () { return this.NAME; }; | 301 | o.repr = function () { return this.NAME; }; |
302 | o.NAME = base + "LOCALE." + k; | 302 | o.NAME = base + "LOCALE." + k; |
303 | } | 303 | } |
304 | } | 304 | } |
305 | }; | 305 | }; |
306 | 306 | ||
307 | MochiKit.Format.__new__(); | 307 | MochiKit.Format.__new__(); |
308 | 308 | ||
309 | MochiKit.Base._exportSymbols(this, MochiKit.Format); | 309 | MochiKit.Base._exportSymbols(this, MochiKit.Format); |
diff --git a/frontend/gamma/js/MochiKit/Iter.js b/frontend/gamma/js/MochiKit/Iter.js index 524b2bc..77623bc 100644 --- a/frontend/gamma/js/MochiKit/Iter.js +++ b/frontend/gamma/js/MochiKit/Iter.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Iter 1.5 | 3 | MochiKit.Iter 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Iter', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'Iter', '1.5', ['Base']); |
12 | 12 | ||
13 | MochiKit.Base.update(MochiKit.Iter, { | 13 | MochiKit.Base.update(MochiKit.Iter, { |
14 | /** @id MochiKit.Iter.registerIteratorFactory */ | 14 | /** @id MochiKit.Iter.registerIteratorFactory */ |
15 | registerIteratorFactory: function (name, check, iterfactory, /* optional */ override) { | 15 | registerIteratorFactory: function (name, check, iterfactory, /* optional */ override) { |
16 | MochiKit.Iter.iteratorRegistry.register(name, check, iterfactory, override); | 16 | MochiKit.Iter.iteratorRegistry.register(name, check, iterfactory, override); |
17 | }, | 17 | }, |
18 | 18 | ||
19 | /** @id MochiKit.Iter.isIterable */ | 19 | /** @id MochiKit.Iter.isIterable */ |
20 | isIterable: function(o) { | 20 | isIterable: function(o) { |
21 | return o != null && | 21 | return o != null && |
22 | (typeof(o.next) == "function" || typeof(o.iter) == "function"); | 22 | (typeof(o.next) == "function" || typeof(o.iter) == "function"); |
23 | }, | 23 | }, |
24 | 24 | ||
25 | /** @id MochiKit.Iter.iter */ | 25 | /** @id MochiKit.Iter.iter */ |
26 | iter: function (iterable, /* optional */ sentinel) { | 26 | iter: function (iterable, /* optional */ sentinel) { |
27 | var self = MochiKit.Iter; | 27 | var self = MochiKit.Iter; |
28 | if (arguments.length == 2) { | 28 | if (arguments.length == 2) { |
29 | return self.takewhile( | 29 | return self.takewhile( |
30 | function (a) { return a != sentinel; }, | 30 | function (a) { return a != sentinel; }, |
31 | iterable | 31 | iterable |
32 | ); | 32 | ); |
33 | } | 33 | } |
34 | if (typeof(iterable.next) == 'function') { | 34 | if (typeof(iterable.next) == 'function') { |
35 | return iterable; | 35 | return iterable; |
36 | } else if (typeof(iterable.iter) == 'function') { | 36 | } else if (typeof(iterable.iter) == 'function') { |
37 | return iterable.iter(); | 37 | return iterable.iter(); |
38 | /* | 38 | /* |
39 | } else if (typeof(iterable.__iterator__) == 'function') { | 39 | } else if (typeof(iterable.__iterator__) == 'function') { |
40 | // | 40 | // |
41 | // XXX: We can't support JavaScript 1.7 __iterator__ directly | 41 | // XXX: We can't support JavaScript 1.7 __iterator__ directly |
42 | // because of Object.prototype.__iterator__ | 42 | // because of Object.prototype.__iterator__ |
43 | // | 43 | // |
@@ -193,131 +193,129 @@ MochiKit.Base.update(MochiKit.Iter, { | |||
193 | } | 193 | } |
194 | // mozilla warnings aren't too bright | 194 | // mozilla warnings aren't too bright |
195 | return undefined; | 195 | return undefined; |
196 | } | 196 | } |
197 | }; | 197 | }; |
198 | }, | 198 | }, |
199 | 199 | ||
200 | /** @id MochiKit.Iter.islice */ | 200 | /** @id MochiKit.Iter.islice */ |
201 | islice: function (seq/*, [start,] stop[, step] */) { | 201 | islice: function (seq/*, [start,] stop[, step] */) { |
202 | var self = MochiKit.Iter; | 202 | var self = MochiKit.Iter; |
203 | var m = MochiKit.Base; | 203 | var m = MochiKit.Base; |
204 | seq = self.iter(seq); | 204 | seq = self.iter(seq); |
205 | var start = 0; | 205 | var start = 0; |
206 | var stop = 0; | 206 | var stop = 0; |
207 | var step = 1; | 207 | var step = 1; |
208 | var i = -1; | 208 | var i = -1; |
209 | if (arguments.length == 2) { | 209 | if (arguments.length == 2) { |
210 | stop = arguments[1]; | 210 | stop = arguments[1]; |
211 | } else if (arguments.length == 3) { | 211 | } else if (arguments.length == 3) { |
212 | start = arguments[1]; | 212 | start = arguments[1]; |
213 | stop = arguments[2]; | 213 | stop = arguments[2]; |
214 | } else { | 214 | } else { |
215 | start = arguments[1]; | 215 | start = arguments[1]; |
216 | stop = arguments[2]; | 216 | stop = arguments[2]; |
217 | step = arguments[3]; | 217 | step = arguments[3]; |
218 | } | 218 | } |
219 | return { | 219 | return { |
220 | repr: function () { | 220 | repr: function () { |
221 | return "islice(" + ["...", start, stop, step].join(", ") + ")"; | 221 | return "islice(" + ["...", start, stop, step].join(", ") + ")"; |
222 | }, | 222 | }, |
223 | toString: m.forwardCall("repr"), | 223 | toString: m.forwardCall("repr"), |
224 | next: function () { | 224 | next: function () { |
225 | if (start >= stop) { | ||
226 | throw self.StopIteration; | ||
227 | } | ||
228 | |||
225 | var rval; | 229 | var rval; |
226 | while (i < start) { | 230 | while (i < start) { |
227 | rval = seq.next(); | 231 | rval = seq.next(); |
228 | i++; | 232 | i++; |
229 | } | 233 | } |
230 | if (start >= stop) { | ||
231 | throw self.StopIteration; | ||
232 | } | ||
233 | start += step; | 234 | start += step; |
234 | return rval; | 235 | return rval; |
235 | } | 236 | } |
236 | }; | 237 | }; |
237 | }, | 238 | }, |
238 | 239 | ||
239 | /** @id MochiKit.Iter.imap */ | 240 | /** @id MochiKit.Iter.imap */ |
240 | imap: function (fun, p, q/*, ...*/) { | 241 | imap: function (fun, p, q/*, ...*/) { |
241 | var m = MochiKit.Base; | 242 | var m = MochiKit.Base; |
242 | var self = MochiKit.Iter; | 243 | var self = MochiKit.Iter; |
243 | var iterables = m.map(self.iter, m.extend(null, arguments, 1)); | 244 | var iterables = m.map(self.iter, m.extend(null, arguments, 1)); |
244 | var map = m.map; | 245 | var map = m.map; |
245 | var next = self.next; | 246 | var next = self.next; |
246 | return { | 247 | return { |
247 | repr: function () { return "imap(...)"; }, | 248 | repr: function () { return "imap(...)"; }, |
248 | toString: m.forwardCall("repr"), | 249 | toString: m.forwardCall("repr"), |
249 | next: function () { | 250 | next: function () { |
250 | return fun.apply(this, map(next, iterables)); | 251 | return fun.apply(this, map(next, iterables)); |
251 | } | 252 | } |
252 | }; | 253 | }; |
253 | }, | 254 | }, |
254 | 255 | ||
255 | /** @id MochiKit.Iter.applymap */ | 256 | /** @id MochiKit.Iter.applymap */ |
256 | applymap: function (fun, seq, self) { | 257 | applymap: function (fun, seq, self) { |
257 | seq = MochiKit.Iter.iter(seq); | 258 | seq = MochiKit.Iter.iter(seq); |
258 | var m = MochiKit.Base; | 259 | var m = MochiKit.Base; |
259 | return { | 260 | return { |
260 | repr: function () { return "applymap(...)"; }, | 261 | repr: function () { return "applymap(...)"; }, |
261 | toString: m.forwardCall("repr"), | 262 | toString: m.forwardCall("repr"), |
262 | next: function () { | 263 | next: function () { |
263 | return fun.apply(self, seq.next()); | 264 | return fun.apply(self, seq.next()); |
264 | } | 265 | } |
265 | }; | 266 | }; |
266 | }, | 267 | }, |
267 | 268 | ||
268 | /** @id MochiKit.Iter.chain */ | 269 | /** @id MochiKit.Iter.chain */ |
269 | chain: function (p, q/*, ...*/) { | 270 | chain: function (p, q/*, ...*/) { |
270 | // dumb fast path | 271 | // dumb fast path |
271 | var self = MochiKit.Iter; | 272 | var self = MochiKit.Iter; |
272 | var m = MochiKit.Base; | 273 | var m = MochiKit.Base; |
273 | if (arguments.length == 1) { | 274 | if (arguments.length == 1) { |
274 | return self.iter(arguments[0]); | 275 | return self.iter(arguments[0]); |
275 | } | 276 | } |
276 | var argiter = m.map(self.iter, arguments); | 277 | var argiter = m.map(self.iter, arguments); |
277 | return { | 278 | return { |
278 | repr: function () { return "chain(...)"; }, | 279 | repr: function () { return "chain(...)"; }, |
279 | toString: m.forwardCall("repr"), | 280 | toString: m.forwardCall("repr"), |
280 | next: function () { | 281 | next: function () { |
281 | while (argiter.length > 1) { | 282 | while (argiter.length > 1) { |
282 | try { | 283 | try { |
283 | var result = argiter[0].next(); | 284 | return argiter[0].next(); |
284 | return result; | ||
285 | } catch (e) { | 285 | } catch (e) { |
286 | if (e != self.StopIteration) { | 286 | if (e != self.StopIteration) { |
287 | throw e; | 287 | throw e; |
288 | } | 288 | } |
289 | argiter.shift(); | 289 | argiter.shift(); |
290 | var result = argiter[0].next(); | ||
291 | return result; | ||
292 | } | 290 | } |
293 | } | 291 | } |
294 | if (argiter.length == 1) { | 292 | if (argiter.length == 1) { |
295 | // optimize last element | 293 | // optimize last element |
296 | var arg = argiter.shift(); | 294 | var arg = argiter.shift(); |
297 | this.next = m.bind("next", arg); | 295 | this.next = m.bind("next", arg); |
298 | return this.next(); | 296 | return this.next(); |
299 | } | 297 | } |
300 | throw self.StopIteration; | 298 | throw self.StopIteration; |
301 | } | 299 | } |
302 | }; | 300 | }; |
303 | }, | 301 | }, |
304 | 302 | ||
305 | /** @id MochiKit.Iter.takewhile */ | 303 | /** @id MochiKit.Iter.takewhile */ |
306 | takewhile: function (pred, seq) { | 304 | takewhile: function (pred, seq) { |
307 | var self = MochiKit.Iter; | 305 | var self = MochiKit.Iter; |
308 | seq = self.iter(seq); | 306 | seq = self.iter(seq); |
309 | return { | 307 | return { |
310 | repr: function () { return "takewhile(...)"; }, | 308 | repr: function () { return "takewhile(...)"; }, |
311 | toString: MochiKit.Base.forwardCall("repr"), | 309 | toString: MochiKit.Base.forwardCall("repr"), |
312 | next: function () { | 310 | next: function () { |
313 | var rval = seq.next(); | 311 | var rval = seq.next(); |
314 | if (!pred(rval)) { | 312 | if (!pred(rval)) { |
315 | this.next = function () { | 313 | this.next = function () { |
316 | throw self.StopIteration; | 314 | throw self.StopIteration; |
317 | }; | 315 | }; |
318 | this.next(); | 316 | this.next(); |
319 | } | 317 | } |
320 | return rval; | 318 | return rval; |
321 | } | 319 | } |
322 | }; | 320 | }; |
323 | }, | 321 | }, |
@@ -384,65 +382,65 @@ MochiKit.Base.update(MochiKit.Iter, { | |||
384 | if (arguments.length == 1 || typeof(n) == "undefined" || n === null) { | 382 | if (arguments.length == 1 || typeof(n) == "undefined" || n === null) { |
385 | n = 2; | 383 | n = 2; |
386 | } | 384 | } |
387 | var self = MochiKit.Iter; | 385 | var self = MochiKit.Iter; |
388 | iterable = self.iter(iterable); | 386 | iterable = self.iter(iterable); |
389 | var _tee = self._tee; | 387 | var _tee = self._tee; |
390 | for (var i = 0; i < n; i++) { | 388 | for (var i = 0; i < n; i++) { |
391 | rval.push(_tee(i, sync, iterable)); | 389 | rval.push(_tee(i, sync, iterable)); |
392 | } | 390 | } |
393 | return rval; | 391 | return rval; |
394 | }, | 392 | }, |
395 | 393 | ||
396 | /** @id MochiKit.Iter.list */ | 394 | /** @id MochiKit.Iter.list */ |
397 | list: function (iterable) { | 395 | list: function (iterable) { |
398 | // Fast-path for Array and Array-like | 396 | // Fast-path for Array and Array-like |
399 | var rval; | 397 | var rval; |
400 | if (iterable instanceof Array) { | 398 | if (iterable instanceof Array) { |
401 | return iterable.slice(); | 399 | return iterable.slice(); |
402 | } | 400 | } |
403 | // this is necessary to avoid a Safari crash | 401 | // this is necessary to avoid a Safari crash |
404 | if (typeof(iterable) == "function" && | 402 | if (typeof(iterable) == "function" && |
405 | !(iterable instanceof Function) && | 403 | !(iterable instanceof Function) && |
406 | typeof(iterable.length) == 'number') { | 404 | typeof(iterable.length) == 'number') { |
407 | rval = []; | 405 | rval = []; |
408 | for (var i = 0; i < iterable.length; i++) { | 406 | for (var i = 0; i < iterable.length; i++) { |
409 | rval.push(iterable[i]); | 407 | rval.push(iterable[i]); |
410 | } | 408 | } |
411 | return rval; | 409 | return rval; |
412 | } | 410 | } |
413 | 411 | ||
414 | var self = MochiKit.Iter; | 412 | var self = MochiKit.Iter; |
415 | iterable = self.iter(iterable); | 413 | iterable = self.iter(iterable); |
416 | var rval = []; | 414 | rval = []; |
417 | var a_val; | 415 | var a_val; |
418 | try { | 416 | try { |
419 | while (true) { | 417 | while (true) { |
420 | a_val = iterable.next(); | 418 | a_val = iterable.next(); |
421 | rval.push(a_val); | 419 | rval.push(a_val); |
422 | } | 420 | } |
423 | } catch (e) { | 421 | } catch (e) { |
424 | if (e != self.StopIteration) { | 422 | if (e != self.StopIteration) { |
425 | throw e; | 423 | throw e; |
426 | } | 424 | } |
427 | return rval; | 425 | return rval; |
428 | } | 426 | } |
429 | // mozilla warnings aren't too bright | 427 | // mozilla warnings aren't too bright |
430 | return undefined; | 428 | return undefined; |
431 | }, | 429 | }, |
432 | 430 | ||
433 | 431 | ||
434 | /** @id MochiKit.Iter.reduce */ | 432 | /** @id MochiKit.Iter.reduce */ |
435 | reduce: function (fn, iterable, /* optional */initial) { | 433 | reduce: function (fn, iterable, /* optional */initial) { |
436 | var i = 0; | 434 | var i = 0; |
437 | var x = initial; | 435 | var x = initial; |
438 | var self = MochiKit.Iter; | 436 | var self = MochiKit.Iter; |
439 | iterable = self.iter(iterable); | 437 | iterable = self.iter(iterable); |
440 | if (arguments.length < 3) { | 438 | if (arguments.length < 3) { |
441 | try { | 439 | try { |
442 | x = iterable.next(); | 440 | x = iterable.next(); |
443 | } catch (e) { | 441 | } catch (e) { |
444 | if (e == self.StopIteration) { | 442 | if (e == self.StopIteration) { |
445 | e = new TypeError("reduce() of empty sequence with no initial value"); | 443 | e = new TypeError("reduce() of empty sequence with no initial value"); |
446 | } | 444 | } |
447 | throw e; | 445 | throw e; |
448 | } | 446 | } |
diff --git a/frontend/gamma/js/MochiKit/Logging.js b/frontend/gamma/js/MochiKit/Logging.js index f00996b..8b06e0b 100644 --- a/frontend/gamma/js/MochiKit/Logging.js +++ b/frontend/gamma/js/MochiKit/Logging.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Logging 1.5 | 3 | MochiKit.Logging 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Logging', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'Logging', '1.5', ['Base']); |
12 | 12 | ||
13 | /** @id MochiKit.Logging.LogMessage */ | 13 | /** @id MochiKit.Logging.LogMessage */ |
14 | MochiKit.Logging.LogMessage = function (num, level, info) { | 14 | MochiKit.Logging.LogMessage = function (num, level, info) { |
15 | this.num = num; | 15 | this.num = num; |
16 | this.level = level; | 16 | this.level = level; |
17 | this.info = info; | 17 | this.info = info; |
18 | this.timestamp = new Date(); | 18 | this.timestamp = new Date(); |
19 | }; | 19 | }; |
20 | 20 | ||
21 | MochiKit.Logging.LogMessage.prototype = { | 21 | MochiKit.Logging.LogMessage.prototype = { |
22 | /** @id MochiKit.Logging.LogMessage.prototype.repr */ | 22 | /** @id MochiKit.Logging.LogMessage.prototype.repr */ |
23 | repr: function () { | 23 | repr: function () { |
24 | var m = MochiKit.Base; | 24 | var m = MochiKit.Base; |
25 | return 'LogMessage(' + | 25 | return 'LogMessage(' + |
26 | m.map( | 26 | m.map( |
27 | m.repr, | 27 | m.repr, |
28 | [this.num, this.level, this.info] | 28 | [this.num, this.level, this.info] |
29 | ).join(', ') + ')'; | 29 | ).join(', ') + ')'; |
30 | }, | 30 | }, |
31 | /** @id MochiKit.Logging.LogMessage.prototype.toString */ | 31 | /** @id MochiKit.Logging.LogMessage.prototype.toString */ |
32 | toString: MochiKit.Base.forwardCall("repr") | 32 | toString: MochiKit.Base.forwardCall("repr") |
33 | }; | 33 | }; |
34 | 34 | ||
35 | MochiKit.Base.update(MochiKit.Logging, { | 35 | MochiKit.Base.update(MochiKit.Logging, { |
36 | /** @id MochiKit.Logging.logLevelAtLeast */ | 36 | /** @id MochiKit.Logging.logLevelAtLeast */ |
37 | logLevelAtLeast: function (minLevel) { | 37 | logLevelAtLeast: function (minLevel) { |
38 | var self = MochiKit.Logging; | 38 | var self = MochiKit.Logging; |
39 | if (typeof(minLevel) == 'string') { | 39 | if (typeof(minLevel) == 'string') { |
40 | minLevel = self.LogLevel[minLevel]; | 40 | minLevel = self.LogLevel[minLevel]; |
41 | } | 41 | } |
42 | return function (msg) { | 42 | return function (msg) { |
43 | var msgLevel = msg.level; | 43 | var msgLevel = msg.level; |
@@ -158,65 +158,65 @@ MochiKit.Logging.Logger.prototype = { | |||
158 | var msg = new MochiKit.Logging.LogMessage( | 158 | var msg = new MochiKit.Logging.LogMessage( |
159 | this.counter, | 159 | this.counter, |
160 | level, | 160 | level, |
161 | MochiKit.Base.extend(null, arguments, 1) | 161 | MochiKit.Base.extend(null, arguments, 1) |
162 | ); | 162 | ); |
163 | this._messages.push(msg); | 163 | this._messages.push(msg); |
164 | this.dispatchListeners(msg); | 164 | this.dispatchListeners(msg); |
165 | if (this.useNativeConsole) { | 165 | if (this.useNativeConsole) { |
166 | this.logToConsole(msg.level + ": " + msg.info.join(" ")); | 166 | this.logToConsole(msg.level + ": " + msg.info.join(" ")); |
167 | } | 167 | } |
168 | this.counter += 1; | 168 | this.counter += 1; |
169 | while (this.maxSize >= 0 && this._messages.length > this.maxSize) { | 169 | while (this.maxSize >= 0 && this._messages.length > this.maxSize) { |
170 | this._messages.shift(); | 170 | this._messages.shift(); |
171 | } | 171 | } |
172 | }, | 172 | }, |
173 | 173 | ||
174 | /** @id MochiKit.Logging.Logger.prototype.getMessages */ | 174 | /** @id MochiKit.Logging.Logger.prototype.getMessages */ |
175 | getMessages: function (howMany) { | 175 | getMessages: function (howMany) { |
176 | var firstMsg = 0; | 176 | var firstMsg = 0; |
177 | if (!(typeof(howMany) == 'undefined' || howMany === null)) { | 177 | if (!(typeof(howMany) == 'undefined' || howMany === null)) { |
178 | firstMsg = Math.max(0, this._messages.length - howMany); | 178 | firstMsg = Math.max(0, this._messages.length - howMany); |
179 | } | 179 | } |
180 | return this._messages.slice(firstMsg); | 180 | return this._messages.slice(firstMsg); |
181 | }, | 181 | }, |
182 | 182 | ||
183 | /** @id MochiKit.Logging.Logger.prototype.getMessageText */ | 183 | /** @id MochiKit.Logging.Logger.prototype.getMessageText */ |
184 | getMessageText: function (howMany) { | 184 | getMessageText: function (howMany) { |
185 | if (typeof(howMany) == 'undefined' || howMany === null) { | 185 | if (typeof(howMany) == 'undefined' || howMany === null) { |
186 | howMany = 30; | 186 | howMany = 30; |
187 | } | 187 | } |
188 | var messages = this.getMessages(howMany); | 188 | var messages = this.getMessages(howMany); |
189 | if (messages.length) { | 189 | if (messages.length) { |
190 | var lst = map(function (m) { | 190 | var lst = MochiKit.Base.map(function (m) { |
191 | return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); | 191 | return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); |
192 | }, messages); | 192 | }, messages); |
193 | lst.unshift('LAST ' + messages.length + ' MESSAGES:'); | 193 | lst.unshift('LAST ' + messages.length + ' MESSAGES:'); |
194 | return lst.join(''); | 194 | return lst.join(''); |
195 | } | 195 | } |
196 | return ''; | 196 | return ''; |
197 | }, | 197 | }, |
198 | 198 | ||
199 | /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */ | 199 | /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */ |
200 | debuggingBookmarklet: function (inline) { | 200 | debuggingBookmarklet: function (inline) { |
201 | if (typeof(MochiKit.LoggingPane) == "undefined") { | 201 | if (typeof(MochiKit.LoggingPane) == "undefined") { |
202 | alert(this.getMessageText()); | 202 | alert(this.getMessageText()); |
203 | } else { | 203 | } else { |
204 | MochiKit.LoggingPane.createLoggingPane(inline || false); | 204 | MochiKit.LoggingPane.createLoggingPane(inline || false); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | }; | 207 | }; |
208 | 208 | ||
209 | MochiKit.Logging.__new__ = function () { | 209 | MochiKit.Logging.__new__ = function () { |
210 | this.LogLevel = { | 210 | this.LogLevel = { |
211 | ERROR: 40, | 211 | ERROR: 40, |
212 | FATAL: 50, | 212 | FATAL: 50, |
213 | WARNING: 30, | 213 | WARNING: 30, |
214 | INFO: 20, | 214 | INFO: 20, |
215 | DEBUG: 10 | 215 | DEBUG: 10 |
216 | }; | 216 | }; |
217 | 217 | ||
218 | var m = MochiKit.Base; | 218 | var m = MochiKit.Base; |
219 | m.registerComparator("LogMessage", | 219 | m.registerComparator("LogMessage", |
220 | this.isLogMessage, | 220 | this.isLogMessage, |
221 | this.compareLogMessage | 221 | this.compareLogMessage |
222 | ); | 222 | ); |
diff --git a/frontend/gamma/js/MochiKit/LoggingPane.js b/frontend/gamma/js/MochiKit/LoggingPane.js index c960c21..b7ea120 100644 --- a/frontend/gamma/js/MochiKit/LoggingPane.js +++ b/frontend/gamma/js/MochiKit/LoggingPane.js | |||
@@ -1,59 +1,62 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.LoggingPane 1.5 | 3 | MochiKit.LoggingPane 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('LoggingPane', '1.5', ['Base', 'Logging']); | 11 | MochiKit.Base.module(MochiKit, 'LoggingPane', '1.5', ['Base', 'Logging']); |
12 | 12 | ||
13 | /** @id MochiKit.LoggingPane.createLoggingPane */ | 13 | /** @id MochiKit.LoggingPane.createLoggingPane */ |
14 | MochiKit.LoggingPane.createLoggingPane = function (inline/* = false */) { | 14 | MochiKit.LoggingPane.createLoggingPane = function (inline/* = false */) { |
15 | var m = MochiKit.LoggingPane; | 15 | var m = MochiKit.LoggingPane; |
16 | inline = !(!inline); | 16 | inline = !(!inline); |
17 | if (m._loggingPane && m._loggingPane.inline != inline) { | 17 | if (m._loggingPane && m._loggingPane.inline != inline) { |
18 | m._loggingPane.closePane(); | 18 | m._loggingPane.closePane(); |
19 | m._loggingPane = null; | 19 | m._loggingPane = null; |
20 | } | 20 | } |
21 | if (!m._loggingPane || m._loggingPane.closed) { | 21 | if (!m._loggingPane || m._loggingPane.closed) { |
22 | m._loggingPane = new m.LoggingPane(inline, MochiKit.Logging.logger); | 22 | m._loggingPane = new m.LoggingPane(inline, MochiKit.Logging.logger); |
23 | } | 23 | } |
24 | return m._loggingPane; | 24 | return m._loggingPane; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | /** @id MochiKit.LoggingPane.LoggingPane */ | 27 | /** |
28 | * @id MochiKit.LoggingPane.LoggingPane | ||
29 | * @constructor | ||
30 | */ | ||
28 | MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = MochiKit.Logging.logger */) { | 31 | MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = MochiKit.Logging.logger */) { |
29 | 32 | ||
30 | /* Use a div if inline, pop up a window if not */ | 33 | /* Use a div if inline, pop up a window if not */ |
31 | /* Create the elements */ | 34 | /* Create the elements */ |
32 | if (typeof(logger) == "undefined" || logger === null) { | 35 | if (typeof(logger) == "undefined" || logger === null) { |
33 | logger = MochiKit.Logging.logger; | 36 | logger = MochiKit.Logging.logger; |
34 | } | 37 | } |
35 | this.logger = logger; | 38 | this.logger = logger; |
36 | var update = MochiKit.Base.update; | 39 | var update = MochiKit.Base.update; |
37 | var updatetree = MochiKit.Base.updatetree; | 40 | var updatetree = MochiKit.Base.updatetree; |
38 | var bind = MochiKit.Base.bind; | 41 | var bind = MochiKit.Base.bind; |
39 | var clone = MochiKit.Base.clone; | 42 | var clone = MochiKit.Base.clone; |
40 | var win = window; | 43 | var win = window; |
41 | var uid = "_MochiKit_LoggingPane"; | 44 | var uid = "_MochiKit_LoggingPane"; |
42 | if (typeof(MochiKit.DOM) != "undefined") { | 45 | if (typeof(MochiKit.DOM) != "undefined") { |
43 | win = MochiKit.DOM.currentWindow(); | 46 | win = MochiKit.DOM.currentWindow(); |
44 | } | 47 | } |
45 | if (!inline) { | 48 | if (!inline) { |
46 | // name the popup with the base URL for uniqueness | 49 | // name the popup with the base URL for uniqueness |
47 | var url = win.location.href.split("?")[0].replace(/[#:\/.><&%-]/g, "_"); | 50 | var url = win.location.href.split("?")[0].replace(/[#:\/.><&%-]/g, "_"); |
48 | var name = uid + "_" + url; | 51 | var name = uid + "_" + url; |
49 | var nwin = win.open("", name, "dependent,resizable,height=200"); | 52 | var nwin = win.open("", name, "dependent,resizable,height=200"); |
50 | if (!nwin) { | 53 | if (!nwin) { |
51 | alert("Not able to open debugging window due to pop-up blocking."); | 54 | alert("Not able to open debugging window due to pop-up blocking."); |
52 | return undefined; | 55 | return undefined; |
53 | } | 56 | } |
54 | nwin.document.write( | 57 | nwin.document.write( |
55 | '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ' | 58 | '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ' |
56 | + '"http://www.w3.org/TR/html4/loose.dtd">' | 59 | + '"http://www.w3.org/TR/html4/loose.dtd">' |
57 | + '<html><head><title>[MochiKit.LoggingPane]</title></head>' | 60 | + '<html><head><title>[MochiKit.LoggingPane]</title></head>' |
58 | + '<body></body></html>' | 61 | + '<body></body></html>' |
59 | ); | 62 | ); |
@@ -117,143 +120,143 @@ MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = Moc | |||
117 | var addMessageText = bind(function (msg) { | 120 | var addMessageText = bind(function (msg) { |
118 | var level = messageLevel(msg); | 121 | var level = messageLevel(msg); |
119 | var text = messageText(msg); | 122 | var text = messageText(msg); |
120 | var c = this.colorTable[level]; | 123 | var c = this.colorTable[level]; |
121 | var p = doc.createElement("span"); | 124 | var p = doc.createElement("span"); |
122 | p.className = "MochiKit-LogMessage MochiKit-LogLevel-" + level; | 125 | p.className = "MochiKit-LogMessage MochiKit-LogLevel-" + level; |
123 | p.style.cssText = "margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: " + c; | 126 | p.style.cssText = "margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: " + c; |
124 | p.appendChild(doc.createTextNode(level + ": " + text)); | 127 | p.appendChild(doc.createTextNode(level + ": " + text)); |
125 | logPane.appendChild(p); | 128 | logPane.appendChild(p); |
126 | logPane.appendChild(doc.createElement("br")); | 129 | logPane.appendChild(doc.createElement("br")); |
127 | if (logPaneArea.offsetHeight > logPaneArea.scrollHeight) { | 130 | if (logPaneArea.offsetHeight > logPaneArea.scrollHeight) { |
128 | logPaneArea.scrollTop = 0; | 131 | logPaneArea.scrollTop = 0; |
129 | } else { | 132 | } else { |
130 | logPaneArea.scrollTop = logPaneArea.scrollHeight; | 133 | logPaneArea.scrollTop = logPaneArea.scrollHeight; |
131 | } | 134 | } |
132 | }, this); | 135 | }, this); |
133 | 136 | ||
134 | /** @id MochiKit.LoggingPane.addMessage */ | 137 | /** @id MochiKit.LoggingPane.addMessage */ |
135 | var addMessage = function (msg) { | 138 | var addMessage = function (msg) { |
136 | messages[messages.length] = msg; | 139 | messages[messages.length] = msg; |
137 | addMessageText(msg); | 140 | addMessageText(msg); |
138 | }; | 141 | }; |
139 | 142 | ||
140 | /** @id MochiKit.LoggingPane.buildMessageFilter */ | 143 | /** @id MochiKit.LoggingPane.buildMessageFilter */ |
141 | var buildMessageFilter = function () { | 144 | var buildMessageFilter = function () { |
142 | var levelre, infore; | 145 | var levelre, infore; |
143 | try { | 146 | try { |
144 | /* Catch any exceptions that might arise due to invalid regexes */ | 147 | /* Catch any exceptions that might arise due to invalid regexes */ |
145 | levelre = new RegExp(levelFilterField.value); | 148 | levelre = new RegExp(levelFilterField.value); |
146 | infore = new RegExp(infoFilterField.value); | 149 | infore = new RegExp(infoFilterField.value); |
147 | } catch(e) { | 150 | } catch(e) { |
148 | /* If there was an error with the regexes, do no filtering */ | 151 | /* If there was an error with the regexes, do no filtering */ |
149 | logDebug("Error in filter regex: " + e.message); | 152 | MochiKit.Logging.logDebug("Error in filter regex: " + e.message); |
150 | return null; | 153 | return null; |
151 | } | 154 | } |
152 | 155 | ||
153 | return function (msg) { | 156 | return function (msg) { |
154 | return ( | 157 | return ( |
155 | levelre.test(messageLevel(msg)) && | 158 | levelre.test(messageLevel(msg)) && |
156 | infore.test(messageText(msg)) | 159 | infore.test(messageText(msg)) |
157 | ); | 160 | ); |
158 | }; | 161 | }; |
159 | }; | 162 | }; |
160 | 163 | ||
161 | /** @id MochiKit.LoggingPane.clearMessagePane */ | 164 | /** @id MochiKit.LoggingPane.clearMessagePane */ |
162 | var clearMessagePane = function () { | 165 | var clearMessagePane = function () { |
163 | while (logPane.firstChild) { | 166 | while (logPane.firstChild) { |
164 | logPane.removeChild(logPane.firstChild); | 167 | logPane.removeChild(logPane.firstChild); |
165 | } | 168 | } |
166 | }; | 169 | }; |
167 | 170 | ||
168 | /** @id MochiKit.LoggingPane.clearMessages */ | 171 | /** @id MochiKit.LoggingPane.clearMessages */ |
169 | var clearMessages = function () { | 172 | var clearMessages = function () { |
170 | messages = []; | 173 | messages = []; |
171 | clearMessagePane(); | 174 | clearMessagePane(); |
172 | }; | 175 | }; |
173 | 176 | ||
174 | /** @id MochiKit.LoggingPane.closePane */ | 177 | /** @id MochiKit.LoggingPane.closePane */ |
175 | var closePane = bind(function () { | 178 | var closePane = bind(function () { |
176 | if (this.closed) { | 179 | if (this.closed) { |
177 | return; | 180 | return; |
178 | } | 181 | } |
179 | this.closed = true; | 182 | this.closed = true; |
180 | if (MochiKit.LoggingPane._loggingPane == this) { | 183 | if (MochiKit.LoggingPane._loggingPane == this) { |
181 | MochiKit.LoggingPane._loggingPane = null; | 184 | MochiKit.LoggingPane._loggingPane = null; |
182 | } | 185 | } |
183 | this.logger.removeListener(listenerId); | 186 | this.logger.removeListener(listenerId); |
184 | try { | 187 | try { |
185 | try { | 188 | try { |
186 | debugPane.loggingPane = null; | 189 | debugPane.loggingPane = null; |
187 | } catch(e) { logFatal("Bookmarklet was closed incorrectly."); } | 190 | } catch(e) { MochiKit.Logging.logFatal("Bookmarklet was closed incorrectly."); } |
188 | if (inline) { | 191 | if (inline) { |
189 | debugPane.parentNode.removeChild(debugPane); | 192 | debugPane.parentNode.removeChild(debugPane); |
190 | } else { | 193 | } else { |
191 | this.win.close(); | 194 | this.win.close(); |
192 | } | 195 | } |
193 | } catch(e) {} | 196 | } catch(e) {} |
194 | }, this); | 197 | }, this); |
195 | 198 | ||
196 | /** @id MochiKit.LoggingPane.filterMessages */ | 199 | /** @id MochiKit.LoggingPane.filterMessages */ |
197 | var filterMessages = function () { | 200 | var filterMessages = function () { |
198 | clearMessagePane(); | 201 | clearMessagePane(); |
199 | 202 | ||
200 | for (var i = 0; i < messages.length; i++) { | 203 | for (var i = 0; i < messages.length; i++) { |
201 | var msg = messages[i]; | 204 | var msg = messages[i]; |
202 | if (messageFilter === null || messageFilter(msg)) { | 205 | if (messageFilter === null || messageFilter(msg)) { |
203 | addMessageText(msg); | 206 | addMessageText(msg); |
204 | } | 207 | } |
205 | } | 208 | } |
206 | }; | 209 | }; |
207 | 210 | ||
208 | this.buildAndApplyFilter = function () { | 211 | this.buildAndApplyFilter = function () { |
209 | messageFilter = buildMessageFilter(); | 212 | messageFilter = buildMessageFilter(); |
210 | 213 | ||
211 | filterMessages(); | 214 | filterMessages(); |
212 | 215 | ||
213 | this.logger.removeListener(listenerId); | 216 | this.logger.removeListener(listenerId); |
214 | this.logger.addListener(listenerId, messageFilter, addMessage); | 217 | this.logger.addListener(listenerId, messageFilter, addMessage); |
215 | }; | 218 | }; |
216 | 219 | ||
217 | 220 | ||
218 | /** @id MochiKit.LoggingPane.loadMessages */ | 221 | /** @id MochiKit.LoggingPane.loadMessages */ |
219 | var loadMessages = bind(function () { | 222 | var loadMessages = bind(function () { |
220 | messages = this.logger.getMessages(); | 223 | messages = this.logger.getMessages(); |
221 | filterMessages(); | 224 | filterMessages(); |
222 | }, this); | 225 | }, this); |
223 | 226 | ||
224 | /** @id MochiKit.LoggingPane.filterOnEnter */ | 227 | /** @id MochiKit.LoggingPane.filterOnEnter */ |
225 | var filterOnEnter = bind(function (event) { | 228 | var filterOnEnter = bind(function (event) { |
226 | event = event || window.event; | 229 | event = event || window.event; |
227 | key = event.which || event.keyCode; | 230 | var key = event.which || event.keyCode; |
228 | if (key == 13) { | 231 | if (key == 13) { |
229 | this.buildAndApplyFilter(); | 232 | this.buildAndApplyFilter(); |
230 | } | 233 | } |
231 | }, this); | 234 | }, this); |
232 | 235 | ||
233 | /* Create the debug pane */ | 236 | /* Create the debug pane */ |
234 | var style = "display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: " + this.logFont; | 237 | var style = "display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: " + this.logFont; |
235 | if (inline) { | 238 | if (inline) { |
236 | style += "; height: 10em; border-top: 2px solid black"; | 239 | style += "; height: 10em; border-top: 2px solid black"; |
237 | } else { | 240 | } else { |
238 | style += "; height: 100%;"; | 241 | style += "; height: 100%;"; |
239 | } | 242 | } |
240 | debugPane.style.cssText = style; | 243 | debugPane.style.cssText = style; |
241 | 244 | ||
242 | if (!existing_pane) { | 245 | if (!existing_pane) { |
243 | doc.body.appendChild(debugPane); | 246 | doc.body.appendChild(debugPane); |
244 | } | 247 | } |
245 | 248 | ||
246 | /* Create the filter fields */ | 249 | /* Create the filter fields */ |
247 | style = {"cssText": "width: 33%; display: inline; font: " + this.logFont}; | 250 | style = {"cssText": "width: 33%; display: inline; font: " + this.logFont}; |
248 | 251 | ||
249 | updatetree(levelFilterField, { | 252 | updatetree(levelFilterField, { |
250 | "value": "FATAL|ERROR|WARNING|INFO|DEBUG", | 253 | "value": "FATAL|ERROR|WARNING|INFO|DEBUG", |
251 | "onkeypress": filterOnEnter, | 254 | "onkeypress": filterOnEnter, |
252 | "style": style | 255 | "style": style |
253 | }); | 256 | }); |
254 | debugPane.appendChild(levelFilterField); | 257 | debugPane.appendChild(levelFilterField); |
255 | 258 | ||
256 | updatetree(infoFilterField, { | 259 | updatetree(infoFilterField, { |
257 | "value": ".*", | 260 | "value": ".*", |
258 | "onkeypress": filterOnEnter, | 261 | "onkeypress": filterOnEnter, |
259 | "style": style | 262 | "style": style |
diff --git a/frontend/gamma/js/MochiKit/MochiKit.js b/frontend/gamma/js/MochiKit/MochiKit.js index 8e5be68..511e075 100644 --- a/frontend/gamma/js/MochiKit/MochiKit.js +++ b/frontend/gamma/js/MochiKit/MochiKit.js | |||
@@ -1,53 +1,50 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.MochiKit 1.5 | 3 | MochiKit.MochiKit 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | if (typeof(MochiKit) == 'undefined') { | 11 | var MochiKit = MochiKit || {}; |
12 | MochiKit = {}; | ||
13 | } | ||
14 | 12 | ||
15 | if (typeof(MochiKit.MochiKit) == 'undefined') { | 13 | /** @id MochiKit.MochiKit */ |
16 | /** @id MochiKit.MochiKit */ | 14 | MochiKit.MochiKit = MochiKit.MochiKit || {}; |
17 | MochiKit.MochiKit = {}; | ||
18 | } | ||
19 | 15 | ||
20 | MochiKit.MochiKit.NAME = "MochiKit.MochiKit"; | 16 | MochiKit.MochiKit.NAME = "MochiKit.MochiKit"; |
21 | MochiKit.MochiKit.VERSION = "1.5"; | 17 | MochiKit.MochiKit.VERSION = "1.5"; |
18 | MochiKit.MochiKit.__export__ = false; | ||
22 | MochiKit.MochiKit.__repr__ = function () { | 19 | MochiKit.MochiKit.__repr__ = function () { |
23 | return "[" + this.NAME + " " + this.VERSION + "]"; | 20 | return "[" + this.NAME + " " + this.VERSION + "]"; |
24 | }; | 21 | }; |
25 | 22 | ||
26 | /** @id MochiKit.MochiKit.toString */ | 23 | /** @id MochiKit.MochiKit.toString */ |
27 | MochiKit.MochiKit.toString = function () { | 24 | MochiKit.MochiKit.toString = function () { |
28 | return this.__repr__(); | 25 | return this.__repr__(); |
29 | }; | 26 | }; |
30 | 27 | ||
31 | /** @id MochiKit.MochiKit.SUBMODULES */ | 28 | /** @id MochiKit.MochiKit.SUBMODULES */ |
32 | MochiKit.MochiKit.SUBMODULES = [ | 29 | MochiKit.MochiKit.SUBMODULES = [ |
33 | "Base", | 30 | "Base", |
34 | "Iter", | 31 | "Iter", |
35 | "Logging", | 32 | "Logging", |
36 | "DateTime", | 33 | "DateTime", |
37 | "Format", | 34 | "Format", |
38 | "Text", | 35 | "Text", |
39 | "Async", | 36 | "Async", |
40 | "DOM", | 37 | "DOM", |
41 | "Selector", | 38 | "Selector", |
42 | "Style", | 39 | "Style", |
43 | "LoggingPane", | 40 | "LoggingPane", |
44 | "Color", | 41 | "Color", |
45 | "Signal", | 42 | "Signal", |
46 | "Position", | 43 | "Position", |
47 | "Visual", | 44 | "Visual", |
48 | "DragAndDrop", | 45 | "DragAndDrop", |
49 | "Sortable" | 46 | "Sortable" |
50 | ]; | 47 | ]; |
51 | 48 | ||
52 | (function () { | 49 | (function () { |
53 | if (typeof(document) == "undefined") { | 50 | if (typeof(document) == "undefined") { |
diff --git a/frontend/gamma/js/MochiKit/MockDOM.js b/frontend/gamma/js/MochiKit/MockDOM.js index abdb54a..7e6d60b 100644 --- a/frontend/gamma/js/MochiKit/MockDOM.js +++ b/frontend/gamma/js/MochiKit/MockDOM.js | |||
@@ -1,52 +1,49 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.MockDOM 1.5 | 3 | MochiKit.MockDOM 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | if (typeof(MochiKit) == "undefined") { | 11 | var MochiKit = MochiKit || {}; |
12 | MochiKit = {}; | ||
13 | } | ||
14 | 12 | ||
15 | if (typeof(MochiKit.MockDOM) == "undefined") { | 13 | MochiKit.MockDOM = MochiKit.MockDOM || {}; |
16 | MochiKit.MockDOM = {}; | ||
17 | } | ||
18 | 14 | ||
19 | MochiKit.MockDOM.NAME = "MochiKit.MockDOM"; | 15 | MochiKit.MockDOM.NAME = "MochiKit.MockDOM"; |
20 | MochiKit.MockDOM.VERSION = "1.5"; | 16 | MochiKit.MockDOM.VERSION = "1.5"; |
17 | MochiKit.MockDOM.__export__ = false; | ||
21 | 18 | ||
22 | MochiKit.MockDOM.__repr__ = function () { | 19 | MochiKit.MockDOM.__repr__ = function () { |
23 | return "[" + this.NAME + " " + this.VERSION + "]"; | 20 | return "[" + this.NAME + " " + this.VERSION + "]"; |
24 | }; | 21 | }; |
25 | 22 | ||
26 | /** @id MochiKit.MockDOM.toString */ | 23 | /** @id MochiKit.MockDOM.toString */ |
27 | MochiKit.MockDOM.toString = function () { | 24 | MochiKit.MockDOM.toString = function () { |
28 | return this.__repr__(); | 25 | return this.__repr__(); |
29 | }; | 26 | }; |
30 | 27 | ||
31 | /** @id MochiKit.MockDOM.createDocument */ | 28 | /** @id MochiKit.MockDOM.createDocument */ |
32 | MochiKit.MockDOM.createDocument = function () { | 29 | MochiKit.MockDOM.createDocument = function () { |
33 | var doc = new MochiKit.MockDOM.MockElement("DOCUMENT"); | 30 | var doc = new MochiKit.MockDOM.MockElement("DOCUMENT"); |
34 | doc.body = doc.createElement("BODY"); | 31 | doc.body = doc.createElement("BODY"); |
35 | doc.appendChild(doc.body); | 32 | doc.appendChild(doc.body); |
36 | return doc; | 33 | return doc; |
37 | }; | 34 | }; |
38 | 35 | ||
39 | /** @id MochiKit.MockDOM.MockElement */ | 36 | /** @id MochiKit.MockDOM.MockElement */ |
40 | MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) { | 37 | MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) { |
41 | this.tagName = this.nodeName = name.toUpperCase(); | 38 | this.tagName = this.nodeName = name.toUpperCase(); |
42 | this.ownerDocument = ownerDocument || null; | 39 | this.ownerDocument = ownerDocument || null; |
43 | if (name == "DOCUMENT") { | 40 | if (name == "DOCUMENT") { |
44 | this.nodeType = 9; | 41 | this.nodeType = 9; |
45 | this.childNodes = []; | 42 | this.childNodes = []; |
46 | } else if (typeof(data) == "string") { | 43 | } else if (typeof(data) == "string") { |
47 | this.nodeValue = data; | 44 | this.nodeValue = data; |
48 | this.nodeType = 3; | 45 | this.nodeType = 3; |
49 | } else { | 46 | } else { |
50 | this.nodeType = 1; | 47 | this.nodeType = 1; |
51 | this.childNodes = []; | 48 | this.childNodes = []; |
52 | } | 49 | } |
diff --git a/frontend/gamma/js/MochiKit/Position.js b/frontend/gamma/js/MochiKit/Position.js index 6bc5b39..2680507 100644 --- a/frontend/gamma/js/MochiKit/Position.js +++ b/frontend/gamma/js/MochiKit/Position.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Position 1.5 | 3 | MochiKit.Position 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005-2006 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005-2006 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Position', '1.5', ['Base', 'DOM', 'Style']); | 11 | MochiKit.Base.module(MochiKit, 'Position', '1.5', ['Base', 'DOM', 'Style']); |
12 | 12 | ||
13 | MochiKit.Base.update(MochiKit.Position, { | 13 | MochiKit.Base.update(MochiKit.Position, { |
14 | // Don't export from this module | 14 | // Don't export from this module |
15 | __export__: false, | 15 | __export__: false, |
16 | 16 | ||
17 | // set to true if needed, warning: firefox performance problems | 17 | // set to true if needed, warning: firefox performance problems |
18 | // NOT neeeded for page scrolling, only if draggable contained in | 18 | // NOT neeeded for page scrolling, only if draggable contained in |
19 | // scrollable elements | 19 | // scrollable elements |
20 | includeScrollOffsets: false, | 20 | includeScrollOffsets: false, |
21 | 21 | ||
22 | /** @id MochiKit.Position.prepare */ | 22 | /** @id MochiKit.Position.prepare */ |
23 | prepare: function () { | 23 | prepare: function () { |
24 | var deltaX = window.pageXOffset | 24 | var deltaX = window.pageXOffset |
25 | || document.documentElement.scrollLeft | 25 | || document.documentElement.scrollLeft |
26 | || document.body.scrollLeft | 26 | || document.body.scrollLeft |
27 | || 0; | 27 | || 0; |
28 | var deltaY = window.pageYOffset | 28 | var deltaY = window.pageYOffset |
29 | || document.documentElement.scrollTop | 29 | || document.documentElement.scrollTop |
30 | || document.body.scrollTop | 30 | || document.body.scrollTop |
31 | || 0; | 31 | || 0; |
32 | this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY); | 32 | this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY); |
33 | }, | 33 | }, |
34 | 34 | ||
35 | /** @id MochiKit.Position.cumulativeOffset */ | 35 | /** @id MochiKit.Position.cumulativeOffset */ |
36 | cumulativeOffset: function (element) { | 36 | cumulativeOffset: function (element) { |
37 | var valueT = 0; | 37 | var valueT = 0; |
38 | var valueL = 0; | 38 | var valueL = 0; |
39 | do { | 39 | do { |
40 | valueT += element.offsetTop || 0; | 40 | valueT += element.offsetTop || 0; |
41 | valueL += element.offsetLeft || 0; | 41 | valueL += element.offsetLeft || 0; |
42 | element = element.offsetParent; | 42 | element = element.offsetParent; |
43 | } while (element); | 43 | } while (element); |
diff --git a/frontend/gamma/js/MochiKit/Selector.js b/frontend/gamma/js/MochiKit/Selector.js index 6aec892..3187fe9 100644 --- a/frontend/gamma/js/MochiKit/Selector.js +++ b/frontend/gamma/js/MochiKit/Selector.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Selector 1.5 | 3 | MochiKit.Selector 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Selector', '1.5', ['Base', 'DOM', 'Iter']); | 11 | MochiKit.Base.module(MochiKit, 'Selector', '1.5', ['Base', 'DOM', 'Iter']); |
12 | 12 | ||
13 | MochiKit.Selector.Selector = function (expression) { | 13 | MochiKit.Selector.Selector = function (expression) { |
14 | this.params = {classNames: [], pseudoClassNames: []}; | 14 | this.params = {classNames: [], pseudoClassNames: []}; |
15 | this.expression = expression.toString().replace(/(^\s+|\s+$)/g, ''); | 15 | this.expression = expression.toString().replace(/(^\s+|\s+$)/g, ''); |
16 | this.parseExpression(); | 16 | this.parseExpression(); |
17 | this.compileMatcher(); | 17 | this.compileMatcher(); |
18 | }; | 18 | }; |
19 | 19 | ||
20 | MochiKit.Selector.Selector.prototype = { | 20 | MochiKit.Selector.Selector.prototype = { |
21 | /*** | 21 | /*** |
22 | 22 | ||
23 | Selector class: convenient object to make CSS selections. | 23 | Selector class: convenient object to make CSS selections. |
24 | 24 | ||
25 | ***/ | 25 | ***/ |
26 | __class__: MochiKit.Selector.Selector, | 26 | __class__: MochiKit.Selector.Selector, |
27 | 27 | ||
28 | /** @id MochiKit.Selector.Selector.prototype.parseExpression */ | 28 | /** @id MochiKit.Selector.Selector.prototype.parseExpression */ |
29 | parseExpression: function () { | 29 | parseExpression: function () { |
30 | function abort(message) { | 30 | function abort(message) { |
31 | throw 'Parse error in selector: ' + message; | 31 | throw 'Parse error in selector: ' + message; |
32 | } | 32 | } |
33 | 33 | ||
34 | if (this.expression == '') { | 34 | if (this.expression == '') { |
35 | abort('empty expression'); | 35 | abort('empty expression'); |
36 | } | 36 | } |
37 | 37 | ||
38 | var repr = MochiKit.Base.repr; | 38 | var repr = MochiKit.Base.repr; |
39 | var params = this.params; | 39 | var params = this.params; |
40 | var expr = this.expression; | 40 | var expr = this.expression; |
41 | var match, modifier, clause, rest; | 41 | var match, modifier, clause, rest; |
42 | while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { | 42 | while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { |
43 | params.attributes = params.attributes || []; | 43 | params.attributes = params.attributes || []; |
@@ -98,115 +98,115 @@ MochiKit.Selector.Selector.prototype = { | |||
98 | if (clause = params.tagName) { | 98 | if (clause = params.tagName) { |
99 | conditions.push('element.tagName.toUpperCase() == ' + repr(clause)); | 99 | conditions.push('element.tagName.toUpperCase() == ' + repr(clause)); |
100 | } | 100 | } |
101 | if ((clause = params.classNames).length > 0) { | 101 | if ((clause = params.classNames).length > 0) { |
102 | for (i = 0; i < clause.length; i++) { | 102 | for (i = 0; i < clause.length; i++) { |
103 | conditions.push('MochiKit.DOM.hasElementClass(element, ' + repr(clause[i]) + ')'); | 103 | conditions.push('MochiKit.DOM.hasElementClass(element, ' + repr(clause[i]) + ')'); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | if ((clause = params.pseudoClassNames).length > 0) { | 106 | if ((clause = params.pseudoClassNames).length > 0) { |
107 | for (i = 0; i < clause.length; i++) { | 107 | for (i = 0; i < clause.length; i++) { |
108 | var match = clause[i].match(/^([^(]+)(?:\((.*)\))?$/); | 108 | var match = clause[i].match(/^([^(]+)(?:\((.*)\))?$/); |
109 | var pseudoClass = match[1]; | 109 | var pseudoClass = match[1]; |
110 | var pseudoClassArgument = match[2]; | 110 | var pseudoClassArgument = match[2]; |
111 | switch (pseudoClass) { | 111 | switch (pseudoClass) { |
112 | case 'root': | 112 | case 'root': |
113 | conditions.push('element.nodeType == 9 || element === element.ownerDocument.documentElement'); break; | 113 | conditions.push('element.nodeType == 9 || element === element.ownerDocument.documentElement'); break; |
114 | case 'nth-child': | 114 | case 'nth-child': |
115 | case 'nth-last-child': | 115 | case 'nth-last-child': |
116 | case 'nth-of-type': | 116 | case 'nth-of-type': |
117 | case 'nth-last-of-type': | 117 | case 'nth-last-of-type': |
118 | match = pseudoClassArgument.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); | 118 | match = pseudoClassArgument.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); |
119 | if (!match) { | 119 | if (!match) { |
120 | throw "Invalid argument to pseudo element nth-child: " + pseudoClassArgument; | 120 | throw "Invalid argument to pseudo element nth-child: " + pseudoClassArgument; |
121 | } | 121 | } |
122 | var a, b; | 122 | var a, b; |
123 | if (match[0] == 'odd') { | 123 | if (match[0] == 'odd') { |
124 | a = 2; | 124 | a = 2; |
125 | b = 1; | 125 | b = 1; |
126 | } else if (match[0] == 'even') { | 126 | } else if (match[0] == 'even') { |
127 | a = 2; | 127 | a = 2; |
128 | b = 0; | 128 | b = 0; |
129 | } else { | 129 | } else { |
130 | a = match[2] && parseInt(match) || null; | 130 | a = match[2] && parseInt(match, 10) || null; |
131 | b = parseInt(match[3]); | 131 | b = parseInt(match[3], 10); |
132 | } | 132 | } |
133 | conditions.push('this.nthChild(element,' + a + ',' + b | 133 | conditions.push('this.nthChild(element,' + a + ',' + b |
134 | + ',' + !!pseudoClass.match('^nth-last') // Reverse | 134 | + ',' + !!pseudoClass.match('^nth-last') // Reverse |
135 | + ',' + !!pseudoClass.match('of-type$') // Restrict to same tagName | 135 | + ',' + !!pseudoClass.match('of-type$') // Restrict to same tagName |
136 | + ')'); | 136 | + ')'); |
137 | break; | 137 | break; |
138 | case 'first-child': | 138 | case 'first-child': |
139 | conditions.push('this.nthChild(element, null, 1)'); | 139 | conditions.push('this.nthChild(element, null, 1)'); |
140 | break; | 140 | break; |
141 | case 'last-child': | 141 | case 'last-child': |
142 | conditions.push('this.nthChild(element, null, 1, true)'); | 142 | conditions.push('this.nthChild(element, null, 1, true)'); |
143 | break; | 143 | break; |
144 | case 'first-of-type': | 144 | case 'first-of-type': |
145 | conditions.push('this.nthChild(element, null, 1, false, true)'); | 145 | conditions.push('this.nthChild(element, null, 1, false, true)'); |
146 | break; | 146 | break; |
147 | case 'last-of-type': | 147 | case 'last-of-type': |
148 | conditions.push('this.nthChild(element, null, 1, true, true)'); | 148 | conditions.push('this.nthChild(element, null, 1, true, true)'); |
149 | break; | 149 | break; |
150 | case 'only-child': | 150 | case 'only-child': |
151 | conditions.push(childElements('element.parentNode') + '.length == 1'); | 151 | conditions.push(childElements('element.parentNode') + '.length == 1'); |
152 | break; | 152 | break; |
153 | case 'only-of-type': | 153 | case 'only-of-type': |
154 | conditions.push('MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, ' + childElements('element.parentNode') + ').length == 1'); | 154 | conditions.push('MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, ' + childElements('element.parentNode') + ').length == 1'); |
155 | break; | 155 | break; |
156 | case 'empty': | 156 | case 'empty': |
157 | conditions.push('element.childNodes.length == 0'); | 157 | conditions.push('element.childNodes.length == 0'); |
158 | break; | 158 | break; |
159 | case 'enabled': | 159 | case 'enabled': |
160 | conditions.push('(this.isUIElement(element) && element.disabled === false)'); | 160 | conditions.push('(this.isUIElement(element) && element.disabled === false)'); |
161 | break; | 161 | break; |
162 | case 'disabled': | 162 | case 'disabled': |
163 | conditions.push('(this.isUIElement(element) && element.disabled === true)'); | 163 | conditions.push('(this.isUIElement(element) && element.disabled === true)'); |
164 | break; | 164 | break; |
165 | case 'checked': | 165 | case 'checked': |
166 | conditions.push('(this.isUIElement(element) && element.checked === true)'); | 166 | conditions.push('(this.isUIElement(element) && element.checked === true)'); |
167 | break; | 167 | break; |
168 | case 'not': | 168 | case 'not': |
169 | var subselector = new MochiKit.Selector.Selector(pseudoClassArgument); | 169 | var subselector = new MochiKit.Selector.Selector(pseudoClassArgument); |
170 | conditions.push('!( ' + subselector.buildMatchExpression() + ')') | 170 | conditions.push('!( ' + subselector.buildMatchExpression() + ')'); |
171 | break; | 171 | break; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
175 | if (clause = params.attributes) { | 175 | if (clause = params.attributes) { |
176 | MochiKit.Base.map(function (attribute) { | 176 | MochiKit.Base.map(function (attribute) { |
177 | var value = 'MochiKit.DOM.getNodeAttribute(element, ' + repr(attribute.name) + ')'; | 177 | var value = 'MochiKit.DOM.getNodeAttribute(element, ' + repr(attribute.name) + ')'; |
178 | var splitValueBy = function (delimiter) { | 178 | var splitValueBy = function (delimiter) { |
179 | return value + '.split(' + repr(delimiter) + ')'; | 179 | return value + '.split(' + repr(delimiter) + ')'; |
180 | } | 180 | }; |
181 | conditions.push(value + ' != null'); | 181 | conditions.push(value + ' != null'); |
182 | switch (attribute.operator) { | 182 | switch (attribute.operator) { |
183 | case '=': | 183 | case '=': |
184 | conditions.push(value + ' == ' + repr(attribute.value)); | 184 | conditions.push(value + ' == ' + repr(attribute.value)); |
185 | break; | 185 | break; |
186 | case '~=': | 186 | case '~=': |
187 | conditions.push('MochiKit.Base.findValue(' + splitValueBy(' ') + ', ' + repr(attribute.value) + ') > -1'); | 187 | conditions.push('MochiKit.Base.findValue(' + splitValueBy(' ') + ', ' + repr(attribute.value) + ') > -1'); |
188 | break; | 188 | break; |
189 | case '^=': | 189 | case '^=': |
190 | conditions.push(value + '.substring(0, ' + attribute.value.length + ') == ' + repr(attribute.value)); | 190 | conditions.push(value + '.substring(0, ' + attribute.value.length + ') == ' + repr(attribute.value)); |
191 | break; | 191 | break; |
192 | case '$=': | 192 | case '$=': |
193 | conditions.push(value + '.substring(' + value + '.length - ' + attribute.value.length + ') == ' + repr(attribute.value)); | 193 | conditions.push(value + '.substring(' + value + '.length - ' + attribute.value.length + ') == ' + repr(attribute.value)); |
194 | break; | 194 | break; |
195 | case '*=': | 195 | case '*=': |
196 | conditions.push(value + '.match(' + repr(attribute.value) + ')'); | 196 | conditions.push(value + '.match(' + repr(attribute.value) + ')'); |
197 | break; | 197 | break; |
198 | case '|=': | 198 | case '|=': |
199 | conditions.push(splitValueBy('-') + '[0].toUpperCase() == ' + repr(attribute.value.toUpperCase())); | 199 | conditions.push(splitValueBy('-') + '[0].toUpperCase() == ' + repr(attribute.value.toUpperCase())); |
200 | break; | 200 | break; |
201 | case '!=': | 201 | case '!=': |
202 | conditions.push(value + ' != ' + repr(attribute.value)); | 202 | conditions.push(value + ' != ' + repr(attribute.value)); |
203 | break; | 203 | break; |
204 | case '': | 204 | case '': |
205 | case undefined: | 205 | case undefined: |
206 | // Condition already added above | 206 | // Condition already added above |
207 | break; | 207 | break; |
208 | default: | 208 | default: |
209 | throw 'Unknown operator ' + attribute.operator + ' in selector'; | 209 | throw 'Unknown operator ' + attribute.operator + ' in selector'; |
210 | } | 210 | } |
211 | }, clause); | 211 | }, clause); |
212 | } | 212 | } |
@@ -323,64 +323,70 @@ MochiKit.Selector.Selector.prototype = { | |||
323 | } | 323 | } |
324 | 324 | ||
325 | var results = MochiKit.Base.filter(MochiKit.Base.bind(function (scopeElt) { | 325 | var results = MochiKit.Base.filter(MochiKit.Base.bind(function (scopeElt) { |
326 | return this.match(scopeElt); | 326 | return this.match(scopeElt); |
327 | }, this), scope); | 327 | }, this), scope); |
328 | 328 | ||
329 | return results; | 329 | return results; |
330 | }, | 330 | }, |
331 | 331 | ||
332 | /** @id MochiKit.Selector.Selector.prototype.repr */ | 332 | /** @id MochiKit.Selector.Selector.prototype.repr */ |
333 | repr: function () { | 333 | repr: function () { |
334 | return 'Selector(' + this.expression + ')'; | 334 | return 'Selector(' + this.expression + ')'; |
335 | }, | 335 | }, |
336 | 336 | ||
337 | toString: MochiKit.Base.forwardCall("repr") | 337 | toString: MochiKit.Base.forwardCall("repr") |
338 | }; | 338 | }; |
339 | 339 | ||
340 | MochiKit.Base.update(MochiKit.Selector, { | 340 | MochiKit.Base.update(MochiKit.Selector, { |
341 | 341 | ||
342 | /** @id MochiKit.Selector.findChildElements */ | 342 | /** @id MochiKit.Selector.findChildElements */ |
343 | findChildElements: function (element, expressions) { | 343 | findChildElements: function (element, expressions) { |
344 | element = MochiKit.DOM.getElement(element); | 344 | element = MochiKit.DOM.getElement(element); |
345 | var uniq = function(arr) { | 345 | var uniq = function(arr) { |
346 | var res = []; | 346 | var res = []; |
347 | for (var i = 0; i < arr.length; i++) { | 347 | for (var i = 0; i < arr.length; i++) { |
348 | if (MochiKit.Base.findIdentical(res, arr[i]) < 0) { | 348 | if (MochiKit.Base.findIdentical(res, arr[i]) < 0) { |
349 | res.push(arr[i]); | 349 | res.push(arr[i]); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | return res; | 352 | return res; |
353 | }; | 353 | }; |
354 | return MochiKit.Base.flattenArray(MochiKit.Base.map(function (expression) { | 354 | return MochiKit.Base.flattenArray(MochiKit.Base.map(function (expression) { |
355 | try { | ||
356 | var res = element.querySelectorAll(expression); | ||
357 | return Array.prototype.slice.call(res, 0); | ||
358 | } catch (ignore) { | ||
359 | // No querySelectorAll or extended expression syntax used | ||
360 | } | ||
355 | var nextScope = ""; | 361 | var nextScope = ""; |
356 | var reducer = function (results, expr) { | 362 | var reducer = function (results, expr) { |
357 | var match = expr.match(/^[>+~]$/); | 363 | var match = expr.match(/^[>+~]$/); |
358 | if (match) { | 364 | if (match) { |
359 | nextScope = match[0]; | 365 | nextScope = match[0]; |
360 | return results; | 366 | return results; |
361 | } else { | 367 | } else { |
362 | var selector = new MochiKit.Selector.Selector(expr); | 368 | var selector = new MochiKit.Selector.Selector(expr); |
363 | var elements = MochiKit.Iter.reduce(function (elements, result) { | 369 | var elements = MochiKit.Iter.reduce(function (elements, result) { |
364 | return MochiKit.Base.extend(elements, selector.findElements(result || element, nextScope)); | 370 | return MochiKit.Base.extend(elements, selector.findElements(result || element, nextScope)); |
365 | }, results, []); | 371 | }, results, []); |
366 | nextScope = ""; | 372 | nextScope = ""; |
367 | return elements; | 373 | return elements; |
368 | } | 374 | } |
369 | }; | 375 | }; |
370 | var exprs = expression.replace(/(^\s+|\s+$)/g, '').split(/\s+/); | 376 | var exprs = expression.replace(/(^\s+|\s+$)/g, '').split(/\s+/); |
371 | return uniq(MochiKit.Iter.reduce(reducer, exprs, [null])); | 377 | return uniq(MochiKit.Iter.reduce(reducer, exprs, [null])); |
372 | }, expressions)); | 378 | }, expressions)); |
373 | }, | 379 | }, |
374 | 380 | ||
375 | findDocElements: function () { | 381 | findDocElements: function () { |
376 | return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(), arguments); | 382 | return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(), arguments); |
377 | }, | 383 | }, |
378 | 384 | ||
379 | __new__: function () { | 385 | __new__: function () { |
380 | this.$$ = this.findDocElements; | 386 | this.$$ = this.findDocElements; |
381 | MochiKit.Base.nameFunctions(this); | 387 | MochiKit.Base.nameFunctions(this); |
382 | } | 388 | } |
383 | }); | 389 | }); |
384 | 390 | ||
385 | MochiKit.Selector.__new__(); | 391 | MochiKit.Selector.__new__(); |
386 | 392 | ||
diff --git a/frontend/gamma/js/MochiKit/Signal.js b/frontend/gamma/js/MochiKit/Signal.js index 7df5619..11590c1 100644 --- a/frontend/gamma/js/MochiKit/Signal.js +++ b/frontend/gamma/js/MochiKit/Signal.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Signal 1.5 | 3 | MochiKit.Signal 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2006 Jonathan Gardner, Beau Hartshorne, Bob Ippolito. All rights Reserved. | 7 | (c) 2006 Jonathan Gardner, Beau Hartshorne, Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Signal', '1.5', ['Base', 'DOM', 'Style']); | 11 | MochiKit.Base.module(MochiKit, 'Signal', '1.5', ['Base', 'DOM']); |
12 | 12 | ||
13 | MochiKit.Signal._observers = []; | 13 | MochiKit.Signal._observers = []; |
14 | 14 | ||
15 | /** @id MochiKit.Signal.Event */ | 15 | /** @id MochiKit.Signal.Event */ |
16 | MochiKit.Signal.Event = function (src, e) { | 16 | MochiKit.Signal.Event = function (src, e) { |
17 | this._event = e || window.event; | 17 | this._event = e || window.event; |
18 | this._src = src; | 18 | this._src = src; |
19 | }; | 19 | }; |
20 | MochiKit.Signal.Event.__export__ = false; | 20 | MochiKit.Signal.Event.__export__ = false; |
21 | 21 | ||
22 | MochiKit.Base.update(MochiKit.Signal.Event.prototype, { | 22 | MochiKit.Base.update(MochiKit.Signal.Event.prototype, { |
23 | 23 | ||
24 | __repr__: function () { | 24 | __repr__: function () { |
25 | var repr = MochiKit.Base.repr; | 25 | var repr = MochiKit.Base.repr; |
26 | var str = '{event(): ' + repr(this.event()) + | 26 | var str = '{event(): ' + repr(this.event()) + |
27 | ', src(): ' + repr(this.src()) + | 27 | ', src(): ' + repr(this.src()) + |
28 | ', type(): ' + repr(this.type()) + | 28 | ', type(): ' + repr(this.type()) + |
29 | ', target(): ' + repr(this.target()); | 29 | ', target(): ' + repr(this.target()); |
30 | 30 | ||
31 | if (this.type() && | 31 | if (this.type() && |
32 | this.type().indexOf('key') === 0 || | 32 | this.type().indexOf('key') === 0 || |
33 | this.type().indexOf('mouse') === 0 || | 33 | this.type().indexOf('mouse') === 0 || |
34 | this.type().indexOf('click') != -1 || | 34 | this.type().indexOf('click') != -1 || |
35 | this.type() == 'contextmenu') { | 35 | this.type() == 'contextmenu') { |
36 | str += ', modifier(): ' + '{alt: ' + repr(this.modifier().alt) + | 36 | str += ', modifier(): ' + '{alt: ' + repr(this.modifier().alt) + |
37 | ', ctrl: ' + repr(this.modifier().ctrl) + | 37 | ', ctrl: ' + repr(this.modifier().ctrl) + |
38 | ', meta: ' + repr(this.modifier().meta) + | 38 | ', meta: ' + repr(this.modifier().meta) + |
39 | ', shift: ' + repr(this.modifier().shift) + | 39 | ', shift: ' + repr(this.modifier().shift) + |
40 | ', any: ' + repr(this.modifier().any) + '}'; | 40 | ', any: ' + repr(this.modifier().any) + '}'; |
41 | } | 41 | } |
42 | 42 | ||
43 | if (this.type() && this.type().indexOf('key') === 0) { | 43 | if (this.type() && this.type().indexOf('key') === 0) { |
@@ -237,136 +237,137 @@ MochiKit.Base.update(MochiKit.Signal.Event.prototype, { | |||
237 | k.string = ''; | 237 | k.string = ''; |
238 | 238 | ||
239 | if (typeof(this._event.charCode) != 'undefined' && | 239 | if (typeof(this._event.charCode) != 'undefined' && |
240 | this._event.charCode !== 0 && | 240 | this._event.charCode !== 0 && |
241 | !MochiKit.Signal._specialMacKeys[this._event.charCode]) { | 241 | !MochiKit.Signal._specialMacKeys[this._event.charCode]) { |
242 | k.code = this._event.charCode; | 242 | k.code = this._event.charCode; |
243 | k.string = String.fromCharCode(k.code); | 243 | k.string = String.fromCharCode(k.code); |
244 | } else if (this._event.keyCode && | 244 | } else if (this._event.keyCode && |
245 | typeof(this._event.charCode) == 'undefined') { // IE | 245 | typeof(this._event.charCode) == 'undefined') { // IE |
246 | k.code = this._event.keyCode; | 246 | k.code = this._event.keyCode; |
247 | k.string = String.fromCharCode(k.code); | 247 | k.string = String.fromCharCode(k.code); |
248 | } | 248 | } |
249 | 249 | ||
250 | this._key = k; | 250 | this._key = k; |
251 | return k; | 251 | return k; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | return undefined; | 254 | return undefined; |
255 | }, | 255 | }, |
256 | 256 | ||
257 | _mouse: null, | 257 | _mouse: null, |
258 | /** @id MochiKit.Signal.Event.prototype.mouse */ | 258 | /** @id MochiKit.Signal.Event.prototype.mouse */ |
259 | mouse: function () { | 259 | mouse: function () { |
260 | if (this._mouse !== null) { | 260 | if (this._mouse !== null) { |
261 | return this._mouse; | 261 | return this._mouse; |
262 | } | 262 | } |
263 | 263 | ||
264 | var m = {}; | 264 | var m = {}; |
265 | var e = this._event; | 265 | var e = this._event; |
266 | 266 | ||
267 | if (this.type() && ( | 267 | if (this.type() && ( |
268 | this.type().indexOf('mouse') === 0 || | 268 | this.type().indexOf('mouse') === 0 || |
269 | this.type().indexOf('drag') === 0 || | ||
269 | this.type().indexOf('click') != -1 || | 270 | this.type().indexOf('click') != -1 || |
270 | this.type() == 'contextmenu')) { | 271 | this.type() == 'contextmenu')) { |
271 | 272 | ||
272 | m.client = new MochiKit.Style.Coordinates(0, 0); | 273 | m.client = { x: 0, y: 0 }; |
273 | if (e.clientX || e.clientY) { | 274 | if (e.clientX || e.clientY) { |
274 | m.client.x = (!e.clientX || e.clientX < 0) ? 0 : e.clientX; | 275 | m.client.x = (!e.clientX || e.clientX < 0) ? 0 : e.clientX; |
275 | m.client.y = (!e.clientY || e.clientY < 0) ? 0 : e.clientY; | 276 | m.client.y = (!e.clientY || e.clientY < 0) ? 0 : e.clientY; |
276 | } | 277 | } |
277 | 278 | ||
278 | m.page = new MochiKit.Style.Coordinates(0, 0); | 279 | m.page = { x: 0, y: 0 }; |
279 | if (e.pageX || e.pageY) { | 280 | if (e.pageX || e.pageY) { |
280 | m.page.x = (!e.pageX || e.pageX < 0) ? 0 : e.pageX; | 281 | m.page.x = (!e.pageX || e.pageX < 0) ? 0 : e.pageX; |
281 | m.page.y = (!e.pageY || e.pageY < 0) ? 0 : e.pageY; | 282 | m.page.y = (!e.pageY || e.pageY < 0) ? 0 : e.pageY; |
282 | } else { | 283 | } else { |
283 | /* | 284 | /* |
284 | 285 | ||
285 | The IE shortcut can be off by two. We fix it. See: | 286 | The IE shortcut can be off by two. We fix it. See: |
286 | http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp | 287 | http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp |
287 | 288 | ||
288 | This is similar to the method used in | 289 | This is similar to the method used in |
289 | MochiKit.Style.getElementPosition(). | 290 | MochiKit.Style.getElementPosition(). |
290 | 291 | ||
291 | */ | 292 | */ |
292 | var de = MochiKit.DOM._document.documentElement; | 293 | var de = MochiKit.DOM._document.documentElement; |
293 | var b = MochiKit.DOM._document.body; | 294 | var b = MochiKit.DOM._document.body; |
294 | 295 | ||
295 | m.page.x = e.clientX + | 296 | m.page.x = e.clientX + |
296 | (de.scrollLeft || b.scrollLeft) - | 297 | (de.scrollLeft || b.scrollLeft) - |
297 | (de.clientLeft || 0); | 298 | (de.clientLeft || 0); |
298 | 299 | ||
299 | m.page.y = e.clientY + | 300 | m.page.y = e.clientY + |
300 | (de.scrollTop || b.scrollTop) - | 301 | (de.scrollTop || b.scrollTop) - |
301 | (de.clientTop || 0); | 302 | (de.clientTop || 0); |
302 | 303 | ||
303 | } | 304 | } |
304 | if (this.type() != 'mousemove' && this.type() != 'mousewheel') { | 305 | if (this.type() != 'mousemove' && this.type() != 'mousewheel') { |
305 | m.button = {}; | 306 | m.button = {}; |
306 | m.button.left = false; | 307 | m.button.left = false; |
307 | m.button.right = false; | 308 | m.button.right = false; |
308 | m.button.middle = false; | 309 | m.button.middle = false; |
309 | 310 | ||
310 | /* we could check e.button, but which is more consistent */ | 311 | /* we could check e.button, but which is more consistent */ |
311 | if (e.which) { | 312 | if (e.which) { |
312 | m.button.left = (e.which == 1); | 313 | m.button.left = (e.which == 1); |
313 | m.button.middle = (e.which == 2); | 314 | m.button.middle = (e.which == 2); |
314 | m.button.right = (e.which == 3); | 315 | m.button.right = (e.which == 3); |
315 | 316 | ||
316 | /* | 317 | /* |
317 | 318 | ||
318 | Mac browsers and right click: | 319 | Mac browsers and right click: |
319 | 320 | ||
320 | - Safari doesn't fire any click events on a right | 321 | - Safari doesn't fire any click events on a right |
321 | click: | 322 | click: |
322 | http://bugs.webkit.org/show_bug.cgi?id=6595 | 323 | http://bugs.webkit.org/show_bug.cgi?id=6595 |
323 | 324 | ||
324 | - Firefox fires the event, and sets ctrlKey = true | 325 | - Firefox fires the event, and sets ctrlKey = true |
325 | 326 | ||
326 | - Opera fires the event, and sets metaKey = true | 327 | - Opera fires the event, and sets metaKey = true |
327 | 328 | ||
328 | oncontextmenu is fired on right clicks between | 329 | oncontextmenu is fired on right clicks between |
329 | browsers and across platforms. | 330 | browsers and across platforms. |
330 | 331 | ||
331 | */ | 332 | */ |
332 | 333 | ||
333 | } else { | 334 | } else { |
334 | m.button.left = !!(e.button & 1); | 335 | m.button.left = !!(e.button & 1); |
335 | m.button.right = !!(e.button & 2); | 336 | m.button.right = !!(e.button & 2); |
336 | m.button.middle = !!(e.button & 4); | 337 | m.button.middle = !!(e.button & 4); |
337 | } | 338 | } |
338 | } | 339 | } |
339 | if (this.type() == 'mousewheel') { | 340 | if (this.type() == 'mousewheel') { |
340 | m.wheel = new MochiKit.Style.Coordinates(0, 0); | 341 | m.wheel = { x: 0, y: 0 }; |
341 | if (e.wheelDeltaX || e.wheelDeltaY) { | 342 | if (e.wheelDeltaX || e.wheelDeltaY) { |
342 | m.wheel.x = e.wheelDeltaX / -40 || 0; | 343 | m.wheel.x = e.wheelDeltaX / -40 || 0; |
343 | m.wheel.y = e.wheelDeltaY / -40 || 0; | 344 | m.wheel.y = e.wheelDeltaY / -40 || 0; |
344 | } else if (e.wheelDelta) { | 345 | } else if (e.wheelDelta) { |
345 | m.wheel.y = e.wheelDelta / -40; | 346 | m.wheel.y = e.wheelDelta / -40; |
346 | } else { | 347 | } else { |
347 | m.wheel.y = e.detail || 0; | 348 | m.wheel.y = e.detail || 0; |
348 | } | 349 | } |
349 | } | 350 | } |
350 | this._mouse = m; | 351 | this._mouse = m; |
351 | return m; | 352 | return m; |
352 | } | 353 | } |
353 | return undefined; | 354 | return undefined; |
354 | }, | 355 | }, |
355 | 356 | ||
356 | /** @id MochiKit.Signal.Event.prototype.stop */ | 357 | /** @id MochiKit.Signal.Event.prototype.stop */ |
357 | stop: function () { | 358 | stop: function () { |
358 | this.stopPropagation(); | 359 | this.stopPropagation(); |
359 | this.preventDefault(); | 360 | this.preventDefault(); |
360 | }, | 361 | }, |
361 | 362 | ||
362 | /** @id MochiKit.Signal.Event.prototype.stopPropagation */ | 363 | /** @id MochiKit.Signal.Event.prototype.stopPropagation */ |
363 | stopPropagation: function () { | 364 | stopPropagation: function () { |
364 | if (this._event.stopPropagation) { | 365 | if (this._event.stopPropagation) { |
365 | this._event.stopPropagation(); | 366 | this._event.stopPropagation(); |
366 | } else { | 367 | } else { |
367 | this._event.cancelBubble = true; | 368 | this._event.cancelBubble = true; |
368 | } | 369 | } |
369 | }, | 370 | }, |
370 | 371 | ||
371 | /** @id MochiKit.Signal.Event.prototype.preventDefault */ | 372 | /** @id MochiKit.Signal.Event.prototype.preventDefault */ |
372 | preventDefault: function () { | 373 | preventDefault: function () { |
@@ -643,246 +644,258 @@ MochiKit.Base.update(MochiKit.Signal, { | |||
643 | } else if (isDOM && sig == "onmousewheel" && self._browserLacksMouseWheelEvent()) { | 644 | } else if (isDOM && sig == "onmousewheel" && self._browserLacksMouseWheelEvent()) { |
644 | var listener = self._listener(src, sig, func, obj, isDOM); | 645 | var listener = self._listener(src, sig, func, obj, isDOM); |
645 | sig = "onDOMMouseScroll"; | 646 | sig = "onDOMMouseScroll"; |
646 | } else { | 647 | } else { |
647 | var listener = self._listener(src, sig, func, obj, isDOM); | 648 | var listener = self._listener(src, sig, func, obj, isDOM); |
648 | } | 649 | } |
649 | 650 | ||
650 | if (src.addEventListener) { | 651 | if (src.addEventListener) { |
651 | src.addEventListener(sig.substr(2), listener, false); | 652 | src.addEventListener(sig.substr(2), listener, false); |
652 | } else if (src.attachEvent) { | 653 | } else if (src.attachEvent) { |
653 | src.attachEvent(sig, listener); // useCapture unsupported | 654 | src.attachEvent(sig, listener); // useCapture unsupported |
654 | } | 655 | } |
655 | 656 | ||
656 | var ident = new MochiKit.Signal.Ident({ | 657 | var ident = new MochiKit.Signal.Ident({ |
657 | source: src, | 658 | source: src, |
658 | signal: sig, | 659 | signal: sig, |
659 | listener: listener, | 660 | listener: listener, |
660 | isDOM: isDOM, | 661 | isDOM: isDOM, |
661 | objOrFunc: objOrFunc, | 662 | objOrFunc: objOrFunc, |
662 | funcOrStr: funcOrStr, | 663 | funcOrStr: funcOrStr, |
663 | connected: true | 664 | connected: true |
664 | }); | 665 | }); |
665 | self._observers.push(ident); | 666 | self._observers.push(ident); |
666 | 667 | ||
667 | if (!isDOM && typeof(src.__connect__) == 'function') { | 668 | if (!isDOM && typeof(src.__connect__) == 'function') { |
668 | var args = MochiKit.Base.extend([ident], arguments, 1); | 669 | var args = MochiKit.Base.extend([ident], arguments, 1); |
669 | src.__connect__.apply(src, args); | 670 | src.__connect__.apply(src, args); |
670 | } | 671 | } |
671 | 672 | ||
672 | return ident; | 673 | return ident; |
673 | }, | 674 | }, |
674 | 675 | ||
676 | /** @id MochiKit.Signal.connectOnce */ | ||
677 | connectOnce: function (src, sig, objOrFunc/* optional */, funcOrStr) { | ||
678 | var self = MochiKit.Signal; | ||
679 | var ident1 = self.connect(src, sig, objOrFunc, funcOrStr); | ||
680 | var ident2; | ||
681 | ident2 = self.connect(src, sig, function() { | ||
682 | self.disconnect(ident1); | ||
683 | self.disconnect(ident2); | ||
684 | }); | ||
685 | return ident1; | ||
686 | }, | ||
687 | |||
675 | _disconnect: function (ident) { | 688 | _disconnect: function (ident) { |
676 | // already disconnected | 689 | // already disconnected |
677 | if (!ident.connected) { | 690 | if (!ident.connected) { |
678 | return; | 691 | return; |
679 | } | 692 | } |
680 | ident.connected = false; | 693 | ident.connected = false; |
681 | var src = ident.source; | 694 | var src = ident.source; |
682 | var sig = ident.signal; | 695 | var sig = ident.signal; |
683 | var listener = ident.listener; | 696 | var listener = ident.listener; |
684 | // check isDOM | 697 | // check isDOM |
685 | if (!ident.isDOM) { | 698 | if (!ident.isDOM) { |
686 | if (typeof(src.__disconnect__) == 'function') { | 699 | if (typeof(src.__disconnect__) == 'function') { |
687 | src.__disconnect__(ident, sig, ident.objOrFunc, ident.funcOrStr); | 700 | src.__disconnect__(ident, sig, ident.objOrFunc, ident.funcOrStr); |
688 | } | 701 | } |
689 | return; | 702 | return; |
690 | } | 703 | } |
691 | if (src.removeEventListener) { | 704 | if (src.removeEventListener) { |
692 | src.removeEventListener(sig.substr(2), listener, false); | 705 | src.removeEventListener(sig.substr(2), listener, false); |
693 | } else if (src.detachEvent) { | 706 | } else if (src.detachEvent) { |
694 | src.detachEvent(sig, listener); // useCapture unsupported | 707 | src.detachEvent(sig, listener); // useCapture unsupported |
695 | } else { | 708 | } else { |
696 | throw new Error("'src' must be a DOM element"); | 709 | throw new Error("'src' must be a DOM element"); |
697 | } | 710 | } |
698 | }, | 711 | }, |
699 | 712 | ||
700 | /** @id MochiKit.Signal.disconnect */ | 713 | /** @id MochiKit.Signal.disconnect */ |
701 | disconnect: function (ident) { | 714 | disconnect: function (ident) { |
702 | var self = MochiKit.Signal; | 715 | var self = MochiKit.Signal; |
703 | var observers = self._observers; | 716 | var observers = self._observers; |
704 | var m = MochiKit.Base; | 717 | var m = MochiKit.Base; |
705 | if (arguments.length > 1) { | 718 | if (arguments.length > 1) { |
706 | // compatibility API | 719 | // compatibility API |
707 | var src = arguments[0]; | 720 | var src = arguments[0]; |
708 | if (typeof(src) == "string") { | 721 | if (typeof(src) == "string") { |
709 | src = MochiKit.DOM.getElement(src); | 722 | src = MochiKit.DOM.getElement(src); |
710 | } | 723 | } |
711 | var sig = arguments[1]; | 724 | var sig = arguments[1]; |
712 | var obj = arguments[2]; | 725 | var obj = arguments[2]; |
713 | var func = arguments[3]; | 726 | var func = arguments[3]; |
714 | for (var i = observers.length - 1; i >= 0; i--) { | 727 | for (var i = observers.length - 1; i >= 0; i--) { |
715 | var o = observers[i]; | 728 | var o = observers[i]; |
716 | if (o.source === src && o.signal === sig && o.objOrFunc === obj && o.funcOrStr === func) { | 729 | if (o.source === src && o.signal === sig && o.objOrFunc === obj && o.funcOrStr === func) { |
717 | self._disconnect(o); | 730 | self._disconnect(o); |
718 | if (!self._lock) { | 731 | if (self._lock === 0) { |
719 | observers.splice(i, 1); | 732 | observers.splice(i, 1); |
720 | } else { | 733 | } else { |
721 | self._dirty = true; | 734 | self._dirty = true; |
722 | } | 735 | } |
723 | return true; | 736 | return true; |
724 | } | 737 | } |
725 | } | 738 | } |
726 | } else { | 739 | } else { |
727 | var idx = m.findIdentical(observers, ident); | 740 | var idx = m.findIdentical(observers, ident); |
728 | if (idx >= 0) { | 741 | if (idx >= 0) { |
729 | self._disconnect(ident); | 742 | self._disconnect(ident); |
730 | if (!self._lock) { | 743 | if (self._lock === 0) { |
731 | observers.splice(idx, 1); | 744 | observers.splice(idx, 1); |
732 | } else { | 745 | } else { |
733 | self._dirty = true; | 746 | self._dirty = true; |
734 | } | 747 | } |
735 | return true; | 748 | return true; |
736 | } | 749 | } |
737 | } | 750 | } |
738 | return false; | 751 | return false; |
739 | }, | 752 | }, |
740 | 753 | ||
741 | /** @id MochiKit.Signal.disconnectAllTo */ | 754 | /** @id MochiKit.Signal.disconnectAllTo */ |
742 | disconnectAllTo: function (objOrFunc, /* optional */funcOrStr) { | 755 | disconnectAllTo: function (objOrFunc, /* optional */funcOrStr) { |
743 | var self = MochiKit.Signal; | 756 | var self = MochiKit.Signal; |
744 | var observers = self._observers; | 757 | var observers = self._observers; |
745 | var disconnect = self._disconnect; | 758 | var disconnect = self._disconnect; |
746 | var locked = self._lock; | 759 | var lock = self._lock; |
747 | var dirty = self._dirty; | 760 | var dirty = self._dirty; |
748 | if (typeof(funcOrStr) === 'undefined') { | 761 | if (typeof(funcOrStr) === 'undefined') { |
749 | funcOrStr = null; | 762 | funcOrStr = null; |
750 | } | 763 | } |
751 | for (var i = observers.length - 1; i >= 0; i--) { | 764 | for (var i = observers.length - 1; i >= 0; i--) { |
752 | var ident = observers[i]; | 765 | var ident = observers[i]; |
753 | if (ident.objOrFunc === objOrFunc && | 766 | if (ident.objOrFunc === objOrFunc && |
754 | (funcOrStr === null || ident.funcOrStr === funcOrStr)) { | 767 | (funcOrStr === null || ident.funcOrStr === funcOrStr)) { |
755 | disconnect(ident); | 768 | disconnect(ident); |
756 | if (locked) { | 769 | if (lock === 0) { |
757 | dirty = true; | ||
758 | } else { | ||
759 | observers.splice(i, 1); | 770 | observers.splice(i, 1); |
771 | } else { | ||
772 | dirty = true; | ||
760 | } | 773 | } |
761 | } | 774 | } |
762 | } | 775 | } |
763 | self._dirty = dirty; | 776 | self._dirty = dirty; |
764 | }, | 777 | }, |
765 | 778 | ||
766 | /** @id MochiKit.Signal.disconnectAll */ | 779 | /** @id MochiKit.Signal.disconnectAll */ |
767 | disconnectAll: function (src/* optional */, sig) { | 780 | disconnectAll: function (src/* optional */, sig) { |
768 | if (typeof(src) == "string") { | 781 | if (typeof(src) == "string") { |
769 | src = MochiKit.DOM.getElement(src); | 782 | src = MochiKit.DOM.getElement(src); |
770 | } | 783 | } |
771 | var m = MochiKit.Base; | 784 | var m = MochiKit.Base; |
772 | var signals = m.flattenArguments(m.extend(null, arguments, 1)); | 785 | var signals = m.flattenArguments(m.extend(null, arguments, 1)); |
773 | var self = MochiKit.Signal; | 786 | var self = MochiKit.Signal; |
774 | var disconnect = self._disconnect; | 787 | var disconnect = self._disconnect; |
775 | var observers = self._observers; | 788 | var observers = self._observers; |
776 | var i, ident; | 789 | var i, ident; |
777 | var locked = self._lock; | 790 | var lock = self._lock; |
778 | var dirty = self._dirty; | 791 | var dirty = self._dirty; |
779 | if (signals.length === 0) { | 792 | if (signals.length === 0) { |
780 | // disconnect all | 793 | // disconnect all |
781 | for (i = observers.length - 1; i >= 0; i--) { | 794 | for (i = observers.length - 1; i >= 0; i--) { |
782 | ident = observers[i]; | 795 | ident = observers[i]; |
783 | if (ident.source === src) { | 796 | if (ident.source === src) { |
784 | disconnect(ident); | 797 | disconnect(ident); |
785 | if (!locked) { | 798 | if (lock === 0) { |
786 | observers.splice(i, 1); | 799 | observers.splice(i, 1); |
787 | } else { | 800 | } else { |
788 | dirty = true; | 801 | dirty = true; |
789 | } | 802 | } |
790 | } | 803 | } |
791 | } | 804 | } |
792 | } else { | 805 | } else { |
793 | var sigs = {}; | 806 | var sigs = {}; |
794 | for (i = 0; i < signals.length; i++) { | 807 | for (i = 0; i < signals.length; i++) { |
795 | sigs[signals[i]] = true; | 808 | sigs[signals[i]] = true; |
796 | } | 809 | } |
797 | for (i = observers.length - 1; i >= 0; i--) { | 810 | for (i = observers.length - 1; i >= 0; i--) { |
798 | ident = observers[i]; | 811 | ident = observers[i]; |
799 | if (ident.source === src && ident.signal in sigs) { | 812 | if (ident.source === src && ident.signal in sigs) { |
800 | disconnect(ident); | 813 | disconnect(ident); |
801 | if (!locked) { | 814 | if (lock === 0) { |
802 | observers.splice(i, 1); | 815 | observers.splice(i, 1); |
803 | } else { | 816 | } else { |
804 | dirty = true; | 817 | dirty = true; |
805 | } | 818 | } |
806 | } | 819 | } |
807 | } | 820 | } |
808 | } | 821 | } |
809 | self._dirty = dirty; | 822 | self._dirty = dirty; |
810 | }, | 823 | }, |
811 | 824 | ||
812 | /** @id MochiKit.Signal.signal */ | 825 | /** @id MochiKit.Signal.signal */ |
813 | signal: function (src, sig) { | 826 | signal: function (src, sig) { |
814 | var self = MochiKit.Signal; | 827 | var self = MochiKit.Signal; |
815 | var observers = self._observers; | 828 | var observers = self._observers; |
816 | if (typeof(src) == "string") { | 829 | if (typeof(src) == "string") { |
817 | src = MochiKit.DOM.getElement(src); | 830 | src = MochiKit.DOM.getElement(src); |
818 | } | 831 | } |
819 | var args = MochiKit.Base.extend(null, arguments, 2); | 832 | var args = MochiKit.Base.extend(null, arguments, 2); |
820 | var errors = []; | 833 | var errors = []; |
821 | self._lock = true; | 834 | self._lock++; |
822 | for (var i = 0; i < observers.length; i++) { | 835 | for (var i = 0; i < observers.length; i++) { |
823 | var ident = observers[i]; | 836 | var ident = observers[i]; |
824 | if (ident.source === src && ident.signal === sig && | 837 | if (ident.source === src && ident.signal === sig && |
825 | ident.connected) { | 838 | ident.connected) { |
826 | try { | 839 | try { |
827 | if (ident.isDOM && ident.funcOrStr != null) { | 840 | if (ident.isDOM && ident.funcOrStr != null) { |
828 | var obj = ident.objOrFunc; | 841 | var obj = ident.objOrFunc; |
829 | obj[ident.funcOrStr].apply(obj, args); | 842 | obj[ident.funcOrStr].apply(obj, args); |
830 | } else if (ident.isDOM) { | 843 | } else if (ident.isDOM) { |
831 | ident.objOrFunc.apply(src, args); | 844 | ident.objOrFunc.apply(src, args); |
832 | } else { | 845 | } else { |
833 | ident.listener.apply(src, args); | 846 | ident.listener.apply(src, args); |
834 | } | 847 | } |
835 | } catch (e) { | 848 | } catch (e) { |
836 | errors.push(e); | 849 | errors.push(e); |
837 | } | 850 | } |
838 | } | 851 | } |
839 | } | 852 | } |
840 | self._lock = false; | 853 | self._lock--; |
841 | if (self._dirty) { | 854 | if (self._lock === 0 && self._dirty) { |
842 | self._dirty = false; | 855 | self._dirty = false; |
843 | for (var i = observers.length - 1; i >= 0; i--) { | 856 | for (var i = observers.length - 1; i >= 0; i--) { |
844 | if (!observers[i].connected) { | 857 | if (!observers[i].connected) { |
845 | observers.splice(i, 1); | 858 | observers.splice(i, 1); |
846 | } | 859 | } |
847 | } | 860 | } |
848 | } | 861 | } |
849 | if (errors.length == 1) { | 862 | if (errors.length == 1) { |
850 | throw errors[0]; | 863 | throw errors[0]; |
851 | } else if (errors.length > 1) { | 864 | } else if (errors.length > 1) { |
852 | var e = new Error("Multiple errors thrown in handling 'sig', see errors property"); | 865 | var e = new Error("Multiple errors thrown in handling 'sig', see errors property"); |
853 | e.errors = errors; | 866 | e.errors = errors; |
854 | throw e; | 867 | throw e; |
855 | } | 868 | } |
856 | } | 869 | } |
857 | 870 | ||
858 | }); | 871 | }); |
859 | 872 | ||
860 | MochiKit.Signal.__new__ = function (win) { | 873 | MochiKit.Signal.__new__ = function (win) { |
861 | var m = MochiKit.Base; | 874 | var m = MochiKit.Base; |
862 | this._document = document; | 875 | this._document = document; |
863 | this._window = win; | 876 | this._window = win; |
864 | this._lock = false; | 877 | this._lock = 0; |
865 | this._dirty = false; | 878 | this._dirty = false; |
866 | 879 | ||
867 | try { | 880 | try { |
868 | this.connect(window, 'onunload', this._unloadCache); | 881 | this.connect(window, 'onunload', this._unloadCache); |
869 | } catch (e) { | 882 | } catch (e) { |
870 | // pass: might not be a browser | 883 | // pass: might not be a browser |
871 | } | 884 | } |
872 | 885 | ||
873 | m.nameFunctions(this); | 886 | m.nameFunctions(this); |
874 | }; | 887 | }; |
875 | 888 | ||
876 | MochiKit.Signal.__new__(this); | 889 | MochiKit.Signal.__new__(this); |
877 | 890 | ||
878 | // | 891 | // |
879 | // XXX: Internet Explorer blows | 892 | // XXX: Internet Explorer blows |
880 | // | 893 | // |
881 | if (MochiKit.__export__) { | 894 | if (MochiKit.__export__) { |
882 | connect = MochiKit.Signal.connect; | 895 | connect = MochiKit.Signal.connect; |
883 | disconnect = MochiKit.Signal.disconnect; | 896 | disconnect = MochiKit.Signal.disconnect; |
884 | disconnectAll = MochiKit.Signal.disconnectAll; | 897 | disconnectAll = MochiKit.Signal.disconnectAll; |
885 | signal = MochiKit.Signal.signal; | 898 | signal = MochiKit.Signal.signal; |
886 | } | 899 | } |
887 | 900 | ||
888 | MochiKit.Base._exportSymbols(this, MochiKit.Signal); | 901 | MochiKit.Base._exportSymbols(this, MochiKit.Signal); |
diff --git a/frontend/gamma/js/MochiKit/Sortable.js b/frontend/gamma/js/MochiKit/Sortable.js index 863b506..ca9db21 100644 --- a/frontend/gamma/js/MochiKit/Sortable.js +++ b/frontend/gamma/js/MochiKit/Sortable.js | |||
@@ -1,41 +1,41 @@ | |||
1 | /*** | 1 | /*** |
2 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) | 2 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
3 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) | 3 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) |
4 | 4 | ||
5 | See scriptaculous.js for full license. | 5 | See scriptaculous.js for full license. |
6 | 6 | ||
7 | ***/ | 7 | ***/ |
8 | 8 | ||
9 | MochiKit.Base._module('Sortable', '1.5', ['Base', 'Iter', 'DOM', 'Position', 'DragAndDrop']); | 9 | MochiKit.Base.module(MochiKit, 'Sortable', '1.5', ['Base', 'Iter', 'DOM', 'Position', 'DragAndDrop']); |
10 | 10 | ||
11 | MochiKit.Base.update(MochiKit.Sortable, { | 11 | MochiKit.Base.update(MochiKit.Sortable, { |
12 | __export__: false, | 12 | __export__: false, |
13 | 13 | ||
14 | /*** | 14 | /*** |
15 | 15 | ||
16 | Manage sortables. Mainly use the create function to add a sortable. | 16 | Manage sortables. Mainly use the create function to add a sortable. |
17 | 17 | ||
18 | ***/ | 18 | ***/ |
19 | sortables: {}, | 19 | sortables: {}, |
20 | 20 | ||
21 | _findRootElement: function (element) { | 21 | _findRootElement: function (element) { |
22 | while (element.tagName.toUpperCase() != "BODY") { | 22 | while (element.tagName.toUpperCase() != "BODY") { |
23 | if (element.id && MochiKit.Sortable.sortables[element.id]) { | 23 | if (element.id && MochiKit.Sortable.sortables[element.id]) { |
24 | return element; | 24 | return element; |
25 | } | 25 | } |
26 | element = element.parentNode; | 26 | element = element.parentNode; |
27 | } | 27 | } |
28 | }, | 28 | }, |
29 | 29 | ||
30 | _createElementId: function(element) { | 30 | _createElementId: function(element) { |
31 | if (element.id == null || element.id == "") { | 31 | if (element.id == null || element.id == "") { |
32 | var d = MochiKit.DOM; | 32 | var d = MochiKit.DOM; |
33 | var id; | 33 | var id; |
34 | var count = 1; | 34 | var count = 1; |
35 | while (d.getElement(id = "sortable" + count) != null) { | 35 | while (d.getElement(id = "sortable" + count) != null) { |
36 | count += 1; | 36 | count += 1; |
37 | } | 37 | } |
38 | d.setNodeAttribute(element, "id", id); | 38 | d.setNodeAttribute(element, "id", id); |
39 | } | 39 | } |
40 | }, | 40 | }, |
41 | 41 | ||
@@ -150,73 +150,73 @@ MochiKit.Base.update(MochiKit.Sortable, { | |||
150 | handle: options.handle | 150 | handle: options.handle |
151 | }; | 151 | }; |
152 | 152 | ||
153 | if (options.starteffect) { | 153 | if (options.starteffect) { |
154 | options_for_draggable.starteffect = options.starteffect; | 154 | options_for_draggable.starteffect = options.starteffect; |
155 | } | 155 | } |
156 | 156 | ||
157 | if (options.reverteffect) { | 157 | if (options.reverteffect) { |
158 | options_for_draggable.reverteffect = options.reverteffect; | 158 | options_for_draggable.reverteffect = options.reverteffect; |
159 | } else if (options.ghosting) { | 159 | } else if (options.ghosting) { |
160 | options_for_draggable.reverteffect = function (innerelement) { | 160 | options_for_draggable.reverteffect = function (innerelement) { |
161 | innerelement.style.top = 0; | 161 | innerelement.style.top = 0; |
162 | innerelement.style.left = 0; | 162 | innerelement.style.left = 0; |
163 | }; | 163 | }; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (options.endeffect) { | 166 | if (options.endeffect) { |
167 | options_for_draggable.endeffect = options.endeffect; | 167 | options_for_draggable.endeffect = options.endeffect; |
168 | } | 168 | } |
169 | 169 | ||
170 | if (options.zindex) { | 170 | if (options.zindex) { |
171 | options_for_draggable.zindex = options.zindex; | 171 | options_for_draggable.zindex = options.zindex; |
172 | } | 172 | } |
173 | 173 | ||
174 | // build options for the droppables | 174 | // build options for the droppables |
175 | var options_for_droppable = { | 175 | var options_for_droppable = { |
176 | overlap: options.overlap, | 176 | overlap: options.overlap, |
177 | containment: options.containment, | 177 | containment: options.containment, |
178 | hoverclass: options.hoverclass, | 178 | hoverclass: options.hoverclass, |
179 | onhover: self.onHover, | 179 | onhover: self.onHover, |
180 | tree: options.tree, | 180 | tree: options.tree, |
181 | accept: options.accept | 181 | accept: options.accept |
182 | } | 182 | }; |
183 | 183 | ||
184 | var options_for_tree = { | 184 | var options_for_tree = { |
185 | onhover: self.onEmptyHover, | 185 | onhover: self.onEmptyHover, |
186 | overlap: options.overlap, | 186 | overlap: options.overlap, |
187 | containment: options.containment, | 187 | containment: options.containment, |
188 | hoverclass: options.hoverclass, | 188 | hoverclass: options.hoverclass, |
189 | accept: options.accept | 189 | accept: options.accept |
190 | } | 190 | }; |
191 | 191 | ||
192 | // fix for gecko engine | 192 | // fix for gecko engine |
193 | MochiKit.DOM.removeEmptyTextNodes(element); | 193 | MochiKit.DOM.removeEmptyTextNodes(element); |
194 | 194 | ||
195 | options.draggables = []; | 195 | options.draggables = []; |
196 | options.droppables = []; | 196 | options.droppables = []; |
197 | 197 | ||
198 | // drop on empty handling | 198 | // drop on empty handling |
199 | if (options.dropOnEmpty || options.tree) { | 199 | if (options.dropOnEmpty || options.tree) { |
200 | new MochiKit.DragAndDrop.Droppable(element, options_for_tree); | 200 | new MochiKit.DragAndDrop.Droppable(element, options_for_tree); |
201 | options.droppables.push(element); | 201 | options.droppables.push(element); |
202 | } | 202 | } |
203 | MochiKit.Base.map(function (e) { | 203 | MochiKit.Base.map(function (e) { |
204 | // handles are per-draggable | 204 | // handles are per-draggable |
205 | var handle = options.handle ? | 205 | var handle = options.handle ? |
206 | MochiKit.DOM.getFirstElementByTagAndClassName(null, | 206 | MochiKit.DOM.getFirstElementByTagAndClassName(null, |
207 | options.handle, e) : e; | 207 | options.handle, e) : e; |
208 | options.draggables.push( | 208 | options.draggables.push( |
209 | new MochiKit.DragAndDrop.Draggable(e, | 209 | new MochiKit.DragAndDrop.Draggable(e, |
210 | MochiKit.Base.update(options_for_draggable, | 210 | MochiKit.Base.update(options_for_draggable, |
211 | {handle: handle}))); | 211 | {handle: handle}))); |
212 | new MochiKit.DragAndDrop.Droppable(e, options_for_droppable); | 212 | new MochiKit.DragAndDrop.Droppable(e, options_for_droppable); |
213 | if (options.tree) { | 213 | if (options.tree) { |
214 | e.treeNode = element; | 214 | e.treeNode = element; |
215 | } | 215 | } |
216 | options.droppables.push(e); | 216 | options.droppables.push(e); |
217 | }, (self.findElements(element, options) || [])); | 217 | }, (self.findElements(element, options) || [])); |
218 | 218 | ||
219 | if (options.tree) { | 219 | if (options.tree) { |
220 | MochiKit.Base.map(function (e) { | 220 | MochiKit.Base.map(function (e) { |
221 | new MochiKit.DragAndDrop.Droppable(e, options_for_tree); | 221 | new MochiKit.DragAndDrop.Droppable(e, options_for_tree); |
222 | e.treeNode = element; | 222 | e.treeNode = element; |
@@ -401,110 +401,110 @@ MochiKit.Base.update(MochiKit.Sortable, { | |||
401 | var offsets = MochiKit.Position.cumulativeOffset(dropon); | 401 | var offsets = MochiKit.Position.cumulativeOffset(dropon); |
402 | self._marker.style.left = offsets.x + 'px'; | 402 | self._marker.style.left = offsets.x + 'px'; |
403 | self._marker.style.top = offsets.y + 'px'; | 403 | self._marker.style.top = offsets.y + 'px'; |
404 | 404 | ||
405 | if (position == 'after') { | 405 | if (position == 'after') { |
406 | if (sortable.overlap == 'horizontal') { | 406 | if (sortable.overlap == 'horizontal') { |
407 | self._marker.style.left = (offsets.x + dropon.clientWidth) + 'px'; | 407 | self._marker.style.left = (offsets.x + dropon.clientWidth) + 'px'; |
408 | } else { | 408 | } else { |
409 | self._marker.style.top = (offsets.y + dropon.clientHeight) + 'px'; | 409 | self._marker.style.top = (offsets.y + dropon.clientHeight) + 'px'; |
410 | } | 410 | } |
411 | } | 411 | } |
412 | MochiKit.Style.showElement(self._marker); | 412 | MochiKit.Style.showElement(self._marker); |
413 | }, | 413 | }, |
414 | 414 | ||
415 | _tree: function (element, options, parent) { | 415 | _tree: function (element, options, parent) { |
416 | var self = MochiKit.Sortable; | 416 | var self = MochiKit.Sortable; |
417 | var children = self.findElements(element, options) || []; | 417 | var children = self.findElements(element, options) || []; |
418 | 418 | ||
419 | for (var i = 0; i < children.length; ++i) { | 419 | for (var i = 0; i < children.length; ++i) { |
420 | var match = children[i].id.match(options.format); | 420 | var match = children[i].id.match(options.format); |
421 | 421 | ||
422 | if (!match) { | 422 | if (!match) { |
423 | continue; | 423 | continue; |
424 | } | 424 | } |
425 | 425 | ||
426 | var child = { | 426 | var child = { |
427 | id: encodeURIComponent(match ? match[1] : null), | 427 | id: encodeURIComponent(match ? match[1] : null), |
428 | element: element, | 428 | element: element, |
429 | parent: parent, | 429 | parent: parent, |
430 | children: [], | 430 | children: [], |
431 | position: parent.children.length, | 431 | position: parent.children.length, |
432 | container: self._findChildrenElement(children[i], options.treeTag.toUpperCase()) | 432 | container: self._findChildrenElement(children[i], options.treeTag.toUpperCase()) |
433 | } | 433 | }; |
434 | 434 | ||
435 | /* Get the element containing the children and recurse over it */ | 435 | /* Get the element containing the children and recurse over it */ |
436 | if (child.container) { | 436 | if (child.container) { |
437 | self._tree(child.container, options, child) | 437 | self._tree(child.container, options, child); |
438 | } | 438 | } |
439 | 439 | ||
440 | parent.children.push (child); | 440 | parent.children.push (child); |
441 | } | 441 | } |
442 | 442 | ||
443 | return parent; | 443 | return parent; |
444 | }, | 444 | }, |
445 | 445 | ||
446 | /* Finds the first element of the given tag type within a parent element. | 446 | /* Finds the first element of the given tag type within a parent element. |
447 | Used for finding the first LI[ST] within a L[IST]I[TEM].*/ | 447 | Used for finding the first LI[ST] within a L[IST]I[TEM].*/ |
448 | _findChildrenElement: function (element, containerTag) { | 448 | _findChildrenElement: function (element, containerTag) { |
449 | if (element && element.hasChildNodes) { | 449 | if (element && element.hasChildNodes) { |
450 | containerTag = containerTag.toUpperCase(); | 450 | containerTag = containerTag.toUpperCase(); |
451 | for (var i = 0; i < element.childNodes.length; ++i) { | 451 | for (var i = 0; i < element.childNodes.length; ++i) { |
452 | if (element.childNodes[i].tagName.toUpperCase() == containerTag) { | 452 | if (element.childNodes[i].tagName.toUpperCase() == containerTag) { |
453 | return element.childNodes[i]; | 453 | return element.childNodes[i]; |
454 | } | 454 | } |
455 | } | 455 | } |
456 | } | 456 | } |
457 | return null; | 457 | return null; |
458 | }, | 458 | }, |
459 | 459 | ||
460 | /** @id MochiKit.Sortable.tree */ | 460 | /** @id MochiKit.Sortable.tree */ |
461 | tree: function (element, options) { | 461 | tree: function (element, options) { |
462 | element = MochiKit.DOM.getElement(element); | 462 | element = MochiKit.DOM.getElement(element); |
463 | var sortableOptions = MochiKit.Sortable.options(element); | 463 | var sortableOptions = MochiKit.Sortable.options(element); |
464 | options = MochiKit.Base.update({ | 464 | options = MochiKit.Base.update({ |
465 | tag: sortableOptions.tag, | 465 | tag: sortableOptions.tag, |
466 | treeTag: sortableOptions.treeTag, | 466 | treeTag: sortableOptions.treeTag, |
467 | only: sortableOptions.only, | 467 | only: sortableOptions.only, |
468 | name: element.id, | 468 | name: element.id, |
469 | format: sortableOptions.format | 469 | format: sortableOptions.format |
470 | }, options || {}); | 470 | }, options || {}); |
471 | 471 | ||
472 | var root = { | 472 | var root = { |
473 | id: null, | 473 | id: null, |
474 | parent: null, | 474 | parent: null, |
475 | children: new Array, | 475 | children: new Array, |
476 | container: element, | 476 | container: element, |
477 | position: 0 | 477 | position: 0 |
478 | } | 478 | }; |
479 | 479 | ||
480 | return MochiKit.Sortable._tree(element, options, root); | 480 | return MochiKit.Sortable._tree(element, options, root); |
481 | }, | 481 | }, |
482 | 482 | ||
483 | /** | 483 | /** |
484 | * Specifies the sequence for the Sortable. | 484 | * Specifies the sequence for the Sortable. |
485 | * @param {Node} element Element to use as the Sortable. | 485 | * @param {Node} element Element to use as the Sortable. |
486 | * @param {Object} newSequence New sequence to use. | 486 | * @param {Object} newSequence New sequence to use. |
487 | * @param {Object} options Options to use fro the Sortable. | 487 | * @param {Object} options Options to use fro the Sortable. |
488 | */ | 488 | */ |
489 | setSequence: function (element, newSequence, options) { | 489 | setSequence: function (element, newSequence, options) { |
490 | var self = MochiKit.Sortable; | 490 | var self = MochiKit.Sortable; |
491 | var b = MochiKit.Base; | 491 | var b = MochiKit.Base; |
492 | element = MochiKit.DOM.getElement(element); | 492 | element = MochiKit.DOM.getElement(element); |
493 | options = b.update(self.options(element), options || {}); | 493 | options = b.update(self.options(element), options || {}); |
494 | 494 | ||
495 | var nodeMap = {}; | 495 | var nodeMap = {}; |
496 | b.map(function (n) { | 496 | b.map(function (n) { |
497 | var m = n.id.match(options.format); | 497 | var m = n.id.match(options.format); |
498 | if (m) { | 498 | if (m) { |
499 | nodeMap[m[1]] = [n, n.parentNode]; | 499 | nodeMap[m[1]] = [n, n.parentNode]; |
500 | } | 500 | } |
501 | n.parentNode.removeChild(n); | 501 | n.parentNode.removeChild(n); |
502 | }, self.findElements(element, options)); | 502 | }, self.findElements(element, options)); |
503 | 503 | ||
504 | b.map(function (ident) { | 504 | b.map(function (ident) { |
505 | var n = nodeMap[ident]; | 505 | var n = nodeMap[ident]; |
506 | if (n) { | 506 | if (n) { |
507 | n[1].appendChild(n[0]); | 507 | n[1].appendChild(n[0]); |
508 | delete nodeMap[ident]; | 508 | delete nodeMap[ident]; |
509 | } | 509 | } |
510 | }, newSequence); | 510 | }, newSequence); |
diff --git a/frontend/gamma/js/MochiKit/Style.js b/frontend/gamma/js/MochiKit/Style.js index 7f10117..740fd2f 100644 --- a/frontend/gamma/js/MochiKit/Style.js +++ b/frontend/gamma/js/MochiKit/Style.js | |||
@@ -1,43 +1,46 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Style 1.5 | 3 | MochiKit.Style 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005-2006 Bob Ippolito, Beau Hartshorne. All rights Reserved. | 7 | (c) 2005-2006 Bob Ippolito, Beau Hartshorne. All rights Reserved. |
8 | 8 | ||
9 | The MochiKit.Style.getElementPosition function is adapted from | ||
10 | YAHOO.util.Dom.getXY v0.9.0. which is copyrighted by Yahoo! Inc. | ||
11 | |||
9 | ***/ | 12 | ***/ |
10 | 13 | ||
11 | MochiKit.Base._module('Style', '1.5', ['Base', 'DOM']); | 14 | MochiKit.Base.module(MochiKit, 'Style', '1.5', ['Base', 'DOM']); |
12 | 15 | ||
13 | 16 | ||
14 | /** @id MochiKit.Style.Dimensions */ | 17 | /** @id MochiKit.Style.Dimensions */ |
15 | MochiKit.Style.Dimensions = function (w, h) { | 18 | MochiKit.Style.Dimensions = function (w, h) { |
16 | if (!(this instanceof MochiKit.Style.Dimensions)) { | 19 | if (!(this instanceof MochiKit.Style.Dimensions)) { |
17 | return new MochiKit.Style.Dimensions(w, h); | 20 | return new MochiKit.Style.Dimensions(w, h); |
18 | } | 21 | } |
19 | this.w = w; | 22 | this.w = w; |
20 | this.h = h; | 23 | this.h = h; |
21 | }; | 24 | }; |
22 | 25 | ||
23 | MochiKit.Style.Dimensions.prototype.__repr__ = function () { | 26 | MochiKit.Style.Dimensions.prototype.__repr__ = function () { |
24 | var repr = MochiKit.Base.repr; | 27 | var repr = MochiKit.Base.repr; |
25 | return '{w: ' + repr(this.w) + ', h: ' + repr(this.h) + '}'; | 28 | return '{w: ' + repr(this.w) + ', h: ' + repr(this.h) + '}'; |
26 | }; | 29 | }; |
27 | 30 | ||
28 | MochiKit.Style.Dimensions.prototype.toString = function () { | 31 | MochiKit.Style.Dimensions.prototype.toString = function () { |
29 | return this.__repr__(); | 32 | return this.__repr__(); |
30 | }; | 33 | }; |
31 | 34 | ||
32 | 35 | ||
33 | /** @id MochiKit.Style.Coordinates */ | 36 | /** @id MochiKit.Style.Coordinates */ |
34 | MochiKit.Style.Coordinates = function (x, y) { | 37 | MochiKit.Style.Coordinates = function (x, y) { |
35 | if (!(this instanceof MochiKit.Style.Coordinates)) { | 38 | if (!(this instanceof MochiKit.Style.Coordinates)) { |
36 | return new MochiKit.Style.Coordinates(x, y); | 39 | return new MochiKit.Style.Coordinates(x, y); |
37 | } | 40 | } |
38 | this.x = x; | 41 | this.x = x; |
39 | this.y = y; | 42 | this.y = y; |
40 | }; | 43 | }; |
41 | 44 | ||
42 | MochiKit.Style.Coordinates.prototype.__repr__ = function () { | 45 | MochiKit.Style.Coordinates.prototype.__repr__ = function () { |
43 | var repr = MochiKit.Base.repr; | 46 | var repr = MochiKit.Base.repr; |
@@ -150,115 +153,115 @@ MochiKit.Base.update(MochiKit.Style, { | |||
150 | elem.style['filter'] = | 153 | elem.style['filter'] = |
151 | self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, ''); | 154 | self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, ''); |
152 | } | 155 | } |
153 | } else { | 156 | } else { |
154 | if (o < 0.00001) { | 157 | if (o < 0.00001) { |
155 | o = 0; | 158 | o = 0; |
156 | } | 159 | } |
157 | elem.style["opacity"] = o; | 160 | elem.style["opacity"] = o; |
158 | if (/MSIE/.test(navigator.userAgent)) { | 161 | if (/MSIE/.test(navigator.userAgent)) { |
159 | elem.style['filter'] = | 162 | elem.style['filter'] = |
160 | self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, '') + 'alpha(opacity=' + o * 100 + ')'; | 163 | self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, '') + 'alpha(opacity=' + o * 100 + ')'; |
161 | } | 164 | } |
162 | } | 165 | } |
163 | }, | 166 | }, |
164 | 167 | ||
165 | /* | 168 | /* |
166 | 169 | ||
167 | getElementPosition is adapted from YAHOO.util.Dom.getXY v0.9.0. | 170 | getElementPosition is adapted from YAHOO.util.Dom.getXY v0.9.0. |
168 | Copyright: Copyright (c) 2006, Yahoo! Inc. All rights reserved. | 171 | Copyright: Copyright (c) 2006, Yahoo! Inc. All rights reserved. |
169 | License: BSD, http://developer.yahoo.net/yui/license.txt | 172 | License: BSD, http://developer.yahoo.net/yui/license.txt |
170 | 173 | ||
171 | */ | 174 | */ |
172 | 175 | ||
173 | /** @id MochiKit.Style.getElementPosition */ | 176 | /** @id MochiKit.Style.getElementPosition */ |
174 | getElementPosition: function (elem, /* optional */relativeTo) { | 177 | getElementPosition: function (elem, /* optional */relativeTo) { |
175 | var self = MochiKit.Style; | 178 | var self = MochiKit.Style; |
176 | var dom = MochiKit.DOM; | 179 | var dom = MochiKit.DOM; |
177 | var isCoordinates = function (o) { | 180 | var isCoordinates = function (o) { |
178 | return o != null && | 181 | return o != null && |
179 | o.nodeType == null && | 182 | o.nodeType == null && |
180 | typeof(o.x) == "number" && | 183 | typeof(o.x) == "number" && |
181 | typeof(o.y) == "number"; | 184 | typeof(o.y) == "number"; |
182 | } | 185 | }; |
183 | 186 | ||
184 | if (typeof(elem) == "string") { | 187 | if (typeof(elem) == "string") { |
185 | elem = dom.getElement(elem); | 188 | elem = dom.getElement(elem); |
186 | } | 189 | } |
187 | if (elem == null || | 190 | if (elem == null || |
188 | (!isCoordinates(elem) && self.getStyle(elem, 'display') == 'none')) { | 191 | (!isCoordinates(elem) && self.getStyle(elem, 'display') == 'none')) { |
189 | return undefined; | 192 | return undefined; |
190 | } | 193 | } |
191 | 194 | ||
192 | var c = new self.Coordinates(0, 0); | 195 | var c = new self.Coordinates(0, 0); |
193 | var box = null; | 196 | var box = null; |
194 | var parent = null; | 197 | var parent = null; |
195 | 198 | ||
196 | var d = MochiKit.DOM._document; | 199 | var d = MochiKit.DOM._document; |
197 | var de = d.documentElement; | 200 | var de = d.documentElement; |
198 | var b = d.body; | 201 | var b = d.body; |
199 | 202 | ||
200 | if (!elem.parentNode && elem.x && elem.y) { | 203 | if (isCoordinates(elem)) { |
201 | /* it's just a MochiKit.Style.Coordinates object */ | 204 | /* it's just a MochiKit.Style.Coordinates object */ |
202 | c.x += elem.x || 0; | 205 | c.x += elem.x || 0; |
203 | c.y += elem.y || 0; | 206 | c.y += elem.y || 0; |
204 | } else if (elem.getBoundingClientRect) { // IE shortcut | 207 | } else if (elem.getBoundingClientRect) { // IE shortcut |
205 | /* | 208 | /* |
206 | 209 | ||
207 | The IE shortcut can be off by two. We fix it. See: | 210 | The IE shortcut can be off by two. We fix it. See: |
208 | http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp | 211 | http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp |
209 | 212 | ||
210 | This is similar to the method used in | 213 | This is similar to the method used in |
211 | MochiKit.Signal.Event.mouse(). | 214 | MochiKit.Signal.Event.mouse(). |
212 | 215 | ||
213 | */ | 216 | */ |
214 | box = elem.getBoundingClientRect(); | 217 | box = elem.getBoundingClientRect(); |
215 | 218 | ||
216 | c.x += box.left + | 219 | c.x += box.left + |
217 | (de.scrollLeft || b.scrollLeft) - | 220 | (de.scrollLeft || b.scrollLeft) - |
218 | (de.clientLeft || 0); | 221 | (de.clientLeft || 0); |
219 | 222 | ||
220 | c.y += box.top + | 223 | c.y += box.top + |
221 | (de.scrollTop || b.scrollTop) - | 224 | (de.scrollTop || b.scrollTop) - |
222 | (de.clientTop || 0); | 225 | (de.clientTop || 0); |
223 | 226 | ||
224 | } else if (elem.offsetParent) { | 227 | } else if (elem.offsetParent) { |
225 | c.x += elem.offsetLeft; | 228 | c.x += elem.offsetLeft; |
226 | c.y += elem.offsetTop; | 229 | c.y += elem.offsetTop; |
227 | parent = elem.offsetParent; | 230 | parent = elem.offsetParent; |
228 | 231 | ||
229 | if (parent != elem) { | 232 | if (parent != elem) { |
230 | while (parent) { | 233 | while (parent) { |
231 | c.x += parseInt(parent.style.borderLeftWidth) || 0; | 234 | c.x += parseInt(parent.style.borderLeftWidth, 10) || 0; |
232 | c.y += parseInt(parent.style.borderTopWidth) || 0; | 235 | c.y += parseInt(parent.style.borderTopWidth, 10) || 0; |
233 | c.x += parent.offsetLeft; | 236 | c.x += parent.offsetLeft; |
234 | c.y += parent.offsetTop; | 237 | c.y += parent.offsetTop; |
235 | parent = parent.offsetParent; | 238 | parent = parent.offsetParent; |
236 | } | 239 | } |
237 | } | 240 | } |
238 | 241 | ||
239 | /* | 242 | /* |
240 | 243 | ||
241 | Opera < 9 and old Safari (absolute) incorrectly account for | 244 | Opera < 9 and old Safari (absolute) incorrectly account for |
242 | body offsetTop and offsetLeft. | 245 | body offsetTop and offsetLeft. |
243 | 246 | ||
244 | */ | 247 | */ |
245 | var ua = navigator.userAgent.toLowerCase(); | 248 | var ua = navigator.userAgent.toLowerCase(); |
246 | if ((typeof(opera) != 'undefined' && | 249 | if ((typeof(opera) != 'undefined' && |
247 | parseFloat(opera.version()) < 9) || | 250 | parseFloat(opera.version()) < 9) || |
248 | (ua.indexOf('AppleWebKit') != -1 && | 251 | (ua.indexOf('AppleWebKit') != -1 && |
249 | self.getStyle(elem, 'position') == 'absolute')) { | 252 | self.getStyle(elem, 'position') == 'absolute')) { |
250 | 253 | ||
251 | c.x -= b.offsetLeft; | 254 | c.x -= b.offsetLeft; |
252 | c.y -= b.offsetTop; | 255 | c.y -= b.offsetTop; |
253 | 256 | ||
254 | } | 257 | } |
255 | 258 | ||
256 | // Adjust position for strange Opera scroll bug | 259 | // Adjust position for strange Opera scroll bug |
257 | if (elem.parentNode) { | 260 | if (elem.parentNode) { |
258 | parent = elem.parentNode; | 261 | parent = elem.parentNode; |
259 | } else { | 262 | } else { |
260 | parent = null; | 263 | parent = null; |
261 | } | 264 | } |
262 | while (parent) { | 265 | while (parent) { |
263 | var tagName = parent.tagName.toUpperCase(); | 266 | var tagName = parent.tagName.toUpperCase(); |
264 | if (tagName === 'BODY' || tagName === 'HTML') { | 267 | if (tagName === 'BODY' || tagName === 'HTML') { |
@@ -361,65 +364,65 @@ MochiKit.Base.update(MochiKit.Style, { | |||
361 | getElementDimensions: function (elem, contentSize/*optional*/) { | 364 | getElementDimensions: function (elem, contentSize/*optional*/) { |
362 | var self = MochiKit.Style; | 365 | var self = MochiKit.Style; |
363 | var dom = MochiKit.DOM; | 366 | var dom = MochiKit.DOM; |
364 | if (typeof(elem.w) == 'number' || typeof(elem.h) == 'number') { | 367 | if (typeof(elem.w) == 'number' || typeof(elem.h) == 'number') { |
365 | return new self.Dimensions(elem.w || 0, elem.h || 0); | 368 | return new self.Dimensions(elem.w || 0, elem.h || 0); |
366 | } | 369 | } |
367 | elem = dom.getElement(elem); | 370 | elem = dom.getElement(elem); |
368 | if (!elem) { | 371 | if (!elem) { |
369 | return undefined; | 372 | return undefined; |
370 | } | 373 | } |
371 | var disp = self.getStyle(elem, 'display'); | 374 | var disp = self.getStyle(elem, 'display'); |
372 | // display can be empty/undefined on WebKit/KHTML | 375 | // display can be empty/undefined on WebKit/KHTML |
373 | if (disp == 'none' || disp == '' || typeof(disp) == 'undefined') { | 376 | if (disp == 'none' || disp == '' || typeof(disp) == 'undefined') { |
374 | var s = elem.style; | 377 | var s = elem.style; |
375 | var originalVisibility = s.visibility; | 378 | var originalVisibility = s.visibility; |
376 | var originalPosition = s.position; | 379 | var originalPosition = s.position; |
377 | var originalDisplay = s.display; | 380 | var originalDisplay = s.display; |
378 | s.visibility = 'hidden'; | 381 | s.visibility = 'hidden'; |
379 | s.position = 'absolute'; | 382 | s.position = 'absolute'; |
380 | s.display = self._getDefaultDisplay(elem); | 383 | s.display = self._getDefaultDisplay(elem); |
381 | var originalWidth = elem.offsetWidth; | 384 | var originalWidth = elem.offsetWidth; |
382 | var originalHeight = elem.offsetHeight; | 385 | var originalHeight = elem.offsetHeight; |
383 | s.display = originalDisplay; | 386 | s.display = originalDisplay; |
384 | s.position = originalPosition; | 387 | s.position = originalPosition; |
385 | s.visibility = originalVisibility; | 388 | s.visibility = originalVisibility; |
386 | } else { | 389 | } else { |
387 | originalWidth = elem.offsetWidth || 0; | 390 | originalWidth = elem.offsetWidth || 0; |
388 | originalHeight = elem.offsetHeight || 0; | 391 | originalHeight = elem.offsetHeight || 0; |
389 | } | 392 | } |
390 | if (contentSize) { | 393 | if (contentSize) { |
391 | var tableCell = 'colSpan' in elem && 'rowSpan' in elem; | 394 | var tableCell = 'colSpan' in elem && 'rowSpan' in elem; |
392 | var collapse = (tableCell && elem.parentNode && self.getStyle( | 395 | var collapse = (tableCell && elem.parentNode && self.getStyle( |
393 | elem.parentNode, 'borderCollapse') == 'collapse') | 396 | elem.parentNode, 'borderCollapse') == 'collapse'); |
394 | if (collapse) { | 397 | if (collapse) { |
395 | if (/MSIE/.test(navigator.userAgent)) { | 398 | if (/MSIE/.test(navigator.userAgent)) { |
396 | var borderLeftQuota = elem.previousSibling? 0.5 : 1; | 399 | var borderLeftQuota = elem.previousSibling? 0.5 : 1; |
397 | var borderRightQuota = elem.nextSibling? 0.5 : 1; | 400 | var borderRightQuota = elem.nextSibling? 0.5 : 1; |
398 | } | 401 | } |
399 | else { | 402 | else { |
400 | var borderLeftQuota = 0.5; | 403 | var borderLeftQuota = 0.5; |
401 | var borderRightQuota = 0.5; | 404 | var borderRightQuota = 0.5; |
402 | } | 405 | } |
403 | } else { | 406 | } else { |
404 | var borderLeftQuota = 1; | 407 | var borderLeftQuota = 1; |
405 | var borderRightQuota = 1; | 408 | var borderRightQuota = 1; |
406 | } | 409 | } |
407 | originalWidth -= Math.round( | 410 | originalWidth -= Math.round( |
408 | (parseFloat(self.getStyle(elem, 'paddingLeft')) || 0) | 411 | (parseFloat(self.getStyle(elem, 'paddingLeft')) || 0) |
409 | + (parseFloat(self.getStyle(elem, 'paddingRight')) || 0) | 412 | + (parseFloat(self.getStyle(elem, 'paddingRight')) || 0) |
410 | + borderLeftQuota * | 413 | + borderLeftQuota * |
411 | (parseFloat(self.getStyle(elem, 'borderLeftWidth')) || 0) | 414 | (parseFloat(self.getStyle(elem, 'borderLeftWidth')) || 0) |
412 | + borderRightQuota * | 415 | + borderRightQuota * |
413 | (parseFloat(self.getStyle(elem, 'borderRightWidth')) || 0) | 416 | (parseFloat(self.getStyle(elem, 'borderRightWidth')) || 0) |
414 | ); | 417 | ); |
415 | if (tableCell) { | 418 | if (tableCell) { |
416 | if (/Gecko|Opera/.test(navigator.userAgent) | 419 | if (/Gecko|Opera/.test(navigator.userAgent) |
417 | && !/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)) { | 420 | && !/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)) { |
418 | var borderHeightQuota = 0; | 421 | var borderHeightQuota = 0; |
419 | } else if (/MSIE/.test(navigator.userAgent)) { | 422 | } else if (/MSIE/.test(navigator.userAgent)) { |
420 | var borderHeightQuota = 1; | 423 | var borderHeightQuota = 1; |
421 | } else { | 424 | } else { |
422 | var borderHeightQuota = collapse? 0.5 : 1; | 425 | var borderHeightQuota = collapse? 0.5 : 1; |
423 | } | 426 | } |
424 | } else { | 427 | } else { |
425 | var borderHeightQuota = 1; | 428 | var borderHeightQuota = 1; |
@@ -514,45 +517,45 @@ MochiKit.Base.update(MochiKit.Style, { | |||
514 | 517 | ||
515 | var inlines = ['A','ABBR','ACRONYM','B','BASEFONT','BDO','BIG','BR', | 518 | var inlines = ['A','ABBR','ACRONYM','B','BASEFONT','BDO','BIG','BR', |
516 | 'CITE','CODE','DFN','EM','FONT','I','IMG','KBD','LABEL', | 519 | 'CITE','CODE','DFN','EM','FONT','I','IMG','KBD','LABEL', |
517 | 'Q','S','SAMP','SMALL','SPAN','STRIKE','STRONG','SUB', | 520 | 'Q','S','SAMP','SMALL','SPAN','STRIKE','STRONG','SUB', |
518 | 'SUP','TEXTAREA','TT','U','VAR']; | 521 | 'SUP','TEXTAREA','TT','U','VAR']; |
519 | this._defaultDisplay = { 'TABLE': 'table', | 522 | this._defaultDisplay = { 'TABLE': 'table', |
520 | 'THEAD': 'table-header-group', | 523 | 'THEAD': 'table-header-group', |
521 | 'TBODY': 'table-row-group', | 524 | 'TBODY': 'table-row-group', |
522 | 'TFOOT': 'table-footer-group', | 525 | 'TFOOT': 'table-footer-group', |
523 | 'COLGROUP': 'table-column-group', | 526 | 'COLGROUP': 'table-column-group', |
524 | 'COL': 'table-column', | 527 | 'COL': 'table-column', |
525 | 'TR': 'table-row', | 528 | 'TR': 'table-row', |
526 | 'TD': 'table-cell', | 529 | 'TD': 'table-cell', |
527 | 'TH': 'table-cell', | 530 | 'TH': 'table-cell', |
528 | 'CAPTION': 'table-caption', | 531 | 'CAPTION': 'table-caption', |
529 | 'LI': 'list-item', | 532 | 'LI': 'list-item', |
530 | 'INPUT': 'inline-block', | 533 | 'INPUT': 'inline-block', |
531 | 'SELECT': 'inline-block' }; | 534 | 'SELECT': 'inline-block' }; |
532 | // CSS 'display' support in IE6/7 is just broken... | 535 | // CSS 'display' support in IE6/7 is just broken... |
533 | if (/MSIE/.test(navigator.userAgent)) { | 536 | if (/MSIE/.test(navigator.userAgent)) { |
534 | for (var k in this._defaultDisplay) { | 537 | for (var k in this._defaultDisplay) { |
535 | var v = this._defaultDisplay[k]; | 538 | var v = this._defaultDisplay[k]; |
536 | if (v.indexOf('table') == 0) { | 539 | if (v.indexOf('table') == 0) { |
537 | this._defaultDisplay[k] = 'block'; | 540 | this._defaultDisplay[k] = 'block'; |
538 | } | 541 | } |
539 | } | 542 | } |
540 | } | 543 | } |
541 | for (var i = 0; i < inlines.length; i++) { | 544 | for (var i = 0; i < inlines.length; i++) { |
542 | this._defaultDisplay[inlines[i]] = 'inline'; | 545 | this._defaultDisplay[inlines[i]] = 'inline'; |
543 | } | 546 | } |
544 | 547 | ||
545 | // Backwards compatibility aliases | 548 | // Backwards compatibility aliases |
546 | m._deprecated(this, 'elementPosition', 'MochiKit.Style.getElementPosition', '1.3'); | 549 | m._deprecated(this, 'elementPosition', 'MochiKit.Style.getElementPosition', '1.3', true); |
547 | m._deprecated(this, 'elementDimensions', 'MochiKit.Style.getElementDimensions', '1.3'); | 550 | m._deprecated(this, 'elementDimensions', 'MochiKit.Style.getElementDimensions', '1.3', true); |
548 | 551 | ||
549 | this.hideElement = m.partial(this.setDisplayForElement, 'none'); | 552 | this.hideElement = m.partial(this.setDisplayForElement, 'none'); |
550 | // TODO: showElement could be improved by using getDefaultDisplay. | 553 | // TODO: showElement could be improved by using getDefaultDisplay. |
551 | this.showElement = m.partial(this.setDisplayForElement, 'block'); | 554 | this.showElement = m.partial(this.setDisplayForElement, 'block'); |
552 | 555 | ||
553 | m.nameFunctions(this); | 556 | m.nameFunctions(this); |
554 | } | 557 | } |
555 | }); | 558 | }); |
556 | 559 | ||
557 | MochiKit.Style.__new__(); | 560 | MochiKit.Style.__new__(); |
558 | MochiKit.Base._exportSymbols(this, MochiKit.Style); | 561 | MochiKit.Base._exportSymbols(this, MochiKit.Style); |
diff --git a/frontend/gamma/js/MochiKit/Test.js b/frontend/gamma/js/MochiKit/Test.js index 9520ab2..f29670f 100644 --- a/frontend/gamma/js/MochiKit/Test.js +++ b/frontend/gamma/js/MochiKit/Test.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Test 1.5 | 3 | MochiKit.Test 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito. All rights Reserved. | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Test', '1.5', ['Base']); | 11 | MochiKit.Base.module(MochiKit, 'Test', '1.5', ['Base']); |
12 | 12 | ||
13 | MochiKit.Test.runTests = function (obj) { | 13 | MochiKit.Test.runTests = function (obj) { |
14 | if (typeof(obj) == "string") { | 14 | if (typeof(obj) == "string") { |
15 | // TODO: Remove this temporary API change advertisement | 15 | // TODO: Remove this temporary API change advertisement |
16 | throw new TypeError("Automatic module import not supported, call runTests() with proper object: " + obj); | 16 | throw new TypeError("Automatic module import not supported, call runTests() with proper object: " + obj); |
17 | } | 17 | } |
18 | var suite = new MochiKit.Test.Suite(); | 18 | var suite = new MochiKit.Test.Suite(); |
19 | suite.run(obj); | 19 | suite.run(obj); |
20 | }; | 20 | }; |
21 | 21 | ||
22 | MochiKit.Test.Suite = function () { | 22 | MochiKit.Test.Suite = function () { |
23 | this.testIndex = 0; | 23 | this.testIndex = 0; |
24 | MochiKit.Base.bindMethods(this); | 24 | MochiKit.Base.bindMethods(this); |
25 | }; | 25 | }; |
26 | 26 | ||
27 | MochiKit.Test.Suite.prototype = { | 27 | MochiKit.Test.Suite.prototype = { |
28 | run: function (obj) { | 28 | run: function (obj) { |
29 | try { | 29 | try { |
30 | obj(this); | 30 | obj(this); |
31 | } catch (e) { | 31 | } catch (e) { |
32 | this.traceback(e); | 32 | this.traceback(e); |
33 | } | 33 | } |
34 | }, | 34 | }, |
35 | traceback: function (e) { | 35 | traceback: function (e) { |
36 | var items = MochiKit.Iter.sorted(MochiKit.Base.items(e)); | 36 | var items = MochiKit.Iter.sorted(MochiKit.Base.items(e)); |
37 | print("not ok " + this.testIndex + " - Error thrown"); | 37 | print("not ok " + this.testIndex + " - Error thrown"); |
38 | for (var i = 0; i < items.length; i++) { | 38 | for (var i = 0; i < items.length; i++) { |
39 | var kv = items[i]; | 39 | var kv = items[i]; |
40 | if (kv[0] == "stack") { | 40 | if (kv[0] == "stack") { |
41 | kv[1] = kv[1].split(/\n/)[0]; | 41 | kv[1] = kv[1].split(/\n/)[0]; |
42 | } | 42 | } |
43 | this.print("# " + kv.join(": ")); | 43 | this.print("# " + kv.join(": ")); |
diff --git a/frontend/gamma/js/MochiKit/Text.js b/frontend/gamma/js/MochiKit/Text.js index a44f7e4..ff6366d 100644 --- a/frontend/gamma/js/MochiKit/Text.js +++ b/frontend/gamma/js/MochiKit/Text.js | |||
@@ -1,577 +1,546 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Text 1.5 | 3 | MochiKit.Text 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2008 Per Cederberg. All rights Reserved. | 7 | (c) 2008 Per Cederberg. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Text', '1.5', ['Base', 'Format']); | 11 | MochiKit.Base.module(MochiKit, 'Text', '1.5', ['Base', 'Format']); |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Checks if a text string starts with the specified substring. If | 14 | * Checks if a text string starts with the specified substring. If |
15 | * either of the two strings is null, false will be returned. | 15 | * either of the two strings is null, false will be returned. |
16 | * | 16 | * |
17 | * @param {String} substr the substring to search for | 17 | * @param {String} substr the substring to search for |
18 | * @param {String} str the string to search in | 18 | * @param {String} str the string to search in |
19 | * | 19 | * |
20 | * @return {Boolean} true if the string starts with the substring, or | 20 | * @return {Boolean} true if the string starts with the substring, or |
21 | * false otherwise | 21 | * false otherwise |
22 | */ | 22 | */ |
23 | MochiKit.Text.startsWith = function (substr, str) { | 23 | MochiKit.Text.startsWith = function (substr, str) { |
24 | return str != null && substr != null && str.indexOf(substr) == 0; | 24 | return str != null && substr != null && str.indexOf(substr) == 0; |
25 | } | 25 | }; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Checks if a text string ends with the specified substring. If | 28 | * Checks if a text string ends with the specified substring. If |
29 | * either of the two strings is null, false will be returned. | 29 | * either of the two strings is null, false will be returned. |
30 | * | 30 | * |
31 | * @param {String} substr the substring to search for | 31 | * @param {String} substr the substring to search for |
32 | * @param {String} str the string to search in | 32 | * @param {String} str the string to search in |
33 | * | 33 | * |
34 | * @return {Boolean} true if the string ends with the substring, or | 34 | * @return {Boolean} true if the string ends with the substring, or |
35 | * false otherwise | 35 | * false otherwise |
36 | */ | 36 | */ |
37 | MochiKit.Text.endsWith = function (substr, str) { | 37 | MochiKit.Text.endsWith = function (substr, str) { |
38 | return str != null && substr != null && | 38 | return str != null && substr != null && |
39 | str.lastIndexOf(substr) == Math.max(str.length - substr.length, 0); | 39 | str.lastIndexOf(substr) == Math.max(str.length - substr.length, 0); |
40 | } | 40 | }; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Checks if a text string contains the specified substring. If | 43 | * Checks if a text string contains the specified substring. If |
44 | * either of the two strings is null, false will be returned. | 44 | * either of the two strings is null, false will be returned. |
45 | * | 45 | * |
46 | * @param {String} substr the substring to search for | 46 | * @param {String} substr the substring to search for |
47 | * @param {String} str the string to search in | 47 | * @param {String} str the string to search in |
48 | * | 48 | * |
49 | * @return {Boolean} true if the string contains the substring, or | 49 | * @return {Boolean} true if the string contains the substring, or |
50 | * false otherwise | 50 | * false otherwise |
51 | */ | 51 | */ |
52 | MochiKit.Text.contains = function (substr, str) { | 52 | MochiKit.Text.contains = function (substr, str) { |
53 | return str != null && substr != null && str.indexOf(substr) >= 0; | 53 | return str != null && substr != null && str.indexOf(substr) >= 0; |
54 | } | 54 | }; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Adds a character to the left-hand side of a string until it | 57 | * Adds a character to the left-hand side of a string until it |
58 | * reaches the specified minimum length. | 58 | * reaches the specified minimum length. |
59 | * | 59 | * |
60 | * @param {String} str the string to process | 60 | * @param {String} str the string to process |
61 | * @param {Number} minLength the requested minimum length | 61 | * @param {Number} minLength the requested minimum length |
62 | * @param {String} fillChar the padding character to add, defaults | 62 | * @param {String} fillChar the padding character to add, defaults |
63 | * to a space | 63 | * to a space |
64 | * | 64 | * |
65 | * @return {String} the padded string | 65 | * @return {String} the padded string |
66 | */ | 66 | */ |
67 | MochiKit.Text.padLeft = function (str, minLength, fillChar) { | 67 | MochiKit.Text.padLeft = function (str, minLength, fillChar) { |
68 | str = str || ""; | 68 | str = str || ""; |
69 | fillChar = fillChar || " "; | 69 | fillChar = fillChar || " "; |
70 | while (str.length < minLength) { | 70 | while (str.length < minLength) { |
71 | str = fillChar + str; | 71 | str = fillChar + str; |
72 | } | 72 | } |
73 | return str; | 73 | return str; |
74 | } | 74 | }; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Adds a character to the right-hand side of a string until it | 77 | * Adds a character to the right-hand side of a string until it |
78 | * reaches the specified minimum length. | 78 | * reaches the specified minimum length. |
79 | * | 79 | * |
80 | * @param {String} str the string to process | 80 | * @param {String} str the string to process |
81 | * @param {Number} minLength the requested minimum length | 81 | * @param {Number} minLength the requested minimum length |
82 | * @param {String} fillChar the padding character to add, defaults | 82 | * @param {String} fillChar the padding character to add, defaults |
83 | * to a space | 83 | * to a space |
84 | * | 84 | * |
85 | * @return {String} the padded string | 85 | * @return {String} the padded string |
86 | */ | 86 | */ |
87 | MochiKit.Text.padRight = function (str, minLength, fillChar) { | 87 | MochiKit.Text.padRight = function (str, minLength, fillChar) { |
88 | str = str || ""; | 88 | str = str || ""; |
89 | fillChar = fillChar || " "; | 89 | fillChar = fillChar || " "; |
90 | while (str.length < minLength) { | 90 | while (str.length < minLength) { |
91 | str += fillChar; | 91 | str += fillChar; |
92 | } | 92 | } |
93 | return str; | 93 | return str; |
94 | } | 94 | }; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Returns a truncated copy of a string. If the string is shorter | 97 | * Returns a truncated copy of a string. If the string is shorter |
98 | * than the specified maximum length, the object will be returned | 98 | * than the specified maximum length, the object will be returned |
99 | * unmodified. If an optional tail string is specified, additional | 99 | * unmodified. If an optional tail string is specified, additional |
100 | * elements will be removed in order to accomodate the tail (that | 100 | * elements will be removed in order to accomodate the tail (that |
101 | * will be appended). This function also works on arrays. | 101 | * will be appended). This function also works on arrays. |
102 | * | 102 | * |
103 | * @param {String} str the string to truncate | 103 | * @param {String} str the string to truncate |
104 | * @param {Number} maxLength the maximum length | 104 | * @param {Number} maxLength the maximum length |
105 | * @param {String} [tail] the tail to append on truncation | 105 | * @param {String} [tail] the tail to append on truncation |
106 | * | 106 | * |
107 | * @return {String} the truncated string | 107 | * @return {String} the truncated string |
108 | */ | 108 | */ |
109 | MochiKit.Text.truncate = function (str, maxLength, tail) { | 109 | MochiKit.Text.truncate = function (str, maxLength, tail) { |
110 | if (str == null || str.length <= maxLength || maxLength < 0) { | 110 | if (str == null || str.length <= maxLength || maxLength < 0) { |
111 | return str; | 111 | return str; |
112 | } else if (tail != null) { | 112 | } else if (tail != null) { |
113 | str = str.slice(0, Math.max(0, maxLength - tail.length)); | 113 | str = str.slice(0, Math.max(0, maxLength - tail.length)); |
114 | if (typeof(str) == "string") { | 114 | if (typeof(str) == "string") { |
115 | return str + tail; | 115 | return str + tail; |
116 | } else { | 116 | } else { |
117 | return MochiKit.Base.extend(str, tail); | 117 | return MochiKit.Base.extend(str, tail); |
118 | } | 118 | } |
119 | } else { | 119 | } else { |
120 | return str.slice(0, maxLength); | 120 | return str.slice(0, maxLength); |
121 | } | 121 | } |
122 | } | 122 | }; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Splits a text string, applies a function and joins the results | 125 | * Splits a text string using separator as the split point |
126 | * back together again. This is a convenience function for calling | 126 | * If max is given, at most max splits are done, giving at most |
127 | * split(), map() and join() separately. It can be used to easily | 127 | * max + 1 elements in the returned list. |
128 | * trim each line in a text string (using the strip function), or to | ||
129 | * translate a text word-by-word. | ||
130 | * | 128 | * |
131 | * @param {Function} func the function to apply | ||
132 | * @param {String} str the string to split | 129 | * @param {String} str the string to split |
133 | * @param {String} [separator] the separator character to use, | 130 | * @param {String/RegExp} [separator] the separator char or regexp to use, |
134 | * defaults to newline | 131 | * defaults to newline |
132 | * @param {Number} [max] the maximum number of parts to return | ||
133 | * @return {Array} an array of parts of the string | ||
134 | */ | ||
135 | MochiKit.Text.split = function (str, separator, max) { | ||
136 | if (str == null) { | ||
137 | return str; | ||
138 | } | ||
139 | separator = separator || '\n'; | ||
140 | var bits = str.split(separator); | ||
141 | if ((typeof(max) == "undefined") || max >= bits.length - 1) { | ||
142 | return bits; | ||
143 | } | ||
144 | bits.splice(max, bits.length, bits.slice(max, bits.length).join(separator)); | ||
145 | return bits; | ||
146 | }; | ||
147 | |||
148 | /** | ||
149 | * Splits a text string using separator as the split point | ||
150 | * If max is given, at most max splits are done, | ||
151 | * using splits from the right | ||
135 | * | 152 | * |
136 | * @return {String} a string with the joined up results | 153 | * @param {String} str the string to split |
154 | * @param {String/RegExp} [separator] the separator char or regexp to use, | ||
155 | * defaults to newline | ||
156 | * @param {Number} [max] the maximum number of parts to return | ||
157 | * @return {Array} an array of parts of the string | ||
137 | */ | 158 | */ |
138 | MochiKit.Text.splitJoin = function (func, str, separator) { | 159 | MochiKit.Text.rsplit = function (str, separator, max) { |
139 | if (str == null || str.length == 0) { | 160 | if (str == null) { |
140 | return str; | 161 | return str; |
141 | } | 162 | } |
142 | separator = separator || '\n' | 163 | separator = separator || '\n'; |
143 | return MochiKit.Base.map(func, str.split(separator)).join(separator); | 164 | var bits = str.split(separator); |
144 | } | 165 | if ((typeof(max) == "undefined") || max >= bits.length - 1){ |
166 | return bits; | ||
167 | } | ||
168 | bits.splice(0, bits.length-max, bits.slice(0, bits.length-max).join(separator)); | ||
169 | return bits; | ||
170 | }; | ||
145 | 171 | ||
146 | /** | 172 | /** |
147 | * Creates a formatter function for the specified formatter pattern | 173 | * Creates a formatter function for the specified formatter pattern |
148 | * and locale. The returned function takes as many arguments as the | 174 | * and locale. The returned function takes as many arguments as the |
149 | * formatter pattern requires. See separate documentation for | 175 | * formatter pattern requires. See separate documentation for |
150 | * information about the formatter pattern syntax. | 176 | * information about the formatter pattern syntax. |
151 | * | 177 | * |
152 | * @param {String} pattern the formatter pattern string | 178 | * @param {String} pattern the formatter pattern string |
153 | * @param {Object} [locale] the locale to use, defaults to | 179 | * @param {Object} [locale] the locale to use, defaults to |
154 | * LOCALE.en_US | 180 | * LOCALE.en_US |
155 | * | 181 | * |
156 | * @return {Function} the formatter function created | 182 | * @return {Function} the formatter function created |
157 | * | 183 | * |
158 | * @throws FormatPatternError if the format pattern was invalid | 184 | * @throws FormatPatternError if the format pattern was invalid |
159 | */ | 185 | */ |
160 | MochiKit.Text.formatter = function (pattern, locale) { | 186 | MochiKit.Text.formatter = function (pattern, locale) { |
161 | if (typeof(locale) == "undefined") { | 187 | if (locale == null) { |
162 | locale = MochiKit.Format.formatLocale(); | 188 | locale = MochiKit.Format.formatLocale(); |
163 | } else if (typeof(locale) == "string") { | 189 | } else if (typeof(locale) == "string") { |
164 | locale = MochiKit.Format.formatLocale(locale); | 190 | locale = MochiKit.Format.formatLocale(locale); |
165 | } | 191 | } |
166 | var parts = MochiKit.Text._parsePattern(pattern); | 192 | var parts = MochiKit.Text._parsePattern(pattern); |
167 | return function() { | 193 | return function() { |
168 | var values = MochiKit.Base.extend([], arguments); | 194 | var values = MochiKit.Base.extend([], arguments); |
169 | var res = []; | 195 | var res = []; |
170 | for (var i = 0; i < parts.length; i++) { | 196 | for (var i = 0; i < parts.length; i++) { |
171 | if (typeof(parts[i]) == "string") { | 197 | if (typeof(parts[i]) == "string") { |
172 | res.push(parts[i]); | 198 | res.push(parts[i]); |
173 | } else { | 199 | } else { |
174 | res.push(MochiKit.Text.formatValue(parts[i], values, locale)); | 200 | res.push(MochiKit.Text.formatValue(parts[i], values, locale)); |
175 | } | 201 | } |
176 | } | 202 | } |
177 | return res.join(""); | 203 | return res.join(""); |
178 | } | 204 | }; |
179 | } | 205 | }; |
180 | 206 | ||
181 | /** | 207 | /** |
182 | * Formats the specified arguments according to a formatter pattern. | 208 | * Formats the specified arguments according to a formatter pattern. |
183 | * See separate documentation for information about the formatter | 209 | * See separate documentation for information about the formatter |
184 | * pattern syntax. | 210 | * pattern syntax. |
185 | * | 211 | * |
186 | * @param {String} pattern the formatter pattern string | 212 | * @param {String} pattern the formatter pattern string |
187 | * @param {Object} [...] the optional values to format | 213 | * @param {Object} [...] the optional values to format |
188 | * | 214 | * |
189 | * @return {String} the formatted output string | 215 | * @return {String} the formatted output string |
190 | * | 216 | * |
191 | * @throws FormatPatternError if the format pattern was invalid | 217 | * @throws FormatPatternError if the format pattern was invalid |
192 | */ | 218 | */ |
193 | MochiKit.Text.format = function (pattern/*, ...*/) { | 219 | MochiKit.Text.format = function (pattern/*, ...*/) { |
194 | var func = MochiKit.Text.formatter(pattern); | 220 | var func = MochiKit.Text.formatter(pattern); |
195 | return func.apply(this, MochiKit.Base.extend([], arguments, 1)); | 221 | return func.apply(this, MochiKit.Base.extend([], arguments, 1)); |
196 | } | 222 | }; |
197 | 223 | ||
198 | /** | 224 | /** |
199 | * Format a value with the specified format specifier. | 225 | * Format a value with the specified format specifier. |
200 | * | 226 | * |
201 | * @param {String/Object} spec the format specifier string or parsed | 227 | * @param {String/Object} spec the format specifier string or parsed |
202 | * format specifier object | 228 | * format specifier object |
203 | * @param {Object} value the value to format | 229 | * @param {Object} value the value to format |
204 | * @param {Object} [locale] the locale to use, defaults to | 230 | * @param {Object} [locale] the locale to use, defaults to |
205 | * LOCALE.en_US | 231 | * LOCALE.en_US |
206 | * | 232 | * |
207 | * @return {String} the formatted output string | 233 | * @return {String} the formatted output string |
234 | * | ||
235 | * @throws FormatPatternError if the format specifier was invalid | ||
208 | */ | 236 | */ |
209 | MochiKit.Text.formatValue = function (spec, value, locale) { | 237 | MochiKit.Text.formatValue = function (spec, value, locale) { |
210 | var self = MochiKit.Text; | 238 | var self = MochiKit.Text; |
211 | if (typeof(spec) === "string") { | 239 | if (typeof(spec) === "string") { |
212 | spec = self._parseFormatFlags(spec, 0, spec.length - 1); | 240 | spec = self._parseFormatFlags(spec, 0, spec.length); |
213 | } | 241 | } |
214 | for (var i = 0; spec.path != null && i < spec.path.length; i++) { | 242 | for (var i = 0; spec.path != null && i < spec.path.length; i++) { |
215 | if (value != null) { | 243 | if (value != null) { |
216 | value = value[spec.path[i]]; | 244 | value = value[spec.path[i]]; |
217 | } | 245 | } |
218 | } | 246 | } |
219 | if (typeof(locale) == "undefined") { | 247 | if (locale == null) { |
220 | locale = MochiKit.Format.formatLocale(); | 248 | locale = MochiKit.Format.formatLocale(); |
221 | } else if (typeof(locale) == "string") { | 249 | } else if (typeof(locale) == "string") { |
222 | locale = MochiKit.Format.formatLocale(locale); | 250 | locale = MochiKit.Format.formatLocale(locale); |
223 | } | 251 | } |
224 | var str = ""; | 252 | var str = ""; |
225 | if (spec.numeric) { | 253 | if (spec.type == "number") { |
254 | if (value instanceof Number) { | ||
255 | value = value.valueOf(); | ||
256 | } | ||
226 | if (typeof(value) != "number" || isNaN(value)) { | 257 | if (typeof(value) != "number" || isNaN(value)) { |
227 | str = ""; | 258 | str = ""; |
228 | } else if (value === Number.POSITIVE_INFINITY) { | 259 | } else if (value === Number.POSITIVE_INFINITY) { |
229 | str = "\u221e"; | 260 | str = "\u221e"; |
230 | } else if (value === Number.NEGATIVE_INFINITY) { | 261 | } else if (value === Number.NEGATIVE_INFINITY) { |
231 | str = "-\u221e"; | 262 | str = "-\u221e"; |
232 | } else { | 263 | } else { |
233 | var sign = (spec.sign === "-") ? "" : spec.sign; | 264 | var sign = (value < 0) ? "-" : spec.sign; |
234 | sign = (value < 0) ? "-" : sign; | ||
235 | value = Math.abs(value); | 265 | value = Math.abs(value); |
236 | if (spec.format === "%") { | 266 | if (spec.format === "%") { |
237 | str = self._truncToPercent(value, spec.precision); | 267 | str = self._truncToPercent(value, spec.precision); |
238 | } else if (spec.format === "d") { | 268 | } else if (spec.format === "d") { |
239 | str = MochiKit.Format.roundToFixed(value, 0); | 269 | str = MochiKit.Format.roundToFixed(value, 0); |
240 | } else if (spec.radix != 10) { | 270 | } else if (spec.radix != 10) { |
241 | str = Math.floor(value).toString(spec.radix); | 271 | str = Math.floor(value).toString(spec.radix); |
242 | if (spec.format === "x") { | 272 | if (spec.format === "x") { |
243 | str = str.toLowerCase(); | 273 | str = str.toLowerCase(); |
244 | } else if (spec.format === "X") { | 274 | } else if (spec.format === "X") { |
245 | str = str.toUpperCase(); | 275 | str = str.toUpperCase(); |
246 | } | 276 | } |
247 | } else if (spec.precision >= 0) { | 277 | } else if (spec.precision >= 0) { |
248 | str = MochiKit.Format.roundToFixed(value, spec.precision); | 278 | str = MochiKit.Format.roundToFixed(value, spec.precision); |
249 | } else { | 279 | } else { |
250 | str = value.toString(); | 280 | str = value.toString(); |
251 | } | 281 | } |
252 | if (spec.padding === "0" && spec.format === "%") { | 282 | if (spec.padding === "0" && spec.format === "%") { |
253 | str = self.padLeft(str, spec.width - sign.length - 1, "0"); | 283 | str = self.padLeft(str, spec.width - sign.length - 1, "0"); |
254 | } else if (spec.padding == "0") { | 284 | } else if (spec.padding == "0") { |
255 | str = self.padLeft(str, spec.width - sign.length, "0"); | 285 | str = self.padLeft(str, spec.width - sign.length, "0"); |
256 | } | 286 | } |
257 | str = self._localizeNumber(str, locale, spec.grouping); | 287 | str = self._localizeNumber(str, locale, spec.group); |
258 | str = sign + str; | 288 | str = sign + str; |
259 | } | 289 | } |
260 | if (str !== "" && spec.format === "%") { | 290 | if (str !== "" && spec.format === "%") { |
261 | str = str + locale.percent; | 291 | str = str + locale.percent; |
262 | } | 292 | } |
263 | } else { | 293 | } else { |
264 | if (spec.format == "r") { | 294 | if (spec.format == "r") { |
265 | str = MochiKit.Base.repr(value); | 295 | str = MochiKit.Base.repr(value); |
266 | } else { | 296 | } else { |
267 | str = (value == null) ? "null" : value.toString(); | 297 | str = (value == null) ? "" : value.toString(); |
268 | } | 298 | } |
269 | str = self.truncate(str, spec.precision); | 299 | str = self.truncate(str, spec.precision); |
270 | } | 300 | } |
271 | if (spec.align == "<") { | 301 | if (spec.align == "<") { |
272 | str = self.padRight(str, spec.width); | 302 | str = self.padRight(str, spec.width); |
273 | } else { | 303 | } else { |
274 | str = self.padLeft(str, spec.width); | 304 | str = self.padLeft(str, spec.width); |
275 | } | 305 | } |
276 | return str; | 306 | return str; |
277 | } | 307 | }; |
278 | 308 | ||
279 | /** | 309 | /** |
280 | * Adjust an already formatted numeric string for locale-specific | 310 | * Adjust an already formatted numeric string for locale-specific |
281 | * grouping and decimal separators. The grouping is optional and | 311 | * grouping and decimal separators. The grouping is optional and |
282 | * will attempt to keep the number string length intact by removing | 312 | * will attempt to keep the number string length intact by removing |
283 | * padded zeros (if possible). | 313 | * padded zeros (if possible). |
284 | * | 314 | * |
285 | * @param {String} num the formatted number string | 315 | * @param {String} num the formatted number string |
286 | * @param {Object} locale the formatting locale to use | 316 | * @param {Object} locale the formatting locale to use |
287 | * @param {Boolean} grouping the grouping flag | 317 | * @param {Boolean} group the grouping flag |
288 | * | 318 | * |
289 | * @return {String} the localized number string | 319 | * @return {String} the localized number string |
290 | */ | 320 | */ |
291 | MochiKit.Text._localizeNumber = function (num, locale, grouping) { | 321 | MochiKit.Text._localizeNumber = function (num, locale, group) { |
292 | var parts = num.split(/\./); | 322 | var parts = num.split(/\./); |
293 | var whole = parts[0]; | 323 | var whole = parts[0]; |
294 | var frac = (parts.length == 1) ? "" : parts[1]; | 324 | var frac = (parts.length == 1) ? "" : parts[1]; |
295 | var res = (frac.length > 0) ? locale.decimal : ""; | 325 | var res = (frac.length > 0) ? locale.decimal : ""; |
296 | while (grouping && frac.length > 3) { | 326 | while (group && frac.length > 3) { |
297 | res = res + frac.substring(0, 3) + locale.separator; | 327 | res = res + frac.substring(0, 3) + locale.separator; |
298 | frac = frac.substring(3); | 328 | frac = frac.substring(3); |
299 | if (whole.charAt(0) == "0") { | 329 | if (whole.charAt(0) == "0") { |
300 | whole = whole.substring(1); | 330 | whole = whole.substring(1); |
301 | } | 331 | } |
302 | } | 332 | } |
303 | if (frac.length > 0) { | 333 | if (frac.length > 0) { |
304 | res += frac; | 334 | res = res + frac; |
305 | } | 335 | } |
306 | while (grouping && whole.length > 3) { | 336 | while (group && whole.length > 3) { |
307 | var pos = whole.length - 3; | 337 | var pos = whole.length - 3; |
308 | res = locale.separator + whole.substring(pos) + res; | 338 | res = locale.separator + whole.substring(pos) + res; |
309 | whole = whole.substring((whole.charAt(0) == "0") ? 1 : 0, pos); | 339 | whole = whole.substring((whole.charAt(0) == "0") ? 1 : 0, pos); |
310 | } | 340 | } |
311 | return whole + res; | 341 | return whole + res; |
312 | } | 342 | }; |
313 | 343 | ||
314 | /** | 344 | /** |
315 | * Parses a format pattern and returns an array of constant strings | 345 | * Parses a format pattern and returns an array of constant strings |
316 | * and format info objects. | 346 | * and format info objects. |
317 | * | 347 | * |
318 | * @param {String} pattern the format pattern to analyze | 348 | * @param {String} pattern the format pattern to analyze |
319 | * | 349 | * |
320 | * @return {Array} an array of strings and format info objects | 350 | * @return {Array} an array of strings and format info objects |
321 | * | 351 | * |
322 | * @throws FormatPatternError if the format pattern was invalid | 352 | * @throws FormatPatternError if the format pattern was invalid |
323 | */ | 353 | */ |
324 | MochiKit.Text._parsePattern = function (pattern) { | 354 | MochiKit.Text._parsePattern = function (pattern) { |
325 | var self = MochiKit.Text; | 355 | var self = MochiKit.Text; |
326 | var parts = []; | 356 | var parts = []; |
327 | var start = 0; | 357 | var re = /{[^{}]*}|{{?|}}?/g; |
328 | var pos = 0; | 358 | var lastPos = re.lastIndex = 0; |
329 | for (pos = 0; pos < pattern.length; pos++) { | 359 | var m; |
330 | if (pattern.charAt(pos) == "{") { | 360 | while ((m = re.exec(pattern)) != null) { |
331 | if (pos + 1 >= pattern.length) { | 361 | if (lastPos < m.index) { |
332 | var msg = "unescaped { char, should be escaped as {{"; | 362 | parts.push(pattern.substring(lastPos, m.index)) |
333 | throw new self.FormatPatternError(pattern, pos, msg); | 363 | } |
334 | } else if (pattern.charAt(pos + 1) == "{") { | 364 | var str = m[0]; |
335 | parts.push(pattern.substring(start, pos + 1)); | 365 | lastPos = m.index + str.length; |
336 | start = pos + 2; | 366 | if (self.startsWith("{", str) && self.endsWith("}", str)) { |
337 | pos++; | 367 | parts.push(self._parseFormat(pattern, m.index + 1, lastPos - 1)); |
338 | } else { | 368 | } else if (self.startsWith("{{", str) || self.startsWith("}}", str)) { |
339 | if (start < pos) { | 369 | parts.push(str.substring(1)); |
340 | parts.push(pattern.substring(start, pos)); | 370 | } else if (self.startsWith("{", str)) { |
341 | } | 371 | var msg = "unescaped { char, should be escaped as {{"; |
342 | start = pattern.indexOf("}", pos) + 1; | 372 | throw new self.FormatPatternError(pattern, m.index, msg); |
343 | if (start <= 0) { | 373 | } else if (self.startsWith("}", str)) { |
344 | var msg = "unmatched { char, not followed by a } char"; | 374 | var msg = "unescaped } char, should be escaped as }}"; |
345 | throw new self.FormatPatternError(pattern, pos, msg); | 375 | throw new self.FormatPatternError(pattern, m.index, msg); |
346 | } | ||
347 | parts.push(self._parseFormat(pattern, pos + 1, start - 1)); | ||
348 | pos = start - 1; | ||
349 | } | ||
350 | } else if (pattern.charAt(pos) == "}") { | ||
351 | if (pos + 1 >= pattern.length || pattern.charAt(pos + 1) != "}") { | ||
352 | var msg = "unescaped } char, should be escaped as }}"; | ||
353 | throw new self.FormatPatternError(pattern, pos, msg); | ||
354 | } | ||
355 | parts.push(pattern.substring(start, pos + 1)); | ||
356 | start = pos + 2; | ||
357 | pos++; | ||
358 | } | 376 | } |
359 | } | 377 | } |
360 | if (start < pos) { | 378 | if (lastPos < pattern.length) { |
361 | parts.push(pattern.substring(start, pos)); | 379 | parts.push(pattern.substring(lastPos)); |
362 | } | 380 | } |
363 | return parts; | 381 | return parts; |
364 | } | 382 | }; |
365 | 383 | ||
366 | /** | 384 | /** |
367 | * Parses a format instruction and returns a format info object. | 385 | * Parses a format instruction and returns a format info object. |
368 | * | 386 | * |
369 | * @param {String} pattern the format pattern string | 387 | * @param {String} pattern the format pattern string |
370 | * @param {Number} startPos the first index of the format instruction | 388 | * @param {Number} startPos the first index of the format instruction |
371 | * @param {Number} endPos the last index of the format instruction | 389 | * @param {Number} endPos the last index of the format instruction |
372 | * | 390 | * |
373 | * @return {Object} the format info object | 391 | * @return {Object} the format info object |
374 | * | 392 | * |
375 | * @throws FormatPatternError if the format pattern was invalid | 393 | * @throws FormatPatternError if the format pattern was invalid |
376 | */ | 394 | */ |
377 | MochiKit.Text._parseFormat = function (pattern, startPos, endPos) { | 395 | MochiKit.Text._parseFormat = function (pattern, startPos, endPos) { |
378 | var self = MochiKit.Text; | 396 | var self = MochiKit.Text; |
379 | var text = pattern.substring(startPos, endPos); | 397 | var text = pattern.substring(startPos, endPos); |
380 | var info; | 398 | var parts = self.split(text, ":", 1); |
381 | var pos = text.indexOf(":"); | 399 | var path = parts[0]; |
382 | if (pos == 0) { | 400 | var flagsPos = startPos + path.length + ((parts.length == 1) ? 0 : 1); |
383 | info = self._parseFormatFlags(pattern, startPos + 1, endPos); | 401 | var info = self._parseFormatFlags(pattern, flagsPos, endPos); |
384 | info.path = [0]; | 402 | info.path = (path == "") ? [] : path.split("."); |
385 | } else if (pos > 0) { | ||
386 | info = self._parseFormatFlags(pattern, startPos + pos + 1, endPos); | ||
387 | info.path = text.substring(0, pos).split("."); | ||
388 | } else { | ||
389 | info = self._parseFormatFlags(pattern, endPos, endPos); | ||
390 | info.path = text.split("."); | ||
391 | } | ||
392 | var DIGITS = /^\d+$/; | ||
393 | for (var i = 0; i < info.path.length; i++) { | 403 | for (var i = 0; i < info.path.length; i++) { |
394 | var e = info.path[i]; | 404 | var v = info.path[i]; |
395 | if (typeof(e) == "string") { | 405 | // TODO: replace with MochiKit.Format.strip? |
396 | // TODO: replace with MochiKit.Format.strip? | 406 | v = v.replace(/^\s+/, "").replace(/\s+$/, ""); |
397 | e = e.replace(/^\s+/, "").replace(/\s+$/, ""); | 407 | if (v == "" && info.path.length == 1) { |
398 | if (e == "" && info.path.length == 1) { | 408 | v = 0; |
399 | e = 0; | 409 | } else if (v == "") { |
400 | } else if (e == "") { | 410 | var msg = "format value path contains blanks"; |
401 | var msg = "format value path contains blanks"; | 411 | throw new self.FormatPatternError(pattern, startPos, msg); |
402 | throw new self.FormatPatternError(pattern, startPos, msg); | 412 | } else if (/^\d+$/.test(v)) { |
403 | } else if (DIGITS.test(e)) { | 413 | v = parseInt(v, 10); |
404 | e = parseInt(e); | ||
405 | } | ||
406 | } | 414 | } |
407 | info.path[i] = e; | 415 | info.path[i] = v; |
408 | } | 416 | } |
409 | if (info.path.length < 0 || typeof(info.path[0]) != "number") { | 417 | if (info.path.length <= 0 || typeof(info.path[0]) != "number") { |
410 | info.path.unshift(0); | 418 | info.path.unshift(0); |
411 | } | 419 | } |
412 | return info; | 420 | return info; |
413 | } | 421 | }; |
414 | 422 | ||
415 | /** | 423 | /** |
416 | * Parses a string with format flags and returns a format info object. | 424 | * Parses a string with format flags and returns a format info object. |
417 | * | 425 | * |
418 | * @param {String} pattern the format pattern string | 426 | * @param {String} pattern the format pattern string |
419 | * @param {Number} startPos the first index of the format instruction | 427 | * @param {Number} startPos the first index of the format instruction |
420 | * @param {Number} endPos the last index of the format instruction | 428 | * @param {Number} endPos the last index of the format instruction |
421 | * | 429 | * |
422 | * @return {Object} the format info object | 430 | * @return {Object} the format info object |
423 | * | 431 | * |
424 | * @throws FormatPatternError if the format pattern was invalid | 432 | * @throws FormatPatternError if the format pattern was invalid |
425 | */ | 433 | */ |
426 | MochiKit.Text._parseFormatFlags = function (pattern, startPos, endPos) { | 434 | MochiKit.Text._parseFormatFlags = function (pattern, startPos, endPos) { |
427 | var self = MochiKit.Text; | 435 | var update = MochiKit.Base.update; |
428 | var info = { numeric: false, format: "s", width: 0, precision: -1, | 436 | var info = { type: "string", format: "s", width: 0, precision: -1, |
429 | align: ">", sign: "-", padding: " ", grouping: false }; | 437 | align: ">", sign: "", padding: " ", group: false }; |
430 | // TODO: replace with MochiKit.Format.rstrip? | 438 | // TODO: replace with MochiKit.Format.rstrip? |
431 | var flags = pattern.substring(startPos, endPos).replace(/\s+$/, ""); | 439 | var text = pattern.substring(startPos, endPos).replace(/\s+$/, ""); |
432 | while (flags.length > 0) { | 440 | var m = /^([<>+ 0,-]+)?(\d+)?(\.\d*)?([srbdoxXf%])?(.*)$/.exec(text); |
433 | switch (flags.charAt(0)) { | 441 | var flags = m[1]; |
434 | case ">": | 442 | var width = m[2]; |
435 | case "<": | 443 | var precision = m[3]; |
436 | info.align = flags.charAt(0); | 444 | var type = m[4]; |
437 | flags = flags.substring(1); | 445 | var unmatched = m[5]; |
438 | break; | 446 | for (var i = 0; flags && i < flags.length; i++) { |
439 | case "+": | 447 | var chr = flags.charAt(i); |
440 | case "-": | 448 | if (chr == "<" || chr == ">") { |
441 | case " ": | 449 | info.align = chr; |
442 | info.sign = flags.charAt(0); | 450 | } else if (chr == "+" || chr == "-" || chr == " ") { |
443 | flags = flags.substring(1); | 451 | info.sign = (chr == "-") ? "" : chr; |
444 | break; | 452 | } else if (chr == "0") { |
445 | case ",": | 453 | info.padding = chr; |
446 | info.grouping = true; | 454 | } else if (chr == ",") { |
447 | flags = flags.substring(1); | 455 | info.group = true; |
448 | break; | ||
449 | case ".": | ||
450 | var chars = /^\d*/.exec(flags.substring(1))[0]; | ||
451 | info.precision = parseInt(chars); | ||
452 | flags = flags.substring(1 + chars.length); | ||
453 | break; | ||
454 | case "0": | ||
455 | info.padding = flags.charAt(0); | ||
456 | flags = flags.substring(1); | ||
457 | break; | ||
458 | case "1": | ||
459 | case "2": | ||
460 | case "3": | ||
461 | case "4": | ||
462 | case "5": | ||
463 | case "6": | ||
464 | case "7": | ||
465 | case "8": | ||
466 | case "9": | ||
467 | var chars = /^\d*/.exec(flags)[0]; | ||
468 | info.width = parseInt(chars); | ||
469 | flags = flags.substring(chars.length); | ||
470 | break; | ||
471 | case "s": | ||
472 | case "r": | ||
473 | info.format = flags.charAt(0); | ||
474 | flags = flags.substring(1); | ||
475 | break; | ||
476 | case "b": | ||
477 | case "d": | ||
478 | case "o": | ||
479 | case "x": | ||
480 | case "X": | ||
481 | case "f": | ||
482 | case "%": | ||
483 | info.numeric = true; | ||
484 | info.format = flags.charAt(0); | ||
485 | info.radix = 10; | ||
486 | if (info.format === "b") { | ||
487 | info.radix = 2; | ||
488 | } else if (info.format === "o") { | ||
489 | info.radix = 8; | ||
490 | } else if (info.format === "x" || info.format === "X") { | ||
491 | info.radix = 16; | ||
492 | } | ||
493 | flags = flags.substring(1); | ||
494 | break; | ||
495 | default: | ||
496 | var msg = "unsupported format flag: " + flags.charAt(0); | ||
497 | throw new self.FormatPatternError(pattern, startPos, msg); | ||
498 | } | 456 | } |
499 | } | 457 | } |
458 | if (width) { | ||
459 | info.width = parseInt(width, 10); | ||
460 | } | ||
461 | if (precision && precision.length > 1) { | ||
462 | info.precision = parseInt(precision.substring(1), 10); | ||
463 | } | ||
464 | if (type == "s" || type == "r") { | ||
465 | info.format = type; | ||
466 | } else if (type == "b") { | ||
467 | update(info, { type: "number", format: type, radix: 2 }); | ||
468 | } else if (type == "o") { | ||
469 | update(info, { type: "number", format: type, radix: 8 }); | ||
470 | } else if (type == "x" || type == "X") { | ||
471 | update(info, { type: "number", format: type, radix: 16 }); | ||
472 | } else if (type == "d" || type == "f" || type == "%") { | ||
473 | update(info, { type: "number", format: type, radix: 10 }); | ||
474 | } | ||
475 | if (unmatched) { | ||
476 | var msg = "unsupported format flag: " + unmatched.charAt(0); | ||
477 | throw new MochiKit.Text.FormatPatternError(pattern, startPos, msg); | ||
478 | } | ||
500 | return info; | 479 | return info; |
501 | } | 480 | }; |
502 | 481 | ||
503 | /** | 482 | /** |
504 | * Formats a value as a percentage. This method avoids multiplication | 483 | * Formats a value as a percentage. This method avoids multiplication |
505 | * by 100 since it leads to weird numeric rounding errors. Instead it | 484 | * by 100 since it leads to weird numeric rounding errors. Instead it |
506 | * just move the decimal separator in the text string. It is ugly, | 485 | * just move the decimal separator in the text string. It is ugly, |
507 | * but works... | 486 | * but works... |
508 | * | 487 | * |
509 | * @param {Number} value the value to format | 488 | * @param {Number} value the value to format |
510 | * @param {Number} precision the number of precision digits | 489 | * @param {Number} precision the number of precision digits |
511 | */ | 490 | */ |
512 | MochiKit.Text._truncToPercent = function (value, precision) { | 491 | MochiKit.Text._truncToPercent = function (value, precision) { |
513 | // TODO: This can be simplified by using the same helper function | 492 | // TODO: This can be simplified by using MochiKit.Format._shiftNumber |
514 | // as roundToFixed now does. | 493 | // as roundToFixed does. |
515 | var str; | 494 | var str; |
516 | if (precision >= 0) { | 495 | if (precision >= 0) { |
517 | str = MochiKit.Format.roundToFixed(value, precision + 2); | 496 | str = MochiKit.Format.roundToFixed(value, precision + 2); |
518 | } else { | 497 | } else { |
519 | str = (value == null) ? "0" : value.toString(); | 498 | str = (value == null) ? "0" : value.toString(); |
520 | } | 499 | } |
521 | var fracPos = str.indexOf("."); | 500 | var arr = MochiKit.Text.split(str, ".", 2); |
522 | if (fracPos < 0) { | 501 | var frac = MochiKit.Text.padRight(arr[1], 2, "0"); |
523 | str = str + "00"; | 502 | var whole = arr[0] + frac.substring(0, 2); |
524 | } else if (fracPos + 3 >= str.length) { | 503 | frac = frac.substring(2); |
525 | var fraction = str.substring(fracPos + 1); | 504 | while (/^0[0-9]/.test(whole)) { |
526 | while (fraction.length < 2) { | 505 | whole = whole.substring(1); |
527 | fraction = fraction + "0"; | ||
528 | } | ||
529 | str = str.substring(0, fracPos) + fraction; | ||
530 | } else { | ||
531 | var fraction = str.substring(fracPos + 1); | ||
532 | str = str.substring(0, fracPos) + fraction.substring(0, 2) + | ||
533 | "." + fraction.substring(2); | ||
534 | } | ||
535 | while (str.length > 1 && str.charAt(0) == "0" && str.charAt(1) != ".") { | ||
536 | str = str.substring(1); | ||
537 | } | 506 | } |
538 | return str; | 507 | return (frac.length <= 0) ? whole : whole + "." + frac; |
539 | } | 508 | }; |
540 | 509 | ||
541 | /** | 510 | /** |
542 | * Creates a new format pattern error. | 511 | * Creates a new format pattern error. |
543 | * | 512 | * |
544 | * @param {String} pattern the format pattern string | 513 | * @param {String} pattern the format pattern string |
545 | * @param {Number} pos the position of the error | 514 | * @param {Number} pos the position of the error |
546 | * @param {String} message the error message text | 515 | * @param {String} message the error message text |
547 | * | 516 | * |
548 | * @return {Error} the format pattern error | 517 | * @return {Error} the format pattern error |
549 | * | 518 | * |
550 | * @class The format pattern error class. This error is thrown when | 519 | * @class The format pattern error class. This error is thrown when |
551 | * a syntax error is encountered inside a format string. | 520 | * a syntax error is encountered inside a format string. |
552 | * @property {String} pattern The format pattern string. | 521 | * @property {String} pattern The format pattern string. |
553 | * @property {Number} pos The position of the error. | 522 | * @property {Number} pos The position of the error. |
554 | * @property {String} message The error message text. | 523 | * @property {String} message The error message text. |
555 | * @extends MochiKit.Base.NamedError | 524 | * @extends MochiKit.Base.NamedError |
556 | */ | 525 | */ |
557 | MochiKit.Text.FormatPatternError = function (pattern, pos, message) { | 526 | MochiKit.Text.FormatPatternError = function (pattern, pos, message) { |
558 | this.pattern = pattern; | 527 | this.pattern = pattern; |
559 | this.pos = pos; | 528 | this.pos = pos; |
560 | this.message = message; | 529 | this.message = message; |
561 | } | 530 | }; |
562 | MochiKit.Text.FormatPatternError.prototype = | ||
563 | new MochiKit.Base.NamedError("MochiKit.Text.FormatPatternError"); | ||
564 | 531 | ||
532 | MochiKit.Text.FormatPatternError.prototype = new MochiKit.Base.NamedError("MochiKit.Text.FormatPatternError"); | ||
533 | MochiKit.Text.FormatPatternError.constructor = MochiKit.Text.FormatPatternError; | ||
565 | 534 | ||
566 | // | 535 | // |
567 | //XXX: Internet Explorer exception handling blows | 536 | //XXX: Internet Explorer export fix |
568 | // | 537 | // |
569 | if (MochiKit.__export__) { | 538 | if (MochiKit.__export__) { |
570 | formatter = MochiKit.Text.formatter; | 539 | formatter = MochiKit.Text.formatter; |
571 | format = MochiKit.Text.format; | 540 | format = MochiKit.Text.format; |
572 | formatValue = MochiKit.Text.formatValue; | 541 | formatValue = MochiKit.Text.formatValue; |
573 | } | 542 | } |
574 | 543 | ||
575 | 544 | ||
576 | MochiKit.Base.nameFunctions(MochiKit.Text); | 545 | MochiKit.Base.nameFunctions(MochiKit.Text); |
577 | MochiKit.Base._exportSymbols(this, MochiKit.Text); | 546 | MochiKit.Base._exportSymbols(this, MochiKit.Text); |
diff --git a/frontend/gamma/js/MochiKit/Visual.js b/frontend/gamma/js/MochiKit/Visual.js index 648d82a..372d99a 100644 --- a/frontend/gamma/js/MochiKit/Visual.js +++ b/frontend/gamma/js/MochiKit/Visual.js | |||
@@ -1,43 +1,43 @@ | |||
1 | /*** | 1 | /*** |
2 | 2 | ||
3 | MochiKit.Visual 1.5 | 3 | MochiKit.Visual 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); | 11 | MochiKit.Base.module(MochiKit, 'Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); |
12 | 12 | ||
13 | MochiKit.Visual._RoundCorners = function (e, options) { | 13 | MochiKit.Visual._RoundCorners = function (e, options) { |
14 | e = MochiKit.DOM.getElement(e); | 14 | e = MochiKit.DOM.getElement(e); |
15 | this._setOptions(options); | 15 | this._setOptions(options); |
16 | if (this.options.__unstable__wrapElement) { | 16 | if (this.options.__unstable__wrapElement) { |
17 | e = this._doWrap(e); | 17 | e = this._doWrap(e); |
18 | } | 18 | } |
19 | 19 | ||
20 | var color = this.options.color; | 20 | var color = this.options.color; |
21 | var C = MochiKit.Color.Color; | 21 | var C = MochiKit.Color.Color; |
22 | if (this.options.color === "fromElement") { | 22 | if (this.options.color === "fromElement") { |
23 | color = C.fromBackground(e); | 23 | color = C.fromBackground(e); |
24 | } else if (!(color instanceof C)) { | 24 | } else if (!(color instanceof C)) { |
25 | color = C.fromString(color); | 25 | color = C.fromString(color); |
26 | } | 26 | } |
27 | this.isTransparent = (color.asRGB().a <= 0); | 27 | this.isTransparent = (color.asRGB().a <= 0); |
28 | 28 | ||
29 | var bgColor = this.options.bgColor; | 29 | var bgColor = this.options.bgColor; |
30 | if (this.options.bgColor === "fromParent") { | 30 | if (this.options.bgColor === "fromParent") { |
31 | bgColor = C.fromBackground(e.offsetParent); | 31 | bgColor = C.fromBackground(e.offsetParent); |
32 | } else if (!(bgColor instanceof C)) { | 32 | } else if (!(bgColor instanceof C)) { |
33 | bgColor = C.fromString(bgColor); | 33 | bgColor = C.fromString(bgColor); |
34 | } | 34 | } |
35 | 35 | ||
36 | this._roundCornersImpl(e, color, bgColor); | 36 | this._roundCornersImpl(e, color, bgColor); |
37 | }; | 37 | }; |
38 | 38 | ||
39 | MochiKit.Visual._RoundCorners.prototype = { | 39 | MochiKit.Visual._RoundCorners.prototype = { |
40 | _doWrap: function (e) { | 40 | _doWrap: function (e) { |
41 | var parent = e.parentNode; | 41 | var parent = e.parentNode; |
42 | var doc = MochiKit.DOM.currentDocument(); | 42 | var doc = MochiKit.DOM.currentDocument(); |
43 | if (typeof(doc.defaultView) === "undefined" | 43 | if (typeof(doc.defaultView) === "undefined" |
@@ -440,64 +440,69 @@ MochiKit.Visual.Transitions.sinoidal = function (pos) { | |||
440 | 440 | ||
441 | /** @id MochiKit.Visual.Transitions.reverse */ | 441 | /** @id MochiKit.Visual.Transitions.reverse */ |
442 | MochiKit.Visual.Transitions.reverse = function (pos) { | 442 | MochiKit.Visual.Transitions.reverse = function (pos) { |
443 | return 1 - pos; | 443 | return 1 - pos; |
444 | }; | 444 | }; |
445 | 445 | ||
446 | /** @id MochiKit.Visual.Transitions.flicker */ | 446 | /** @id MochiKit.Visual.Transitions.flicker */ |
447 | MochiKit.Visual.Transitions.flicker = function (pos) { | 447 | MochiKit.Visual.Transitions.flicker = function (pos) { |
448 | return 0.25 - Math.cos(pos*Math.PI)/4 + Math.random()/2; | 448 | return 0.25 - Math.cos(pos*Math.PI)/4 + Math.random()/2; |
449 | }; | 449 | }; |
450 | 450 | ||
451 | /** @id MochiKit.Visual.Transitions.wobble */ | 451 | /** @id MochiKit.Visual.Transitions.wobble */ |
452 | MochiKit.Visual.Transitions.wobble = function (pos) { | 452 | MochiKit.Visual.Transitions.wobble = function (pos) { |
453 | return 0.5 - Math.cos(9*pos*Math.PI)/2; | 453 | return 0.5 - Math.cos(9*pos*Math.PI)/2; |
454 | }; | 454 | }; |
455 | 455 | ||
456 | /** @id MochiKit.Visual.Transitions.pulse */ | 456 | /** @id MochiKit.Visual.Transitions.pulse */ |
457 | MochiKit.Visual.Transitions.pulse = function (pos, pulses) { | 457 | MochiKit.Visual.Transitions.pulse = function (pos, pulses) { |
458 | if (pulses) { | 458 | if (pulses) { |
459 | pos *= 2 * pulses; | 459 | pos *= 2 * pulses; |
460 | } else { | 460 | } else { |
461 | pos *= 10; | 461 | pos *= 10; |
462 | } | 462 | } |
463 | var decimals = pos - Math.floor(pos); | 463 | var decimals = pos - Math.floor(pos); |
464 | return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; | 464 | return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; |
465 | }; | 465 | }; |
466 | 466 | ||
467 | /** @id MochiKit.Visual.Transitions.parabolic */ | 467 | /** @id MochiKit.Visual.Transitions.parabolic */ |
468 | MochiKit.Visual.Transitions.parabolic = function (pos) { | 468 | MochiKit.Visual.Transitions.parabolic = function (pos) { |
469 | return pos * pos; | 469 | return pos * pos; |
470 | }; | 470 | }; |
471 | 471 | ||
472 | /** @id MochiKit.Visual.Transitions.spring */ | ||
473 | MochiKit.Visual.Transitions.spring = function (pos) { | ||
474 | return 1 - (Math.cos(pos * 2.5 * Math.PI) * Math.exp(-pos * 6)); | ||
475 | }; | ||
476 | |||
472 | /** @id MochiKit.Visual.Transitions.none */ | 477 | /** @id MochiKit.Visual.Transitions.none */ |
473 | MochiKit.Visual.Transitions.none = function (pos) { | 478 | MochiKit.Visual.Transitions.none = function (pos) { |
474 | return 0; | 479 | return 0; |
475 | }; | 480 | }; |
476 | 481 | ||
477 | /** @id MochiKit.Visual.Transitions.full */ | 482 | /** @id MochiKit.Visual.Transitions.full */ |
478 | MochiKit.Visual.Transitions.full = function (pos) { | 483 | MochiKit.Visual.Transitions.full = function (pos) { |
479 | return 1; | 484 | return 1; |
480 | }; | 485 | }; |
481 | 486 | ||
482 | /*** | 487 | /*** |
483 | 488 | ||
484 | Core effects | 489 | Core effects |
485 | 490 | ||
486 | ***/ | 491 | ***/ |
487 | 492 | ||
488 | MochiKit.Visual.ScopedQueue = function () { | 493 | MochiKit.Visual.ScopedQueue = function () { |
489 | var cls = arguments.callee; | 494 | var cls = arguments.callee; |
490 | if (!(this instanceof cls)) { | 495 | if (!(this instanceof cls)) { |
491 | return new cls(); | 496 | return new cls(); |
492 | } | 497 | } |
493 | this.__init__(); | 498 | this.__init__(); |
494 | }; | 499 | }; |
495 | MochiKit.Visual.ScopedQueue.__export__ = false; | 500 | MochiKit.Visual.ScopedQueue.__export__ = false; |
496 | 501 | ||
497 | MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { | 502 | MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { |
498 | __init__: function () { | 503 | __init__: function () { |
499 | this.effects = []; | 504 | this.effects = []; |
500 | this.interval = null; | 505 | this.interval = null; |
501 | }, | 506 | }, |
502 | 507 | ||
503 | /** @id MochiKit.Visual.ScopedQueue.prototype.add */ | 508 | /** @id MochiKit.Visual.ScopedQueue.prototype.add */ |
@@ -505,64 +510,69 @@ MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { | |||
505 | var timestamp = new Date().getTime(); | 510 | var timestamp = new Date().getTime(); |
506 | 511 | ||
507 | var position = (typeof(effect.options.queue) == 'string') ? | 512 | var position = (typeof(effect.options.queue) == 'string') ? |
508 | effect.options.queue : effect.options.queue.position; | 513 | effect.options.queue : effect.options.queue.position; |
509 | 514 | ||
510 | var ma = MochiKit.Base.map; | 515 | var ma = MochiKit.Base.map; |
511 | switch (position) { | 516 | switch (position) { |
512 | case 'front': | 517 | case 'front': |
513 | // move unstarted effects after this effect | 518 | // move unstarted effects after this effect |
514 | ma(function (e) { | 519 | ma(function (e) { |
515 | if (e.state == 'idle') { | 520 | if (e.state == 'idle') { |
516 | e.startOn += effect.finishOn; | 521 | e.startOn += effect.finishOn; |
517 | e.finishOn += effect.finishOn; | 522 | e.finishOn += effect.finishOn; |
518 | } | 523 | } |
519 | }, this.effects); | 524 | }, this.effects); |
520 | break; | 525 | break; |
521 | case 'end': | 526 | case 'end': |
522 | var finish; | 527 | var finish; |
523 | // start effect after last queued effect has finished | 528 | // start effect after last queued effect has finished |
524 | ma(function (e) { | 529 | ma(function (e) { |
525 | var i = e.finishOn; | 530 | var i = e.finishOn; |
526 | if (i >= (finish || i)) { | 531 | if (i >= (finish || i)) { |
527 | finish = i; | 532 | finish = i; |
528 | } | 533 | } |
529 | }, this.effects); | 534 | }, this.effects); |
530 | timestamp = finish || timestamp; | 535 | timestamp = finish || timestamp; |
531 | break; | 536 | break; |
532 | case 'break': | 537 | case 'break': |
533 | ma(function (e) { | 538 | ma(function (e) { |
534 | e.finalize(); | 539 | e.finalize(); |
535 | }, this.effects); | 540 | }, this.effects); |
536 | break; | 541 | break; |
542 | case 'replace': | ||
543 | ma(function (e) { | ||
544 | e.cancel(); | ||
545 | }, this.effects); | ||
546 | break; | ||
537 | } | 547 | } |
538 | 548 | ||
539 | effect.startOn += timestamp; | 549 | effect.startOn += timestamp; |
540 | effect.finishOn += timestamp; | 550 | effect.finishOn += timestamp; |
541 | if (!effect.options.queue.limit || | 551 | if (!effect.options.queue.limit || |
542 | this.effects.length < effect.options.queue.limit) { | 552 | this.effects.length < effect.options.queue.limit) { |
543 | this.effects.push(effect); | 553 | this.effects.push(effect); |
544 | } | 554 | } |
545 | 555 | ||
546 | if (!this.interval) { | 556 | if (!this.interval) { |
547 | this.interval = this.startLoop(MochiKit.Base.bind(this.loop, this), | 557 | this.interval = this.startLoop(MochiKit.Base.bind(this.loop, this), |
548 | 40); | 558 | 40); |
549 | } | 559 | } |
550 | }, | 560 | }, |
551 | 561 | ||
552 | /** @id MochiKit.Visual.ScopedQueue.prototype.startLoop */ | 562 | /** @id MochiKit.Visual.ScopedQueue.prototype.startLoop */ |
553 | startLoop: function (func, interval) { | 563 | startLoop: function (func, interval) { |
554 | return setInterval(func, interval); | 564 | return setInterval(func, interval); |
555 | }, | 565 | }, |
556 | 566 | ||
557 | /** @id MochiKit.Visual.ScopedQueue.prototype.remove */ | 567 | /** @id MochiKit.Visual.ScopedQueue.prototype.remove */ |
558 | remove: function (effect) { | 568 | remove: function (effect) { |
559 | this.effects = MochiKit.Base.filter(function (e) { | 569 | this.effects = MochiKit.Base.filter(function (e) { |
560 | return e != effect; | 570 | return e != effect; |
561 | }, this.effects); | 571 | }, this.effects); |
562 | if (!this.effects.length) { | 572 | if (!this.effects.length) { |
563 | this.stopLoop(this.interval); | 573 | this.stopLoop(this.interval); |
564 | this.interval = null; | 574 | this.interval = null; |
565 | } | 575 | } |
566 | }, | 576 | }, |
567 | 577 | ||
568 | /** @id MochiKit.Visual.ScopedQueue.prototype.stopLoop */ | 578 | /** @id MochiKit.Visual.ScopedQueue.prototype.stopLoop */ |
@@ -633,66 +643,70 @@ MochiKit.Visual.Base.prototype = { | |||
633 | this.event('beforeStart'); | 643 | this.event('beforeStart'); |
634 | if (!this.options.sync) { | 644 | if (!this.options.sync) { |
635 | v.Queues.get(typeof(this.options.queue) == 'string' ? | 645 | v.Queues.get(typeof(this.options.queue) == 'string' ? |
636 | 'global' : this.options.queue.scope).add(this); | 646 | 'global' : this.options.queue.scope).add(this); |
637 | } | 647 | } |
638 | }, | 648 | }, |
639 | 649 | ||
640 | /** @id MochiKit.Visual.Base.prototype.loop */ | 650 | /** @id MochiKit.Visual.Base.prototype.loop */ |
641 | loop: function (timePos) { | 651 | loop: function (timePos) { |
642 | if (timePos >= this.startOn) { | 652 | if (timePos >= this.startOn) { |
643 | if (timePos >= this.finishOn) { | 653 | if (timePos >= this.finishOn) { |
644 | return this.finalize(); | 654 | return this.finalize(); |
645 | } | 655 | } |
646 | var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); | 656 | var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); |
647 | var frame = | 657 | var frame = |
648 | Math.round(pos * this.options.fps * this.options.duration); | 658 | Math.round(pos * this.options.fps * this.options.duration); |
649 | if (frame > this.currentFrame) { | 659 | if (frame > this.currentFrame) { |
650 | this.render(pos); | 660 | this.render(pos); |
651 | this.currentFrame = frame; | 661 | this.currentFrame = frame; |
652 | } | 662 | } |
653 | } | 663 | } |
654 | }, | 664 | }, |
655 | 665 | ||
656 | /** @id MochiKit.Visual.Base.prototype.render */ | 666 | /** @id MochiKit.Visual.Base.prototype.render */ |
657 | render: function (pos) { | 667 | render: function (pos) { |
658 | if (this.state == 'idle') { | 668 | if (this.state == 'idle') { |
659 | this.state = 'running'; | 669 | this.state = 'running'; |
660 | this.event('beforeSetup'); | 670 | this.event('beforeSetup'); |
661 | this.setup(); | 671 | this.setup(); |
662 | this.event('afterSetup'); | 672 | this.event('afterSetup'); |
663 | } | 673 | } |
664 | if (this.state == 'running') { | 674 | if (this.state == 'running') { |
665 | if (this.options.transition) { | 675 | var trans = this.options.transition; |
666 | pos = this.options.transition(pos); | 676 | if (typeof(trans) == "string") { |
677 | trans = MochiKit.Visual.Transitions[trans]; | ||
678 | } | ||
679 | if (typeof(trans) == "function") { | ||
680 | pos = trans(pos); | ||
667 | } | 681 | } |
668 | pos *= (this.options.to - this.options.from); | 682 | pos *= (this.options.to - this.options.from); |
669 | pos += this.options.from; | 683 | pos += this.options.from; |
670 | this.event('beforeUpdate'); | 684 | this.event('beforeUpdate'); |
671 | this.update(pos); | 685 | this.update(pos); |
672 | this.event('afterUpdate'); | 686 | this.event('afterUpdate'); |
673 | } | 687 | } |
674 | }, | 688 | }, |
675 | 689 | ||
676 | /** @id MochiKit.Visual.Base.prototype.cancel */ | 690 | /** @id MochiKit.Visual.Base.prototype.cancel */ |
677 | cancel: function () { | 691 | cancel: function () { |
678 | if (!this.options.sync) { | 692 | if (!this.options.sync) { |
679 | MochiKit.Visual.Queues.get(typeof(this.options.queue) == 'string' ? | 693 | MochiKit.Visual.Queues.get(typeof(this.options.queue) == 'string' ? |
680 | 'global' : this.options.queue.scope).remove(this); | 694 | 'global' : this.options.queue.scope).remove(this); |
681 | } | 695 | } |
682 | this.state = 'finished'; | 696 | this.state = 'finished'; |
683 | }, | 697 | }, |
684 | 698 | ||
685 | /** @id MochiKit.Visual.Base.prototype.finalize */ | 699 | /** @id MochiKit.Visual.Base.prototype.finalize */ |
686 | finalize: function () { | 700 | finalize: function () { |
687 | this.render(1.0); | 701 | this.render(1.0); |
688 | this.cancel(); | 702 | this.cancel(); |
689 | this.event('beforeFinish'); | 703 | this.event('beforeFinish'); |
690 | this.finish(); | 704 | this.finish(); |
691 | this.event('afterFinish'); | 705 | this.event('afterFinish'); |
692 | }, | 706 | }, |
693 | 707 | ||
694 | setup: function () { | 708 | setup: function () { |
695 | }, | 709 | }, |
696 | 710 | ||
697 | finish: function () { | 711 | finish: function () { |
698 | }, | 712 | }, |
@@ -1657,66 +1671,66 @@ MochiKit.Visual.slideUp = function (element, /* optional */ options) { | |||
1657 | afterUpdateInternal: function (effect) { | 1671 | afterUpdateInternal: function (effect) { |
1658 | var elementDimensions = s.getElementDimensions(effect.element, true); | 1672 | var elementDimensions = s.getElementDimensions(effect.element, true); |
1659 | s.setStyle(effect.element.firstChild, | 1673 | s.setStyle(effect.element.firstChild, |
1660 | {bottom: (effect.dims[0] - elementDimensions.h) + 'px'}); | 1674 | {bottom: (effect.dims[0] - elementDimensions.h) + 'px'}); |
1661 | }, | 1675 | }, |
1662 | afterFinishInternal: function (effect) { | 1676 | afterFinishInternal: function (effect) { |
1663 | s.hideElement(effect.element); | 1677 | s.hideElement(effect.element); |
1664 | s.undoClipping(effect.element, elemClip); | 1678 | s.undoClipping(effect.element, elemClip); |
1665 | s.undoPositioned(effect.element.firstChild); | 1679 | s.undoPositioned(effect.element.firstChild); |
1666 | s.undoPositioned(effect.element); | 1680 | s.undoPositioned(effect.element); |
1667 | s.setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); | 1681 | s.setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); |
1668 | } | 1682 | } |
1669 | }, options); | 1683 | }, options); |
1670 | return new MochiKit.Visual.Scale(element, 0, options); | 1684 | return new MochiKit.Visual.Scale(element, 0, options); |
1671 | }; | 1685 | }; |
1672 | 1686 | ||
1673 | // Bug in opera makes the TD containing this element expand for a instance | 1687 | // Bug in opera makes the TD containing this element expand for a instance |
1674 | // after finish | 1688 | // after finish |
1675 | /** @id MochiKit.Visual.squish */ | 1689 | /** @id MochiKit.Visual.squish */ |
1676 | MochiKit.Visual.squish = function (element, /* optional */ options) { | 1690 | MochiKit.Visual.squish = function (element, /* optional */ options) { |
1677 | /*** | 1691 | /*** |
1678 | 1692 | ||
1679 | Reduce an element and make it disappear. | 1693 | Reduce an element and make it disappear. |
1680 | 1694 | ||
1681 | ***/ | 1695 | ***/ |
1682 | var d = MochiKit.DOM; | 1696 | var d = MochiKit.DOM; |
1683 | var b = MochiKit.Base; | 1697 | var b = MochiKit.Base; |
1684 | var s = MochiKit.Style; | 1698 | var s = MochiKit.Style; |
1685 | var elementDimensions = s.getElementDimensions(element, true); | 1699 | var elementDimensions = s.getElementDimensions(element, true); |
1686 | var elemClip; | 1700 | var elemClip; |
1687 | options = b.update({ | 1701 | options = b.update({ |
1688 | restoreAfterFinish: true, | 1702 | restoreAfterFinish: true, |
1689 | scaleMode: {originalHeight: elementDimensions.w, | 1703 | scaleMode: {originalHeight: elementDimensions.h, |
1690 | originalWidth: elementDimensions.h}, | 1704 | originalWidth: elementDimensions.w}, |
1691 | beforeSetupInternal: function (effect) { | 1705 | beforeSetupInternal: function (effect) { |
1692 | elemClip = s.makeClipping(effect.element); | 1706 | elemClip = s.makeClipping(effect.element); |
1693 | }, | 1707 | }, |
1694 | afterFinishInternal: function (effect) { | 1708 | afterFinishInternal: function (effect) { |
1695 | s.hideElement(effect.element); | 1709 | s.hideElement(effect.element); |
1696 | s.undoClipping(effect.element, elemClip); | 1710 | s.undoClipping(effect.element, elemClip); |
1697 | } | 1711 | } |
1698 | }, options); | 1712 | }, options); |
1699 | 1713 | ||
1700 | return new MochiKit.Visual.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, options); | 1714 | return new MochiKit.Visual.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, options); |
1701 | }; | 1715 | }; |
1702 | 1716 | ||
1703 | /** @id MochiKit.Visual.grow */ | 1717 | /** @id MochiKit.Visual.grow */ |
1704 | MochiKit.Visual.grow = function (element, /* optional */ options) { | 1718 | MochiKit.Visual.grow = function (element, /* optional */ options) { |
1705 | /*** | 1719 | /*** |
1706 | 1720 | ||
1707 | Grow an element to its original size. Make it zero-sized before | 1721 | Grow an element to its original size. Make it zero-sized before |
1708 | if necessary. | 1722 | if necessary. |
1709 | 1723 | ||
1710 | ***/ | 1724 | ***/ |
1711 | var d = MochiKit.DOM; | 1725 | var d = MochiKit.DOM; |
1712 | var v = MochiKit.Visual; | 1726 | var v = MochiKit.Visual; |
1713 | var s = MochiKit.Style; | 1727 | var s = MochiKit.Style; |
1714 | element = d.getElement(element); | 1728 | element = d.getElement(element); |
1715 | options = MochiKit.Base.update({ | 1729 | options = MochiKit.Base.update({ |
1716 | direction: 'center', | 1730 | direction: 'center', |
1717 | moveTransition: v.Transitions.sinoidal, | 1731 | moveTransition: v.Transitions.sinoidal, |
1718 | scaleTransition: v.Transitions.sinoidal, | 1732 | scaleTransition: v.Transitions.sinoidal, |
1719 | opacityTransition: v.Transitions.full, | 1733 | opacityTransition: v.Transitions.full, |
1720 | scaleContent: true, | 1734 | scaleContent: true, |
1721 | scaleFromCenter: false | 1735 | scaleFromCenter: false |
1722 | }, options); | 1736 | }, options); |
@@ -1929,47 +1943,34 @@ MochiKit.Visual.fold = function (element, /* optional */ options) { | |||
1929 | element = d.getElement(element); | 1943 | element = d.getElement(element); |
1930 | var elementDimensions = s.getElementDimensions(element, true); | 1944 | var elementDimensions = s.getElementDimensions(element, true); |
1931 | var oldStyle = { | 1945 | var oldStyle = { |
1932 | top: element.style.top, | 1946 | top: element.style.top, |
1933 | left: element.style.left, | 1947 | left: element.style.left, |
1934 | width: element.style.width, | 1948 | width: element.style.width, |
1935 | height: element.style.height | 1949 | height: element.style.height |
1936 | }; | 1950 | }; |
1937 | var elemClip = s.makeClipping(element); | 1951 | var elemClip = s.makeClipping(element); |
1938 | options = MochiKit.Base.update({ | 1952 | options = MochiKit.Base.update({ |
1939 | scaleContent: false, | 1953 | scaleContent: false, |
1940 | scaleX: false, | 1954 | scaleX: false, |
1941 | scaleMode: {originalHeight: elementDimensions.h, | 1955 | scaleMode: {originalHeight: elementDimensions.h, |
1942 | originalWidth: elementDimensions.w}, | 1956 | originalWidth: elementDimensions.w}, |
1943 | afterFinishInternal: function (effect) { | 1957 | afterFinishInternal: function (effect) { |
1944 | new v.Scale(element, 1, { | 1958 | new v.Scale(element, 1, { |
1945 | scaleContent: false, | 1959 | scaleContent: false, |
1946 | scaleY: false, | 1960 | scaleY: false, |
1947 | scaleMode: {originalHeight: elementDimensions.h, | 1961 | scaleMode: {originalHeight: elementDimensions.h, |
1948 | originalWidth: elementDimensions.w}, | 1962 | originalWidth: elementDimensions.w}, |
1949 | afterFinishInternal: function (effect) { | 1963 | afterFinishInternal: function (effect) { |
1950 | s.hideElement(effect.element); | 1964 | s.hideElement(effect.element); |
1951 | s.undoClipping(effect.element, elemClip); | 1965 | s.undoClipping(effect.element, elemClip); |
1952 | s.setStyle(effect.element, oldStyle); | 1966 | s.setStyle(effect.element, oldStyle); |
1953 | } | 1967 | } |
1954 | }); | 1968 | }); |
1955 | } | 1969 | } |
1956 | }, options); | 1970 | }, options); |
1957 | return new v.Scale(element, 5, options); | 1971 | return new v.Scale(element, 5, options); |
1958 | }; | 1972 | }; |
1959 | 1973 | ||
1960 | 1974 | ||
1961 | /* end of Rico adaptation */ | 1975 | MochiKit.Base.nameFunctions(MochiKit.Visual); |
1962 | |||
1963 | MochiKit.Visual.__new__ = function () { | ||
1964 | var m = MochiKit.Base; | ||
1965 | |||
1966 | // Backwards compatibility aliases | ||
1967 | m._deprecated(this, 'Color', 'MochiKit.Color.Color', '1.1'); | ||
1968 | m._deprecated(this, 'getElementsComputedStyle', 'MochiKit.Style.getStyle', '1.1'); | ||
1969 | |||
1970 | m.nameFunctions(this); | ||
1971 | }; | ||
1972 | |||
1973 | MochiKit.Visual.__new__(); | ||
1974 | |||
1975 | MochiKit.Base._exportSymbols(this, MochiKit.Visual); | 1976 | MochiKit.Base._exportSymbols(this, MochiKit.Visual); |
diff --git a/frontend/gamma/js/MochiKit/__package__.js b/frontend/gamma/js/MochiKit/__package__.js deleted file mode 100644 index 8d644b1..0000000 --- a/frontend/gamma/js/MochiKit/__package__.js +++ b/dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | dojo.kwCompoundRequire({ | ||
2 | "common": [ | ||
3 | "MochiKit.Base", | ||
4 | "MochiKit.Iter", | ||
5 | "MochiKit.Logging", | ||
6 | "MochiKit.DateTime", | ||
7 | "MochiKit.Format", | ||
8 | "MochiKit.Async", | ||
9 | "MochiKit.DOM", | ||
10 | "MochiKit.Style", | ||
11 | "MochiKit.LoggingPane", | ||
12 | "MochiKit.Color", | ||
13 | "MochiKit.Signal", | ||
14 | "MochiKit.Position", | ||
15 | "MochiKit.Visual" | ||
16 | ] | ||
17 | }); | ||
18 | dojo.provide("MochiKit.*"); | ||
diff --git a/frontend/gamma/js/main.js b/frontend/gamma/js/main.js index a9fd65e..934b325 100644 --- a/frontend/gamma/js/main.js +++ b/frontend/gamma/js/main.js | |||
@@ -52,42 +52,42 @@ function run() { | |||
52 | var useCompactDesign; | 52 | var useCompactDesign; |
53 | var controllerParameters; | 53 | var controllerParameters; |
54 | 54 | ||
55 | controllerParameters = {}; | 55 | controllerParameters = {}; |
56 | 56 | ||
57 | //MochiKit.DOM.removeElement('javaScriptAlert'); | 57 | //MochiKit.DOM.removeElement('javaScriptAlert'); |
58 | Clipperz.PM.Strings.Languages.initSetup(); | 58 | Clipperz.PM.Strings.Languages.initSetup(); |
59 | 59 | ||
60 | if (window.location.search.indexOf('registration') != -1) { | 60 | if (window.location.search.indexOf('registration') != -1) { |
61 | shouldShowRegistrationForm = true; | 61 | shouldShowRegistrationForm = true; |
62 | } else { | 62 | } else { |
63 | shouldShowRegistrationForm = false; | 63 | shouldShowRegistrationForm = false; |
64 | } | 64 | } |
65 | 65 | ||
66 | if (window.location.search.indexOf('autocomplete') != -1) { | 66 | if (window.location.search.indexOf('autocomplete') != -1) { |
67 | controllerParameters['autocomplete'] = 'on' | 67 | controllerParameters['autocomplete'] = 'on' |
68 | } | 68 | } |
69 | 69 | ||
70 | if (window.location.search.indexOf('compact') != -1) { | 70 | if (window.location.search.indexOf('compact') != -1) { |
71 | useCompactDesign = true; | 71 | useCompactDesign = true; |
72 | } else { | 72 | } else { |
73 | useCompactDesign = false; | 73 | useCompactDesign = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | if (useCompactDesign == true) { | 76 | if (useCompactDesign == true) { |
77 | Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Compact.Controllers.MainController(controllerParameters); | 77 | Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Compact.Controllers.MainController(controllerParameters); |
78 | } else { | 78 | } else { |
79 | Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Web.Controllers.MainController(controllerParameters); | 79 | Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Web.Controllers.MainController(controllerParameters); |
80 | } | 80 | } |
81 | 81 | ||
82 | Clipperz.PM.RunTime.mainController.run(shouldShowRegistrationForm); | 82 | Clipperz.PM.RunTime.mainController.run(shouldShowRegistrationForm); |
83 | 83 | ||
84 | //Clipperz.log("HASH: " + window.location.hash); | 84 | //Clipperz.log("HASH: " + window.location.hash); |
85 | if (window.location.hash != "") { | 85 | //if (window.location.hash != "") { |
86 | window.location.hash = "" | 86 | // window.location.hash = "" |
87 | } | 87 | //} |
88 | //Clipperz.log("HASH cleaned"); | 88 | //Clipperz.log("HASH cleaned"); |
89 | //#credentials=base64encoded({username:'joe', passphrase:'clipperz'}) | 89 | //#credentials=base64encoded({username:'joe', passphrase:'clipperz'}) |
90 | //MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'doLogin', {username:'joe', passphrase:'clipperz'}); | 90 | //MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'doLogin', {username:'joe', passphrase:'clipperz'}); |
91 | } | 91 | } |
92 | 92 | ||
93 | MochiKit.DOM.addLoadEvent(run); | 93 | MochiKit.DOM.addLoadEvent(run); |
diff --git a/frontend/gamma/properties/gamma.properties.json b/frontend/gamma/properties/gamma.properties.json index 8f2d98e..0a513e8 100644 --- a/frontend/gamma/properties/gamma.properties.json +++ b/frontend/gamma/properties/gamma.properties.json | |||
@@ -1,37 +1,40 @@ | |||
1 | { | 1 | { |
2 | "copyright.values": { | 2 | "copyright.values": { |
3 | "mochikit.repository": "http://svn.mochikit.com/mochikit/trunk/", | 3 | "mochikit.repository": "https://github.com/mochi/mochikit.git", |
4 | "mochikit.version": "1506" | 4 | "mochikit.version": "fe8d17bb9ac0a4e5ad4a8d5c2c94a6fac1c92d75" |
5 | }, | 5 | }, |
6 | |||
7 | "html.template": "index_template.html", | ||
8 | |||
6 | "js": [ | 9 | "js": [ |
7 | "MochiKit/Base.js", | 10 | "MochiKit/Base.js", |
8 | "MochiKit/Iter.js", | 11 | "MochiKit/Iter.js", |
9 | "MochiKit/Logging.js", | 12 | "MochiKit/Logging.js", |
10 | "-- MochiKit/DateTime.js", | 13 | "-- MochiKit/DateTime.js", |
11 | "MochiKit/Format.js", | 14 | "MochiKit/Format.js", |
12 | "MochiKit/Async.js", | 15 | "MochiKit/Async.js", |
13 | "MochiKit/DOM.js", | 16 | "MochiKit/DOM.js", |
14 | "MochiKit/Style.js", | 17 | "MochiKit/Style.js", |
15 | "MochiKit/LoggingPane.js", | 18 | "MochiKit/LoggingPane.js", |
16 | "MochiKit/Color.js", | 19 | "MochiKit/Color.js", |
17 | "MochiKit/Signal.js", | 20 | "MochiKit/Signal.js", |
18 | "MochiKit/Position.js", | 21 | "MochiKit/Position.js", |
19 | "MochiKit/Selector.js", | 22 | "MochiKit/Selector.js", |
20 | "MochiKit/Visual.js", | 23 | "MochiKit/Visual.js", |
21 | 24 | ||
22 | "JSON/json2.js", | 25 | "JSON/json2.js", |
23 | 26 | ||
24 | "Clipperz/YUI/Utils.js", | 27 | "Clipperz/YUI/Utils.js", |
25 | "Clipperz/YUI/DomHelper.js", | 28 | "Clipperz/YUI/DomHelper.js", |
26 | 29 | ||
27 | "Clipperz/ByteArray.js", | 30 | "Clipperz/ByteArray.js", |
28 | "Clipperz/Base.js", | 31 | "Clipperz/Base.js", |
29 | "Clipperz/Async.js", | 32 | "Clipperz/Async.js", |
30 | "Clipperz/CSVProcessor.js", | 33 | "Clipperz/CSVProcessor.js", |
31 | "Clipperz/KeePassExportProcessor.js", | 34 | "Clipperz/KeePassExportProcessor.js", |
32 | "Clipperz/Date.js", | 35 | "Clipperz/Date.js", |
33 | "Clipperz/DOM.js", | 36 | "Clipperz/DOM.js", |
34 | "Clipperz/Logging.js", | 37 | "Clipperz/Logging.js", |
35 | "Clipperz/Signal.js", | 38 | "Clipperz/Signal.js", |
36 | "Clipperz/Style.js", | 39 | "Clipperz/Style.js", |
37 | "Clipperz/Visual.js", | 40 | "Clipperz/Visual.js", |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/AES.html b/frontend/gamma/tests/tests/Clipperz/Crypto/AES.html index 828ccb8..16f64d0 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/AES.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/AES.html | |||
@@ -1,63 +1,62 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.Crypto.AES_v3 - TEST</title> | 28 | <title>Clipperz.Crypto.AES_v3 - TEST</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> | 34 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> |
36 | 35 | ||
37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
41 | 40 | ||
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
44 | 43 | ||
45 | </head> | 44 | </head> |
46 | <body> | 45 | <body> |
47 | <pre id="test"> | 46 | <pre id="test"> |
48 | <script type="text/javascript"> | 47 | <script type="text/javascript"> |
49 | 48 | ||
50 | try { | 49 | try { |
51 | var block; | 50 | var block; |
52 | var keyValue; | 51 | var keyValue; |
53 | varkey; | 52 | varkey; |
54 | var encryptedBlock; | 53 | var encryptedBlock; |
55 | var startTime, endTime; | 54 | var startTime, endTime; |
56 | 55 | ||
57 | startTime = new Date(); | 56 | startTime = new Date(); |
58 | 57 | ||
59 | keyValue = new Clipperz.ByteArray("0x00010203050607080a0b0c0d0f10111214151617191a1b1c1e1f202123242526"); | 58 | keyValue = new Clipperz.ByteArray("0x00010203050607080a0b0c0d0f10111214151617191a1b1c1e1f202123242526"); |
60 | key = new Clipperz.Crypto.AES.Key({key:keyValue}); | 59 | key = new Clipperz.Crypto.AES.Key({key:keyValue}); |
61 | block = new Clipperz.ByteArray("0x834eadfccac7e1b30664b1aba44815ab"); | 60 | block = new Clipperz.ByteArray("0x834eadfccac7e1b30664b1aba44815ab"); |
62 | encryptedBlock = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(key, block.arrayValues())); | 61 | encryptedBlock = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(key, block.arrayValues())); |
63 | is(encryptedBlock.toHexString(), "0x1946dabf6a03a2a2c3d0b05080aed6fc", "Test 1"); | 62 | is(encryptedBlock.toHexString(), "0x1946dabf6a03a2a2c3d0b05080aed6fc", "Test 1"); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/AES.performance.html b/frontend/gamma/tests/tests/Clipperz/Crypto/AES.performance.html index 4817096..a90d815 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/AES.performance.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/AES.performance.html | |||
@@ -3,65 +3,64 @@ | |||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.Crypto.AES_performance - TEST</title> | 28 | <title>Clipperz.Crypto.AES_performance - TEST</title> |
29 | 29 | ||
30 | <script> | 30 | <script> |
31 | jslog_config_enabled = true; | 31 | jslog_config_enabled = true; |
32 | </script> | 32 | </script> |
33 | 33 | ||
34 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 34 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
35 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
36 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 35 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
37 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 36 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
38 | 37 | ||
39 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> | 38 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> |
40 | 39 | ||
41 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
44 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
46 | 45 | ||
47 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
48 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 47 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
49 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 48 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
50 | 49 | ||
51 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 50 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
52 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> | 51 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> |
53 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script> | 52 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script> |
54 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script> | 53 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script> |
55 | 54 | ||
56 | </head> | 55 | </head> |
57 | <body> | 56 | <body> |
58 | <pre id="test"> | 57 | <pre id="test"> |
59 | <script type="text/javascript"> | 58 | <script type="text/javascript"> |
60 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | 59 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); |
61 | 60 | ||
62 | try { | 61 | try { |
63 | 62 | ||
64 | var password; | 63 | var password; |
65 | varplainText; | 64 | varplainText; |
66 | varencryptedText; | 65 | varencryptedText; |
67 | var decryptedText; | 66 | var decryptedText; |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/Base.html b/frontend/gamma/tests/tests/Clipperz/Crypto/Base.html index 0ffcdb8..83f0766 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/Base.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/Base.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
35 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
36 | 35 | ||
37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
41 | 40 | ||
42 | </head> | 41 | </head> |
43 | <body> | 42 | <body> |
44 | <pre id="test"> | 43 | <pre id="test"> |
45 | <script type="text/javascript"> | 44 | <script type="text/javascript"> |
46 | try { | 45 | try { |
47 | var secretKey; | 46 | var secretKey; |
48 | varpublicKey; | 47 | varpublicKey; |
49 | varplainString; | 48 | varplainString; |
50 | varencryptedString; | 49 | varencryptedString; |
51 | 50 | ||
52 | 51 | ||
53 | secretKey = "s3cr37k39"; | 52 | secretKey = "s3cr37k39"; |
54 | plainString = "The Quick Brown Fox Jumps Over The Lazy Dog"; | 53 | plainString = "The Quick Brown Fox Jumps Over The Lazy Dog"; |
55 | encryptedString = Clipperz.Crypto.Base.encryptUsingSecretKey(secretKey, plainString); | 54 | encryptedString = Clipperz.Crypto.Base.encryptUsingSecretKey(secretKey, plainString); |
56 | 55 | ||
57 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
58 | // | 57 | // |
59 | //Secret key encryption / decryption | 58 | //Secret key encryption / decryption |
60 | // | 59 | // |
61 | is (isUndefinedOrNull(encryptedString), false, "An encrypted string should not be empty"); | 60 | is (isUndefinedOrNull(encryptedString), false, "An encrypted string should not be empty"); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/BigInt.html b/frontend/gamma/tests/tests/Clipperz/Crypto/BigInt.html index b970a9a..f4db3b7 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/BigInt.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/BigInt.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
35 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
36 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
37 | 36 | ||
38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> |
41 | </head> | 40 | </head> |
42 | <body> | 41 | <body> |
43 | <pre id="test"> | 42 | <pre id="test"> |
44 | <script type="text/javascript"> | 43 | <script type="text/javascript"> |
45 | try { | 44 | try { |
46 | varbigInt_1; | 45 | varbigInt_1; |
47 | varbigInt_2; | 46 | varbigInt_2; |
48 | varresult; | 47 | varresult; |
49 | varexpectedResult; | 48 | varexpectedResult; |
50 | 49 | ||
51 | // | 50 | // |
52 | //Constructur and equality test | 51 | //Constructur and equality test |
53 | // | 52 | // |
54 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); | 53 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); |
55 | is (bigInt_1.equals(bigInt_1), true, ""); | 54 | is (bigInt_1.equals(bigInt_1), true, ""); |
56 | 55 | ||
57 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); | 56 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); |
58 | bigInt_2 = new Clipperz.Crypto.BigInt("110", 10); | 57 | bigInt_2 = new Clipperz.Crypto.BigInt("110", 10); |
59 | is (bigInt_1.equals(bigInt_2), true, ""); | 58 | is (bigInt_1.equals(bigInt_2), true, ""); |
60 | 59 | ||
61 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); | 60 | bigInt_1 = new Clipperz.Crypto.BigInt("110"); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.B283.html b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.B283.html index 6024021..93d8695 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.B283.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.B283.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
35 | 34 | ||
36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
38 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> | 37 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> |
44 | </head> | 43 | </head> |
45 | <body> | 44 | <body> |
46 | <pre id="test"> | 45 | <pre id="test"> |
47 | <script type="text/javascript"> | 46 | <script type="text/javascript"> |
48 | try { | 47 | try { |
49 | // | 48 | // |
50 | //ECC.BinaryFiniteField | 49 | //ECC.BinaryFiniteField |
51 | // | 50 | // |
52 | varf2m; | 51 | varf2m; |
53 | varf2m_improved; | 52 | varf2m_improved; |
54 | var a, a1, b; | 53 | var a, a1, b; |
55 | var result; | 54 | var result; |
56 | var result_improved; | 55 | var result_improved; |
57 | var expectedResul; | 56 | var expectedResul; |
58 | 57 | ||
59 | f2m = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16)}) | 58 | f2m = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16)}) |
60 | f2m_improved = Clipperz.Crypto.ECC.StandardCurves.B283().finiteField(); | 59 | f2m_improved = Clipperz.Crypto.ECC.StandardCurves.B283().finiteField(); |
61 | a = new Clipperz.Crypto.ECC.BinaryField.Value("05c91e41 d9ca17ef 9d8a33c1 a44eba6d 368fde02 1c492077 1a46eb01 a481e5f7 f430749d", 16); | 60 | a = new Clipperz.Crypto.ECC.BinaryField.Value("05c91e41 d9ca17ef 9d8a33c1 a44eba6d 368fde02 1c492077 1a46eb01 a481e5f7 f430749d", 16); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.html b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.html index 5a7a4f7..658c402 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.FiniteField.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
35 | 34 | ||
36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
38 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> | 37 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> |
44 | </head> | 43 | </head> |
45 | <body> | 44 | <body> |
46 | <pre id="test"> | 45 | <pre id="test"> |
47 | <script type="text/javascript"> | 46 | <script type="text/javascript"> |
48 | try { | 47 | try { |
49 | // | 48 | // |
50 | //ECC.BinaryFiniteField | 49 | //ECC.BinaryFiniteField |
51 | // | 50 | // |
52 | varf2m; | 51 | varf2m; |
53 | varf2m_improved; | 52 | varf2m_improved; |
54 | var a, b; | 53 | var a, b; |
55 | var result; | 54 | var result; |
56 | var result_improved; | 55 | var result_improved; |
57 | var expectedResul; | 56 | var expectedResul; |
58 | 57 | ||
59 | f2m = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:new Clipperz.Crypto.ECC.BinaryField.Value('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425', 16)}) | 58 | f2m = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:new Clipperz.Crypto.ECC.BinaryField.Value('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425', 16)}) |
60 | f2m_improved = Clipperz.Crypto.ECC.StandardCurves.B571().finiteField(); | 59 | f2m_improved = Clipperz.Crypto.ECC.StandardCurves.B571().finiteField(); |
61 | a = new Clipperz.Crypto.ECC.BinaryField.Value("01401ca8 7b8f1446 84a2c58a e9308c23 7789e4bf 1f36dd11 7c150b7d 6076dd1d a6197fe4 c5225a06 4db0e422 2589d5ca 50eb6bb6 b7147a03 f6152843 8a8767c6 a6c4a688 3fd6f067", 16); | 60 | a = new Clipperz.Crypto.ECC.BinaryField.Value("01401ca8 7b8f1446 84a2c58a e9308c23 7789e4bf 1f36dd11 7c150b7d 6076dd1d a6197fe4 c5225a06 4db0e422 2589d5ca 50eb6bb6 b7147a03 f6152843 8a8767c6 a6c4a688 3fd6f067", 16); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.Value.html b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.Value.html index c58cf42..0d0903d 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.Value.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/ECC.BinaryField.Value.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
35 | 34 | ||
36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
38 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> | 37 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC.js'></script>--> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Value.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Point.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/ECC/BinaryField/Curve.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Functions.js'></script> |
44 | </head> | 43 | </head> |
45 | <body> | 44 | <body> |
46 | <pre id="test"> | 45 | <pre id="test"> |
47 | <script type="text/javascript"> | 46 | <script type="text/javascript"> |
48 | try { | 47 | try { |
49 | var value_1; | 48 | var value_1; |
50 | var value_2; | 49 | var value_2; |
51 | 50 | ||
52 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("a", 16); | 51 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("a", 16); |
53 | is(value_1.asString(16), "0a"); | 52 | is(value_1.asString(16), "0a"); |
54 | 53 | ||
55 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("ffff", 16); | 54 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("ffff", 16); |
56 | is(value_1.asString(16), "ffff"); | 55 | is(value_1.asString(16), "ffff"); |
57 | 56 | ||
58 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("7fff", 16); | 57 | value_1 = new Clipperz.Crypto.ECC.BinaryField.Value("7fff", 16); |
59 | is(value_1.asString(16), "7fff"); | 58 | is(value_1.asString(16), "7fff"); |
60 | 59 | ||
61 | is(parseInt("ffff", 16), 65535); | 60 | is(parseInt("ffff", 16), 65535); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/PRNG.html b/frontend/gamma/tests/tests/Clipperz/Crypto/PRNG.html index 438d96f..61aa1c2 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/PRNG.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/PRNG.html | |||
@@ -1,63 +1,62 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script> jslog_config_enabled = true; </script> | 28 | <script> jslog_config_enabled = true; </script> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script> |
41 | 40 | ||
42 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Statistics.js'></script>--> | 41 | <!--<script type='text/javascript' src='../../../../js/Clipperz/Crypto/Statistics.js'></script>--> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
47 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
48 | </head> | 47 | </head> |
49 | <body> | 48 | <body> |
50 | <pre id="test"> | 49 | <pre id="test"> |
51 | <script type="text/javascript"> | 50 | <script type="text/javascript"> |
52 | test_PRNG = function() { | 51 | test_PRNG = function() { |
53 | varrand1, rand2; | 52 | varrand1, rand2; |
54 | var i,c; | 53 | var i,c; |
55 | 54 | ||
56 | c = 10; | 55 | c = 10; |
57 | for (i=0; i<c; i++) { | 56 | for (i=0; i<c; i++) { |
58 | // jslog.debug(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString()); | 57 | // jslog.debug(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString()); |
59 | } | 58 | } |
60 | 59 | ||
61 | rand1 = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(1); | 60 | rand1 = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(1); |
62 | is(rand1.byteAtIndex(0) <= 255, true, "getRandomByte returns always a single byte"); | 61 | is(rand1.byteAtIndex(0) <= 255, true, "getRandomByte returns always a single byte"); |
63 | 62 | ||
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/RSA.html b/frontend/gamma/tests/tests/Clipperz/Crypto/RSA.html index f29f894..4c7fd86 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/RSA.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/RSA.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/DOM.js'></script> |
35 | 34 | ||
36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/RSA.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/RSA.js'></script> |
39 | 38 | ||
40 | </head> | 39 | </head> |
41 | <body> | 40 | <body> |
42 | <pre id="test"> | 41 | <pre id="test"> |
43 | <script type="text/javascript"> | 42 | <script type="text/javascript"> |
44 | try { | 43 | try { |
45 | varrsaPublicKey; | 44 | varrsaPublicKey; |
46 | varrandomValue; | 45 | varrandomValue; |
47 | varpublicEncryptedValue; | 46 | varpublicEncryptedValue; |
48 | var privateEncryptedValue; | 47 | var privateEncryptedValue; |
49 | 48 | ||
50 | varstartTime; | 49 | varstartTime; |
51 | varendTime; | 50 | varendTime; |
52 | 51 | ||
53 | 52 | ||
54 | startTime=new Date(); | 53 | startTime=new Date(); |
55 | rsaPublicKey = Clipperz.Crypto.RSA.generatePublicKey(512); | 54 | rsaPublicKey = Clipperz.Crypto.RSA.generatePublicKey(512); |
56 | 55 | ||
57 | endTime=new Date(); | 56 | endTime=new Date(); |
58 | is(true, true, 'Time to generate the RSA public key (size 512 bit): '+(endTime.getTime()-startTime.getTime())/1000.0); | 57 | is(true, true, 'Time to generate the RSA public key (size 512 bit): '+(endTime.getTime()-startTime.getTime())/1000.0); |
59 | 58 | ||
60 | randomValue = Clipperz.Crypto.Base.generateRandomSeed(); | 59 | randomValue = Clipperz.Crypto.Base.generateRandomSeed(); |
61 | publicEncryptedValue = Clipperz.Crypto.RSA.encryptUsingPublicKey(rsaPublicKey, randomValue); | 60 | publicEncryptedValue = Clipperz.Crypto.RSA.encryptUsingPublicKey(rsaPublicKey, randomValue); |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/SHA.html b/frontend/gamma/tests/tests/Clipperz/Crypto/SHA.html index a580491..a2f6c04 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/SHA.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/SHA.html | |||
@@ -34,65 +34,64 @@ refer to http://www.clipperz.com. | |||
34 | <script type='text/javascript' src='../../../js/JSON/json2.js'></script> | 34 | <script type='text/javascript' src='../../../js/JSON/json2.js'></script> |
35 | 35 | ||
36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> |
42 | 42 | ||
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
44 | 44 | ||
45 | 45 | ||
46 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> | 46 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> |
47 | 47 | ||
48 | </head> | 48 | </head> |
49 | <body> | 49 | <body> |
50 | <pre id="test"> | 50 | <pre id="test"> |
51 | <script type="text/javascript" src="SHA.test.js"></script> | 51 | <script type="text/javascript" src="SHA.test.js"></script> |
52 | </pre> | 52 | </pre> |
53 | </body> | 53 | </body> |
54 | </html> | 54 | </html> |
55 | 55 | ||
56 | 56 | ||
57 | 57 | ||
58 | <!-- html> | 58 | <!-- html> |
59 | <head> | 59 | <head> |
60 | <script> | 60 | <script> |
61 | jslog_config_enabled = true; | 61 | jslog_config_enabled = true; |
62 | clipperz_profiling_enabled = true; | 62 | clipperz_profiling_enabled = true; |
63 | </script> | 63 | </script> |
64 | 64 | ||
65 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 65 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
66 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
67 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 66 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
68 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 67 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
69 | 68 | ||
70 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 69 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
71 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 70 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
72 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 71 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
73 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 72 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
74 | 73 | ||
75 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 74 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
76 | </head> | 75 | </head> |
77 | <body> | 76 | <body> |
78 | <pre id="test"> | 77 | <pre id="test"> |
79 | <script type="text/javascript"> | 78 | <script type="text/javascript"> |
80 | 79 | ||
81 | try { | 80 | try { |
82 | varbyteArray; | 81 | varbyteArray; |
83 | varhash; | 82 | varhash; |
84 | var longText; | 83 | var longText; |
85 | var startTime, endTime; | 84 | var startTime, endTime; |
86 | 85 | ||
87 | longText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec nunc sapien, condimentum vitae, varius vel, pharetra in, augue. Mauris quam magna, pretium sit amet, accumsan id, volutpat lobortis, nibh. Fusce sagittis. Aenean justo. Curabitur euismod pede. Morbi at ante. Proin nisl leo, ultrices sed, facilisis et, nonummy sit amet, lorem. Praesent mauris tellus, pulvinar sed, nonummy vitae, rhoncus non, nunc. Proin placerat malesuada nisl. Nunc id enim. Maecenas commodo enim ac nibh. Sed condimentum, urna sit amet euismod gravida, mi urna varius odio, luctus pretium lectus justo nec felis. Ut in augue et est malesuada rhoncus. Sed vel orci. Mauris suscipit. Praesent cursus velit non turpis. Donec tristique dolor ac est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla est sapien, vulputate eget, bibendum id, pharetra nec, mauris. Aliquam faucibus tincidunt dui. Proin iaculis. Maecenas sagittis. Integer et augue. Donec vitae urna in orci aliquet commodo. Vestibulum lorem sem, suscipit ac, placerat nec, mollis in, felis. Donec laoreet odio a mauris. Integer rutrum, sapien id varius molestie, mauris odio egestas orci, non bibendum sem felis in metus. Phasellus consectetuer lectus adipiscing mauris. Ut magna tellus, euismod ac, suscipit tincidunt, ullamcorper adipiscing, massa. Etiam orci. Phasellus a urna. Cras neque quam, laoreet at, tempus eget, euismod nec, nibh. Etiam hendrerit. Aenean vel lorem. Ut ligula lacus, congue eu, lobortis sit amet, venenatis in, magna. Nullam cursus felis quis est. Sed sem est, condimentum eu, vestibulum a, mattis vel, diam. Curabitur tincidunt pede quis pede. Sed neque diam, convallis vel, luctus at, porta id, nisl. Suspendisse potenti. Sed volutpat lobortis orci. Praesent mi. In interdum. Suspendisse suscipit ipsum eget dolor. Curabitur et tellus sed velit hendrerit varius. Cras sit amet est. Donec arcu nulla, vehicula et, pretium in, placerat id, felis. Integer mollis auctor lectus. Integer ultrices elementum sapien. Nam et erat. Nam pulvinar porta tortor. Nam at risus. Quisque nulla. Integer vestibulum, lacus id bibendum laoreet, ligula mi pharetra lorem, sit amet pharetra felis mauris quis justo. Aliquam ultricies. Duis a pede eget lorem dapibus rhoncus. Aenean eu elit non libero consectetuer viverra. Maecenas velit mi, eleifend vel, malesuada vel, condimentum quis, odio. Mauris tempus augue sed turpis. Pellentesque condimentum, lacus vitae pellentesque ultricies, risus tellus posuere nisi, et dictum turpis pede nec elit. Sed eu lectus eu justo sagittis euismod. Vestibulum lobortis, urna id mollis rhoncus, orci quam euismod ligula, at malesuada lacus magna vitae massa. Phasellus mattis fermentum velit. Nulla vulputate consequat enim. Maecenas quis neque. Curabitur sagittis facilisis neque. In elementum, eros non porttitor rhoncus, libero turpis sodales odio, vitae porta tellus purus et ante. Nullam molestie sollicitudin metus. Donec a elit. Morbi ut lacus. Donec at arcu. Quisque velit diam, interdum a, lacinia at, varius et, odio. Cras neque magna, ornare id, sollicitudin id, consequat a, est. Phasellus vestibulum est at leo. Nam facilisis, nulla dapibus condimentum pellentesque, est magna viverra ligula, at sollicitudin urna augue ut sapien. Fusce justo."; | 86 | longText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec nunc sapien, condimentum vitae, varius vel, pharetra in, augue. Mauris quam magna, pretium sit amet, accumsan id, volutpat lobortis, nibh. Fusce sagittis. Aenean justo. Curabitur euismod pede. Morbi at ante. Proin nisl leo, ultrices sed, facilisis et, nonummy sit amet, lorem. Praesent mauris tellus, pulvinar sed, nonummy vitae, rhoncus non, nunc. Proin placerat malesuada nisl. Nunc id enim. Maecenas commodo enim ac nibh. Sed condimentum, urna sit amet euismod gravida, mi urna varius odio, luctus pretium lectus justo nec felis. Ut in augue et est malesuada rhoncus. Sed vel orci. Mauris suscipit. Praesent cursus velit non turpis. Donec tristique dolor ac est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla est sapien, vulputate eget, bibendum id, pharetra nec, mauris. Aliquam faucibus tincidunt dui. Proin iaculis. Maecenas sagittis. Integer et augue. Donec vitae urna in orci aliquet commodo. Vestibulum lorem sem, suscipit ac, placerat nec, mollis in, felis. Donec laoreet odio a mauris. Integer rutrum, sapien id varius molestie, mauris odio egestas orci, non bibendum sem felis in metus. Phasellus consectetuer lectus adipiscing mauris. Ut magna tellus, euismod ac, suscipit tincidunt, ullamcorper adipiscing, massa. Etiam orci. Phasellus a urna. Cras neque quam, laoreet at, tempus eget, euismod nec, nibh. Etiam hendrerit. Aenean vel lorem. Ut ligula lacus, congue eu, lobortis sit amet, venenatis in, magna. Nullam cursus felis quis est. Sed sem est, condimentum eu, vestibulum a, mattis vel, diam. Curabitur tincidunt pede quis pede. Sed neque diam, convallis vel, luctus at, porta id, nisl. Suspendisse potenti. Sed volutpat lobortis orci. Praesent mi. In interdum. Suspendisse suscipit ipsum eget dolor. Curabitur et tellus sed velit hendrerit varius. Cras sit amet est. Donec arcu nulla, vehicula et, pretium in, placerat id, felis. Integer mollis auctor lectus. Integer ultrices elementum sapien. Nam et erat. Nam pulvinar porta tortor. Nam at risus. Quisque nulla. Integer vestibulum, lacus id bibendum laoreet, ligula mi pharetra lorem, sit amet pharetra felis mauris quis justo. Aliquam ultricies. Duis a pede eget lorem dapibus rhoncus. Aenean eu elit non libero consectetuer viverra. Maecenas velit mi, eleifend vel, malesuada vel, condimentum quis, odio. Mauris tempus augue sed turpis. Pellentesque condimentum, lacus vitae pellentesque ultricies, risus tellus posuere nisi, et dictum turpis pede nec elit. Sed eu lectus eu justo sagittis euismod. Vestibulum lobortis, urna id mollis rhoncus, orci quam euismod ligula, at malesuada lacus magna vitae massa. Phasellus mattis fermentum velit. Nulla vulputate consequat enim. Maecenas quis neque. Curabitur sagittis facilisis neque. In elementum, eros non porttitor rhoncus, libero turpis sodales odio, vitae porta tellus purus et ante. Nullam molestie sollicitudin metus. Donec a elit. Morbi ut lacus. Donec at arcu. Quisque velit diam, interdum a, lacinia at, varius et, odio. Cras neque magna, ornare id, sollicitudin id, consequat a, est. Phasellus vestibulum est at leo. Nam facilisis, nulla dapibus condimentum pellentesque, est magna viverra ligula, at sollicitudin urna augue ut sapien. Fusce justo."; |
88 | 87 | ||
89 | //------------------------------------------------------------------------- | 88 | //------------------------------------------------------------------------- |
90 | // | 89 | // |
91 | //Test of SHA-256 algorithm | 90 | //Test of SHA-256 algorithm |
92 | // | 91 | // |
93 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
94 | 93 | ||
95 | byteArray = new Clipperz.ByteArray(); | 94 | byteArray = new Clipperz.ByteArray(); |
96 | hash = Clipperz.Crypto.SHA.sha256(byteArray); | 95 | hash = Clipperz.Crypto.SHA.sha256(byteArray); |
97 | is(hash.toHexString(), "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "sha256('')"); | 96 | is(hash.toHexString(), "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "sha256('')"); |
98 | 97 | ||
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/SRP.html b/frontend/gamma/tests/tests/Clipperz/Crypto/SRP.html index d0ee153..ba842a9 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/SRP.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/SRP.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 32 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
34 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 33 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
35 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
36 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
37 | 36 | ||
38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> |
44 | </head> | 43 | </head> |
45 | <body> | 44 | <body> |
46 | <pre id="test"> | 45 | <pre id="test"> |
47 | <script type="text/javascript"> | 46 | <script type="text/javascript"> |
48 | hashString = function(aValue) { | 47 | hashString = function(aValue) { |
49 | return Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(aValue)).toHexString().substring(2) | 48 | return Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(aValue)).toHexString().substring(2) |
50 | } | 49 | } |
51 | try { | 50 | try { |
52 | varusername; | 51 | varusername; |
53 | varpassphrase; | 52 | varpassphrase; |
54 | 53 | ||
55 | var C; | 54 | var C; |
56 | var P; | 55 | var P; |
57 | var encryptedText_1; | 56 | var encryptedText_1; |
58 | var encryptedText_2; | 57 | var encryptedText_2; |
59 | varsalt; | 58 | varsalt; |
60 | varx; | 59 | varx; |
61 | var v; | 60 | var v; |
diff --git a/frontend/gamma/tests/tests/Clipperz/Crypto/Usage.html b/frontend/gamma/tests/tests/Clipperz/Crypto/Usage.html index 8920915..4e7ad3d 100644 --- a/frontend/gamma/tests/tests/Clipperz/Crypto/Usage.html +++ b/frontend/gamma/tests/tests/Clipperz/Crypto/Usage.html | |||
@@ -1,63 +1,62 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.Crypto.Usage - TEST</title> | 28 | <title>Clipperz.Crypto.Usage - TEST</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> | 34 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> |
36 | 35 | ||
37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/DomHelper.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
42 | 41 | ||
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
46 | 45 | ||
47 | </head> | 46 | </head> |
48 | <body> | 47 | <body> |
49 | <pre id="test"> | 48 | <pre id="test"> |
50 | <script type="text/javascript"> | 49 | <script type="text/javascript"> |
51 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | 50 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); |
52 | 51 | ||
53 | MochiKit.Base.update(Clipperz, { | 52 | MochiKit.Base.update(Clipperz, { |
54 | 'PM': { | 53 | 'PM': { |
55 | 'Crypto': { | 54 | 'Crypto': { |
56 | 'passwordEntropy': function(aValue) { | 55 | 'passwordEntropy': function(aValue) { |
57 | var result; | 56 | var result; |
58 | varbitPerChar; | 57 | varbitPerChar; |
59 | 58 | ||
60 | bitPerChar = 4; | 59 | bitPerChar = 4; |
61 | if (/[a-z]/.test(aValue)) { | 60 | if (/[a-z]/.test(aValue)) { |
62 | bitPerChar ++; | 61 | bitPerChar ++; |
63 | } | 62 | } |
diff --git a/frontend/gamma/tests/tests/Clipperz/PM/Date.html b/frontend/gamma/tests/tests/Clipperz/PM/Date.html index a606ca4..7b87185 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/Date.html +++ b/frontend/gamma/tests/tests/Clipperz/PM/Date.html | |||
@@ -1,56 +1,55 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.PM.Date - test</title> | 28 | <title>Clipperz.PM.Date - test</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <!-- script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script --> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> | 34 | <script type='text/javascript' src='../../../../js/JSON/json2.js'></script> |
36 | 35 | ||
37 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
41 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> | 40 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> |
42 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> |
43 | 42 | ||
44 | <script type='text/javascript' src='../../../../js/Clipperz/Date.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Date.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Strings.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Strings.js'></script> |
46 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Date.js'></script> | 45 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Date.js'></script> |
47 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> | 46 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> |
48 | 47 | ||
49 | </head> | 48 | </head> |
50 | <body> | 49 | <body> |
51 | <pre id="test"> | 50 | <pre id="test"> |
52 | <script type="text/javascript" src="Date.test.js"></script> | 51 | <script type="text/javascript" src="Date.test.js"></script> |
53 | </pre> | 52 | </pre> |
54 | 53 | ||
55 | </body> | 54 | </body> |
56 | </html> | 55 | </html> |
diff --git a/frontend/gamma/tests/tests/Clipperz/PM/Proxy.html b/frontend/gamma/tests/tests/Clipperz/PM/Proxy.html index 8dc533f..8177285 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/Proxy.html +++ b/frontend/gamma/tests/tests/Clipperz/PM/Proxy.html | |||
@@ -1,62 +1,61 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.PM.Proxy - TEST</title> | 28 | <title>Clipperz.PM.Proxy - TEST</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
36 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> |
41 | 40 | ||
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
47 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> | 46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> |
48 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> | 47 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> |
49 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script> | 48 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Connection.js'></script> |
50 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script> | 49 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Crypto.js'></script> |
51 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script> | 50 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script> |
52 | 51 | ||
53 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> | 52 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Proxy.js'></script> |
54 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> | 53 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> |
55 | 54 | ||
56 | </head> | 55 | </head> |
57 | <body> | 56 | <body> |
58 | <pre id="test"> | 57 | <pre id="test"> |
59 | <script type="text/javascript" src="Proxy.test.js"></script> | 58 | <script type="text/javascript" src="Proxy.test.js"></script> |
60 | </pre> | 59 | </pre> |
61 | </body> | 60 | </body> |
62 | </html> | 61 | </html> |
diff --git a/frontend/gamma/tests/tests/Clipperz/PM/Toll.html b/frontend/gamma/tests/tests/Clipperz/PM/Toll.html index 9baf167..6c2e000 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/Toll.html +++ b/frontend/gamma/tests/tests/Clipperz/PM/Toll.html | |||
@@ -1,59 +1,58 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.PM.Toll - test</title> | 28 | <title>Clipperz.PM.Toll - test</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> | 34 | <script type='text/javascript' src='../../../../js/Clipperz/YUI/Utils.js'></script> |
36 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> | 35 | <script type='text/javascript' src='../../../../js/Clipperz/Base.js'></script> |
37 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> | 36 | <script type='text/javascript' src='../../../../js/Clipperz/ByteArray.js'></script> |
38 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> | 37 | <script type='text/javascript' src='../../../../js/Clipperz/Logging.js'></script> |
39 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> | 38 | <script type='text/javascript' src='../../../../js/Clipperz/Async.js'></script> |
40 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> | 39 | <script type='text/javascript' src='../../../../js/Clipperz/KeyValueObjectStore.js'></script> |
41 | 40 | ||
42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> | 41 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/Base.js'></script> |
43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> | 42 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/BigInt.js'></script> |
44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> | 43 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/AES.js'></script> |
45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> | 44 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SHA.js'></script> |
46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> | 45 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/PRNG.js'></script> |
47 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> | 46 | <script type='text/javascript' src='../../../../js/Clipperz/Crypto/SRP.js'></script> |
48 | 47 | ||
49 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script> | 48 | <script type='text/javascript' src='../../../../js/Clipperz/PM/Toll.js'></script> |
50 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> | 49 | <script type="text/javascript" src="../../../SimpleTest/SimpleTest.Async.js"></script> |
51 | 50 | ||
52 | </head> | 51 | </head> |
53 | <body> | 52 | <body> |
54 | <pre id="test"> | 53 | <pre id="test"> |
55 | <script type="text/javascript" src="Toll.test.js"></script> | 54 | <script type="text/javascript" src="Toll.test.js"></script> |
56 | </pre> | 55 | </pre> |
57 | 56 | ||
58 | </body> | 57 | </body> |
59 | </html> | 58 | </html> |
diff --git a/frontend/gamma/tests/tests/Clipperz/PM/UI/Web/Controllers/MainController.html b/frontend/gamma/tests/tests/Clipperz/PM/UI/Web/Controllers/MainController.html index 04f0e70..1eea01b 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/UI/Web/Controllers/MainController.html +++ b/frontend/gamma/tests/tests/Clipperz/PM/UI/Web/Controllers/MainController.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <title>Clipperz.PM.UI.Web.MainController - test</title> | 28 | <title>Clipperz.PM.UI.Web.MainController - test</title> |
29 | 29 | ||
30 | <script type="text/javascript" src="../../../../../../../js/MochiKit/MochiKit.js"></script> | 30 | <script type="text/javascript" src="../../../../../../../js/MochiKit/MochiKit.js"></script> |
31 | <script type="text/javascript" src="../../../../../../../js/JSLog/jslog.js"></script> | ||
32 | <script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.js"></script> | 31 | <script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.js"></script> |
33 | <link rel="stylesheet" type="text/css" href="../../../../../../SimpleTest/test.css"> | 32 | <link rel="stylesheet" type="text/css" href="../../../../../../SimpleTest/test.css"> |
34 | 33 | ||
35 | <script type='text/javascript' src='../../../../../../../js/Clipperz/YUI/Utils.js'></script> | 34 | <script type='text/javascript' src='../../../../../../../js/Clipperz/YUI/Utils.js'></script> |
36 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Base.js'></script> | 35 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Base.js'></script> |
37 | <script type='text/javascript' src='../../../../../../../js/Clipperz/ByteArray.js'></script> | 36 | <script type='text/javascript' src='../../../../../../../js/Clipperz/ByteArray.js'></script> |
38 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Logging.js'></script> | 37 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Logging.js'></script> |
39 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Async.js'></script> | 38 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Async.js'></script> |
40 | <script type='text/javascript' src='../../../../../../../js/Clipperz/KeyValueObjectStore.js'></script> | 39 | <script type='text/javascript' src='../../../../../../../js/Clipperz/KeyValueObjectStore.js'></script> |
41 | 40 | ||
42 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/Base.js'></script> | 41 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/Base.js'></script> |
43 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/BigInt.js'></script> | 42 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/BigInt.js'></script> |
44 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/AES.js'></script> | 43 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/AES.js'></script> |
45 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SHA.js'></script> | 44 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SHA.js'></script> |
46 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/PRNG.js'></script> | 45 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/PRNG.js'></script> |
47 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SRP.js'></script> | 46 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Crypto/SRP.js'></script> |
48 | 47 | ||
49 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Signal.js'></script> | 48 | <script type='text/javascript' src='../../../../../../../js/Clipperz/Signal.js'></script> |
50 | 49 | ||
51 | <script type='text/javascript' src='../../../../../../../js/Clipperz/PM/UI/Web/Controllers/MainController.js'></script> | 50 | <script type='text/javascript' src='../../../../../../../js/Clipperz/PM/UI/Web/Controllers/MainController.js'></script> |
52 | <script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.Async.js"></script> | 51 | <script type="text/javascript" src="../../../../../../SimpleTest/SimpleTest.Async.js"></script> |
53 | 52 | ||
54 | </head> | 53 | </head> |
55 | <body> | 54 | <body> |
56 | <pre id="test"> | 55 | <pre id="test"> |
57 | <script type="text/javascript" src="MainController.test.js"></script> | 56 | <script type="text/javascript" src="MainController.test.js"></script> |
58 | </pre> | 57 | </pre> |
59 | 58 | ||
60 | </body> | 59 | </body> |
61 | </html> | 60 | </html> |
diff --git a/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html index 87cde0f..b4500e3 100644 --- a/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html +++ b/frontend/gamma/tests/tests/Clipperz/RoboFormExportProcessor.html | |||
@@ -1,61 +1,60 @@ | |||
1 | <!-- | 1 | <!-- |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | --> | 24 | --> |
25 | 25 | ||
26 | <html> | 26 | <html> |
27 | <head> | 27 | <head> |
28 | <script type="text/javascript" src="../../../js/MochiKit/MochiKit.js"></script> | 28 | <script type="text/javascript" src="../../../js/MochiKit/MochiKit.js"></script> |
29 | <script type="text/javascript" src="../../../js/JSLog/jslog.js"></script> | ||
30 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.js"></script> | 29 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.js"></script> |
31 | <link rel="stylesheet" type="text/css" href="../../SimpleTest/test.css"> | 30 | <link rel="stylesheet" type="text/css" href="../../SimpleTest/test.css"> |
32 | 31 | ||
33 | <script type='text/javascript' src='../../../js/Clipperz/YUI/Utils.js'></script> | 32 | <script type='text/javascript' src='../../../js/Clipperz/YUI/Utils.js'></script> |
34 | <script type='text/javascript' src='../../../js/Clipperz/Base.js'></script> | 33 | <script type='text/javascript' src='../../../js/Clipperz/Base.js'></script> |
35 | <script type='text/javascript' src='../../../js/Clipperz/Async.js'></script> | 34 | <script type='text/javascript' src='../../../js/Clipperz/Async.js'></script> |
36 | <script type='text/javascript' src='../../../js/Clipperz/KeePassExportProcessor.js'></script> | 35 | <script type='text/javascript' src='../../../js/Clipperz/KeePassExportProcessor.js'></script> |
37 | 36 | ||
38 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.Async.js"></script> | 37 | <script type="text/javascript" src="../../SimpleTest/SimpleTest.Async.js"></script> |
39 | </head> | 38 | </head> |
40 | <body> | 39 | <body> |
41 | <pre id="test"> | 40 | <pre id="test"> |
42 | <script type="text/javascript"> | 41 | <script type="text/javascript"> |
43 | try { | 42 | try { |
44 | var deferredResult; | 43 | var deferredResult; |
45 | varkeePassProcessor; | 44 | varkeePassProcessor; |
46 | 45 | ||
47 | keePassProcessor = new Clipperz.KeePassExportProcessor(); | 46 | keePassProcessor = new Clipperz.KeePassExportProcessor(); |
48 | 47 | ||
49 | deferredResult = new MochiKit.Async.Deferred(); | 48 | deferredResult = new MochiKit.Async.Deferred(); |
50 | 49 | ||
51 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\n" }); | 50 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\n" }); |
52 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); | 51 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); |
53 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\"}]", "first test"); }); | 52 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\"}]", "first test"); }); |
54 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); | 53 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); |
55 | 54 | ||
56 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); | 55 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); |
57 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); | 56 | deferredResult.addCallback(MochiKit.Base.method(keePassProcessor, 'deferredParse')); |
58 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "second test"); }); | 57 | deferredResult.addCallback(function(aResult) { is(MochiKit.Base.serializeJSON(aResult), "[{\"Title\":\"Gmail\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.gmail.com\", \"Password\":\"NHy08ZCMYsqUeLQCawR7\", \"Notes\":\"Personal account\"}, {\"Title\":\"del.icio.us\", \"Group\":\"General\", \"UserName\":\"joe69\", \"URL\":\"http://del.icio.us\", \"Password\":\"tS1cIEeqp5y0wkU\", \"Notes\":\"social bookmarking site\"}, {\"Title\":\"Amazon\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.amazon.com\", \"Password\":\"wvpkqNPIsqlI5g6XE9Tz\", \"Notes\":\"The US online store\"}, {\"Title\":\"Paypal\", \"Group\":\"General\", \"UserName\":\"joeclipperz\", \"URL\":\"http://www.paypal.com\", \"Password\":\"24T4wIcvHnM28T3L\", \"Notes\":\"Linked to my savings account\"}, {\"Title\":\"Technorati\", \"Group\":\"General\", \"UserName\":\"jclipperz\", \"URL\":\"http://www.technorati.com\", \"Password\":\"UcVeNqF\", \"Notes\":\"Blog ranking and searching\"}, {\"Title\":\"American Airlines\", \"Group\":\"General\", \"UserName\":\"joe.clipperz\", \"URL\":\"http://www.aa.com\", \"Password\":\"AtrYbmi7lmSjR\", \"Notes\":\"Adavantages card n. 795495\"}]", "second test"); }); |
59 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); | 58 | deferredResult.addErrback(function(anError) { is("ERROR", anError) }); |
60 | 59 | ||
61 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\nwith some notes stored\non multiple lines\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); | 60 | deferredResult.addCallback(function(aResult) { return "[Gmail]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.gmail.com\nPassword: NHy08ZCMYsqUeLQCawR7\nNotes: Personal account\nwith some notes stored\non multiple lines\n\n[del.icio.us]\nGroup: General\nUserName: joe69\nURL: http://del.icio.us\nPassword: tS1cIEeqp5y0wkU\nNotes: social bookmarking site\n\n[Amazon]\nGroup: General\nUserName: jclipperz\nURL: http://www.amazon.com\nPassword: wvpkqNPIsqlI5g6XE9Tz\nNotes: The US online store\n\n[Paypal]\nGroup: General\nUserName: joeclipperz\nURL: http://www.paypal.com\nPassword: 24T4wIcvHnM28T3L\nNotes: Linked to my savings account\n\n[Technorati]\nGroup: General\nUserName: jclipperz\nURL: http://www.technorati.com\nPassword: UcVeNqF\nNotes: Blog ranking and searching\n\n[American Airlines]\nGroup: General\nUserName: joe.clipperz\nURL: http://www.aa.com\nPassword: AtrYbmi7lmSjR\nNotes: Adavantages card n. 795495\n" }); |
diff --git a/frontend/gamma/tests/tests/Components/CardDialogNew/index.html b/frontend/gamma/tests/tests/Components/CardDialogNew/index.html index 2d502b4..64f9e4d 100644 --- a/frontend/gamma/tests/tests/Components/CardDialogNew/index.html +++ b/frontend/gamma/tests/tests/Components/CardDialogNew/index.html | |||
@@ -72,43 +72,41 @@ refer to http://www.clipperz.com. | |||
72 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.js'></script> | 72 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.js'></script> |
73 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script> | 73 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script> |
74 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script> | 74 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script> |
75 | 75 | ||
76 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/BaseComponent.js'></script> | 76 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/BaseComponent.js'></script> |
77 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Button.js'></script> | 77 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Button.js'></script> |
78 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ComponentSlot.js'></script> | 78 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ComponentSlot.js'></script> |
79 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js'></script> | 79 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js'></script> |
80 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ProgressBar.js'></script> | 80 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ProgressBar.js'></script> |
81 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js'></script> | 81 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js'></script> |
82 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js'></script> | 82 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js'></script> |
83 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Tooltip.js'></script> | 83 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Tooltip.js'></script> |
84 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js'></script> | 84 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js'></script> |
85 | 85 | ||
86 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js'></script> | 86 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js'></script> |
87 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js'></script> | 87 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js'></script> |
88 | 88 | ||
89 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js'></script> | 89 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js'></script> |
90 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js'></script> | 90 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js'></script> |
91 | 91 | ||
92 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js'></script> | 92 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js'></script> |
93 | 93 | ||
94 | <script type='text/javascript' src='./User.data.js'></script> | 94 | <script type='text/javascript' src='./User.data.js'></script> |
95 | <script type='text/javascript' src='./cardDialogNew_test.js'></script> | 95 | <script type='text/javascript' src='./cardDialogNew_test.js'></script> |
96 | <script> | 96 | <script> |
97 | Clipperz_IEisBroken = false; | 97 | Clipperz_IEisBroken = false; |
98 | </script> | 98 | </script> |
99 | 99 | ||
100 | <!--[if IE]><script> | 100 | <!--[if IE]><script> |
101 | Clipperz_IEisBroken = true; | 101 | Clipperz_IEisBroken = true; |
102 | </script><![endif]--> | 102 | </script><![endif]--> |
103 | 103 | ||
104 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/clipperz.css" /> | 104 | <link rel="stylesheet" type="text/css" href="../../../../css/web.css" /> |
105 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/compact.css" /> | ||
106 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/ytheme-clipperz.css" /> | ||
107 | 105 | ||
108 | </head> | 106 | </head> |
109 | <body> | 107 | <body> |
110 | 108 | ||
111 | <div id="tableWrapper"></div> | 109 | <div id="tableWrapper"></div> |
112 | 110 | ||
113 | </body> | 111 | </body> |
114 | </html> | 112 | </html> |
diff --git a/frontend/gamma/tests/tests/Components/Tooltips/index.html b/frontend/gamma/tests/tests/Components/Tooltips/index.html index 02c6c34..3772227 100644 --- a/frontend/gamma/tests/tests/Components/Tooltips/index.html +++ b/frontend/gamma/tests/tests/Components/Tooltips/index.html | |||
@@ -70,67 +70,65 @@ refer to http://www.clipperz.com. | |||
70 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script> | 70 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/DirectLogin.js'></script> |
71 | <!-- script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/Record.Field.js'></script --> | 71 | <!-- script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/Record.Field.js'></script --> |
72 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.js'></script> | 72 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.js'></script> |
73 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script> | 73 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.Legacy.js'></script> |
74 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script> | 74 | <script type='text/javascript' src='../../../../js/Clipperz/PM/DataModel/User.Header.RecordIndex.js'></script> |
75 | 75 | ||
76 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/BaseComponent.js'></script> | 76 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/BaseComponent.js'></script> |
77 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ComponentSlot.js'></script> | 77 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ComponentSlot.js'></script> |
78 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js'></script> | 78 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js'></script> |
79 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ProgressBar.js'></script> | 79 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/ProgressBar.js'></script> |
80 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js'></script> | 80 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js'></script> |
81 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js'></script> | 81 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js'></script> |
82 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Tooltip.js'></script> | 82 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/Tooltip.js'></script> |
83 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js'></script> | 83 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js'></script> |
84 | 84 | ||
85 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js'></script> | 85 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js'></script> |
86 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js'></script> | 86 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js'></script> |
87 | 87 | ||
88 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js'></script> | 88 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js'></script> |
89 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js'></script> | 89 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js'></script> |
90 | 90 | ||
91 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js'></script> | 91 | <script type='text/javascript' src='../../../../js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js'></script> |
92 | 92 | ||
93 | <script type='text/javascript' src='./tooltips_test.js'></script> | 93 | <script type='text/javascript' src='./tooltips_test.js'></script> |
94 | <script> | 94 | <script> |
95 | Clipperz_IEisBroken = false; | 95 | Clipperz_IEisBroken = false; |
96 | </script> | 96 | </script> |
97 | 97 | ||
98 | <!--[if IE]><script> | 98 | <!--[if IE]><script> |
99 | Clipperz_IEisBroken = true; | 99 | Clipperz_IEisBroken = true; |
100 | </script><![endif]--> | 100 | </script><![endif]--> |
101 | 101 | ||
102 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/clipperz.css" /> | 102 | <link rel="stylesheet" type="text/css" href="../../../../css/web.css" /> |
103 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/compact.css" /> | ||
104 | <link rel="stylesheet" type="text/css" href="../../../../css/clipperz/ytheme-clipperz.css" /> | ||
105 | 103 | ||
106 | <style> | 104 | <style> |
107 | 105 | ||
108 | div.leftColumn { | 106 | div.leftColumn { |
109 | float:left; | 107 | float:left; |
110 | } | 108 | } |
111 | 109 | ||
112 | div.rightColumn { | 110 | div.rightColumn { |
113 | float:left; | 111 | float:left; |
114 | } | 112 | } |
115 | 113 | ||
116 | div.boxWrapper { | 114 | div.boxWrapper { |
117 | padding: 70px 200px; | 115 | padding: 70px 200px; |
118 | } | 116 | } |
119 | 117 | ||
120 | div.box { | 118 | div.box { |
121 | width: 100px; | 119 | width: 100px; |
122 | height: 30px; | 120 | height: 30px; |
123 | border: 1px solid red; | 121 | border: 1px solid red; |
124 | } | 122 | } |
125 | </style> | 123 | </style> |
126 | 124 | ||
127 | </head> | 125 | </head> |
128 | <body> | 126 | <body> |
129 | 127 | ||
130 | <div class="leftColumn"> | 128 | <div class="leftColumn"> |
131 | <div class="boxWrapper"><div id="ABOVE" class="box">above</div></div> | 129 | <div class="boxWrapper"><div id="ABOVE" class="box">above</div></div> |
132 | <div class="boxWrapper"><div id="BELOW" class="box">below</div></div> | 130 | <div class="boxWrapper"><div id="BELOW" class="box">below</div></div> |
133 | </div> | 131 | </div> |
134 | <div class="rightColumn"> | 132 | <div class="rightColumn"> |
135 | <div class="boxWrapper"><div id="LEFT" class="box">left</div></div> | 133 | <div class="boxWrapper"><div id="LEFT" class="box">left</div></div> |
136 | <div class="boxWrapper"><div id="RIGHT" class="box">right</div></div> | 134 | <div class="boxWrapper"><div id="RIGHT" class="box">right</div></div> |