OLD | NEW |
| (Empty) |
1 var COMPILED = !0, goog = goog || {}; | |
2 goog.global = this; | |
3 goog.DEBUG = !0; | |
4 goog.LOCALE = "en"; | |
5 goog.provide = function(a) { | |
6 if(!COMPILED) { | |
7 if(goog.isProvided_(a)) { | |
8 throw Error('Namespace "' + a + '" already declared.'); | |
9 } | |
10 delete goog.implicitNamespaces_[a]; | |
11 for(var b = a;b = b.substring(0, b.lastIndexOf("."));) { | |
12 if(goog.getObjectByName(b)) { | |
13 break | |
14 } | |
15 goog.implicitNamespaces_[b] = !0 | |
16 } | |
17 } | |
18 goog.exportPath_(a) | |
19 }; | |
20 goog.setTestOnly = function(a) { | |
21 if(COMPILED && !goog.DEBUG) { | |
22 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); | |
23 } | |
24 }; | |
25 if(!COMPILED) { | |
26 goog.isProvided_ = function(a) { | |
27 return!goog.implicitNamespaces_[a] && !!goog.getObjectByName(a) | |
28 }, goog.implicitNamespaces_ = {} | |
29 } | |
30 goog.exportPath_ = function(a, b, c) { | |
31 a = a.split("."); | |
32 c = c || goog.global; | |
33 !(a[0] in c) && c.execScript && c.execScript("var " + a[0]); | |
34 for(var d;a.length && (d = a.shift());) { | |
35 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {} | |
36 } | |
37 }; | |
38 goog.getObjectByName = function(a, b) { | |
39 for(var c = a.split("."), d = b || goog.global, e;e = c.shift();) { | |
40 if(goog.isDefAndNotNull(d[e])) { | |
41 d = d[e] | |
42 }else { | |
43 return null | |
44 } | |
45 } | |
46 return d | |
47 }; | |
48 goog.globalize = function(a, b) { | |
49 var c = b || goog.global, d; | |
50 for(d in a) { | |
51 c[d] = a[d] | |
52 } | |
53 }; | |
54 goog.addDependency = function(a, b, c) { | |
55 if(!COMPILED) { | |
56 for(var d, a = a.replace(/\\/g, "/"), e = goog.dependencies_, f = 0;d = b[f]
;f++) { | |
57 e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.path
ToNames[a][d] = !0 | |
58 } | |
59 for(d = 0;b = c[d];d++) { | |
60 a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0 | |
61 } | |
62 } | |
63 }; | |
64 goog.ENABLE_DEBUG_LOADER = !0; | |
65 goog.require = function(a) { | |
66 if(!COMPILED && !goog.isProvided_(a)) { | |
67 if(goog.ENABLE_DEBUG_LOADER) { | |
68 var b = goog.getPathFromDeps_(a); | |
69 if(b) { | |
70 goog.included_[b] = !0; | |
71 goog.writeScripts_(); | |
72 return | |
73 } | |
74 } | |
75 a = "goog.require could not find: " + a; | |
76 goog.global.console && goog.global.console.error(a); | |
77 throw Error(a); | |
78 } | |
79 }; | |
80 goog.basePath = ""; | |
81 goog.nullFunction = function() { | |
82 }; | |
83 goog.identityFunction = function(a) { | |
84 return a | |
85 }; | |
86 goog.abstractMethod = function() { | |
87 throw Error("unimplemented abstract method"); | |
88 }; | |
89 goog.addSingletonGetter = function(a) { | |
90 a.getInstance = function() { | |
91 return a.instance_ || (a.instance_ = new a) | |
92 } | |
93 }; | |
94 if(!COMPILED && goog.ENABLE_DEBUG_LOADER) { | |
95 goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requ
ires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() { | |
96 var a = goog.global.document; | |
97 return typeof a != "undefined" && "write" in a | |
98 }, goog.findBasePath_ = function() { | |
99 if(goog.global.CLOSURE_BASE_PATH) { | |
100 goog.basePath = goog.global.CLOSURE_BASE_PATH | |
101 }else { | |
102 if(goog.inHtmlDocument_()) { | |
103 for(var a = goog.global.document.getElementsByTagName("script"), b = a.l
ength - 1;b >= 0;--b) { | |
104 var c = a[b].src, d = c.lastIndexOf("?"), d = d == -1 ? c.length : d; | |
105 if(c.substr(d - 7, 7) == "base.js") { | |
106 goog.basePath = c.substr(0, d - 7); | |
107 break | |
108 } | |
109 } | |
110 } | |
111 } | |
112 }, goog.importScript_ = function(a) { | |
113 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | |
114 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !
0) | |
115 }, goog.writeScriptTag_ = function(a) { | |
116 return goog.inHtmlDocument_() ? (goog.global.document.write('<script type="t
ext/javascript" src="' + a + '"><\/script>'), !0) : !1 | |
117 }, goog.writeScripts_ = function() { | |
118 function a(e) { | |
119 if(!(e in d.written)) { | |
120 if(!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { | |
121 for(var g in d.requires[e]) { | |
122 if(!goog.isProvided_(g)) { | |
123 if(g in d.nameToPath) { | |
124 a(d.nameToPath[g]) | |
125 }else { | |
126 throw Error("Undefined nameToPath for " + g); | |
127 } | |
128 } | |
129 } | |
130 } | |
131 e in c || (c[e] = !0, b.push(e)) | |
132 } | |
133 } | |
134 var b = [], c = {}, d = goog.dependencies_, e; | |
135 for(e in goog.included_) { | |
136 d.written[e] || a(e) | |
137 } | |
138 for(e = 0;e < b.length;e++) { | |
139 if(b[e]) { | |
140 goog.importScript_(goog.basePath + b[e]) | |
141 }else { | |
142 throw Error("Undefined script input"); | |
143 } | |
144 } | |
145 }, goog.getPathFromDeps_ = function(a) { | |
146 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a]
: null | |
147 }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goo
g.basePath + "deps.js") | |
148 } | |
149 goog.typeOf = function(a) { | |
150 var b = typeof a; | |
151 if(b == "object") { | |
152 if(a) { | |
153 if(a instanceof Array) { | |
154 return"array" | |
155 }else { | |
156 if(a instanceof Object) { | |
157 return b | |
158 } | |
159 } | |
160 var c = Object.prototype.toString.call(a); | |
161 if(c == "[object Window]") { | |
162 return"object" | |
163 } | |
164 if(c == "[object Array]" || typeof a.length == "number" && typeof a.splice
!= "undefined" && typeof a.propertyIsEnumerable != "undefined" && !a.propertyIs
Enumerable("splice")) { | |
165 return"array" | |
166 } | |
167 if(c == "[object Function]" || typeof a.call != "undefined" && typeof a.pr
opertyIsEnumerable != "undefined" && !a.propertyIsEnumerable("call")) { | |
168 return"function" | |
169 } | |
170 }else { | |
171 return"null" | |
172 } | |
173 }else { | |
174 if(b == "function" && typeof a.call == "undefined") { | |
175 return"object" | |
176 } | |
177 } | |
178 return b | |
179 }; | |
180 goog.propertyIsEnumerableCustom_ = function(a, b) { | |
181 if(b in a) { | |
182 for(var c in a) { | |
183 if(c == b && Object.prototype.hasOwnProperty.call(a, b)) { | |
184 return!0 | |
185 } | |
186 } | |
187 } | |
188 return!1 | |
189 }; | |
190 goog.propertyIsEnumerable_ = function(a, b) { | |
191 return a instanceof Object ? Object.prototype.propertyIsEnumerable.call(a, b)
: goog.propertyIsEnumerableCustom_(a, b) | |
192 }; | |
193 goog.isDef = function(a) { | |
194 return a !== void 0 | |
195 }; | |
196 goog.isNull = function(a) { | |
197 return a === null | |
198 }; | |
199 goog.isDefAndNotNull = function(a) { | |
200 return a != null | |
201 }; | |
202 goog.isArray = function(a) { | |
203 return goog.typeOf(a) == "array" | |
204 }; | |
205 goog.isArrayLike = function(a) { | |
206 var b = goog.typeOf(a); | |
207 return b == "array" || b == "object" && typeof a.length == "number" | |
208 }; | |
209 goog.isDateLike = function(a) { | |
210 return goog.isObject(a) && typeof a.getFullYear == "function" | |
211 }; | |
212 goog.isString = function(a) { | |
213 return typeof a == "string" | |
214 }; | |
215 goog.isBoolean = function(a) { | |
216 return typeof a == "boolean" | |
217 }; | |
218 goog.isNumber = function(a) { | |
219 return typeof a == "number" | |
220 }; | |
221 goog.isFunction = function(a) { | |
222 return goog.typeOf(a) == "function" | |
223 }; | |
224 goog.isObject = function(a) { | |
225 a = goog.typeOf(a); | |
226 return a == "object" || a == "array" || a == "function" | |
227 }; | |
228 goog.getUid = function(a) { | |
229 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_) | |
230 }; | |
231 goog.removeUid = function(a) { | |
232 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); | |
233 try { | |
234 delete a[goog.UID_PROPERTY_] | |
235 }catch(b) { | |
236 } | |
237 }; | |
238 goog.UID_PROPERTY_ = "closure_uid_" + Math.floor(Math.random() * 2147483648).toS
tring(36); | |
239 goog.uidCounter_ = 0; | |
240 goog.getHashCode = goog.getUid; | |
241 goog.removeHashCode = goog.removeUid; | |
242 goog.cloneObject = function(a) { | |
243 var b = goog.typeOf(a); | |
244 if(b == "object" || b == "array") { | |
245 if(a.clone) { | |
246 return a.clone() | |
247 } | |
248 var b = b == "array" ? [] : {}, c; | |
249 for(c in a) { | |
250 b[c] = goog.cloneObject(a[c]) | |
251 } | |
252 return b | |
253 } | |
254 return a | |
255 }; | |
256 goog.bindNative_ = function(a, b, c) { | |
257 return a.call.apply(a.bind, arguments) | |
258 }; | |
259 goog.bindJs_ = function(a, b, c) { | |
260 if(!a) { | |
261 throw Error(); | |
262 } | |
263 if(arguments.length > 2) { | |
264 var d = Array.prototype.slice.call(arguments, 2); | |
265 return function() { | |
266 var c = Array.prototype.slice.call(arguments); | |
267 Array.prototype.unshift.apply(c, d); | |
268 return a.apply(b, c) | |
269 } | |
270 }else { | |
271 return function() { | |
272 return a.apply(b, arguments) | |
273 } | |
274 } | |
275 }; | |
276 goog.bind = function(a, b, c) { | |
277 goog.bind = Function.prototype.bind && Function.prototype.bind.toString().inde
xOf("native code") != -1 ? goog.bindNative_ : goog.bindJs_; | |
278 return goog.bind.apply(null, arguments) | |
279 }; | |
280 goog.partial = function(a, b) { | |
281 var c = Array.prototype.slice.call(arguments, 1); | |
282 return function() { | |
283 var b = Array.prototype.slice.call(arguments); | |
284 b.unshift.apply(b, c); | |
285 return a.apply(this, b) | |
286 } | |
287 }; | |
288 goog.mixin = function(a, b) { | |
289 for(var c in b) { | |
290 a[c] = b[c] | |
291 } | |
292 }; | |
293 goog.now = Date.now || function() { | |
294 return+new Date | |
295 }; | |
296 goog.globalEval = function(a) { | |
297 if(goog.global.execScript) { | |
298 goog.global.execScript(a, "JavaScript") | |
299 }else { | |
300 if(goog.global.eval) { | |
301 if(goog.evalWorksForGlobals_ == null) { | |
302 goog.global.eval("var _et_ = 1;"), typeof goog.global._et_ != "undefined
" ? (delete goog.global._et_, goog.evalWorksForGlobals_ = !0) : goog.evalWorksFo
rGlobals_ = !1 | |
303 } | |
304 if(goog.evalWorksForGlobals_) { | |
305 goog.global.eval(a) | |
306 }else { | |
307 var b = goog.global.document, c = b.createElement("script"); | |
308 c.type = "text/javascript"; | |
309 c.defer = !1; | |
310 c.appendChild(b.createTextNode(a)); | |
311 b.body.appendChild(c); | |
312 b.body.removeChild(c) | |
313 } | |
314 }else { | |
315 throw Error("goog.globalEval not available"); | |
316 } | |
317 } | |
318 }; | |
319 goog.evalWorksForGlobals_ = null; | |
320 goog.getCssName = function(a, b) { | |
321 var c = function(a) { | |
322 return goog.cssNameMapping_[a] || a | |
323 }, d; | |
324 d = goog.cssNameMapping_ ? goog.cssNameMappingStyle_ == "BY_WHOLE" ? c : funct
ion(a) { | |
325 for(var a = a.split("-"), b = [], d = 0;d < a.length;d++) { | |
326 b.push(c(a[d])) | |
327 } | |
328 return b.join("-") | |
329 } : function(a) { | |
330 return a | |
331 }; | |
332 return b ? a + "-" + d(b) : d(a) | |
333 }; | |
334 goog.setCssNameMapping = function(a, b) { | |
335 goog.cssNameMapping_ = a; | |
336 goog.cssNameMappingStyle_ = b | |
337 }; | |
338 goog.getMsg = function(a, b) { | |
339 var c = b || {}, d; | |
340 for(d in c) { | |
341 var e = ("" + c[d]).replace(/\$/g, "$$$$"), a = a.replace(RegExp("\\{\\$" +
d + "\\}", "gi"), e) | |
342 } | |
343 return a | |
344 }; | |
345 goog.exportSymbol = function(a, b, c) { | |
346 goog.exportPath_(a, b, c) | |
347 }; | |
348 goog.exportProperty = function(a, b, c) { | |
349 a[b] = c | |
350 }; | |
351 goog.inherits = function(a, b) { | |
352 function c() { | |
353 } | |
354 c.prototype = b.prototype; | |
355 a.superClass_ = b.prototype; | |
356 a.prototype = new c; | |
357 a.prototype.constructor = a | |
358 }; | |
359 goog.base = function(a, b, c) { | |
360 var d = arguments.callee.caller; | |
361 if(d.superClass_) { | |
362 return d.superClass_.constructor.apply(a, Array.prototype.slice.call(argumen
ts, 1)) | |
363 } | |
364 for(var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructo
r;g;g = g.superClass_ && g.superClass_.constructor) { | |
365 if(g.prototype[b] === d) { | |
366 f = !0 | |
367 }else { | |
368 if(f) { | |
369 return g.prototype[b].apply(a, e) | |
370 } | |
371 } | |
372 } | |
373 if(a[b] === d) { | |
374 return a.constructor.prototype[b].apply(a, e) | |
375 }else { | |
376 throw Error("goog.base called from a method of one name to a method of a dif
ferent name"); | |
377 } | |
378 }; | |
379 goog.scope = function(a) { | |
380 a.call(goog.global) | |
381 }; | |
382 goog.debug = {}; | |
383 goog.debug.Error = function(a) { | |
384 this.stack = Error().stack || ""; | |
385 if(a) { | |
386 this.message = String(a) | |
387 } | |
388 }; | |
389 goog.inherits(goog.debug.Error, Error); | |
390 goog.debug.Error.prototype.name = "CustomError"; | |
391 goog.string = {}; | |
392 goog.string.Unicode = {NBSP:"\u00a0"}; | |
393 goog.string.startsWith = function(a, b) { | |
394 return a.lastIndexOf(b, 0) == 0 | |
395 }; | |
396 goog.string.endsWith = function(a, b) { | |
397 var c = a.length - b.length; | |
398 return c >= 0 && a.indexOf(b, c) == c | |
399 }; | |
400 goog.string.caseInsensitiveStartsWith = function(a, b) { | |
401 return goog.string.caseInsensitiveCompare(b, a.substr(0, b.length)) == 0 | |
402 }; | |
403 goog.string.caseInsensitiveEndsWith = function(a, b) { | |
404 return goog.string.caseInsensitiveCompare(b, a.substr(a.length - b.length, b.l
ength)) == 0 | |
405 }; | |
406 goog.string.subs = function(a, b) { | |
407 for(var c = 1;c < arguments.length;c++) { | |
408 var d = String(arguments[c]).replace(/\$/g, "$$$$"), a = a.replace(/\%s/, d) | |
409 } | |
410 return a | |
411 }; | |
412 goog.string.collapseWhitespace = function(a) { | |
413 return a.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "") | |
414 }; | |
415 goog.string.isEmpty = function(a) { | |
416 return/^[\s\xa0]*$/.test(a) | |
417 }; | |
418 goog.string.isEmptySafe = function(a) { | |
419 return goog.string.isEmpty(goog.string.makeSafe(a)) | |
420 }; | |
421 goog.string.isBreakingWhitespace = function(a) { | |
422 return!/[^\t\n\r ]/.test(a) | |
423 }; | |
424 goog.string.isAlpha = function(a) { | |
425 return!/[^a-zA-Z]/.test(a) | |
426 }; | |
427 goog.string.isNumeric = function(a) { | |
428 return!/[^0-9]/.test(a) | |
429 }; | |
430 goog.string.isAlphaNumeric = function(a) { | |
431 return!/[^a-zA-Z0-9]/.test(a) | |
432 }; | |
433 goog.string.isSpace = function(a) { | |
434 return a == " " | |
435 }; | |
436 goog.string.isUnicodeChar = function(a) { | |
437 return a.length == 1 && a >= " " && a <= "~" || a >= "\u0080" && a <= "\ufffd" | |
438 }; | |
439 goog.string.stripNewlines = function(a) { | |
440 return a.replace(/(\r\n|\r|\n)+/g, " ") | |
441 }; | |
442 goog.string.canonicalizeNewlines = function(a) { | |
443 return a.replace(/(\r\n|\r|\n)/g, "\n") | |
444 }; | |
445 goog.string.normalizeWhitespace = function(a) { | |
446 return a.replace(/\xa0|\s/g, " ") | |
447 }; | |
448 goog.string.normalizeSpaces = function(a) { | |
449 return a.replace(/\xa0|[ \t]+/g, " ") | |
450 }; | |
451 goog.string.collapseBreakingSpaces = function(a) { | |
452 return a.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "") | |
453 }; | |
454 goog.string.trim = function(a) { | |
455 return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "") | |
456 }; | |
457 goog.string.trimLeft = function(a) { | |
458 return a.replace(/^[\s\xa0]+/, "") | |
459 }; | |
460 goog.string.trimRight = function(a) { | |
461 return a.replace(/[\s\xa0]+$/, "") | |
462 }; | |
463 goog.string.caseInsensitiveCompare = function(a, b) { | |
464 var c = String(a).toLowerCase(), d = String(b).toLowerCase(); | |
465 return c < d ? -1 : c == d ? 0 : 1 | |
466 }; | |
467 goog.string.numerateCompareRegExp_ = /(\.\d+)|(\d+)|(\D+)/g; | |
468 goog.string.numerateCompare = function(a, b) { | |
469 if(a == b) { | |
470 return 0 | |
471 } | |
472 if(!a) { | |
473 return-1 | |
474 } | |
475 if(!b) { | |
476 return 1 | |
477 } | |
478 for(var c = a.toLowerCase().match(goog.string.numerateCompareRegExp_), d = b.t
oLowerCase().match(goog.string.numerateCompareRegExp_), e = Math.min(c.length, d
.length), f = 0;f < e;f++) { | |
479 var g = c[f], h = d[f]; | |
480 if(g != h) { | |
481 c = parseInt(g, 10); | |
482 return!isNaN(c) && (d = parseInt(h, 10), !isNaN(d) && c - d) ? c - d : g <
h ? -1 : 1 | |
483 } | |
484 } | |
485 return c.length != d.length ? c.length - d.length : a < b ? -1 : 1 | |
486 }; | |
487 goog.string.encodeUriRegExp_ = /^[a-zA-Z0-9\-_.!~*'()]*$/; | |
488 goog.string.urlEncode = function(a) { | |
489 a = String(a); | |
490 return!goog.string.encodeUriRegExp_.test(a) ? encodeURIComponent(a) : a | |
491 }; | |
492 goog.string.urlDecode = function(a) { | |
493 return decodeURIComponent(a.replace(/\+/g, " ")) | |
494 }; | |
495 goog.string.newLineToBr = function(a, b) { | |
496 return a.replace(/(\r\n|\r|\n)/g, b ? "<br />" : "<br>") | |
497 }; | |
498 goog.string.htmlEscape = function(a, b) { | |
499 if(b) { | |
500 return a.replace(goog.string.amperRe_, "&").replace(goog.string.ltRe_, "
<").replace(goog.string.gtRe_, ">").replace(goog.string.quotRe_, """) | |
501 }else { | |
502 if(!goog.string.allRe_.test(a)) { | |
503 return a | |
504 } | |
505 a.indexOf("&") != -1 && (a = a.replace(goog.string.amperRe_, "&")); | |
506 a.indexOf("<") != -1 && (a = a.replace(goog.string.ltRe_, "<")); | |
507 a.indexOf(">") != -1 && (a = a.replace(goog.string.gtRe_, ">")); | |
508 a.indexOf('"') != -1 && (a = a.replace(goog.string.quotRe_, """)); | |
509 return a | |
510 } | |
511 }; | |
512 goog.string.amperRe_ = /&/g; | |
513 goog.string.ltRe_ = /</g; | |
514 goog.string.gtRe_ = />/g; | |
515 goog.string.quotRe_ = /\"/g; | |
516 goog.string.allRe_ = /[&<>\"]/; | |
517 goog.string.unescapeEntities = function(a) { | |
518 return goog.string.contains(a, "&") ? "document" in goog.global ? goog.string.
unescapeEntitiesUsingDom_(a) : goog.string.unescapePureXmlEntities_(a) : a | |
519 }; | |
520 goog.string.unescapeEntitiesUsingDom_ = function(a) { | |
521 var b = {"&":"&", "<":"<", ">":">", """:'"'}, c = document.crea
teElement("div"); | |
522 return a.replace(goog.string.HTML_ENTITY_PATTERN_, function(a, e) { | |
523 var f = b[a]; | |
524 if(f) { | |
525 return f | |
526 } | |
527 if(e.charAt(0) == "#") { | |
528 var g = Number("0" + e.substr(1)); | |
529 isNaN(g) || (f = String.fromCharCode(g)) | |
530 } | |
531 if(!f) { | |
532 c.innerHTML = a + " ", f = c.firstChild.nodeValue.slice(0, -1) | |
533 } | |
534 return b[a] = f | |
535 }) | |
536 }; | |
537 goog.string.unescapePureXmlEntities_ = function(a) { | |
538 return a.replace(/&([^;]+);/g, function(a, c) { | |
539 switch(c) { | |
540 case "amp": | |
541 return"&"; | |
542 case "lt": | |
543 return"<"; | |
544 case "gt": | |
545 return">"; | |
546 case "quot": | |
547 return'"'; | |
548 default: | |
549 if(c.charAt(0) == "#") { | |
550 var d = Number("0" + c.substr(1)); | |
551 if(!isNaN(d)) { | |
552 return String.fromCharCode(d) | |
553 } | |
554 } | |
555 return a | |
556 } | |
557 }) | |
558 }; | |
559 goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; | |
560 goog.string.whitespaceEscape = function(a, b) { | |
561 return goog.string.newLineToBr(a.replace(/ /g, "  "), b) | |
562 }; | |
563 goog.string.stripQuotes = function(a, b) { | |
564 for(var c = b.length, d = 0;d < c;d++) { | |
565 var e = c == 1 ? b : b.charAt(d); | |
566 if(a.charAt(0) == e && a.charAt(a.length - 1) == e) { | |
567 return a.substring(1, a.length - 1) | |
568 } | |
569 } | |
570 return a | |
571 }; | |
572 goog.string.truncate = function(a, b, c) { | |
573 c && (a = goog.string.unescapeEntities(a)); | |
574 a.length > b && (a = a.substring(0, b - 3) + "..."); | |
575 c && (a = goog.string.htmlEscape(a)); | |
576 return a | |
577 }; | |
578 goog.string.truncateMiddle = function(a, b, c, d) { | |
579 c && (a = goog.string.unescapeEntities(a)); | |
580 if(d && a.length > b) { | |
581 d > b && (d = b); | |
582 var e = a.length - d, a = a.substring(0, b - d) + "..." + a.substring(e) | |
583 }else { | |
584 a.length > b && (d = Math.floor(b / 2), e = a.length - d, d += b % 2, a = a.
substring(0, d) + "..." + a.substring(e)) | |
585 } | |
586 c && (a = goog.string.htmlEscape(a)); | |
587 return a | |
588 }; | |
589 goog.string.specialEscapeChars_ = {"\x00":"\\0", "\u0008":"\\b", "\u000c":"\\f",
"\n":"\\n", "\r":"\\r", "\t":"\\t", "\u000b":"\\x0B", '"':'\\"', "\\":"\\\\"}; | |
590 goog.string.jsEscapeCache_ = {"'":"\\'"}; | |
591 goog.string.quote = function(a) { | |
592 a = String(a); | |
593 if(a.quote) { | |
594 return a.quote() | |
595 }else { | |
596 for(var b = ['"'], c = 0;c < a.length;c++) { | |
597 var d = a.charAt(c), e = d.charCodeAt(0); | |
598 b[c + 1] = goog.string.specialEscapeChars_[d] || (e > 31 && e < 127 ? d :
goog.string.escapeChar(d)) | |
599 } | |
600 b.push('"'); | |
601 return b.join("") | |
602 } | |
603 }; | |
604 goog.string.escapeString = function(a) { | |
605 for(var b = [], c = 0;c < a.length;c++) { | |
606 b[c] = goog.string.escapeChar(a.charAt(c)) | |
607 } | |
608 return b.join("") | |
609 }; | |
610 goog.string.escapeChar = function(a) { | |
611 if(a in goog.string.jsEscapeCache_) { | |
612 return goog.string.jsEscapeCache_[a] | |
613 } | |
614 if(a in goog.string.specialEscapeChars_) { | |
615 return goog.string.jsEscapeCache_[a] = goog.string.specialEscapeChars_[a] | |
616 } | |
617 var b = a, c = a.charCodeAt(0); | |
618 if(c > 31 && c < 127) { | |
619 b = a | |
620 }else { | |
621 if(c < 256) { | |
622 if(b = "\\x", c < 16 || c > 256) { | |
623 b += "0" | |
624 } | |
625 }else { | |
626 b = "\\u", c < 4096 && (b += "0") | |
627 } | |
628 b += c.toString(16).toUpperCase() | |
629 } | |
630 return goog.string.jsEscapeCache_[a] = b | |
631 }; | |
632 goog.string.toMap = function(a) { | |
633 for(var b = {}, c = 0;c < a.length;c++) { | |
634 b[a.charAt(c)] = !0 | |
635 } | |
636 return b | |
637 }; | |
638 goog.string.contains = function(a, b) { | |
639 return a.indexOf(b) != -1 | |
640 }; | |
641 goog.string.removeAt = function(a, b, c) { | |
642 var d = a; | |
643 b >= 0 && b < a.length && c > 0 && (d = a.substr(0, b) + a.substr(b + c, a.len
gth - b - c)); | |
644 return d | |
645 }; | |
646 goog.string.remove = function(a, b) { | |
647 var c = RegExp(goog.string.regExpEscape(b), ""); | |
648 return a.replace(c, "") | |
649 }; | |
650 goog.string.removeAll = function(a, b) { | |
651 var c = RegExp(goog.string.regExpEscape(b), "g"); | |
652 return a.replace(c, "") | |
653 }; | |
654 goog.string.regExpEscape = function(a) { | |
655 return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x0
8/g, "\\x08") | |
656 }; | |
657 goog.string.repeat = function(a, b) { | |
658 return Array(b + 1).join(a) | |
659 }; | |
660 goog.string.padNumber = function(a, b, c) { | |
661 a = goog.isDef(c) ? a.toFixed(c) : String(a); | |
662 c = a.indexOf("."); | |
663 if(c == -1) { | |
664 c = a.length | |
665 } | |
666 return goog.string.repeat("0", Math.max(0, b - c)) + a | |
667 }; | |
668 goog.string.makeSafe = function(a) { | |
669 return a == null ? "" : String(a) | |
670 }; | |
671 goog.string.buildString = function(a) { | |
672 return Array.prototype.join.call(arguments, "") | |
673 }; | |
674 goog.string.getRandomString = function() { | |
675 return Math.floor(Math.random() * 2147483648).toString(36) + Math.abs(Math.flo
or(Math.random() * 2147483648) ^ goog.now()).toString(36) | |
676 }; | |
677 goog.string.compareVersions = function(a, b) { | |
678 for(var c = 0, d = goog.string.trim(String(a)).split("."), e = goog.string.tri
m(String(b)).split("."), f = Math.max(d.length, e.length), g = 0;c == 0 && g < f
;g++) { | |
679 var h = d[g] || "", i = e[g] || "", j = RegExp("(\\d*)(\\D*)", "g"), k = Reg
Exp("(\\d*)(\\D*)", "g"); | |
680 do { | |
681 var m = j.exec(h) || ["", "", ""], l = k.exec(i) || ["", "", ""]; | |
682 if(m[0].length == 0 && l[0].length == 0) { | |
683 break | |
684 } | |
685 var c = m[1].length == 0 ? 0 : parseInt(m[1], 10), n = l[1].length == 0 ?
0 : parseInt(l[1], 10), c = goog.string.compareElements_(c, n) || goog.string.co
mpareElements_(m[2].length == 0, l[2].length == 0) || goog.string.compareElement
s_(m[2], l[2]) | |
686 }while(c == 0) | |
687 } | |
688 return c | |
689 }; | |
690 goog.string.compareElements_ = function(a, b) { | |
691 if(a < b) { | |
692 return-1 | |
693 }else { | |
694 if(a > b) { | |
695 return 1 | |
696 } | |
697 } | |
698 return 0 | |
699 }; | |
700 goog.string.HASHCODE_MAX_ = 4294967296; | |
701 goog.string.hashCode = function(a) { | |
702 for(var b = 0, c = 0;c < a.length;++c) { | |
703 b = 31 * b + a.charCodeAt(c), b %= goog.string.HASHCODE_MAX_ | |
704 } | |
705 return b | |
706 }; | |
707 goog.string.uniqueStringCounter_ = Math.random() * 2147483648 | 0; | |
708 goog.string.createUniqueString = function() { | |
709 return"goog_" + goog.string.uniqueStringCounter_++ | |
710 }; | |
711 goog.string.toNumber = function(a) { | |
712 var b = Number(a); | |
713 return b == 0 && goog.string.isEmpty(a) ? NaN : b | |
714 }; | |
715 goog.string.toCamelCaseCache_ = {}; | |
716 goog.string.toCamelCase = function(a) { | |
717 return goog.string.toCamelCaseCache_[a] || (goog.string.toCamelCaseCache_[a] =
String(a).replace(/\-([a-z])/g, function(a, c) { | |
718 return c.toUpperCase() | |
719 })) | |
720 }; | |
721 goog.string.toSelectorCaseCache_ = {}; | |
722 goog.string.toSelectorCase = function(a) { | |
723 return goog.string.toSelectorCaseCache_[a] || (goog.string.toSelectorCaseCache
_[a] = String(a).replace(/([A-Z])/g, "-$1").toLowerCase()) | |
724 }; | |
725 goog.asserts = {}; | |
726 goog.asserts.ENABLE_ASSERTS = goog.DEBUG; | |
727 goog.asserts.AssertionError = function(a, b) { | |
728 b.unshift(a); | |
729 goog.debug.Error.call(this, goog.string.subs.apply(null, b)); | |
730 b.shift(); | |
731 this.messagePattern = a | |
732 }; | |
733 goog.inherits(goog.asserts.AssertionError, goog.debug.Error); | |
734 goog.asserts.AssertionError.prototype.name = "AssertionError"; | |
735 goog.asserts.doAssertFailure_ = function(a, b, c, d) { | |
736 var e = "Assertion failed"; | |
737 if(c) { | |
738 e += ": " + c; | |
739 var f = d | |
740 }else { | |
741 a && (e += ": " + a, f = b) | |
742 } | |
743 throw new goog.asserts.AssertionError("" + e, f || []); | |
744 }; | |
745 goog.asserts.assert = function(a, b, c) { | |
746 goog.asserts.ENABLE_ASSERTS && !a && goog.asserts.doAssertFailure_("", null, b
, Array.prototype.slice.call(arguments, 2)); | |
747 return a | |
748 }; | |
749 goog.asserts.fail = function(a, b) { | |
750 if(goog.asserts.ENABLE_ASSERTS) { | |
751 throw new goog.asserts.AssertionError("Failure" + (a ? ": " + a : ""), Array
.prototype.slice.call(arguments, 1)); | |
752 } | |
753 }; | |
754 goog.asserts.assertNumber = function(a, b, c) { | |
755 goog.asserts.ENABLE_ASSERTS && !goog.isNumber(a) && goog.asserts.doAssertFailu
re_("Expected number but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.s
lice.call(arguments, 2)); | |
756 return a | |
757 }; | |
758 goog.asserts.assertString = function(a, b, c) { | |
759 goog.asserts.ENABLE_ASSERTS && !goog.isString(a) && goog.asserts.doAssertFailu
re_("Expected string but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.s
lice.call(arguments, 2)); | |
760 return a | |
761 }; | |
762 goog.asserts.assertFunction = function(a, b, c) { | |
763 goog.asserts.ENABLE_ASSERTS && !goog.isFunction(a) && goog.asserts.doAssertFai
lure_("Expected function but got %s: %s.", [goog.typeOf(a), a], b, Array.prototy
pe.slice.call(arguments, 2)); | |
764 return a | |
765 }; | |
766 goog.asserts.assertObject = function(a, b, c) { | |
767 goog.asserts.ENABLE_ASSERTS && !goog.isObject(a) && goog.asserts.doAssertFailu
re_("Expected object but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.s
lice.call(arguments, 2)); | |
768 return a | |
769 }; | |
770 goog.asserts.assertArray = function(a, b, c) { | |
771 goog.asserts.ENABLE_ASSERTS && !goog.isArray(a) && goog.asserts.doAssertFailur
e_("Expected array but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.sli
ce.call(arguments, 2)); | |
772 return a | |
773 }; | |
774 goog.asserts.assertBoolean = function(a, b, c) { | |
775 goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(a) && goog.asserts.doAssertFail
ure_("Expected boolean but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype
.slice.call(arguments, 2)); | |
776 return a | |
777 }; | |
778 goog.asserts.assertInstanceof = function(a, b, c, d) { | |
779 goog.asserts.ENABLE_ASSERTS && !(a instanceof b) && goog.asserts.doAssertFailu
re_("instanceof check failed.", null, c, Array.prototype.slice.call(arguments, 3
)) | |
780 }; | |
781 goog.array = {}; | |
782 goog.NATIVE_ARRAY_PROTOTYPES = !0; | |
783 goog.array.peek = function(a) { | |
784 return a[a.length - 1] | |
785 }; | |
786 goog.array.ARRAY_PROTOTYPE_ = Array.prototype; | |
787 goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_
.indexOf ? function(a, b, c) { | |
788 goog.asserts.assert(a.length != null); | |
789 return goog.array.ARRAY_PROTOTYPE_.indexOf.call(a, b, c) | |
790 } : function(a, b, c) { | |
791 c = c == null ? 0 : c < 0 ? Math.max(0, a.length + c) : c; | |
792 if(goog.isString(a)) { | |
793 return!goog.isString(b) || b.length != 1 ? -1 : a.indexOf(b, c) | |
794 } | |
795 for(;c < a.length;c++) { | |
796 if(c in a && a[c] === b) { | |
797 return c | |
798 } | |
799 } | |
800 return-1 | |
801 }; | |
802 goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOT
YPE_.lastIndexOf ? function(a, b, c) { | |
803 goog.asserts.assert(a.length != null); | |
804 return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(a, b, c == null ? a.length
- 1 : c) | |
805 } : function(a, b, c) { | |
806 c = c == null ? a.length - 1 : c; | |
807 c < 0 && (c = Math.max(0, a.length + c)); | |
808 if(goog.isString(a)) { | |
809 return!goog.isString(b) || b.length != 1 ? -1 : a.lastIndexOf(b, c) | |
810 } | |
811 for(;c >= 0;c--) { | |
812 if(c in a && a[c] === b) { | |
813 return c | |
814 } | |
815 } | |
816 return-1 | |
817 }; | |
818 goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_
.forEach ? function(a, b, c) { | |
819 goog.asserts.assert(a.length != null); | |
820 goog.array.ARRAY_PROTOTYPE_.forEach.call(a, b, c) | |
821 } : function(a, b, c) { | |
822 for(var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0;f < d;f++)
{ | |
823 f in e && b.call(c, e[f], f, a) | |
824 } | |
825 }; | |
826 goog.array.forEachRight = function(a, b, c) { | |
827 var d = a.length, e = goog.isString(a) ? a.split("") : a; | |
828 for(d -= 1;d >= 0;--d) { | |
829 d in e && b.call(c, e[d], d, a) | |
830 } | |
831 }; | |
832 goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_.
filter ? function(a, b, c) { | |
833 goog.asserts.assert(a.length != null); | |
834 return goog.array.ARRAY_PROTOTYPE_.filter.call(a, b, c) | |
835 } : function(a, b, c) { | |
836 for(var d = a.length, e = [], f = 0, g = goog.isString(a) ? a.split("") : a, h
= 0;h < d;h++) { | |
837 if(h in g) { | |
838 var i = g[h]; | |
839 b.call(c, i, h, a) && (e[f++] = i) | |
840 } | |
841 } | |
842 return e | |
843 }; | |
844 goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_.map
? function(a, b, c) { | |
845 goog.asserts.assert(a.length != null); | |
846 return goog.array.ARRAY_PROTOTYPE_.map.call(a, b, c) | |
847 } : function(a, b, c) { | |
848 for(var d = a.length, e = Array(d), f = goog.isString(a) ? a.split("") : a, g
= 0;g < d;g++) { | |
849 g in f && (e[g] = b.call(c, f[g], g, a)) | |
850 } | |
851 return e | |
852 }; | |
853 goog.array.reduce = function(a, b, c, d) { | |
854 if(a.reduce) { | |
855 return d ? a.reduce(goog.bind(b, d), c) : a.reduce(b, c) | |
856 } | |
857 var e = c; | |
858 goog.array.forEach(a, function(c, g) { | |
859 e = b.call(d, e, c, g, a) | |
860 }); | |
861 return e | |
862 }; | |
863 goog.array.reduceRight = function(a, b, c, d) { | |
864 if(a.reduceRight) { | |
865 return d ? a.reduceRight(goog.bind(b, d), c) : a.reduceRight(b, c) | |
866 } | |
867 var e = c; | |
868 goog.array.forEachRight(a, function(c, g) { | |
869 e = b.call(d, e, c, g, a) | |
870 }); | |
871 return e | |
872 }; | |
873 goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_.so
me ? function(a, b, c) { | |
874 goog.asserts.assert(a.length != null); | |
875 return goog.array.ARRAY_PROTOTYPE_.some.call(a, b, c) | |
876 } : function(a, b, c) { | |
877 for(var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0;f < d;f++)
{ | |
878 if(f in e && b.call(c, e[f], f, a)) { | |
879 return!0 | |
880 } | |
881 } | |
882 return!1 | |
883 }; | |
884 goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && goog.array.ARRAY_PROTOTYPE_.e
very ? function(a, b, c) { | |
885 goog.asserts.assert(a.length != null); | |
886 return goog.array.ARRAY_PROTOTYPE_.every.call(a, b, c) | |
887 } : function(a, b, c) { | |
888 for(var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0;f < d;f++)
{ | |
889 if(f in e && !b.call(c, e[f], f, a)) { | |
890 return!1 | |
891 } | |
892 } | |
893 return!0 | |
894 }; | |
895 goog.array.find = function(a, b, c) { | |
896 b = goog.array.findIndex(a, b, c); | |
897 return b < 0 ? null : goog.isString(a) ? a.charAt(b) : a[b] | |
898 }; | |
899 goog.array.findIndex = function(a, b, c) { | |
900 for(var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0;f < d;f++)
{ | |
901 if(f in e && b.call(c, e[f], f, a)) { | |
902 return f | |
903 } | |
904 } | |
905 return-1 | |
906 }; | |
907 goog.array.findRight = function(a, b, c) { | |
908 b = goog.array.findIndexRight(a, b, c); | |
909 return b < 0 ? null : goog.isString(a) ? a.charAt(b) : a[b] | |
910 }; | |
911 goog.array.findIndexRight = function(a, b, c) { | |
912 var d = a.length, e = goog.isString(a) ? a.split("") : a; | |
913 for(d -= 1;d >= 0;d--) { | |
914 if(d in e && b.call(c, e[d], d, a)) { | |
915 return d | |
916 } | |
917 } | |
918 return-1 | |
919 }; | |
920 goog.array.contains = function(a, b) { | |
921 return goog.array.indexOf(a, b) >= 0 | |
922 }; | |
923 goog.array.isEmpty = function(a) { | |
924 return a.length == 0 | |
925 }; | |
926 goog.array.clear = function(a) { | |
927 if(!goog.isArray(a)) { | |
928 for(var b = a.length - 1;b >= 0;b--) { | |
929 delete a[b] | |
930 } | |
931 } | |
932 a.length = 0 | |
933 }; | |
934 goog.array.insert = function(a, b) { | |
935 goog.array.contains(a, b) || a.push(b) | |
936 }; | |
937 goog.array.insertAt = function(a, b, c) { | |
938 goog.array.splice(a, c, 0, b) | |
939 }; | |
940 goog.array.insertArrayAt = function(a, b, c) { | |
941 goog.partial(goog.array.splice, a, c, 0).apply(null, b) | |
942 }; | |
943 goog.array.insertBefore = function(a, b, c) { | |
944 var d; | |
945 arguments.length == 2 || (d = goog.array.indexOf(a, c)) < 0 ? a.push(b) : goog
.array.insertAt(a, b, d) | |
946 }; | |
947 goog.array.remove = function(a, b) { | |
948 var c = goog.array.indexOf(a, b), d; | |
949 (d = c >= 0) && goog.array.removeAt(a, c); | |
950 return d | |
951 }; | |
952 goog.array.removeAt = function(a, b) { | |
953 goog.asserts.assert(a.length != null); | |
954 return goog.array.ARRAY_PROTOTYPE_.splice.call(a, b, 1).length == 1 | |
955 }; | |
956 goog.array.removeIf = function(a, b, c) { | |
957 b = goog.array.findIndex(a, b, c); | |
958 return b >= 0 ? (goog.array.removeAt(a, b), !0) : !1 | |
959 }; | |
960 goog.array.concat = function(a) { | |
961 return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, a
rguments) | |
962 }; | |
963 goog.array.clone = function(a) { | |
964 if(goog.isArray(a)) { | |
965 return goog.array.concat(a) | |
966 }else { | |
967 for(var b = [], c = 0, d = a.length;c < d;c++) { | |
968 b[c] = a[c] | |
969 } | |
970 return b | |
971 } | |
972 }; | |
973 goog.array.toArray = function(a) { | |
974 return goog.isArray(a) ? goog.array.concat(a) : goog.array.clone(a) | |
975 }; | |
976 goog.array.extend = function(a, b) { | |
977 for(var c = 1;c < arguments.length;c++) { | |
978 var d = arguments[c], e; | |
979 if(goog.isArray(d) || (e = goog.isArrayLike(d)) && d.hasOwnProperty("callee"
)) { | |
980 a.push.apply(a, d) | |
981 }else { | |
982 if(e) { | |
983 for(var f = a.length, g = d.length, h = 0;h < g;h++) { | |
984 a[f + h] = d[h] | |
985 } | |
986 }else { | |
987 a.push(d) | |
988 } | |
989 } | |
990 } | |
991 }; | |
992 goog.array.splice = function(a, b, c, d) { | |
993 goog.asserts.assert(a.length != null); | |
994 return goog.array.ARRAY_PROTOTYPE_.splice.apply(a, goog.array.slice(arguments,
1)) | |
995 }; | |
996 goog.array.slice = function(a, b, c) { | |
997 goog.asserts.assert(a.length != null); | |
998 return arguments.length <= 2 ? goog.array.ARRAY_PROTOTYPE_.slice.call(a, b) :
goog.array.ARRAY_PROTOTYPE_.slice.call(a, b, c) | |
999 }; | |
1000 goog.array.removeDuplicates = function(a, b) { | |
1001 for(var c = b || a, d = {}, e = 0, f = 0;f < a.length;) { | |
1002 var g = a[f++], h = goog.isObject(g) ? "o" + goog.getUid(g) : (typeof g).cha
rAt(0) + g; | |
1003 Object.prototype.hasOwnProperty.call(d, h) || (d[h] = !0, c[e++] = g) | |
1004 } | |
1005 c.length = e | |
1006 }; | |
1007 goog.array.binarySearch = function(a, b, c) { | |
1008 return goog.array.binarySearch_(a, c || goog.array.defaultCompare, !1, b) | |
1009 }; | |
1010 goog.array.binarySelect = function(a, b, c) { | |
1011 return goog.array.binarySearch_(a, b, !0, void 0, c) | |
1012 }; | |
1013 goog.array.binarySearch_ = function(a, b, c, d, e) { | |
1014 for(var f = 0, g = a.length, h;f < g;) { | |
1015 var i = f + g >> 1, j; | |
1016 j = c ? b.call(e, a[i], i, a) : b(d, a[i]); | |
1017 j > 0 ? f = i + 1 : (g = i, h = !j) | |
1018 } | |
1019 return h ? f : ~f | |
1020 }; | |
1021 goog.array.sort = function(a, b) { | |
1022 goog.asserts.assert(a.length != null); | |
1023 goog.array.ARRAY_PROTOTYPE_.sort.call(a, b || goog.array.defaultCompare) | |
1024 }; | |
1025 goog.array.stableSort = function(a, b) { | |
1026 for(var c = 0;c < a.length;c++) { | |
1027 a[c] = {index:c, value:a[c]} | |
1028 } | |
1029 var d = b || goog.array.defaultCompare; | |
1030 goog.array.sort(a, function(a, b) { | |
1031 return d(a.value, b.value) || a.index - b.index | |
1032 }); | |
1033 for(c = 0;c < a.length;c++) { | |
1034 a[c] = a[c].value | |
1035 } | |
1036 }; | |
1037 goog.array.sortObjectsByKey = function(a, b, c) { | |
1038 var d = c || goog.array.defaultCompare; | |
1039 goog.array.sort(a, function(a, c) { | |
1040 return d(a[b], c[b]) | |
1041 }) | |
1042 }; | |
1043 goog.array.isSorted = function(a, b, c) { | |
1044 for(var b = b || goog.array.defaultCompare, d = 1;d < a.length;d++) { | |
1045 var e = b(a[d - 1], a[d]); | |
1046 if(e > 0 || e == 0 && c) { | |
1047 return!1 | |
1048 } | |
1049 } | |
1050 return!0 | |
1051 }; | |
1052 goog.array.equals = function(a, b, c) { | |
1053 if(!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length) { | |
1054 return!1 | |
1055 } | |
1056 for(var d = a.length, c = c || goog.array.defaultCompareEquality, e = 0;e < d;
e++) { | |
1057 if(!c(a[e], b[e])) { | |
1058 return!1 | |
1059 } | |
1060 } | |
1061 return!0 | |
1062 }; | |
1063 goog.array.compare = function(a, b, c) { | |
1064 return goog.array.equals(a, b, c) | |
1065 }; | |
1066 goog.array.compare3 = function(a, b, c) { | |
1067 for(var c = c || goog.array.defaultCompare, d = Math.min(a.length, b.length),
e = 0;e < d;e++) { | |
1068 var f = c(a[e], b[e]); | |
1069 if(f != 0) { | |
1070 return f | |
1071 } | |
1072 } | |
1073 return goog.array.defaultCompare(a.length, b.length) | |
1074 }; | |
1075 goog.array.defaultCompare = function(a, b) { | |
1076 return a > b ? 1 : a < b ? -1 : 0 | |
1077 }; | |
1078 goog.array.defaultCompareEquality = function(a, b) { | |
1079 return a === b | |
1080 }; | |
1081 goog.array.binaryInsert = function(a, b, c) { | |
1082 c = goog.array.binarySearch(a, b, c); | |
1083 return c < 0 ? (goog.array.insertAt(a, b, -(c + 1)), !0) : !1 | |
1084 }; | |
1085 goog.array.binaryRemove = function(a, b, c) { | |
1086 b = goog.array.binarySearch(a, b, c); | |
1087 return b >= 0 ? goog.array.removeAt(a, b) : !1 | |
1088 }; | |
1089 goog.array.bucket = function(a, b) { | |
1090 for(var c = {}, d = 0;d < a.length;d++) { | |
1091 var e = a[d], f = b(e, d, a); | |
1092 goog.isDef(f) && (c[f] || (c[f] = [])).push(e) | |
1093 } | |
1094 return c | |
1095 }; | |
1096 goog.array.repeat = function(a, b) { | |
1097 for(var c = [], d = 0;d < b;d++) { | |
1098 c[d] = a | |
1099 } | |
1100 return c | |
1101 }; | |
1102 goog.array.flatten = function(a) { | |
1103 for(var b = [], c = 0;c < arguments.length;c++) { | |
1104 var d = arguments[c]; | |
1105 goog.isArray(d) ? b.push.apply(b, goog.array.flatten.apply(null, d)) : b.pus
h(d) | |
1106 } | |
1107 return b | |
1108 }; | |
1109 goog.array.rotate = function(a, b) { | |
1110 goog.asserts.assert(a.length != null); | |
1111 a.length && (b %= a.length, b > 0 ? goog.array.ARRAY_PROTOTYPE_.unshift.apply(
a, a.splice(-b, b)) : b < 0 && goog.array.ARRAY_PROTOTYPE_.push.apply(a, a.splic
e(0, -b))); | |
1112 return a | |
1113 }; | |
1114 goog.array.zip = function(a) { | |
1115 if(!arguments.length) { | |
1116 return[] | |
1117 } | |
1118 for(var b = [], c = 0;;c++) { | |
1119 for(var d = [], e = 0;e < arguments.length;e++) { | |
1120 var f = arguments[e]; | |
1121 if(c >= f.length) { | |
1122 return b | |
1123 } | |
1124 d.push(f[c]) | |
1125 } | |
1126 b.push(d) | |
1127 } | |
1128 }; | |
1129 goog.array.shuffle = function(a, b) { | |
1130 for(var c = b || Math.random, d = a.length - 1;d > 0;d--) { | |
1131 var e = Math.floor(c() * (d + 1)), f = a[d]; | |
1132 a[d] = a[e]; | |
1133 a[e] = f | |
1134 } | |
1135 }; | |
1136 goog.userAgent = {}; | |
1137 goog.userAgent.ASSUME_IE = !1; | |
1138 goog.userAgent.ASSUME_GECKO = !1; | |
1139 goog.userAgent.ASSUME_WEBKIT = !1; | |
1140 goog.userAgent.ASSUME_MOBILE_WEBKIT = !1; | |
1141 goog.userAgent.ASSUME_OPERA = !1; | |
1142 goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUM
E_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT |
| goog.userAgent.ASSUME_OPERA; | |
1143 goog.userAgent.getUserAgentString = function() { | |
1144 return goog.global.navigator ? goog.global.navigator.userAgent : null | |
1145 }; | |
1146 goog.userAgent.getNavigator = function() { | |
1147 return goog.global.navigator | |
1148 }; | |
1149 goog.userAgent.init_ = function() { | |
1150 goog.userAgent.detectedOpera_ = !1; | |
1151 goog.userAgent.detectedIe_ = !1; | |
1152 goog.userAgent.detectedWebkit_ = !1; | |
1153 goog.userAgent.detectedMobile_ = !1; | |
1154 goog.userAgent.detectedGecko_ = !1; | |
1155 var a; | |
1156 if(!goog.userAgent.BROWSER_KNOWN_ && (a = goog.userAgent.getUserAgentString())
) { | |
1157 var b = goog.userAgent.getNavigator(); | |
1158 goog.userAgent.detectedOpera_ = a.indexOf("Opera") == 0; | |
1159 goog.userAgent.detectedIe_ = !goog.userAgent.detectedOpera_ && a.indexOf("MS
IE") != -1; | |
1160 goog.userAgent.detectedWebkit_ = !goog.userAgent.detectedOpera_ && a.indexOf
("WebKit") != -1; | |
1161 goog.userAgent.detectedMobile_ = goog.userAgent.detectedWebkit_ && a.indexOf
("Mobile") != -1; | |
1162 goog.userAgent.detectedGecko_ = !goog.userAgent.detectedOpera_ && !goog.user
Agent.detectedWebkit_ && b.product == "Gecko" | |
1163 } | |
1164 }; | |
1165 goog.userAgent.BROWSER_KNOWN_ || goog.userAgent.init_(); | |
1166 goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPE
RA : goog.userAgent.detectedOpera_; | |
1167 goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : g
oog.userAgent.detectedIe_; | |
1168 goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GEC
KO : goog.userAgent.detectedGecko_; | |
1169 goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WE
BKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.userAgent.detectedWebkit_; | |
1170 goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.de
tectedMobile_; | |
1171 goog.userAgent.SAFARI = goog.userAgent.WEBKIT; | |
1172 goog.userAgent.determinePlatform_ = function() { | |
1173 var a = goog.userAgent.getNavigator(); | |
1174 return a && a.platform || "" | |
1175 }; | |
1176 goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_(); | |
1177 goog.userAgent.ASSUME_MAC = !1; | |
1178 goog.userAgent.ASSUME_WINDOWS = !1; | |
1179 goog.userAgent.ASSUME_LINUX = !1; | |
1180 goog.userAgent.ASSUME_X11 = !1; | |
1181 goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASS
UME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11; | |
1182 goog.userAgent.initPlatform_ = function() { | |
1183 goog.userAgent.detectedMac_ = goog.string.contains(goog.userAgent.PLATFORM, "M
ac"); | |
1184 goog.userAgent.detectedWindows_ = goog.string.contains(goog.userAgent.PLATFORM
, "Win"); | |
1185 goog.userAgent.detectedLinux_ = goog.string.contains(goog.userAgent.PLATFORM,
"Linux"); | |
1186 goog.userAgent.detectedX11_ = !!goog.userAgent.getNavigator() && goog.string.c
ontains(goog.userAgent.getNavigator().appVersion || "", "X11") | |
1187 }; | |
1188 goog.userAgent.PLATFORM_KNOWN_ || goog.userAgent.initPlatform_(); | |
1189 goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC
: goog.userAgent.detectedMac_; | |
1190 goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_
WINDOWS : goog.userAgent.detectedWindows_; | |
1191 goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LI
NUX : goog.userAgent.detectedLinux_; | |
1192 goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11
: goog.userAgent.detectedX11_; | |
1193 goog.userAgent.determineVersion_ = function() { | |
1194 var a = "", b; | |
1195 goog.userAgent.OPERA && goog.global.opera ? (a = goog.global.opera.version, a
= typeof a == "function" ? a() : a) : (goog.userAgent.GECKO ? b = /rv\:([^\);]+)
(\)|;)/ : goog.userAgent.IE ? b = /MSIE\s+([^\);]+)(\)|;)/ : goog.userAgent.WEBK
IT && (b = /WebKit\/(\S+)/), b && (a = (a = b.exec(goog.userAgent.getUserAgentSt
ring())) ? a[1] : "")); | |
1196 return goog.userAgent.IE && (b = goog.userAgent.getDocumentMode_(), b > parseF
loat(a)) ? String(b) : a | |
1197 }; | |
1198 goog.userAgent.getDocumentMode_ = function() { | |
1199 var a = goog.global.document; | |
1200 return a ? a.documentMode : void 0 | |
1201 }; | |
1202 goog.userAgent.VERSION = goog.userAgent.determineVersion_(); | |
1203 goog.userAgent.compare = function(a, b) { | |
1204 return goog.string.compareVersions(a, b) | |
1205 }; | |
1206 goog.userAgent.isVersionCache_ = {}; | |
1207 goog.userAgent.isVersion = function(a) { | |
1208 return goog.userAgent.isVersionCache_[a] || (goog.userAgent.isVersionCache_[a]
= goog.string.compareVersions(goog.userAgent.VERSION, a) >= 0) | |
1209 }; | |
1210 goog.userAgent.isDocumentModeCache_ = {}; | |
1211 goog.userAgent.isDocumentMode = function(a) { | |
1212 return goog.userAgent.isDocumentModeCache_[a] || (goog.userAgent.isDocumentMod
eCache_[a] = goog.userAgent.IE && document.documentMode && document.documentMode
>= a) | |
1213 }; | |
1214 goog.dom = {}; | |
1215 goog.dom.BrowserFeature = {CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE ||
goog.userAgent.isDocumentMode(9), CAN_USE_CHILDREN_ATTRIBUTE:!goog.userAgent.GE
CKO && !goog.userAgent.IE || goog.userAgent.IE && goog.userAgent.isDocumentMode(
9) || goog.userAgent.GECKO && goog.userAgent.isVersion("1.9.1"), CAN_USE_INNER_T
EXT:goog.userAgent.IE && !goog.userAgent.isVersion("9"), INNER_HTML_NEEDS_SCOPED
_ELEMENT:goog.userAgent.IE}; | |
1216 goog.dom.TagName = {A:"A", ABBR:"ABBR", ACRONYM:"ACRONYM", ADDRESS:"ADDRESS", AP
PLET:"APPLET", AREA:"AREA", B:"B", BASE:"BASE", BASEFONT:"BASEFONT", BDO:"BDO",
BIG:"BIG", BLOCKQUOTE:"BLOCKQUOTE", BODY:"BODY", BR:"BR", BUTTON:"BUTTON", CANVA
S:"CANVAS", CAPTION:"CAPTION", CENTER:"CENTER", CITE:"CITE", CODE:"CODE", COL:"C
OL", COLGROUP:"COLGROUP", DD:"DD", DEL:"DEL", DFN:"DFN", DIR:"DIR", DIV:"DIV", D
L:"DL", DT:"DT", EM:"EM", FIELDSET:"FIELDSET", FONT:"FONT", FORM:"FORM", FRAME:"
FRAME", FRAMESET:"FRAMESET", | |
1217 H1:"H1", H2:"H2", H3:"H3", H4:"H4", H5:"H5", H6:"H6", HEAD:"HEAD", HR:"HR", HTML
:"HTML", I:"I", IFRAME:"IFRAME", IMG:"IMG", INPUT:"INPUT", INS:"INS", ISINDEX:"I
SINDEX", KBD:"KBD", LABEL:"LABEL", LEGEND:"LEGEND", LI:"LI", LINK:"LINK", MAP:"M
AP", MENU:"MENU", META:"META", NOFRAMES:"NOFRAMES", NOSCRIPT:"NOSCRIPT", OBJECT:
"OBJECT", OL:"OL", OPTGROUP:"OPTGROUP", OPTION:"OPTION", P:"P", PARAM:"PARAM", P
RE:"PRE", Q:"Q", S:"S", SAMP:"SAMP", SCRIPT:"SCRIPT", SELECT:"SELECT", SMALL:"SM
ALL", SPAN:"SPAN", STRIKE:"STRIKE", | |
1218 STRONG:"STRONG", STYLE:"STYLE", SUB:"SUB", SUP:"SUP", TABLE:"TABLE", TBODY:"TBOD
Y", TD:"TD", TEXTAREA:"TEXTAREA", TFOOT:"TFOOT", TH:"TH", THEAD:"THEAD", TITLE:"
TITLE", TR:"TR", TT:"TT", U:"U", UL:"UL", VAR:"VAR"}; | |
1219 goog.dom.classes = {}; | |
1220 goog.dom.classes.set = function(a, b) { | |
1221 a.className = b | |
1222 }; | |
1223 goog.dom.classes.get = function(a) { | |
1224 return(a = a.className) && typeof a.split == "function" ? a.split(/\s+/) : [] | |
1225 }; | |
1226 goog.dom.classes.add = function(a, b) { | |
1227 var c = goog.dom.classes.get(a), d = goog.array.slice(arguments, 1), d = goog.
dom.classes.add_(c, d); | |
1228 a.className = c.join(" "); | |
1229 return d | |
1230 }; | |
1231 goog.dom.classes.remove = function(a, b) { | |
1232 var c = goog.dom.classes.get(a), d = goog.array.slice(arguments, 1), d = goog.
dom.classes.remove_(c, d); | |
1233 a.className = c.join(" "); | |
1234 return d | |
1235 }; | |
1236 goog.dom.classes.add_ = function(a, b) { | |
1237 for(var c = 0, d = 0;d < b.length;d++) { | |
1238 goog.array.contains(a, b[d]) || (a.push(b[d]), c++) | |
1239 } | |
1240 return c == b.length | |
1241 }; | |
1242 goog.dom.classes.remove_ = function(a, b) { | |
1243 for(var c = 0, d = 0;d < a.length;d++) { | |
1244 goog.array.contains(b, a[d]) && (goog.array.splice(a, d--, 1), c++) | |
1245 } | |
1246 return c == b.length | |
1247 }; | |
1248 goog.dom.classes.swap = function(a, b, c) { | |
1249 for(var d = goog.dom.classes.get(a), e = !1, f = 0;f < d.length;f++) { | |
1250 d[f] == b && (goog.array.splice(d, f--, 1), e = !0) | |
1251 } | |
1252 if(e) { | |
1253 d.push(c), a.className = d.join(" ") | |
1254 } | |
1255 return e | |
1256 }; | |
1257 goog.dom.classes.addRemove = function(a, b, c) { | |
1258 var d = goog.dom.classes.get(a); | |
1259 goog.isString(b) ? goog.array.remove(d, b) : goog.isArray(b) && goog.dom.class
es.remove_(d, b); | |
1260 goog.isString(c) && !goog.array.contains(d, c) ? d.push(c) : goog.isArray(c) &
& goog.dom.classes.add_(d, c); | |
1261 a.className = d.join(" ") | |
1262 }; | |
1263 goog.dom.classes.has = function(a, b) { | |
1264 return goog.array.contains(goog.dom.classes.get(a), b) | |
1265 }; | |
1266 goog.dom.classes.enable = function(a, b, c) { | |
1267 c ? goog.dom.classes.add(a, b) : goog.dom.classes.remove(a, b) | |
1268 }; | |
1269 goog.dom.classes.toggle = function(a, b) { | |
1270 var c = !goog.dom.classes.has(a, b); | |
1271 goog.dom.classes.enable(a, b, c); | |
1272 return c | |
1273 }; | |
1274 goog.math = {}; | |
1275 goog.math.Coordinate = function(a, b) { | |
1276 this.x = goog.isDef(a) ? a : 0; | |
1277 this.y = goog.isDef(b) ? b : 0 | |
1278 }; | |
1279 goog.math.Coordinate.prototype.clone = function() { | |
1280 return new goog.math.Coordinate(this.x, this.y) | |
1281 }; | |
1282 if(goog.DEBUG) { | |
1283 goog.math.Coordinate.prototype.toString = function() { | |
1284 return"(" + this.x + ", " + this.y + ")" | |
1285 } | |
1286 } | |
1287 goog.math.Coordinate.equals = function(a, b) { | |
1288 return a == b ? !0 : !a || !b ? !1 : a.x == b.x && a.y == b.y | |
1289 }; | |
1290 goog.math.Coordinate.distance = function(a, b) { | |
1291 var c = a.x - b.x, d = a.y - b.y; | |
1292 return Math.sqrt(c * c + d * d) | |
1293 }; | |
1294 goog.math.Coordinate.squaredDistance = function(a, b) { | |
1295 var c = a.x - b.x, d = a.y - b.y; | |
1296 return c * c + d * d | |
1297 }; | |
1298 goog.math.Coordinate.difference = function(a, b) { | |
1299 return new goog.math.Coordinate(a.x - b.x, a.y - b.y) | |
1300 }; | |
1301 goog.math.Coordinate.sum = function(a, b) { | |
1302 return new goog.math.Coordinate(a.x + b.x, a.y + b.y) | |
1303 }; | |
1304 goog.math.Size = function(a, b) { | |
1305 this.width = a; | |
1306 this.height = b | |
1307 }; | |
1308 goog.math.Size.equals = function(a, b) { | |
1309 return a == b ? !0 : !a || !b ? !1 : a.width == b.width && a.height == b.heigh
t | |
1310 }; | |
1311 goog.math.Size.prototype.clone = function() { | |
1312 return new goog.math.Size(this.width, this.height) | |
1313 }; | |
1314 if(goog.DEBUG) { | |
1315 goog.math.Size.prototype.toString = function() { | |
1316 return"(" + this.width + " x " + this.height + ")" | |
1317 } | |
1318 } | |
1319 goog.math.Size.prototype.getLongest = function() { | |
1320 return Math.max(this.width, this.height) | |
1321 }; | |
1322 goog.math.Size.prototype.getShortest = function() { | |
1323 return Math.min(this.width, this.height) | |
1324 }; | |
1325 goog.math.Size.prototype.area = function() { | |
1326 return this.width * this.height | |
1327 }; | |
1328 goog.math.Size.prototype.perimeter = function() { | |
1329 return(this.width + this.height) * 2 | |
1330 }; | |
1331 goog.math.Size.prototype.aspectRatio = function() { | |
1332 return this.width / this.height | |
1333 }; | |
1334 goog.math.Size.prototype.isEmpty = function() { | |
1335 return!this.area() | |
1336 }; | |
1337 goog.math.Size.prototype.ceil = function() { | |
1338 this.width = Math.ceil(this.width); | |
1339 this.height = Math.ceil(this.height); | |
1340 return this | |
1341 }; | |
1342 goog.math.Size.prototype.fitsInside = function(a) { | |
1343 return this.width <= a.width && this.height <= a.height | |
1344 }; | |
1345 goog.math.Size.prototype.floor = function() { | |
1346 this.width = Math.floor(this.width); | |
1347 this.height = Math.floor(this.height); | |
1348 return this | |
1349 }; | |
1350 goog.math.Size.prototype.round = function() { | |
1351 this.width = Math.round(this.width); | |
1352 this.height = Math.round(this.height); | |
1353 return this | |
1354 }; | |
1355 goog.math.Size.prototype.scale = function(a) { | |
1356 this.width *= a; | |
1357 this.height *= a; | |
1358 return this | |
1359 }; | |
1360 goog.math.Size.prototype.scaleToFit = function(a) { | |
1361 return this.scale(this.aspectRatio() > a.aspectRatio() ? a.width / this.width
: a.height / this.height) | |
1362 }; | |
1363 goog.object = {}; | |
1364 goog.object.forEach = function(a, b, c) { | |
1365 for(var d in a) { | |
1366 b.call(c, a[d], d, a) | |
1367 } | |
1368 }; | |
1369 goog.object.filter = function(a, b, c) { | |
1370 var d = {}, e; | |
1371 for(e in a) { | |
1372 b.call(c, a[e], e, a) && (d[e] = a[e]) | |
1373 } | |
1374 return d | |
1375 }; | |
1376 goog.object.map = function(a, b, c) { | |
1377 var d = {}, e; | |
1378 for(e in a) { | |
1379 d[e] = b.call(c, a[e], e, a) | |
1380 } | |
1381 return d | |
1382 }; | |
1383 goog.object.some = function(a, b, c) { | |
1384 for(var d in a) { | |
1385 if(b.call(c, a[d], d, a)) { | |
1386 return!0 | |
1387 } | |
1388 } | |
1389 return!1 | |
1390 }; | |
1391 goog.object.every = function(a, b, c) { | |
1392 for(var d in a) { | |
1393 if(!b.call(c, a[d], d, a)) { | |
1394 return!1 | |
1395 } | |
1396 } | |
1397 return!0 | |
1398 }; | |
1399 goog.object.getCount = function(a) { | |
1400 var b = 0, c; | |
1401 for(c in a) { | |
1402 b++ | |
1403 } | |
1404 return b | |
1405 }; | |
1406 goog.object.getAnyKey = function(a) { | |
1407 for(var b in a) { | |
1408 return b | |
1409 } | |
1410 }; | |
1411 goog.object.getAnyValue = function(a) { | |
1412 for(var b in a) { | |
1413 return a[b] | |
1414 } | |
1415 }; | |
1416 goog.object.contains = function(a, b) { | |
1417 return goog.object.containsValue(a, b) | |
1418 }; | |
1419 goog.object.getValues = function(a) { | |
1420 var b = [], c = 0, d; | |
1421 for(d in a) { | |
1422 b[c++] = a[d] | |
1423 } | |
1424 return b | |
1425 }; | |
1426 goog.object.getKeys = function(a) { | |
1427 var b = [], c = 0, d; | |
1428 for(d in a) { | |
1429 b[c++] = d | |
1430 } | |
1431 return b | |
1432 }; | |
1433 goog.object.getValueByKeys = function(a, b) { | |
1434 for(var c = goog.isArrayLike(b), d = c ? b : arguments, c = c ? 0 : 1;c < d.le
ngth;c++) { | |
1435 if(a = a[d[c]], !goog.isDef(a)) { | |
1436 break | |
1437 } | |
1438 } | |
1439 return a | |
1440 }; | |
1441 goog.object.containsKey = function(a, b) { | |
1442 return b in a | |
1443 }; | |
1444 goog.object.containsValue = function(a, b) { | |
1445 for(var c in a) { | |
1446 if(a[c] == b) { | |
1447 return!0 | |
1448 } | |
1449 } | |
1450 return!1 | |
1451 }; | |
1452 goog.object.findKey = function(a, b, c) { | |
1453 for(var d in a) { | |
1454 if(b.call(c, a[d], d, a)) { | |
1455 return d | |
1456 } | |
1457 } | |
1458 }; | |
1459 goog.object.findValue = function(a, b, c) { | |
1460 return(b = goog.object.findKey(a, b, c)) && a[b] | |
1461 }; | |
1462 goog.object.isEmpty = function(a) { | |
1463 for(var b in a) { | |
1464 return!1 | |
1465 } | |
1466 return!0 | |
1467 }; | |
1468 goog.object.clear = function(a) { | |
1469 for(var b in a) { | |
1470 delete a[b] | |
1471 } | |
1472 }; | |
1473 goog.object.remove = function(a, b) { | |
1474 var c; | |
1475 (c = b in a) && delete a[b]; | |
1476 return c | |
1477 }; | |
1478 goog.object.add = function(a, b, c) { | |
1479 if(b in a) { | |
1480 throw Error('The object already contains the key "' + b + '"'); | |
1481 } | |
1482 goog.object.set(a, b, c) | |
1483 }; | |
1484 goog.object.get = function(a, b, c) { | |
1485 return b in a ? a[b] : c | |
1486 }; | |
1487 goog.object.set = function(a, b, c) { | |
1488 a[b] = c | |
1489 }; | |
1490 goog.object.setIfUndefined = function(a, b, c) { | |
1491 return b in a ? a[b] : a[b] = c | |
1492 }; | |
1493 goog.object.clone = function(a) { | |
1494 var b = {}, c; | |
1495 for(c in a) { | |
1496 b[c] = a[c] | |
1497 } | |
1498 return b | |
1499 }; | |
1500 goog.object.unsafeClone = function(a) { | |
1501 var b = goog.typeOf(a); | |
1502 if(b == "object" || b == "array") { | |
1503 if(a.clone) { | |
1504 return a.clone() | |
1505 } | |
1506 var b = b == "array" ? [] : {}, c; | |
1507 for(c in a) { | |
1508 b[c] = goog.object.unsafeClone(a[c]) | |
1509 } | |
1510 return b | |
1511 } | |
1512 return a | |
1513 }; | |
1514 goog.object.transpose = function(a) { | |
1515 var b = {}, c; | |
1516 for(c in a) { | |
1517 b[a[c]] = c | |
1518 } | |
1519 return b | |
1520 }; | |
1521 goog.object.PROTOTYPE_FIELDS_ = "constructor,hasOwnProperty,isPrototypeOf,proper
tyIsEnumerable,toLocaleString,toString,valueOf".split(","); | |
1522 goog.object.extend = function(a, b) { | |
1523 for(var c, d, e = 1;e < arguments.length;e++) { | |
1524 d = arguments[e]; | |
1525 for(c in d) { | |
1526 a[c] = d[c] | |
1527 } | |
1528 for(var f = 0;f < goog.object.PROTOTYPE_FIELDS_.length;f++) { | |
1529 c = goog.object.PROTOTYPE_FIELDS_[f], Object.prototype.hasOwnProperty.call
(d, c) && (a[c] = d[c]) | |
1530 } | |
1531 } | |
1532 }; | |
1533 goog.object.create = function(a) { | |
1534 var b = arguments.length; | |
1535 if(b == 1 && goog.isArray(arguments[0])) { | |
1536 return goog.object.create.apply(null, arguments[0]) | |
1537 } | |
1538 if(b % 2) { | |
1539 throw Error("Uneven number of arguments"); | |
1540 } | |
1541 for(var c = {}, d = 0;d < b;d += 2) { | |
1542 c[arguments[d]] = arguments[d + 1] | |
1543 } | |
1544 return c | |
1545 }; | |
1546 goog.object.createSet = function(a) { | |
1547 var b = arguments.length; | |
1548 if(b == 1 && goog.isArray(arguments[0])) { | |
1549 return goog.object.createSet.apply(null, arguments[0]) | |
1550 } | |
1551 for(var c = {}, d = 0;d < b;d++) { | |
1552 c[arguments[d]] = !0 | |
1553 } | |
1554 return c | |
1555 }; | |
1556 goog.dom.ASSUME_QUIRKS_MODE = !1; | |
1557 goog.dom.ASSUME_STANDARDS_MODE = !1; | |
1558 goog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STA
NDARDS_MODE; | |
1559 goog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REF
ERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TY
PE:10, DOCUMENT_FRAGMENT:11, NOTATION:12}; | |
1560 goog.dom.getDomHelper = function(a) { | |
1561 return a ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)) : goog.dom.def
aultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper) | |
1562 }; | |
1563 goog.dom.getDocument = function() { | |
1564 return document | |
1565 }; | |
1566 goog.dom.getElement = function(a) { | |
1567 return goog.isString(a) ? document.getElementById(a) : a | |
1568 }; | |
1569 goog.dom.$ = goog.dom.getElement; | |
1570 goog.dom.getElementsByTagNameAndClass = function(a, b, c) { | |
1571 return goog.dom.getElementsByTagNameAndClass_(document, a, b, c) | |
1572 }; | |
1573 goog.dom.getElementsByClass = function(a, b) { | |
1574 var c = b || document; | |
1575 if(goog.dom.canUseQuerySelector_(c)) { | |
1576 return c.querySelectorAll("." + a) | |
1577 }else { | |
1578 if(c.getElementsByClassName) { | |
1579 return c.getElementsByClassName(a) | |
1580 } | |
1581 } | |
1582 return goog.dom.getElementsByTagNameAndClass_(document, "*", a, b) | |
1583 }; | |
1584 goog.dom.getElementByClass = function(a, b) { | |
1585 var c = b || document, d = null; | |
1586 return(d = goog.dom.canUseQuerySelector_(c) ? c.querySelector("." + a) : goog.
dom.getElementsByClass(a, b)[0]) || null | |
1587 }; | |
1588 goog.dom.canUseQuerySelector_ = function(a) { | |
1589 return a.querySelectorAll && a.querySelector && (!goog.userAgent.WEBKIT || goo
g.dom.isCss1CompatMode_(document) || goog.userAgent.isVersion("528")) | |
1590 }; | |
1591 goog.dom.getElementsByTagNameAndClass_ = function(a, b, c, d) { | |
1592 a = d || a; | |
1593 b = b && b != "*" ? b.toUpperCase() : ""; | |
1594 if(goog.dom.canUseQuerySelector_(a) && (b || c)) { | |
1595 return a.querySelectorAll(b + (c ? "." + c : "")) | |
1596 } | |
1597 if(c && a.getElementsByClassName) { | |
1598 if(a = a.getElementsByClassName(c), b) { | |
1599 for(var d = {}, e = 0, f = 0, g;g = a[f];f++) { | |
1600 b == g.nodeName && (d[e++] = g) | |
1601 } | |
1602 d.length = e; | |
1603 return d | |
1604 }else { | |
1605 return a | |
1606 } | |
1607 } | |
1608 a = a.getElementsByTagName(b || "*"); | |
1609 if(c) { | |
1610 d = {}; | |
1611 for(f = e = 0;g = a[f];f++) { | |
1612 b = g.className, typeof b.split == "function" && goog.array.contains(b.spl
it(/\s+/), c) && (d[e++] = g) | |
1613 } | |
1614 d.length = e; | |
1615 return d | |
1616 }else { | |
1617 return a | |
1618 } | |
1619 }; | |
1620 goog.dom.$$ = goog.dom.getElementsByTagNameAndClass; | |
1621 goog.dom.setProperties = function(a, b) { | |
1622 goog.object.forEach(b, function(b, d) { | |
1623 d == "style" ? a.style.cssText = b : d == "class" ? a.className = b : d == "
for" ? a.htmlFor = b : d in goog.dom.DIRECT_ATTRIBUTE_MAP_ ? a.setAttribute(goog
.dom.DIRECT_ATTRIBUTE_MAP_[d], b) : goog.string.startsWith(d, "aria-") ? a.setAt
tribute(d, b) : a[d] = b | |
1624 }) | |
1625 }; | |
1626 goog.dom.DIRECT_ATTRIBUTE_MAP_ = {cellpadding:"cellPadding", cellspacing:"cellSp
acing", colspan:"colSpan", rowspan:"rowSpan", valign:"vAlign", height:"height",
width:"width", usemap:"useMap", frameborder:"frameBorder", maxlength:"maxLength"
, type:"type"}; | |
1627 goog.dom.getViewportSize = function(a) { | |
1628 return goog.dom.getViewportSize_(a || window) | |
1629 }; | |
1630 goog.dom.getViewportSize_ = function(a) { | |
1631 var b = a.document; | |
1632 if(goog.userAgent.WEBKIT && !goog.userAgent.isVersion("500") && !goog.userAgen
t.MOBILE) { | |
1633 typeof a.innerHeight == "undefined" && (a = window); | |
1634 var b = a.innerHeight, c = a.document.documentElement.scrollHeight; | |
1635 a == a.top && c < b && (b -= 15); | |
1636 return new goog.math.Size(a.innerWidth, b) | |
1637 } | |
1638 a = goog.dom.isCss1CompatMode_(b) ? b.documentElement : b.body; | |
1639 return new goog.math.Size(a.clientWidth, a.clientHeight) | |
1640 }; | |
1641 goog.dom.getDocumentHeight = function() { | |
1642 return goog.dom.getDocumentHeight_(window) | |
1643 }; | |
1644 goog.dom.getDocumentHeight_ = function(a) { | |
1645 var b = a.document, c = 0; | |
1646 if(b) { | |
1647 var a = goog.dom.getViewportSize_(a).height, c = b.body, d = b.documentEleme
nt; | |
1648 if(goog.dom.isCss1CompatMode_(b) && d.scrollHeight) { | |
1649 c = d.scrollHeight != a ? d.scrollHeight : d.offsetHeight | |
1650 }else { | |
1651 var b = d.scrollHeight, e = d.offsetHeight; | |
1652 if(d.clientHeight != e) { | |
1653 b = c.scrollHeight, e = c.offsetHeight | |
1654 } | |
1655 c = b > a ? b > e ? b : e : b < e ? b : e | |
1656 } | |
1657 } | |
1658 return c | |
1659 }; | |
1660 goog.dom.getPageScroll = function(a) { | |
1661 return goog.dom.getDomHelper((a || goog.global || window).document).getDocumen
tScroll() | |
1662 }; | |
1663 goog.dom.getDocumentScroll = function() { | |
1664 return goog.dom.getDocumentScroll_(document) | |
1665 }; | |
1666 goog.dom.getDocumentScroll_ = function(a) { | |
1667 var b = goog.dom.getDocumentScrollElement_(a), a = goog.dom.getWindow_(a); | |
1668 return new goog.math.Coordinate(a.pageXOffset || b.scrollLeft, a.pageYOffset |
| b.scrollTop) | |
1669 }; | |
1670 goog.dom.getDocumentScrollElement = function() { | |
1671 return goog.dom.getDocumentScrollElement_(document) | |
1672 }; | |
1673 goog.dom.getDocumentScrollElement_ = function(a) { | |
1674 return!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(a) ? a.documentElem
ent : a.body | |
1675 }; | |
1676 goog.dom.getWindow = function(a) { | |
1677 return a ? goog.dom.getWindow_(a) : window | |
1678 }; | |
1679 goog.dom.getWindow_ = function(a) { | |
1680 return a.parentWindow || a.defaultView | |
1681 }; | |
1682 goog.dom.createDom = function(a, b, c) { | |
1683 return goog.dom.createDom_(document, arguments) | |
1684 }; | |
1685 goog.dom.createDom_ = function(a, b) { | |
1686 var c = b[0], d = b[1]; | |
1687 if(!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && d && (d.name ||
d.type)) { | |
1688 c = ["<", c]; | |
1689 d.name && c.push(' name="', goog.string.htmlEscape(d.name), '"'); | |
1690 if(d.type) { | |
1691 c.push(' type="', goog.string.htmlEscape(d.type), '"'); | |
1692 var e = {}; | |
1693 goog.object.extend(e, d); | |
1694 d = e; | |
1695 delete d.type | |
1696 } | |
1697 c.push(">"); | |
1698 c = c.join("") | |
1699 } | |
1700 c = a.createElement(c); | |
1701 if(d) { | |
1702 goog.isString(d) ? c.className = d : goog.isArray(d) ? goog.dom.classes.add.
apply(null, [c].concat(d)) : goog.dom.setProperties(c, d) | |
1703 } | |
1704 b.length > 2 && goog.dom.append_(a, c, b, 2); | |
1705 return c | |
1706 }; | |
1707 goog.dom.append_ = function(a, b, c, d) { | |
1708 function e(c) { | |
1709 c && b.appendChild(goog.isString(c) ? a.createTextNode(c) : c) | |
1710 } | |
1711 for(;d < c.length;d++) { | |
1712 var f = c[d]; | |
1713 goog.isArrayLike(f) && !goog.dom.isNodeLike(f) ? goog.array.forEach(goog.dom
.isNodeList(f) ? goog.array.clone(f) : f, e) : e(f) | |
1714 } | |
1715 }; | |
1716 goog.dom.$dom = goog.dom.createDom; | |
1717 goog.dom.createElement = function(a) { | |
1718 return document.createElement(a) | |
1719 }; | |
1720 goog.dom.createTextNode = function(a) { | |
1721 return document.createTextNode(a) | |
1722 }; | |
1723 goog.dom.createTable = function(a, b, c) { | |
1724 return goog.dom.createTable_(document, a, b, !!c) | |
1725 }; | |
1726 goog.dom.createTable_ = function(a, b, c, d) { | |
1727 for(var e = ["<tr>"], f = 0;f < c;f++) { | |
1728 e.push(d ? "<td> </td>" : "<td></td>") | |
1729 } | |
1730 e.push("</tr>"); | |
1731 e = e.join(""); | |
1732 c = ["<table>"]; | |
1733 for(f = 0;f < b;f++) { | |
1734 c.push(e) | |
1735 } | |
1736 c.push("</table>"); | |
1737 a = a.createElement(goog.dom.TagName.DIV); | |
1738 a.innerHTML = c.join(""); | |
1739 return a.removeChild(a.firstChild) | |
1740 }; | |
1741 goog.dom.htmlToDocumentFragment = function(a) { | |
1742 return goog.dom.htmlToDocumentFragment_(document, a) | |
1743 }; | |
1744 goog.dom.htmlToDocumentFragment_ = function(a, b) { | |
1745 var c = a.createElement("div"); | |
1746 goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT ? (c.innerHTML = "<br>
" + b, c.removeChild(c.firstChild)) : c.innerHTML = b; | |
1747 if(c.childNodes.length == 1) { | |
1748 return c.removeChild(c.firstChild) | |
1749 }else { | |
1750 for(var d = a.createDocumentFragment();c.firstChild;) { | |
1751 d.appendChild(c.firstChild) | |
1752 } | |
1753 return d | |
1754 } | |
1755 }; | |
1756 goog.dom.getCompatMode = function() { | |
1757 return goog.dom.isCss1CompatMode() ? "CSS1Compat" : "BackCompat" | |
1758 }; | |
1759 goog.dom.isCss1CompatMode = function() { | |
1760 return goog.dom.isCss1CompatMode_(document) | |
1761 }; | |
1762 goog.dom.isCss1CompatMode_ = function(a) { | |
1763 return goog.dom.COMPAT_MODE_KNOWN_ ? goog.dom.ASSUME_STANDARDS_MODE : a.compat
Mode == "CSS1Compat" | |
1764 }; | |
1765 goog.dom.canHaveChildren = function(a) { | |
1766 if(a.nodeType != goog.dom.NodeType.ELEMENT) { | |
1767 return!1 | |
1768 } | |
1769 switch(a.tagName) { | |
1770 case goog.dom.TagName.APPLET: | |
1771 ; | |
1772 case goog.dom.TagName.AREA: | |
1773 ; | |
1774 case goog.dom.TagName.BASE: | |
1775 ; | |
1776 case goog.dom.TagName.BR: | |
1777 ; | |
1778 case goog.dom.TagName.COL: | |
1779 ; | |
1780 case goog.dom.TagName.FRAME: | |
1781 ; | |
1782 case goog.dom.TagName.HR: | |
1783 ; | |
1784 case goog.dom.TagName.IMG: | |
1785 ; | |
1786 case goog.dom.TagName.INPUT: | |
1787 ; | |
1788 case goog.dom.TagName.IFRAME: | |
1789 ; | |
1790 case goog.dom.TagName.ISINDEX: | |
1791 ; | |
1792 case goog.dom.TagName.LINK: | |
1793 ; | |
1794 case goog.dom.TagName.NOFRAMES: | |
1795 ; | |
1796 case goog.dom.TagName.NOSCRIPT: | |
1797 ; | |
1798 case goog.dom.TagName.META: | |
1799 ; | |
1800 case goog.dom.TagName.OBJECT: | |
1801 ; | |
1802 case goog.dom.TagName.PARAM: | |
1803 ; | |
1804 case goog.dom.TagName.SCRIPT: | |
1805 ; | |
1806 case goog.dom.TagName.STYLE: | |
1807 return!1 | |
1808 } | |
1809 return!0 | |
1810 }; | |
1811 goog.dom.appendChild = function(a, b) { | |
1812 a.appendChild(b) | |
1813 }; | |
1814 goog.dom.append = function(a, b) { | |
1815 goog.dom.append_(goog.dom.getOwnerDocument(a), a, arguments, 1) | |
1816 }; | |
1817 goog.dom.removeChildren = function(a) { | |
1818 for(var b;b = a.firstChild;) { | |
1819 a.removeChild(b) | |
1820 } | |
1821 }; | |
1822 goog.dom.insertSiblingBefore = function(a, b) { | |
1823 b.parentNode && b.parentNode.insertBefore(a, b) | |
1824 }; | |
1825 goog.dom.insertSiblingAfter = function(a, b) { | |
1826 b.parentNode && b.parentNode.insertBefore(a, b.nextSibling) | |
1827 }; | |
1828 goog.dom.insertChildAt = function(a, b, c) { | |
1829 a.insertBefore(b, a.childNodes[c] || null) | |
1830 }; | |
1831 goog.dom.removeNode = function(a) { | |
1832 return a && a.parentNode ? a.parentNode.removeChild(a) : null | |
1833 }; | |
1834 goog.dom.replaceNode = function(a, b) { | |
1835 var c = b.parentNode; | |
1836 c && c.replaceChild(a, b) | |
1837 }; | |
1838 goog.dom.flattenElement = function(a) { | |
1839 var b, c = a.parentNode; | |
1840 if(c && c.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) { | |
1841 if(a.removeNode) { | |
1842 return a.removeNode(!1) | |
1843 }else { | |
1844 for(;b = a.firstChild;) { | |
1845 c.insertBefore(b, a) | |
1846 } | |
1847 return goog.dom.removeNode(a) | |
1848 } | |
1849 } | |
1850 }; | |
1851 goog.dom.getChildren = function(a) { | |
1852 return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && a.children != voi
d 0 ? a.children : goog.array.filter(a.childNodes, function(a) { | |
1853 return a.nodeType == goog.dom.NodeType.ELEMENT | |
1854 }) | |
1855 }; | |
1856 goog.dom.getFirstElementChild = function(a) { | |
1857 return a.firstElementChild != void 0 ? a.firstElementChild : goog.dom.getNextE
lementNode_(a.firstChild, !0) | |
1858 }; | |
1859 goog.dom.getLastElementChild = function(a) { | |
1860 return a.lastElementChild != void 0 ? a.lastElementChild : goog.dom.getNextEle
mentNode_(a.lastChild, !1) | |
1861 }; | |
1862 goog.dom.getNextElementSibling = function(a) { | |
1863 return a.nextElementSibling != void 0 ? a.nextElementSibling : goog.dom.getNex
tElementNode_(a.nextSibling, !0) | |
1864 }; | |
1865 goog.dom.getPreviousElementSibling = function(a) { | |
1866 return a.previousElementSibling != void 0 ? a.previousElementSibling : goog.do
m.getNextElementNode_(a.previousSibling, !1) | |
1867 }; | |
1868 goog.dom.getNextElementNode_ = function(a, b) { | |
1869 for(;a && a.nodeType != goog.dom.NodeType.ELEMENT;) { | |
1870 a = b ? a.nextSibling : a.previousSibling | |
1871 } | |
1872 return a | |
1873 }; | |
1874 goog.dom.getNextNode = function(a) { | |
1875 if(!a) { | |
1876 return null | |
1877 } | |
1878 if(a.firstChild) { | |
1879 return a.firstChild | |
1880 } | |
1881 for(;a && !a.nextSibling;) { | |
1882 a = a.parentNode | |
1883 } | |
1884 return a ? a.nextSibling : null | |
1885 }; | |
1886 goog.dom.getPreviousNode = function(a) { | |
1887 if(!a) { | |
1888 return null | |
1889 } | |
1890 if(!a.previousSibling) { | |
1891 return a.parentNode | |
1892 } | |
1893 for(a = a.previousSibling;a && a.lastChild;) { | |
1894 a = a.lastChild | |
1895 } | |
1896 return a | |
1897 }; | |
1898 goog.dom.isNodeLike = function(a) { | |
1899 return goog.isObject(a) && a.nodeType > 0 | |
1900 }; | |
1901 goog.dom.isElement = function(a) { | |
1902 return goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT | |
1903 }; | |
1904 goog.dom.isWindow = function(a) { | |
1905 return goog.isObject(a) && a.window == a | |
1906 }; | |
1907 goog.dom.contains = function(a, b) { | |
1908 if(a.contains && b.nodeType == goog.dom.NodeType.ELEMENT) { | |
1909 return a == b || a.contains(b) | |
1910 } | |
1911 if(typeof a.compareDocumentPosition != "undefined") { | |
1912 return a == b || Boolean(a.compareDocumentPosition(b) & 16) | |
1913 } | |
1914 for(;b && a != b;) { | |
1915 b = b.parentNode | |
1916 } | |
1917 return b == a | |
1918 }; | |
1919 goog.dom.compareNodeOrder = function(a, b) { | |
1920 if(a == b) { | |
1921 return 0 | |
1922 } | |
1923 if(a.compareDocumentPosition) { | |
1924 return a.compareDocumentPosition(b) & 2 ? 1 : -1 | |
1925 } | |
1926 if("sourceIndex" in a || a.parentNode && "sourceIndex" in a.parentNode) { | |
1927 var c = a.nodeType == goog.dom.NodeType.ELEMENT, d = b.nodeType == goog.dom.
NodeType.ELEMENT; | |
1928 if(c && d) { | |
1929 return a.sourceIndex - b.sourceIndex | |
1930 }else { | |
1931 var e = a.parentNode, f = b.parentNode; | |
1932 return e == f ? goog.dom.compareSiblingOrder_(a, b) : !c && goog.dom.conta
ins(e, b) ? -1 * goog.dom.compareParentsDescendantNodeIe_(a, b) : !d && goog.dom
.contains(f, a) ? goog.dom.compareParentsDescendantNodeIe_(b, a) : (c ? a.source
Index : e.sourceIndex) - (d ? b.sourceIndex : f.sourceIndex) | |
1933 } | |
1934 } | |
1935 d = goog.dom.getOwnerDocument(a); | |
1936 c = d.createRange(); | |
1937 c.selectNode(a); | |
1938 c.collapse(!0); | |
1939 d = d.createRange(); | |
1940 d.selectNode(b); | |
1941 d.collapse(!0); | |
1942 return c.compareBoundaryPoints(goog.global.Range.START_TO_END, d) | |
1943 }; | |
1944 goog.dom.compareParentsDescendantNodeIe_ = function(a, b) { | |
1945 var c = a.parentNode; | |
1946 if(c == b) { | |
1947 return-1 | |
1948 } | |
1949 for(var d = b;d.parentNode != c;) { | |
1950 d = d.parentNode | |
1951 } | |
1952 return goog.dom.compareSiblingOrder_(d, a) | |
1953 }; | |
1954 goog.dom.compareSiblingOrder_ = function(a, b) { | |
1955 for(var c = b;c = c.previousSibling;) { | |
1956 if(c == a) { | |
1957 return-1 | |
1958 } | |
1959 } | |
1960 return 1 | |
1961 }; | |
1962 goog.dom.findCommonAncestor = function(a) { | |
1963 var b, c = arguments.length; | |
1964 if(c) { | |
1965 if(c == 1) { | |
1966 return arguments[0] | |
1967 } | |
1968 }else { | |
1969 return null | |
1970 } | |
1971 var d = [], e = Infinity; | |
1972 for(b = 0;b < c;b++) { | |
1973 for(var f = [], g = arguments[b];g;) { | |
1974 f.unshift(g), g = g.parentNode | |
1975 } | |
1976 d.push(f); | |
1977 e = Math.min(e, f.length) | |
1978 } | |
1979 f = null; | |
1980 for(b = 0;b < e;b++) { | |
1981 for(var g = d[0][b], h = 1;h < c;h++) { | |
1982 if(g != d[h][b]) { | |
1983 return f | |
1984 } | |
1985 } | |
1986 f = g | |
1987 } | |
1988 return f | |
1989 }; | |
1990 goog.dom.getOwnerDocument = function(a) { | |
1991 return a.nodeType == goog.dom.NodeType.DOCUMENT ? a : a.ownerDocument || a.doc
ument | |
1992 }; | |
1993 goog.dom.getFrameContentDocument = function(a) { | |
1994 return goog.userAgent.WEBKIT ? a.document || a.contentWindow.document : a.cont
entDocument || a.contentWindow.document | |
1995 }; | |
1996 goog.dom.getFrameContentWindow = function(a) { | |
1997 return a.contentWindow || goog.dom.getWindow_(goog.dom.getFrameContentDocument
(a)) | |
1998 }; | |
1999 goog.dom.setTextContent = function(a, b) { | |
2000 if("textContent" in a) { | |
2001 a.textContent = b | |
2002 }else { | |
2003 if(a.firstChild && a.firstChild.nodeType == goog.dom.NodeType.TEXT) { | |
2004 for(;a.lastChild != a.firstChild;) { | |
2005 a.removeChild(a.lastChild) | |
2006 } | |
2007 a.firstChild.data = b | |
2008 }else { | |
2009 goog.dom.removeChildren(a); | |
2010 var c = goog.dom.getOwnerDocument(a); | |
2011 a.appendChild(c.createTextNode(b)) | |
2012 } | |
2013 } | |
2014 }; | |
2015 goog.dom.getOuterHtml = function(a) { | |
2016 if("outerHTML" in a) { | |
2017 return a.outerHTML | |
2018 }else { | |
2019 var b = goog.dom.getOwnerDocument(a).createElement("div"); | |
2020 b.appendChild(a.cloneNode(!0)); | |
2021 return b.innerHTML | |
2022 } | |
2023 }; | |
2024 goog.dom.findNode = function(a, b) { | |
2025 var c = []; | |
2026 return goog.dom.findNodes_(a, b, c, !0) ? c[0] : void 0 | |
2027 }; | |
2028 goog.dom.findNodes = function(a, b) { | |
2029 var c = []; | |
2030 goog.dom.findNodes_(a, b, c, !1); | |
2031 return c | |
2032 }; | |
2033 goog.dom.findNodes_ = function(a, b, c, d) { | |
2034 if(a != null) { | |
2035 for(a = a.firstChild;a;) { | |
2036 if(b(a) && (c.push(a), d)) { | |
2037 return!0 | |
2038 } | |
2039 if(goog.dom.findNodes_(a, b, c, d)) { | |
2040 return!0 | |
2041 } | |
2042 a = a.nextSibling | |
2043 } | |
2044 } | |
2045 return!1 | |
2046 }; | |
2047 goog.dom.TAGS_TO_IGNORE_ = {SCRIPT:1, STYLE:1, HEAD:1, IFRAME:1, OBJECT:1}; | |
2048 goog.dom.PREDEFINED_TAG_VALUES_ = {IMG:" ", BR:"\n"}; | |
2049 goog.dom.isFocusableTabIndex = function(a) { | |
2050 var b = a.getAttributeNode("tabindex"); | |
2051 return b && b.specified ? (a = a.tabIndex, goog.isNumber(a) && a >= 0 && a < 3
2768) : !1 | |
2052 }; | |
2053 goog.dom.setFocusableTabIndex = function(a, b) { | |
2054 b ? a.tabIndex = 0 : a.removeAttribute("tabIndex") | |
2055 }; | |
2056 goog.dom.getTextContent = function(a) { | |
2057 if(goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && "innerText" in a) { | |
2058 a = goog.string.canonicalizeNewlines(a.innerText) | |
2059 }else { | |
2060 var b = []; | |
2061 goog.dom.getTextContent_(a, b, !0); | |
2062 a = b.join("") | |
2063 } | |
2064 a = a.replace(/ \xAD /g, " ").replace(/\xAD/g, ""); | |
2065 a = a.replace(/\u200B/g, ""); | |
2066 goog.dom.BrowserFeature.CAN_USE_INNER_TEXT || (a = a.replace(/ +/g, " ")); | |
2067 a != " " && (a = a.replace(/^\s*/, "")); | |
2068 return a | |
2069 }; | |
2070 goog.dom.getRawTextContent = function(a) { | |
2071 var b = []; | |
2072 goog.dom.getTextContent_(a, b, !1); | |
2073 return b.join("") | |
2074 }; | |
2075 goog.dom.getTextContent_ = function(a, b, c) { | |
2076 if(!(a.nodeName in goog.dom.TAGS_TO_IGNORE_)) { | |
2077 if(a.nodeType == goog.dom.NodeType.TEXT) { | |
2078 c ? b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g, "")) : b.push(a.no
deValue) | |
2079 }else { | |
2080 if(a.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { | |
2081 b.push(goog.dom.PREDEFINED_TAG_VALUES_[a.nodeName]) | |
2082 }else { | |
2083 for(a = a.firstChild;a;) { | |
2084 goog.dom.getTextContent_(a, b, c), a = a.nextSibling | |
2085 } | |
2086 } | |
2087 } | |
2088 } | |
2089 }; | |
2090 goog.dom.getNodeTextLength = function(a) { | |
2091 return goog.dom.getTextContent(a).length | |
2092 }; | |
2093 goog.dom.getNodeTextOffset = function(a, b) { | |
2094 for(var c = b || goog.dom.getOwnerDocument(a).body, d = [];a && a != c;) { | |
2095 for(var e = a;e = e.previousSibling;) { | |
2096 d.unshift(goog.dom.getTextContent(e)) | |
2097 } | |
2098 a = a.parentNode | |
2099 } | |
2100 return goog.string.trimLeft(d.join("")).replace(/ +/g, " ").length | |
2101 }; | |
2102 goog.dom.getNodeAtOffset = function(a, b, c) { | |
2103 for(var a = [a], d = 0, e;a.length > 0 && d < b;) { | |
2104 if(e = a.pop(), !(e.nodeName in goog.dom.TAGS_TO_IGNORE_)) { | |
2105 if(e.nodeType == goog.dom.NodeType.TEXT) { | |
2106 var f = e.nodeValue.replace(/(\r\n|\r|\n)/g, "").replace(/ +/g, " "); | |
2107 d += f.length | |
2108 }else { | |
2109 if(e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { | |
2110 d += goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName].length | |
2111 }else { | |
2112 for(f = e.childNodes.length - 1;f >= 0;f--) { | |
2113 a.push(e.childNodes[f]) | |
2114 } | |
2115 } | |
2116 } | |
2117 } | |
2118 } | |
2119 if(goog.isObject(c)) { | |
2120 c.remainder = e ? e.nodeValue.length + b - d - 1 : 0, c.node = e | |
2121 } | |
2122 return e | |
2123 }; | |
2124 goog.dom.isNodeList = function(a) { | |
2125 if(a && typeof a.length == "number") { | |
2126 if(goog.isObject(a)) { | |
2127 return typeof a.item == "function" || typeof a.item == "string" | |
2128 }else { | |
2129 if(goog.isFunction(a)) { | |
2130 return typeof a.item == "function" | |
2131 } | |
2132 } | |
2133 } | |
2134 return!1 | |
2135 }; | |
2136 goog.dom.getAncestorByTagNameAndClass = function(a, b, c) { | |
2137 var d = b ? b.toUpperCase() : null; | |
2138 return goog.dom.getAncestor(a, function(a) { | |
2139 return(!d || a.nodeName == d) && (!c || goog.dom.classes.has(a, c)) | |
2140 }, !0) | |
2141 }; | |
2142 goog.dom.getAncestorByClass = function(a, b) { | |
2143 return goog.dom.getAncestorByTagNameAndClass(a, null, b) | |
2144 }; | |
2145 goog.dom.getAncestor = function(a, b, c, d) { | |
2146 if(!c) { | |
2147 a = a.parentNode | |
2148 } | |
2149 for(var c = d == null, e = 0;a && (c || e <= d);) { | |
2150 if(b(a)) { | |
2151 return a | |
2152 } | |
2153 a = a.parentNode; | |
2154 e++ | |
2155 } | |
2156 return null | |
2157 }; | |
2158 goog.dom.DomHelper = function(a) { | |
2159 this.document_ = a || goog.global.document || document | |
2160 }; | |
2161 goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper; | |
2162 goog.dom.DomHelper.prototype.setDocument = function(a) { | |
2163 this.document_ = a | |
2164 }; | |
2165 goog.dom.DomHelper.prototype.getDocument = function() { | |
2166 return this.document_ | |
2167 }; | |
2168 goog.dom.DomHelper.prototype.getElement = function(a) { | |
2169 return goog.isString(a) ? this.document_.getElementById(a) : a | |
2170 }; | |
2171 goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement; | |
2172 goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(a, b, c) { | |
2173 return goog.dom.getElementsByTagNameAndClass_(this.document_, a, b, c) | |
2174 }; | |
2175 goog.dom.DomHelper.prototype.getElementsByClass = function(a, b) { | |
2176 return goog.dom.getElementsByClass(a, b || this.document_) | |
2177 }; | |
2178 goog.dom.DomHelper.prototype.getElementByClass = function(a, b) { | |
2179 return goog.dom.getElementByClass(a, b || this.document_) | |
2180 }; | |
2181 goog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagN
ameAndClass; | |
2182 goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties; | |
2183 goog.dom.DomHelper.prototype.getViewportSize = function(a) { | |
2184 return goog.dom.getViewportSize(a || this.getWindow()) | |
2185 }; | |
2186 goog.dom.DomHelper.prototype.getDocumentHeight = function() { | |
2187 return goog.dom.getDocumentHeight_(this.getWindow()) | |
2188 }; | |
2189 goog.dom.DomHelper.prototype.createDom = function(a, b, c) { | |
2190 return goog.dom.createDom_(this.document_, arguments) | |
2191 }; | |
2192 goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom; | |
2193 goog.dom.DomHelper.prototype.createElement = function(a) { | |
2194 return this.document_.createElement(a) | |
2195 }; | |
2196 goog.dom.DomHelper.prototype.createTextNode = function(a) { | |
2197 return this.document_.createTextNode(a) | |
2198 }; | |
2199 goog.dom.DomHelper.prototype.createTable = function(a, b, c) { | |
2200 return goog.dom.createTable_(this.document_, a, b, !!c) | |
2201 }; | |
2202 goog.dom.DomHelper.prototype.htmlToDocumentFragment = function(a) { | |
2203 return goog.dom.htmlToDocumentFragment_(this.document_, a) | |
2204 }; | |
2205 goog.dom.DomHelper.prototype.getCompatMode = function() { | |
2206 return this.isCss1CompatMode() ? "CSS1Compat" : "BackCompat" | |
2207 }; | |
2208 goog.dom.DomHelper.prototype.isCss1CompatMode = function() { | |
2209 return goog.dom.isCss1CompatMode_(this.document_) | |
2210 }; | |
2211 goog.dom.DomHelper.prototype.getWindow = function() { | |
2212 return goog.dom.getWindow_(this.document_) | |
2213 }; | |
2214 goog.dom.DomHelper.prototype.getDocumentScrollElement = function() { | |
2215 return goog.dom.getDocumentScrollElement_(this.document_) | |
2216 }; | |
2217 goog.dom.DomHelper.prototype.getDocumentScroll = function() { | |
2218 return goog.dom.getDocumentScroll_(this.document_) | |
2219 }; | |
2220 goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild; | |
2221 goog.dom.DomHelper.prototype.append = goog.dom.append; | |
2222 goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren; | |
2223 goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore; | |
2224 goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter; | |
2225 goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode; | |
2226 goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode; | |
2227 goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement; | |
2228 goog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChil
d; | |
2229 goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild; | |
2230 goog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibl
ing; | |
2231 goog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousEle
mentSibling; | |
2232 goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode; | |
2233 goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode; | |
2234 goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike; | |
2235 goog.dom.DomHelper.prototype.contains = goog.dom.contains; | |
2236 goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument; | |
2237 goog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentD
ocument; | |
2238 goog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWin
dow; | |
2239 goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent; | |
2240 goog.dom.DomHelper.prototype.findNode = goog.dom.findNode; | |
2241 goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes; | |
2242 goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent; | |
2243 goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength; | |
2244 goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset; | |
2245 goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestor
ByTagNameAndClass; | |
2246 goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass; | |
2247 goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor; | |
2248 goog.disposable = {}; | |
2249 goog.disposable.IDisposable = function() { | |
2250 }; | |
2251 goog.Disposable = function() { | |
2252 goog.Disposable.ENABLE_MONITORING && (goog.Disposable.instances_[goog.getUid(t
his)] = this) | |
2253 }; | |
2254 goog.Disposable.ENABLE_MONITORING = !1; | |
2255 goog.Disposable.instances_ = {}; | |
2256 goog.Disposable.getUndisposedObjects = function() { | |
2257 var a = [], b; | |
2258 for(b in goog.Disposable.instances_) { | |
2259 goog.Disposable.instances_.hasOwnProperty(b) && a.push(goog.Disposable.insta
nces_[Number(b)]) | |
2260 } | |
2261 return a | |
2262 }; | |
2263 goog.Disposable.clearUndisposedObjects = function() { | |
2264 goog.Disposable.instances_ = {} | |
2265 }; | |
2266 goog.Disposable.prototype.disposed_ = !1; | |
2267 goog.Disposable.prototype.isDisposed = function() { | |
2268 return this.disposed_ | |
2269 }; | |
2270 goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed; | |
2271 goog.Disposable.prototype.dispose = function() { | |
2272 if(!this.disposed_ && (this.disposed_ = !0, this.disposeInternal(), goog.Dispo
sable.ENABLE_MONITORING)) { | |
2273 var a = goog.getUid(this); | |
2274 if(!goog.Disposable.instances_.hasOwnProperty(a)) { | |
2275 throw Error(this + " did not call the goog.Disposable base constructor or
was disposed of after a clearUndisposedObjects call"); | |
2276 } | |
2277 delete goog.Disposable.instances_[a] | |
2278 } | |
2279 }; | |
2280 goog.Disposable.prototype.registerDisposable = function(a) { | |
2281 if(!this.dependentDisposables_) { | |
2282 this.dependentDisposables_ = [] | |
2283 } | |
2284 this.dependentDisposables_.push(a) | |
2285 }; | |
2286 goog.Disposable.prototype.disposeInternal = function() { | |
2287 this.dependentDisposables_ && goog.disposeAll.apply(null, this.dependentDispos
ables_) | |
2288 }; | |
2289 goog.dispose = function(a) { | |
2290 a && typeof a.dispose == "function" && a.dispose() | |
2291 }; | |
2292 goog.disposeAll = function(a) { | |
2293 for(var b = 0, c = arguments.length;b < c;++b) { | |
2294 var d = arguments[b]; | |
2295 goog.isArrayLike(d) ? goog.disposeAll.apply(null, d) : goog.dispose(d) | |
2296 } | |
2297 }; | |
2298 goog.debug.entryPointRegistry = {}; | |
2299 goog.debug.EntryPointMonitor = function() { | |
2300 }; | |
2301 goog.debug.entryPointRegistry.refList_ = []; | |
2302 goog.debug.entryPointRegistry.register = function(a) { | |
2303 goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.
length] = a | |
2304 }; | |
2305 goog.debug.entryPointRegistry.monitorAll = function(a) { | |
2306 for(var a = goog.bind(a.wrap, a), b = 0;b < goog.debug.entryPointRegistry.refL
ist_.length;b++) { | |
2307 goog.debug.entryPointRegistry.refList_[b](a) | |
2308 } | |
2309 }; | |
2310 goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(a) { | |
2311 for(var a = goog.bind(a.unwrap, a), b = 0;b < goog.debug.entryPointRegistry.re
fList_.length;b++) { | |
2312 goog.debug.entryPointRegistry.refList_[b](a) | |
2313 } | |
2314 }; | |
2315 goog.debug.errorHandlerWeakDep = {protectEntryPoint:function(a) { | |
2316 return a | |
2317 }}; | |
2318 goog.events = {}; | |
2319 goog.events.BrowserFeature = {HAS_W3C_BUTTON:!goog.userAgent.IE || goog.userAgen
t.isDocumentMode(9), SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE && !goog.
userAgent.isVersion("8")}; | |
2320 goog.events.Event = function(a, b) { | |
2321 goog.Disposable.call(this); | |
2322 this.type = a; | |
2323 this.currentTarget = this.target = b | |
2324 }; | |
2325 goog.inherits(goog.events.Event, goog.Disposable); | |
2326 goog.events.Event.prototype.disposeInternal = function() { | |
2327 delete this.type; | |
2328 delete this.target; | |
2329 delete this.currentTarget | |
2330 }; | |
2331 goog.events.Event.prototype.propagationStopped_ = !1; | |
2332 goog.events.Event.prototype.returnValue_ = !0; | |
2333 goog.events.Event.prototype.stopPropagation = function() { | |
2334 this.propagationStopped_ = !0 | |
2335 }; | |
2336 goog.events.Event.prototype.preventDefault = function() { | |
2337 this.returnValue_ = !1 | |
2338 }; | |
2339 goog.events.Event.stopPropagation = function(a) { | |
2340 a.stopPropagation() | |
2341 }; | |
2342 goog.events.Event.preventDefault = function(a) { | |
2343 a.preventDefault() | |
2344 }; | |
2345 goog.events.EventType = {CLICK:"click", DBLCLICK:"dblclick", MOUSEDOWN:"mousedow
n", MOUSEUP:"mouseup", MOUSEOVER:"mouseover", MOUSEOUT:"mouseout", MOUSEMOVE:"mo
usemove", SELECTSTART:"selectstart", KEYPRESS:"keypress", KEYDOWN:"keydown", KEY
UP:"keyup", BLUR:"blur", FOCUS:"focus", DEACTIVATE:"deactivate", FOCUSIN:goog.us
erAgent.IE ? "focusin" : "DOMFocusIn", FOCUSOUT:goog.userAgent.IE ? "focusout" :
"DOMFocusOut", CHANGE:"change", SELECT:"select", SUBMIT:"submit", INPUT:"input"
, PROPERTYCHANGE:"propertychange", | |
2346 DRAGSTART:"dragstart", DRAGENTER:"dragenter", DRAGOVER:"dragover", DRAGLEAVE:"dr
agleave", DROP:"drop", TOUCHSTART:"touchstart", TOUCHMOVE:"touchmove", TOUCHEND:
"touchend", TOUCHCANCEL:"touchcancel", CONTEXTMENU:"contextmenu", ERROR:"error",
HELP:"help", LOAD:"load", LOSECAPTURE:"losecapture", READYSTATECHANGE:"readysta
techange", RESIZE:"resize", SCROLL:"scroll", UNLOAD:"unload", HASHCHANGE:"hashch
ange", PAGEHIDE:"pagehide", PAGESHOW:"pageshow", POPSTATE:"popstate", COPY:"copy
", PASTE:"paste", CUT:"cut", | |
2347 BEFORECOPY:"beforecopy", BEFORECUT:"beforecut", BEFOREPASTE:"beforepaste", MESSA
GE:"message", CONNECT:"connect"}; | |
2348 goog.reflect = {}; | |
2349 goog.reflect.object = function(a, b) { | |
2350 return b | |
2351 }; | |
2352 goog.reflect.sinkValue = new Function("a", "return a"); | |
2353 goog.reflect.canAccessProperty = function(a, b) { | |
2354 try { | |
2355 return goog.reflect.sinkValue(a[b]), !0 | |
2356 }catch(c) { | |
2357 } | |
2358 return!1 | |
2359 }; | |
2360 goog.events.BrowserEvent = function(a, b) { | |
2361 a && this.init(a, b) | |
2362 }; | |
2363 goog.inherits(goog.events.BrowserEvent, goog.events.Event); | |
2364 goog.events.BrowserEvent.MouseButton = {LEFT:0, MIDDLE:1, RIGHT:2}; | |
2365 goog.events.BrowserEvent.IEButtonMap = [1, 4, 2]; | |
2366 goog.events.BrowserEvent.prototype.target = null; | |
2367 goog.events.BrowserEvent.prototype.relatedTarget = null; | |
2368 goog.events.BrowserEvent.prototype.offsetX = 0; | |
2369 goog.events.BrowserEvent.prototype.offsetY = 0; | |
2370 goog.events.BrowserEvent.prototype.clientX = 0; | |
2371 goog.events.BrowserEvent.prototype.clientY = 0; | |
2372 goog.events.BrowserEvent.prototype.screenX = 0; | |
2373 goog.events.BrowserEvent.prototype.screenY = 0; | |
2374 goog.events.BrowserEvent.prototype.button = 0; | |
2375 goog.events.BrowserEvent.prototype.keyCode = 0; | |
2376 goog.events.BrowserEvent.prototype.charCode = 0; | |
2377 goog.events.BrowserEvent.prototype.ctrlKey = !1; | |
2378 goog.events.BrowserEvent.prototype.altKey = !1; | |
2379 goog.events.BrowserEvent.prototype.shiftKey = !1; | |
2380 goog.events.BrowserEvent.prototype.metaKey = !1; | |
2381 goog.events.BrowserEvent.prototype.platformModifierKey = !1; | |
2382 goog.events.BrowserEvent.prototype.event_ = null; | |
2383 goog.events.BrowserEvent.prototype.init = function(a, b) { | |
2384 var c = this.type = a.type; | |
2385 goog.events.Event.call(this, c); | |
2386 this.target = a.target || a.srcElement; | |
2387 this.currentTarget = b; | |
2388 var d = a.relatedTarget; | |
2389 if(d) { | |
2390 goog.userAgent.GECKO && (goog.reflect.canAccessProperty(d, "nodeName") || (d
= null)) | |
2391 }else { | |
2392 if(c == goog.events.EventType.MOUSEOVER) { | |
2393 d = a.fromElement | |
2394 }else { | |
2395 if(c == goog.events.EventType.MOUSEOUT) { | |
2396 d = a.toElement | |
2397 } | |
2398 } | |
2399 } | |
2400 this.relatedTarget = d; | |
2401 this.offsetX = a.offsetX !== void 0 ? a.offsetX : a.layerX; | |
2402 this.offsetY = a.offsetY !== void 0 ? a.offsetY : a.layerY; | |
2403 this.clientX = a.clientX !== void 0 ? a.clientX : a.pageX; | |
2404 this.clientY = a.clientY !== void 0 ? a.clientY : a.pageY; | |
2405 this.screenX = a.screenX || 0; | |
2406 this.screenY = a.screenY || 0; | |
2407 this.button = a.button; | |
2408 this.keyCode = a.keyCode || 0; | |
2409 this.charCode = a.charCode || (c == "keypress" ? a.keyCode : 0); | |
2410 this.ctrlKey = a.ctrlKey; | |
2411 this.altKey = a.altKey; | |
2412 this.shiftKey = a.shiftKey; | |
2413 this.metaKey = a.metaKey; | |
2414 this.platformModifierKey = goog.userAgent.MAC ? a.metaKey : a.ctrlKey; | |
2415 this.state = a.state; | |
2416 this.event_ = a; | |
2417 delete this.returnValue_; | |
2418 delete this.propagationStopped_ | |
2419 }; | |
2420 goog.events.BrowserEvent.prototype.isButton = function(a) { | |
2421 return goog.events.BrowserFeature.HAS_W3C_BUTTON ? this.event_.button == a : t
his.type == "click" ? a == goog.events.BrowserEvent.MouseButton.LEFT : !!(this.e
vent_.button & goog.events.BrowserEvent.IEButtonMap[a]) | |
2422 }; | |
2423 goog.events.BrowserEvent.prototype.isMouseActionButton = function() { | |
2424 return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && !(goog.user
Agent.WEBKIT && goog.userAgent.MAC && this.ctrlKey) | |
2425 }; | |
2426 goog.events.BrowserEvent.prototype.stopPropagation = function() { | |
2427 goog.events.BrowserEvent.superClass_.stopPropagation.call(this); | |
2428 this.event_.stopPropagation ? this.event_.stopPropagation() : this.event_.canc
elBubble = !0 | |
2429 }; | |
2430 goog.events.BrowserEvent.prototype.preventDefault = function() { | |
2431 goog.events.BrowserEvent.superClass_.preventDefault.call(this); | |
2432 var a = this.event_; | |
2433 if(a.preventDefault) { | |
2434 a.preventDefault() | |
2435 }else { | |
2436 if(a.returnValue = !1, goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DE
FAULT) { | |
2437 try { | |
2438 if(a.ctrlKey || a.keyCode >= 112 && a.keyCode <= 123) { | |
2439 a.keyCode = -1 | |
2440 } | |
2441 }catch(b) { | |
2442 } | |
2443 } | |
2444 } | |
2445 }; | |
2446 goog.events.BrowserEvent.prototype.getBrowserEvent = function() { | |
2447 return this.event_ | |
2448 }; | |
2449 goog.events.BrowserEvent.prototype.disposeInternal = function() { | |
2450 goog.events.BrowserEvent.superClass_.disposeInternal.call(this); | |
2451 this.relatedTarget = this.currentTarget = this.target = this.event_ = null | |
2452 }; | |
2453 goog.events.EventWrapper = function() { | |
2454 }; | |
2455 goog.events.EventWrapper.prototype.listen = function() { | |
2456 }; | |
2457 goog.events.EventWrapper.prototype.unlisten = function() { | |
2458 }; | |
2459 goog.events.Listener = function() { | |
2460 }; | |
2461 goog.events.Listener.counter_ = 0; | |
2462 goog.events.Listener.prototype.key = 0; | |
2463 goog.events.Listener.prototype.removed = !1; | |
2464 goog.events.Listener.prototype.callOnce = !1; | |
2465 goog.events.Listener.prototype.init = function(a, b, c, d, e, f) { | |
2466 if(goog.isFunction(a)) { | |
2467 this.isFunctionListener_ = !0 | |
2468 }else { | |
2469 if(a && a.handleEvent && goog.isFunction(a.handleEvent)) { | |
2470 this.isFunctionListener_ = !1 | |
2471 }else { | |
2472 throw Error("Invalid listener argument"); | |
2473 } | |
2474 } | |
2475 this.listener = a; | |
2476 this.proxy = b; | |
2477 this.src = c; | |
2478 this.type = d; | |
2479 this.capture = !!e; | |
2480 this.handler = f; | |
2481 this.callOnce = !1; | |
2482 this.key = ++goog.events.Listener.counter_; | |
2483 this.removed = !1 | |
2484 }; | |
2485 goog.events.Listener.prototype.handleEvent = function(a) { | |
2486 return this.isFunctionListener_ ? this.listener.call(this.handler || this.src,
a) : this.listener.handleEvent.call(this.listener, a) | |
2487 }; | |
2488 goog.structs = {}; | |
2489 goog.structs.SimplePool = function(a, b) { | |
2490 goog.Disposable.call(this); | |
2491 this.maxCount_ = b; | |
2492 this.freeQueue_ = []; | |
2493 this.createInitial_(a) | |
2494 }; | |
2495 goog.inherits(goog.structs.SimplePool, goog.Disposable); | |
2496 goog.structs.SimplePool.prototype.createObjectFn_ = null; | |
2497 goog.structs.SimplePool.prototype.disposeObjectFn_ = null; | |
2498 goog.structs.SimplePool.prototype.setCreateObjectFn = function(a) { | |
2499 this.createObjectFn_ = a | |
2500 }; | |
2501 goog.structs.SimplePool.prototype.setDisposeObjectFn = function(a) { | |
2502 this.disposeObjectFn_ = a | |
2503 }; | |
2504 goog.structs.SimplePool.prototype.getObject = function() { | |
2505 return this.freeQueue_.length ? this.freeQueue_.pop() : this.createObject() | |
2506 }; | |
2507 goog.structs.SimplePool.prototype.releaseObject = function(a) { | |
2508 this.freeQueue_.length < this.maxCount_ ? this.freeQueue_.push(a) : this.dispo
seObject(a) | |
2509 }; | |
2510 goog.structs.SimplePool.prototype.createInitial_ = function(a) { | |
2511 if(a > this.maxCount_) { | |
2512 throw Error("[goog.structs.SimplePool] Initial cannot be greater than max"); | |
2513 } | |
2514 for(var b = 0;b < a;b++) { | |
2515 this.freeQueue_.push(this.createObject()) | |
2516 } | |
2517 }; | |
2518 goog.structs.SimplePool.prototype.createObject = function() { | |
2519 return this.createObjectFn_ ? this.createObjectFn_() : {} | |
2520 }; | |
2521 goog.structs.SimplePool.prototype.disposeObject = function(a) { | |
2522 if(this.disposeObjectFn_) { | |
2523 this.disposeObjectFn_(a) | |
2524 }else { | |
2525 if(goog.isObject(a)) { | |
2526 if(goog.isFunction(a.dispose)) { | |
2527 a.dispose() | |
2528 }else { | |
2529 for(var b in a) { | |
2530 delete a[b] | |
2531 } | |
2532 } | |
2533 } | |
2534 } | |
2535 }; | |
2536 goog.structs.SimplePool.prototype.disposeInternal = function() { | |
2537 goog.structs.SimplePool.superClass_.disposeInternal.call(this); | |
2538 for(var a = this.freeQueue_;a.length;) { | |
2539 this.disposeObject(a.pop()) | |
2540 } | |
2541 delete this.freeQueue_ | |
2542 }; | |
2543 goog.userAgent.jscript = {}; | |
2544 goog.userAgent.jscript.ASSUME_NO_JSCRIPT = !1; | |
2545 goog.userAgent.jscript.init_ = function() { | |
2546 goog.userAgent.jscript.DETECTED_HAS_JSCRIPT_ = "ScriptEngine" in goog.global &
& goog.global.ScriptEngine() == "JScript"; | |
2547 goog.userAgent.jscript.DETECTED_VERSION_ = goog.userAgent.jscript.DETECTED_HAS
_JSCRIPT_ ? goog.global.ScriptEngineMajorVersion() + "." + goog.global.ScriptEng
ineMinorVersion() + "." + goog.global.ScriptEngineBuildVersion() : "0" | |
2548 }; | |
2549 goog.userAgent.jscript.ASSUME_NO_JSCRIPT || goog.userAgent.jscript.init_(); | |
2550 goog.userAgent.jscript.HAS_JSCRIPT = goog.userAgent.jscript.ASSUME_NO_JSCRIPT ?
!1 : goog.userAgent.jscript.DETECTED_HAS_JSCRIPT_; | |
2551 goog.userAgent.jscript.VERSION = goog.userAgent.jscript.ASSUME_NO_JSCRIPT ? "0"
: goog.userAgent.jscript.DETECTED_VERSION_; | |
2552 goog.userAgent.jscript.isVersion = function(a) { | |
2553 return goog.string.compareVersions(goog.userAgent.jscript.VERSION, a) >= 0 | |
2554 }; | |
2555 goog.events.pools = {}; | |
2556 goog.events.ASSUME_GOOD_GC = !1; | |
2557 (function() { | |
2558 function a() { | |
2559 return{count_:0, remaining_:0} | |
2560 } | |
2561 function b() { | |
2562 return[] | |
2563 } | |
2564 function c() { | |
2565 var a = function(b) { | |
2566 b = g.call(a.src, a.key, b); | |
2567 if(!b) { | |
2568 return b | |
2569 } | |
2570 }; | |
2571 return a | |
2572 } | |
2573 function d() { | |
2574 return new goog.events.Listener | |
2575 } | |
2576 function e() { | |
2577 return new goog.events.BrowserEvent | |
2578 } | |
2579 var f = !goog.events.ASSUME_GOOD_GC && goog.userAgent.jscript.HAS_JSCRIPT && !
goog.userAgent.jscript.isVersion("5.7"), g; | |
2580 goog.events.pools.setProxyCallbackFunction = function(a) { | |
2581 g = a | |
2582 }; | |
2583 if(f) { | |
2584 goog.events.pools.getObject = function() { | |
2585 return h.getObject() | |
2586 }; | |
2587 goog.events.pools.releaseObject = function(a) { | |
2588 h.releaseObject(a) | |
2589 }; | |
2590 goog.events.pools.getArray = function() { | |
2591 return i.getObject() | |
2592 }; | |
2593 goog.events.pools.releaseArray = function(a) { | |
2594 i.releaseObject(a) | |
2595 }; | |
2596 goog.events.pools.getProxy = function() { | |
2597 return j.getObject() | |
2598 }; | |
2599 goog.events.pools.releaseProxy = function() { | |
2600 j.releaseObject(c()) | |
2601 }; | |
2602 goog.events.pools.getListener = function() { | |
2603 return k.getObject() | |
2604 }; | |
2605 goog.events.pools.releaseListener = function(a) { | |
2606 k.releaseObject(a) | |
2607 }; | |
2608 goog.events.pools.getEvent = function() { | |
2609 return m.getObject() | |
2610 }; | |
2611 goog.events.pools.releaseEvent = function(a) { | |
2612 m.releaseObject(a) | |
2613 }; | |
2614 var h = new goog.structs.SimplePool(0, 600); | |
2615 h.setCreateObjectFn(a); | |
2616 var i = new goog.structs.SimplePool(0, 600); | |
2617 i.setCreateObjectFn(b); | |
2618 var j = new goog.structs.SimplePool(0, 600); | |
2619 j.setCreateObjectFn(c); | |
2620 var k = new goog.structs.SimplePool(0, 600); | |
2621 k.setCreateObjectFn(d); | |
2622 var m = new goog.structs.SimplePool(0, 600); | |
2623 m.setCreateObjectFn(e) | |
2624 }else { | |
2625 goog.events.pools.getObject = a, goog.events.pools.releaseObject = goog.null
Function, goog.events.pools.getArray = b, goog.events.pools.releaseArray = goog.
nullFunction, goog.events.pools.getProxy = c, goog.events.pools.releaseProxy = g
oog.nullFunction, goog.events.pools.getListener = d, goog.events.pools.releaseLi
stener = goog.nullFunction, goog.events.pools.getEvent = e, goog.events.pools.re
leaseEvent = goog.nullFunction | |
2626 } | |
2627 })(); | |
2628 goog.events.listeners_ = {}; | |
2629 goog.events.listenerTree_ = {}; | |
2630 goog.events.sources_ = {}; | |
2631 goog.events.onString_ = "on"; | |
2632 goog.events.onStringMap_ = {}; | |
2633 goog.events.keySeparator_ = "_"; | |
2634 goog.events.listen = function(a, b, c, d, e) { | |
2635 if(b) { | |
2636 if(goog.isArray(b)) { | |
2637 for(var f = 0;f < b.length;f++) { | |
2638 goog.events.listen(a, b[f], c, d, e) | |
2639 } | |
2640 return null | |
2641 }else { | |
2642 var d = !!d, g = goog.events.listenerTree_; | |
2643 b in g || (g[b] = goog.events.pools.getObject()); | |
2644 g = g[b]; | |
2645 d in g || (g[d] = goog.events.pools.getObject(), g.count_++); | |
2646 var g = g[d], h = goog.getUid(a), i; | |
2647 g.remaining_++; | |
2648 if(g[h]) { | |
2649 i = g[h]; | |
2650 for(f = 0;f < i.length;f++) { | |
2651 if(g = i[f], g.listener == c && g.handler == e) { | |
2652 if(g.removed) { | |
2653 break | |
2654 } | |
2655 return i[f].key | |
2656 } | |
2657 } | |
2658 }else { | |
2659 i = g[h] = goog.events.pools.getArray(), g.count_++ | |
2660 } | |
2661 f = goog.events.pools.getProxy(); | |
2662 f.src = a; | |
2663 g = goog.events.pools.getListener(); | |
2664 g.init(c, f, a, b, d, e); | |
2665 c = g.key; | |
2666 f.key = c; | |
2667 i.push(g); | |
2668 goog.events.listeners_[c] = g; | |
2669 goog.events.sources_[h] || (goog.events.sources_[h] = goog.events.pools.ge
tArray()); | |
2670 goog.events.sources_[h].push(g); | |
2671 a.addEventListener ? (a == goog.global || !a.customEvent_) && a.addEventLi
stener(b, f, d) : a.attachEvent(goog.events.getOnString_(b), f); | |
2672 return c | |
2673 } | |
2674 }else { | |
2675 throw Error("Invalid event type"); | |
2676 } | |
2677 }; | |
2678 goog.events.listenOnce = function(a, b, c, d, e) { | |
2679 if(goog.isArray(b)) { | |
2680 for(var f = 0;f < b.length;f++) { | |
2681 goog.events.listenOnce(a, b[f], c, d, e) | |
2682 } | |
2683 return null | |
2684 } | |
2685 a = goog.events.listen(a, b, c, d, e); | |
2686 goog.events.listeners_[a].callOnce = !0; | |
2687 return a | |
2688 }; | |
2689 goog.events.listenWithWrapper = function(a, b, c, d, e) { | |
2690 b.listen(a, c, d, e) | |
2691 }; | |
2692 goog.events.unlisten = function(a, b, c, d, e) { | |
2693 if(goog.isArray(b)) { | |
2694 for(var f = 0;f < b.length;f++) { | |
2695 goog.events.unlisten(a, b[f], c, d, e) | |
2696 } | |
2697 return null | |
2698 } | |
2699 d = !!d; | |
2700 a = goog.events.getListeners_(a, b, d); | |
2701 if(!a) { | |
2702 return!1 | |
2703 } | |
2704 for(f = 0;f < a.length;f++) { | |
2705 if(a[f].listener == c && a[f].capture == d && a[f].handler == e) { | |
2706 return goog.events.unlistenByKey(a[f].key) | |
2707 } | |
2708 } | |
2709 return!1 | |
2710 }; | |
2711 goog.events.unlistenByKey = function(a) { | |
2712 if(!goog.events.listeners_[a]) { | |
2713 return!1 | |
2714 } | |
2715 var b = goog.events.listeners_[a]; | |
2716 if(b.removed) { | |
2717 return!1 | |
2718 } | |
2719 var c = b.src, d = b.type, e = b.proxy, f = b.capture; | |
2720 c.removeEventListener ? (c == goog.global || !c.customEvent_) && c.removeEvent
Listener(d, e, f) : c.detachEvent && c.detachEvent(goog.events.getOnString_(d),
e); | |
2721 c = goog.getUid(c); | |
2722 e = goog.events.listenerTree_[d][f][c]; | |
2723 if(goog.events.sources_[c]) { | |
2724 var g = goog.events.sources_[c]; | |
2725 goog.array.remove(g, b); | |
2726 g.length == 0 && delete goog.events.sources_[c] | |
2727 } | |
2728 b.removed = !0; | |
2729 e.needsCleanup_ = !0; | |
2730 goog.events.cleanUp_(d, f, c, e); | |
2731 delete goog.events.listeners_[a]; | |
2732 return!0 | |
2733 }; | |
2734 goog.events.unlistenWithWrapper = function(a, b, c, d, e) { | |
2735 b.unlisten(a, c, d, e) | |
2736 }; | |
2737 goog.events.cleanUp_ = function(a, b, c, d) { | |
2738 if(!d.locked_ && d.needsCleanup_) { | |
2739 for(var e = 0, f = 0;e < d.length;e++) { | |
2740 if(d[e].removed) { | |
2741 var g = d[e].proxy; | |
2742 g.src = null; | |
2743 goog.events.pools.releaseProxy(g); | |
2744 goog.events.pools.releaseListener(d[e]) | |
2745 }else { | |
2746 e != f && (d[f] = d[e]), f++ | |
2747 } | |
2748 } | |
2749 d.length = f; | |
2750 d.needsCleanup_ = !1; | |
2751 f == 0 && (goog.events.pools.releaseArray(d), delete goog.events.listenerTre
e_[a][b][c], goog.events.listenerTree_[a][b].count_--, goog.events.listenerTree_
[a][b].count_ == 0 && (goog.events.pools.releaseObject(goog.events.listenerTree_
[a][b]), delete goog.events.listenerTree_[a][b], goog.events.listenerTree_[a].co
unt_--), goog.events.listenerTree_[a].count_ == 0 && (goog.events.pools.releaseO
bject(goog.events.listenerTree_[a]), delete goog.events.listenerTree_[a])) | |
2752 } | |
2753 }; | |
2754 goog.events.removeAll = function(a, b, c) { | |
2755 var d = 0, e = b == null, f = c == null, c = !!c; | |
2756 if(a == null) { | |
2757 goog.object.forEach(goog.events.sources_, function(a) { | |
2758 for(var g = a.length - 1;g >= 0;g--) { | |
2759 var h = a[g]; | |
2760 if((e || b == h.type) && (f || c == h.capture)) { | |
2761 goog.events.unlistenByKey(h.key), d++ | |
2762 } | |
2763 } | |
2764 }) | |
2765 }else { | |
2766 if(a = goog.getUid(a), goog.events.sources_[a]) { | |
2767 for(var a = goog.events.sources_[a], g = a.length - 1;g >= 0;g--) { | |
2768 var h = a[g]; | |
2769 if((e || b == h.type) && (f || c == h.capture)) { | |
2770 goog.events.unlistenByKey(h.key), d++ | |
2771 } | |
2772 } | |
2773 } | |
2774 } | |
2775 return d | |
2776 }; | |
2777 goog.events.getListeners = function(a, b, c) { | |
2778 return goog.events.getListeners_(a, b, c) || [] | |
2779 }; | |
2780 goog.events.getListeners_ = function(a, b, c) { | |
2781 var d = goog.events.listenerTree_; | |
2782 return b in d && (d = d[b], c in d && (d = d[c], a = goog.getUid(a), d[a])) ?
d[a] : null | |
2783 }; | |
2784 goog.events.getListener = function(a, b, c, d, e) { | |
2785 d = !!d; | |
2786 if(a = goog.events.getListeners_(a, b, d)) { | |
2787 for(b = 0;b < a.length;b++) { | |
2788 if(!a[b].removed && a[b].listener == c && a[b].capture == d && a[b].handle
r == e) { | |
2789 return a[b] | |
2790 } | |
2791 } | |
2792 } | |
2793 return null | |
2794 }; | |
2795 goog.events.hasListener = function(a, b, c) { | |
2796 var a = goog.getUid(a), d = goog.events.sources_[a]; | |
2797 if(d) { | |
2798 var e = goog.isDef(b), f = goog.isDef(c); | |
2799 return e && f ? (d = goog.events.listenerTree_[b], !!d && !!d[c] && a in d[c
]) : !e && !f ? !0 : goog.array.some(d, function(a) { | |
2800 return e && a.type == b || f && a.capture == c | |
2801 }) | |
2802 } | |
2803 return!1 | |
2804 }; | |
2805 goog.events.expose = function(a) { | |
2806 var b = [], c; | |
2807 for(c in a) { | |
2808 a[c] && a[c].id ? b.push(c + " = " + a[c] + " (" + a[c].id + ")") : b.push(c
+ " = " + a[c]) | |
2809 } | |
2810 return b.join("\n") | |
2811 }; | |
2812 goog.events.getOnString_ = function(a) { | |
2813 return a in goog.events.onStringMap_ ? goog.events.onStringMap_[a] : goog.even
ts.onStringMap_[a] = goog.events.onString_ + a | |
2814 }; | |
2815 goog.events.fireListeners = function(a, b, c, d) { | |
2816 var e = goog.events.listenerTree_; | |
2817 return b in e && (e = e[b], c in e) ? goog.events.fireListeners_(e[c], a, b, c
, d) : !0 | |
2818 }; | |
2819 goog.events.fireListeners_ = function(a, b, c, d, e) { | |
2820 var f = 1, b = goog.getUid(b); | |
2821 if(a[b]) { | |
2822 a.remaining_--; | |
2823 a = a[b]; | |
2824 a.locked_ ? a.locked_++ : a.locked_ = 1; | |
2825 try { | |
2826 for(var g = a.length, h = 0;h < g;h++) { | |
2827 var i = a[h]; | |
2828 i && !i.removed && (f &= goog.events.fireListener(i, e) !== !1) | |
2829 } | |
2830 }finally { | |
2831 a.locked_--, goog.events.cleanUp_(c, d, b, a) | |
2832 } | |
2833 } | |
2834 return Boolean(f) | |
2835 }; | |
2836 goog.events.fireListener = function(a, b) { | |
2837 var c = a.handleEvent(b); | |
2838 a.callOnce && goog.events.unlistenByKey(a.key); | |
2839 return c | |
2840 }; | |
2841 goog.events.getTotalListenerCount = function() { | |
2842 return goog.object.getCount(goog.events.listeners_) | |
2843 }; | |
2844 goog.events.dispatchEvent = function(a, b) { | |
2845 var c = b.type || b, d = goog.events.listenerTree_; | |
2846 if(!(c in d)) { | |
2847 return!0 | |
2848 } | |
2849 if(goog.isString(b)) { | |
2850 b = new goog.events.Event(b, a) | |
2851 }else { | |
2852 if(b instanceof goog.events.Event) { | |
2853 b.target = b.target || a | |
2854 }else { | |
2855 var e = b, b = new goog.events.Event(c, a); | |
2856 goog.object.extend(b, e) | |
2857 } | |
2858 } | |
2859 var e = 1, f, d = d[c], c = !0 in d, g; | |
2860 if(c) { | |
2861 f = []; | |
2862 for(g = a;g;g = g.getParentEventTarget()) { | |
2863 f.push(g) | |
2864 } | |
2865 g = d[!0]; | |
2866 g.remaining_ = g.count_; | |
2867 for(var h = f.length - 1;!b.propagationStopped_ && h >= 0 && g.remaining_;h-
-) { | |
2868 b.currentTarget = f[h], e &= goog.events.fireListeners_(g, f[h], b.type, !
0, b) && b.returnValue_ != !1 | |
2869 } | |
2870 } | |
2871 if(!1 in d) { | |
2872 if(g = d[!1], g.remaining_ = g.count_, c) { | |
2873 for(h = 0;!b.propagationStopped_ && h < f.length && g.remaining_;h++) { | |
2874 b.currentTarget = f[h], e &= goog.events.fireListeners_(g, f[h], b.type,
!1, b) && b.returnValue_ != !1 | |
2875 } | |
2876 }else { | |
2877 for(d = a;!b.propagationStopped_ && d && g.remaining_;d = d.getParentEvent
Target()) { | |
2878 b.currentTarget = d, e &= goog.events.fireListeners_(g, d, b.type, !1, b
) && b.returnValue_ != !1 | |
2879 } | |
2880 } | |
2881 } | |
2882 return Boolean(e) | |
2883 }; | |
2884 goog.events.protectBrowserEventEntryPoint = function(a) { | |
2885 goog.events.handleBrowserEvent_ = a.protectEntryPoint(goog.events.handleBrowse
rEvent_); | |
2886 goog.events.pools.setProxyCallbackFunction(goog.events.handleBrowserEvent_) | |
2887 }; | |
2888 goog.events.handleBrowserEvent_ = function(a, b) { | |
2889 if(!goog.events.listeners_[a]) { | |
2890 return!0 | |
2891 } | |
2892 var c = goog.events.listeners_[a], d = c.type, e = goog.events.listenerTree_; | |
2893 if(!(d in e)) { | |
2894 return!0 | |
2895 } | |
2896 var e = e[d], f, g; | |
2897 if(goog.events.synthesizeEventPropagation_()) { | |
2898 f = b || goog.getObjectByName("window.event"); | |
2899 var h = !0 in e, i = !1 in e; | |
2900 if(h) { | |
2901 if(goog.events.isMarkedIeEvent_(f)) { | |
2902 return!0 | |
2903 } | |
2904 goog.events.markIeEvent_(f) | |
2905 } | |
2906 var j = goog.events.pools.getEvent(); | |
2907 j.init(f, this); | |
2908 f = !0; | |
2909 try { | |
2910 if(h) { | |
2911 for(var k = goog.events.pools.getArray(), m = j.currentTarget;m;m = m.pa
rentNode) { | |
2912 k.push(m) | |
2913 } | |
2914 g = e[!0]; | |
2915 g.remaining_ = g.count_; | |
2916 for(var l = k.length - 1;!j.propagationStopped_ && l >= 0 && g.remaining
_;l--) { | |
2917 j.currentTarget = k[l], f &= goog.events.fireListeners_(g, k[l], d, !0
, j) | |
2918 } | |
2919 if(i) { | |
2920 g = e[!1]; | |
2921 g.remaining_ = g.count_; | |
2922 for(l = 0;!j.propagationStopped_ && l < k.length && g.remaining_;l++)
{ | |
2923 j.currentTarget = k[l], f &= goog.events.fireListeners_(g, k[l], d,
!1, j) | |
2924 } | |
2925 } | |
2926 }else { | |
2927 f = goog.events.fireListener(c, j) | |
2928 } | |
2929 }finally { | |
2930 if(k) { | |
2931 k.length = 0, goog.events.pools.releaseArray(k) | |
2932 } | |
2933 j.dispose(); | |
2934 goog.events.pools.releaseEvent(j) | |
2935 } | |
2936 return f | |
2937 } | |
2938 d = new goog.events.BrowserEvent(b, this); | |
2939 try { | |
2940 f = goog.events.fireListener(c, d) | |
2941 }finally { | |
2942 d.dispose() | |
2943 } | |
2944 return f | |
2945 }; | |
2946 goog.events.pools.setProxyCallbackFunction(goog.events.handleBrowserEvent_); | |
2947 goog.events.markIeEvent_ = function(a) { | |
2948 var b = !1; | |
2949 if(a.keyCode == 0) { | |
2950 try { | |
2951 a.keyCode = -1; | |
2952 return | |
2953 }catch(c) { | |
2954 b = !0 | |
2955 } | |
2956 } | |
2957 if(b || a.returnValue == void 0) { | |
2958 a.returnValue = !0 | |
2959 } | |
2960 }; | |
2961 goog.events.isMarkedIeEvent_ = function(a) { | |
2962 return a.keyCode < 0 || a.returnValue != void 0 | |
2963 }; | |
2964 goog.events.uniqueIdCounter_ = 0; | |
2965 goog.events.getUniqueId = function(a) { | |
2966 return a + "_" + goog.events.uniqueIdCounter_++ | |
2967 }; | |
2968 goog.events.synthesizeEventPropagation_ = function() { | |
2969 if(goog.events.requiresSyntheticEventPropagation_ === void 0) { | |
2970 goog.events.requiresSyntheticEventPropagation_ = goog.userAgent.IE && !goog.
global.addEventListener | |
2971 } | |
2972 return goog.events.requiresSyntheticEventPropagation_ | |
2973 }; | |
2974 goog.debug.entryPointRegistry.register(function(a) { | |
2975 goog.events.handleBrowserEvent_ = a(goog.events.handleBrowserEvent_); | |
2976 goog.events.pools.setProxyCallbackFunction(goog.events.handleBrowserEvent_) | |
2977 }); | |
2978 goog.events.EventHandler = function(a) { | |
2979 goog.Disposable.call(this); | |
2980 this.handler_ = a; | |
2981 this.keys_ = [] | |
2982 }; | |
2983 goog.inherits(goog.events.EventHandler, goog.Disposable); | |
2984 goog.events.EventHandler.typeArray_ = []; | |
2985 goog.events.EventHandler.prototype.listen = function(a, b, c, d, e) { | |
2986 if(!goog.isArray(b)) { | |
2987 goog.events.EventHandler.typeArray_[0] = b, b = goog.events.EventHandler.typ
eArray_ | |
2988 } | |
2989 for(var f = 0;f < b.length;f++) { | |
2990 this.keys_.push(goog.events.listen(a, b[f], c || this, d || !1, e || this.ha
ndler_ || this)) | |
2991 } | |
2992 return this | |
2993 }; | |
2994 goog.events.EventHandler.prototype.listenOnce = function(a, b, c, d, e) { | |
2995 if(goog.isArray(b)) { | |
2996 for(var f = 0;f < b.length;f++) { | |
2997 this.listenOnce(a, b[f], c, d, e) | |
2998 } | |
2999 }else { | |
3000 this.keys_.push(goog.events.listenOnce(a, b, c || this, d, e || this.handler
_ || this)) | |
3001 } | |
3002 return this | |
3003 }; | |
3004 goog.events.EventHandler.prototype.listenWithWrapper = function(a, b, c, d, e) { | |
3005 b.listen(a, c, d, e || this.handler_, this); | |
3006 return this | |
3007 }; | |
3008 goog.events.EventHandler.prototype.getListenerCount = function() { | |
3009 return this.keys_.length | |
3010 }; | |
3011 goog.events.EventHandler.prototype.unlisten = function(a, b, c, d, e) { | |
3012 if(goog.isArray(b)) { | |
3013 for(var f = 0;f < b.length;f++) { | |
3014 this.unlisten(a, b[f], c, d, e) | |
3015 } | |
3016 }else { | |
3017 if(a = goog.events.getListener(a, b, c || this, d, e || this.handler_ || thi
s)) { | |
3018 a = a.key, goog.events.unlistenByKey(a), goog.array.remove(this.keys_, a) | |
3019 } | |
3020 } | |
3021 return this | |
3022 }; | |
3023 goog.events.EventHandler.prototype.unlistenWithWrapper = function(a, b, c, d, e)
{ | |
3024 b.unlisten(a, c, d, e || this.handler_, this); | |
3025 return this | |
3026 }; | |
3027 goog.events.EventHandler.prototype.removeAll = function() { | |
3028 goog.array.forEach(this.keys_, goog.events.unlistenByKey); | |
3029 this.keys_.length = 0 | |
3030 }; | |
3031 goog.events.EventHandler.prototype.disposeInternal = function() { | |
3032 goog.events.EventHandler.superClass_.disposeInternal.call(this); | |
3033 this.removeAll() | |
3034 }; | |
3035 goog.events.EventHandler.prototype.handleEvent = function() { | |
3036 throw Error("EventHandler.handleEvent not implemented"); | |
3037 }; | |
3038 goog.events.EventTarget = function() { | |
3039 goog.Disposable.call(this) | |
3040 }; | |
3041 goog.inherits(goog.events.EventTarget, goog.Disposable); | |
3042 goog.events.EventTarget.prototype.customEvent_ = !0; | |
3043 goog.events.EventTarget.prototype.parentEventTarget_ = null; | |
3044 goog.events.EventTarget.prototype.getParentEventTarget = function() { | |
3045 return this.parentEventTarget_ | |
3046 }; | |
3047 goog.events.EventTarget.prototype.setParentEventTarget = function(a) { | |
3048 this.parentEventTarget_ = a | |
3049 }; | |
3050 goog.events.EventTarget.prototype.addEventListener = function(a, b, c, d) { | |
3051 goog.events.listen(this, a, b, c, d) | |
3052 }; | |
3053 goog.events.EventTarget.prototype.removeEventListener = function(a, b, c, d) { | |
3054 goog.events.unlisten(this, a, b, c, d) | |
3055 }; | |
3056 goog.events.EventTarget.prototype.dispatchEvent = function(a) { | |
3057 return goog.events.dispatchEvent(this, a) | |
3058 }; | |
3059 goog.events.EventTarget.prototype.disposeInternal = function() { | |
3060 goog.events.EventTarget.superClass_.disposeInternal.call(this); | |
3061 goog.events.removeAll(this); | |
3062 this.parentEventTarget_ = null | |
3063 }; | |
3064 goog.math.Box = function(a, b, c, d) { | |
3065 this.top = a; | |
3066 this.right = b; | |
3067 this.bottom = c; | |
3068 this.left = d | |
3069 }; | |
3070 goog.math.Box.boundingBox = function(a) { | |
3071 for(var b = new goog.math.Box(arguments[0].y, arguments[0].x, arguments[0].y,
arguments[0].x), c = 1;c < arguments.length;c++) { | |
3072 var d = arguments[c]; | |
3073 b.top = Math.min(b.top, d.y); | |
3074 b.right = Math.max(b.right, d.x); | |
3075 b.bottom = Math.max(b.bottom, d.y); | |
3076 b.left = Math.min(b.left, d.x) | |
3077 } | |
3078 return b | |
3079 }; | |
3080 goog.math.Box.prototype.clone = function() { | |
3081 return new goog.math.Box(this.top, this.right, this.bottom, this.left) | |
3082 }; | |
3083 if(goog.DEBUG) { | |
3084 goog.math.Box.prototype.toString = function() { | |
3085 return"(" + this.top + "t, " + this.right + "r, " + this.bottom + "b, " + th
is.left + "l)" | |
3086 } | |
3087 } | |
3088 goog.math.Box.prototype.contains = function(a) { | |
3089 return goog.math.Box.contains(this, a) | |
3090 }; | |
3091 goog.math.Box.prototype.expand = function(a, b, c, d) { | |
3092 goog.isObject(a) ? (this.top -= a.top, this.right += a.right, this.bottom += a
.bottom, this.left -= a.left) : (this.top -= a, this.right += b, this.bottom +=
c, this.left -= d); | |
3093 return this | |
3094 }; | |
3095 goog.math.Box.prototype.expandToInclude = function(a) { | |
3096 this.left = Math.min(this.left, a.left); | |
3097 this.top = Math.min(this.top, a.top); | |
3098 this.right = Math.max(this.right, a.right); | |
3099 this.bottom = Math.max(this.bottom, a.bottom) | |
3100 }; | |
3101 goog.math.Box.equals = function(a, b) { | |
3102 return a == b ? !0 : !a || !b ? !1 : a.top == b.top && a.right == b.right && a
.bottom == b.bottom && a.left == b.left | |
3103 }; | |
3104 goog.math.Box.contains = function(a, b) { | |
3105 return!a || !b ? !1 : b instanceof goog.math.Box ? b.left >= a.left && b.right
<= a.right && b.top >= a.top && b.bottom <= a.bottom : b.x >= a.left && b.x <=
a.right && b.y >= a.top && b.y <= a.bottom | |
3106 }; | |
3107 goog.math.Box.distance = function(a, b) { | |
3108 return b.x >= a.left && b.x <= a.right ? b.y >= a.top && b.y <= a.bottom ? 0 :
b.y < a.top ? a.top - b.y : b.y - a.bottom : b.y >= a.top && b.y <= a.bottom ?
b.x < a.left ? a.left - b.x : b.x - a.right : goog.math.Coordinate.distance(b, n
ew goog.math.Coordinate(b.x < a.left ? a.left : a.right, b.y < a.top ? a.top : a
.bottom)) | |
3109 }; | |
3110 goog.math.Box.intersects = function(a, b) { | |
3111 return a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <=
a.bottom | |
3112 }; | |
3113 goog.math.Box.intersectsWithPadding = function(a, b, c) { | |
3114 return a.left <= b.right + c && b.left <= a.right + c && a.top <= b.bottom + c
&& b.top <= a.bottom + c | |
3115 }; | |
3116 goog.math.Rect = function(a, b, c, d) { | |
3117 this.left = a; | |
3118 this.top = b; | |
3119 this.width = c; | |
3120 this.height = d | |
3121 }; | |
3122 goog.math.Rect.prototype.clone = function() { | |
3123 return new goog.math.Rect(this.left, this.top, this.width, this.height) | |
3124 }; | |
3125 goog.math.Rect.prototype.toBox = function() { | |
3126 return new goog.math.Box(this.top, this.left + this.width, this.top + this.hei
ght, this.left) | |
3127 }; | |
3128 goog.math.Rect.createFromBox = function(a) { | |
3129 return new goog.math.Rect(a.left, a.top, a.right - a.left, a.bottom - a.top) | |
3130 }; | |
3131 if(goog.DEBUG) { | |
3132 goog.math.Rect.prototype.toString = function() { | |
3133 return"(" + this.left + ", " + this.top + " - " + this.width + "w x " + this
.height + "h)" | |
3134 } | |
3135 } | |
3136 goog.math.Rect.equals = function(a, b) { | |
3137 return a == b ? !0 : !a || !b ? !1 : a.left == b.left && a.width == b.width &&
a.top == b.top && a.height == b.height | |
3138 }; | |
3139 goog.math.Rect.prototype.intersection = function(a) { | |
3140 var b = Math.max(this.left, a.left), c = Math.min(this.left + this.width, a.le
ft + a.width); | |
3141 if(b <= c) { | |
3142 var d = Math.max(this.top, a.top), a = Math.min(this.top + this.height, a.to
p + a.height); | |
3143 if(d <= a) { | |
3144 return this.left = b, this.top = d, this.width = c - b, this.height = a -
d, !0 | |
3145 } | |
3146 } | |
3147 return!1 | |
3148 }; | |
3149 goog.math.Rect.intersection = function(a, b) { | |
3150 var c = Math.max(a.left, b.left), d = Math.min(a.left + a.width, b.left + b.wi
dth); | |
3151 if(c <= d) { | |
3152 var e = Math.max(a.top, b.top), f = Math.min(a.top + a.height, b.top + b.hei
ght); | |
3153 if(e <= f) { | |
3154 return new goog.math.Rect(c, e, d - c, f - e) | |
3155 } | |
3156 } | |
3157 return null | |
3158 }; | |
3159 goog.math.Rect.intersects = function(a, b) { | |
3160 return a.left <= b.left + b.width && b.left <= a.left + a.width && a.top <= b.
top + b.height && b.top <= a.top + a.height | |
3161 }; | |
3162 goog.math.Rect.prototype.intersects = function(a) { | |
3163 return goog.math.Rect.intersects(this, a) | |
3164 }; | |
3165 goog.math.Rect.difference = function(a, b) { | |
3166 var c = goog.math.Rect.intersection(a, b); | |
3167 if(!c || !c.height || !c.width) { | |
3168 return[a.clone()] | |
3169 } | |
3170 var c = [], d = a.top, e = a.height, f = a.left + a.width, g = a.top + a.heigh
t, h = b.left + b.width, i = b.top + b.height; | |
3171 if(b.top > a.top) { | |
3172 c.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top)), d = b.top
, e -= b.top - a.top | |
3173 } | |
3174 i < g && (c.push(new goog.math.Rect(a.left, i, a.width, g - i)), e = i - d); | |
3175 b.left > a.left && c.push(new goog.math.Rect(a.left, d, b.left - a.left, e)); | |
3176 h < f && c.push(new goog.math.Rect(h, d, f - h, e)); | |
3177 return c | |
3178 }; | |
3179 goog.math.Rect.prototype.difference = function(a) { | |
3180 return goog.math.Rect.difference(this, a) | |
3181 }; | |
3182 goog.math.Rect.prototype.boundingRect = function(a) { | |
3183 var b = Math.max(this.left + this.width, a.left + a.width), c = Math.max(this.
top + this.height, a.top + a.height); | |
3184 this.left = Math.min(this.left, a.left); | |
3185 this.top = Math.min(this.top, a.top); | |
3186 this.width = b - this.left; | |
3187 this.height = c - this.top | |
3188 }; | |
3189 goog.math.Rect.boundingRect = function(a, b) { | |
3190 if(!a || !b) { | |
3191 return null | |
3192 } | |
3193 var c = a.clone(); | |
3194 c.boundingRect(b); | |
3195 return c | |
3196 }; | |
3197 goog.math.Rect.prototype.contains = function(a) { | |
3198 return a instanceof goog.math.Rect ? this.left <= a.left && this.left + this.w
idth >= a.left + a.width && this.top <= a.top && this.top + this.height >= a.top
+ a.height : a.x >= this.left && a.x <= this.left + this.width && a.y >= this.t
op && a.y <= this.top + this.height | |
3199 }; | |
3200 goog.math.Rect.prototype.getSize = function() { | |
3201 return new goog.math.Size(this.width, this.height) | |
3202 }; | |
3203 goog.style = {}; | |
3204 goog.style.setStyle = function(a, b, c) { | |
3205 goog.isString(b) ? goog.style.setStyle_(a, c, b) : goog.object.forEach(b, goog
.partial(goog.style.setStyle_, a)) | |
3206 }; | |
3207 goog.style.setStyle_ = function(a, b, c) { | |
3208 a.style[goog.string.toCamelCase(c)] = b | |
3209 }; | |
3210 goog.style.getStyle = function(a, b) { | |
3211 return a.style[goog.string.toCamelCase(b)] || "" | |
3212 }; | |
3213 goog.style.getComputedStyle = function(a, b) { | |
3214 var c = goog.dom.getOwnerDocument(a); | |
3215 return c.defaultView && c.defaultView.getComputedStyle && (c = c.defaultView.g
etComputedStyle(a, null)) ? c[b] || c.getPropertyValue(b) : "" | |
3216 }; | |
3217 goog.style.getCascadedStyle = function(a, b) { | |
3218 return a.currentStyle ? a.currentStyle[b] : null | |
3219 }; | |
3220 goog.style.getStyle_ = function(a, b) { | |
3221 return goog.style.getComputedStyle(a, b) || goog.style.getCascadedStyle(a, b)
|| a.style[b] | |
3222 }; | |
3223 goog.style.getComputedPosition = function(a) { | |
3224 return goog.style.getStyle_(a, "position") | |
3225 }; | |
3226 goog.style.getBackgroundColor = function(a) { | |
3227 return goog.style.getStyle_(a, "backgroundColor") | |
3228 }; | |
3229 goog.style.getComputedOverflowX = function(a) { | |
3230 return goog.style.getStyle_(a, "overflowX") | |
3231 }; | |
3232 goog.style.getComputedOverflowY = function(a) { | |
3233 return goog.style.getStyle_(a, "overflowY") | |
3234 }; | |
3235 goog.style.getComputedZIndex = function(a) { | |
3236 return goog.style.getStyle_(a, "zIndex") | |
3237 }; | |
3238 goog.style.getComputedTextAlign = function(a) { | |
3239 return goog.style.getStyle_(a, "textAlign") | |
3240 }; | |
3241 goog.style.getComputedCursor = function(a) { | |
3242 return goog.style.getStyle_(a, "cursor") | |
3243 }; | |
3244 goog.style.setPosition = function(a, b, c) { | |
3245 var d, e = goog.userAgent.GECKO && (goog.userAgent.MAC || goog.userAgent.X11)
&& goog.userAgent.isVersion("1.9"); | |
3246 b instanceof goog.math.Coordinate ? (d = b.x, b = b.y) : (d = b, b = c); | |
3247 a.style.left = goog.style.getPixelStyleValue_(d, e); | |
3248 a.style.top = goog.style.getPixelStyleValue_(b, e) | |
3249 }; | |
3250 goog.style.getPosition = function(a) { | |
3251 return new goog.math.Coordinate(a.offsetLeft, a.offsetTop) | |
3252 }; | |
3253 goog.style.getClientViewportElement = function(a) { | |
3254 a = a ? a.nodeType == goog.dom.NodeType.DOCUMENT ? a : goog.dom.getOwnerDocume
nt(a) : goog.dom.getDocument(); | |
3255 return goog.userAgent.IE && !goog.userAgent.isDocumentMode(9) && !goog.dom.get
DomHelper(a).isCss1CompatMode() ? a.body : a.documentElement | |
3256 }; | |
3257 goog.style.getBoundingClientRect_ = function(a) { | |
3258 var b = a.getBoundingClientRect(); | |
3259 if(goog.userAgent.IE) { | |
3260 a = a.ownerDocument, b.left -= a.documentElement.clientLeft + a.body.clientL
eft, b.top -= a.documentElement.clientTop + a.body.clientTop | |
3261 } | |
3262 return b | |
3263 }; | |
3264 goog.style.getOffsetParent = function(a) { | |
3265 if(goog.userAgent.IE) { | |
3266 return a.offsetParent | |
3267 } | |
3268 for(var b = goog.dom.getOwnerDocument(a), c = goog.style.getStyle_(a, "positio
n"), d = c == "fixed" || c == "absolute", a = a.parentNode;a && a != b;a = a.par
entNode) { | |
3269 if(c = goog.style.getStyle_(a, "position"), d = d && c == "static" && a != b
.documentElement && a != b.body, !d && (a.scrollWidth > a.clientWidth || a.scrol
lHeight > a.clientHeight || c == "fixed" || c == "absolute" || c == "relative"))
{ | |
3270 return a | |
3271 } | |
3272 } | |
3273 return null | |
3274 }; | |
3275 goog.style.getVisibleRectForElement = function(a) { | |
3276 for(var b = new goog.math.Box(0, Infinity, Infinity, 0), c = goog.dom.getDomHe
lper(a), d = c.getDocument().body, e = c.getDocumentScrollElement(), f;a = goog.
style.getOffsetParent(a);) { | |
3277 if((!goog.userAgent.IE || a.clientWidth != 0) && (!goog.userAgent.WEBKIT ||
a.clientHeight != 0 || a != d) && (a.scrollWidth != a.clientWidth || a.scrollHei
ght != a.clientHeight) && goog.style.getStyle_(a, "overflow") != "visible") { | |
3278 var g = goog.style.getPageOffset(a), h = goog.style.getClientLeftTop(a); | |
3279 g.x += h.x; | |
3280 g.y += h.y; | |
3281 b.top = Math.max(b.top, g.y); | |
3282 b.right = Math.min(b.right, g.x + a.clientWidth); | |
3283 b.bottom = Math.min(b.bottom, g.y + a.clientHeight); | |
3284 b.left = Math.max(b.left, g.x); | |
3285 f = f || a != e | |
3286 } | |
3287 } | |
3288 d = e.scrollLeft; | |
3289 e = e.scrollTop; | |
3290 goog.userAgent.WEBKIT ? (b.left += d, b.top += e) : (b.left = Math.max(b.left,
d), b.top = Math.max(b.top, e)); | |
3291 if(!f || goog.userAgent.WEBKIT) { | |
3292 b.right += d, b.bottom += e | |
3293 } | |
3294 c = c.getViewportSize(); | |
3295 b.right = Math.min(b.right, d + c.width); | |
3296 b.bottom = Math.min(b.bottom, e + c.height); | |
3297 return b.top >= 0 && b.left >= 0 && b.bottom > b.top && b.right > b.left ? b :
null | |
3298 }; | |
3299 goog.style.scrollIntoContainerView = function(a, b, c) { | |
3300 var d = goog.style.getPageOffset(a), e = goog.style.getPageOffset(b), f = goog
.style.getBorderBox(b), g = d.x - e.x - f.left, d = d.y - e.y - f.top, e = b.cli
entWidth - a.offsetWidth, a = b.clientHeight - a.offsetHeight; | |
3301 c ? (b.scrollLeft += g - e / 2, b.scrollTop += d - a / 2) : (b.scrollLeft += M
ath.min(g, Math.max(g - e, 0)), b.scrollTop += Math.min(d, Math.max(d - a, 0))) | |
3302 }; | |
3303 goog.style.getClientLeftTop = function(a) { | |
3304 if(goog.userAgent.GECKO && !goog.userAgent.isVersion("1.9")) { | |
3305 var b = parseFloat(goog.style.getComputedStyle(a, "borderLeftWidth")); | |
3306 if(goog.style.isRightToLeft(a)) { | |
3307 var c = a.offsetWidth - a.clientWidth - b - parseFloat(goog.style.getCompu
tedStyle(a, "borderRightWidth")); | |
3308 b += c | |
3309 } | |
3310 return new goog.math.Coordinate(b, parseFloat(goog.style.getComputedStyle(a,
"borderTopWidth"))) | |
3311 } | |
3312 return new goog.math.Coordinate(a.clientLeft, a.clientTop) | |
3313 }; | |
3314 goog.style.getPageOffset = function(a) { | |
3315 var b, c = goog.dom.getOwnerDocument(a), d = goog.style.getStyle_(a, "position
"), e = goog.userAgent.GECKO && c.getBoxObjectFor && !a.getBoundingClientRect &&
d == "absolute" && (b = c.getBoxObjectFor(a)) && (b.screenX < 0 || b.screenY <
0), f = new goog.math.Coordinate(0, 0), g = goog.style.getClientViewportElement(
c); | |
3316 if(a == g) { | |
3317 return f | |
3318 } | |
3319 if(a.getBoundingClientRect) { | |
3320 b = goog.style.getBoundingClientRect_(a), a = goog.dom.getDomHelper(c).getDo
cumentScroll(), f.x = b.left + a.x, f.y = b.top + a.y | |
3321 }else { | |
3322 if(c.getBoxObjectFor && !e) { | |
3323 b = c.getBoxObjectFor(a), a = c.getBoxObjectFor(g), f.x = b.screenX - a.sc
reenX, f.y = b.screenY - a.screenY | |
3324 }else { | |
3325 b = a; | |
3326 do { | |
3327 f.x += b.offsetLeft; | |
3328 f.y += b.offsetTop; | |
3329 b != a && (f.x += b.clientLeft || 0, f.y += b.clientTop || 0); | |
3330 if(goog.userAgent.WEBKIT && goog.style.getComputedPosition(b) == "fixed"
) { | |
3331 f.x += c.body.scrollLeft; | |
3332 f.y += c.body.scrollTop; | |
3333 break | |
3334 } | |
3335 b = b.offsetParent | |
3336 }while(b && b != a); | |
3337 if(goog.userAgent.OPERA || goog.userAgent.WEBKIT && d == "absolute") { | |
3338 f.y -= c.body.offsetTop | |
3339 } | |
3340 for(b = a;(b = goog.style.getOffsetParent(b)) && b != c.body && b != g;) { | |
3341 if(f.x -= b.scrollLeft, !goog.userAgent.OPERA || b.tagName != "TR") { | |
3342 f.y -= b.scrollTop | |
3343 } | |
3344 } | |
3345 } | |
3346 } | |
3347 return f | |
3348 }; | |
3349 goog.style.getPageOffsetLeft = function(a) { | |
3350 return goog.style.getPageOffset(a).x | |
3351 }; | |
3352 goog.style.getPageOffsetTop = function(a) { | |
3353 return goog.style.getPageOffset(a).y | |
3354 }; | |
3355 goog.style.getFramedPageOffset = function(a, b) { | |
3356 var c = new goog.math.Coordinate(0, 0), d = goog.dom.getWindow(goog.dom.getOwn
erDocument(a)), e = a; | |
3357 do { | |
3358 var f = d == b ? goog.style.getPageOffset(e) : goog.style.getClientPosition(
e); | |
3359 c.x += f.x; | |
3360 c.y += f.y | |
3361 }while(d && d != b && (e = d.frameElement) && (d = d.parent)); | |
3362 return c | |
3363 }; | |
3364 goog.style.translateRectForAnotherFrame = function(a, b, c) { | |
3365 if(b.getDocument() != c.getDocument()) { | |
3366 var d = b.getDocument().body, c = goog.style.getFramedPageOffset(d, c.getWin
dow()), c = goog.math.Coordinate.difference(c, goog.style.getPageOffset(d)); | |
3367 goog.userAgent.IE && !b.isCss1CompatMode() && (c = goog.math.Coordinate.diff
erence(c, b.getDocumentScroll())); | |
3368 a.left += c.x; | |
3369 a.top += c.y | |
3370 } | |
3371 }; | |
3372 goog.style.getRelativePosition = function(a, b) { | |
3373 var c = goog.style.getClientPosition(a), d = goog.style.getClientPosition(b); | |
3374 return new goog.math.Coordinate(c.x - d.x, c.y - d.y) | |
3375 }; | |
3376 goog.style.getClientPosition = function(a) { | |
3377 var b = new goog.math.Coordinate; | |
3378 if(a.nodeType == goog.dom.NodeType.ELEMENT) { | |
3379 if(a.getBoundingClientRect) { | |
3380 a = goog.style.getBoundingClientRect_(a), b.x = a.left, b.y = a.top | |
3381 }else { | |
3382 var c = goog.dom.getDomHelper(a).getDocumentScroll(), a = goog.style.getPa
geOffset(a); | |
3383 b.x = a.x - c.x; | |
3384 b.y = a.y - c.y | |
3385 } | |
3386 }else { | |
3387 var c = goog.isFunction(a.getBrowserEvent), d = a; | |
3388 a.targetTouches ? d = a.targetTouches[0] : c && a.getBrowserEvent().targetTo
uches && (d = a.getBrowserEvent().targetTouches[0]); | |
3389 b.x = d.clientX; | |
3390 b.y = d.clientY | |
3391 } | |
3392 return b | |
3393 }; | |
3394 goog.style.setPageOffset = function(a, b, c) { | |
3395 var d = goog.style.getPageOffset(a); | |
3396 if(b instanceof goog.math.Coordinate) { | |
3397 c = b.y, b = b.x | |
3398 } | |
3399 goog.style.setPosition(a, a.offsetLeft + (b - d.x), a.offsetTop + (c - d.y)) | |
3400 }; | |
3401 goog.style.setSize = function(a, b, c) { | |
3402 if(b instanceof goog.math.Size) { | |
3403 c = b.height, b = b.width | |
3404 }else { | |
3405 if(c == void 0) { | |
3406 throw Error("missing height argument"); | |
3407 } | |
3408 } | |
3409 goog.style.setWidth(a, b); | |
3410 goog.style.setHeight(a, c) | |
3411 }; | |
3412 goog.style.getPixelStyleValue_ = function(a, b) { | |
3413 typeof a == "number" && (a = (b ? Math.round(a) : a) + "px"); | |
3414 return a | |
3415 }; | |
3416 goog.style.setHeight = function(a, b) { | |
3417 a.style.height = goog.style.getPixelStyleValue_(b, !0) | |
3418 }; | |
3419 goog.style.setWidth = function(a, b) { | |
3420 a.style.width = goog.style.getPixelStyleValue_(b, !0) | |
3421 }; | |
3422 goog.style.getSize = function(a) { | |
3423 if(goog.style.getStyle_(a, "display") != "none") { | |
3424 return goog.style.getSizeWithDisplay_(a) | |
3425 } | |
3426 var b = a.style, c = b.display, d = b.visibility, e = b.position; | |
3427 b.visibility = "hidden"; | |
3428 b.position = "absolute"; | |
3429 b.display = "inline"; | |
3430 a = goog.style.getSizeWithDisplay_(a); | |
3431 b.display = c; | |
3432 b.position = e; | |
3433 b.visibility = d; | |
3434 return a | |
3435 }; | |
3436 goog.style.getSizeWithDisplay_ = function(a) { | |
3437 var b = a.offsetWidth, c = a.offsetHeight, d = goog.userAgent.WEBKIT && !b &&
!c; | |
3438 return(!goog.isDef(b) || d) && a.getBoundingClientRect ? (a = goog.style.getBo
undingClientRect_(a), new goog.math.Size(a.right - a.left, a.bottom - a.top)) :
new goog.math.Size(b, c) | |
3439 }; | |
3440 goog.style.getBounds = function(a) { | |
3441 var b = goog.style.getPageOffset(a), a = goog.style.getSize(a); | |
3442 return new goog.math.Rect(b.x, b.y, a.width, a.height) | |
3443 }; | |
3444 goog.style.toCamelCase = function(a) { | |
3445 return goog.string.toCamelCase(String(a)) | |
3446 }; | |
3447 goog.style.toSelectorCase = function(a) { | |
3448 return goog.string.toSelectorCase(a) | |
3449 }; | |
3450 goog.style.getOpacity = function(a) { | |
3451 var b = a.style, a = ""; | |
3452 "opacity" in b ? a = b.opacity : "MozOpacity" in b ? a = b.MozOpacity : "filte
r" in b && (b = b.filter.match(/alpha\(opacity=([\d.]+)\)/)) && (a = String(b[1]
/ 100)); | |
3453 return a == "" ? a : Number(a) | |
3454 }; | |
3455 goog.style.setOpacity = function(a, b) { | |
3456 var c = a.style; | |
3457 if("opacity" in c) { | |
3458 c.opacity = b | |
3459 }else { | |
3460 if("MozOpacity" in c) { | |
3461 c.MozOpacity = b | |
3462 }else { | |
3463 if("filter" in c) { | |
3464 c.filter = b === "" ? "" : "alpha(opacity=" + b * 100 + ")" | |
3465 } | |
3466 } | |
3467 } | |
3468 }; | |
3469 goog.style.setTransparentBackgroundImage = function(a, b) { | |
3470 var c = a.style; | |
3471 goog.userAgent.IE && !goog.userAgent.isVersion("8") ? c.filter = 'progid:DXIma
geTransform.Microsoft.AlphaImageLoader(src="' + b + '", sizingMethod="crop")' :
(c.backgroundImage = "url(" + b + ")", c.backgroundPosition = "top left", c.back
groundRepeat = "no-repeat") | |
3472 }; | |
3473 goog.style.clearTransparentBackgroundImage = function(a) { | |
3474 a = a.style; | |
3475 "filter" in a ? a.filter = "" : a.backgroundImage = "none" | |
3476 }; | |
3477 goog.style.showElement = function(a, b) { | |
3478 a.style.display = b ? "" : "none" | |
3479 }; | |
3480 goog.style.isElementShown = function(a) { | |
3481 return a.style.display != "none" | |
3482 }; | |
3483 goog.style.installStyles = function(a, b) { | |
3484 var c = goog.dom.getDomHelper(b), d = null; | |
3485 if(goog.userAgent.IE) { | |
3486 d = c.getDocument().createStyleSheet(), goog.style.setStyles(d, a) | |
3487 }else { | |
3488 var e = c.getElementsByTagNameAndClass("head")[0]; | |
3489 e || (d = c.getElementsByTagNameAndClass("body")[0], e = c.createDom("head")
, d.parentNode.insertBefore(e, d)); | |
3490 d = c.createDom("style"); | |
3491 goog.style.setStyles(d, a); | |
3492 c.appendChild(e, d) | |
3493 } | |
3494 return d | |
3495 }; | |
3496 goog.style.uninstallStyles = function(a) { | |
3497 goog.dom.removeNode(a.ownerNode || a.owningElement || a) | |
3498 }; | |
3499 goog.style.setStyles = function(a, b) { | |
3500 goog.userAgent.IE ? a.cssText = b : a[goog.userAgent.WEBKIT ? "innerText" : "i
nnerHTML"] = b | |
3501 }; | |
3502 goog.style.setPreWrap = function(a) { | |
3503 a = a.style; | |
3504 goog.userAgent.IE && !goog.userAgent.isVersion("8") ? (a.whiteSpace = "pre", a
.wordWrap = "break-word") : a.whiteSpace = goog.userAgent.GECKO ? "-moz-pre-wrap
" : "pre-wrap" | |
3505 }; | |
3506 goog.style.setInlineBlock = function(a) { | |
3507 a = a.style; | |
3508 a.position = "relative"; | |
3509 goog.userAgent.IE && !goog.userAgent.isVersion("8") ? (a.zoom = "1", a.display
= "inline") : a.display = goog.userAgent.GECKO ? goog.userAgent.isVersion("1.9a
") ? "inline-block" : "-moz-inline-box" : "inline-block" | |
3510 }; | |
3511 goog.style.isRightToLeft = function(a) { | |
3512 return"rtl" == goog.style.getStyle_(a, "direction") | |
3513 }; | |
3514 goog.style.unselectableStyle_ = goog.userAgent.GECKO ? "MozUserSelect" : goog.us
erAgent.WEBKIT ? "WebkitUserSelect" : null; | |
3515 goog.style.isUnselectable = function(a) { | |
3516 if(goog.style.unselectableStyle_) { | |
3517 return a.style[goog.style.unselectableStyle_].toLowerCase() == "none" | |
3518 }else { | |
3519 if(goog.userAgent.IE || goog.userAgent.OPERA) { | |
3520 return a.getAttribute("unselectable") == "on" | |
3521 } | |
3522 } | |
3523 return!1 | |
3524 }; | |
3525 goog.style.setUnselectable = function(a, b, c) { | |
3526 var c = !c ? a.getElementsByTagName("*") : null, d = goog.style.unselectableSt
yle_; | |
3527 if(d) { | |
3528 if(b = b ? "none" : "", a.style[d] = b, c) { | |
3529 for(var a = 0, e;e = c[a];a++) { | |
3530 e.style[d] = b | |
3531 } | |
3532 } | |
3533 }else { | |
3534 if(goog.userAgent.IE || goog.userAgent.OPERA) { | |
3535 if(b = b ? "on" : "", a.setAttribute("unselectable", b), c) { | |
3536 for(a = 0;e = c[a];a++) { | |
3537 e.setAttribute("unselectable", b) | |
3538 } | |
3539 } | |
3540 } | |
3541 } | |
3542 }; | |
3543 goog.style.getBorderBoxSize = function(a) { | |
3544 return new goog.math.Size(a.offsetWidth, a.offsetHeight) | |
3545 }; | |
3546 goog.style.setBorderBoxSize = function(a, b) { | |
3547 var c = goog.dom.getOwnerDocument(a), d = goog.dom.getDomHelper(c).isCss1Compa
tMode(); | |
3548 if(goog.userAgent.IE && (!d || !goog.userAgent.isVersion("8"))) { | |
3549 if(c = a.style, d) { | |
3550 var d = goog.style.getPaddingBox(a), e = goog.style.getBorderBox(a); | |
3551 c.pixelWidth = b.width - e.left - d.left - d.right - e.right; | |
3552 c.pixelHeight = b.height - e.top - d.top - d.bottom - e.bottom | |
3553 }else { | |
3554 c.pixelWidth = b.width, c.pixelHeight = b.height | |
3555 } | |
3556 }else { | |
3557 goog.style.setBoxSizingSize_(a, b, "border-box") | |
3558 } | |
3559 }; | |
3560 goog.style.getContentBoxSize = function(a) { | |
3561 var b = goog.dom.getOwnerDocument(a), c = goog.userAgent.IE && a.currentStyle; | |
3562 return c && goog.dom.getDomHelper(b).isCss1CompatMode() && c.width != "auto" &
& c.height != "auto" && !c.boxSizing ? (b = goog.style.getIePixelValue_(a, c.wid
th, "width", "pixelWidth"), a = goog.style.getIePixelValue_(a, c.height, "height
", "pixelHeight"), new goog.math.Size(b, a)) : (c = goog.style.getBorderBoxSize(
a), b = goog.style.getPaddingBox(a), a = goog.style.getBorderBox(a), new goog.ma
th.Size(c.width - a.left - b.left - b.right - a.right, c.height - a.top - b.top
- b.bottom - a.bottom)) | |
3563 }; | |
3564 goog.style.setContentBoxSize = function(a, b) { | |
3565 var c = goog.dom.getOwnerDocument(a), d = goog.dom.getDomHelper(c).isCss1Compa
tMode(); | |
3566 if(goog.userAgent.IE && (!d || !goog.userAgent.isVersion("8"))) { | |
3567 if(c = a.style, d) { | |
3568 c.pixelWidth = b.width, c.pixelHeight = b.height | |
3569 }else { | |
3570 var d = goog.style.getPaddingBox(a), e = goog.style.getBorderBox(a); | |
3571 c.pixelWidth = b.width + e.left + d.left + d.right + e.right; | |
3572 c.pixelHeight = b.height + e.top + d.top + d.bottom + e.bottom | |
3573 } | |
3574 }else { | |
3575 goog.style.setBoxSizingSize_(a, b, "content-box") | |
3576 } | |
3577 }; | |
3578 goog.style.setBoxSizingSize_ = function(a, b, c) { | |
3579 a = a.style; | |
3580 goog.userAgent.GECKO ? a.MozBoxSizing = c : goog.userAgent.WEBKIT ? a.WebkitBo
xSizing = c : a.boxSizing = c; | |
3581 a.width = b.width + "px"; | |
3582 a.height = b.height + "px" | |
3583 }; | |
3584 goog.style.getIePixelValue_ = function(a, b, c, d) { | |
3585 if(/^\d+px?$/.test(b)) { | |
3586 return parseInt(b, 10) | |
3587 }else { | |
3588 var e = a.style[c], f = a.runtimeStyle[c]; | |
3589 a.runtimeStyle[c] = a.currentStyle[c]; | |
3590 a.style[c] = b; | |
3591 b = a.style[d]; | |
3592 a.style[c] = e; | |
3593 a.runtimeStyle[c] = f; | |
3594 return b | |
3595 } | |
3596 }; | |
3597 goog.style.getIePixelDistance_ = function(a, b) { | |
3598 return goog.style.getIePixelValue_(a, goog.style.getCascadedStyle(a, b), "left
", "pixelLeft") | |
3599 }; | |
3600 goog.style.getBox_ = function(a, b) { | |
3601 if(goog.userAgent.IE) { | |
3602 var c = goog.style.getIePixelDistance_(a, b + "Left"), d = goog.style.getIeP
ixelDistance_(a, b + "Right"), e = goog.style.getIePixelDistance_(a, b + "Top"),
f = goog.style.getIePixelDistance_(a, b + "Bottom"); | |
3603 return new goog.math.Box(e, d, f, c) | |
3604 }else { | |
3605 return c = goog.style.getComputedStyle(a, b + "Left"), d = goog.style.getCom
putedStyle(a, b + "Right"), e = goog.style.getComputedStyle(a, b + "Top"), f = g
oog.style.getComputedStyle(a, b + "Bottom"), new goog.math.Box(parseFloat(e), pa
rseFloat(d), parseFloat(f), parseFloat(c)) | |
3606 } | |
3607 }; | |
3608 goog.style.getPaddingBox = function(a) { | |
3609 return goog.style.getBox_(a, "padding") | |
3610 }; | |
3611 goog.style.getMarginBox = function(a) { | |
3612 return goog.style.getBox_(a, "margin") | |
3613 }; | |
3614 goog.style.ieBorderWidthKeywords_ = {thin:2, medium:4, thick:6}; | |
3615 goog.style.getIePixelBorder_ = function(a, b) { | |
3616 if(goog.style.getCascadedStyle(a, b + "Style") == "none") { | |
3617 return 0 | |
3618 } | |
3619 var c = goog.style.getCascadedStyle(a, b + "Width"); | |
3620 return c in goog.style.ieBorderWidthKeywords_ ? goog.style.ieBorderWidthKeywor
ds_[c] : goog.style.getIePixelValue_(a, c, "left", "pixelLeft") | |
3621 }; | |
3622 goog.style.getBorderBox = function(a) { | |
3623 if(goog.userAgent.IE) { | |
3624 var b = goog.style.getIePixelBorder_(a, "borderLeft"), c = goog.style.getIeP
ixelBorder_(a, "borderRight"), d = goog.style.getIePixelBorder_(a, "borderTop"),
a = goog.style.getIePixelBorder_(a, "borderBottom"); | |
3625 return new goog.math.Box(d, c, a, b) | |
3626 }else { | |
3627 return b = goog.style.getComputedStyle(a, "borderLeftWidth"), c = goog.style
.getComputedStyle(a, "borderRightWidth"), d = goog.style.getComputedStyle(a, "bo
rderTopWidth"), a = goog.style.getComputedStyle(a, "borderBottomWidth"), new goo
g.math.Box(parseFloat(d), parseFloat(c), parseFloat(a), parseFloat(b)) | |
3628 } | |
3629 }; | |
3630 goog.style.getFontFamily = function(a) { | |
3631 var b = goog.dom.getOwnerDocument(a), c = ""; | |
3632 if(b.body.createTextRange) { | |
3633 b = b.body.createTextRange(); | |
3634 b.moveToElementText(a); | |
3635 try { | |
3636 c = b.queryCommandValue("FontName") | |
3637 }catch(d) { | |
3638 c = "" | |
3639 } | |
3640 } | |
3641 c || (c = goog.style.getStyle_(a, "fontFamily")); | |
3642 a = c.split(","); | |
3643 a.length > 1 && (c = a[0]); | |
3644 return goog.string.stripQuotes(c, "\"'") | |
3645 }; | |
3646 goog.style.lengthUnitRegex_ = /[^\d]+$/; | |
3647 goog.style.getLengthUnits = function(a) { | |
3648 return(a = a.match(goog.style.lengthUnitRegex_)) && a[0] || null | |
3649 }; | |
3650 goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = {cm:1, "in":1, mm:1, pc:1, pt:1}; | |
3651 goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = {em:1, ex:1}; | |
3652 goog.style.getFontSize = function(a) { | |
3653 var b = goog.style.getStyle_(a, "fontSize"), c = goog.style.getLengthUnits(b); | |
3654 if(b && "px" == c) { | |
3655 return parseInt(b, 10) | |
3656 } | |
3657 if(goog.userAgent.IE) { | |
3658 if(c in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_) { | |
3659 return goog.style.getIePixelValue_(a, b, "left", "pixelLeft") | |
3660 }else { | |
3661 if(a.parentNode && a.parentNode.nodeType == goog.dom.NodeType.ELEMENT && c
in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_) { | |
3662 return a = a.parentNode, c = goog.style.getStyle_(a, "fontSize"), goog.s
tyle.getIePixelValue_(a, b == c ? "1em" : b, "left", "pixelLeft") | |
3663 } | |
3664 } | |
3665 } | |
3666 c = goog.dom.createDom("span", {style:"visibility:hidden;position:absolute;lin
e-height:0;padding:0;margin:0;border:0;height:1em;"}); | |
3667 goog.dom.appendChild(a, c); | |
3668 b = c.offsetHeight; | |
3669 goog.dom.removeNode(c); | |
3670 return b | |
3671 }; | |
3672 goog.style.parseStyleAttribute = function(a) { | |
3673 var b = {}; | |
3674 goog.array.forEach(a.split(/\s*;\s*/), function(a) { | |
3675 a = a.split(/\s*:\s*/); | |
3676 a.length == 2 && (b[goog.string.toCamelCase(a[0].toLowerCase())] = a[1]) | |
3677 }); | |
3678 return b | |
3679 }; | |
3680 goog.style.toStyleAttribute = function(a) { | |
3681 var b = []; | |
3682 goog.object.forEach(a, function(a, d) { | |
3683 b.push(goog.string.toSelectorCase(d), ":", a, ";") | |
3684 }); | |
3685 return b.join("") | |
3686 }; | |
3687 goog.style.setFloat = function(a, b) { | |
3688 a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] = b | |
3689 }; | |
3690 goog.style.getFloat = function(a) { | |
3691 return a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] || "" | |
3692 }; | |
3693 goog.style.getScrollbarWidth = function() { | |
3694 var a = goog.dom.createElement("div"); | |
3695 a.style.cssText = "visibility:hidden;overflow:scroll;position:absolute;top:0;w
idth:100px;height:100px"; | |
3696 goog.dom.appendChild(goog.dom.getDocument().body, a); | |
3697 var b = a.offsetWidth - a.clientWidth; | |
3698 goog.dom.removeNode(a); | |
3699 return b | |
3700 }; | |
3701 goog.ui = {}; | |
3702 goog.ui.IdGenerator = function() { | |
3703 }; | |
3704 goog.addSingletonGetter(goog.ui.IdGenerator); | |
3705 goog.ui.IdGenerator.prototype.nextId_ = 0; | |
3706 goog.ui.IdGenerator.prototype.getNextUniqueId = function() { | |
3707 return":" + (this.nextId_++).toString(36) | |
3708 }; | |
3709 goog.ui.IdGenerator.instance = goog.ui.IdGenerator.getInstance(); | |
3710 goog.ui.Component = function(a) { | |
3711 goog.events.EventTarget.call(this); | |
3712 this.dom_ = a || goog.dom.getDomHelper(); | |
3713 this.rightToLeft_ = goog.ui.Component.defaultRightToLeft_ | |
3714 }; | |
3715 goog.inherits(goog.ui.Component, goog.events.EventTarget); | |
3716 goog.ui.Component.prototype.idGenerator_ = goog.ui.IdGenerator.getInstance(); | |
3717 goog.ui.Component.defaultRightToLeft_ = null; | |
3718 goog.ui.Component.EventType = {BEFORE_SHOW:"beforeshow", SHOW:"show", HIDE:"hide
", DISABLE:"disable", ENABLE:"enable", HIGHLIGHT:"highlight", UNHIGHLIGHT:"unhig
hlight", ACTIVATE:"activate", DEACTIVATE:"deactivate", SELECT:"select", UNSELECT
:"unselect", CHECK:"check", UNCHECK:"uncheck", FOCUS:"focus", BLUR:"blur", OPEN:
"open", CLOSE:"close", ENTER:"enter", LEAVE:"leave", ACTION:"action", CHANGE:"ch
ange"}; | |
3719 goog.ui.Component.Error = {NOT_SUPPORTED:"Method not supported", DECORATE_INVALI
D:"Invalid element to decorate", ALREADY_RENDERED:"Component already rendered",
PARENT_UNABLE_TO_BE_SET:"Unable to set parent component", CHILD_INDEX_OUT_OF_BOU
NDS:"Child component index out of bounds", NOT_OUR_CHILD:"Child is not in parent
component", NOT_IN_DOCUMENT:"Operation not supported while component is not in
document", STATE_INVALID:"Invalid component state"}; | |
3720 goog.ui.Component.State = {ALL:255, DISABLED:1, HOVER:2, ACTIVE:4, SELECTED:8, C
HECKED:16, FOCUSED:32, OPENED:64}; | |
3721 goog.ui.Component.getStateTransitionEvent = function(a, b) { | |
3722 switch(a) { | |
3723 case goog.ui.Component.State.DISABLED: | |
3724 return b ? goog.ui.Component.EventType.DISABLE : goog.ui.Component.EventTy
pe.ENABLE; | |
3725 case goog.ui.Component.State.HOVER: | |
3726 return b ? goog.ui.Component.EventType.HIGHLIGHT : goog.ui.Component.Event
Type.UNHIGHLIGHT; | |
3727 case goog.ui.Component.State.ACTIVE: | |
3728 return b ? goog.ui.Component.EventType.ACTIVATE : goog.ui.Component.EventT
ype.DEACTIVATE; | |
3729 case goog.ui.Component.State.SELECTED: | |
3730 return b ? goog.ui.Component.EventType.SELECT : goog.ui.Component.EventTyp
e.UNSELECT; | |
3731 case goog.ui.Component.State.CHECKED: | |
3732 return b ? goog.ui.Component.EventType.CHECK : goog.ui.Component.EventType
.UNCHECK; | |
3733 case goog.ui.Component.State.FOCUSED: | |
3734 return b ? goog.ui.Component.EventType.FOCUS : goog.ui.Component.EventType
.BLUR; | |
3735 case goog.ui.Component.State.OPENED: | |
3736 return b ? goog.ui.Component.EventType.OPEN : goog.ui.Component.EventType.
CLOSE | |
3737 } | |
3738 throw Error(goog.ui.Component.Error.STATE_INVALID); | |
3739 }; | |
3740 goog.ui.Component.setDefaultRightToLeft = function(a) { | |
3741 goog.ui.Component.defaultRightToLeft_ = a | |
3742 }; | |
3743 goog.ui.Component.prototype.id_ = null; | |
3744 goog.ui.Component.prototype.inDocument_ = !1; | |
3745 goog.ui.Component.prototype.element_ = null; | |
3746 goog.ui.Component.prototype.rightToLeft_ = null; | |
3747 goog.ui.Component.prototype.model_ = null; | |
3748 goog.ui.Component.prototype.parent_ = null; | |
3749 goog.ui.Component.prototype.children_ = null; | |
3750 goog.ui.Component.prototype.childIndex_ = null; | |
3751 goog.ui.Component.prototype.wasDecorated_ = !1; | |
3752 goog.ui.Component.prototype.getId = function() { | |
3753 return this.id_ || (this.id_ = this.idGenerator_.getNextUniqueId()) | |
3754 }; | |
3755 goog.ui.Component.prototype.setId = function(a) { | |
3756 this.parent_ && this.parent_.childIndex_ && (goog.object.remove(this.parent_.c
hildIndex_, this.id_), goog.object.add(this.parent_.childIndex_, a, this)); | |
3757 this.id_ = a | |
3758 }; | |
3759 goog.ui.Component.prototype.getElement = function() { | |
3760 return this.element_ | |
3761 }; | |
3762 goog.ui.Component.prototype.setElementInternal = function(a) { | |
3763 this.element_ = a | |
3764 }; | |
3765 goog.ui.Component.prototype.getElementsByClass = function(a) { | |
3766 return this.element_ ? this.dom_.getElementsByClass(a, this.element_) : [] | |
3767 }; | |
3768 goog.ui.Component.prototype.getElementByClass = function(a) { | |
3769 return this.element_ ? this.dom_.getElementByClass(a, this.element_) : null | |
3770 }; | |
3771 goog.ui.Component.prototype.getHandler = function() { | |
3772 return this.googUiComponentHandler_ || (this.googUiComponentHandler_ = new goo
g.events.EventHandler(this)) | |
3773 }; | |
3774 goog.ui.Component.prototype.setParent = function(a) { | |
3775 if(this == a) { | |
3776 throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET); | |
3777 } | |
3778 if(a && this.parent_ && this.id_ && this.parent_.getChild(this.id_) && this.pa
rent_ != a) { | |
3779 throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET); | |
3780 } | |
3781 this.parent_ = a; | |
3782 goog.ui.Component.superClass_.setParentEventTarget.call(this, a) | |
3783 }; | |
3784 goog.ui.Component.prototype.getParent = function() { | |
3785 return this.parent_ | |
3786 }; | |
3787 goog.ui.Component.prototype.setParentEventTarget = function(a) { | |
3788 if(this.parent_ && this.parent_ != a) { | |
3789 throw Error(goog.ui.Component.Error.NOT_SUPPORTED); | |
3790 } | |
3791 goog.ui.Component.superClass_.setParentEventTarget.call(this, a) | |
3792 }; | |
3793 goog.ui.Component.prototype.getDomHelper = function() { | |
3794 return this.dom_ | |
3795 }; | |
3796 goog.ui.Component.prototype.isInDocument = function() { | |
3797 return this.inDocument_ | |
3798 }; | |
3799 goog.ui.Component.prototype.createDom = function() { | |
3800 this.element_ = this.dom_.createElement("div") | |
3801 }; | |
3802 goog.ui.Component.prototype.render = function(a) { | |
3803 this.render_(a) | |
3804 }; | |
3805 goog.ui.Component.prototype.renderBefore = function(a) { | |
3806 this.render_(a.parentNode, a) | |
3807 }; | |
3808 goog.ui.Component.prototype.render_ = function(a, b) { | |
3809 if(this.inDocument_) { | |
3810 throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
3811 } | |
3812 this.element_ || this.createDom(); | |
3813 a ? a.insertBefore(this.element_, b || null) : this.dom_.getDocument().body.ap
pendChild(this.element_); | |
3814 (!this.parent_ || this.parent_.isInDocument()) && this.enterDocument() | |
3815 }; | |
3816 goog.ui.Component.prototype.decorate = function(a) { | |
3817 if(this.inDocument_) { | |
3818 throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
3819 }else { | |
3820 if(a && this.canDecorate(a)) { | |
3821 this.wasDecorated_ = !0; | |
3822 if(!this.dom_ || this.dom_.getDocument() != goog.dom.getOwnerDocument(a))
{ | |
3823 this.dom_ = goog.dom.getDomHelper(a) | |
3824 } | |
3825 this.decorateInternal(a); | |
3826 this.enterDocument() | |
3827 }else { | |
3828 throw Error(goog.ui.Component.Error.DECORATE_INVALID); | |
3829 } | |
3830 } | |
3831 }; | |
3832 goog.ui.Component.prototype.canDecorate = function() { | |
3833 return!0 | |
3834 }; | |
3835 goog.ui.Component.prototype.wasDecorated = function() { | |
3836 return this.wasDecorated_ | |
3837 }; | |
3838 goog.ui.Component.prototype.decorateInternal = function(a) { | |
3839 this.element_ = a | |
3840 }; | |
3841 goog.ui.Component.prototype.enterDocument = function() { | |
3842 this.inDocument_ = !0; | |
3843 this.forEachChild(function(a) { | |
3844 !a.isInDocument() && a.getElement() && a.enterDocument() | |
3845 }) | |
3846 }; | |
3847 goog.ui.Component.prototype.exitDocument = function() { | |
3848 this.forEachChild(function(a) { | |
3849 a.isInDocument() && a.exitDocument() | |
3850 }); | |
3851 this.googUiComponentHandler_ && this.googUiComponentHandler_.removeAll(); | |
3852 this.inDocument_ = !1 | |
3853 }; | |
3854 goog.ui.Component.prototype.disposeInternal = function() { | |
3855 goog.ui.Component.superClass_.disposeInternal.call(this); | |
3856 this.inDocument_ && this.exitDocument(); | |
3857 this.googUiComponentHandler_ && (this.googUiComponentHandler_.dispose(), delet
e this.googUiComponentHandler_); | |
3858 this.forEachChild(function(a) { | |
3859 a.dispose() | |
3860 }); | |
3861 !this.wasDecorated_ && this.element_ && goog.dom.removeNode(this.element_); | |
3862 this.parent_ = this.model_ = this.element_ = this.childIndex_ = this.children_
= null | |
3863 }; | |
3864 goog.ui.Component.prototype.makeId = function(a) { | |
3865 return this.getId() + "." + a | |
3866 }; | |
3867 goog.ui.Component.prototype.makeIds = function(a) { | |
3868 var b = {}, c; | |
3869 for(c in a) { | |
3870 b[c] = this.makeId(a[c]) | |
3871 } | |
3872 return b | |
3873 }; | |
3874 goog.ui.Component.prototype.getModel = function() { | |
3875 return this.model_ | |
3876 }; | |
3877 goog.ui.Component.prototype.setModel = function(a) { | |
3878 this.model_ = a | |
3879 }; | |
3880 goog.ui.Component.prototype.getFragmentFromId = function(a) { | |
3881 return a.substring(this.getId().length + 1) | |
3882 }; | |
3883 goog.ui.Component.prototype.getElementByFragment = function(a) { | |
3884 if(!this.inDocument_) { | |
3885 throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT); | |
3886 } | |
3887 return this.dom_.getElement(this.makeId(a)) | |
3888 }; | |
3889 goog.ui.Component.prototype.addChild = function(a, b) { | |
3890 this.addChildAt(a, this.getChildCount(), b) | |
3891 }; | |
3892 goog.ui.Component.prototype.addChildAt = function(a, b, c) { | |
3893 if(a.inDocument_ && (c || !this.inDocument_)) { | |
3894 throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
3895 } | |
3896 if(b < 0 || b > this.getChildCount()) { | |
3897 throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS); | |
3898 } | |
3899 if(!this.childIndex_ || !this.children_) { | |
3900 this.childIndex_ = {}, this.children_ = [] | |
3901 } | |
3902 a.getParent() == this ? (goog.object.set(this.childIndex_, a.getId(), a), goog
.array.remove(this.children_, a)) : goog.object.add(this.childIndex_, a.getId(),
a); | |
3903 a.setParent(this); | |
3904 goog.array.insertAt(this.children_, a, b); | |
3905 a.inDocument_ && this.inDocument_ && a.getParent() == this ? (c = this.getCont
entElement(), c.insertBefore(a.getElement(), c.childNodes[b] || null)) : c ? (th
is.element_ || this.createDom(), b = this.getChildAt(b + 1), a.render_(this.getC
ontentElement(), b ? b.element_ : null)) : this.inDocument_ && !a.inDocument_ &&
a.element_ && a.enterDocument() | |
3906 }; | |
3907 goog.ui.Component.prototype.getContentElement = function() { | |
3908 return this.element_ | |
3909 }; | |
3910 goog.ui.Component.prototype.isRightToLeft = function() { | |
3911 if(this.rightToLeft_ == null) { | |
3912 this.rightToLeft_ = goog.style.isRightToLeft(this.inDocument_ ? this.element
_ : this.dom_.getDocument().body) | |
3913 } | |
3914 return this.rightToLeft_ | |
3915 }; | |
3916 goog.ui.Component.prototype.setRightToLeft = function(a) { | |
3917 if(this.inDocument_) { | |
3918 throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
3919 } | |
3920 this.rightToLeft_ = a | |
3921 }; | |
3922 goog.ui.Component.prototype.hasChildren = function() { | |
3923 return!!this.children_ && this.children_.length != 0 | |
3924 }; | |
3925 goog.ui.Component.prototype.getChildCount = function() { | |
3926 return this.children_ ? this.children_.length : 0 | |
3927 }; | |
3928 goog.ui.Component.prototype.getChildIds = function() { | |
3929 var a = []; | |
3930 this.forEachChild(function(b) { | |
3931 a.push(b.getId()) | |
3932 }); | |
3933 return a | |
3934 }; | |
3935 goog.ui.Component.prototype.getChild = function(a) { | |
3936 return this.childIndex_ && a ? goog.object.get(this.childIndex_, a) || null :
null | |
3937 }; | |
3938 goog.ui.Component.prototype.getChildAt = function(a) { | |
3939 return this.children_ ? this.children_[a] || null : null | |
3940 }; | |
3941 goog.ui.Component.prototype.forEachChild = function(a, b) { | |
3942 this.children_ && goog.array.forEach(this.children_, a, b) | |
3943 }; | |
3944 goog.ui.Component.prototype.indexOfChild = function(a) { | |
3945 return this.children_ && a ? goog.array.indexOf(this.children_, a) : -1 | |
3946 }; | |
3947 goog.ui.Component.prototype.removeChild = function(a, b) { | |
3948 if(a) { | |
3949 var c = goog.isString(a) ? a : a.getId(), a = this.getChild(c); | |
3950 c && a && (goog.object.remove(this.childIndex_, c), goog.array.remove(this.c
hildren_, a), b && (a.exitDocument(), a.element_ && goog.dom.removeNode(a.elemen
t_)), a.setParent(null)) | |
3951 } | |
3952 if(!a) { | |
3953 throw Error(goog.ui.Component.Error.NOT_OUR_CHILD); | |
3954 } | |
3955 return a | |
3956 }; | |
3957 goog.ui.Component.prototype.removeChildAt = function(a, b) { | |
3958 return this.removeChild(this.getChildAt(a), b) | |
3959 }; | |
3960 goog.ui.Component.prototype.removeChildren = function(a) { | |
3961 for(;this.hasChildren();) { | |
3962 this.removeChildAt(0, a) | |
3963 } | |
3964 }; | |
3965 goog.dom.a11y = {}; | |
3966 goog.dom.a11y.State = {ACTIVEDESCENDANT:"activedescendant", ATOMIC:"atomic", AUT
OCOMPLETE:"autocomplete", BUSY:"busy", CHECKED:"checked", CONTROLS:"controls", D
ESCRIBEDBY:"describedby", DISABLED:"disabled", DROPEFFECT:"dropeffect", EXPANDED
:"expanded", FLOWTO:"flowto", GRABBED:"grabbed", HASPOPUP:"haspopup", HIDDEN:"hi
dden", INVALID:"invalid", LABEL:"label", LABELLEDBY:"labelledby", LEVEL:"level",
LIVE:"live", MULTILINE:"multiline", MULTISELECTABLE:"multiselectable", ORIENTAT
ION:"orientation", OWNS:"owns", | |
3967 POSINSET:"posinset", PRESSED:"pressed", READONLY:"readonly", RELEVANT:"relevant"
, REQUIRED:"required", SELECTED:"selected", SETSIZE:"setsize", SORT:"sort", VALU
EMAX:"valuemax", VALUEMIN:"valuemin", VALUENOW:"valuenow", VALUETEXT:"valuetext"
}; | |
3968 goog.dom.a11y.Role = {ALERT:"alert", ALERTDIALOG:"alertdialog", APPLICATION:"app
lication", ARTICLE:"article", BANNER:"banner", BUTTON:"button", CHECKBOX:"checkb
ox", COLUMNHEADER:"columnheader", COMBOBOX:"combobox", COMPLEMENTARY:"complement
ary", DIALOG:"dialog", DIRECTORY:"directory", DOCUMENT:"document", FORM:"form",
GRID:"grid", GRIDCELL:"gridcell", GROUP:"group", HEADING:"heading", IMG:"img", L
INK:"link", LIST:"list", LISTBOX:"listbox", LISTITEM:"listitem", LOG:"log", MAIN
:"main", MARQUEE:"marquee", | |
3969 MATH:"math", MENU:"menu", MENUBAR:"menubar", MENU_ITEM:"menuitem", MENU_ITEM_CHE
CKBOX:"menuitemcheckbox", MENU_ITEM_RADIO:"menuitemradio", NAVIGATION:"navigatio
n", NOTE:"note", OPTION:"option", PRESENTATION:"presentation", PROGRESSBAR:"prog
ressbar", RADIO:"radio", RADIOGROUP:"radiogroup", REGION:"region", ROW:"row", RO
WGROUP:"rowgroup", ROWHEADER:"rowheader", SCROLLBAR:"scrollbar", SEARCH:"search"
, SEPARATOR:"separator", SLIDER:"slider", SPINBUTTON:"spinbutton", STATUS:"statu
s", TAB:"tab", TAB_LIST:"tablist", | |
3970 TAB_PANEL:"tabpanel", TEXTBOX:"textbox", TIMER:"timer", TOOLBAR:"toolbar", TOOLT
IP:"tooltip", TREE:"tree", TREEGRID:"treegrid", TREEITEM:"treeitem"}; | |
3971 goog.dom.a11y.LivePriority = {OFF:"off", POLITE:"polite", ASSERTIVE:"assertive"}
; | |
3972 goog.dom.a11y.setRole = function(a, b) { | |
3973 a.setAttribute("role", b); | |
3974 a.roleName = b | |
3975 }; | |
3976 goog.dom.a11y.getRole = function(a) { | |
3977 return a.roleName || "" | |
3978 }; | |
3979 goog.dom.a11y.setState = function(a, b, c) { | |
3980 a.setAttribute("aria-" + b, c) | |
3981 }; | |
3982 goog.dom.a11y.getState = function(a, b) { | |
3983 var c = a.getAttribute("aria-" + b); | |
3984 return c === !0 || c === !1 ? c ? "true" : "false" : c ? String(c) : "" | |
3985 }; | |
3986 goog.dom.a11y.getActiveDescendant = function(a) { | |
3987 var b = goog.dom.a11y.getState(a, goog.dom.a11y.State.ACTIVEDESCENDANT); | |
3988 return goog.dom.getOwnerDocument(a).getElementById(b) | |
3989 }; | |
3990 goog.dom.a11y.setActiveDescendant = function(a, b) { | |
3991 goog.dom.a11y.setState(a, goog.dom.a11y.State.ACTIVEDESCENDANT, b ? b.id : "") | |
3992 }; | |
3993 goog.dom.a11y.Announcer = function(a) { | |
3994 goog.Disposable.call(this); | |
3995 this.domHelper_ = a; | |
3996 this.liveRegions_ = {} | |
3997 }; | |
3998 goog.inherits(goog.dom.a11y.Announcer, goog.Disposable); | |
3999 goog.dom.a11y.Announcer.prototype.disposeInternal = function() { | |
4000 goog.object.forEach(this.liveRegions_, this.domHelper_.removeNode, this.domHel
per_); | |
4001 this.domHelper_ = this.liveRegions_ = null; | |
4002 goog.dom.a11y.Announcer.superClass_.disposeInternal.call(this) | |
4003 }; | |
4004 goog.dom.a11y.Announcer.prototype.say = function(a, b) { | |
4005 goog.dom.setTextContent(this.getLiveRegion_(b || goog.dom.a11y.LivePriority.PO
LITE), a) | |
4006 }; | |
4007 goog.dom.a11y.Announcer.prototype.getLiveRegion_ = function(a) { | |
4008 if(this.liveRegions_[a]) { | |
4009 return this.liveRegions_[a] | |
4010 } | |
4011 var b; | |
4012 b = this.domHelper_.createElement("div"); | |
4013 b.style.position = "absolute"; | |
4014 b.style.top = "-1000px"; | |
4015 goog.dom.a11y.setState(b, "live", a); | |
4016 goog.dom.a11y.setState(b, "atomic", "true"); | |
4017 this.domHelper_.getDocument().body.appendChild(b); | |
4018 return this.liveRegions_[a] = b | |
4019 }; | |
4020 goog.Timer = function(a, b) { | |
4021 goog.events.EventTarget.call(this); | |
4022 this.interval_ = a || 1; | |
4023 this.timerObject_ = b || goog.Timer.defaultTimerObject; | |
4024 this.boundTick_ = goog.bind(this.tick_, this); | |
4025 this.last_ = goog.now() | |
4026 }; | |
4027 goog.inherits(goog.Timer, goog.events.EventTarget); | |
4028 goog.Timer.MAX_TIMEOUT_ = 2147483647; | |
4029 goog.Timer.prototype.enabled = !1; | |
4030 goog.Timer.defaultTimerObject = goog.global.window; | |
4031 goog.Timer.intervalScale = 0.8; | |
4032 goog.Timer.prototype.timer_ = null; | |
4033 goog.Timer.prototype.getInterval = function() { | |
4034 return this.interval_ | |
4035 }; | |
4036 goog.Timer.prototype.setInterval = function(a) { | |
4037 this.interval_ = a; | |
4038 this.timer_ && this.enabled ? (this.stop(), this.start()) : this.timer_ && thi
s.stop() | |
4039 }; | |
4040 goog.Timer.prototype.tick_ = function() { | |
4041 if(this.enabled) { | |
4042 var a = goog.now() - this.last_; | |
4043 if(a > 0 && a < this.interval_ * goog.Timer.intervalScale) { | |
4044 this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_
- a) | |
4045 }else { | |
4046 if(this.dispatchTick(), this.enabled) { | |
4047 this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interva
l_), this.last_ = goog.now() | |
4048 } | |
4049 } | |
4050 } | |
4051 }; | |
4052 goog.Timer.prototype.dispatchTick = function() { | |
4053 this.dispatchEvent(goog.Timer.TICK) | |
4054 }; | |
4055 goog.Timer.prototype.start = function() { | |
4056 this.enabled = !0; | |
4057 if(!this.timer_) { | |
4058 this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_),
this.last_ = goog.now() | |
4059 } | |
4060 }; | |
4061 goog.Timer.prototype.stop = function() { | |
4062 this.enabled = !1; | |
4063 if(this.timer_) { | |
4064 this.timerObject_.clearTimeout(this.timer_), this.timer_ = null | |
4065 } | |
4066 }; | |
4067 goog.Timer.prototype.disposeInternal = function() { | |
4068 goog.Timer.superClass_.disposeInternal.call(this); | |
4069 this.stop(); | |
4070 delete this.timerObject_ | |
4071 }; | |
4072 goog.Timer.TICK = "tick"; | |
4073 goog.Timer.callOnce = function(a, b, c) { | |
4074 if(goog.isFunction(a)) { | |
4075 c && (a = goog.bind(a, c)) | |
4076 }else { | |
4077 if(a && typeof a.handleEvent == "function") { | |
4078 a = goog.bind(a.handleEvent, a) | |
4079 }else { | |
4080 throw Error("Invalid listener argument"); | |
4081 } | |
4082 } | |
4083 return b > goog.Timer.MAX_TIMEOUT_ ? -1 : goog.Timer.defaultTimerObject.setTim
eout(a, b || 0) | |
4084 }; | |
4085 goog.Timer.clear = function(a) { | |
4086 goog.Timer.defaultTimerObject.clearTimeout(a) | |
4087 }; | |
4088 goog.events.KeyCodes = {MAC_ENTER:3, BACKSPACE:8, TAB:9, NUM_CENTER:12, ENTER:13
, SHIFT:16, CTRL:17, ALT:18, PAUSE:19, CAPS_LOCK:20, ESC:27, SPACE:32, PAGE_UP:3
3, PAGE_DOWN:34, END:35, HOME:36, LEFT:37, UP:38, RIGHT:39, DOWN:40, PRINT_SCREE
N:44, INSERT:45, DELETE:46, ZERO:48, ONE:49, TWO:50, THREE:51, FOUR:52, FIVE:53,
SIX:54, SEVEN:55, EIGHT:56, NINE:57, QUESTION_MARK:63, A:65, B:66, C:67, D:68,
E:69, F:70, G:71, H:72, I:73, J:74, K:75, L:76, M:77, N:78, O:79, P:80, Q:81, R:
82, S:83, T:84, U:85, | |
4089 V:86, W:87, X:88, Y:89, Z:90, META:91, WIN_KEY_RIGHT:92, CONTEXT_MENU:93, NUM_ZE
RO:96, NUM_ONE:97, NUM_TWO:98, NUM_THREE:99, NUM_FOUR:100, NUM_FIVE:101, NUM_SIX
:102, NUM_SEVEN:103, NUM_EIGHT:104, NUM_NINE:105, NUM_MULTIPLY:106, NUM_PLUS:107
, NUM_MINUS:109, NUM_PERIOD:110, NUM_DIVISION:111, F1:112, F2:113, F3:114, F4:11
5, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, F12:123, NUMLOCK:14
4, SEMICOLON:186, DASH:189, EQUALS:187, COMMA:188, PERIOD:190, SLASH:191, APOSTR
OPHE:192, SINGLE_QUOTE:222, | |
4090 OPEN_SQUARE_BRACKET:219, BACKSLASH:220, CLOSE_SQUARE_BRACKET:221, WIN_KEY:224, M
AC_FF_META:224, WIN_IME:229, PHANTOM:255}; | |
4091 goog.events.KeyCodes.isTextModifyingKeyEvent = function(a) { | |
4092 if(a.altKey && !a.ctrlKey || a.metaKey || a.keyCode >= goog.events.KeyCodes.F1
&& a.keyCode <= goog.events.KeyCodes.F12) { | |
4093 return!1 | |
4094 } | |
4095 switch(a.keyCode) { | |
4096 case goog.events.KeyCodes.ALT: | |
4097 ; | |
4098 case goog.events.KeyCodes.CAPS_LOCK: | |
4099 ; | |
4100 case goog.events.KeyCodes.CONTEXT_MENU: | |
4101 ; | |
4102 case goog.events.KeyCodes.CTRL: | |
4103 ; | |
4104 case goog.events.KeyCodes.DOWN: | |
4105 ; | |
4106 case goog.events.KeyCodes.END: | |
4107 ; | |
4108 case goog.events.KeyCodes.ESC: | |
4109 ; | |
4110 case goog.events.KeyCodes.HOME: | |
4111 ; | |
4112 case goog.events.KeyCodes.INSERT: | |
4113 ; | |
4114 case goog.events.KeyCodes.LEFT: | |
4115 ; | |
4116 case goog.events.KeyCodes.MAC_FF_META: | |
4117 ; | |
4118 case goog.events.KeyCodes.META: | |
4119 ; | |
4120 case goog.events.KeyCodes.NUMLOCK: | |
4121 ; | |
4122 case goog.events.KeyCodes.NUM_CENTER: | |
4123 ; | |
4124 case goog.events.KeyCodes.PAGE_DOWN: | |
4125 ; | |
4126 case goog.events.KeyCodes.PAGE_UP: | |
4127 ; | |
4128 case goog.events.KeyCodes.PAUSE: | |
4129 ; | |
4130 case goog.events.KeyCodes.PHANTOM: | |
4131 ; | |
4132 case goog.events.KeyCodes.PRINT_SCREEN: | |
4133 ; | |
4134 case goog.events.KeyCodes.RIGHT: | |
4135 ; | |
4136 case goog.events.KeyCodes.SHIFT: | |
4137 ; | |
4138 case goog.events.KeyCodes.UP: | |
4139 ; | |
4140 case goog.events.KeyCodes.WIN_KEY: | |
4141 ; | |
4142 case goog.events.KeyCodes.WIN_KEY_RIGHT: | |
4143 return!1; | |
4144 default: | |
4145 return!0 | |
4146 } | |
4147 }; | |
4148 goog.events.KeyCodes.firesKeyPressEvent = function(a, b, c, d, e) { | |
4149 if(!goog.userAgent.IE && (!goog.userAgent.WEBKIT || !goog.userAgent.isVersion(
"525"))) { | |
4150 return!0 | |
4151 } | |
4152 if(goog.userAgent.MAC && e) { | |
4153 return goog.events.KeyCodes.isCharacterKey(a) | |
4154 } | |
4155 if(e && !d) { | |
4156 return!1 | |
4157 } | |
4158 if(!c && (b == goog.events.KeyCodes.CTRL || b == goog.events.KeyCodes.ALT)) { | |
4159 return!1 | |
4160 } | |
4161 if(goog.userAgent.IE && d && b == a) { | |
4162 return!1 | |
4163 } | |
4164 switch(a) { | |
4165 case goog.events.KeyCodes.ENTER: | |
4166 return!(goog.userAgent.IE && goog.userAgent.isDocumentMode(9)); | |
4167 case goog.events.KeyCodes.ESC: | |
4168 return!goog.userAgent.WEBKIT | |
4169 } | |
4170 return goog.events.KeyCodes.isCharacterKey(a) | |
4171 }; | |
4172 goog.events.KeyCodes.isCharacterKey = function(a) { | |
4173 if(a >= goog.events.KeyCodes.ZERO && a <= goog.events.KeyCodes.NINE) { | |
4174 return!0 | |
4175 } | |
4176 if(a >= goog.events.KeyCodes.NUM_ZERO && a <= goog.events.KeyCodes.NUM_MULTIPL
Y) { | |
4177 return!0 | |
4178 } | |
4179 if(a >= goog.events.KeyCodes.A && a <= goog.events.KeyCodes.Z) { | |
4180 return!0 | |
4181 } | |
4182 if(goog.userAgent.WEBKIT && a == 0) { | |
4183 return!0 | |
4184 } | |
4185 switch(a) { | |
4186 case goog.events.KeyCodes.SPACE: | |
4187 ; | |
4188 case goog.events.KeyCodes.QUESTION_MARK: | |
4189 ; | |
4190 case goog.events.KeyCodes.NUM_PLUS: | |
4191 ; | |
4192 case goog.events.KeyCodes.NUM_MINUS: | |
4193 ; | |
4194 case goog.events.KeyCodes.NUM_PERIOD: | |
4195 ; | |
4196 case goog.events.KeyCodes.NUM_DIVISION: | |
4197 ; | |
4198 case goog.events.KeyCodes.SEMICOLON: | |
4199 ; | |
4200 case goog.events.KeyCodes.DASH: | |
4201 ; | |
4202 case goog.events.KeyCodes.EQUALS: | |
4203 ; | |
4204 case goog.events.KeyCodes.COMMA: | |
4205 ; | |
4206 case goog.events.KeyCodes.PERIOD: | |
4207 ; | |
4208 case goog.events.KeyCodes.SLASH: | |
4209 ; | |
4210 case goog.events.KeyCodes.APOSTROPHE: | |
4211 ; | |
4212 case goog.events.KeyCodes.SINGLE_QUOTE: | |
4213 ; | |
4214 case goog.events.KeyCodes.OPEN_SQUARE_BRACKET: | |
4215 ; | |
4216 case goog.events.KeyCodes.BACKSLASH: | |
4217 ; | |
4218 case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET: | |
4219 return!0; | |
4220 default: | |
4221 return!1 | |
4222 } | |
4223 }; | |
4224 goog.events.KeyHandler = function(a, b) { | |
4225 goog.events.EventTarget.call(this); | |
4226 a && this.attach(a, b) | |
4227 }; | |
4228 goog.inherits(goog.events.KeyHandler, goog.events.EventTarget); | |
4229 goog.events.KeyHandler.prototype.element_ = null; | |
4230 goog.events.KeyHandler.prototype.keyPressKey_ = null; | |
4231 goog.events.KeyHandler.prototype.keyDownKey_ = null; | |
4232 goog.events.KeyHandler.prototype.keyUpKey_ = null; | |
4233 goog.events.KeyHandler.prototype.lastKey_ = -1; | |
4234 goog.events.KeyHandler.prototype.keyCode_ = -1; | |
4235 goog.events.KeyHandler.EventType = {KEY:"key"}; | |
4236 goog.events.KeyHandler.safariKey_ = {3:goog.events.KeyCodes.ENTER, 12:goog.event
s.KeyCodes.NUMLOCK, 63232:goog.events.KeyCodes.UP, 63233:goog.events.KeyCodes.DO
WN, 63234:goog.events.KeyCodes.LEFT, 63235:goog.events.KeyCodes.RIGHT, 63236:goo
g.events.KeyCodes.F1, 63237:goog.events.KeyCodes.F2, 63238:goog.events.KeyCodes.
F3, 63239:goog.events.KeyCodes.F4, 63240:goog.events.KeyCodes.F5, 63241:goog.eve
nts.KeyCodes.F6, 63242:goog.events.KeyCodes.F7, 63243:goog.events.KeyCodes.F8, 6
3244:goog.events.KeyCodes.F9, | |
4237 63245:goog.events.KeyCodes.F10, 63246:goog.events.KeyCodes.F11, 63247:goog.event
s.KeyCodes.F12, 63248:goog.events.KeyCodes.PRINT_SCREEN, 63272:goog.events.KeyCo
des.DELETE, 63273:goog.events.KeyCodes.HOME, 63275:goog.events.KeyCodes.END, 632
76:goog.events.KeyCodes.PAGE_UP, 63277:goog.events.KeyCodes.PAGE_DOWN, 63289:goo
g.events.KeyCodes.NUMLOCK, 63302:goog.events.KeyCodes.INSERT}; | |
4238 goog.events.KeyHandler.keyIdentifier_ = {Up:goog.events.KeyCodes.UP, Down:goog.e
vents.KeyCodes.DOWN, Left:goog.events.KeyCodes.LEFT, Right:goog.events.KeyCodes.
RIGHT, Enter:goog.events.KeyCodes.ENTER, F1:goog.events.KeyCodes.F1, F2:goog.eve
nts.KeyCodes.F2, F3:goog.events.KeyCodes.F3, F4:goog.events.KeyCodes.F4, F5:goog
.events.KeyCodes.F5, F6:goog.events.KeyCodes.F6, F7:goog.events.KeyCodes.F7, F8:
goog.events.KeyCodes.F8, F9:goog.events.KeyCodes.F9, F10:goog.events.KeyCodes.F1
0, F11:goog.events.KeyCodes.F11, | |
4239 F12:goog.events.KeyCodes.F12, "U+007F":goog.events.KeyCodes.DELETE, Home:goog.ev
ents.KeyCodes.HOME, End:goog.events.KeyCodes.END, PageUp:goog.events.KeyCodes.PA
GE_UP, PageDown:goog.events.KeyCodes.PAGE_DOWN, Insert:goog.events.KeyCodes.INSE
RT}; | |
4240 goog.events.KeyHandler.mozKeyCodeToKeyCodeMap_ = {61:187, 59:186}; | |
4241 goog.events.KeyHandler.USES_KEYDOWN_ = goog.userAgent.IE || goog.userAgent.WEBKI
T && goog.userAgent.isVersion("525"); | |
4242 goog.events.KeyHandler.prototype.handleKeyDown_ = function(a) { | |
4243 if(goog.userAgent.WEBKIT && (this.lastKey_ == goog.events.KeyCodes.CTRL && !a.
ctrlKey || this.lastKey_ == goog.events.KeyCodes.ALT && !a.altKey)) { | |
4244 this.keyCode_ = this.lastKey_ = -1 | |
4245 } | |
4246 goog.events.KeyHandler.USES_KEYDOWN_ && !goog.events.KeyCodes.firesKeyPressEve
nt(a.keyCode, this.lastKey_, a.shiftKey, a.ctrlKey, a.altKey) ? this.handleEvent
(a) : this.keyCode_ = goog.userAgent.GECKO && a.keyCode in goog.events.KeyHandle
r.mozKeyCodeToKeyCodeMap_ ? goog.events.KeyHandler.mozKeyCodeToKeyCodeMap_[a.key
Code] : a.keyCode | |
4247 }; | |
4248 goog.events.KeyHandler.prototype.handleKeyup_ = function() { | |
4249 this.keyCode_ = this.lastKey_ = -1 | |
4250 }; | |
4251 goog.events.KeyHandler.prototype.handleEvent = function(a) { | |
4252 var b = a.getBrowserEvent(), c, d; | |
4253 if(goog.userAgent.IE && a.type == goog.events.EventType.KEYPRESS) { | |
4254 c = this.keyCode_, d = c != goog.events.KeyCodes.ENTER && c != goog.events.K
eyCodes.ESC ? b.keyCode : 0 | |
4255 }else { | |
4256 if(goog.userAgent.WEBKIT && a.type == goog.events.EventType.KEYPRESS) { | |
4257 c = this.keyCode_, d = b.charCode >= 0 && b.charCode < 63232 && goog.event
s.KeyCodes.isCharacterKey(c) ? b.charCode : 0 | |
4258 }else { | |
4259 if(goog.userAgent.OPERA) { | |
4260 c = this.keyCode_, d = goog.events.KeyCodes.isCharacterKey(c) ? b.keyCod
e : 0 | |
4261 }else { | |
4262 if(c = b.keyCode || this.keyCode_, d = b.charCode || 0, goog.userAgent.M
AC && d == goog.events.KeyCodes.QUESTION_MARK && !c) { | |
4263 c = goog.events.KeyCodes.SLASH | |
4264 } | |
4265 } | |
4266 } | |
4267 } | |
4268 var e = c, f = b.keyIdentifier; | |
4269 c ? c >= 63232 && c in goog.events.KeyHandler.safariKey_ ? e = goog.events.Key
Handler.safariKey_[c] : c == 25 && a.shiftKey && (e = 9) : f && f in goog.events
.KeyHandler.keyIdentifier_ && (e = goog.events.KeyHandler.keyIdentifier_[f]); | |
4270 a = e == this.lastKey_; | |
4271 this.lastKey_ = e; | |
4272 b = new goog.events.KeyEvent(e, d, a, b); | |
4273 try { | |
4274 this.dispatchEvent(b) | |
4275 }finally { | |
4276 b.dispose() | |
4277 } | |
4278 }; | |
4279 goog.events.KeyHandler.prototype.getElement = function() { | |
4280 return this.element_ | |
4281 }; | |
4282 goog.events.KeyHandler.prototype.attach = function(a, b) { | |
4283 this.keyUpKey_ && this.detach(); | |
4284 this.element_ = a; | |
4285 this.keyPressKey_ = goog.events.listen(this.element_, goog.events.EventType.KE
YPRESS, this, b); | |
4286 this.keyDownKey_ = goog.events.listen(this.element_, goog.events.EventType.KEY
DOWN, this.handleKeyDown_, b, this); | |
4287 this.keyUpKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYUP
, this.handleKeyup_, b, this) | |
4288 }; | |
4289 goog.events.KeyHandler.prototype.detach = function() { | |
4290 if(this.keyPressKey_) { | |
4291 goog.events.unlistenByKey(this.keyPressKey_), goog.events.unlistenByKey(this
.keyDownKey_), goog.events.unlistenByKey(this.keyUpKey_), this.keyUpKey_ = this.
keyDownKey_ = this.keyPressKey_ = null | |
4292 } | |
4293 this.element_ = null; | |
4294 this.keyCode_ = this.lastKey_ = -1 | |
4295 }; | |
4296 goog.events.KeyHandler.prototype.disposeInternal = function() { | |
4297 goog.events.KeyHandler.superClass_.disposeInternal.call(this); | |
4298 this.detach() | |
4299 }; | |
4300 goog.events.KeyEvent = function(a, b, c, d) { | |
4301 goog.events.BrowserEvent.call(this, d); | |
4302 this.type = goog.events.KeyHandler.EventType.KEY; | |
4303 this.keyCode = a; | |
4304 this.charCode = b; | |
4305 this.repeat = c | |
4306 }; | |
4307 goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent); | |
4308 goog.math.randomInt = function(a) { | |
4309 return Math.floor(Math.random() * a) | |
4310 }; | |
4311 goog.math.uniformRandom = function(a, b) { | |
4312 return a + Math.random() * (b - a) | |
4313 }; | |
4314 goog.math.clamp = function(a, b, c) { | |
4315 return Math.min(Math.max(a, b), c) | |
4316 }; | |
4317 goog.math.modulo = function(a, b) { | |
4318 var c = a % b; | |
4319 return c * b < 0 ? c + b : c | |
4320 }; | |
4321 goog.math.lerp = function(a, b, c) { | |
4322 return a + c * (b - a) | |
4323 }; | |
4324 goog.math.nearlyEquals = function(a, b, c) { | |
4325 return Math.abs(a - b) <= (c || 1.0E-6) | |
4326 }; | |
4327 goog.math.standardAngle = function(a) { | |
4328 return goog.math.modulo(a, 360) | |
4329 }; | |
4330 goog.math.toRadians = function(a) { | |
4331 return a * Math.PI / 180 | |
4332 }; | |
4333 goog.math.toDegrees = function(a) { | |
4334 return a * 180 / Math.PI | |
4335 }; | |
4336 goog.math.angleDx = function(a, b) { | |
4337 return b * Math.cos(goog.math.toRadians(a)) | |
4338 }; | |
4339 goog.math.angleDy = function(a, b) { | |
4340 return b * Math.sin(goog.math.toRadians(a)) | |
4341 }; | |
4342 goog.math.angle = function(a, b, c, d) { | |
4343 return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(d - b, c - a))) | |
4344 }; | |
4345 goog.math.angleDifference = function(a, b) { | |
4346 var c = goog.math.standardAngle(b) - goog.math.standardAngle(a); | |
4347 c > 180 ? c -= 360 : c <= -180 && (c = 360 + c); | |
4348 return c | |
4349 }; | |
4350 goog.math.sign = function(a) { | |
4351 return a == 0 ? 0 : a < 0 ? -1 : 1 | |
4352 }; | |
4353 goog.math.longestCommonSubsequence = function(a, b, c, d) { | |
4354 for(var c = c || function(a, b) { | |
4355 return a == b | |
4356 }, d = d || function(b) { | |
4357 return a[b] | |
4358 }, e = a.length, f = b.length, g = [], h = 0;h < e + 1;h++) { | |
4359 g[h] = [], g[h][0] = 0 | |
4360 } | |
4361 for(var i = 0;i < f + 1;i++) { | |
4362 g[0][i] = 0 | |
4363 } | |
4364 for(h = 1;h <= e;h++) { | |
4365 for(i = 1;i <= e;i++) { | |
4366 g[h][i] = c(a[h - 1], b[i - 1]) ? g[h - 1][i - 1] + 1 : Math.max(g[h - 1][
i], g[h][i - 1]) | |
4367 } | |
4368 } | |
4369 for(var j = [], h = e, i = f;h > 0 && i > 0;) { | |
4370 c(a[h - 1], b[i - 1]) ? (j.unshift(d(h - 1, i - 1)), h--, i--) : g[h - 1][i]
> g[h][i - 1] ? h-- : i-- | |
4371 } | |
4372 return j | |
4373 }; | |
4374 goog.math.sum = function(a) { | |
4375 return goog.array.reduce(arguments, function(a, c) { | |
4376 return a + c | |
4377 }, 0) | |
4378 }; | |
4379 goog.math.average = function(a) { | |
4380 return goog.math.sum.apply(null, arguments) / arguments.length | |
4381 }; | |
4382 goog.math.standardDeviation = function(a) { | |
4383 var b = arguments.length; | |
4384 if(b < 2) { | |
4385 return 0 | |
4386 } | |
4387 var c = goog.math.average.apply(null, arguments), b = goog.math.sum.apply(null
, goog.array.map(arguments, function(a) { | |
4388 return Math.pow(a - c, 2) | |
4389 })) / (b - 1); | |
4390 return Math.sqrt(b) | |
4391 }; | |
4392 goog.math.isInt = function(a) { | |
4393 return isFinite(a) && a % 1 == 0 | |
4394 }; | |
4395 goog.math.isFiniteNumber = function(a) { | |
4396 return isFinite(a) && !isNaN(a) | |
4397 }; | |
4398 goog.events.MouseWheelHandler = function(a) { | |
4399 goog.events.EventTarget.call(this); | |
4400 this.element_ = a; | |
4401 this.listenKey_ = goog.events.listen(this.element_, goog.userAgent.GECKO ? "DO
MMouseScroll" : "mousewheel", this) | |
4402 }; | |
4403 goog.inherits(goog.events.MouseWheelHandler, goog.events.EventTarget); | |
4404 goog.events.MouseWheelHandler.EventType = {MOUSEWHEEL:"mousewheel"}; | |
4405 goog.events.MouseWheelHandler.prototype.setMaxDeltaX = function(a) { | |
4406 this.maxDeltaX_ = a | |
4407 }; | |
4408 goog.events.MouseWheelHandler.prototype.setMaxDeltaY = function(a) { | |
4409 this.maxDeltaY_ = a | |
4410 }; | |
4411 goog.events.MouseWheelHandler.prototype.handleEvent = function(a) { | |
4412 var b = 0, c = 0, d = 0, a = a.getBrowserEvent(); | |
4413 if(a.type == "mousewheel") { | |
4414 c = 1; | |
4415 if(goog.userAgent.IE || goog.userAgent.WEBKIT && (goog.userAgent.WINDOWS ||
goog.userAgent.isVersion("532.0"))) { | |
4416 c = 40 | |
4417 } | |
4418 d = goog.events.MouseWheelHandler.smartScale_(-a.wheelDelta, c); | |
4419 goog.isDef(a.wheelDeltaX) ? (b = goog.events.MouseWheelHandler.smartScale_(-
a.wheelDeltaX, c), c = goog.events.MouseWheelHandler.smartScale_(-a.wheelDeltaY,
c)) : c = d | |
4420 }else { | |
4421 d = a.detail, d > 100 ? d = 3 : d < -100 && (d = -3), goog.isDef(a.axis) &&
a.axis === a.HORIZONTAL_AXIS ? b = d : c = d | |
4422 } | |
4423 goog.isNumber(this.maxDeltaX_) && (b = goog.math.clamp(b, -this.maxDeltaX_, th
is.maxDeltaX_)); | |
4424 goog.isNumber(this.maxDeltaY_) && (c = goog.math.clamp(c, -this.maxDeltaY_, th
is.maxDeltaY_)); | |
4425 b = new goog.events.MouseWheelEvent(d, a, b, c); | |
4426 try { | |
4427 this.dispatchEvent(b) | |
4428 }finally { | |
4429 b.dispose() | |
4430 } | |
4431 }; | |
4432 goog.events.MouseWheelHandler.smartScale_ = function(a, b) { | |
4433 return goog.userAgent.WEBKIT && goog.userAgent.MAC && a % b != 0 ? a : a / b | |
4434 }; | |
4435 goog.events.MouseWheelHandler.prototype.disposeInternal = function() { | |
4436 goog.events.MouseWheelHandler.superClass_.disposeInternal.call(this); | |
4437 goog.events.unlistenByKey(this.listenKey_); | |
4438 delete this.listenKey_ | |
4439 }; | |
4440 goog.events.MouseWheelEvent = function(a, b, c, d) { | |
4441 goog.events.BrowserEvent.call(this, b); | |
4442 this.type = goog.events.MouseWheelHandler.EventType.MOUSEWHEEL; | |
4443 this.detail = a; | |
4444 this.deltaX = c; | |
4445 this.deltaY = d | |
4446 }; | |
4447 goog.inherits(goog.events.MouseWheelEvent, goog.events.BrowserEvent); | |
4448 goog.fx = {}; | |
4449 goog.fx.Transition = function() { | |
4450 }; | |
4451 goog.fx.Transition.EventType = {PLAY:"play", BEGIN:"begin", RESUME:"resume", END
:"end", STOP:"stop", FINISH:"finish", PAUSE:"pause"}; | |
4452 goog.fx.Animation = function(a, b, c, d) { | |
4453 goog.events.EventTarget.call(this); | |
4454 if(!goog.isArray(a) || !goog.isArray(b)) { | |
4455 throw Error("Start and end parameters must be arrays"); | |
4456 } | |
4457 if(a.length != b.length) { | |
4458 throw Error("Start and end points must be the same length"); | |
4459 } | |
4460 this.startPoint = a; | |
4461 this.endPoint = b; | |
4462 this.duration = c; | |
4463 this.accel_ = d; | |
4464 this.coords = [] | |
4465 }; | |
4466 goog.inherits(goog.fx.Animation, goog.events.EventTarget); | |
4467 goog.fx.Animation.EventType = {PLAY:goog.fx.Transition.EventType.PLAY, BEGIN:goo
g.fx.Transition.EventType.BEGIN, RESUME:goog.fx.Transition.EventType.RESUME, END
:goog.fx.Transition.EventType.END, STOP:goog.fx.Transition.EventType.STOP, FINIS
H:goog.fx.Transition.EventType.FINISH, PAUSE:goog.fx.Transition.EventType.PAUSE,
ANIMATE:"animate", DESTROY:"destroy"}; | |
4468 goog.fx.Animation.State = {STOPPED:0, PAUSED:-1, PLAYING:1}; | |
4469 goog.fx.Animation.TIMEOUT = 20; | |
4470 goog.fx.Animation.activeAnimations_ = {}; | |
4471 goog.fx.Animation.globalTimer_ = null; | |
4472 goog.fx.Animation.animationWindow_ = null; | |
4473 goog.fx.Animation.requestAnimationFrameFn_ = null; | |
4474 goog.fx.Animation.cancelRequestAnimationFrameFn_ = null; | |
4475 goog.fx.Animation.cycleAnimations_ = function() { | |
4476 goog.fx.Animation.resetTimer_(); | |
4477 var a = goog.now(), b; | |
4478 for(b in goog.fx.Animation.activeAnimations_) { | |
4479 goog.fx.Animation.activeAnimations_[b].cycle(a) | |
4480 } | |
4481 goog.fx.Animation.globalTimer_ = goog.object.isEmpty(goog.fx.Animation.activeA
nimations_) ? null : goog.fx.Animation.startTimer_() | |
4482 }; | |
4483 goog.fx.Animation.resetTimer_ = function() { | |
4484 if(goog.fx.Animation.globalTimer_) { | |
4485 goog.fx.Animation.requestAnimationFrameFn_ ? goog.fx.Animation.cancelRequest
AnimationFrameFn_.call(goog.fx.Animation.animationWindow_, goog.fx.Animation.glo
balTimer_) : goog.Timer.defaultTimerObject.clearTimeout(goog.fx.Animation.global
Timer_), goog.fx.Animation.globalTimer_ = null | |
4486 } | |
4487 }; | |
4488 goog.fx.Animation.startTimer_ = function() { | |
4489 return goog.fx.Animation.requestAnimationFrameFn_ ? goog.fx.Animation.requestA
nimationFrameFn_.call(goog.fx.Animation.animationWindow_, goog.fx.Animation.cycl
eAnimations_) : goog.Timer.defaultTimerObject.setTimeout(goog.fx.Animation.cycle
Animations_, goog.fx.Animation.TIMEOUT) | |
4490 }; | |
4491 goog.fx.Animation.registerAnimation = function(a) { | |
4492 var b = goog.getUid(a); | |
4493 b in goog.fx.Animation.activeAnimations_ || (goog.fx.Animation.activeAnimation
s_[b] = a); | |
4494 if(!goog.fx.Animation.globalTimer_) { | |
4495 goog.fx.Animation.globalTimer_ = goog.fx.Animation.startTimer_() | |
4496 } | |
4497 }; | |
4498 goog.fx.Animation.unregisterAnimation = function(a) { | |
4499 a = goog.getUid(a); | |
4500 delete goog.fx.Animation.activeAnimations_[a]; | |
4501 goog.object.isEmpty(goog.fx.Animation.activeAnimations_) && goog.fx.Animation.
resetTimer_() | |
4502 }; | |
4503 goog.fx.Animation.setAnimationWindow = function(a) { | |
4504 (goog.fx.Animation.animationWindow_ = a) ? (goog.fx.Animation.requestAnimation
FrameFn_ = a.requestAnimationFrame || a.webkitRequestAnimationFrame || a.mozRequ
estAnimationFrame || a.oRequestAnimationFrame || a.msRequestAnimationFrame, goog
.fx.Animation.cancelRequestAnimationFrameFn_ = a.cancelRequestAnimationFrame ||
a.webkitCancelRequestAnimationFrame || a.mozCancelRequestAnimationFrame || a.oCa
ncelRequestAnimationFrame || a.msCancelRequestAnimationFrame) : (goog.fx.Animati
on.requestAnimationFrameFn_ = | |
4505 null, goog.fx.Animation.cancelRequestAnimationFrameFn_ = null) | |
4506 }; | |
4507 goog.fx.Animation.prototype.state_ = goog.fx.Animation.State.STOPPED; | |
4508 goog.fx.Animation.prototype.fps_ = 0; | |
4509 goog.fx.Animation.prototype.progress = 0; | |
4510 goog.fx.Animation.prototype.startTime = null; | |
4511 goog.fx.Animation.prototype.endTime = null; | |
4512 goog.fx.Animation.prototype.lastFrame = null; | |
4513 goog.fx.Animation.prototype.getStateInternal = function() { | |
4514 return this.state_ | |
4515 }; | |
4516 goog.fx.Animation.prototype.play = function(a) { | |
4517 if(a || this.state_ == goog.fx.Animation.State.STOPPED) { | |
4518 this.progress = 0, this.coords = this.startPoint | |
4519 }else { | |
4520 if(this.state_ == goog.fx.Animation.State.PLAYING) { | |
4521 return!1 | |
4522 } | |
4523 } | |
4524 goog.fx.Animation.unregisterAnimation(this); | |
4525 this.startTime = goog.now(); | |
4526 this.state_ == goog.fx.Animation.State.PAUSED && (this.startTime -= this.durat
ion * this.progress); | |
4527 this.endTime = this.startTime + this.duration; | |
4528 this.lastFrame = this.startTime; | |
4529 if(!this.progress) { | |
4530 this.onBegin() | |
4531 } | |
4532 this.onPlay(); | |
4533 if(this.state_ == goog.fx.Animation.State.PAUSED) { | |
4534 this.onResume() | |
4535 } | |
4536 this.state_ = goog.fx.Animation.State.PLAYING; | |
4537 goog.fx.Animation.registerAnimation(this); | |
4538 this.cycle(this.startTime); | |
4539 return!0 | |
4540 }; | |
4541 goog.fx.Animation.prototype.stop = function(a) { | |
4542 goog.fx.Animation.unregisterAnimation(this); | |
4543 this.state_ = goog.fx.Animation.State.STOPPED; | |
4544 if(a) { | |
4545 this.progress = 1 | |
4546 } | |
4547 this.updateCoords_(this.progress); | |
4548 this.onStop(); | |
4549 this.onEnd() | |
4550 }; | |
4551 goog.fx.Animation.prototype.pause = function() { | |
4552 if(this.state_ == goog.fx.Animation.State.PLAYING) { | |
4553 goog.fx.Animation.unregisterAnimation(this), this.state_ = goog.fx.Animation
.State.PAUSED, this.onPause() | |
4554 } | |
4555 }; | |
4556 goog.fx.Animation.prototype.disposeInternal = function() { | |
4557 this.state_ != goog.fx.Animation.State.STOPPED && this.stop(!1); | |
4558 this.onDestroy(); | |
4559 goog.fx.Animation.superClass_.disposeInternal.call(this) | |
4560 }; | |
4561 goog.fx.Animation.prototype.destroy = function() { | |
4562 this.dispose() | |
4563 }; | |
4564 goog.fx.Animation.prototype.cycle = function(a) { | |
4565 this.progress = (a - this.startTime) / (this.endTime - this.startTime); | |
4566 if(this.progress >= 1) { | |
4567 this.progress = 1 | |
4568 } | |
4569 this.fps_ = 1E3 / (a - this.lastFrame); | |
4570 this.lastFrame = a; | |
4571 this.updateCoords_(this.progress); | |
4572 if(this.progress == 1) { | |
4573 this.state_ = goog.fx.Animation.State.STOPPED, goog.fx.Animation.unregisterA
nimation(this), this.onFinish(), this.onEnd() | |
4574 }else { | |
4575 if(this.state_ == goog.fx.Animation.State.PLAYING) { | |
4576 this.onAnimate() | |
4577 } | |
4578 } | |
4579 }; | |
4580 goog.fx.Animation.prototype.updateCoords_ = function(a) { | |
4581 goog.isFunction(this.accel_) && (a = this.accel_(a)); | |
4582 this.coords = Array(this.startPoint.length); | |
4583 for(var b = 0;b < this.startPoint.length;b++) { | |
4584 this.coords[b] = (this.endPoint[b] - this.startPoint[b]) * a + this.startPoi
nt[b] | |
4585 } | |
4586 }; | |
4587 goog.fx.Animation.prototype.onAnimate = function() { | |
4588 this.dispatchAnimationEvent_(goog.fx.Animation.EventType.ANIMATE) | |
4589 }; | |
4590 goog.fx.Animation.prototype.onBegin = function() { | |
4591 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.BEGIN) | |
4592 }; | |
4593 goog.fx.Animation.prototype.onDestroy = function() { | |
4594 this.dispatchAnimationEvent_(goog.fx.Animation.EventType.DESTROY) | |
4595 }; | |
4596 goog.fx.Animation.prototype.onEnd = function() { | |
4597 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.END) | |
4598 }; | |
4599 goog.fx.Animation.prototype.onFinish = function() { | |
4600 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.FINISH) | |
4601 }; | |
4602 goog.fx.Animation.prototype.onPause = function() { | |
4603 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.PAUSE) | |
4604 }; | |
4605 goog.fx.Animation.prototype.onPlay = function() { | |
4606 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.PLAY) | |
4607 }; | |
4608 goog.fx.Animation.prototype.onResume = function() { | |
4609 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.RESUME) | |
4610 }; | |
4611 goog.fx.Animation.prototype.onStop = function() { | |
4612 this.dispatchAnimationEvent_(goog.fx.Transition.EventType.STOP) | |
4613 }; | |
4614 goog.fx.Animation.prototype.dispatchAnimationEvent_ = function(a) { | |
4615 this.dispatchEvent(new goog.fx.AnimationEvent(a, this)) | |
4616 }; | |
4617 goog.fx.AnimationEvent = function(a, b) { | |
4618 goog.events.Event.call(this, a); | |
4619 this.coords = b.coords; | |
4620 this.x = b.coords[0]; | |
4621 this.y = b.coords[1]; | |
4622 this.z = b.coords[2]; | |
4623 this.duration = b.duration; | |
4624 this.progress = b.progress; | |
4625 this.fps = b.fps_; | |
4626 this.state = b.state_; | |
4627 this.anim = b | |
4628 }; | |
4629 goog.inherits(goog.fx.AnimationEvent, goog.events.Event); | |
4630 goog.fx.AnimationEvent.prototype.coordsAsInts = function() { | |
4631 return goog.array.map(this.coords, Math.round) | |
4632 }; | |
4633 goog.fx.AnimationQueue = function() { | |
4634 goog.fx.Animation.call(this, [0], [0], 0); | |
4635 this.queue_ = [] | |
4636 }; | |
4637 goog.inherits(goog.fx.AnimationQueue, goog.fx.Animation); | |
4638 goog.fx.AnimationQueue.prototype.onResume = function() { | |
4639 this.executeChildrenAction(function(a) { | |
4640 a.play(a.progress == 0) | |
4641 }); | |
4642 goog.fx.AnimationQueue.superClass_.onResume.call(this) | |
4643 }; | |
4644 goog.fx.AnimationQueue.prototype.onStop = function() { | |
4645 this.executeChildrenAction(function(a) { | |
4646 a.stop() | |
4647 }); | |
4648 goog.fx.AnimationQueue.superClass_.onStop.call(this) | |
4649 }; | |
4650 goog.fx.AnimationQueue.prototype.onPause = function() { | |
4651 this.executeChildrenAction(function(a) { | |
4652 a.pause() | |
4653 }); | |
4654 goog.fx.AnimationQueue.superClass_.onPause.call(this) | |
4655 }; | |
4656 goog.fx.AnimationQueue.prototype.onDestroy = function() { | |
4657 this.destroyQueueAndHandlers_(); | |
4658 goog.fx.AnimationQueue.superClass_.onDestroy.call(this) | |
4659 }; | |
4660 goog.fx.AnimationQueue.prototype.destroyQueueAndHandlers_ = function() { | |
4661 goog.array.forEach(this.queue_, function(a) { | |
4662 a.destroy() | |
4663 }) | |
4664 }; | |
4665 goog.fx.AnimationParallelQueue = function() { | |
4666 goog.fx.AnimationQueue.call(this) | |
4667 }; | |
4668 goog.inherits(goog.fx.AnimationParallelQueue, goog.fx.AnimationQueue); | |
4669 goog.fx.AnimationParallelQueue.prototype.playAll_ = function() { | |
4670 for(var a = 0;a < this.queue_.length;a++) { | |
4671 this.queue_[a].play() | |
4672 } | |
4673 }; | |
4674 goog.fx.AnimationParallelQueue.prototype.onBegin = function() { | |
4675 this.playAll_(); | |
4676 goog.fx.AnimationParallelQueue.superClass_.onBegin.call(this) | |
4677 }; | |
4678 goog.fx.AnimationParallelQueue.prototype.executeChildrenAction = function(a) { | |
4679 goog.array.forEach(this.queue_, a) | |
4680 }; | |
4681 goog.fx.AnimationParallelQueue.prototype.add = function(a) { | |
4682 this.queue_.push(a); | |
4683 this.duration = Math.max(this.duration, a.duration) | |
4684 }; | |
4685 goog.fx.AnimationParallelQueue.prototype.remove = function(a) { | |
4686 if(goog.array.remove(this.queue_, a) && a.duration == this.duration) { | |
4687 this.duration = 0, goog.array.forEach(this.queue_, function(a) { | |
4688 this.duration = Math.max(a.duration, this.duration) | |
4689 }, this) | |
4690 } | |
4691 }; | |
4692 goog.fx.AnimationSerialQueue = function() { | |
4693 goog.fx.AnimationQueue.call(this); | |
4694 this.childHandler_ = new goog.events.EventHandler(this) | |
4695 }; | |
4696 goog.inherits(goog.fx.AnimationSerialQueue, goog.fx.AnimationQueue); | |
4697 goog.fx.AnimationSerialQueue.prototype.counter_ = 0; | |
4698 goog.fx.AnimationSerialQueue.prototype.onBegin = function() { | |
4699 this.playNext_(); | |
4700 goog.fx.AnimationSerialQueue.superClass_.onBegin.call(this) | |
4701 }; | |
4702 goog.fx.AnimationSerialQueue.prototype.onEnd = function() { | |
4703 this.reset_(); | |
4704 goog.fx.AnimationSerialQueue.superClass_.onEnd.call(this) | |
4705 }; | |
4706 goog.fx.AnimationSerialQueue.prototype.reset_ = function() { | |
4707 this.counter_ = 0; | |
4708 this.childHandler_.removeAll() | |
4709 }; | |
4710 goog.fx.AnimationSerialQueue.prototype.playNext_ = function() { | |
4711 this.getStateInternal() == goog.fx.Animation.State.PAUSED && (this.reset_(), g
oog.array.forEach(this.queue_, function(a) { | |
4712 a.progress = 0; | |
4713 a.updateCoords_(a.progress); | |
4714 a.stop() | |
4715 })); | |
4716 this.queue_[this.counter_].play(); | |
4717 this.counter_++; | |
4718 this.counter_ < this.queue_.length && this.childHandler_.listen(this.queue_[th
is.counter_ - 1], goog.fx.Transition.EventType.FINISH, function() { | |
4719 this.playNext_() | |
4720 }) | |
4721 }; | |
4722 goog.fx.AnimationSerialQueue.prototype.add = function(a) { | |
4723 this.queue_.push(a); | |
4724 this.duration += a.duration | |
4725 }; | |
4726 goog.fx.AnimationSerialQueue.prototype.remove = function(a) { | |
4727 goog.array.remove(this.queue_, a) && (this.duration -= a.duration) | |
4728 }; | |
4729 goog.fx.AnimationSerialQueue.prototype.executeChildrenAction = function(a) { | |
4730 this.counter_ > 0 && a(this.queue_[this.counter_ - 1]) | |
4731 }; | |
4732 goog.fx.AnimationSerialQueue.prototype.destroyQueueAndHandlers_ = function() { | |
4733 goog.array.forEach(this.queue_, function(a) { | |
4734 a.destroy() | |
4735 }); | |
4736 this.childHandler_.dispose() | |
4737 }; | |
4738 goog.fx.Dragger = function(a, b, c) { | |
4739 goog.events.EventTarget.call(this); | |
4740 this.target = a; | |
4741 this.handle = b || a; | |
4742 this.limits = c || new goog.math.Rect(NaN, NaN, NaN, NaN); | |
4743 this.document_ = goog.dom.getOwnerDocument(a); | |
4744 this.eventHandler_ = new goog.events.EventHandler(this); | |
4745 goog.events.listen(this.handle, [goog.events.EventType.TOUCHSTART, goog.events
.EventType.MOUSEDOWN], this.startDrag, !1, this) | |
4746 }; | |
4747 goog.inherits(goog.fx.Dragger, goog.events.EventTarget); | |
4748 goog.fx.Dragger.HAS_SET_CAPTURE_ = goog.userAgent.IE || goog.userAgent.GECKO &&
goog.userAgent.isVersion("1.9.3"); | |
4749 goog.fx.Dragger.EventType = {EARLY_CANCEL:"earlycancel", START:"start", BEFOREDR
AG:"beforedrag", DRAG:"drag", END:"end"}; | |
4750 goog.fx.Dragger.prototype.clientX = 0; | |
4751 goog.fx.Dragger.prototype.clientY = 0; | |
4752 goog.fx.Dragger.prototype.screenX = 0; | |
4753 goog.fx.Dragger.prototype.screenY = 0; | |
4754 goog.fx.Dragger.prototype.startX = 0; | |
4755 goog.fx.Dragger.prototype.startY = 0; | |
4756 goog.fx.Dragger.prototype.deltaX = 0; | |
4757 goog.fx.Dragger.prototype.deltaY = 0; | |
4758 goog.fx.Dragger.prototype.enabled_ = !0; | |
4759 goog.fx.Dragger.prototype.dragging_ = !1; | |
4760 goog.fx.Dragger.prototype.hysteresisDistanceSquared_ = 0; | |
4761 goog.fx.Dragger.prototype.mouseDownTime_ = 0; | |
4762 goog.fx.Dragger.prototype.ieDragStartCancellingOn_ = !1; | |
4763 goog.fx.Dragger.prototype.getHandler = function() { | |
4764 return this.eventHandler_ | |
4765 }; | |
4766 goog.fx.Dragger.prototype.setLimits = function(a) { | |
4767 this.limits = a || new goog.math.Rect(NaN, NaN, NaN, NaN) | |
4768 }; | |
4769 goog.fx.Dragger.prototype.setHysteresis = function(a) { | |
4770 this.hysteresisDistanceSquared_ = Math.pow(a, 2) | |
4771 }; | |
4772 goog.fx.Dragger.prototype.getHysteresis = function() { | |
4773 return Math.sqrt(this.hysteresisDistanceSquared_) | |
4774 }; | |
4775 goog.fx.Dragger.prototype.setScrollTarget = function(a) { | |
4776 this.scrollTarget_ = a | |
4777 }; | |
4778 goog.fx.Dragger.prototype.setCancelIeDragStart = function(a) { | |
4779 this.ieDragStartCancellingOn_ = a | |
4780 }; | |
4781 goog.fx.Dragger.prototype.getEnabled = function() { | |
4782 return this.enabled_ | |
4783 }; | |
4784 goog.fx.Dragger.prototype.setEnabled = function(a) { | |
4785 this.enabled_ = a | |
4786 }; | |
4787 goog.fx.Dragger.prototype.disposeInternal = function() { | |
4788 goog.fx.Dragger.superClass_.disposeInternal.call(this); | |
4789 goog.events.unlisten(this.handle, [goog.events.EventType.TOUCHSTART, goog.even
ts.EventType.MOUSEDOWN], this.startDrag, !1, this); | |
4790 this.eventHandler_.dispose(); | |
4791 delete this.target; | |
4792 delete this.handle; | |
4793 delete this.eventHandler_ | |
4794 }; | |
4795 goog.fx.Dragger.prototype.startDrag = function(a) { | |
4796 var b = a.type == goog.events.EventType.MOUSEDOWN; | |
4797 if(this.enabled_ && !this.dragging_ && (!b || a.isMouseActionButton())) { | |
4798 this.maybeReinitTouchEvent_(a); | |
4799 if(this.hysteresisDistanceSquared_ == 0) { | |
4800 if(this.initializeDrag_(a), this.dragging_) { | |
4801 a.preventDefault() | |
4802 }else { | |
4803 return | |
4804 } | |
4805 }else { | |
4806 a.preventDefault() | |
4807 } | |
4808 this.setupDragHandlers(); | |
4809 this.clientX = this.startX = a.clientX; | |
4810 this.clientY = this.startY = a.clientY; | |
4811 this.screenX = a.screenX; | |
4812 this.screenY = a.screenY; | |
4813 this.deltaX = this.target.offsetLeft; | |
4814 this.deltaY = this.target.offsetTop; | |
4815 this.pageScroll = goog.dom.getDomHelper(this.document_).getDocumentScroll(); | |
4816 this.mouseDownTime_ = goog.now() | |
4817 }else { | |
4818 this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL) | |
4819 } | |
4820 }; | |
4821 goog.fx.Dragger.prototype.setupDragHandlers = function() { | |
4822 var a = this.document_, b = a.documentElement, c = !goog.fx.Dragger.HAS_SET_CA
PTURE_; | |
4823 this.eventHandler_.listen(a, [goog.events.EventType.TOUCHMOVE, goog.events.Eve
ntType.MOUSEMOVE], this.handleMove_, c); | |
4824 this.eventHandler_.listen(a, [goog.events.EventType.TOUCHEND, goog.events.Even
tType.MOUSEUP], this.endDrag, c); | |
4825 goog.fx.Dragger.HAS_SET_CAPTURE_ ? (b.setCapture(!1), this.eventHandler_.liste
n(b, goog.events.EventType.LOSECAPTURE, this.endDrag)) : this.eventHandler_.list
en(goog.dom.getWindow(a), goog.events.EventType.BLUR, this.endDrag); | |
4826 goog.userAgent.IE && this.ieDragStartCancellingOn_ && this.eventHandler_.liste
n(a, goog.events.EventType.DRAGSTART, goog.events.Event.preventDefault); | |
4827 this.scrollTarget_ && this.eventHandler_.listen(this.scrollTarget_, goog.event
s.EventType.SCROLL, this.onScroll_, c) | |
4828 }; | |
4829 goog.fx.Dragger.prototype.initializeDrag_ = function(a) { | |
4830 if(this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.START, t
his, a.clientX, a.clientY, a)) !== !1) { | |
4831 this.dragging_ = !0 | |
4832 } | |
4833 }; | |
4834 goog.fx.Dragger.prototype.endDrag = function(a, b) { | |
4835 this.eventHandler_.removeAll(); | |
4836 goog.fx.Dragger.HAS_SET_CAPTURE_ && this.document_.releaseCapture(); | |
4837 var c = this.limitX(this.deltaX), d = this.limitY(this.deltaY); | |
4838 this.dragging_ ? (this.maybeReinitTouchEvent_(a), this.dragging_ = !1, this.di
spatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.END, this, a.clientX
, a.clientY, a, c, d, b || a.type == goog.events.EventType.TOUCHCANCEL))) : this
.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL); | |
4839 (a.type == goog.events.EventType.TOUCHEND || a.type == goog.events.EventType.T
OUCHCANCEL) && a.preventDefault() | |
4840 }; | |
4841 goog.fx.Dragger.prototype.endDragCancel = function(a) { | |
4842 this.endDrag(a, !0) | |
4843 }; | |
4844 goog.fx.Dragger.prototype.maybeReinitTouchEvent_ = function(a) { | |
4845 var b = a.type; | |
4846 b == goog.events.EventType.TOUCHSTART || b == goog.events.EventType.TOUCHMOVE
? a.init(a.getBrowserEvent().targetTouches[0], a.currentTarget) : (b == goog.eve
nts.EventType.TOUCHEND || b == goog.events.EventType.TOUCHCANCEL) && a.init(a.ge
tBrowserEvent().changedTouches[0], a.currentTarget) | |
4847 }; | |
4848 goog.fx.Dragger.prototype.handleMove_ = function(a) { | |
4849 if(this.enabled_) { | |
4850 this.maybeReinitTouchEvent_(a); | |
4851 var b = a.clientX - this.clientX, c = a.clientY - this.clientY; | |
4852 this.clientX = a.clientX; | |
4853 this.clientY = a.clientY; | |
4854 this.screenX = a.screenX; | |
4855 this.screenY = a.screenY; | |
4856 if(!this.dragging_) { | |
4857 var d = this.startX - this.clientX, e = this.startY - this.clientY; | |
4858 if(d * d + e * e > this.hysteresisDistanceSquared_ && (this.initializeDrag
_(a), !this.dragging_)) { | |
4859 this.endDrag(a); | |
4860 return | |
4861 } | |
4862 } | |
4863 c = this.calculatePosition_(b, c); | |
4864 b = c.x; | |
4865 c = c.y; | |
4866 this.dragging_ && this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.E
ventType.BEFOREDRAG, this, a.clientX, a.clientY, a, b, c)) !== !1 && (this.doDra
g(a, b, c, !1), a.preventDefault()) | |
4867 } | |
4868 }; | |
4869 goog.fx.Dragger.prototype.calculatePosition_ = function(a, b) { | |
4870 var c = goog.dom.getDomHelper(this.document_).getDocumentScroll(); | |
4871 a += c.x - this.pageScroll.x; | |
4872 b += c.y - this.pageScroll.y; | |
4873 this.pageScroll = c; | |
4874 this.deltaX += a; | |
4875 this.deltaY += b; | |
4876 var c = this.limitX(this.deltaX), d = this.limitY(this.deltaY); | |
4877 return new goog.math.Coordinate(c, d) | |
4878 }; | |
4879 goog.fx.Dragger.prototype.onScroll_ = function(a) { | |
4880 var b = this.calculatePosition_(0, 0); | |
4881 a.clientX = this.clientX; | |
4882 a.clientY = this.clientY; | |
4883 this.doDrag(a, b.x, b.y, !0) | |
4884 }; | |
4885 goog.fx.Dragger.prototype.doDrag = function(a, b, c) { | |
4886 this.defaultAction(b, c); | |
4887 this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.DRAG, this,
a.clientX, a.clientY, a, b, c)) | |
4888 }; | |
4889 goog.fx.Dragger.prototype.limitX = function(a) { | |
4890 var b = this.limits, c = !isNaN(b.left) ? b.left : null, b = !isNaN(b.width) ?
b.width : 0; | |
4891 return Math.min(c != null ? c + b : Infinity, Math.max(c != null ? c : -Infini
ty, a)) | |
4892 }; | |
4893 goog.fx.Dragger.prototype.limitY = function(a) { | |
4894 var b = this.limits, c = !isNaN(b.top) ? b.top : null, b = !isNaN(b.height) ?
b.height : 0; | |
4895 return Math.min(c != null ? c + b : Infinity, Math.max(c != null ? c : -Infini
ty, a)) | |
4896 }; | |
4897 goog.fx.Dragger.prototype.defaultAction = function(a, b) { | |
4898 this.target.style.left = a + "px"; | |
4899 this.target.style.top = b + "px" | |
4900 }; | |
4901 goog.fx.DragEvent = function(a, b, c, d, e, f, g, h) { | |
4902 goog.events.Event.call(this, a); | |
4903 this.clientX = c; | |
4904 this.clientY = d; | |
4905 this.browserEvent = e; | |
4906 this.left = goog.isDef(f) ? f : b.deltaX; | |
4907 this.top = goog.isDef(g) ? g : b.deltaY; | |
4908 this.dragger = b; | |
4909 this.dragCanceled = !!h | |
4910 }; | |
4911 goog.inherits(goog.fx.DragEvent, goog.events.Event); | |
4912 goog.color = {}; | |
4913 goog.color.names = {aliceblue:"#f0f8ff", antiquewhite:"#faebd7", aqua:"#00ffff",
aquamarine:"#7fffd4", azure:"#f0ffff", beige:"#f5f5dc", bisque:"#ffe4c4", black
:"#000000", blanchedalmond:"#ffebcd", blue:"#0000ff", blueviolet:"#8a2be2", brow
n:"#a52a2a", burlywood:"#deb887", cadetblue:"#5f9ea0", chartreuse:"#7fff00", cho
colate:"#d2691e", coral:"#ff7f50", cornflowerblue:"#6495ed", cornsilk:"#fff8dc",
crimson:"#dc143c", cyan:"#00ffff", darkblue:"#00008b", darkcyan:"#008b8b", dark
goldenrod:"#b8860b", | |
4914 darkgray:"#a9a9a9", darkgreen:"#006400", darkgrey:"#a9a9a9", darkkhaki:"#bdb76b"
, darkmagenta:"#8b008b", darkolivegreen:"#556b2f", darkorange:"#ff8c00", darkorc
hid:"#9932cc", darkred:"#8b0000", darksalmon:"#e9967a", darkseagreen:"#8fbc8f",
darkslateblue:"#483d8b", darkslategray:"#2f4f4f", darkslategrey:"#2f4f4f", darkt
urquoise:"#00ced1", darkviolet:"#9400d3", deeppink:"#ff1493", deepskyblue:"#00bf
ff", dimgray:"#696969", dimgrey:"#696969", dodgerblue:"#1e90ff", firebrick:"#b22
222", floralwhite:"#fffaf0", | |
4915 forestgreen:"#228b22", fuchsia:"#ff00ff", gainsboro:"#dcdcdc", ghostwhite:"#f8f8
ff", gold:"#ffd700", goldenrod:"#daa520", gray:"#808080", green:"#008000", green
yellow:"#adff2f", grey:"#808080", honeydew:"#f0fff0", hotpink:"#ff69b4", indianr
ed:"#cd5c5c", indigo:"#4b0082", ivory:"#fffff0", khaki:"#f0e68c", lavender:"#e6e
6fa", lavenderblush:"#fff0f5", lawngreen:"#7cfc00", lemonchiffon:"#fffacd", ligh
tblue:"#add8e6", lightcoral:"#f08080", lightcyan:"#e0ffff", lightgoldenrodyellow
:"#fafad2", lightgray:"#d3d3d3", | |
4916 lightgreen:"#90ee90", lightgrey:"#d3d3d3", lightpink:"#ffb6c1", lightsalmon:"#ff
a07a", lightseagreen:"#20b2aa", lightskyblue:"#87cefa", lightslategray:"#778899"
, lightslategrey:"#778899", lightsteelblue:"#b0c4de", lightyellow:"#ffffe0", lim
e:"#00ff00", limegreen:"#32cd32", linen:"#faf0e6", magenta:"#ff00ff", maroon:"#8
00000", mediumaquamarine:"#66cdaa", mediumblue:"#0000cd", mediumorchid:"#ba55d3"
, mediumpurple:"#9370d8", mediumseagreen:"#3cb371", mediumslateblue:"#7b68ee", m
ediumspringgreen:"#00fa9a", | |
4917 mediumturquoise:"#48d1cc", mediumvioletred:"#c71585", midnightblue:"#191970", mi
ntcream:"#f5fffa", mistyrose:"#ffe4e1", moccasin:"#ffe4b5", navajowhite:"#ffdead
", navy:"#000080", oldlace:"#fdf5e6", olive:"#808000", olivedrab:"#6b8e23", oran
ge:"#ffa500", orangered:"#ff4500", orchid:"#da70d6", palegoldenrod:"#eee8aa", pa
legreen:"#98fb98", paleturquoise:"#afeeee", palevioletred:"#d87093", papayawhip:
"#ffefd5", peachpuff:"#ffdab9", peru:"#cd853f", pink:"#ffc0cb", plum:"#dda0dd",
powderblue:"#b0e0e6", | |
4918 purple:"#800080", red:"#ff0000", rosybrown:"#bc8f8f", royalblue:"#4169e1", saddl
ebrown:"#8b4513", salmon:"#fa8072", sandybrown:"#f4a460", seagreen:"#2e8b57", se
ashell:"#fff5ee", sienna:"#a0522d", silver:"#c0c0c0", skyblue:"#87ceeb", slatebl
ue:"#6a5acd", slategray:"#708090", slategrey:"#708090", snow:"#fffafa", springgr
een:"#00ff7f", steelblue:"#4682b4", tan:"#d2b48c", teal:"#008080", thistle:"#d8b
fd8", tomato:"#ff6347", turquoise:"#40e0d0", violet:"#ee82ee", wheat:"#f5deb3",
white:"#ffffff", whitesmoke:"#f5f5f5", | |
4919 yellow:"#ffff00", yellowgreen:"#9acd32"}; | |
4920 goog.color.parse = function(a) { | |
4921 var b = {}, a = String(a), c = goog.color.prependPoundIfNecessary_(a); | |
4922 if(goog.color.isValidHexColor_(c)) { | |
4923 return b.hex = goog.color.normalizeHex(c), b.type = "hex", b | |
4924 }else { | |
4925 if(c = goog.color.isValidRgbColor_(a), c.length) { | |
4926 return b.hex = goog.color.rgbArrayToHex(c), b.type = "rgb", b | |
4927 }else { | |
4928 if(goog.color.names && (c = goog.color.names[a.toLowerCase()])) { | |
4929 return b.hex = c, b.type = "named", b | |
4930 } | |
4931 } | |
4932 } | |
4933 throw Error(a + " is not a valid color string"); | |
4934 }; | |
4935 goog.color.parseRgb = function(a) { | |
4936 var b = goog.color.isValidRgbColor_(a); | |
4937 if(!b.length) { | |
4938 throw Error(a + " is not a valid RGB color"); | |
4939 } | |
4940 return b | |
4941 }; | |
4942 goog.color.hexToRgbStyle = function(a) { | |
4943 return goog.color.rgbStyle_(goog.color.hexToRgb(a)) | |
4944 }; | |
4945 goog.color.hexTripletRe_ = /#(.)(.)(.)/; | |
4946 goog.color.normalizeHex = function(a) { | |
4947 if(!goog.color.isValidHexColor_(a)) { | |
4948 throw Error("'" + a + "' is not a valid hex color"); | |
4949 } | |
4950 a.length == 4 && (a = a.replace(goog.color.hexTripletRe_, "#$1$1$2$2$3$3")); | |
4951 return a.toLowerCase() | |
4952 }; | |
4953 goog.color.hexToRgb = function(a) { | |
4954 var a = goog.color.normalizeHex(a), b = parseInt(a.substr(1, 2), 16), c = pars
eInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16); | |
4955 return[b, c, a] | |
4956 }; | |
4957 goog.color.rgbToHex = function(a, b, c) { | |
4958 a = Number(a); | |
4959 b = Number(b); | |
4960 c = Number(c); | |
4961 if(isNaN(a) || a < 0 || a > 255 || isNaN(b) || b < 0 || b > 255 || isNaN(c) ||
c < 0 || c > 255) { | |
4962 throw Error('"(' + a + "," + b + "," + c + '") is not a valid RGB color'); | |
4963 } | |
4964 a = goog.color.prependZeroIfNecessary_(a.toString(16)); | |
4965 b = goog.color.prependZeroIfNecessary_(b.toString(16)); | |
4966 c = goog.color.prependZeroIfNecessary_(c.toString(16)); | |
4967 return"#" + a + b + c | |
4968 }; | |
4969 goog.color.rgbArrayToHex = function(a) { | |
4970 return goog.color.rgbToHex(a[0], a[1], a[2]) | |
4971 }; | |
4972 goog.color.rgbToHsl = function(a, b, c) { | |
4973 a /= 255; | |
4974 b /= 255; | |
4975 c /= 255; | |
4976 var d = Math.max(a, b, c), e = Math.min(a, b, c), f = 0, g = 0, h = 0.5 * (d +
e); | |
4977 d != e && (d == a ? f = 60 * (b - c) / (d - e) : d == b ? f = 60 * (c - a) / (
d - e) + 120 : d == c && (f = 60 * (a - b) / (d - e) + 240), g = 0 < h && h <= 0
.5 ? (d - e) / (2 * h) : (d - e) / (2 - 2 * h)); | |
4978 return[Math.round(f + 360) % 360, g, h] | |
4979 }; | |
4980 goog.color.rgbArrayToHsl = function(a) { | |
4981 return goog.color.rgbToHsl(a[0], a[1], a[2]) | |
4982 }; | |
4983 goog.color.hueToRgb_ = function(a, b, c) { | |
4984 c < 0 ? c += 1 : c > 1 && (c -= 1); | |
4985 if(6 * c < 1) { | |
4986 return a + (b - a) * 6 * c | |
4987 }else { | |
4988 if(2 * c < 1) { | |
4989 return b | |
4990 }else { | |
4991 if(3 * c < 2) { | |
4992 return a + (b - a) * (2 / 3 - c) * 6 | |
4993 } | |
4994 } | |
4995 } | |
4996 return a | |
4997 }; | |
4998 goog.color.hslToRgb = function(a, b, c) { | |
4999 var d = 0, e = 0, f = 0; | |
5000 a /= 360; | |
5001 if(b == 0) { | |
5002 d = e = f = c * 255 | |
5003 }else { | |
5004 var g = f = 0, g = c < 0.5 ? c * (1 + b) : c + b - b * c, f = 2 * c - g, d =
255 * goog.color.hueToRgb_(f, g, a + 1 / 3), e = 255 * goog.color.hueToRgb_(f,
g, a), f = 255 * goog.color.hueToRgb_(f, g, a - 1 / 3) | |
5005 } | |
5006 return[Math.round(d), Math.round(e), Math.round(f)] | |
5007 }; | |
5008 goog.color.hslArrayToRgb = function(a) { | |
5009 return goog.color.hslToRgb(a[0], a[1], a[2]) | |
5010 }; | |
5011 goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i; | |
5012 goog.color.isValidHexColor_ = function(a) { | |
5013 return goog.color.validHexColorRe_.test(a) | |
5014 }; | |
5015 goog.color.normalizedHexColorRe_ = /^#[0-9a-f]{6}$/; | |
5016 goog.color.isNormalizedHexColor_ = function(a) { | |
5017 return goog.color.normalizedHexColorRe_.test(a) | |
5018 }; | |
5019 goog.color.rgbColorRe_ = /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|
[1-9]\d{0,2})\)$/i; | |
5020 goog.color.isValidRgbColor_ = function(a) { | |
5021 var b = a.match(goog.color.rgbColorRe_); | |
5022 if(b) { | |
5023 var a = Number(b[1]), c = Number(b[2]), b = Number(b[3]); | |
5024 if(a >= 0 && a <= 255 && c >= 0 && c <= 255 && b >= 0 && b <= 255) { | |
5025 return[a, c, b] | |
5026 } | |
5027 } | |
5028 return[] | |
5029 }; | |
5030 goog.color.prependZeroIfNecessary_ = function(a) { | |
5031 return a.length == 1 ? "0" + a : a | |
5032 }; | |
5033 goog.color.prependPoundIfNecessary_ = function(a) { | |
5034 return a.charAt(0) == "#" ? a : "#" + a | |
5035 }; | |
5036 goog.color.rgbStyle_ = function(a) { | |
5037 return"rgb(" + a.join(",") + ")" | |
5038 }; | |
5039 goog.color.hsvToRgb = function(a, b, c) { | |
5040 var d = 0, e = 0, f = 0; | |
5041 if(b == 0) { | |
5042 f = e = d = c | |
5043 }else { | |
5044 var g = Math.floor(a / 60), h = a / 60 - g, a = c * (1 - b), i = c * (1 - b
* h), b = c * (1 - b * (1 - h)); | |
5045 switch(g) { | |
5046 case 1: | |
5047 d = i; | |
5048 e = c; | |
5049 f = a; | |
5050 break; | |
5051 case 2: | |
5052 d = a; | |
5053 e = c; | |
5054 f = b; | |
5055 break; | |
5056 case 3: | |
5057 d = a; | |
5058 e = i; | |
5059 f = c; | |
5060 break; | |
5061 case 4: | |
5062 d = b; | |
5063 e = a; | |
5064 f = c; | |
5065 break; | |
5066 case 5: | |
5067 d = c; | |
5068 e = a; | |
5069 f = i; | |
5070 break; | |
5071 case 6: | |
5072 ; | |
5073 case 0: | |
5074 d = c, e = b, f = a | |
5075 } | |
5076 } | |
5077 return[Math.floor(d), Math.floor(e), Math.floor(f)] | |
5078 }; | |
5079 goog.color.rgbToHsv = function(a, b, c) { | |
5080 var d = Math.max(Math.max(a, b), c), e = Math.min(Math.min(a, b), c); | |
5081 if(e == d) { | |
5082 e = a = 0 | |
5083 }else { | |
5084 var f = d - e, e = f / d, a = a == d ? (b - c) / f : b == d ? 2 + (c - a) /
f : 4 + (a - b) / f; | |
5085 a *= 60; | |
5086 a < 0 && (a += 360); | |
5087 a > 360 && (a -= 360) | |
5088 } | |
5089 return[a, e, d] | |
5090 }; | |
5091 goog.color.rgbArrayToHsv = function(a) { | |
5092 return goog.color.rgbToHsv(a[0], a[1], a[2]) | |
5093 }; | |
5094 goog.color.hsvArrayToRgb = function(a) { | |
5095 return goog.color.hsvToRgb(a[0], a[1], a[2]) | |
5096 }; | |
5097 goog.color.hexToHsl = function(a) { | |
5098 a = goog.color.hexToRgb(a); | |
5099 return goog.color.rgbToHsl(a[0], a[1], a[2]) | |
5100 }; | |
5101 goog.color.hslToHex = function(a, b, c) { | |
5102 return goog.color.rgbArrayToHex(goog.color.hslToRgb(a, b, c)) | |
5103 }; | |
5104 goog.color.hslArrayToHex = function(a) { | |
5105 return goog.color.rgbArrayToHex(goog.color.hslToRgb(a[0], a[1], a[2])) | |
5106 }; | |
5107 goog.color.hexToHsv = function(a) { | |
5108 return goog.color.rgbArrayToHsv(goog.color.hexToRgb(a)) | |
5109 }; | |
5110 goog.color.hsvToHex = function(a, b, c) { | |
5111 return goog.color.rgbArrayToHex(goog.color.hsvToRgb(a, b, c)) | |
5112 }; | |
5113 goog.color.hsvArrayToHex = function(a) { | |
5114 return goog.color.hsvToHex(a[0], a[1], a[2]) | |
5115 }; | |
5116 goog.color.hslDistance = function(a, b) { | |
5117 var c, d; | |
5118 c = a[2] <= 0.5 ? a[1] * a[2] : a[1] * (1 - a[2]); | |
5119 d = b[2] <= 0.5 ? b[1] * b[2] : b[1] * (1 - b[2]); | |
5120 return(a[2] - b[2]) * (a[2] - b[2]) + c * c + d * d - 2 * c * d * Math.cos((a[
0] / 360 - b[0] / 360) * 2 * Math.PI) | |
5121 }; | |
5122 goog.color.blend = function(a, b, c) { | |
5123 c = goog.math.clamp(c, 0, 1); | |
5124 return[Math.round(c * a[0] + (1 - c) * b[0]), Math.round(c * a[1] + (1 - c) *
b[1]), Math.round(c * a[2] + (1 - c) * b[2])] | |
5125 }; | |
5126 goog.color.darken = function(a, b) { | |
5127 return goog.color.blend([0, 0, 0], a, b) | |
5128 }; | |
5129 goog.color.lighten = function(a, b) { | |
5130 return goog.color.blend([255, 255, 255], a, b) | |
5131 }; | |
5132 goog.color.highContrast = function(a, b) { | |
5133 for(var c = [], d = 0;d < b.length;d++) { | |
5134 c.push({color:b[d], diff:goog.color.yiqBrightnessDiff_(b[d], a) + goog.color
.colorDiff_(b[d], a)}) | |
5135 } | |
5136 c.sort(function(a, b) { | |
5137 return b.diff - a.diff | |
5138 }); | |
5139 return c[0].color | |
5140 }; | |
5141 goog.color.yiqBrightness_ = function(a) { | |
5142 return Math.round((a[0] * 299 + a[1] * 587 + a[2] * 114) / 1E3) | |
5143 }; | |
5144 goog.color.yiqBrightnessDiff_ = function(a, b) { | |
5145 return Math.abs(goog.color.yiqBrightness_(a) - goog.color.yiqBrightness_(b)) | |
5146 }; | |
5147 goog.color.colorDiff_ = function(a, b) { | |
5148 return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]) + Math.abs(a[2] - b[2]) | |
5149 }; | |
5150 goog.fx.dom = {}; | |
5151 goog.fx.dom.PredefinedEffect = function(a, b, c, d, e) { | |
5152 goog.fx.Animation.call(this, b, c, d, e); | |
5153 this.element = a | |
5154 }; | |
5155 goog.inherits(goog.fx.dom.PredefinedEffect, goog.fx.Animation); | |
5156 goog.fx.dom.PredefinedEffect.prototype.updateStyle = goog.nullFunction; | |
5157 goog.fx.dom.PredefinedEffect.prototype.onAnimate = function() { | |
5158 this.updateStyle(); | |
5159 goog.fx.dom.PredefinedEffect.superClass_.onAnimate.call(this) | |
5160 }; | |
5161 goog.fx.dom.PredefinedEffect.prototype.onEnd = function() { | |
5162 this.updateStyle(); | |
5163 goog.fx.dom.PredefinedEffect.superClass_.onEnd.call(this) | |
5164 }; | |
5165 goog.fx.dom.PredefinedEffect.prototype.onBegin = function() { | |
5166 this.updateStyle(); | |
5167 goog.fx.dom.PredefinedEffect.superClass_.onBegin.call(this) | |
5168 }; | |
5169 goog.fx.dom.Slide = function(a, b, c, d, e) { | |
5170 if(b.length != 2 || c.length != 2) { | |
5171 throw Error("Start and end points must be 2D"); | |
5172 } | |
5173 goog.fx.dom.PredefinedEffect.apply(this, arguments) | |
5174 }; | |
5175 goog.inherits(goog.fx.dom.Slide, goog.fx.dom.PredefinedEffect); | |
5176 goog.fx.dom.Slide.prototype.updateStyle = function() { | |
5177 this.element.style.left = Math.round(this.coords[0]) + "px"; | |
5178 this.element.style.top = Math.round(this.coords[1]) + "px" | |
5179 }; | |
5180 goog.fx.dom.SlideFrom = function(a, b, c, d) { | |
5181 goog.fx.dom.Slide.call(this, a, [a.offsetLeft, a.offsetTop], b, c, d) | |
5182 }; | |
5183 goog.inherits(goog.fx.dom.SlideFrom, goog.fx.dom.Slide); | |
5184 goog.fx.dom.SlideFrom.prototype.onBegin = function() { | |
5185 this.startPoint = [this.element.offsetLeft, this.element.offsetTop]; | |
5186 goog.fx.dom.SlideFrom.superClass_.onBegin.call(this) | |
5187 }; | |
5188 goog.fx.dom.Swipe = function(a, b, c, d, e) { | |
5189 if(b.length != 2 || c.length != 2) { | |
5190 throw Error("Start and end points must be 2D"); | |
5191 } | |
5192 goog.fx.dom.PredefinedEffect.apply(this, arguments); | |
5193 this.maxWidth_ = Math.max(this.endPoint[0], this.startPoint[0]); | |
5194 this.maxHeight_ = Math.max(this.endPoint[1], this.startPoint[1]) | |
5195 }; | |
5196 goog.inherits(goog.fx.dom.Swipe, goog.fx.dom.PredefinedEffect); | |
5197 goog.fx.dom.Swipe.prototype.updateStyle = function() { | |
5198 var a = this.coords[0], b = this.coords[1]; | |
5199 this.clip_(Math.round(a), Math.round(b), this.maxWidth_, this.maxHeight_); | |
5200 this.element.style.width = Math.round(a) + "px"; | |
5201 this.element.style.marginLeft = Math.round(a) - this.maxWidth_ + "px"; | |
5202 this.element.style.marginTop = Math.round(b) - this.maxHeight_ + "px" | |
5203 }; | |
5204 goog.fx.dom.Swipe.prototype.clip_ = function(a, b, c, d) { | |
5205 this.element.style.clip = "rect(" + (d - b) + "px " + c + "px " + d + "px " +
(c - a) + "px)" | |
5206 }; | |
5207 goog.fx.dom.Scroll = function(a, b, c, d, e) { | |
5208 if(b.length != 2 || c.length != 2) { | |
5209 throw Error("Start and end points must be 2D"); | |
5210 } | |
5211 goog.fx.dom.PredefinedEffect.apply(this, arguments) | |
5212 }; | |
5213 goog.inherits(goog.fx.dom.Scroll, goog.fx.dom.PredefinedEffect); | |
5214 goog.fx.dom.Scroll.prototype.updateStyle = function() { | |
5215 this.element.scrollLeft = Math.round(this.coords[0]); | |
5216 this.element.scrollTop = Math.round(this.coords[1]) | |
5217 }; | |
5218 goog.fx.dom.Resize = function(a, b, c, d, e) { | |
5219 if(b.length != 2 || c.length != 2) { | |
5220 throw Error("Start and end points must be 2D"); | |
5221 } | |
5222 goog.fx.dom.PredefinedEffect.apply(this, arguments) | |
5223 }; | |
5224 goog.inherits(goog.fx.dom.Resize, goog.fx.dom.PredefinedEffect); | |
5225 goog.fx.dom.Resize.prototype.updateStyle = function() { | |
5226 this.element.style.width = Math.round(this.coords[0]) + "px"; | |
5227 this.element.style.height = Math.round(this.coords[1]) + "px" | |
5228 }; | |
5229 goog.fx.dom.ResizeWidth = function(a, b, c, d, e) { | |
5230 goog.fx.dom.PredefinedEffect.call(this, a, [b], [c], d, e) | |
5231 }; | |
5232 goog.inherits(goog.fx.dom.ResizeWidth, goog.fx.dom.PredefinedEffect); | |
5233 goog.fx.dom.ResizeWidth.prototype.updateStyle = function() { | |
5234 this.element.style.width = Math.round(this.coords[0]) + "px" | |
5235 }; | |
5236 goog.fx.dom.ResizeHeight = function(a, b, c, d, e) { | |
5237 goog.fx.dom.PredefinedEffect.call(this, a, [b], [c], d, e) | |
5238 }; | |
5239 goog.inherits(goog.fx.dom.ResizeHeight, goog.fx.dom.PredefinedEffect); | |
5240 goog.fx.dom.ResizeHeight.prototype.updateStyle = function() { | |
5241 this.element.style.height = Math.round(this.coords[0]) + "px" | |
5242 }; | |
5243 goog.fx.dom.Fade = function(a, b, c, d, e) { | |
5244 goog.isNumber(b) && (b = [b]); | |
5245 goog.isNumber(c) && (c = [c]); | |
5246 goog.fx.dom.PredefinedEffect.call(this, a, b, c, d, e); | |
5247 if(b.length != 1 || c.length != 1) { | |
5248 throw Error("Start and end points must be 1D"); | |
5249 } | |
5250 }; | |
5251 goog.inherits(goog.fx.dom.Fade, goog.fx.dom.PredefinedEffect); | |
5252 goog.fx.dom.Fade.prototype.updateStyle = function() { | |
5253 goog.style.setOpacity(this.element, this.coords[0]) | |
5254 }; | |
5255 goog.fx.dom.Fade.prototype.show = function() { | |
5256 this.element.style.display = "" | |
5257 }; | |
5258 goog.fx.dom.Fade.prototype.hide = function() { | |
5259 this.element.style.display = "none" | |
5260 }; | |
5261 goog.fx.dom.FadeOut = function(a, b, c) { | |
5262 goog.fx.dom.Fade.call(this, a, 1, 0, b, c) | |
5263 }; | |
5264 goog.inherits(goog.fx.dom.FadeOut, goog.fx.dom.Fade); | |
5265 goog.fx.dom.FadeIn = function(a, b, c) { | |
5266 goog.fx.dom.Fade.call(this, a, 0, 1, b, c) | |
5267 }; | |
5268 goog.inherits(goog.fx.dom.FadeIn, goog.fx.dom.Fade); | |
5269 goog.fx.dom.FadeOutAndHide = function(a, b, c) { | |
5270 goog.fx.dom.Fade.call(this, a, 1, 0, b, c) | |
5271 }; | |
5272 goog.inherits(goog.fx.dom.FadeOutAndHide, goog.fx.dom.Fade); | |
5273 goog.fx.dom.FadeOutAndHide.prototype.onBegin = function() { | |
5274 this.show(); | |
5275 goog.fx.dom.FadeOutAndHide.superClass_.onBegin.call(this) | |
5276 }; | |
5277 goog.fx.dom.FadeOutAndHide.prototype.onEnd = function() { | |
5278 this.hide(); | |
5279 goog.fx.dom.FadeOutAndHide.superClass_.onEnd.call(this) | |
5280 }; | |
5281 goog.fx.dom.FadeInAndShow = function(a, b, c) { | |
5282 goog.fx.dom.Fade.call(this, a, 0, 1, b, c) | |
5283 }; | |
5284 goog.inherits(goog.fx.dom.FadeInAndShow, goog.fx.dom.Fade); | |
5285 goog.fx.dom.FadeInAndShow.prototype.onBegin = function() { | |
5286 this.show(); | |
5287 goog.fx.dom.FadeInAndShow.superClass_.onBegin.call(this) | |
5288 }; | |
5289 goog.fx.dom.BgColorTransform = function(a, b, c, d, e) { | |
5290 if(b.length != 3 || c.length != 3) { | |
5291 throw Error("Start and end points must be 3D"); | |
5292 } | |
5293 goog.fx.dom.PredefinedEffect.apply(this, arguments) | |
5294 }; | |
5295 goog.inherits(goog.fx.dom.BgColorTransform, goog.fx.dom.PredefinedEffect); | |
5296 goog.fx.dom.BgColorTransform.prototype.setColor = function() { | |
5297 for(var a = [], b = 0;b < this.coords.length;b++) { | |
5298 a[b] = Math.round(this.coords[b]) | |
5299 } | |
5300 this.element.style.backgroundColor = "rgb(" + a.join(",") + ")" | |
5301 }; | |
5302 goog.fx.dom.BgColorTransform.prototype.updateStyle = function() { | |
5303 this.setColor() | |
5304 }; | |
5305 goog.fx.dom.bgColorFadeIn = function(a, b, c, d) { | |
5306 function e() { | |
5307 a.style.backgroundColor = f | |
5308 } | |
5309 var f = a.style.backgroundColor || "", g = goog.style.getBackgroundColor(a), g
= g && g != "transparent" && g != "rgba(0, 0, 0, 0)" ? goog.color.hexToRgb(goog
.color.parse(g).hex) : [255, 255, 255], b = new goog.fx.dom.BgColorTransform(a,
b, g, c); | |
5310 d ? d.listen(b, goog.fx.Transition.EventType.END, e) : goog.events.listen(b, g
oog.fx.Transition.EventType.END, e); | |
5311 b.play() | |
5312 }; | |
5313 goog.fx.dom.ColorTransform = function(a, b, c, d, e) { | |
5314 if(b.length != 3 || c.length != 3) { | |
5315 throw Error("Start and end points must be 3D"); | |
5316 } | |
5317 goog.fx.dom.PredefinedEffect.apply(this, arguments) | |
5318 }; | |
5319 goog.inherits(goog.fx.dom.ColorTransform, goog.fx.dom.PredefinedEffect); | |
5320 goog.fx.dom.ColorTransform.prototype.updateStyle = function() { | |
5321 for(var a = [], b = 0;b < this.coords.length;b++) { | |
5322 a[b] = Math.round(this.coords[b]) | |
5323 } | |
5324 this.element.style.color = "rgb(" + a.join(",") + ")" | |
5325 }; | |
5326 goog.ui.RangeModel = function() { | |
5327 goog.events.EventTarget.call(this) | |
5328 }; | |
5329 goog.inherits(goog.ui.RangeModel, goog.events.EventTarget); | |
5330 goog.ui.RangeModel.prototype.value_ = 0; | |
5331 goog.ui.RangeModel.prototype.minimum_ = 0; | |
5332 goog.ui.RangeModel.prototype.maximum_ = 100; | |
5333 goog.ui.RangeModel.prototype.extent_ = 0; | |
5334 goog.ui.RangeModel.prototype.step_ = 1; | |
5335 goog.ui.RangeModel.prototype.isChanging_ = !1; | |
5336 goog.ui.RangeModel.prototype.mute_ = !1; | |
5337 goog.ui.RangeModel.prototype.setMute = function(a) { | |
5338 this.mute_ = a | |
5339 }; | |
5340 goog.ui.RangeModel.prototype.setValue = function(a) { | |
5341 a = this.roundToStepWithMin(a); | |
5342 if(this.value_ != a) { | |
5343 this.value_ = a + this.extent_ > this.maximum_ ? this.maximum_ - this.extent
_ : a < this.minimum_ ? this.minimum_ : a, !this.isChanging_ && !this.mute_ && t
his.dispatchEvent(goog.ui.Component.EventType.CHANGE) | |
5344 } | |
5345 }; | |
5346 goog.ui.RangeModel.prototype.getValue = function() { | |
5347 return this.roundToStepWithMin(this.value_) | |
5348 }; | |
5349 goog.ui.RangeModel.prototype.setExtent = function(a) { | |
5350 a = this.roundToStepWithMin(a); | |
5351 if(this.extent_ != a) { | |
5352 this.extent_ = a < 0 ? 0 : this.value_ + a > this.maximum_ ? this.maximum_ -
this.value_ : a, !this.isChanging_ && !this.mute_ && this.dispatchEvent(goog.ui
.Component.EventType.CHANGE) | |
5353 } | |
5354 }; | |
5355 goog.ui.RangeModel.prototype.getExtent = function() { | |
5356 return this.roundToStep(this.extent_) | |
5357 }; | |
5358 goog.ui.RangeModel.prototype.setMinimum = function(a) { | |
5359 if(this.minimum_ != a) { | |
5360 var b = this.isChanging_; | |
5361 this.isChanging_ = !0; | |
5362 this.minimum_ = a; | |
5363 if(a + this.extent_ > this.maximum_) { | |
5364 this.extent_ = this.maximum_ - this.minimum_ | |
5365 } | |
5366 a > this.value_ && this.setValue(a); | |
5367 if(a > this.maximum_) { | |
5368 this.extent_ = 0, this.setMaximum(a), this.setValue(a) | |
5369 } | |
5370 this.isChanging_ = b; | |
5371 !this.isChanging_ && !this.mute_ && this.dispatchEvent(goog.ui.Component.Eve
ntType.CHANGE) | |
5372 } | |
5373 }; | |
5374 goog.ui.RangeModel.prototype.getMinimum = function() { | |
5375 return this.roundToStepWithMin(this.minimum_) | |
5376 }; | |
5377 goog.ui.RangeModel.prototype.setMaximum = function(a) { | |
5378 a = this.roundToStepWithMin(a); | |
5379 if(this.maximum_ != a) { | |
5380 var b = this.isChanging_; | |
5381 this.isChanging_ = !0; | |
5382 this.maximum_ = a; | |
5383 a < this.value_ + this.extent_ && this.setValue(a - this.extent_); | |
5384 if(a < this.minimum_) { | |
5385 this.extent_ = 0, this.setMinimum(a), this.setValue(this.maximum_) | |
5386 } | |
5387 if(a < this.minimum_ + this.extent_) { | |
5388 this.extent_ = this.maximum_ - this.minimum_ | |
5389 } | |
5390 this.isChanging_ = b; | |
5391 !this.isChanging_ && !this.mute_ && this.dispatchEvent(goog.ui.Component.Eve
ntType.CHANGE) | |
5392 } | |
5393 }; | |
5394 goog.ui.RangeModel.prototype.getMaximum = function() { | |
5395 return this.roundToStepWithMin(this.maximum_) | |
5396 }; | |
5397 goog.ui.RangeModel.prototype.getStep = function() { | |
5398 return this.step_ | |
5399 }; | |
5400 goog.ui.RangeModel.prototype.setStep = function(a) { | |
5401 if(this.step_ != a) { | |
5402 this.step_ = a, a = this.isChanging_, this.isChanging_ = !0, this.setMaximum
(this.getMaximum()), this.setExtent(this.getExtent()), this.setValue(this.getVal
ue()), this.isChanging_ = a, !this.isChanging_ && !this.mute_ && this.dispatchEv
ent(goog.ui.Component.EventType.CHANGE) | |
5403 } | |
5404 }; | |
5405 goog.ui.RangeModel.prototype.roundToStepWithMin = function(a) { | |
5406 return this.step_ == null ? a : this.minimum_ + Math.round((a - this.minimum_)
/ this.step_) * this.step_ | |
5407 }; | |
5408 goog.ui.RangeModel.prototype.roundToStep = function(a) { | |
5409 return this.step_ == null ? a : Math.round(a / this.step_) * this.step_ | |
5410 }; | |
5411 goog.ui.SliderBase = function(a) { | |
5412 goog.ui.Component.call(this, a); | |
5413 this.rangeModel = new goog.ui.RangeModel; | |
5414 goog.events.listen(this.rangeModel, goog.ui.Component.EventType.CHANGE, this.h
andleRangeModelChange, !1, this) | |
5415 }; | |
5416 goog.inherits(goog.ui.SliderBase, goog.ui.Component); | |
5417 goog.ui.SliderBase.Orientation = {VERTICAL:"vertical", HORIZONTAL:"horizontal"}; | |
5418 goog.ui.SliderBase.prototype.orientation_ = goog.ui.SliderBase.Orientation.HORIZ
ONTAL; | |
5419 goog.ui.SliderBase.MOUSE_DOWN_INCREMENT_INTERVAL_ = 200; | |
5420 goog.ui.SliderBase.ANIMATION_INTERVAL_ = 100; | |
5421 goog.ui.SliderBase.prototype.isAnimating_ = !1; | |
5422 goog.ui.SliderBase.prototype.moveToPointEnabled_ = !1; | |
5423 goog.ui.SliderBase.prototype.blockIncrement_ = 10; | |
5424 goog.ui.SliderBase.prototype.minExtent_ = 0; | |
5425 goog.ui.SliderBase.prototype.createDom = function() { | |
5426 goog.ui.SliderBase.superClass_.createDom.call(this); | |
5427 this.decorateInternal(this.getDomHelper().createDom("div", this.getCssClass(th
is.orientation_))) | |
5428 }; | |
5429 goog.ui.SliderBase.prototype.decorateInternal = function(a) { | |
5430 goog.ui.SliderBase.superClass_.decorateInternal.call(this, a); | |
5431 goog.dom.classes.add(a, this.getCssClass(this.orientation_)); | |
5432 this.createThumbs(); | |
5433 this.setAriaRoles() | |
5434 }; | |
5435 goog.ui.SliderBase.prototype.enterDocument = function() { | |
5436 goog.ui.SliderBase.superClass_.enterDocument.call(this); | |
5437 this.valueDragger_ = new goog.fx.Dragger(this.valueThumb); | |
5438 this.extentDragger_ = new goog.fx.Dragger(this.extentThumb); | |
5439 this.valueDragger_.defaultAction = this.extentDragger_.defaultAction = goog.nu
llFunction; | |
5440 this.keyHandler_ = new goog.events.KeyHandler(this.getElement()); | |
5441 this.mouseWheelHandler_ = new goog.events.MouseWheelHandler(this.getElement())
; | |
5442 this.getHandler().listen(this.valueDragger_, goog.fx.Dragger.EventType.BEFORED
RAG, this.handleBeforeDrag_).listen(this.extentDragger_, goog.fx.Dragger.EventTy
pe.BEFOREDRAG, this.handleBeforeDrag_).listen(this.keyHandler_, goog.events.KeyH
andler.EventType.KEY, this.handleKeyDown_).listen(this.getElement(), goog.events
.EventType.MOUSEDOWN, this.handleMouseDown_).listen(this.mouseWheelHandler_, goo
g.events.MouseWheelHandler.EventType.MOUSEWHEEL, this.handleMouseWheel_); | |
5443 this.getElement().tabIndex = 0; | |
5444 this.updateUi_() | |
5445 }; | |
5446 goog.ui.SliderBase.prototype.exitDocument = function() { | |
5447 goog.ui.SliderBase.superClass_.exitDocument.call(this); | |
5448 goog.disposeAll(this.valueDragger_, this.extentDragger_, this.keyHandler_, thi
s.mouseWheelHandler_) | |
5449 }; | |
5450 goog.ui.SliderBase.prototype.handleBeforeDrag_ = function(a) { | |
5451 var b = a.dragger == this.valueDragger_ ? this.valueThumb : this.extentThumb,
c; | |
5452 this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL ? (c = this.getEl
ement().clientHeight - b.offsetHeight, c = (c - a.top) / c * (this.getMaximum()
- this.getMinimum()) + this.getMinimum()) : (c = this.getElement().clientWidth -
b.offsetWidth, c = a.left / c * (this.getMaximum() - this.getMinimum()) + this.
getMinimum()); | |
5453 c = a.dragger == this.valueDragger_ ? Math.min(Math.max(c, this.getMinimum()),
this.getValue() + this.getExtent()) : Math.min(Math.max(c, this.getValue()), th
is.getMaximum()); | |
5454 this.setThumbPosition_(b, c) | |
5455 }; | |
5456 goog.ui.SliderBase.prototype.handleKeyDown_ = function(a) { | |
5457 var b = !0; | |
5458 switch(a.keyCode) { | |
5459 case goog.events.KeyCodes.HOME: | |
5460 this.animatedSetValue(this.getMinimum()); | |
5461 break; | |
5462 case goog.events.KeyCodes.END: | |
5463 this.animatedSetValue(this.getMaximum()); | |
5464 break; | |
5465 case goog.events.KeyCodes.PAGE_UP: | |
5466 this.moveThumbs(this.getBlockIncrement()); | |
5467 break; | |
5468 case goog.events.KeyCodes.PAGE_DOWN: | |
5469 this.moveThumbs(-this.getBlockIncrement()); | |
5470 break; | |
5471 case goog.events.KeyCodes.LEFT: | |
5472 ; | |
5473 case goog.events.KeyCodes.DOWN: | |
5474 this.moveThumbs(a.shiftKey ? -this.getBlockIncrement() : -this.getUnitIncr
ement()); | |
5475 break; | |
5476 case goog.events.KeyCodes.RIGHT: | |
5477 ; | |
5478 case goog.events.KeyCodes.UP: | |
5479 this.moveThumbs(a.shiftKey ? this.getBlockIncrement() : this.getUnitIncrem
ent()); | |
5480 break; | |
5481 default: | |
5482 b = !1 | |
5483 } | |
5484 b && a.preventDefault() | |
5485 }; | |
5486 goog.ui.SliderBase.prototype.handleMouseDown_ = function(a) { | |
5487 this.getElement().focus && this.getElement().focus(); | |
5488 var b = a.target; | |
5489 !goog.dom.contains(this.valueThumb, b) && !goog.dom.contains(this.extentThumb,
b) && (this.moveToPointEnabled_ ? this.animatedSetValue(this.getValueFromMouseP
osition_(a)) : this.startBlockIncrementing_(a)) | |
5490 }; | |
5491 goog.ui.SliderBase.prototype.handleMouseWheel_ = function(a) { | |
5492 this.moveThumbs((a.detail > 0 ? -1 : 1) * this.getUnitIncrement()); | |
5493 a.preventDefault() | |
5494 }; | |
5495 goog.ui.SliderBase.prototype.startBlockIncrementing_ = function(a) { | |
5496 this.storeMousePos_(a); | |
5497 this.thumbToMove_ = this.getClosestThumb_(this.getValueFromMousePosition_(a)); | |
5498 this.incrementing_ = this.orientation_ == goog.ui.SliderBase.Orientation.VERTI
CAL ? this.lastMousePosition_ < this.thumbToMove_.offsetTop : this.lastMousePosi
tion_ > this.thumbToMove_.offsetLeft + this.thumbToMove_.offsetWidth; | |
5499 a = goog.dom.getOwnerDocument(this.getElement()); | |
5500 this.getHandler().listen(a, goog.events.EventType.MOUSEUP, this.handleMouseUp_
, !0).listen(this.getElement(), goog.events.EventType.MOUSEMOVE, this.storeMouse
Pos_); | |
5501 if(!this.incTimer_) { | |
5502 this.incTimer_ = new goog.Timer(goog.ui.SliderBase.MOUSE_DOWN_INCREMENT_INTE
RVAL_), this.getHandler().listen(this.incTimer_, goog.Timer.TICK, this.handleTim
erTick_) | |
5503 } | |
5504 this.handleTimerTick_(); | |
5505 this.incTimer_.start() | |
5506 }; | |
5507 goog.ui.SliderBase.prototype.handleTimerTick_ = function() { | |
5508 var a; | |
5509 if(this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL) { | |
5510 var b = this.lastMousePosition_, c = this.thumbToMove_.offsetTop; | |
5511 this.incrementing_ ? b < c && (a = this.getThumbPosition_(this.thumbToMove_)
+ this.getBlockIncrement()) : b > c + this.thumbToMove_.offsetHeight && (a = th
is.getThumbPosition_(this.thumbToMove_) - this.getBlockIncrement()) | |
5512 }else { | |
5513 b = this.lastMousePosition_, c = this.thumbToMove_.offsetLeft, this.incremen
ting_ ? b > c + this.thumbToMove_.offsetWidth && (a = this.getThumbPosition_(thi
s.thumbToMove_) + this.getBlockIncrement()) : b < c && (a = this.getThumbPositio
n_(this.thumbToMove_) - this.getBlockIncrement()) | |
5514 } | |
5515 goog.isDef(a) && this.setThumbPosition_(this.thumbToMove_, a) | |
5516 }; | |
5517 goog.ui.SliderBase.prototype.handleMouseUp_ = function() { | |
5518 this.incTimer_ && this.incTimer_.stop(); | |
5519 var a = goog.dom.getOwnerDocument(this.getElement()); | |
5520 this.getHandler().unlisten(a, goog.events.EventType.MOUSEUP, this.handleMouseU
p_, !0).unlisten(this.getElement(), goog.events.EventType.MOUSEMOVE, this.storeM
ousePos_) | |
5521 }; | |
5522 goog.ui.SliderBase.prototype.getRelativeMousePos_ = function(a) { | |
5523 a = goog.style.getRelativePosition(a, this.getElement()); | |
5524 return this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL ? a.y : a.
x | |
5525 }; | |
5526 goog.ui.SliderBase.prototype.storeMousePos_ = function(a) { | |
5527 this.lastMousePosition_ = this.getRelativeMousePos_(a) | |
5528 }; | |
5529 goog.ui.SliderBase.prototype.getValueFromMousePosition_ = function(a) { | |
5530 var b = this.getMinimum(), c = this.getMaximum(); | |
5531 if(this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL) { | |
5532 var d = this.valueThumb.offsetHeight, e = this.getElement().clientHeight - d
, a = this.getRelativeMousePos_(a) - d / 2; | |
5533 return(c - b) * (e - a) / e + b | |
5534 }else { | |
5535 return d = this.valueThumb.offsetWidth, e = this.getElement().clientWidth -
d, a = this.getRelativeMousePos_(a) - d / 2, (c - b) * a / e + b | |
5536 } | |
5537 }; | |
5538 goog.ui.SliderBase.prototype.getThumbPosition_ = function(a) { | |
5539 if(a == this.valueThumb) { | |
5540 return this.rangeModel.getValue() | |
5541 }else { | |
5542 if(a == this.extentThumb) { | |
5543 return this.rangeModel.getValue() + this.rangeModel.getExtent() | |
5544 }else { | |
5545 throw Error("Illegal thumb element. Neither minThumb nor maxThumb"); | |
5546 } | |
5547 } | |
5548 }; | |
5549 goog.ui.SliderBase.prototype.moveThumbs = function(a) { | |
5550 var b = this.getThumbPosition_(this.valueThumb) + a, a = this.getThumbPosition
_(this.extentThumb) + a, b = goog.math.clamp(b, this.getMinimum(), this.getMaxim
um() - this.minExtent_), a = goog.math.clamp(a, this.getMinimum() + this.minExte
nt_, this.getMaximum()); | |
5551 this.setValueAndExtent(b, a - b) | |
5552 }; | |
5553 goog.ui.SliderBase.prototype.setThumbPosition_ = function(a, b) { | |
5554 var c = null; | |
5555 a == this.extentThumb && b <= this.rangeModel.getMaximum() && b >= this.rangeM
odel.getValue() + this.minExtent_ && (c = b - this.rangeModel.getValue()); | |
5556 var d = c || this.rangeModel.getExtent(); | |
5557 a == this.valueThumb && b >= this.getMinimum() && b <= this.rangeModel.getValu
e() + d - this.minExtent_ && (d -= b - this.rangeModel.getValue(), this.rangeMod
el.roundToStepWithMin(b) + this.rangeModel.roundToStepWithMin(d) == this.rangeMo
del.roundToStepWithMin(b + d) && (this.setValueAndExtent(b, d), c = null)); | |
5558 c != null && this.rangeModel.setExtent(c) | |
5559 }; | |
5560 goog.ui.SliderBase.prototype.setValueAndExtent = function(a, b) { | |
5561 this.getMinimum() <= a && a <= this.getMaximum() - b && this.minExtent_ <= b &
& b <= this.getMaximum() - a && !(a == this.getValue() && b == this.getExtent())
&& (this.rangeModel.setMute(!0), this.rangeModel.setExtent(0), this.rangeModel.
setValue(a), this.rangeModel.setExtent(b), this.rangeModel.setMute(!1), this.upd
ateUi_(), this.dispatchEvent(goog.ui.Component.EventType.CHANGE)) | |
5562 }; | |
5563 goog.ui.SliderBase.prototype.getMinimum = function() { | |
5564 return this.rangeModel.getMinimum() | |
5565 }; | |
5566 goog.ui.SliderBase.prototype.setMinimum = function(a) { | |
5567 this.rangeModel.setMinimum(a) | |
5568 }; | |
5569 goog.ui.SliderBase.prototype.getMaximum = function() { | |
5570 return this.rangeModel.getMaximum() | |
5571 }; | |
5572 goog.ui.SliderBase.prototype.setMaximum = function(a) { | |
5573 this.rangeModel.setMaximum(a) | |
5574 }; | |
5575 goog.ui.SliderBase.prototype.getValueThumb = function() { | |
5576 return this.valueThumb | |
5577 }; | |
5578 goog.ui.SliderBase.prototype.getExtentThumb = function() { | |
5579 return this.extentThumb | |
5580 }; | |
5581 goog.ui.SliderBase.prototype.getClosestThumb_ = function(a) { | |
5582 return a <= this.rangeModel.getValue() + this.rangeModel.getExtent() / 2 ? thi
s.valueThumb : this.extentThumb | |
5583 }; | |
5584 goog.ui.SliderBase.prototype.handleRangeModelChange = function() { | |
5585 this.updateUi_(); | |
5586 this.updateAriaStates(); | |
5587 this.dispatchEvent(goog.ui.Component.EventType.CHANGE) | |
5588 }; | |
5589 goog.ui.SliderBase.prototype.updateUi_ = function() { | |
5590 if(this.valueThumb && !this.isAnimating_) { | |
5591 var a = this.getThumbCoordinateForValue_(this.getThumbPosition_(this.valueTh
umb)), b = this.getThumbCoordinateForValue_(this.getThumbPosition_(this.extentTh
umb)); | |
5592 if(this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL) { | |
5593 if(this.valueThumb.style.top = a.y + "px", this.extentThumb.style.top = b.
y + "px", this.rangeHighlight) { | |
5594 a = this.calculateRangeHighlightPositioning_(b.y, a.y, this.valueThumb.o
ffsetHeight), this.rangeHighlight.style.top = a.offset + "px", this.rangeHighlig
ht.style.height = a.size + "px" | |
5595 } | |
5596 }else { | |
5597 if(this.valueThumb.style.left = a.x + "px", this.extentThumb.style.left =
b.x + "px", this.rangeHighlight) { | |
5598 a = this.calculateRangeHighlightPositioning_(a.x, b.x, this.valueThumb.o
ffsetWidth), this.rangeHighlight.style.left = a.offset + "px", this.rangeHighlig
ht.style.width = a.size + "px" | |
5599 } | |
5600 } | |
5601 } | |
5602 }; | |
5603 goog.ui.SliderBase.prototype.calculateRangeHighlightPositioning_ = function(a, b
, c) { | |
5604 var d = Math.ceil(c / 2); | |
5605 return{offset:a + d, size:b - a + c - 2 * d} | |
5606 }; | |
5607 goog.ui.SliderBase.prototype.getThumbCoordinateForValue_ = function(a) { | |
5608 var b = new goog.math.Coordinate; | |
5609 if(this.valueThumb) { | |
5610 var c = this.getMinimum(), d = this.getMaximum(), a = a == c && c == d ? 0 :
(a - c) / (d - c); | |
5611 this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL ? (c = this.val
ueThumb.offsetHeight, c = this.getElement().clientHeight - c, a = Math.round(a *
c), b.y = c - a) : (c = this.getElement().clientWidth - this.valueThumb.offsetW
idth, a = Math.round(a * c), b.x = a) | |
5612 } | |
5613 return b | |
5614 }; | |
5615 goog.ui.SliderBase.prototype.animatedSetValue = function(a) { | |
5616 a = Math.min(this.getMaximum(), Math.max(a, this.getMinimum())); | |
5617 this.isAnimating_ && this.currentAnimation_.stop(!0); | |
5618 var b = new goog.fx.AnimationParallelQueue, c = this.getClosestThumb_(a), d =
this.getThumbCoordinateForValue_(a); | |
5619 b.add(new goog.fx.dom.SlideFrom(c, this.orientation_ == goog.ui.SliderBase.Ori
entation.VERTICAL ? [c.offsetLeft, d.y] : [d.x, c.offsetTop], goog.ui.SliderBase
.ANIMATION_INTERVAL_)); | |
5620 this.rangeHighlight && this.addRangeHighlightAnimations_(c, d, b); | |
5621 this.currentAnimation_ = b; | |
5622 this.getHandler().listen(b, goog.fx.Transition.EventType.END, this.endAnimatio
n_); | |
5623 this.isAnimating_ = !0; | |
5624 this.setThumbPosition_(c, a); | |
5625 b.play(!1) | |
5626 }; | |
5627 goog.ui.SliderBase.prototype.addRangeHighlightAnimations_ = function(a, b, c) { | |
5628 var d = this.getThumbCoordinateForValue_(this.rangeModel.getValue()), e = this
.getThumbCoordinateForValue_(this.rangeModel.getValue() + this.rangeModel.getExt
ent()); | |
5629 a == this.valueThumb ? d = b : e = b; | |
5630 this.orientation_ == goog.ui.SliderBase.Orientation.VERTICAL ? (a = this.calcu
lateRangeHighlightPositioning_(e.y, d.y, this.valueThumb.offsetHeight), c.add(ne
w goog.fx.dom.SlideFrom(this.rangeHighlight, [this.rangeHighlight.offsetLeft, a.
offset], goog.ui.SliderBase.ANIMATION_INTERVAL_)), c.add(new goog.fx.dom.ResizeH
eight(this.rangeHighlight, this.rangeHighlight.offsetHeight, a.size, goog.ui.Sli
derBase.ANIMATION_INTERVAL_))) : (a = this.calculateRangeHighlightPositioning_(d
.x, e.x, this.valueThumb.offsetWidth), | |
5631 c.add(new goog.fx.dom.SlideFrom(this.rangeHighlight, [a.offset, this.rangeHigh
light.offsetTop], goog.ui.SliderBase.ANIMATION_INTERVAL_)), c.add(new goog.fx.do
m.ResizeWidth(this.rangeHighlight, this.rangeHighlight.offsetWidth, a.size, goog
.ui.SliderBase.ANIMATION_INTERVAL_))) | |
5632 }; | |
5633 goog.ui.SliderBase.prototype.endAnimation_ = function() { | |
5634 this.isAnimating_ = !1 | |
5635 }; | |
5636 goog.ui.SliderBase.prototype.setOrientation = function(a) { | |
5637 if(this.orientation_ != a) { | |
5638 var b = this.getCssClass(this.orientation_), c = this.getCssClass(a); | |
5639 this.orientation_ = a; | |
5640 if(this.getElement()) { | |
5641 goog.dom.classes.swap(this.getElement(), b, c); | |
5642 this.valueThumb.style.left = this.valueThumb.style.top = ""; | |
5643 this.extentThumb.style.left = this.extentThumb.style.top = ""; | |
5644 if(this.rangeHighlight) { | |
5645 this.rangeHighlight.style.left = this.rangeHighlight.style.top = "", thi
s.rangeHighlight.style.width = this.rangeHighlight.style.height = "" | |
5646 } | |
5647 this.updateUi_() | |
5648 } | |
5649 } | |
5650 }; | |
5651 goog.ui.SliderBase.prototype.getOrientation = function() { | |
5652 return this.orientation_ | |
5653 }; | |
5654 goog.ui.SliderBase.prototype.disposeInternal = function() { | |
5655 goog.ui.SliderBase.superClass_.disposeInternal.call(this); | |
5656 this.incTimer_ && this.incTimer_.dispose(); | |
5657 delete this.incTimer_; | |
5658 this.currentAnimation_ && this.currentAnimation_.dispose(); | |
5659 delete this.currentAnimation_; | |
5660 delete this.valueThumb; | |
5661 delete this.extentThumb; | |
5662 this.rangeHighlight && delete this.rangeHighlight; | |
5663 this.rangeModel.dispose(); | |
5664 delete this.rangeModel; | |
5665 this.keyHandler_ && (this.keyHandler_.dispose(), delete this.keyHandler_); | |
5666 this.mouseWheelHandler_ && (this.mouseWheelHandler_.dispose(), delete this.mou
seWheelHandler_); | |
5667 this.valueDragger_ && (this.valueDragger_.dispose(), delete this.valueDragger_
); | |
5668 this.extentDragger_ && (this.extentDragger_.dispose(), delete this.extentDragg
er_) | |
5669 }; | |
5670 goog.ui.SliderBase.prototype.getBlockIncrement = function() { | |
5671 return this.blockIncrement_ | |
5672 }; | |
5673 goog.ui.SliderBase.prototype.setBlockIncrement = function(a) { | |
5674 this.blockIncrement_ = a | |
5675 }; | |
5676 goog.ui.SliderBase.prototype.setMinExtent = function(a) { | |
5677 this.minExtent_ = a | |
5678 }; | |
5679 goog.ui.SliderBase.prototype.unitIncrement_ = 1; | |
5680 goog.ui.SliderBase.prototype.getUnitIncrement = function() { | |
5681 return this.unitIncrement_ | |
5682 }; | |
5683 goog.ui.SliderBase.prototype.setUnitIncrement = function(a) { | |
5684 this.unitIncrement_ = a | |
5685 }; | |
5686 goog.ui.SliderBase.prototype.getStep = function() { | |
5687 return this.rangeModel.getStep() | |
5688 }; | |
5689 goog.ui.SliderBase.prototype.setStep = function(a) { | |
5690 this.rangeModel.setStep(a) | |
5691 }; | |
5692 goog.ui.SliderBase.prototype.getMoveToPointEnabled = function() { | |
5693 return this.moveToPointEnabled_ | |
5694 }; | |
5695 goog.ui.SliderBase.prototype.setMoveToPointEnabled = function(a) { | |
5696 this.moveToPointEnabled_ = a | |
5697 }; | |
5698 goog.ui.SliderBase.prototype.getValue = function() { | |
5699 return this.rangeModel.getValue() | |
5700 }; | |
5701 goog.ui.SliderBase.prototype.setValue = function(a) { | |
5702 this.setThumbPosition_(this.valueThumb, a) | |
5703 }; | |
5704 goog.ui.SliderBase.prototype.getExtent = function() { | |
5705 return this.rangeModel.getExtent() | |
5706 }; | |
5707 goog.ui.SliderBase.prototype.setExtent = function(a) { | |
5708 this.setThumbPosition_(this.extentThumb, this.rangeModel.getValue() + a) | |
5709 }; | |
5710 goog.ui.SliderBase.prototype.setVisible = function(a) { | |
5711 goog.style.showElement(this.getElement(), a); | |
5712 a && this.updateUi_() | |
5713 }; | |
5714 goog.ui.SliderBase.prototype.setAriaRoles = function() { | |
5715 goog.dom.a11y.setRole(this.getElement(), goog.dom.a11y.Role.SLIDER); | |
5716 this.updateAriaStates() | |
5717 }; | |
5718 goog.ui.SliderBase.prototype.updateAriaStates = function() { | |
5719 var a = this.getElement(); | |
5720 a && (goog.dom.a11y.setState(a, goog.dom.a11y.State.VALUEMIN, this.getMinimum(
)), goog.dom.a11y.setState(a, goog.dom.a11y.State.VALUEMAX, this.getMaximum()),
goog.dom.a11y.setState(a, goog.dom.a11y.State.VALUENOW, this.getValue())) | |
5721 }; | |
5722 goog.ui.Slider = function(a) { | |
5723 goog.ui.SliderBase.call(this, a); | |
5724 this.rangeModel.setExtent(0) | |
5725 }; | |
5726 goog.inherits(goog.ui.Slider, goog.ui.SliderBase); | |
5727 goog.ui.Slider.Orientation = goog.ui.SliderBase.Orientation; | |
5728 goog.ui.Slider.CSS_CLASS_PREFIX = "goog-slider"; | |
5729 goog.ui.Slider.THUMB_CSS_CLASS = goog.ui.Slider.CSS_CLASS_PREFIX + "-thumb"; | |
5730 goog.ui.Slider.prototype.getCssClass = function(a) { | |
5731 return a == goog.ui.SliderBase.Orientation.VERTICAL ? goog.ui.Slider.CSS_CLASS
_PREFIX + "-vertical" : goog.ui.Slider.CSS_CLASS_PREFIX + "-horizontal" | |
5732 }; | |
5733 goog.ui.Slider.prototype.createThumbs = function() { | |
5734 var a = this.getElement(), b = goog.dom.getElementsByTagNameAndClass(null, goo
g.ui.Slider.THUMB_CSS_CLASS, a)[0]; | |
5735 b || (b = this.createThumb_(), a.appendChild(b)); | |
5736 this.valueThumb = this.extentThumb = b | |
5737 }; | |
5738 goog.ui.Slider.prototype.createThumb_ = function() { | |
5739 var a = this.getDomHelper().createDom("div", goog.ui.Slider.THUMB_CSS_CLASS); | |
5740 goog.dom.a11y.setRole(a, goog.dom.a11y.Role.BUTTON); | |
5741 return a | |
5742 }; | |
5743 goog.math.Vec2 = function(a, b) { | |
5744 this.x = a; | |
5745 this.y = b | |
5746 }; | |
5747 goog.inherits(goog.math.Vec2, goog.math.Coordinate); | |
5748 goog.math.Vec2.randomUnit = function() { | |
5749 var a = Math.random() * Math.PI * 2; | |
5750 return new goog.math.Vec2(Math.cos(a), Math.sin(a)) | |
5751 }; | |
5752 goog.math.Vec2.random = function() { | |
5753 var a = Math.sqrt(Math.random()), b = Math.random() * Math.PI * 2; | |
5754 return new goog.math.Vec2(Math.cos(b) * a, Math.sin(b) * a) | |
5755 }; | |
5756 goog.math.Vec2.fromCoordinate = function(a) { | |
5757 return new goog.math.Vec2(a.x, a.y) | |
5758 }; | |
5759 goog.math.Vec2.prototype.clone = function() { | |
5760 return new goog.math.Vec2(this.x, this.y) | |
5761 }; | |
5762 goog.math.Vec2.prototype.magnitude = function() { | |
5763 return Math.sqrt(this.x * this.x + this.y * this.y) | |
5764 }; | |
5765 goog.math.Vec2.prototype.squaredMagnitude = function() { | |
5766 return this.x * this.x + this.y * this.y | |
5767 }; | |
5768 goog.math.Vec2.prototype.scale = function(a) { | |
5769 this.x *= a; | |
5770 this.y *= a; | |
5771 return this | |
5772 }; | |
5773 goog.math.Vec2.prototype.invert = function() { | |
5774 this.x = -this.x; | |
5775 this.y = -this.y; | |
5776 return this | |
5777 }; | |
5778 goog.math.Vec2.prototype.normalize = function() { | |
5779 return this.scale(1 / this.magnitude()) | |
5780 }; | |
5781 goog.math.Vec2.prototype.add = function(a) { | |
5782 this.x += a.x; | |
5783 this.y += a.y; | |
5784 return this | |
5785 }; | |
5786 goog.math.Vec2.prototype.subtract = function(a) { | |
5787 this.x -= a.x; | |
5788 this.y -= a.y; | |
5789 return this | |
5790 }; | |
5791 goog.math.Vec2.prototype.equals = function(a) { | |
5792 return this == a || !!a && this.x == a.x && this.y == a.y | |
5793 }; | |
5794 goog.math.Vec2.distance = goog.math.Coordinate.distance; | |
5795 goog.math.Vec2.squaredDistance = goog.math.Coordinate.squaredDistance; | |
5796 goog.math.Vec2.equals = goog.math.Coordinate.equals; | |
5797 goog.math.Vec2.sum = function(a, b) { | |
5798 return new goog.math.Vec2(a.x + b.x, a.y + b.y) | |
5799 }; | |
5800 goog.math.Vec2.difference = function(a, b) { | |
5801 return new goog.math.Vec2(a.x - b.x, a.y - b.y) | |
5802 }; | |
5803 goog.math.Vec2.dot = function(a, b) { | |
5804 return a.x * b.x + a.y * b.y | |
5805 }; | |
5806 goog.math.Vec2.lerp = function(a, b, c) { | |
5807 return new goog.math.Vec2(goog.math.lerp(a.x, b.x, c), goog.math.lerp(a.y, b.y
, c)) | |
5808 }; | |
OLD | NEW |