As-is import of NaCl Mozc for Chromium OS
This is just an as-is import of NaCl Mozc from the internal repository. Compilation is not verified. Nothing is tested actually.
BUG=none
TEST=none
git-svn-id: https://mozc.googlecode.com/svn/trunk@498 a6090854-d499-a067-5803-1114d4e51264
Yohei Yukawa
9 years ago
0 | // Copyright 2010-2015, Google Inc. | |
1 | // All rights reserved. | |
2 | // | |
3 | // Redistribution and use in source and binary forms, with or without | |
4 | // modification, are permitted provided that the following conditions are | |
5 | // met: | |
6 | // | |
7 | // * Redistributions of source code must retain the above copyright | |
8 | // notice, this list of conditions and the following disclaimer. | |
9 | // * Redistributions in binary form must reproduce the above | |
10 | // copyright notice, this list of conditions and the following disclaimer | |
11 | // in the documentation and/or other materials provided with the | |
12 | // distribution. | |
13 | // * Neither the name of Google Inc. nor the names of its | |
14 | // contributors may be used to endorse or promote products derived from | |
15 | // this software without specific prior written permission. | |
16 | // | |
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | (function() { function b(c,a){return c.type=a}var d="push",e="ArrowDown",f="ArrowLeft",h="ArrowRight",k="ArrowUp",l="ShiftLeft",m="ShiftRight",n="inputview-arrow-key ",p="inputview-down-key",q="inputview-left-key",r="inputview-right-key",s="inputview-shift-icon",t="inputview-up-key";function u(c,a,g,H){v.splice.apply(c,w(arguments,1))}function w(c,a,g){return 2>=arguments.length?v.slice.call(c,a):v.slice.call(c,a,g)} | |
30 | function x(c){var a={toState:1,iconCssClass:s,type:5};a.id=c?l:m;a.supportSticky=void 0;return y(a)}function z(c){var a={iconCssClass:n};0==c?(a.id=k,a.iconCssClass+=t,b(a,15)):1==c?(a.id=e,a.iconCssClass+=p,b(a,16)):2==c?(a.id=f,a.iconCssClass+=q,b(a,17)):3==c&&(a.id=h,a.iconCssClass+=r,b(a,18));return y(a)}function y(c){var a={},g;for(g in c)a[g]=c[g];return{spec:a}};var v=Array.prototype;for(var A=[["`","~"],["1","!"],["2",'"'],["3","#"],["4","$"],["5","%"],["6","&"],["7","'"],["8","("],["9",")"],["0","~"],["-","="],["^","~"],["q","Q"],["w","W"],["e","E"],["r","R"],["t","T"],["y","Y"],["u","U"],["i","I"],["o","O"],["p","P"],["@","`"],["[","{"],["]","}"],["a","A"],["s","S"],["d","D"],["f","F"],["g","G"],["h","H"],["j","J"],["k","K"],["l","L"],[";","+"],[":","*"],["z","Z"],["x","X"],["c","C"],["v","V"],["b","B"],["n","N"],["m","M"],[",","<"],[".",">"],["/","?"],[" "," "]],B=[],C={}, | |
31 | D="Backquote Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Digit0 Minus Equal KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash".split(" "),E=0;E<A.length-1;E++){var F=y({id:D[E],type:6,characters:A[E]});B[d](F)}var G=y({name:" ",type:11,id:"Space"});u(B,13,0,y({iconCssClass:"inputview-backspace-icon",type:13,id:"Backspace"})); | |
32 | u(B,14,0,y({iconCssClass:"inputview-tab-icon",type:14,id:"Tab"}));u(B,28,0,y({toState:4,name:"caps",type:5,id:"OsLeft"}));u(B,40,0,y({iconCssClass:"inputview-enter-icon",type:12,id:"Enter"}));u(B,41,0,x(!0));B[d](x(!1));B[d](y({toState:8,name:"ctrl",type:5,id:"ControlLeft"}));B[d](y({toState:16,name:"alt",type:5,id:"AltLeft"}));B[d](y({id:"toCompact",name:"",toKeyset:"us.compact",iconCssClass:"inputview-compact-switcher",type:21,record:!0}));B[d](G);B[d](y({toState:2,name:"altgr",type:5,id:"AltRight"})); | |
33 | B[d](z(2));B[d](z(3));B[d](y({iconCssClass:"inputview-hide-keyboard-icon",type:19,id:"HideKeyboard"}));for(E=0;E<B.length;E++)F=B[E],C[F.spec.id]="101kbd-k-"+E;google.ime.chrome.inputview.onConfigLoaded({keyList:B,mapping:C,layout:"101kbd",hasAltGrKey:!1,id:"jp"}); })() |
0 | // Copyright 2010-2015, Google Inc. | |
1 | // All rights reserved. | |
2 | // | |
3 | // Redistribution and use in source and binary forms, with or without | |
4 | // modification, are permitted provided that the following conditions are | |
5 | // met: | |
6 | // | |
7 | // * Redistributions of source code must retain the above copyright | |
8 | // notice, this list of conditions and the following disclaimer. | |
9 | // * Redistributions in binary form must reproduce the above | |
10 | // copyright notice, this list of conditions and the following disclaimer | |
11 | // in the documentation and/or other materials provided with the | |
12 | // distribution. | |
13 | // * Neither the name of Google Inc. nor the names of its | |
14 | // contributors may be used to endorse or promote products derived from | |
15 | // this software without specific prior written permission. | |
16 | // | |
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | (function() { function f(d,a){return d.type=a} | |
30 | var g="push",h="chrome",k="inputview",l="length",n="onConfigLoaded",p=" ",q="?123",r="ArrowDown",t="ArrowLeft",u="ArrowRight",w="ArrowUp",x="Backspace",y="Enter",z="HideKeyboard",A="ShiftLeft",B="ShiftRight",C="Space",D="abc",aa="compactkbd",ba="compactkbd-k-",E="compactkbd-k-key-",ca="inputview-arrow-key ",da="inputview-backspace-icon",ea="inputview-down-key",fa="inputview-enter-icon",ga="inputview-hide-keyboard-icon",ha="inputview-left-key",ia="inputview-right-key",ja="inputview-shift-icon",ka= | |
31 | "inputview-up-key",F="us.compact",G="us.compact.123",H="us.compact.more",I="~[<";function J(d,a,b,v){K.splice.apply(d,la(arguments,1))}function la(d,a,b){return 2>=arguments[l]?K.slice.call(d,a):K.slice.call(d,a,b)}function L(){return M({iconCssClass:ga,type:19,id:z})}function N(d,a){var b={toState:1,iconCssClass:ja,type:5};b.id=d?A:B;b.supportSticky=a;return M(b)}function P(){return M({iconCssClass:fa,type:12,id:y})}function Q(){return M({iconCssClass:da,type:13,id:x})} | |
32 | function R(){return M({name:p,type:11,id:C})}function S(d){var a={iconCssClass:ca};0==d?(a.id=w,a.iconCssClass+=ka,f(a,15)):1==d?(a.id=r,a.iconCssClass+=ea,f(a,16)):2==d?(a.id=t,a.iconCssClass+=ha,f(a,17)):3==d&&(a.id=u,a.iconCssClass+=ia,f(a,18));return M(a)}function M(d){var a={},b;for(b in d)a[b]=d[b];return{spec:a}} | |
33 | function T(d,a){for(var b=[],v={},e=0;e<d[l]-1;e++){var c;c=d[e][0];var m=2==d[e][l]?d[e][1]:void 0,O=10==e?.33:0,ma=3==d[e][l]?!!d[e][2]:!1,s={};s.id=E+e;f(s,22);s.text=c;m&&(s.hintText=m);O&&(s.marginLeftPercent=O);s.isGrey=!!ma;c=M(s);b[g](c)}e=R();c=b[l];J(b,10,0,Q());J(b,20,0,P());switch(a){case 0:J(b,21,0,N(!0,!0));J(b,31,0,N(!1,!0));c=U(E+c++,q,G);J(b,32,0,c);break;case 1:m=U(E+c++,I,H);J(b,21,0,m);m=U(E+c++,I,H);J(b,31,0,m);c=U(E+c++,D,F);J(b,32,0,c);break;case 2:m=U(E+c++,q,G),J(b,21,0,m), | |
34 | m=U(E+c++,q,G),J(b,31,0,m),c=U(E+c++,D,F),J(b,32,0,c)}J(b,35,0,e);b[g](L());for(e=0;e<b[l];e++)c=b[e],v[c.spec.id]=ba+e;return{keyList:b,mapping:v,layout:aa}}function U(d,a,b,v,e){var c={};c.id=d;c.name=a;c.toKeyset=b;c.iconCssClass=v;f(c,21);c.record=!!e;return M(c)};var K=Array.prototype;for(var V,W=[["`","~"],["1","!"],["2","@"],["3","#"],["4","$"],["5","%"],["6","^"],["7","&"],["8","*"],["9","("],["0",")"],["-","_"],["=","+"],["q","Q"],["w","W"],["e","E"],["r","R"],["t","T"],["y","Y"],["u","U"],["i","I"],["o","O"],["p","P"],["[","{"],["]","}"],["\\","|"],["a","A"],["s","S"],["d","D"],["f","F"],["g","G"],["h","H"],["j","J"],["k","K"],["l","L"],[";",":"],["'",'"'],["z","Z"],["x","X"],["c","C"],["v","V"],["b","B"],["n","N"],["m","M"],[",","<"],[".",">"],["/","?"],[p,p]],X=[],Y={}, | |
35 | na="Backquote Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Digit0 Minus Equal KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash".split(" "),Z=0;Z<W[l]-1;Z++){var $=M({id:na[Z],type:6,characters:W[Z]});X[g]($)}var oa=R();J(X,13,0,Q());J(X,14,0,M({iconCssClass:"inputview-tab-icon",type:14,id:"Tab"})); | |
36 | J(X,28,0,M({toState:4,name:"caps",type:5,id:"OsLeft"}));J(X,40,0,P());J(X,41,0,N(!0));X[g](N(!1));X[g](M({toState:8,name:"ctrl",type:5,id:"ControlLeft"}));X[g](M({toState:16,name:"alt",type:5,id:"AltLeft"}));X[g](U("toCompact","",F,"inputview-compact-switcher",!0));X[g](oa);X[g](M({toState:2,name:"altgr",type:5,id:"AltRight"}));X[g](S(2));X[g](S(3));X[g](L());for(Z=0;Z<X[l];Z++)$=X[Z],Y[$.spec.id]="101kbd-k-"+Z;V={keyList:X,mapping:Y,layout:"101kbd",hasAltGrKey:!1,id:"us"};google.ime[h][k][n](V); | |
37 | V=T([["q","1"],["w","2"],["e","3"],["r","4"],["t","5"],["y","6"],["u","7"],["i","8"],["o","9"],["p","0"],["a"],["s"],["d"],["f"],["g"],["h"],["j"],["k"],["l"],["z"],["x"],["c"],["v"],["b"],["n"],["m"],["!"],["?"],["/"],["-"],[","],["."],[p]],0);V.id=F;google.ime[h][k][n](V);V=T([["1"],["2"],["3"],["4"],["5"],["6"],["7"],["8"],["9"],["0"],["@"],["#"],["$"],["%"],["&"],["-"],["+"],["("],[")"],["\\"],["="],["*"],['"'],["'"],[":"],[";"],["!"],["?"],["/"],["_"],[","],["."],[p]],1);V.id=G;google.ime[h][k][n](V); | |
38 | V=T([["~"],["`"],["|"],["\u2022"],["\u23b7"],["\u03a0"],["\u00f7"],["\u00d7"],["\u00b6"],["\u0394"],["\u00a3"],["\u00a2"],["\u20ac"],["\u00a5"],["^"],["\u00b0"],["="],["{"],["}"],["\\"],["\u00a9"],["\u00ae"],["\u2122"],["\u2105"],["["],["]"],["\u00a1"],["\u00bf"],["<"],[">"],[","],["."],[p]],2);V.id=H;google.ime[h][k][n](V); })() |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | <html> | |
1 | <head><title>The test page for input view keyboard</title></head> | |
2 | <link rel="stylesheet" href="inputview_css.css"> | |
3 | <script src="inputview.js"></script> | |
4 | <body> | |
5 | </body> | |
6 | </html> |
0 | // Copyright 2010-2015, Google Inc. | |
1 | // All rights reserved. | |
2 | // | |
3 | // Redistribution and use in source and binary forms, with or without | |
4 | // modification, are permitted provided that the following conditions are | |
5 | // met: | |
6 | // | |
7 | // * Redistributions of source code must retain the above copyright | |
8 | // notice, this list of conditions and the following disclaimer. | |
9 | // * Redistributions in binary form must reproduce the above | |
10 | // copyright notice, this list of conditions and the following disclaimer | |
11 | // in the documentation and/or other materials provided with the | |
12 | // distribution. | |
13 | // * Neither the name of Google Inc. nor the names of its | |
14 | // contributors may be used to endorse or promote products derived from | |
15 | // this software without specific prior written permission. | |
16 | // | |
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | var goog = goog || {}; | |
30 | goog.global = this; | |
31 | goog.isDef = function $goog$isDef$(val) { | |
32 | return void 0 !== val; | |
33 | }; | |
34 | goog.exportPath_ = function $goog$exportPath_$(name, opt_object, opt_objectToExportTo) { | |
35 | var parts = name.split("."), cur = opt_objectToExportTo || goog.global; | |
36 | parts[0] in cur || !cur.execScript || cur.execScript("var " + parts[0]); | |
37 | for (var part;parts.length && (part = parts.shift());) { | |
38 | !parts.length && goog.isDef(opt_object) ? cur[part] = opt_object : cur = cur[part] ? cur[part] : cur[part] = {}; | |
39 | } | |
40 | }; | |
41 | goog.define = function $goog$define$(name, defaultValue) { | |
42 | var value = defaultValue; | |
43 | goog.exportPath_(name, value); | |
44 | }; | |
45 | goog.DEBUG = !0; | |
46 | goog.LOCALE = "en"; | |
47 | goog.TRUSTED_SITE = !0; | |
48 | goog.STRICT_MODE_COMPATIBLE = !1; | |
49 | goog.provide = function $goog$provide$(name) { | |
50 | goog.exportPath_(name); | |
51 | }; | |
52 | goog.setTestOnly = function $goog$setTestOnly$(opt_message) { | |
53 | if (!goog.DEBUG) { | |
54 | throw opt_message = opt_message || "", Error("Importing test-only code into non-debug environment" + opt_message ? ": " + opt_message : "."); | |
55 | } | |
56 | }; | |
57 | goog.forwardDeclare = function $goog$forwardDeclare$() { | |
58 | }; | |
59 | goog.getObjectByName = function $goog$getObjectByName$(name, opt_obj) { | |
60 | for (var parts = name.split("."), cur = opt_obj || goog.global, part;part = parts.shift();) { | |
61 | if (goog.isDefAndNotNull(cur[part])) { | |
62 | cur = cur[part]; | |
63 | } else { | |
64 | return null; | |
65 | } | |
66 | } | |
67 | return cur; | |
68 | }; | |
69 | goog.globalize = function $goog$globalize$(obj, opt_global) { | |
70 | var global = opt_global || goog.global, x; | |
71 | for (x in obj) { | |
72 | global[x] = obj[x]; | |
73 | } | |
74 | }; | |
75 | goog.addDependency = function $goog$addDependency$(relPath, provides, requires) { | |
76 | if (goog.DEPENDENCIES_ENABLED) { | |
77 | for (var provide, require, path = relPath.replace(/\\/g, "/"), deps = goog.dependencies_, i = 0;provide = provides[i];i++) { | |
78 | deps.nameToPath[provide] = path, path in deps.pathToNames || (deps.pathToNames[path] = {}), deps.pathToNames[path][provide] = !0; | |
79 | } | |
80 | for (var j = 0;require = requires[j];j++) { | |
81 | path in deps.requires || (deps.requires[path] = {}), deps.requires[path][require] = !0; | |
82 | } | |
83 | } | |
84 | }; | |
85 | goog.useStrictRequires = !1; | |
86 | goog.ENABLE_DEBUG_LOADER = !0; | |
87 | goog.require = function $goog$require$() { | |
88 | }; | |
89 | goog.basePath = ""; | |
90 | goog.nullFunction = function $goog$nullFunction$() { | |
91 | }; | |
92 | goog.identityFunction = function $goog$identityFunction$(opt_returnValue) { | |
93 | return opt_returnValue; | |
94 | }; | |
95 | goog.abstractMethod = function $goog$abstractMethod$() { | |
96 | throw Error("unimplemented abstract method"); | |
97 | }; | |
98 | goog.addSingletonGetter = function $goog$addSingletonGetter$(ctor) { | |
99 | ctor.getInstance = function $ctor$getInstance$() { | |
100 | if (ctor.instance_) { | |
101 | return ctor.instance_; | |
102 | } | |
103 | goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor); | |
104 | return ctor.instance_ = new ctor; | |
105 | }; | |
106 | }; | |
107 | goog.instantiatedSingletons_ = []; | |
108 | goog.DEPENDENCIES_ENABLED = !1; | |
109 | goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function $goog$inHtmlDocument_$() { | |
110 | var doc = goog.global.document; | |
111 | return "undefined" != typeof doc && "write" in doc; | |
112 | }, goog.findBasePath_ = function $goog$findBasePath_$() { | |
113 | if (goog.global.CLOSURE_BASE_PATH) { | |
114 | goog.basePath = goog.global.CLOSURE_BASE_PATH; | |
115 | } else { | |
116 | if (goog.inHtmlDocument_()) { | |
117 | for (var doc = goog.global.document, scripts = doc.getElementsByTagName("script"), i = scripts.length - 1;0 <= i;--i) { | |
118 | var src = scripts[i].src, qmark = src.lastIndexOf("?"), l = -1 == qmark ? src.length : qmark; | |
119 | if ("base.js" == src.substr(l - 7, 7)) { | |
120 | goog.basePath = src.substr(0, l - 7); | |
121 | break; | |
122 | } | |
123 | } | |
124 | } | |
125 | } | |
126 | }, goog.importScript_ = function $goog$importScript_$(src) { | |
127 | var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | |
128 | !goog.dependencies_.written[src] && importScript(src) && (goog.dependencies_.written[src] = !0); | |
129 | }, goog.writeScriptTag_ = function $goog$writeScriptTag_$(src) { | |
130 | if (goog.inHtmlDocument_()) { | |
131 | var doc = goog.global.document; | |
132 | if ("complete" == doc.readyState) { | |
133 | var isDeps = /\bdeps.js$/.test(src); | |
134 | if (isDeps) { | |
135 | return!1; | |
136 | } | |
137 | throw Error('Cannot write "' + src + '" after document load'); | |
138 | } | |
139 | doc.write('<script type="text/javascript" src="' + src + '">\x3c/script>'); | |
140 | return!0; | |
141 | } | |
142 | return!1; | |
143 | }, goog.writeScripts_ = function $goog$writeScripts_$() { | |
144 | function visitNode(path) { | |
145 | if (!(path in deps.written)) { | |
146 | if (!(path in deps.visited) && (deps.visited[path] = !0, path in deps.requires)) { | |
147 | for (var requireName in deps.requires[path]) { | |
148 | if (!goog.isProvided_(requireName)) { | |
149 | if (requireName in deps.nameToPath) { | |
150 | visitNode(deps.nameToPath[requireName]); | |
151 | } else { | |
152 | throw Error("Undefined nameToPath for " + requireName); | |
153 | } | |
154 | } | |
155 | } | |
156 | } | |
157 | path in seenScript || (seenScript[path] = !0, scripts.push(path)); | |
158 | } | |
159 | } | |
160 | var scripts = [], seenScript = {}, deps = goog.dependencies_, path$$0; | |
161 | for (path$$0 in goog.included_) { | |
162 | deps.written[path$$0] || visitNode(path$$0); | |
163 | } | |
164 | for (var i = 0;i < scripts.length;i++) { | |
165 | if (scripts[i]) { | |
166 | goog.importScript_(goog.basePath + scripts[i]); | |
167 | } else { | |
168 | throw Error("Undefined script input"); | |
169 | } | |
170 | } | |
171 | }, goog.getPathFromDeps_ = function $goog$getPathFromDeps_$(rule) { | |
172 | return rule in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[rule] : null; | |
173 | }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js")); | |
174 | goog.typeOf = function $goog$typeOf$(value) { | |
175 | var s = typeof value; | |
176 | if ("object" == s) { | |
177 | if (value) { | |
178 | if (value instanceof Array) { | |
179 | return "array"; | |
180 | } | |
181 | if (value instanceof Object) { | |
182 | return s; | |
183 | } | |
184 | var className = Object.prototype.toString.call(value); | |
185 | if ("[object Window]" == className) { | |
186 | return "object"; | |
187 | } | |
188 | if ("[object Array]" == className || "number" == typeof value.length && "undefined" != typeof value.splice && "undefined" != typeof value.propertyIsEnumerable && !value.propertyIsEnumerable("splice")) { | |
189 | return "array"; | |
190 | } | |
191 | if ("[object Function]" == className || "undefined" != typeof value.call && "undefined" != typeof value.propertyIsEnumerable && !value.propertyIsEnumerable("call")) { | |
192 | return "function"; | |
193 | } | |
194 | } else { | |
195 | return "null"; | |
196 | } | |
197 | } else { | |
198 | if ("function" == s && "undefined" == typeof value.call) { | |
199 | return "object"; | |
200 | } | |
201 | } | |
202 | return s; | |
203 | }; | |
204 | goog.isNull = function $goog$isNull$(val) { | |
205 | return null === val; | |
206 | }; | |
207 | goog.isDefAndNotNull = function $goog$isDefAndNotNull$(val) { | |
208 | return null != val; | |
209 | }; | |
210 | goog.isArray = function $goog$isArray$(val) { | |
211 | return "array" == goog.typeOf(val); | |
212 | }; | |
213 | goog.isArrayLike = function $goog$isArrayLike$(val) { | |
214 | var type = goog.typeOf(val); | |
215 | return "array" == type || "object" == type && "number" == typeof val.length; | |
216 | }; | |
217 | goog.isDateLike = function $goog$isDateLike$(val) { | |
218 | return goog.isObject(val) && "function" == typeof val.getFullYear; | |
219 | }; | |
220 | goog.isString = function $goog$isString$(val) { | |
221 | return "string" == typeof val; | |
222 | }; | |
223 | goog.isBoolean = function $goog$isBoolean$(val) { | |
224 | return "boolean" == typeof val; | |
225 | }; | |
226 | goog.isNumber = function $goog$isNumber$(val) { | |
227 | return "number" == typeof val; | |
228 | }; | |
229 | goog.isFunction = function $goog$isFunction$(val) { | |
230 | return "function" == goog.typeOf(val); | |
231 | }; | |
232 | goog.isObject = function $goog$isObject$(val) { | |
233 | var type = typeof val; | |
234 | return "object" == type && null != val || "function" == type; | |
235 | }; | |
236 | goog.getUid = function $goog$getUid$(obj) { | |
237 | return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_); | |
238 | }; | |
239 | goog.hasUid = function $goog$hasUid$(obj) { | |
240 | return!!obj[goog.UID_PROPERTY_]; | |
241 | }; | |
242 | goog.removeUid = function $goog$removeUid$(obj) { | |
243 | "removeAttribute" in obj && obj.removeAttribute(goog.UID_PROPERTY_); | |
244 | try { | |
245 | delete obj[goog.UID_PROPERTY_]; | |
246 | } catch (ex) { | |
247 | } | |
248 | }; | |
249 | goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); | |
250 | goog.uidCounter_ = 0; | |
251 | goog.getHashCode = goog.getUid; | |
252 | goog.removeHashCode = goog.removeUid; | |
253 | goog.cloneObject = function $goog$cloneObject$(obj) { | |
254 | var type = goog.typeOf(obj); | |
255 | if ("object" == type || "array" == type) { | |
256 | if (obj.clone) { | |
257 | return obj.clone(); | |
258 | } | |
259 | var clone = "array" == type ? [] : {}, key; | |
260 | for (key in obj) { | |
261 | clone[key] = goog.cloneObject(obj[key]); | |
262 | } | |
263 | return clone; | |
264 | } | |
265 | return obj; | |
266 | }; | |
267 | goog.bindNative_ = function $goog$bindNative_$(fn, selfObj, var_args) { | |
268 | return fn.call.apply(fn.bind, arguments); | |
269 | }; | |
270 | goog.bindJs_ = function $goog$bindJs_$(fn, selfObj, var_args) { | |
271 | if (!fn) { | |
272 | throw Error(); | |
273 | } | |
274 | if (2 < arguments.length) { | |
275 | var boundArgs = Array.prototype.slice.call(arguments, 2); | |
276 | return function() { | |
277 | var newArgs = Array.prototype.slice.call(arguments); | |
278 | Array.prototype.unshift.apply(newArgs, boundArgs); | |
279 | return fn.apply(selfObj, newArgs); | |
280 | }; | |
281 | } | |
282 | return function() { | |
283 | return fn.apply(selfObj, arguments); | |
284 | }; | |
285 | }; | |
286 | goog.bind = function $goog$bind$(fn, selfObj, var_args) { | |
287 | Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; | |
288 | return goog.bind.apply(null, arguments); | |
289 | }; | |
290 | goog.partial = function $goog$partial$(fn, var_args) { | |
291 | var args = Array.prototype.slice.call(arguments, 1); | |
292 | return function() { | |
293 | var newArgs = args.slice(); | |
294 | newArgs.push.apply(newArgs, arguments); | |
295 | return fn.apply(this, newArgs); | |
296 | }; | |
297 | }; | |
298 | goog.mixin = function $goog$mixin$(target, source) { | |
299 | for (var x in source) { | |
300 | target[x] = source[x]; | |
301 | } | |
302 | }; | |
303 | goog.now = goog.TRUSTED_SITE && Date.now || function() { | |
304 | return+new Date; | |
305 | }; | |
306 | goog.globalEval = function $goog$globalEval$(script) { | |
307 | if (goog.global.execScript) { | |
308 | goog.global.execScript(script, "JavaScript"); | |
309 | } else { | |
310 | if (goog.global.eval) { | |
311 | if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalWorksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobals_) { | |
312 | goog.global.eval(script); | |
313 | } else { | |
314 | var doc = goog.global.document, scriptElt = doc.createElement("script"); | |
315 | scriptElt.type = "text/javascript"; | |
316 | scriptElt.defer = !1; | |
317 | scriptElt.appendChild(doc.createTextNode(script)); | |
318 | doc.body.appendChild(scriptElt); | |
319 | doc.body.removeChild(scriptElt); | |
320 | } | |
321 | } else { | |
322 | throw Error("goog.globalEval not available"); | |
323 | } | |
324 | } | |
325 | }; | |
326 | goog.evalWorksForGlobals_ = null; | |
327 | goog.getCssName = function $goog$getCssName$(className, opt_modifier) { | |
328 | var getMapping = function $getMapping$(cssName) { | |
329 | return goog.cssNameMapping_[cssName] || cssName; | |
330 | }, renameByParts = function $renameByParts$(cssName) { | |
331 | for (var parts = cssName.split("-"), mapped = [], i = 0;i < parts.length;i++) { | |
332 | mapped.push(getMapping(parts[i])); | |
333 | } | |
334 | return mapped.join("-"); | |
335 | }, rename; | |
336 | rename = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? getMapping : renameByParts : function(a) { | |
337 | return a; | |
338 | }; | |
339 | return opt_modifier ? className + "-" + rename(opt_modifier) : rename(className); | |
340 | }; | |
341 | goog.setCssNameMapping = function $goog$setCssNameMapping$(mapping, opt_style) { | |
342 | goog.cssNameMapping_ = mapping; | |
343 | goog.cssNameMappingStyle_ = opt_style; | |
344 | }; | |
345 | goog.getMsg = function $goog$getMsg$(str, opt_values) { | |
346 | var values = opt_values || {}, key; | |
347 | for (key in values) { | |
348 | var value = ("" + values[key]).replace(/\$/g, "$$$$"); | |
349 | str = str.replace(new RegExp("\\{\\$" + key + "\\}", "gi"), value); | |
350 | } | |
351 | return str; | |
352 | }; | |
353 | goog.getMsgWithFallback = function $goog$getMsgWithFallback$(a) { | |
354 | return a; | |
355 | }; | |
356 | goog.exportSymbol = function $goog$exportSymbol$(publicPath, object, opt_objectToExportTo) { | |
357 | goog.exportPath_(publicPath, object, opt_objectToExportTo); | |
358 | }; | |
359 | goog.exportProperty = function $goog$exportProperty$(object, publicName, symbol) { | |
360 | object[publicName] = symbol; | |
361 | }; | |
362 | goog.inherits = function $goog$inherits$(childCtor, parentCtor) { | |
363 | function tempCtor() { | |
364 | } | |
365 | tempCtor.prototype = parentCtor.prototype; | |
366 | childCtor.superClass_ = parentCtor.prototype; | |
367 | childCtor.prototype = new tempCtor; | |
368 | childCtor.prototype.constructor = childCtor; | |
369 | childCtor.base = function $childCtor$base$(me, methodName, var_args) { | |
370 | var args = Array.prototype.slice.call(arguments, 2); | |
371 | return parentCtor.prototype[methodName].apply(me, args); | |
372 | }; | |
373 | }; | |
374 | goog.base = function $goog$base$(me, opt_methodName, var_args) { | |
375 | var caller = arguments.callee.caller; | |
376 | if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !caller) { | |
377 | throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C"); | |
378 | } | |
379 | if (caller.superClass_) { | |
380 | return caller.superClass_.constructor.apply(me, Array.prototype.slice.call(arguments, 1)); | |
381 | } | |
382 | for (var args = Array.prototype.slice.call(arguments, 2), foundCaller = !1, ctor = me.constructor;ctor;ctor = ctor.superClass_ && ctor.superClass_.constructor) { | |
383 | if (ctor.prototype[opt_methodName] === caller) { | |
384 | foundCaller = !0; | |
385 | } else { | |
386 | if (foundCaller) { | |
387 | return ctor.prototype[opt_methodName].apply(me, args); | |
388 | } | |
389 | } | |
390 | } | |
391 | if (me[opt_methodName] === caller) { | |
392 | return me.constructor.prototype[opt_methodName].apply(me, args); | |
393 | } | |
394 | throw Error("goog.base called from a method of one name to a method of a different name"); | |
395 | }; | |
396 | goog.scope = function $goog$scope$(fn) { | |
397 | fn.call(goog.global); | |
398 | }; | |
399 | goog.MODIFY_FUNCTION_PROTOTYPES = !0; | |
400 | goog.MODIFY_FUNCTION_PROTOTYPES && (Function.prototype.bind = Function.prototype.bind || function(selfObj, var_args) { | |
401 | if (1 < arguments.length) { | |
402 | var args = Array.prototype.slice.call(arguments, 1); | |
403 | args.unshift(this, selfObj); | |
404 | return goog.bind.apply(null, args); | |
405 | } | |
406 | return goog.bind(this, selfObj); | |
407 | }, Function.prototype.partial = function $Function$$partial$(var_args) { | |
408 | var args = Array.prototype.slice.call(arguments); | |
409 | args.unshift(this, null); | |
410 | return goog.bind.apply(null, args); | |
411 | }, Function.prototype.inherits = function $Function$$inherits$(parentCtor) { | |
412 | goog.inherits(this, parentCtor); | |
413 | }, Function.prototype.mixin = function $Function$$mixin$(source) { | |
414 | goog.mixin(this.prototype, source); | |
415 | }); | |
416 | goog.debug = {}; | |
417 | goog.debug.Error = function $goog$debug$Error$(opt_msg) { | |
418 | if (Error.captureStackTrace) { | |
419 | Error.captureStackTrace(this, goog.debug.Error); | |
420 | } else { | |
421 | var stack = Error().stack; | |
422 | stack && (this.stack = stack); | |
423 | } | |
424 | opt_msg && (this.message = String(opt_msg)); | |
425 | }; | |
426 | goog.inherits(goog.debug.Error, Error); | |
427 | goog.debug.Error.prototype.name = "CustomError"; | |
428 | goog.dom = {}; | |
429 | goog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REFERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TYPE:10, DOCUMENT_FRAGMENT:11, NOTATION:12}; | |
430 | goog.string = {}; | |
431 | goog.string.DETECT_DOUBLE_ESCAPING = !1; | |
432 | goog.string.Unicode = {NBSP:"\u00a0"}; | |
433 | goog.string.startsWith = function $goog$string$startsWith$(str, prefix) { | |
434 | return 0 == str.lastIndexOf(prefix, 0); | |
435 | }; | |
436 | goog.string.endsWith = function $goog$string$endsWith$(str, suffix) { | |
437 | var l = str.length - suffix.length; | |
438 | return 0 <= l && str.indexOf(suffix, l) == l; | |
439 | }; | |
440 | goog.string.caseInsensitiveStartsWith = function $goog$string$caseInsensitiveStartsWith$(str, prefix) { | |
441 | return 0 == goog.string.caseInsensitiveCompare(prefix, str.substr(0, prefix.length)); | |
442 | }; | |
443 | goog.string.caseInsensitiveEndsWith = function $goog$string$caseInsensitiveEndsWith$(str, suffix) { | |
444 | return 0 == goog.string.caseInsensitiveCompare(suffix, str.substr(str.length - suffix.length, suffix.length)); | |
445 | }; | |
446 | goog.string.caseInsensitiveEquals = function $goog$string$caseInsensitiveEquals$(str1, str2) { | |
447 | return str1.toLowerCase() == str2.toLowerCase(); | |
448 | }; | |
449 | goog.string.subs = function $goog$string$subs$(str, var_args) { | |
450 | for (var splitParts = str.split("%s"), returnString = "", subsArguments = Array.prototype.slice.call(arguments, 1);subsArguments.length && 1 < splitParts.length;) { | |
451 | returnString += splitParts.shift() + subsArguments.shift(); | |
452 | } | |
453 | return returnString + splitParts.join("%s"); | |
454 | }; | |
455 | goog.string.collapseWhitespace = function $goog$string$collapseWhitespace$(str) { | |
456 | return str.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, ""); | |
457 | }; | |
458 | goog.string.isEmpty = function $goog$string$isEmpty$(str) { | |
459 | return/^[\s\xa0]*$/.test(str); | |
460 | }; | |
461 | goog.string.isEmptySafe = function $goog$string$isEmptySafe$(str) { | |
462 | return goog.string.isEmpty(goog.string.makeSafe(str)); | |
463 | }; | |
464 | goog.string.isBreakingWhitespace = function $goog$string$isBreakingWhitespace$(str) { | |
465 | return!/[^\t\n\r ]/.test(str); | |
466 | }; | |
467 | goog.string.isAlpha = function $goog$string$isAlpha$(str) { | |
468 | return!/[^a-zA-Z]/.test(str); | |
469 | }; | |
470 | goog.string.isNumeric = function $goog$string$isNumeric$(str) { | |
471 | return!/[^0-9]/.test(str); | |
472 | }; | |
473 | goog.string.isAlphaNumeric = function $goog$string$isAlphaNumeric$(str) { | |
474 | return!/[^a-zA-Z0-9]/.test(str); | |
475 | }; | |
476 | goog.string.isSpace = function $goog$string$isSpace$(ch) { | |
477 | return " " == ch; | |
478 | }; | |
479 | goog.string.isUnicodeChar = function $goog$string$isUnicodeChar$(ch) { | |
480 | return 1 == ch.length && " " <= ch && "~" >= ch || "\u0080" <= ch && "\ufffd" >= ch; | |
481 | }; | |
482 | goog.string.stripNewlines = function $goog$string$stripNewlines$(str) { | |
483 | return str.replace(/(\r\n|\r|\n)+/g, " "); | |
484 | }; | |
485 | goog.string.canonicalizeNewlines = function $goog$string$canonicalizeNewlines$(str) { | |
486 | return str.replace(/(\r\n|\r|\n)/g, "\n"); | |
487 | }; | |
488 | goog.string.normalizeWhitespace = function $goog$string$normalizeWhitespace$(str) { | |
489 | return str.replace(/\xa0|\s/g, " "); | |
490 | }; | |
491 | goog.string.normalizeSpaces = function $goog$string$normalizeSpaces$(str) { | |
492 | return str.replace(/\xa0|[ \t]+/g, " "); | |
493 | }; | |
494 | goog.string.collapseBreakingSpaces = function $goog$string$collapseBreakingSpaces$(str) { | |
495 | return str.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, ""); | |
496 | }; | |
497 | goog.string.trim = function $goog$string$trim$(str) { | |
498 | return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, ""); | |
499 | }; | |
500 | goog.string.trimLeft = function $goog$string$trimLeft$(str) { | |
501 | return str.replace(/^[\s\xa0]+/, ""); | |
502 | }; | |
503 | goog.string.trimRight = function $goog$string$trimRight$(str) { | |
504 | return str.replace(/[\s\xa0]+$/, ""); | |
505 | }; | |
506 | goog.string.caseInsensitiveCompare = function $goog$string$caseInsensitiveCompare$(str1, str2) { | |
507 | var test1 = String(str1).toLowerCase(), test2 = String(str2).toLowerCase(); | |
508 | return test1 < test2 ? -1 : test1 == test2 ? 0 : 1; | |
509 | }; | |
510 | goog.string.numerateCompareRegExp_ = /(\.\d+)|(\d+)|(\D+)/g; | |
511 | goog.string.numerateCompare = function $goog$string$numerateCompare$(str1, str2) { | |
512 | if (str1 == str2) { | |
513 | return 0; | |
514 | } | |
515 | if (!str1) { | |
516 | return-1; | |
517 | } | |
518 | if (!str2) { | |
519 | return 1; | |
520 | } | |
521 | for (var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_), tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_), count = Math.min(tokens1.length, tokens2.length), i = 0;i < count;i++) { | |
522 | var a = tokens1[i], b = tokens2[i]; | |
523 | if (a != b) { | |
524 | var num1 = parseInt(a, 10); | |
525 | if (!isNaN(num1)) { | |
526 | var num2 = parseInt(b, 10); | |
527 | if (!isNaN(num2) && num1 - num2) { | |
528 | return num1 - num2; | |
529 | } | |
530 | } | |
531 | return a < b ? -1 : 1; | |
532 | } | |
533 | } | |
534 | return tokens1.length != tokens2.length ? tokens1.length - tokens2.length : str1 < str2 ? -1 : 1; | |
535 | }; | |
536 | goog.string.urlEncode = function $goog$string$urlEncode$(str) { | |
537 | return encodeURIComponent(String(str)); | |
538 | }; | |
539 | goog.string.urlDecode = function $goog$string$urlDecode$(str) { | |
540 | return decodeURIComponent(str.replace(/\+/g, " ")); | |
541 | }; | |
542 | goog.string.newLineToBr = function $goog$string$newLineToBr$(str, opt_xml) { | |
543 | return str.replace(/(\r\n|\r|\n)/g, opt_xml ? "<br />" : "<br>"); | |
544 | }; | |
545 | goog.string.htmlEscape = function $goog$string$htmlEscape$(str, opt_isLikelyToContainHtmlChars) { | |
546 | if (opt_isLikelyToContainHtmlChars) { | |
547 | str = str.replace(goog.string.AMP_RE_, "&").replace(goog.string.LT_RE_, "<").replace(goog.string.GT_RE_, ">").replace(goog.string.QUOT_RE_, """).replace(goog.string.SINGLE_QUOTE_RE_, "'").replace(goog.string.NULL_RE_, "�"), goog.string.DETECT_DOUBLE_ESCAPING && (str = str.replace(goog.string.E_RE_, "e")); | |
548 | } else { | |
549 | if (!goog.string.ALL_RE_.test(str)) { | |
550 | return str; | |
551 | } | |
552 | -1 != str.indexOf("&") && (str = str.replace(goog.string.AMP_RE_, "&")); | |
553 | -1 != str.indexOf("<") && (str = str.replace(goog.string.LT_RE_, "<")); | |
554 | -1 != str.indexOf(">") && (str = str.replace(goog.string.GT_RE_, ">")); | |
555 | -1 != str.indexOf('"') && (str = str.replace(goog.string.QUOT_RE_, """)); | |
556 | -1 != str.indexOf("'") && (str = str.replace(goog.string.SINGLE_QUOTE_RE_, "'")); | |
557 | -1 != str.indexOf("\x00") && (str = str.replace(goog.string.NULL_RE_, "�")); | |
558 | goog.string.DETECT_DOUBLE_ESCAPING && -1 != str.indexOf("e") && (str = str.replace(goog.string.E_RE_, "e")); | |
559 | } | |
560 | return str; | |
561 | }; | |
562 | goog.string.AMP_RE_ = /&/g; | |
563 | goog.string.LT_RE_ = /</g; | |
564 | goog.string.GT_RE_ = />/g; | |
565 | goog.string.QUOT_RE_ = /"/g; | |
566 | goog.string.SINGLE_QUOTE_RE_ = /'/g; | |
567 | goog.string.NULL_RE_ = /\x00/g; | |
568 | goog.string.E_RE_ = /e/g; | |
569 | goog.string.ALL_RE_ = goog.string.DETECT_DOUBLE_ESCAPING ? /[\x00&<>"'e]/ : /[\x00&<>"']/; | |
570 | goog.string.unescapeEntities = function $goog$string$unescapeEntities$(str) { | |
571 | return goog.string.contains(str, "&") ? "document" in goog.global ? goog.string.unescapeEntitiesUsingDom_(str) : goog.string.unescapePureXmlEntities_(str) : str; | |
572 | }; | |
573 | goog.string.unescapeEntitiesWithDocument = function $goog$string$unescapeEntitiesWithDocument$(str, document) { | |
574 | return goog.string.contains(str, "&") ? goog.string.unescapeEntitiesUsingDom_(str, document) : str; | |
575 | }; | |
576 | goog.string.unescapeEntitiesUsingDom_ = function $goog$string$unescapeEntitiesUsingDom_$(str, opt_document) { | |
577 | var seen = {"&":"&", "<":"<", ">":">", """:'"'}, div; | |
578 | div = opt_document ? opt_document.createElement("div") : goog.global.document.createElement("div"); | |
579 | return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) { | |
580 | var value = seen[s]; | |
581 | if (value) { | |
582 | return value; | |
583 | } | |
584 | if ("#" == entity.charAt(0)) { | |
585 | var n = Number("0" + entity.substr(1)); | |
586 | isNaN(n) || (value = String.fromCharCode(n)); | |
587 | } | |
588 | value || (div.innerHTML = s + " ", value = div.firstChild.nodeValue.slice(0, -1)); | |
589 | return seen[s] = value; | |
590 | }); | |
591 | }; | |
592 | goog.string.unescapePureXmlEntities_ = function $goog$string$unescapePureXmlEntities_$(str) { | |
593 | return str.replace(/&([^;]+);/g, function(s, entity) { | |
594 | switch(entity) { | |
595 | case "amp": | |
596 | return "&"; | |
597 | case "lt": | |
598 | return "<"; | |
599 | case "gt": | |
600 | return ">"; | |
601 | case "quot": | |
602 | return'"'; | |
603 | default: | |
604 | if ("#" == entity.charAt(0)) { | |
605 | var n = Number("0" + entity.substr(1)); | |
606 | if (!isNaN(n)) { | |
607 | return String.fromCharCode(n); | |
608 | } | |
609 | } | |
610 | return s; | |
611 | } | |
612 | }); | |
613 | }; | |
614 | goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; | |
615 | goog.string.whitespaceEscape = function $goog$string$whitespaceEscape$(str, opt_xml) { | |
616 | return goog.string.newLineToBr(str.replace(/ /g, "  "), opt_xml); | |
617 | }; | |
618 | goog.string.stripQuotes = function $goog$string$stripQuotes$(str, quoteChars) { | |
619 | for (var length = quoteChars.length, i = 0;i < length;i++) { | |
620 | var quoteChar = 1 == length ? quoteChars : quoteChars.charAt(i); | |
621 | if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) { | |
622 | return str.substring(1, str.length - 1); | |
623 | } | |
624 | } | |
625 | return str; | |
626 | }; | |
627 | goog.string.truncate = function $goog$string$truncate$(str, chars, opt_protectEscapedCharacters) { | |
628 | opt_protectEscapedCharacters && (str = goog.string.unescapeEntities(str)); | |
629 | str.length > chars && (str = str.substring(0, chars - 3) + "..."); | |
630 | opt_protectEscapedCharacters && (str = goog.string.htmlEscape(str)); | |
631 | return str; | |
632 | }; | |
633 | goog.string.truncateMiddle = function $goog$string$truncateMiddle$(str, chars, opt_protectEscapedCharacters, opt_trailingChars) { | |
634 | opt_protectEscapedCharacters && (str = goog.string.unescapeEntities(str)); | |
635 | if (opt_trailingChars && str.length > chars) { | |
636 | opt_trailingChars > chars && (opt_trailingChars = chars); | |
637 | var endPoint = str.length - opt_trailingChars, startPoint = chars - opt_trailingChars; | |
638 | str = str.substring(0, startPoint) + "..." + str.substring(endPoint); | |
639 | } else { | |
640 | if (str.length > chars) { | |
641 | var half = Math.floor(chars / 2), endPos = str.length - half, half = half + chars % 2; | |
642 | str = str.substring(0, half) + "..." + str.substring(endPos); | |
643 | } | |
644 | } | |
645 | opt_protectEscapedCharacters && (str = goog.string.htmlEscape(str)); | |
646 | return str; | |
647 | }; | |
648 | goog.string.specialEscapeChars_ = {"\x00":"\\0", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t", "\x0B":"\\x0B", '"':'\\"', "\\":"\\\\"}; | |
649 | goog.string.jsEscapeCache_ = {"'":"\\'"}; | |
650 | goog.string.quote = function $goog$string$quote$(s) { | |
651 | s = String(s); | |
652 | if (s.quote) { | |
653 | return s.quote(); | |
654 | } | |
655 | for (var sb = ['"'], i = 0;i < s.length;i++) { | |
656 | var ch = s.charAt(i), cc = ch.charCodeAt(0); | |
657 | sb[i + 1] = goog.string.specialEscapeChars_[ch] || (31 < cc && 127 > cc ? ch : goog.string.escapeChar(ch)); | |
658 | } | |
659 | sb.push('"'); | |
660 | return sb.join(""); | |
661 | }; | |
662 | goog.string.escapeString = function $goog$string$escapeString$(str) { | |
663 | for (var sb = [], i = 0;i < str.length;i++) { | |
664 | sb[i] = goog.string.escapeChar(str.charAt(i)); | |
665 | } | |
666 | return sb.join(""); | |
667 | }; | |
668 | goog.string.escapeChar = function $goog$string$escapeChar$(c) { | |
669 | if (c in goog.string.jsEscapeCache_) { | |
670 | return goog.string.jsEscapeCache_[c]; | |
671 | } | |
672 | if (c in goog.string.specialEscapeChars_) { | |
673 | return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c]; | |
674 | } | |
675 | var rv = c, cc = c.charCodeAt(0); | |
676 | if (31 < cc && 127 > cc) { | |
677 | rv = c; | |
678 | } else { | |
679 | if (256 > cc) { | |
680 | if (rv = "\\x", 16 > cc || 256 < cc) { | |
681 | rv += "0"; | |
682 | } | |
683 | } else { | |
684 | rv = "\\u", 4096 > cc && (rv += "0"); | |
685 | } | |
686 | rv += cc.toString(16).toUpperCase(); | |
687 | } | |
688 | return goog.string.jsEscapeCache_[c] = rv; | |
689 | }; | |
690 | goog.string.toMap = function $goog$string$toMap$(s) { | |
691 | for (var rv = {}, i = 0;i < s.length;i++) { | |
692 | rv[s.charAt(i)] = !0; | |
693 | } | |
694 | return rv; | |
695 | }; | |
696 | goog.string.contains = function $goog$string$contains$(str, subString) { | |
697 | return-1 != str.indexOf(subString); | |
698 | }; | |
699 | goog.string.caseInsensitiveContains = function $goog$string$caseInsensitiveContains$(str, subString) { | |
700 | return goog.string.contains(str.toLowerCase(), subString.toLowerCase()); | |
701 | }; | |
702 | goog.string.countOf = function $goog$string$countOf$(s, ss) { | |
703 | return s && ss ? s.split(ss).length - 1 : 0; | |
704 | }; | |
705 | goog.string.removeAt = function $goog$string$removeAt$(s, index, stringLength) { | |
706 | var resultStr = s; | |
707 | 0 <= index && index < s.length && 0 < stringLength && (resultStr = s.substr(0, index) + s.substr(index + stringLength, s.length - index - stringLength)); | |
708 | return resultStr; | |
709 | }; | |
710 | goog.string.remove = function $goog$string$remove$(s, ss) { | |
711 | var re = new RegExp(goog.string.regExpEscape(ss), ""); | |
712 | return s.replace(re, ""); | |
713 | }; | |
714 | goog.string.removeAll = function $goog$string$removeAll$(s, ss) { | |
715 | var re = new RegExp(goog.string.regExpEscape(ss), "g"); | |
716 | return s.replace(re, ""); | |
717 | }; | |
718 | goog.string.regExpEscape = function $goog$string$regExpEscape$(s) { | |
719 | return String(s).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08"); | |
720 | }; | |
721 | goog.string.repeat = function $goog$string$repeat$(string, length) { | |
722 | return Array(length + 1).join(string); | |
723 | }; | |
724 | goog.string.padNumber = function $goog$string$padNumber$(num, length, opt_precision) { | |
725 | var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num), index = s.indexOf("."); | |
726 | -1 == index && (index = s.length); | |
727 | return goog.string.repeat("0", Math.max(0, length - index)) + s; | |
728 | }; | |
729 | goog.string.makeSafe = function $goog$string$makeSafe$(obj) { | |
730 | return null == obj ? "" : String(obj); | |
731 | }; | |
732 | goog.string.buildString = function $goog$string$buildString$(var_args) { | |
733 | return Array.prototype.join.call(arguments, ""); | |
734 | }; | |
735 | goog.string.getRandomString = function $goog$string$getRandomString$() { | |
736 | var x = 2147483648; | |
737 | return Math.floor(Math.random() * x).toString(36) + Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36); | |
738 | }; | |
739 | goog.string.compareVersions = function $goog$string$compareVersions$(version1, version2) { | |
740 | for (var order = 0, v1Subs = goog.string.trim(String(version1)).split("."), v2Subs = goog.string.trim(String(version2)).split("."), subCount = Math.max(v1Subs.length, v2Subs.length), subIdx = 0;0 == order && subIdx < subCount;subIdx++) { | |
741 | var v1Sub = v1Subs[subIdx] || "", v2Sub = v2Subs[subIdx] || "", v1CompParser = RegExp("(\\d*)(\\D*)", "g"), v2CompParser = RegExp("(\\d*)(\\D*)", "g"); | |
742 | do { | |
743 | var v1Comp = v1CompParser.exec(v1Sub) || ["", "", ""], v2Comp = v2CompParser.exec(v2Sub) || ["", "", ""]; | |
744 | if (0 == v1Comp[0].length && 0 == v2Comp[0].length) { | |
745 | break; | |
746 | } | |
747 | var v1CompNum = 0 == v1Comp[1].length ? 0 : parseInt(v1Comp[1], 10), v2CompNum = 0 == v2Comp[1].length ? 0 : parseInt(v2Comp[1], 10), order = goog.string.compareElements_(v1CompNum, v2CompNum) || goog.string.compareElements_(0 == v1Comp[2].length, 0 == v2Comp[2].length) || goog.string.compareElements_(v1Comp[2], v2Comp[2]); | |
748 | } while (0 == order); | |
749 | } | |
750 | return order; | |
751 | }; | |
752 | goog.string.compareElements_ = function $goog$string$compareElements_$(left, right) { | |
753 | return left < right ? -1 : left > right ? 1 : 0; | |
754 | }; | |
755 | goog.string.HASHCODE_MAX_ = 4294967296; | |
756 | goog.string.hashCode = function $goog$string$hashCode$(str) { | |
757 | for (var result = 0, i = 0;i < str.length;++i) { | |
758 | result = 31 * result + str.charCodeAt(i), result %= goog.string.HASHCODE_MAX_; | |
759 | } | |
760 | return result; | |
761 | }; | |
762 | goog.string.uniqueStringCounter_ = 2147483648 * Math.random() | 0; | |
763 | goog.string.createUniqueString = function $goog$string$createUniqueString$() { | |
764 | return "goog_" + goog.string.uniqueStringCounter_++; | |
765 | }; | |
766 | goog.string.toNumber = function $goog$string$toNumber$(str) { | |
767 | var num = Number(str); | |
768 | return 0 == num && goog.string.isEmpty(str) ? NaN : num; | |
769 | }; | |
770 | goog.string.isLowerCamelCase = function $goog$string$isLowerCamelCase$(str) { | |
771 | return/^[a-z]+([A-Z][a-z]*)*$/.test(str); | |
772 | }; | |
773 | goog.string.isUpperCamelCase = function $goog$string$isUpperCamelCase$(str) { | |
774 | return/^([A-Z][a-z]*)+$/.test(str); | |
775 | }; | |
776 | goog.string.toCamelCase = function $goog$string$toCamelCase$(str) { | |
777 | return String(str).replace(/\-([a-z])/g, function(all, match) { | |
778 | return match.toUpperCase(); | |
779 | }); | |
780 | }; | |
781 | goog.string.toSelectorCase = function $goog$string$toSelectorCase$(str) { | |
782 | return String(str).replace(/([A-Z])/g, "-$1").toLowerCase(); | |
783 | }; | |
784 | goog.string.toTitleCase = function $goog$string$toTitleCase$(str, opt_delimiters) { | |
785 | var delimiters = goog.isString(opt_delimiters) ? goog.string.regExpEscape(opt_delimiters) : "\\s", delimiters = delimiters ? "|[" + delimiters + "]+" : "", regexp = new RegExp("(^" + delimiters + ")([a-z])", "g"); | |
786 | return str.replace(regexp, function(all, p1, p2) { | |
787 | return p1 + p2.toUpperCase(); | |
788 | }); | |
789 | }; | |
790 | goog.string.parseInt = function $goog$string$parseInt$(value) { | |
791 | isFinite(value) && (value = String(value)); | |
792 | return goog.isString(value) ? /^\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10) : NaN; | |
793 | }; | |
794 | goog.string.splitLimit = function $goog$string$splitLimit$(str, separator, limit) { | |
795 | for (var parts = str.split(separator), returnVal = [];0 < limit && parts.length;) { | |
796 | returnVal.push(parts.shift()), limit--; | |
797 | } | |
798 | parts.length && returnVal.push(parts.join(separator)); | |
799 | return returnVal; | |
800 | }; | |
801 | goog.asserts = {}; | |
802 | goog.asserts.ENABLE_ASSERTS = goog.DEBUG; | |
803 | goog.asserts.AssertionError = function $goog$asserts$AssertionError$(messagePattern, messageArgs) { | |
804 | messageArgs.unshift(messagePattern); | |
805 | goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs)); | |
806 | messageArgs.shift(); | |
807 | }; | |
808 | goog.inherits(goog.asserts.AssertionError, goog.debug.Error); | |
809 | goog.asserts.AssertionError.prototype.name = "AssertionError"; | |
810 | goog.asserts.doAssertFailure_ = function $goog$asserts$doAssertFailure_$(defaultMessage, defaultArgs, givenMessage, givenArgs) { | |
811 | var message = "Assertion failed"; | |
812 | if (givenMessage) { | |
813 | var message = message + (": " + givenMessage), args = givenArgs | |
814 | } else { | |
815 | defaultMessage && (message += ": " + defaultMessage, args = defaultArgs); | |
816 | } | |
817 | throw new goog.asserts.AssertionError("" + message, args || []); | |
818 | }; | |
819 | goog.asserts.assert = function $goog$asserts$assert$(condition, opt_message, var_args) { | |
820 | goog.asserts.ENABLE_ASSERTS && !condition && goog.asserts.doAssertFailure_("", null, opt_message, Array.prototype.slice.call(arguments, 2)); | |
821 | return condition; | |
822 | }; | |
823 | goog.asserts.fail = function $goog$asserts$fail$(opt_message, var_args) { | |
824 | if (goog.asserts.ENABLE_ASSERTS) { | |
825 | throw new goog.asserts.AssertionError("Failure" + (opt_message ? ": " + opt_message : ""), Array.prototype.slice.call(arguments, 1)); | |
826 | } | |
827 | }; | |
828 | goog.asserts.assertNumber = function $goog$asserts$assertNumber$(value, opt_message, var_args) { | |
829 | goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value) && goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
830 | return value; | |
831 | }; | |
832 | goog.asserts.assertString = function $goog$asserts$assertString$(value, opt_message, var_args) { | |
833 | goog.asserts.ENABLE_ASSERTS && !goog.isString(value) && goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
834 | return value; | |
835 | }; | |
836 | goog.asserts.assertFunction = function $goog$asserts$assertFunction$(value, opt_message, var_args) { | |
837 | goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value) && goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
838 | return value; | |
839 | }; | |
840 | goog.asserts.assertObject = function $goog$asserts$assertObject$(value, opt_message, var_args) { | |
841 | goog.asserts.ENABLE_ASSERTS && !goog.isObject(value) && goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
842 | return value; | |
843 | }; | |
844 | goog.asserts.assertArray = function $goog$asserts$assertArray$(value, opt_message, var_args) { | |
845 | goog.asserts.ENABLE_ASSERTS && !goog.isArray(value) && goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
846 | return value; | |
847 | }; | |
848 | goog.asserts.assertBoolean = function $goog$asserts$assertBoolean$(value, opt_message, var_args) { | |
849 | goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value) && goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
850 | return value; | |
851 | }; | |
852 | goog.asserts.assertElement = function $goog$asserts$assertElement$(value, opt_message, var_args) { | |
853 | !goog.asserts.ENABLE_ASSERTS || goog.isObject(value) && value.nodeType == goog.dom.NodeType.ELEMENT || goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2)); | |
854 | return value; | |
855 | }; | |
856 | goog.asserts.assertInstanceof = function $goog$asserts$assertInstanceof$(value, type, opt_message, var_args) { | |
857 | !goog.asserts.ENABLE_ASSERTS || value instanceof type || goog.asserts.doAssertFailure_("instanceof check failed.", null, opt_message, Array.prototype.slice.call(arguments, 3)); | |
858 | return value; | |
859 | }; | |
860 | goog.asserts.assertObjectPrototypeIsIntact = function $goog$asserts$assertObjectPrototypeIsIntact$() { | |
861 | for (var key in Object.prototype) { | |
862 | goog.asserts.fail(key + " should not be enumerable in Object.prototype."); | |
863 | } | |
864 | }; | |
865 | goog.array = {}; | |
866 | goog.NATIVE_ARRAY_PROTOTYPES = goog.TRUSTED_SITE; | |
867 | goog.array.ASSUME_NATIVE_FUNCTIONS = !1; | |
868 | goog.array.peek = function $goog$array$peek$(array) { | |
869 | return array[array.length - 1]; | |
870 | }; | |
871 | goog.array.last = goog.array.peek; | |
872 | goog.array.ARRAY_PROTOTYPE_ = Array.prototype; | |
873 | goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.indexOf) ? function(arr, obj, opt_fromIndex) { | |
874 | goog.asserts.assert(null != arr.length); | |
875 | return goog.array.ARRAY_PROTOTYPE_.indexOf.call(arr, obj, opt_fromIndex); | |
876 | } : function(arr, obj, opt_fromIndex) { | |
877 | var fromIndex = null == opt_fromIndex ? 0 : 0 > opt_fromIndex ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex; | |
878 | if (goog.isString(arr)) { | |
879 | return goog.isString(obj) && 1 == obj.length ? arr.indexOf(obj, fromIndex) : -1; | |
880 | } | |
881 | for (var i = fromIndex;i < arr.length;i++) { | |
882 | if (i in arr && arr[i] === obj) { | |
883 | return i; | |
884 | } | |
885 | } | |
886 | return-1; | |
887 | }; | |
888 | goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.lastIndexOf) ? function(arr, obj, opt_fromIndex) { | |
889 | goog.asserts.assert(null != arr.length); | |
890 | var fromIndex = null == opt_fromIndex ? arr.length - 1 : opt_fromIndex; | |
891 | return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(arr, obj, fromIndex); | |
892 | } : function(arr, obj, opt_fromIndex) { | |
893 | var fromIndex = null == opt_fromIndex ? arr.length - 1 : opt_fromIndex; | |
894 | 0 > fromIndex && (fromIndex = Math.max(0, arr.length + fromIndex)); | |
895 | if (goog.isString(arr)) { | |
896 | return goog.isString(obj) && 1 == obj.length ? arr.lastIndexOf(obj, fromIndex) : -1; | |
897 | } | |
898 | for (var i = fromIndex;0 <= i;i--) { | |
899 | if (i in arr && arr[i] === obj) { | |
900 | return i; | |
901 | } | |
902 | } | |
903 | return-1; | |
904 | }; | |
905 | goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.forEach) ? function(arr, f, opt_obj) { | |
906 | goog.asserts.assert(null != arr.length); | |
907 | goog.array.ARRAY_PROTOTYPE_.forEach.call(arr, f, opt_obj); | |
908 | } : function(arr, f, opt_obj) { | |
909 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
910 | i in arr2 && f.call(opt_obj, arr2[i], i, arr); | |
911 | } | |
912 | }; | |
913 | goog.array.forEachRight = function $goog$array$forEachRight$(arr, f, opt_obj) { | |
914 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = l - 1;0 <= i;--i) { | |
915 | i in arr2 && f.call(opt_obj, arr2[i], i, arr); | |
916 | } | |
917 | }; | |
918 | goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.filter) ? function(arr, f, opt_obj) { | |
919 | goog.asserts.assert(null != arr.length); | |
920 | return goog.array.ARRAY_PROTOTYPE_.filter.call(arr, f, opt_obj); | |
921 | } : function(arr, f, opt_obj) { | |
922 | for (var l = arr.length, res = [], resLength = 0, arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
923 | if (i in arr2) { | |
924 | var val = arr2[i]; | |
925 | f.call(opt_obj, val, i, arr) && (res[resLength++] = val); | |
926 | } | |
927 | } | |
928 | return res; | |
929 | }; | |
930 | goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.map) ? function(arr, f, opt_obj) { | |
931 | goog.asserts.assert(null != arr.length); | |
932 | return goog.array.ARRAY_PROTOTYPE_.map.call(arr, f, opt_obj); | |
933 | } : function(arr, f, opt_obj) { | |
934 | for (var l = arr.length, res = Array(l), arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
935 | i in arr2 && (res[i] = f.call(opt_obj, arr2[i], i, arr)); | |
936 | } | |
937 | return res; | |
938 | }; | |
939 | goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduce) ? function(arr, f, val, opt_obj) { | |
940 | goog.asserts.assert(null != arr.length); | |
941 | opt_obj && (f = goog.bind(f, opt_obj)); | |
942 | return goog.array.ARRAY_PROTOTYPE_.reduce.call(arr, f, val); | |
943 | } : function(arr, f, val$$0, opt_obj) { | |
944 | var rval = val$$0; | |
945 | goog.array.forEach(arr, function(val, index) { | |
946 | rval = f.call(opt_obj, rval, val, index, arr); | |
947 | }); | |
948 | return rval; | |
949 | }; | |
950 | goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduceRight) ? function(arr, f, val, opt_obj) { | |
951 | goog.asserts.assert(null != arr.length); | |
952 | opt_obj && (f = goog.bind(f, opt_obj)); | |
953 | return goog.array.ARRAY_PROTOTYPE_.reduceRight.call(arr, f, val); | |
954 | } : function(arr, f, val$$0, opt_obj) { | |
955 | var rval = val$$0; | |
956 | goog.array.forEachRight(arr, function(val, index) { | |
957 | rval = f.call(opt_obj, rval, val, index, arr); | |
958 | }); | |
959 | return rval; | |
960 | }; | |
961 | goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.some) ? function(arr, f, opt_obj) { | |
962 | goog.asserts.assert(null != arr.length); | |
963 | return goog.array.ARRAY_PROTOTYPE_.some.call(arr, f, opt_obj); | |
964 | } : function(arr, f, opt_obj) { | |
965 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
966 | if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { | |
967 | return!0; | |
968 | } | |
969 | } | |
970 | return!1; | |
971 | }; | |
972 | goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.every) ? function(arr, f, opt_obj) { | |
973 | goog.asserts.assert(null != arr.length); | |
974 | return goog.array.ARRAY_PROTOTYPE_.every.call(arr, f, opt_obj); | |
975 | } : function(arr, f, opt_obj) { | |
976 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
977 | if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) { | |
978 | return!1; | |
979 | } | |
980 | } | |
981 | return!0; | |
982 | }; | |
983 | goog.array.count = function $goog$array$count$(arr$$0, f, opt_obj) { | |
984 | var count = 0; | |
985 | goog.array.forEach(arr$$0, function(element, index, arr) { | |
986 | f.call(opt_obj, element, index, arr) && ++count; | |
987 | }, opt_obj); | |
988 | return count; | |
989 | }; | |
990 | goog.array.find = function $goog$array$find$(arr, f, opt_obj) { | |
991 | var i = goog.array.findIndex(arr, f, opt_obj); | |
992 | return 0 > i ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; | |
993 | }; | |
994 | goog.array.findIndex = function $goog$array$findIndex$(arr, f, opt_obj) { | |
995 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = 0;i < l;i++) { | |
996 | if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { | |
997 | return i; | |
998 | } | |
999 | } | |
1000 | return-1; | |
1001 | }; | |
1002 | goog.array.findRight = function $goog$array$findRight$(arr, f, opt_obj) { | |
1003 | var i = goog.array.findIndexRight(arr, f, opt_obj); | |
1004 | return 0 > i ? null : goog.isString(arr) ? arr.charAt(i) : arr[i]; | |
1005 | }; | |
1006 | goog.array.findIndexRight = function $goog$array$findIndexRight$(arr, f, opt_obj) { | |
1007 | for (var l = arr.length, arr2 = goog.isString(arr) ? arr.split("") : arr, i = l - 1;0 <= i;i--) { | |
1008 | if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) { | |
1009 | return i; | |
1010 | } | |
1011 | } | |
1012 | return-1; | |
1013 | }; | |
1014 | goog.array.contains = function $goog$array$contains$(arr, obj) { | |
1015 | return 0 <= goog.array.indexOf(arr, obj); | |
1016 | }; | |
1017 | goog.array.isEmpty = function $goog$array$isEmpty$(arr) { | |
1018 | return 0 == arr.length; | |
1019 | }; | |
1020 | goog.array.clear = function $goog$array$clear$(arr) { | |
1021 | if (!goog.isArray(arr)) { | |
1022 | for (var i = arr.length - 1;0 <= i;i--) { | |
1023 | delete arr[i]; | |
1024 | } | |
1025 | } | |
1026 | arr.length = 0; | |
1027 | }; | |
1028 | goog.array.insert = function $goog$array$insert$(arr, obj) { | |
1029 | goog.array.contains(arr, obj) || arr.push(obj); | |
1030 | }; | |
1031 | goog.array.insertAt = function $goog$array$insertAt$(arr, obj, opt_i) { | |
1032 | goog.array.splice(arr, opt_i, 0, obj); | |
1033 | }; | |
1034 | goog.array.insertArrayAt = function $goog$array$insertArrayAt$(arr, elementsToAdd, opt_i) { | |
1035 | goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd); | |
1036 | }; | |
1037 | goog.array.insertBefore = function $goog$array$insertBefore$(arr, obj, opt_obj2) { | |
1038 | var i; | |
1039 | 2 == arguments.length || 0 > (i = goog.array.indexOf(arr, opt_obj2)) ? arr.push(obj) : goog.array.insertAt(arr, obj, i); | |
1040 | }; | |
1041 | goog.array.remove = function $goog$array$remove$(arr, obj) { | |
1042 | var i = goog.array.indexOf(arr, obj), rv; | |
1043 | (rv = 0 <= i) && goog.array.removeAt(arr, i); | |
1044 | return rv; | |
1045 | }; | |
1046 | goog.array.removeAt = function $goog$array$removeAt$(arr, i) { | |
1047 | goog.asserts.assert(null != arr.length); | |
1048 | return 1 == goog.array.ARRAY_PROTOTYPE_.splice.call(arr, i, 1).length; | |
1049 | }; | |
1050 | goog.array.removeIf = function $goog$array$removeIf$(arr, f, opt_obj) { | |
1051 | var i = goog.array.findIndex(arr, f, opt_obj); | |
1052 | return 0 <= i ? (goog.array.removeAt(arr, i), !0) : !1; | |
1053 | }; | |
1054 | goog.array.concat = function $goog$array$concat$(var_args) { | |
1055 | return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments); | |
1056 | }; | |
1057 | goog.array.join = function $goog$array$join$(var_args) { | |
1058 | return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments); | |
1059 | }; | |
1060 | goog.array.toArray = function $goog$array$toArray$(object) { | |
1061 | var length = object.length; | |
1062 | if (0 < length) { | |
1063 | for (var rv = Array(length), i = 0;i < length;i++) { | |
1064 | rv[i] = object[i]; | |
1065 | } | |
1066 | return rv; | |
1067 | } | |
1068 | return[]; | |
1069 | }; | |
1070 | goog.array.clone = goog.array.toArray; | |
1071 | goog.array.extend = function $goog$array$extend$(arr1, var_args) { | |
1072 | for (var i = 1;i < arguments.length;i++) { | |
1073 | var arr2 = arguments[i], isArrayLike; | |
1074 | if (goog.isArray(arr2) || (isArrayLike = goog.isArrayLike(arr2)) && Object.prototype.hasOwnProperty.call(arr2, "callee")) { | |
1075 | arr1.push.apply(arr1, arr2); | |
1076 | } else { | |
1077 | if (isArrayLike) { | |
1078 | for (var len1 = arr1.length, len2 = arr2.length, j = 0;j < len2;j++) { | |
1079 | arr1[len1 + j] = arr2[j]; | |
1080 | } | |
1081 | } else { | |
1082 | arr1.push(arr2); | |
1083 | } | |
1084 | } | |
1085 | } | |
1086 | }; | |
1087 | goog.array.splice = function $goog$array$splice$(arr, index, howMany, var_args) { | |
1088 | goog.asserts.assert(null != arr.length); | |
1089 | return goog.array.ARRAY_PROTOTYPE_.splice.apply(arr, goog.array.slice(arguments, 1)); | |
1090 | }; | |
1091 | goog.array.slice = function $goog$array$slice$(arr, start, opt_end) { | |
1092 | goog.asserts.assert(null != arr.length); | |
1093 | return 2 >= arguments.length ? goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start) : goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start, opt_end); | |
1094 | }; | |
1095 | goog.array.removeDuplicates = function $goog$array$removeDuplicates$(arr, opt_rv, opt_hashFn) { | |
1096 | for (var returnArray = opt_rv || arr, defaultHashFn = function $defaultHashFn$() { | |
1097 | return goog.isObject(current) ? "o" + goog.getUid(current) : (typeof current).charAt(0) + current; | |
1098 | }, hashFn = opt_hashFn || defaultHashFn, seen = {}, cursorInsert = 0, cursorRead = 0;cursorRead < arr.length;) { | |
1099 | var current = arr[cursorRead++], key = hashFn(current); | |
1100 | Object.prototype.hasOwnProperty.call(seen, key) || (seen[key] = !0, returnArray[cursorInsert++] = current); | |
1101 | } | |
1102 | returnArray.length = cursorInsert; | |
1103 | }; | |
1104 | goog.array.binarySearch = function $goog$array$binarySearch$(arr, target, opt_compareFn) { | |
1105 | return goog.array.binarySearch_(arr, opt_compareFn || goog.array.defaultCompare, !1, target); | |
1106 | }; | |
1107 | goog.array.binarySelect = function $goog$array$binarySelect$(arr, evaluator, opt_obj) { | |
1108 | return goog.array.binarySearch_(arr, evaluator, !0, void 0, opt_obj); | |
1109 | }; | |
1110 | goog.array.binarySearch_ = function $goog$array$binarySearch_$(arr, compareFn, isEvaluator, opt_target, opt_selfObj) { | |
1111 | for (var left = 0, right = arr.length, found;left < right;) { | |
1112 | var middle = left + right >> 1, compareResult; | |
1113 | compareResult = isEvaluator ? compareFn.call(opt_selfObj, arr[middle], middle, arr) : compareFn(opt_target, arr[middle]); | |
1114 | 0 < compareResult ? left = middle + 1 : (right = middle, found = !compareResult); | |
1115 | } | |
1116 | return found ? left : ~left; | |
1117 | }; | |
1118 | goog.array.sort = function $goog$array$sort$(arr, opt_compareFn) { | |
1119 | arr.sort(opt_compareFn || goog.array.defaultCompare); | |
1120 | }; | |
1121 | goog.array.stableSort = function $goog$array$stableSort$(arr, opt_compareFn) { | |
1122 | function stableCompareFn(obj1, obj2) { | |
1123 | return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index; | |
1124 | } | |
1125 | for (var i = 0;i < arr.length;i++) { | |
1126 | arr[i] = {index:i, value:arr[i]}; | |
1127 | } | |
1128 | var valueCompareFn = opt_compareFn || goog.array.defaultCompare; | |
1129 | goog.array.sort(arr, stableCompareFn); | |
1130 | for (i = 0;i < arr.length;i++) { | |
1131 | arr[i] = arr[i].value; | |
1132 | } | |
1133 | }; | |
1134 | goog.array.sortObjectsByKey = function $goog$array$sortObjectsByKey$(arr, key, opt_compareFn) { | |
1135 | var compare = opt_compareFn || goog.array.defaultCompare; | |
1136 | goog.array.sort(arr, function(a, b) { | |
1137 | return compare(a[key], b[key]); | |
1138 | }); | |
1139 | }; | |
1140 | goog.array.isSorted = function $goog$array$isSorted$(arr, opt_compareFn, opt_strict) { | |
1141 | for (var compare = opt_compareFn || goog.array.defaultCompare, i = 1;i < arr.length;i++) { | |
1142 | var compareResult = compare(arr[i - 1], arr[i]); | |
1143 | if (0 < compareResult || 0 == compareResult && opt_strict) { | |
1144 | return!1; | |
1145 | } | |
1146 | } | |
1147 | return!0; | |
1148 | }; | |
1149 | goog.array.equals = function $goog$array$equals$(arr1, arr2, opt_equalsFn) { | |
1150 | if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) { | |
1151 | return!1; | |
1152 | } | |
1153 | for (var l = arr1.length, equalsFn = opt_equalsFn || goog.array.defaultCompareEquality, i = 0;i < l;i++) { | |
1154 | if (!equalsFn(arr1[i], arr2[i])) { | |
1155 | return!1; | |
1156 | } | |
1157 | } | |
1158 | return!0; | |
1159 | }; | |
1160 | goog.array.compare3 = function $goog$array$compare3$(arr1, arr2, opt_compareFn) { | |
1161 | for (var compare = opt_compareFn || goog.array.defaultCompare, l = Math.min(arr1.length, arr2.length), i = 0;i < l;i++) { | |
1162 | var result = compare(arr1[i], arr2[i]); | |
1163 | if (0 != result) { | |
1164 | return result; | |
1165 | } | |
1166 | } | |
1167 | return goog.array.defaultCompare(arr1.length, arr2.length); | |
1168 | }; | |
1169 | goog.array.defaultCompare = function $goog$array$defaultCompare$(a, b) { | |
1170 | return a > b ? 1 : a < b ? -1 : 0; | |
1171 | }; | |
1172 | goog.array.defaultCompareEquality = function $goog$array$defaultCompareEquality$(a, b) { | |
1173 | return a === b; | |
1174 | }; | |
1175 | goog.array.binaryInsert = function $goog$array$binaryInsert$(array, value, opt_compareFn) { | |
1176 | var index = goog.array.binarySearch(array, value, opt_compareFn); | |
1177 | return 0 > index ? (goog.array.insertAt(array, value, -(index + 1)), !0) : !1; | |
1178 | }; | |
1179 | goog.array.binaryRemove = function $goog$array$binaryRemove$(array, value, opt_compareFn) { | |
1180 | var index = goog.array.binarySearch(array, value, opt_compareFn); | |
1181 | return 0 <= index ? goog.array.removeAt(array, index) : !1; | |
1182 | }; | |
1183 | goog.array.bucket = function $goog$array$bucket$(array, sorter, opt_obj) { | |
1184 | for (var buckets = {}, i = 0;i < array.length;i++) { | |
1185 | var value = array[i], key = sorter.call(opt_obj, value, i, array); | |
1186 | if (goog.isDef(key)) { | |
1187 | var bucket = buckets[key] || (buckets[key] = []); | |
1188 | bucket.push(value); | |
1189 | } | |
1190 | } | |
1191 | return buckets; | |
1192 | }; | |
1193 | goog.array.toObject = function $goog$array$toObject$(arr, keyFunc, opt_obj) { | |
1194 | var ret = {}; | |
1195 | goog.array.forEach(arr, function(element, index) { | |
1196 | ret[keyFunc.call(opt_obj, element, index, arr)] = element; | |
1197 | }); | |
1198 | return ret; | |
1199 | }; | |
1200 | goog.array.range = function $goog$array$range$(startOrEnd, opt_end, opt_step) { | |
1201 | var array = [], start = 0, end = startOrEnd, step = opt_step || 1; | |
1202 | void 0 !== opt_end && (start = startOrEnd, end = opt_end); | |
1203 | if (0 > step * (end - start)) { | |
1204 | return[]; | |
1205 | } | |
1206 | if (0 < step) { | |
1207 | for (var i = start;i < end;i += step) { | |
1208 | array.push(i); | |
1209 | } | |
1210 | } else { | |
1211 | for (i = start;i > end;i += step) { | |
1212 | array.push(i); | |
1213 | } | |
1214 | } | |
1215 | return array; | |
1216 | }; | |
1217 | goog.array.repeat = function $goog$array$repeat$(value, n) { | |
1218 | for (var array = [], i = 0;i < n;i++) { | |
1219 | array[i] = value; | |
1220 | } | |
1221 | return array; | |
1222 | }; | |
1223 | goog.array.flatten = function $goog$array$flatten$(var_args) { | |
1224 | for (var result = [], i = 0;i < arguments.length;i++) { | |
1225 | var element = arguments[i]; | |
1226 | goog.isArray(element) ? result.push.apply(result, goog.array.flatten.apply(null, element)) : result.push(element); | |
1227 | } | |
1228 | return result; | |
1229 | }; | |
1230 | goog.array.rotate = function $goog$array$rotate$(array, n) { | |
1231 | goog.asserts.assert(null != array.length); | |
1232 | array.length && (n %= array.length, 0 < n ? goog.array.ARRAY_PROTOTYPE_.unshift.apply(array, array.splice(-n, n)) : 0 > n && goog.array.ARRAY_PROTOTYPE_.push.apply(array, array.splice(0, -n))); | |
1233 | return array; | |
1234 | }; | |
1235 | goog.array.moveItem = function $goog$array$moveItem$(arr, fromIndex, toIndex) { | |
1236 | goog.asserts.assert(0 <= fromIndex && fromIndex < arr.length); | |
1237 | goog.asserts.assert(0 <= toIndex && toIndex < arr.length); | |
1238 | var removedItems = goog.array.ARRAY_PROTOTYPE_.splice.call(arr, fromIndex, 1); | |
1239 | goog.array.ARRAY_PROTOTYPE_.splice.call(arr, toIndex, 0, removedItems[0]); | |
1240 | }; | |
1241 | goog.array.zip = function $goog$array$zip$(var_args) { | |
1242 | if (!arguments.length) { | |
1243 | return[]; | |
1244 | } | |
1245 | for (var result = [], i = 0;;i++) { | |
1246 | for (var value = [], j = 0;j < arguments.length;j++) { | |
1247 | var arr = arguments[j]; | |
1248 | if (i >= arr.length) { | |
1249 | return result; | |
1250 | } | |
1251 | value.push(arr[i]); | |
1252 | } | |
1253 | result.push(value); | |
1254 | } | |
1255 | }; | |
1256 | goog.array.shuffle = function $goog$array$shuffle$(arr, opt_randFn) { | |
1257 | for (var randFn = opt_randFn || Math.random, i = arr.length - 1;0 < i;i--) { | |
1258 | var j = Math.floor(randFn() * (i + 1)), tmp = arr[i]; | |
1259 | arr[i] = arr[j]; | |
1260 | arr[j] = tmp; | |
1261 | } | |
1262 | }; | |
1263 | goog.functions = {}; | |
1264 | goog.functions.constant = function $goog$functions$constant$(retValue) { | |
1265 | return function() { | |
1266 | return retValue; | |
1267 | }; | |
1268 | }; | |
1269 | goog.functions.FALSE = goog.functions.constant(!1); | |
1270 | goog.functions.TRUE = goog.functions.constant(!0); | |
1271 | goog.functions.NULL = goog.functions.constant(null); | |
1272 | goog.functions.identity = function $goog$functions$identity$(opt_returnValue) { | |
1273 | return opt_returnValue; | |
1274 | }; | |
1275 | goog.functions.error = function $goog$functions$error$(message) { | |
1276 | return function() { | |
1277 | throw Error(message); | |
1278 | }; | |
1279 | }; | |
1280 | goog.functions.fail = function $goog$functions$fail$(err) { | |
1281 | return function() { | |
1282 | throw err; | |
1283 | }; | |
1284 | }; | |
1285 | goog.functions.lock = function $goog$functions$lock$(f, opt_numArgs) { | |
1286 | opt_numArgs = opt_numArgs || 0; | |
1287 | return function() { | |
1288 | return f.apply(this, Array.prototype.slice.call(arguments, 0, opt_numArgs)); | |
1289 | }; | |
1290 | }; | |
1291 | goog.functions.nth = function $goog$functions$nth$(n) { | |
1292 | return function() { | |
1293 | return arguments[n]; | |
1294 | }; | |
1295 | }; | |
1296 | goog.functions.withReturnValue = function $goog$functions$withReturnValue$(f, retValue) { | |
1297 | return goog.functions.sequence(f, goog.functions.constant(retValue)); | |
1298 | }; | |
1299 | goog.functions.compose = function $goog$functions$compose$(fn, var_args) { | |
1300 | var functions = arguments, length = functions.length; | |
1301 | return function() { | |
1302 | var result; | |
1303 | length && (result = functions[length - 1].apply(this, arguments)); | |
1304 | for (var i = length - 2;0 <= i;i--) { | |
1305 | result = functions[i].call(this, result); | |
1306 | } | |
1307 | return result; | |
1308 | }; | |
1309 | }; | |
1310 | goog.functions.sequence = function $goog$functions$sequence$(var_args) { | |
1311 | var functions = arguments, length = functions.length; | |
1312 | return function() { | |
1313 | for (var result, i = 0;i < length;i++) { | |
1314 | result = functions[i].apply(this, arguments); | |
1315 | } | |
1316 | return result; | |
1317 | }; | |
1318 | }; | |
1319 | goog.functions.and = function $goog$functions$and$(var_args) { | |
1320 | var functions = arguments, length = functions.length; | |
1321 | return function() { | |
1322 | for (var i = 0;i < length;i++) { | |
1323 | if (!functions[i].apply(this, arguments)) { | |
1324 | return!1; | |
1325 | } | |
1326 | } | |
1327 | return!0; | |
1328 | }; | |
1329 | }; | |
1330 | goog.functions.or = function $goog$functions$or$(var_args) { | |
1331 | var functions = arguments, length = functions.length; | |
1332 | return function() { | |
1333 | for (var i = 0;i < length;i++) { | |
1334 | if (functions[i].apply(this, arguments)) { | |
1335 | return!0; | |
1336 | } | |
1337 | } | |
1338 | return!1; | |
1339 | }; | |
1340 | }; | |
1341 | goog.functions.not = function $goog$functions$not$(f) { | |
1342 | return function() { | |
1343 | return!f.apply(this, arguments); | |
1344 | }; | |
1345 | }; | |
1346 | goog.functions.create = function $goog$functions$create$(constructor, var_args) { | |
1347 | var temp = function $temp$() { | |
1348 | }; | |
1349 | temp.prototype = constructor.prototype; | |
1350 | var obj = new temp; | |
1351 | constructor.apply(obj, Array.prototype.slice.call(arguments, 1)); | |
1352 | return obj; | |
1353 | }; | |
1354 | goog.functions.CACHE_RETURN_VALUE = !0; | |
1355 | goog.functions.cacheReturnValue = function $goog$functions$cacheReturnValue$(fn) { | |
1356 | var called = !1, value; | |
1357 | return function() { | |
1358 | if (!goog.functions.CACHE_RETURN_VALUE) { | |
1359 | return fn(); | |
1360 | } | |
1361 | called || (value = fn(), called = !0); | |
1362 | return value; | |
1363 | }; | |
1364 | }; | |
1365 | goog.math = {}; | |
1366 | goog.math.randomInt = function $goog$math$randomInt$(a) { | |
1367 | return Math.floor(Math.random() * a); | |
1368 | }; | |
1369 | goog.math.uniformRandom = function $goog$math$uniformRandom$(a, b) { | |
1370 | return a + Math.random() * (b - a); | |
1371 | }; | |
1372 | goog.math.clamp = function $goog$math$clamp$(value, min, max) { | |
1373 | return Math.min(Math.max(value, min), max); | |
1374 | }; | |
1375 | goog.math.modulo = function $goog$math$modulo$(a, b) { | |
1376 | var r = a % b; | |
1377 | return 0 > r * b ? r + b : r; | |
1378 | }; | |
1379 | goog.math.lerp = function $goog$math$lerp$(a, b, x) { | |
1380 | return a + x * (b - a); | |
1381 | }; | |
1382 | goog.math.nearlyEquals = function $goog$math$nearlyEquals$(a, b, opt_tolerance) { | |
1383 | return Math.abs(a - b) <= (opt_tolerance || 1E-6); | |
1384 | }; | |
1385 | goog.math.standardAngle = function $goog$math$standardAngle$(angle) { | |
1386 | return goog.math.modulo(angle, 360); | |
1387 | }; | |
1388 | goog.math.standardAngleInRadians = function $goog$math$standardAngleInRadians$(angle) { | |
1389 | return goog.math.modulo(angle, 2 * Math.PI); | |
1390 | }; | |
1391 | goog.math.toRadians = function $goog$math$toRadians$(angleDegrees) { | |
1392 | return angleDegrees * Math.PI / 180; | |
1393 | }; | |
1394 | goog.math.toDegrees = function $goog$math$toDegrees$(angleRadians) { | |
1395 | return 180 * angleRadians / Math.PI; | |
1396 | }; | |
1397 | goog.math.angleDx = function $goog$math$angleDx$(degrees, radius) { | |
1398 | return radius * Math.cos(goog.math.toRadians(degrees)); | |
1399 | }; | |
1400 | goog.math.angleDy = function $goog$math$angleDy$(degrees, radius) { | |
1401 | return radius * Math.sin(goog.math.toRadians(degrees)); | |
1402 | }; | |
1403 | goog.math.angle = function $goog$math$angle$(x1, y1, x2, y2) { | |
1404 | return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(y2 - y1, x2 - x1))); | |
1405 | }; | |
1406 | goog.math.angleDifference = function $goog$math$angleDifference$(startAngle, endAngle) { | |
1407 | var d = goog.math.standardAngle(endAngle) - goog.math.standardAngle(startAngle); | |
1408 | 180 < d ? d -= 360 : -180 >= d && (d = 360 + d); | |
1409 | return d; | |
1410 | }; | |
1411 | goog.math.sign = function $goog$math$sign$(x) { | |
1412 | return 0 == x ? 0 : 0 > x ? -1 : 1; | |
1413 | }; | |
1414 | goog.math.longestCommonSubsequence = function $goog$math$longestCommonSubsequence$(array1, array2, opt_compareFn, opt_collectorFn) { | |
1415 | for (var compare = opt_compareFn || function(a, b) { | |
1416 | return a == b; | |
1417 | }, collect = opt_collectorFn || function(i1) { | |
1418 | return array1[i1]; | |
1419 | }, length1 = array1.length, length2 = array2.length, arr = [], i = 0;i < length1 + 1;i++) { | |
1420 | arr[i] = [], arr[i][0] = 0; | |
1421 | } | |
1422 | for (var j = 0;j < length2 + 1;j++) { | |
1423 | arr[0][j] = 0; | |
1424 | } | |
1425 | for (i = 1;i <= length1;i++) { | |
1426 | for (j = 1;j <= length2;j++) { | |
1427 | compare(array1[i - 1], array2[j - 1]) ? arr[i][j] = arr[i - 1][j - 1] + 1 : arr[i][j] = Math.max(arr[i - 1][j], arr[i][j - 1]); | |
1428 | } | |
1429 | } | |
1430 | for (var result = [], i = length1, j = length2;0 < i && 0 < j;) { | |
1431 | compare(array1[i - 1], array2[j - 1]) ? (result.unshift(collect(i - 1, j - 1)), i--, j--) : arr[i - 1][j] > arr[i][j - 1] ? i-- : j--; | |
1432 | } | |
1433 | return result; | |
1434 | }; | |
1435 | goog.math.sum = function $goog$math$sum$(var_args) { | |
1436 | return goog.array.reduce(arguments, function(sum, value) { | |
1437 | return sum + value; | |
1438 | }, 0); | |
1439 | }; | |
1440 | goog.math.average = function $goog$math$average$(var_args) { | |
1441 | return goog.math.sum.apply(null, arguments) / arguments.length; | |
1442 | }; | |
1443 | goog.math.sampleVariance = function $goog$math$sampleVariance$(var_args) { | |
1444 | var sampleSize = arguments.length; | |
1445 | if (2 > sampleSize) { | |
1446 | return 0; | |
1447 | } | |
1448 | var mean = goog.math.average.apply(null, arguments), variance = goog.math.sum.apply(null, goog.array.map(arguments, function(val) { | |
1449 | return Math.pow(val - mean, 2); | |
1450 | })) / (sampleSize - 1); | |
1451 | return variance; | |
1452 | }; | |
1453 | goog.math.standardDeviation = function $goog$math$standardDeviation$(var_args) { | |
1454 | return Math.sqrt(goog.math.sampleVariance.apply(null, arguments)); | |
1455 | }; | |
1456 | goog.math.isInt = function $goog$math$isInt$(num) { | |
1457 | return isFinite(num) && 0 == num % 1; | |
1458 | }; | |
1459 | goog.math.isFiniteNumber = function $goog$math$isFiniteNumber$(num) { | |
1460 | return isFinite(num) && !isNaN(num); | |
1461 | }; | |
1462 | goog.math.log10Floor = function $goog$math$log10Floor$(num) { | |
1463 | if (0 < num) { | |
1464 | var x = Math.round(Math.log(num) * Math.LOG10E); | |
1465 | return x - (parseFloat("1e" + x) > num); | |
1466 | } | |
1467 | return 0 == num ? -Infinity : NaN; | |
1468 | }; | |
1469 | goog.math.safeFloor = function $goog$math$safeFloor$(num, opt_epsilon) { | |
1470 | goog.asserts.assert(!goog.isDef(opt_epsilon) || 0 < opt_epsilon); | |
1471 | return Math.floor(num + (opt_epsilon || 2E-15)); | |
1472 | }; | |
1473 | goog.math.safeCeil = function $goog$math$safeCeil$(num, opt_epsilon) { | |
1474 | goog.asserts.assert(!goog.isDef(opt_epsilon) || 0 < opt_epsilon); | |
1475 | return Math.ceil(num - (opt_epsilon || 2E-15)); | |
1476 | }; | |
1477 | goog.iter = {}; | |
1478 | goog.iter.StopIteration = "StopIteration" in goog.global ? goog.global.StopIteration : Error("StopIteration"); | |
1479 | goog.iter.Iterator = function $goog$iter$Iterator$() { | |
1480 | }; | |
1481 | goog.iter.Iterator.prototype.next = function $goog$iter$Iterator$$next$() { | |
1482 | throw goog.iter.StopIteration; | |
1483 | }; | |
1484 | goog.iter.Iterator.prototype.__iterator__ = function $goog$iter$Iterator$$__iterator__$() { | |
1485 | return this; | |
1486 | }; | |
1487 | goog.iter.toIterator = function $goog$iter$toIterator$(iterable) { | |
1488 | if (iterable instanceof goog.iter.Iterator) { | |
1489 | return iterable; | |
1490 | } | |
1491 | if ("function" == typeof iterable.__iterator__) { | |
1492 | return iterable.__iterator__(!1); | |
1493 | } | |
1494 | if (goog.isArrayLike(iterable)) { | |
1495 | var i = 0, newIter = new goog.iter.Iterator; | |
1496 | newIter.next = function $newIter$next$() { | |
1497 | for (;;) { | |
1498 | if (i >= iterable.length) { | |
1499 | throw goog.iter.StopIteration; | |
1500 | } | |
1501 | if (i in iterable) { | |
1502 | return iterable[i++]; | |
1503 | } | |
1504 | i++; | |
1505 | } | |
1506 | }; | |
1507 | return newIter; | |
1508 | } | |
1509 | throw Error("Not implemented"); | |
1510 | }; | |
1511 | goog.iter.forEach = function $goog$iter$forEach$(iterable, f, opt_obj) { | |
1512 | if (goog.isArrayLike(iterable)) { | |
1513 | try { | |
1514 | goog.array.forEach(iterable, f, opt_obj); | |
1515 | } catch (ex) { | |
1516 | if (ex !== goog.iter.StopIteration) { | |
1517 | throw ex; | |
1518 | } | |
1519 | } | |
1520 | } else { | |
1521 | iterable = goog.iter.toIterator(iterable); | |
1522 | try { | |
1523 | for (;;) { | |
1524 | f.call(opt_obj, iterable.next(), void 0, iterable); | |
1525 | } | |
1526 | } catch (ex$$0) { | |
1527 | if (ex$$0 !== goog.iter.StopIteration) { | |
1528 | throw ex$$0; | |
1529 | } | |
1530 | } | |
1531 | } | |
1532 | }; | |
1533 | goog.iter.filter = function $goog$iter$filter$(iterable, f, opt_obj) { | |
1534 | var iterator = goog.iter.toIterator(iterable), newIter = new goog.iter.Iterator; | |
1535 | newIter.next = function $newIter$next$() { | |
1536 | for (;;) { | |
1537 | var val = iterator.next(); | |
1538 | if (f.call(opt_obj, val, void 0, iterator)) { | |
1539 | return val; | |
1540 | } | |
1541 | } | |
1542 | }; | |
1543 | return newIter; | |
1544 | }; | |
1545 | goog.iter.filterFalse = function $goog$iter$filterFalse$(iterable, f, opt_obj) { | |
1546 | return goog.iter.filter(iterable, goog.functions.not(f), opt_obj); | |
1547 | }; | |
1548 | goog.iter.range = function $goog$iter$range$(startOrStop, opt_stop, opt_step) { | |
1549 | var start = 0, stop = startOrStop, step = opt_step || 1; | |
1550 | 1 < arguments.length && (start = startOrStop, stop = opt_stop); | |
1551 | if (0 == step) { | |
1552 | throw Error("Range step argument must not be zero"); | |
1553 | } | |
1554 | var newIter = new goog.iter.Iterator; | |
1555 | newIter.next = function $newIter$next$() { | |
1556 | if (0 < step && start >= stop || 0 > step && start <= stop) { | |
1557 | throw goog.iter.StopIteration; | |
1558 | } | |
1559 | var rv = start; | |
1560 | start += step; | |
1561 | return rv; | |
1562 | }; | |
1563 | return newIter; | |
1564 | }; | |
1565 | goog.iter.join = function $goog$iter$join$(iterable, deliminator) { | |
1566 | return goog.iter.toArray(iterable).join(deliminator); | |
1567 | }; | |
1568 | goog.iter.map = function $goog$iter$map$(iterable, f, opt_obj) { | |
1569 | var iterator = goog.iter.toIterator(iterable), newIter = new goog.iter.Iterator; | |
1570 | newIter.next = function $newIter$next$() { | |
1571 | var val = iterator.next(); | |
1572 | return f.call(opt_obj, val, void 0, iterator); | |
1573 | }; | |
1574 | return newIter; | |
1575 | }; | |
1576 | goog.iter.reduce = function $goog$iter$reduce$(iterable, f, val$$0, opt_obj) { | |
1577 | var rval = val$$0; | |
1578 | goog.iter.forEach(iterable, function(val) { | |
1579 | rval = f.call(opt_obj, rval, val); | |
1580 | }); | |
1581 | return rval; | |
1582 | }; | |
1583 | goog.iter.some = function $goog$iter$some$(iterable, f, opt_obj) { | |
1584 | iterable = goog.iter.toIterator(iterable); | |
1585 | try { | |
1586 | for (;;) { | |
1587 | if (f.call(opt_obj, iterable.next(), void 0, iterable)) { | |
1588 | return!0; | |
1589 | } | |
1590 | } | |
1591 | } catch (ex) { | |
1592 | if (ex !== goog.iter.StopIteration) { | |
1593 | throw ex; | |
1594 | } | |
1595 | } | |
1596 | return!1; | |
1597 | }; | |
1598 | goog.iter.every = function $goog$iter$every$(iterable, f, opt_obj) { | |
1599 | iterable = goog.iter.toIterator(iterable); | |
1600 | try { | |
1601 | for (;;) { | |
1602 | if (!f.call(opt_obj, iterable.next(), void 0, iterable)) { | |
1603 | return!1; | |
1604 | } | |
1605 | } | |
1606 | } catch (ex) { | |
1607 | if (ex !== goog.iter.StopIteration) { | |
1608 | throw ex; | |
1609 | } | |
1610 | } | |
1611 | return!0; | |
1612 | }; | |
1613 | goog.iter.chain = function $goog$iter$chain$(var_args) { | |
1614 | var iterator = goog.iter.toIterator(arguments), iter = new goog.iter.Iterator, current = null; | |
1615 | iter.next = function $iter$next$() { | |
1616 | for (;;) { | |
1617 | if (null == current) { | |
1618 | var it = iterator.next(); | |
1619 | current = goog.iter.toIterator(it); | |
1620 | } | |
1621 | try { | |
1622 | return current.next(); | |
1623 | } catch (ex) { | |
1624 | if (ex !== goog.iter.StopIteration) { | |
1625 | throw ex; | |
1626 | } | |
1627 | current = null; | |
1628 | } | |
1629 | } | |
1630 | }; | |
1631 | return iter; | |
1632 | }; | |
1633 | goog.iter.chainFromIterable = function $goog$iter$chainFromIterable$(iterable) { | |
1634 | return goog.iter.chain.apply(void 0, iterable); | |
1635 | }; | |
1636 | goog.iter.dropWhile = function $goog$iter$dropWhile$(iterable, f, opt_obj) { | |
1637 | var iterator = goog.iter.toIterator(iterable), newIter = new goog.iter.Iterator, dropping = !0; | |
1638 | newIter.next = function $newIter$next$() { | |
1639 | for (;;) { | |
1640 | var val = iterator.next(); | |
1641 | if (!dropping || !f.call(opt_obj, val, void 0, iterator)) { | |
1642 | return dropping = !1, val; | |
1643 | } | |
1644 | } | |
1645 | }; | |
1646 | return newIter; | |
1647 | }; | |
1648 | goog.iter.takeWhile = function $goog$iter$takeWhile$(iterable, f, opt_obj) { | |
1649 | var iterator = goog.iter.toIterator(iterable), newIter = new goog.iter.Iterator, taking = !0; | |
1650 | newIter.next = function $newIter$next$() { | |
1651 | for (;;) { | |
1652 | if (taking) { | |
1653 | var val = iterator.next(); | |
1654 | if (f.call(opt_obj, val, void 0, iterator)) { | |
1655 | return val; | |
1656 | } | |
1657 | taking = !1; | |
1658 | } else { | |
1659 | throw goog.iter.StopIteration; | |
1660 | } | |
1661 | } | |
1662 | }; | |
1663 | return newIter; | |
1664 | }; | |
1665 | goog.iter.toArray = function $goog$iter$toArray$(iterable) { | |
1666 | if (goog.isArrayLike(iterable)) { | |
1667 | return goog.array.toArray(iterable); | |
1668 | } | |
1669 | iterable = goog.iter.toIterator(iterable); | |
1670 | var array = []; | |
1671 | goog.iter.forEach(iterable, function(val) { | |
1672 | array.push(val); | |
1673 | }); | |
1674 | return array; | |
1675 | }; | |
1676 | goog.iter.equals = function $goog$iter$equals$(iterable1, iterable2) { | |
1677 | var fillValue = {}, pairs = goog.iter.zipLongest(fillValue, iterable1, iterable2); | |
1678 | return goog.iter.every(pairs, function(pair) { | |
1679 | return pair[0] == pair[1]; | |
1680 | }); | |
1681 | }; | |
1682 | goog.iter.nextOrValue = function $goog$iter$nextOrValue$(iterable, defaultValue) { | |
1683 | try { | |
1684 | return goog.iter.toIterator(iterable).next(); | |
1685 | } catch (e) { | |
1686 | if (e != goog.iter.StopIteration) { | |
1687 | throw e; | |
1688 | } | |
1689 | return defaultValue; | |
1690 | } | |
1691 | }; | |
1692 | goog.iter.product = function $goog$iter$product$(var_args) { | |
1693 | var someArrayEmpty = goog.array.some(arguments, function(arr) { | |
1694 | return!arr.length; | |
1695 | }); | |
1696 | if (someArrayEmpty || !arguments.length) { | |
1697 | return new goog.iter.Iterator; | |
1698 | } | |
1699 | var iter = new goog.iter.Iterator, arrays = arguments, indicies = goog.array.repeat(0, arrays.length); | |
1700 | iter.next = function $iter$next$() { | |
1701 | if (indicies) { | |
1702 | for (var retVal = goog.array.map(indicies, function(valueIndex, arrayIndex) { | |
1703 | return arrays[arrayIndex][valueIndex]; | |
1704 | }), i = indicies.length - 1;0 <= i;i--) { | |
1705 | goog.asserts.assert(indicies); | |
1706 | if (indicies[i] < arrays[i].length - 1) { | |
1707 | indicies[i]++; | |
1708 | break; | |
1709 | } | |
1710 | if (0 == i) { | |
1711 | indicies = null; | |
1712 | break; | |
1713 | } | |
1714 | indicies[i] = 0; | |
1715 | } | |
1716 | return retVal; | |
1717 | } | |
1718 | throw goog.iter.StopIteration; | |
1719 | }; | |
1720 | return iter; | |
1721 | }; | |
1722 | goog.iter.cycle = function $goog$iter$cycle$(iterable) { | |
1723 | var baseIterator = goog.iter.toIterator(iterable), cache = [], cacheIndex = 0, iter = new goog.iter.Iterator, useCache = !1; | |
1724 | iter.next = function $iter$next$() { | |
1725 | var returnElement = null; | |
1726 | if (!useCache) { | |
1727 | try { | |
1728 | return returnElement = baseIterator.next(), cache.push(returnElement), returnElement; | |
1729 | } catch (e) { | |
1730 | if (e != goog.iter.StopIteration || goog.array.isEmpty(cache)) { | |
1731 | throw e; | |
1732 | } | |
1733 | useCache = !0; | |
1734 | } | |
1735 | } | |
1736 | returnElement = cache[cacheIndex]; | |
1737 | cacheIndex = (cacheIndex + 1) % cache.length; | |
1738 | return returnElement; | |
1739 | }; | |
1740 | return iter; | |
1741 | }; | |
1742 | goog.iter.count = function $goog$iter$count$(opt_start, opt_step) { | |
1743 | var counter = opt_start || 0, step = goog.isDef(opt_step) ? opt_step : 1, iter = new goog.iter.Iterator; | |
1744 | iter.next = function $iter$next$() { | |
1745 | var returnValue = counter; | |
1746 | counter += step; | |
1747 | return returnValue; | |
1748 | }; | |
1749 | return iter; | |
1750 | }; | |
1751 | goog.iter.repeat = function $goog$iter$repeat$(value) { | |
1752 | var iter = new goog.iter.Iterator; | |
1753 | iter.next = goog.functions.constant(value); | |
1754 | return iter; | |
1755 | }; | |
1756 | goog.iter.accumulate = function $goog$iter$accumulate$(iterable) { | |
1757 | var iterator = goog.iter.toIterator(iterable), total = 0, iter = new goog.iter.Iterator; | |
1758 | iter.next = function $iter$next$() { | |
1759 | return total += iterator.next(); | |
1760 | }; | |
1761 | return iter; | |
1762 | }; | |
1763 | goog.iter.zip = function $goog$iter$zip$(var_args) { | |
1764 | var args = arguments, iter = new goog.iter.Iterator; | |
1765 | if (0 < args.length) { | |
1766 | var iterators = goog.array.map(args, goog.iter.toIterator); | |
1767 | iter.next = function $iter$next$() { | |
1768 | var arr = goog.array.map(iterators, function(it) { | |
1769 | return it.next(); | |
1770 | }); | |
1771 | return arr; | |
1772 | }; | |
1773 | } | |
1774 | return iter; | |
1775 | }; | |
1776 | goog.iter.zipLongest = function $goog$iter$zipLongest$(fillValue, var_args) { | |
1777 | var args = goog.array.slice(arguments, 1), iter = new goog.iter.Iterator; | |
1778 | if (0 < args.length) { | |
1779 | var iterators = goog.array.map(args, goog.iter.toIterator); | |
1780 | iter.next = function $iter$next$() { | |
1781 | var iteratorsHaveValues = !1, arr = goog.array.map(iterators, function(it) { | |
1782 | var returnValue; | |
1783 | try { | |
1784 | returnValue = it.next(), iteratorsHaveValues = !0; | |
1785 | } catch (ex) { | |
1786 | if (ex !== goog.iter.StopIteration) { | |
1787 | throw ex; | |
1788 | } | |
1789 | returnValue = fillValue; | |
1790 | } | |
1791 | return returnValue; | |
1792 | }); | |
1793 | if (!iteratorsHaveValues) { | |
1794 | throw goog.iter.StopIteration; | |
1795 | } | |
1796 | return arr; | |
1797 | }; | |
1798 | } | |
1799 | return iter; | |
1800 | }; | |
1801 | goog.iter.compress = function $goog$iter$compress$(iterable, selectors) { | |
1802 | var selectorIterator = goog.iter.toIterator(selectors); | |
1803 | return goog.iter.filter(iterable, function() { | |
1804 | return!!selectorIterator.next(); | |
1805 | }); | |
1806 | }; | |
1807 | goog.iter.GroupByIterator_ = function $goog$iter$GroupByIterator_$(iterable, opt_keyFunc) { | |
1808 | this.iterator = goog.iter.toIterator(iterable); | |
1809 | this.keyFunc = opt_keyFunc || goog.functions.identity; | |
1810 | }; | |
1811 | goog.inherits(goog.iter.GroupByIterator_, goog.iter.Iterator); | |
1812 | goog.iter.GroupByIterator_.prototype.next = function $goog$iter$GroupByIterator_$$next$() { | |
1813 | for (;this.currentKey == this.targetKey;) { | |
1814 | this.currentValue = this.iterator.next(), this.currentKey = this.keyFunc(this.currentValue); | |
1815 | } | |
1816 | this.targetKey = this.currentKey; | |
1817 | return[this.currentKey, this.groupItems_(this.targetKey)]; | |
1818 | }; | |
1819 | goog.iter.GroupByIterator_.prototype.groupItems_ = function $goog$iter$GroupByIterator_$$groupItems_$(targetKey) { | |
1820 | for (var arr = [];this.currentKey == targetKey;) { | |
1821 | arr.push(this.currentValue); | |
1822 | try { | |
1823 | this.currentValue = this.iterator.next(); | |
1824 | } catch (ex) { | |
1825 | if (ex !== goog.iter.StopIteration) { | |
1826 | throw ex; | |
1827 | } | |
1828 | break; | |
1829 | } | |
1830 | this.currentKey = this.keyFunc(this.currentValue); | |
1831 | } | |
1832 | return arr; | |
1833 | }; | |
1834 | goog.iter.groupBy = function $goog$iter$groupBy$(iterable, opt_keyFunc) { | |
1835 | return new goog.iter.GroupByIterator_(iterable, opt_keyFunc); | |
1836 | }; | |
1837 | goog.iter.starMap = function $goog$iter$starMap$(iterable, f, opt_obj) { | |
1838 | var iterator = goog.iter.toIterator(iterable), iter = new goog.iter.Iterator; | |
1839 | iter.next = function $iter$next$() { | |
1840 | var args = goog.iter.toArray(iterator.next()); | |
1841 | return f.apply(opt_obj, goog.array.concat(args, void 0, iterator)); | |
1842 | }; | |
1843 | return iter; | |
1844 | }; | |
1845 | goog.iter.tee = function $goog$iter$tee$(iterable, opt_num) { | |
1846 | var iterator = goog.iter.toIterator(iterable), num = goog.isNumber(opt_num) ? opt_num : 2, buffers = goog.array.map(goog.array.range(num), function() { | |
1847 | return[]; | |
1848 | }), addNextIteratorValueToBuffers = function $addNextIteratorValueToBuffers$() { | |
1849 | var val = iterator.next(); | |
1850 | goog.array.forEach(buffers, function(buffer) { | |
1851 | buffer.push(val); | |
1852 | }); | |
1853 | }, createIterator = function $createIterator$(buffer) { | |
1854 | var iter = new goog.iter.Iterator; | |
1855 | iter.next = function $iter$next$() { | |
1856 | goog.array.isEmpty(buffer) && addNextIteratorValueToBuffers(); | |
1857 | goog.asserts.assert(!goog.array.isEmpty(buffer)); | |
1858 | return buffer.shift(); | |
1859 | }; | |
1860 | return iter; | |
1861 | }; | |
1862 | return goog.array.map(buffers, createIterator); | |
1863 | }; | |
1864 | goog.iter.enumerate = function $goog$iter$enumerate$(iterable, opt_start) { | |
1865 | return goog.iter.zip(goog.iter.count(opt_start), iterable); | |
1866 | }; | |
1867 | goog.iter.limit = function $goog$iter$limit$(iterable, limitSize) { | |
1868 | goog.asserts.assert(goog.math.isInt(limitSize) && 0 <= limitSize); | |
1869 | var iterator = goog.iter.toIterator(iterable), iter = new goog.iter.Iterator, remaining = limitSize; | |
1870 | iter.next = function $iter$next$() { | |
1871 | if (0 < remaining--) { | |
1872 | return iterator.next(); | |
1873 | } | |
1874 | throw goog.iter.StopIteration; | |
1875 | }; | |
1876 | return iter; | |
1877 | }; | |
1878 | goog.iter.consume = function $goog$iter$consume$(iterable, count) { | |
1879 | goog.asserts.assert(goog.math.isInt(count) && 0 <= count); | |
1880 | for (var iterator = goog.iter.toIterator(iterable);0 < count--;) { | |
1881 | goog.iter.nextOrValue(iterator, null); | |
1882 | } | |
1883 | return iterator; | |
1884 | }; | |
1885 | goog.iter.slice = function $goog$iter$slice$(iterable, start, opt_end) { | |
1886 | goog.asserts.assert(goog.math.isInt(start) && 0 <= start); | |
1887 | var iterator = goog.iter.consume(iterable, start); | |
1888 | goog.isNumber(opt_end) && (goog.asserts.assert(goog.math.isInt(opt_end) && opt_end >= start), iterator = goog.iter.limit(iterator, opt_end - start)); | |
1889 | return iterator; | |
1890 | }; | |
1891 | goog.iter.hasDuplicates_ = function $goog$iter$hasDuplicates_$(arr) { | |
1892 | var deduped = []; | |
1893 | goog.array.removeDuplicates(arr, deduped); | |
1894 | return arr.length != deduped.length; | |
1895 | }; | |
1896 | goog.iter.permutations = function $goog$iter$permutations$(iterable, opt_length) { | |
1897 | var elements = goog.iter.toArray(iterable), length = goog.isNumber(opt_length) ? opt_length : elements.length, sets = goog.array.repeat(elements, length), product = goog.iter.product.apply(void 0, sets); | |
1898 | return goog.iter.filter(product, function(arr) { | |
1899 | return!goog.iter.hasDuplicates_(arr); | |
1900 | }); | |
1901 | }; | |
1902 | goog.iter.combinations = function $goog$iter$combinations$(iterable, length) { | |
1903 | function getIndexFromElements(index) { | |
1904 | return elements[index]; | |
1905 | } | |
1906 | var elements = goog.iter.toArray(iterable), indexes = goog.iter.range(elements.length), indexIterator = goog.iter.permutations(indexes, length), sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) { | |
1907 | return goog.array.isSorted(arr); | |
1908 | }), iter = new goog.iter.Iterator; | |
1909 | iter.next = function $iter$next$() { | |
1910 | return goog.array.map(sortedIndexIterator.next(), getIndexFromElements); | |
1911 | }; | |
1912 | return iter; | |
1913 | }; | |
1914 | goog.iter.combinationsWithReplacement = function $goog$iter$combinationsWithReplacement$(iterable, length) { | |
1915 | function getIndexFromElements(index) { | |
1916 | return elements[index]; | |
1917 | } | |
1918 | var elements = goog.iter.toArray(iterable), indexes = goog.array.range(elements.length), sets = goog.array.repeat(indexes, length), indexIterator = goog.iter.product.apply(void 0, sets), sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) { | |
1919 | return goog.array.isSorted(arr); | |
1920 | }), iter = new goog.iter.Iterator; | |
1921 | iter.next = function $iter$next$() { | |
1922 | return goog.array.map(sortedIndexIterator.next(), getIndexFromElements); | |
1923 | }; | |
1924 | return iter; | |
1925 | }; | |
1926 | goog.object = {}; | |
1927 | goog.object.forEach = function $goog$object$forEach$(obj, f, opt_obj) { | |
1928 | for (var key in obj) { | |
1929 | f.call(opt_obj, obj[key], key, obj); | |
1930 | } | |
1931 | }; | |
1932 | goog.object.filter = function $goog$object$filter$(obj, f, opt_obj) { | |
1933 | var res = {}, key; | |
1934 | for (key in obj) { | |
1935 | f.call(opt_obj, obj[key], key, obj) && (res[key] = obj[key]); | |
1936 | } | |
1937 | return res; | |
1938 | }; | |
1939 | goog.object.map = function $goog$object$map$(obj, f, opt_obj) { | |
1940 | var res = {}, key; | |
1941 | for (key in obj) { | |
1942 | res[key] = f.call(opt_obj, obj[key], key, obj); | |
1943 | } | |
1944 | return res; | |
1945 | }; | |
1946 | goog.object.some = function $goog$object$some$(obj, f, opt_obj) { | |
1947 | for (var key in obj) { | |
1948 | if (f.call(opt_obj, obj[key], key, obj)) { | |
1949 | return!0; | |
1950 | } | |
1951 | } | |
1952 | return!1; | |
1953 | }; | |
1954 | goog.object.every = function $goog$object$every$(obj, f, opt_obj) { | |
1955 | for (var key in obj) { | |
1956 | if (!f.call(opt_obj, obj[key], key, obj)) { | |
1957 | return!1; | |
1958 | } | |
1959 | } | |
1960 | return!0; | |
1961 | }; | |
1962 | goog.object.getCount = function $goog$object$getCount$(obj) { | |
1963 | var rv = 0, key; | |
1964 | for (key in obj) { | |
1965 | rv++; | |
1966 | } | |
1967 | return rv; | |
1968 | }; | |
1969 | goog.object.getAnyKey = function $goog$object$getAnyKey$(obj) { | |
1970 | for (var key in obj) { | |
1971 | return key; | |
1972 | } | |
1973 | }; | |
1974 | goog.object.getAnyValue = function $goog$object$getAnyValue$(obj) { | |
1975 | for (var key in obj) { | |
1976 | return obj[key]; | |
1977 | } | |
1978 | }; | |
1979 | goog.object.contains = function $goog$object$contains$(obj, val) { | |
1980 | return goog.object.containsValue(obj, val); | |
1981 | }; | |
1982 | goog.object.getValues = function $goog$object$getValues$(obj) { | |
1983 | var res = [], i = 0, key; | |
1984 | for (key in obj) { | |
1985 | res[i++] = obj[key]; | |
1986 | } | |
1987 | return res; | |
1988 | }; | |
1989 | goog.object.getKeys = function $goog$object$getKeys$(obj) { | |
1990 | var res = [], i = 0, key; | |
1991 | for (key in obj) { | |
1992 | res[i++] = key; | |
1993 | } | |
1994 | return res; | |
1995 | }; | |
1996 | goog.object.getValueByKeys = function $goog$object$getValueByKeys$(obj, var_args) { | |
1997 | for (var isArrayLike = goog.isArrayLike(var_args), keys = isArrayLike ? var_args : arguments, i = isArrayLike ? 0 : 1;i < keys.length && (obj = obj[keys[i]], goog.isDef(obj));i++) { | |
1998 | } | |
1999 | return obj; | |
2000 | }; | |
2001 | goog.object.containsKey = function $goog$object$containsKey$(obj, key) { | |
2002 | return key in obj; | |
2003 | }; | |
2004 | goog.object.containsValue = function $goog$object$containsValue$(obj, val) { | |
2005 | for (var key in obj) { | |
2006 | if (obj[key] == val) { | |
2007 | return!0; | |
2008 | } | |
2009 | } | |
2010 | return!1; | |
2011 | }; | |
2012 | goog.object.findKey = function $goog$object$findKey$(obj, f, opt_this) { | |
2013 | for (var key in obj) { | |
2014 | if (f.call(opt_this, obj[key], key, obj)) { | |
2015 | return key; | |
2016 | } | |
2017 | } | |
2018 | }; | |
2019 | goog.object.findValue = function $goog$object$findValue$(obj, f, opt_this) { | |
2020 | var key = goog.object.findKey(obj, f, opt_this); | |
2021 | return key && obj[key]; | |
2022 | }; | |
2023 | goog.object.isEmpty = function $goog$object$isEmpty$(obj) { | |
2024 | for (var key in obj) { | |
2025 | return!1; | |
2026 | } | |
2027 | return!0; | |
2028 | }; | |
2029 | goog.object.clear = function $goog$object$clear$(obj) { | |
2030 | for (var i in obj) { | |
2031 | delete obj[i]; | |
2032 | } | |
2033 | }; | |
2034 | goog.object.remove = function $goog$object$remove$(obj, key) { | |
2035 | var rv; | |
2036 | (rv = key in obj) && delete obj[key]; | |
2037 | return rv; | |
2038 | }; | |
2039 | goog.object.add = function $goog$object$add$(obj, key, val) { | |
2040 | if (key in obj) { | |
2041 | throw Error('The object already contains the key "' + key + '"'); | |
2042 | } | |
2043 | goog.object.set(obj, key, val); | |
2044 | }; | |
2045 | goog.object.get = function $goog$object$get$(obj, key, opt_val) { | |
2046 | return key in obj ? obj[key] : opt_val; | |
2047 | }; | |
2048 | goog.object.set = function $goog$object$set$(obj, key, value) { | |
2049 | obj[key] = value; | |
2050 | }; | |
2051 | goog.object.setIfUndefined = function $goog$object$setIfUndefined$(obj, key, value) { | |
2052 | return key in obj ? obj[key] : obj[key] = value; | |
2053 | }; | |
2054 | goog.object.clone = function $goog$object$clone$(obj) { | |
2055 | var res = {}, key; | |
2056 | for (key in obj) { | |
2057 | res[key] = obj[key]; | |
2058 | } | |
2059 | return res; | |
2060 | }; | |
2061 | goog.object.unsafeClone = function $goog$object$unsafeClone$(obj) { | |
2062 | var type = goog.typeOf(obj); | |
2063 | if ("object" == type || "array" == type) { | |
2064 | if (obj.clone) { | |
2065 | return obj.clone(); | |
2066 | } | |
2067 | var clone = "array" == type ? [] : {}, key; | |
2068 | for (key in obj) { | |
2069 | clone[key] = goog.object.unsafeClone(obj[key]); | |
2070 | } | |
2071 | return clone; | |
2072 | } | |
2073 | return obj; | |
2074 | }; | |
2075 | goog.object.transpose = function $goog$object$transpose$(obj) { | |
2076 | var transposed = {}, key; | |
2077 | for (key in obj) { | |
2078 | transposed[obj[key]] = key; | |
2079 | } | |
2080 | return transposed; | |
2081 | }; | |
2082 | goog.object.PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); | |
2083 | goog.object.extend = function $goog$object$extend$(target, var_args) { | |
2084 | for (var key, source, i = 1;i < arguments.length;i++) { | |
2085 | source = arguments[i]; | |
2086 | for (key in source) { | |
2087 | target[key] = source[key]; | |
2088 | } | |
2089 | for (var j = 0;j < goog.object.PROTOTYPE_FIELDS_.length;j++) { | |
2090 | key = goog.object.PROTOTYPE_FIELDS_[j], Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]); | |
2091 | } | |
2092 | } | |
2093 | }; | |
2094 | goog.object.create = function $goog$object$create$(var_args) { | |
2095 | var argLength = arguments.length; | |
2096 | if (1 == argLength && goog.isArray(arguments[0])) { | |
2097 | return goog.object.create.apply(null, arguments[0]); | |
2098 | } | |
2099 | if (argLength % 2) { | |
2100 | throw Error("Uneven number of arguments"); | |
2101 | } | |
2102 | for (var rv = {}, i = 0;i < argLength;i += 2) { | |
2103 | rv[arguments[i]] = arguments[i + 1]; | |
2104 | } | |
2105 | return rv; | |
2106 | }; | |
2107 | goog.object.createSet = function $goog$object$createSet$(var_args) { | |
2108 | var argLength = arguments.length; | |
2109 | if (1 == argLength && goog.isArray(arguments[0])) { | |
2110 | return goog.object.createSet.apply(null, arguments[0]); | |
2111 | } | |
2112 | for (var rv = {}, i = 0;i < argLength;i++) { | |
2113 | rv[arguments[i]] = !0; | |
2114 | } | |
2115 | return rv; | |
2116 | }; | |
2117 | goog.object.createImmutableView = function $goog$object$createImmutableView$(obj) { | |
2118 | var result = obj; | |
2119 | Object.isFrozen && !Object.isFrozen(obj) && (result = Object.create(obj), Object.freeze(result)); | |
2120 | return result; | |
2121 | }; | |
2122 | goog.object.isImmutableView = function $goog$object$isImmutableView$(obj) { | |
2123 | return!!Object.isFrozen && Object.isFrozen(obj); | |
2124 | }; | |
2125 | goog.structs = {}; | |
2126 | goog.structs.Map = function $goog$structs$Map$(opt_map, var_args) { | |
2127 | this.map_ = {}; | |
2128 | this.keys_ = []; | |
2129 | this.version_ = this.count_ = 0; | |
2130 | var argLength = arguments.length; | |
2131 | if (1 < argLength) { | |
2132 | if (argLength % 2) { | |
2133 | throw Error("Uneven number of arguments"); | |
2134 | } | |
2135 | for (var i = 0;i < argLength;i += 2) { | |
2136 | this.set(arguments[i], arguments[i + 1]); | |
2137 | } | |
2138 | } else { | |
2139 | opt_map && this.addAll(opt_map); | |
2140 | } | |
2141 | }; | |
2142 | goog.structs.Map.prototype.getCount = function $goog$structs$Map$$getCount$() { | |
2143 | return this.count_; | |
2144 | }; | |
2145 | goog.structs.Map.prototype.getValues = function $goog$structs$Map$$getValues$() { | |
2146 | this.cleanupKeysArray_(); | |
2147 | for (var rv = [], i = 0;i < this.keys_.length;i++) { | |
2148 | var key = this.keys_[i]; | |
2149 | rv.push(this.map_[key]); | |
2150 | } | |
2151 | return rv; | |
2152 | }; | |
2153 | goog.structs.Map.prototype.getKeys = function $goog$structs$Map$$getKeys$() { | |
2154 | this.cleanupKeysArray_(); | |
2155 | return this.keys_.concat(); | |
2156 | }; | |
2157 | goog.structs.Map.prototype.containsKey = function $goog$structs$Map$$containsKey$(key) { | |
2158 | return goog.structs.Map.hasKey_(this.map_, key); | |
2159 | }; | |
2160 | goog.structs.Map.prototype.containsValue = function $goog$structs$Map$$containsValue$(val) { | |
2161 | for (var i = 0;i < this.keys_.length;i++) { | |
2162 | var key = this.keys_[i]; | |
2163 | if (goog.structs.Map.hasKey_(this.map_, key) && this.map_[key] == val) { | |
2164 | return!0; | |
2165 | } | |
2166 | } | |
2167 | return!1; | |
2168 | }; | |
2169 | goog.structs.Map.prototype.equals = function $goog$structs$Map$$equals$(otherMap, opt_equalityFn) { | |
2170 | if (this === otherMap) { | |
2171 | return!0; | |
2172 | } | |
2173 | if (this.count_ != otherMap.getCount()) { | |
2174 | return!1; | |
2175 | } | |
2176 | var equalityFn = opt_equalityFn || goog.structs.Map.defaultEquals; | |
2177 | this.cleanupKeysArray_(); | |
2178 | for (var key, i = 0;key = this.keys_[i];i++) { | |
2179 | if (!equalityFn(this.get(key), otherMap.get(key))) { | |
2180 | return!1; | |
2181 | } | |
2182 | } | |
2183 | return!0; | |
2184 | }; | |
2185 | goog.structs.Map.defaultEquals = function $goog$structs$Map$defaultEquals$(a, b) { | |
2186 | return a === b; | |
2187 | }; | |
2188 | goog.structs.Map.prototype.isEmpty = function $goog$structs$Map$$isEmpty$() { | |
2189 | return 0 == this.count_; | |
2190 | }; | |
2191 | goog.structs.Map.prototype.clear = function $goog$structs$Map$$clear$() { | |
2192 | this.map_ = {}; | |
2193 | this.version_ = this.count_ = this.keys_.length = 0; | |
2194 | }; | |
2195 | goog.structs.Map.prototype.remove = function $goog$structs$Map$$remove$(key) { | |
2196 | return goog.structs.Map.hasKey_(this.map_, key) ? (delete this.map_[key], this.count_--, this.version_++, this.keys_.length > 2 * this.count_ && this.cleanupKeysArray_(), !0) : !1; | |
2197 | }; | |
2198 | goog.structs.Map.prototype.cleanupKeysArray_ = function $goog$structs$Map$$cleanupKeysArray_$() { | |
2199 | if (this.count_ != this.keys_.length) { | |
2200 | for (var srcIndex = 0, destIndex = 0;srcIndex < this.keys_.length;) { | |
2201 | var key = this.keys_[srcIndex]; | |
2202 | goog.structs.Map.hasKey_(this.map_, key) && (this.keys_[destIndex++] = key); | |
2203 | srcIndex++; | |
2204 | } | |
2205 | this.keys_.length = destIndex; | |
2206 | } | |
2207 | if (this.count_ != this.keys_.length) { | |
2208 | for (var seen = {}, destIndex = srcIndex = 0;srcIndex < this.keys_.length;) { | |
2209 | key = this.keys_[srcIndex], goog.structs.Map.hasKey_(seen, key) || (this.keys_[destIndex++] = key, seen[key] = 1), srcIndex++; | |
2210 | } | |
2211 | this.keys_.length = destIndex; | |
2212 | } | |
2213 | }; | |
2214 | goog.structs.Map.prototype.get = function $goog$structs$Map$$get$(key, opt_val) { | |
2215 | return goog.structs.Map.hasKey_(this.map_, key) ? this.map_[key] : opt_val; | |
2216 | }; | |
2217 | goog.structs.Map.prototype.set = function $goog$structs$Map$$set$(key, value) { | |
2218 | goog.structs.Map.hasKey_(this.map_, key) || (this.count_++, this.keys_.push(key), this.version_++); | |
2219 | this.map_[key] = value; | |
2220 | }; | |
2221 | goog.structs.Map.prototype.addAll = function $goog$structs$Map$$addAll$(map) { | |
2222 | var keys, values; | |
2223 | map instanceof goog.structs.Map ? (keys = map.getKeys(), values = map.getValues()) : (keys = goog.object.getKeys(map), values = goog.object.getValues(map)); | |
2224 | for (var i = 0;i < keys.length;i++) { | |
2225 | this.set(keys[i], values[i]); | |
2226 | } | |
2227 | }; | |
2228 | goog.structs.Map.prototype.forEach = function $goog$structs$Map$$forEach$(f, opt_obj) { | |
2229 | for (var keys = this.getKeys(), i = 0;i < keys.length;i++) { | |
2230 | var key = keys[i], value = this.get(key); | |
2231 | f.call(opt_obj, value, key, this); | |
2232 | } | |
2233 | }; | |
2234 | goog.structs.Map.prototype.clone = function $goog$structs$Map$$clone$() { | |
2235 | return new goog.structs.Map(this); | |
2236 | }; | |
2237 | goog.structs.Map.prototype.transpose = function $goog$structs$Map$$transpose$() { | |
2238 | for (var transposed = new goog.structs.Map, i = 0;i < this.keys_.length;i++) { | |
2239 | var key = this.keys_[i], value = this.map_[key]; | |
2240 | transposed.set(value, key); | |
2241 | } | |
2242 | return transposed; | |
2243 | }; | |
2244 | goog.structs.Map.prototype.toObject = function $goog$structs$Map$$toObject$() { | |
2245 | this.cleanupKeysArray_(); | |
2246 | for (var obj = {}, i = 0;i < this.keys_.length;i++) { | |
2247 | var key = this.keys_[i]; | |
2248 | obj[key] = this.map_[key]; | |
2249 | } | |
2250 | return obj; | |
2251 | }; | |
2252 | goog.structs.Map.prototype.__iterator__ = function $goog$structs$Map$$__iterator__$(opt_keys) { | |
2253 | this.cleanupKeysArray_(); | |
2254 | var i = 0, keys = this.keys_, map = this.map_, version = this.version_, selfObj = this, newIter = new goog.iter.Iterator; | |
2255 | newIter.next = function $newIter$next$() { | |
2256 | for (;;) { | |
2257 | if (version != selfObj.version_) { | |
2258 | throw Error("The map has changed since the iterator was created"); | |
2259 | } | |
2260 | if (i >= keys.length) { | |
2261 | throw goog.iter.StopIteration; | |
2262 | } | |
2263 | var key = keys[i++]; | |
2264 | return opt_keys ? key : map[key]; | |
2265 | } | |
2266 | }; | |
2267 | return newIter; | |
2268 | }; | |
2269 | goog.structs.Map.hasKey_ = function $goog$structs$Map$hasKey_$(obj, key) { | |
2270 | return Object.prototype.hasOwnProperty.call(obj, key); | |
2271 | }; | |
2272 | goog.structs.getCount = function $goog$structs$getCount$(col) { | |
2273 | return "function" == typeof col.getCount ? col.getCount() : goog.isArrayLike(col) || goog.isString(col) ? col.length : goog.object.getCount(col); | |
2274 | }; | |
2275 | goog.structs.getValues = function $goog$structs$getValues$(col) { | |
2276 | if ("function" == typeof col.getValues) { | |
2277 | return col.getValues(); | |
2278 | } | |
2279 | if (goog.isString(col)) { | |
2280 | return col.split(""); | |
2281 | } | |
2282 | if (goog.isArrayLike(col)) { | |
2283 | for (var rv = [], l = col.length, i = 0;i < l;i++) { | |
2284 | rv.push(col[i]); | |
2285 | } | |
2286 | return rv; | |
2287 | } | |
2288 | return goog.object.getValues(col); | |
2289 | }; | |
2290 | goog.structs.getKeys = function $goog$structs$getKeys$(col) { | |
2291 | if ("function" == typeof col.getKeys) { | |
2292 | return col.getKeys(); | |
2293 | } | |
2294 | if ("function" != typeof col.getValues) { | |
2295 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2296 | for (var rv = [], l = col.length, i = 0;i < l;i++) { | |
2297 | rv.push(i); | |
2298 | } | |
2299 | return rv; | |
2300 | } | |
2301 | return goog.object.getKeys(col); | |
2302 | } | |
2303 | }; | |
2304 | goog.structs.contains = function $goog$structs$contains$(col, val) { | |
2305 | return "function" == typeof col.contains ? col.contains(val) : "function" == typeof col.containsValue ? col.containsValue(val) : goog.isArrayLike(col) || goog.isString(col) ? goog.array.contains(col, val) : goog.object.containsValue(col, val); | |
2306 | }; | |
2307 | goog.structs.isEmpty = function $goog$structs$isEmpty$(col) { | |
2308 | return "function" == typeof col.isEmpty ? col.isEmpty() : goog.isArrayLike(col) || goog.isString(col) ? goog.array.isEmpty(col) : goog.object.isEmpty(col); | |
2309 | }; | |
2310 | goog.structs.clear = function $goog$structs$clear$(col) { | |
2311 | "function" == typeof col.clear ? col.clear() : goog.isArrayLike(col) ? goog.array.clear(col) : goog.object.clear(col); | |
2312 | }; | |
2313 | goog.structs.forEach = function $goog$structs$forEach$(col, f, opt_obj) { | |
2314 | if ("function" == typeof col.forEach) { | |
2315 | col.forEach(f, opt_obj); | |
2316 | } else { | |
2317 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2318 | goog.array.forEach(col, f, opt_obj); | |
2319 | } else { | |
2320 | for (var keys = goog.structs.getKeys(col), values = goog.structs.getValues(col), l = values.length, i = 0;i < l;i++) { | |
2321 | f.call(opt_obj, values[i], keys && keys[i], col); | |
2322 | } | |
2323 | } | |
2324 | } | |
2325 | }; | |
2326 | goog.structs.filter = function $goog$structs$filter$(col, f, opt_obj) { | |
2327 | if ("function" == typeof col.filter) { | |
2328 | return col.filter(f, opt_obj); | |
2329 | } | |
2330 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2331 | return goog.array.filter(col, f, opt_obj); | |
2332 | } | |
2333 | var rv, keys = goog.structs.getKeys(col), values = goog.structs.getValues(col), l = values.length; | |
2334 | if (keys) { | |
2335 | rv = {}; | |
2336 | for (var i = 0;i < l;i++) { | |
2337 | f.call(opt_obj, values[i], keys[i], col) && (rv[keys[i]] = values[i]); | |
2338 | } | |
2339 | } else { | |
2340 | for (rv = [], i = 0;i < l;i++) { | |
2341 | f.call(opt_obj, values[i], void 0, col) && rv.push(values[i]); | |
2342 | } | |
2343 | } | |
2344 | return rv; | |
2345 | }; | |
2346 | goog.structs.map = function $goog$structs$map$(col, f, opt_obj) { | |
2347 | if ("function" == typeof col.map) { | |
2348 | return col.map(f, opt_obj); | |
2349 | } | |
2350 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2351 | return goog.array.map(col, f, opt_obj); | |
2352 | } | |
2353 | var rv, keys = goog.structs.getKeys(col), values = goog.structs.getValues(col), l = values.length; | |
2354 | if (keys) { | |
2355 | rv = {}; | |
2356 | for (var i = 0;i < l;i++) { | |
2357 | rv[keys[i]] = f.call(opt_obj, values[i], keys[i], col); | |
2358 | } | |
2359 | } else { | |
2360 | for (rv = [], i = 0;i < l;i++) { | |
2361 | rv[i] = f.call(opt_obj, values[i], void 0, col); | |
2362 | } | |
2363 | } | |
2364 | return rv; | |
2365 | }; | |
2366 | goog.structs.some = function $goog$structs$some$(col, f, opt_obj) { | |
2367 | if ("function" == typeof col.some) { | |
2368 | return col.some(f, opt_obj); | |
2369 | } | |
2370 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2371 | return goog.array.some(col, f, opt_obj); | |
2372 | } | |
2373 | for (var keys = goog.structs.getKeys(col), values = goog.structs.getValues(col), l = values.length, i = 0;i < l;i++) { | |
2374 | if (f.call(opt_obj, values[i], keys && keys[i], col)) { | |
2375 | return!0; | |
2376 | } | |
2377 | } | |
2378 | return!1; | |
2379 | }; | |
2380 | goog.structs.every = function $goog$structs$every$(col, f, opt_obj) { | |
2381 | if ("function" == typeof col.every) { | |
2382 | return col.every(f, opt_obj); | |
2383 | } | |
2384 | if (goog.isArrayLike(col) || goog.isString(col)) { | |
2385 | return goog.array.every(col, f, opt_obj); | |
2386 | } | |
2387 | for (var keys = goog.structs.getKeys(col), values = goog.structs.getValues(col), l = values.length, i = 0;i < l;i++) { | |
2388 | if (!f.call(opt_obj, values[i], keys && keys[i], col)) { | |
2389 | return!1; | |
2390 | } | |
2391 | } | |
2392 | return!0; | |
2393 | }; | |
2394 | goog.labs = {}; | |
2395 | goog.labs.userAgent = {}; | |
2396 | goog.labs.userAgent.util = {}; | |
2397 | goog.labs.userAgent.util.getNativeUserAgentString_ = function $goog$labs$userAgent$util$getNativeUserAgentString_$() { | |
2398 | var navigator = goog.labs.userAgent.util.getNavigator_(); | |
2399 | if (navigator) { | |
2400 | var userAgent = navigator.userAgent; | |
2401 | if (userAgent) { | |
2402 | return userAgent; | |
2403 | } | |
2404 | } | |
2405 | return ""; | |
2406 | }; | |
2407 | goog.labs.userAgent.util.getNavigator_ = function $goog$labs$userAgent$util$getNavigator_$() { | |
2408 | return goog.global.navigator; | |
2409 | }; | |
2410 | goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_(); | |
2411 | goog.labs.userAgent.util.setUserAgent = function $goog$labs$userAgent$util$setUserAgent$(opt_userAgent) { | |
2412 | goog.labs.userAgent.util.userAgent_ = opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_(); | |
2413 | }; | |
2414 | goog.labs.userAgent.util.getUserAgent = function $goog$labs$userAgent$util$getUserAgent$() { | |
2415 | return goog.labs.userAgent.util.userAgent_; | |
2416 | }; | |
2417 | goog.labs.userAgent.util.matchUserAgent = function $goog$labs$userAgent$util$matchUserAgent$(str) { | |
2418 | var userAgent = goog.labs.userAgent.util.getUserAgent(); | |
2419 | return goog.string.contains(userAgent, str); | |
2420 | }; | |
2421 | goog.labs.userAgent.util.matchUserAgentIgnoreCase = function $goog$labs$userAgent$util$matchUserAgentIgnoreCase$(str) { | |
2422 | var userAgent = goog.labs.userAgent.util.getUserAgent(); | |
2423 | return goog.string.caseInsensitiveContains(userAgent, str); | |
2424 | }; | |
2425 | goog.labs.userAgent.util.extractVersionTuples = function $goog$labs$userAgent$util$extractVersionTuples$(userAgent) { | |
2426 | for (var versionRegExp = RegExp("(\\w[\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?", "g"), data = [], match;match = versionRegExp.exec(userAgent);) { | |
2427 | data.push([match[1], match[2], match[3] || void 0]); | |
2428 | } | |
2429 | return data; | |
2430 | }; | |
2431 | goog.labs.userAgent.browser = {}; | |
2432 | goog.labs.userAgent.browser.matchOpera_ = function $goog$labs$userAgent$browser$matchOpera_$() { | |
2433 | return goog.labs.userAgent.util.matchUserAgent("Opera") || goog.labs.userAgent.util.matchUserAgent("OPR"); | |
2434 | }; | |
2435 | goog.labs.userAgent.browser.matchIE_ = function $goog$labs$userAgent$browser$matchIE_$() { | |
2436 | return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE"); | |
2437 | }; | |
2438 | goog.labs.userAgent.browser.matchFirefox_ = function $goog$labs$userAgent$browser$matchFirefox_$() { | |
2439 | return goog.labs.userAgent.util.matchUserAgent("Firefox"); | |
2440 | }; | |
2441 | goog.labs.userAgent.browser.matchSafari_ = function $goog$labs$userAgent$browser$matchSafari_$() { | |
2442 | return goog.labs.userAgent.util.matchUserAgent("Safari") && !goog.labs.userAgent.util.matchUserAgent("Chrome") && !goog.labs.userAgent.util.matchUserAgent("CriOS") && !goog.labs.userAgent.util.matchUserAgent("Android"); | |
2443 | }; | |
2444 | goog.labs.userAgent.browser.matchChrome_ = function $goog$labs$userAgent$browser$matchChrome_$() { | |
2445 | return goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS"); | |
2446 | }; | |
2447 | goog.labs.userAgent.browser.matchAndroidBrowser_ = function $goog$labs$userAgent$browser$matchAndroidBrowser_$() { | |
2448 | return goog.labs.userAgent.util.matchUserAgent("Android") && !goog.labs.userAgent.util.matchUserAgent("Chrome") && !goog.labs.userAgent.util.matchUserAgent("CriOS"); | |
2449 | }; | |
2450 | goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_; | |
2451 | goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_; | |
2452 | goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_; | |
2453 | goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_; | |
2454 | goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_; | |
2455 | goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_; | |
2456 | goog.labs.userAgent.browser.isSilk = function $goog$labs$userAgent$browser$isSilk$() { | |
2457 | return goog.labs.userAgent.util.matchUserAgent("Silk"); | |
2458 | }; | |
2459 | goog.labs.userAgent.browser.getVersion = function $goog$labs$userAgent$browser$getVersion$() { | |
2460 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); | |
2461 | if (goog.labs.userAgent.browser.isIE()) { | |
2462 | return goog.labs.userAgent.browser.getIEVersion_(userAgentString); | |
2463 | } | |
2464 | if (goog.labs.userAgent.browser.isOpera()) { | |
2465 | return goog.labs.userAgent.browser.getOperaVersion_(userAgentString); | |
2466 | } | |
2467 | var versionTuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString); | |
2468 | return goog.labs.userAgent.browser.getVersionFromTuples_(versionTuples); | |
2469 | }; | |
2470 | goog.labs.userAgent.browser.isVersionOrHigher = function $goog$labs$userAgent$browser$isVersionOrHigher$(version) { | |
2471 | return 0 <= goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(), version); | |
2472 | }; | |
2473 | goog.labs.userAgent.browser.getIEVersion_ = function $goog$labs$userAgent$browser$getIEVersion_$(userAgent) { | |
2474 | var rv = /rv: *([\d\.]*)/.exec(userAgent); | |
2475 | if (rv && rv[1]) { | |
2476 | return rv[1]; | |
2477 | } | |
2478 | var version = "", msie = /MSIE +([\d\.]+)/.exec(userAgent); | |
2479 | if (msie && msie[1]) { | |
2480 | var tridentVersion = /Trident\/(\d.\d)/.exec(userAgent); | |
2481 | if ("7.0" == msie[1]) { | |
2482 | if (tridentVersion && tridentVersion[1]) { | |
2483 | switch(tridentVersion[1]) { | |
2484 | case "4.0": | |
2485 | version = "8.0"; | |
2486 | break; | |
2487 | case "5.0": | |
2488 | version = "9.0"; | |
2489 | break; | |
2490 | case "6.0": | |
2491 | version = "10.0"; | |
2492 | break; | |
2493 | case "7.0": | |
2494 | version = "11.0"; | |
2495 | } | |
2496 | } else { | |
2497 | version = "7.0"; | |
2498 | } | |
2499 | } else { | |
2500 | version = msie[1]; | |
2501 | } | |
2502 | } | |
2503 | return version; | |
2504 | }; | |
2505 | goog.labs.userAgent.browser.getOperaVersion_ = function $goog$labs$userAgent$browser$getOperaVersion_$(userAgent) { | |
2506 | var versionTuples = goog.labs.userAgent.util.extractVersionTuples(userAgent), lastTuple = goog.array.peek(versionTuples); | |
2507 | return "OPR" == lastTuple[0] && lastTuple[1] ? lastTuple[1] : goog.labs.userAgent.browser.getVersionFromTuples_(versionTuples); | |
2508 | }; | |
2509 | goog.labs.userAgent.browser.getVersionFromTuples_ = function $goog$labs$userAgent$browser$getVersionFromTuples_$(versionTuples) { | |
2510 | goog.asserts.assert(2 < versionTuples.length, "Couldn't extract version tuple from user agent string"); | |
2511 | return versionTuples[2] && versionTuples[2][1] ? versionTuples[2][1] : ""; | |
2512 | }; | |
2513 | goog.labs.userAgent.engine = {}; | |
2514 | goog.labs.userAgent.engine.isPresto = function $goog$labs$userAgent$engine$isPresto$() { | |
2515 | return goog.labs.userAgent.util.matchUserAgent("Presto"); | |
2516 | }; | |
2517 | goog.labs.userAgent.engine.isTrident = function $goog$labs$userAgent$engine$isTrident$() { | |
2518 | return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE"); | |
2519 | }; | |
2520 | goog.labs.userAgent.engine.isWebKit = function $goog$labs$userAgent$engine$isWebKit$() { | |
2521 | return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit"); | |
2522 | }; | |
2523 | goog.labs.userAgent.engine.isGecko = function $goog$labs$userAgent$engine$isGecko$() { | |
2524 | return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident(); | |
2525 | }; | |
2526 | goog.labs.userAgent.engine.getVersion = function $goog$labs$userAgent$engine$getVersion$() { | |
2527 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); | |
2528 | if (userAgentString) { | |
2529 | var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString), engineTuple = tuples[1]; | |
2530 | if (engineTuple) { | |
2531 | return "Gecko" == engineTuple[0] ? goog.labs.userAgent.engine.getVersionForKey_(tuples, "Firefox") : engineTuple[1]; | |
2532 | } | |
2533 | var browserTuple = tuples[0], info; | |
2534 | if (browserTuple && (info = browserTuple[2])) { | |
2535 | var match = /Trident\/([^\s;]+)/.exec(info); | |
2536 | if (match) { | |
2537 | return match[1]; | |
2538 | } | |
2539 | } | |
2540 | } | |
2541 | return ""; | |
2542 | }; | |
2543 | goog.labs.userAgent.engine.isVersionOrHigher = function $goog$labs$userAgent$engine$isVersionOrHigher$(version) { | |
2544 | return 0 <= goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), version); | |
2545 | }; | |
2546 | goog.labs.userAgent.engine.getVersionForKey_ = function $goog$labs$userAgent$engine$getVersionForKey_$(tuples, key) { | |
2547 | var pair$$0 = goog.array.find(tuples, function(pair) { | |
2548 | return key == pair[0]; | |
2549 | }); | |
2550 | return pair$$0 && pair$$0[1] || ""; | |
2551 | }; | |
2552 | goog.userAgent = {}; | |
2553 | goog.userAgent.ASSUME_IE = !1; | |
2554 | goog.userAgent.ASSUME_GECKO = !1; | |
2555 | goog.userAgent.ASSUME_WEBKIT = !1; | |
2556 | goog.userAgent.ASSUME_MOBILE_WEBKIT = !1; | |
2557 | goog.userAgent.ASSUME_OPERA = !1; | |
2558 | goog.userAgent.ASSUME_ANY_VERSION = !1; | |
2559 | goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA; | |
2560 | goog.userAgent.getUserAgentString = function $goog$userAgent$getUserAgentString$() { | |
2561 | return goog.labs.userAgent.util.getUserAgent(); | |
2562 | }; | |
2563 | goog.userAgent.getNavigator = function $goog$userAgent$getNavigator$() { | |
2564 | return goog.global.navigator || null; | |
2565 | }; | |
2566 | goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera(); | |
2567 | goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE(); | |
2568 | goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko(); | |
2569 | goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit(); | |
2570 | goog.userAgent.isMobile_ = function $goog$userAgent$isMobile_$() { | |
2571 | return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile"); | |
2572 | }; | |
2573 | goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_(); | |
2574 | goog.userAgent.SAFARI = goog.userAgent.WEBKIT; | |
2575 | goog.userAgent.determinePlatform_ = function $goog$userAgent$determinePlatform_$() { | |
2576 | var navigator = goog.userAgent.getNavigator(); | |
2577 | return navigator && navigator.platform || ""; | |
2578 | }; | |
2579 | goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_(); | |
2580 | goog.userAgent.ASSUME_MAC = !1; | |
2581 | goog.userAgent.ASSUME_WINDOWS = !1; | |
2582 | goog.userAgent.ASSUME_LINUX = !1; | |
2583 | goog.userAgent.ASSUME_X11 = !1; | |
2584 | goog.userAgent.ASSUME_ANDROID = !1; | |
2585 | goog.userAgent.ASSUME_IPHONE = !1; | |
2586 | goog.userAgent.ASSUME_IPAD = !1; | |
2587 | goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD; | |
2588 | goog.userAgent.initPlatform_ = function $goog$userAgent$initPlatform_$() { | |
2589 | goog.userAgent.detectedMac_ = goog.string.contains(goog.userAgent.PLATFORM, "Mac"); | |
2590 | goog.userAgent.detectedWindows_ = goog.string.contains(goog.userAgent.PLATFORM, "Win"); | |
2591 | goog.userAgent.detectedLinux_ = goog.string.contains(goog.userAgent.PLATFORM, "Linux"); | |
2592 | goog.userAgent.detectedX11_ = !!goog.userAgent.getNavigator() && goog.string.contains(goog.userAgent.getNavigator().appVersion || "", "X11"); | |
2593 | var ua = goog.userAgent.getUserAgentString(); | |
2594 | goog.userAgent.detectedAndroid_ = !!ua && goog.string.contains(ua, "Android"); | |
2595 | goog.userAgent.detectedIPhone_ = !!ua && goog.string.contains(ua, "iPhone"); | |
2596 | goog.userAgent.detectedIPad_ = !!ua && goog.string.contains(ua, "iPad"); | |
2597 | }; | |
2598 | goog.userAgent.PLATFORM_KNOWN_ || goog.userAgent.initPlatform_(); | |
2599 | goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.userAgent.detectedMac_; | |
2600 | goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.userAgent.detectedWindows_; | |
2601 | goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.detectedLinux_; | |
2602 | goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.detectedX11_; | |
2603 | goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.userAgent.detectedAndroid_; | |
2604 | goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.userAgent.detectedIPhone_; | |
2605 | goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.userAgent.detectedIPad_; | |
2606 | goog.userAgent.determineVersion_ = function $goog$userAgent$determineVersion_$() { | |
2607 | var version = "", re; | |
2608 | if (goog.userAgent.OPERA && goog.global.opera) { | |
2609 | var operaVersion = goog.global.opera.version; | |
2610 | return goog.isFunction(operaVersion) ? operaVersion() : operaVersion; | |
2611 | } | |
2612 | goog.userAgent.GECKO ? re = /rv\:([^\);]+)(\)|;)/ : goog.userAgent.IE ? re = /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/ : goog.userAgent.WEBKIT && (re = /WebKit\/(\S+)/); | |
2613 | if (re) { | |
2614 | var arr = re.exec(goog.userAgent.getUserAgentString()), version = arr ? arr[1] : "" | |
2615 | } | |
2616 | if (goog.userAgent.IE) { | |
2617 | var docMode = goog.userAgent.getDocumentMode_(); | |
2618 | if (docMode > parseFloat(version)) { | |
2619 | return String(docMode); | |
2620 | } | |
2621 | } | |
2622 | return version; | |
2623 | }; | |
2624 | goog.userAgent.getDocumentMode_ = function $goog$userAgent$getDocumentMode_$() { | |
2625 | var doc = goog.global.document; | |
2626 | return doc ? doc.documentMode : void 0; | |
2627 | }; | |
2628 | goog.userAgent.VERSION = goog.userAgent.determineVersion_(); | |
2629 | goog.userAgent.compare = function $goog$userAgent$compare$(v1, v2) { | |
2630 | return goog.string.compareVersions(v1, v2); | |
2631 | }; | |
2632 | goog.userAgent.isVersionOrHigherCache_ = {}; | |
2633 | goog.userAgent.isVersionOrHigher = function $goog$userAgent$isVersionOrHigher$(version) { | |
2634 | return goog.userAgent.ASSUME_ANY_VERSION || goog.userAgent.isVersionOrHigherCache_[version] || (goog.userAgent.isVersionOrHigherCache_[version] = 0 <= goog.string.compareVersions(goog.userAgent.VERSION, version)); | |
2635 | }; | |
2636 | goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher; | |
2637 | goog.userAgent.isDocumentModeOrHigher = function $goog$userAgent$isDocumentModeOrHigher$(documentMode) { | |
2638 | return goog.userAgent.IE && goog.userAgent.DOCUMENT_MODE >= documentMode; | |
2639 | }; | |
2640 | goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher; | |
2641 | var JSCompiler_inline_result$$0; | |
2642 | var doc$$inline_1 = goog.global.document; | |
2643 | if (doc$$inline_1 && goog.userAgent.IE) { | |
2644 | var mode$$inline_2 = goog.userAgent.getDocumentMode_(); | |
2645 | JSCompiler_inline_result$$0 = mode$$inline_2 || ("CSS1Compat" == doc$$inline_1.compatMode ? parseInt(goog.userAgent.VERSION, 10) : 5); | |
2646 | } else { | |
2647 | JSCompiler_inline_result$$0 = void 0; | |
2648 | } | |
2649 | goog.userAgent.DOCUMENT_MODE = JSCompiler_inline_result$$0; | |
2650 | goog.uri = {}; | |
2651 | goog.uri.utils = {}; | |
2652 | goog.uri.utils.CharCode_ = {AMPERSAND:38, EQUAL:61, HASH:35, QUESTION:63}; | |
2653 | goog.uri.utils.buildFromEncodedParts = function $goog$uri$utils$buildFromEncodedParts$(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { | |
2654 | var out = ""; | |
2655 | opt_scheme && (out += opt_scheme + ":"); | |
2656 | opt_domain && (out += "//", opt_userInfo && (out += opt_userInfo + "@"), out += opt_domain, opt_port && (out += ":" + opt_port)); | |
2657 | opt_path && (out += opt_path); | |
2658 | opt_queryData && (out += "?" + opt_queryData); | |
2659 | opt_fragment && (out += "#" + opt_fragment); | |
2660 | return out; | |
2661 | }; | |
2662 | goog.uri.utils.splitRe_ = RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"); | |
2663 | goog.uri.utils.ComponentIndex = {SCHEME:1, USER_INFO:2, DOMAIN:3, PORT:4, PATH:5, QUERY_DATA:6, FRAGMENT:7}; | |
2664 | goog.uri.utils.split = function $goog$uri$utils$split$(uri) { | |
2665 | goog.uri.utils.phishingProtection_(); | |
2666 | return uri.match(goog.uri.utils.splitRe_); | |
2667 | }; | |
2668 | goog.uri.utils.needsPhishingProtection_ = goog.userAgent.WEBKIT; | |
2669 | goog.uri.utils.phishingProtection_ = function $goog$uri$utils$phishingProtection_$() { | |
2670 | if (goog.uri.utils.needsPhishingProtection_) { | |
2671 | goog.uri.utils.needsPhishingProtection_ = !1; | |
2672 | var location = goog.global.location; | |
2673 | if (location) { | |
2674 | var href = location.href; | |
2675 | if (href) { | |
2676 | var domain = goog.uri.utils.getDomain(href); | |
2677 | if (domain && domain != location.hostname) { | |
2678 | throw goog.uri.utils.needsPhishingProtection_ = !0, Error(); | |
2679 | } | |
2680 | } | |
2681 | } | |
2682 | } | |
2683 | }; | |
2684 | goog.uri.utils.decodeIfPossible_ = function $goog$uri$utils$decodeIfPossible_$(uri) { | |
2685 | return uri && decodeURIComponent(uri); | |
2686 | }; | |
2687 | goog.uri.utils.getComponentByIndex_ = function $goog$uri$utils$getComponentByIndex_$(componentIndex, uri) { | |
2688 | return goog.uri.utils.split(uri)[componentIndex] || null; | |
2689 | }; | |
2690 | goog.uri.utils.getScheme = function $goog$uri$utils$getScheme$(uri) { | |
2691 | return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.SCHEME, uri); | |
2692 | }; | |
2693 | goog.uri.utils.getEffectiveScheme = function $goog$uri$utils$getEffectiveScheme$(uri) { | |
2694 | var scheme = goog.uri.utils.getScheme(uri); | |
2695 | if (!scheme && self.location) { | |
2696 | var protocol = self.location.protocol, scheme = protocol.substr(0, protocol.length - 1) | |
2697 | } | |
2698 | return scheme ? scheme.toLowerCase() : ""; | |
2699 | }; | |
2700 | goog.uri.utils.getUserInfoEncoded = function $goog$uri$utils$getUserInfoEncoded$(uri) { | |
2701 | return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.USER_INFO, uri); | |
2702 | }; | |
2703 | goog.uri.utils.getUserInfo = function $goog$uri$utils$getUserInfo$(uri) { | |
2704 | return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getUserInfoEncoded(uri)); | |
2705 | }; | |
2706 | goog.uri.utils.getDomainEncoded = function $goog$uri$utils$getDomainEncoded$(uri) { | |
2707 | return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.DOMAIN, uri); | |
2708 | }; | |
2709 | goog.uri.utils.getDomain = function $goog$uri$utils$getDomain$(uri) { | |
2710 | return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getDomainEncoded(uri)); | |
2711 | }; | |
2712 | goog.uri.utils.getPort = function $goog$uri$utils$getPort$(uri) { | |
2713 | return Number(goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.PORT, uri)) || null; | |
2714 | }; | |
2715 | goog.uri.utils.getPathEncoded = function $goog$uri$utils$getPathEncoded$(uri) { | |
2716 | return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.PATH, uri); | |
2717 | }; | |
2718 | goog.uri.utils.getPath = function $goog$uri$utils$getPath$(uri) { | |
2719 | return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getPathEncoded(uri)); | |
2720 | }; | |
2721 | goog.uri.utils.getQueryData = function $goog$uri$utils$getQueryData$(uri) { | |
2722 | return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.QUERY_DATA, uri); | |
2723 | }; | |
2724 | goog.uri.utils.getFragmentEncoded = function $goog$uri$utils$getFragmentEncoded$(uri) { | |
2725 | var hashIndex = uri.indexOf("#"); | |
2726 | return 0 > hashIndex ? null : uri.substr(hashIndex + 1); | |
2727 | }; | |
2728 | goog.uri.utils.setFragmentEncoded = function $goog$uri$utils$setFragmentEncoded$(uri, fragment) { | |
2729 | return goog.uri.utils.removeFragment(uri) + (fragment ? "#" + fragment : ""); | |
2730 | }; | |
2731 | goog.uri.utils.getFragment = function $goog$uri$utils$getFragment$(uri) { | |
2732 | return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getFragmentEncoded(uri)); | |
2733 | }; | |
2734 | goog.uri.utils.getHost = function $goog$uri$utils$getHost$(uri) { | |
2735 | var pieces = goog.uri.utils.split(uri); | |
2736 | return goog.uri.utils.buildFromEncodedParts(pieces[goog.uri.utils.ComponentIndex.SCHEME], pieces[goog.uri.utils.ComponentIndex.USER_INFO], pieces[goog.uri.utils.ComponentIndex.DOMAIN], pieces[goog.uri.utils.ComponentIndex.PORT]); | |
2737 | }; | |
2738 | goog.uri.utils.getPathAndAfter = function $goog$uri$utils$getPathAndAfter$(uri) { | |
2739 | var pieces = goog.uri.utils.split(uri); | |
2740 | return goog.uri.utils.buildFromEncodedParts(null, null, null, null, pieces[goog.uri.utils.ComponentIndex.PATH], pieces[goog.uri.utils.ComponentIndex.QUERY_DATA], pieces[goog.uri.utils.ComponentIndex.FRAGMENT]); | |
2741 | }; | |
2742 | goog.uri.utils.removeFragment = function $goog$uri$utils$removeFragment$(uri) { | |
2743 | var hashIndex = uri.indexOf("#"); | |
2744 | return 0 > hashIndex ? uri : uri.substr(0, hashIndex); | |
2745 | }; | |
2746 | goog.uri.utils.haveSameDomain = function $goog$uri$utils$haveSameDomain$(uri1, uri2) { | |
2747 | var pieces1 = goog.uri.utils.split(uri1), pieces2 = goog.uri.utils.split(uri2); | |
2748 | return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && pieces1[goog.uri.utils.ComponentIndex.SCHEME] == pieces2[goog.uri.utils.ComponentIndex.SCHEME] && pieces1[goog.uri.utils.ComponentIndex.PORT] == pieces2[goog.uri.utils.ComponentIndex.PORT]; | |
2749 | }; | |
2750 | goog.uri.utils.assertNoFragmentsOrQueries_ = function $goog$uri$utils$assertNoFragmentsOrQueries_$(uri) { | |
2751 | if (goog.DEBUG && (0 <= uri.indexOf("#") || 0 <= uri.indexOf("?"))) { | |
2752 | throw Error("goog.uri.utils: Fragment or query identifiers are not supported: [" + uri + "]"); | |
2753 | } | |
2754 | }; | |
2755 | goog.uri.utils.appendQueryData_ = function $goog$uri$utils$appendQueryData_$(buffer) { | |
2756 | if (buffer[1]) { | |
2757 | var baseUri = buffer[0], hashIndex = baseUri.indexOf("#"); | |
2758 | 0 <= hashIndex && (buffer.push(baseUri.substr(hashIndex)), buffer[0] = baseUri = baseUri.substr(0, hashIndex)); | |
2759 | var questionIndex = baseUri.indexOf("?"); | |
2760 | 0 > questionIndex ? buffer[1] = "?" : questionIndex == baseUri.length - 1 && (buffer[1] = void 0); | |
2761 | } | |
2762 | return buffer.join(""); | |
2763 | }; | |
2764 | goog.uri.utils.appendKeyValuePairs_ = function $goog$uri$utils$appendKeyValuePairs_$(key, value, pairs) { | |
2765 | if (goog.isArray(value)) { | |
2766 | goog.asserts.assertArray(value); | |
2767 | for (var j = 0;j < value.length;j++) { | |
2768 | goog.uri.utils.appendKeyValuePairs_(key, String(value[j]), pairs); | |
2769 | } | |
2770 | } else { | |
2771 | null != value && pairs.push("&", key, "" === value ? "" : "=", goog.string.urlEncode(value)); | |
2772 | } | |
2773 | }; | |
2774 | goog.uri.utils.buildQueryDataBuffer_ = function $goog$uri$utils$buildQueryDataBuffer_$(buffer, keysAndValues, opt_startIndex) { | |
2775 | goog.asserts.assert(0 == Math.max(keysAndValues.length - (opt_startIndex || 0), 0) % 2, "goog.uri.utils: Key/value lists must be even in length."); | |
2776 | for (var i = opt_startIndex || 0;i < keysAndValues.length;i += 2) { | |
2777 | goog.uri.utils.appendKeyValuePairs_(keysAndValues[i], keysAndValues[i + 1], buffer); | |
2778 | } | |
2779 | return buffer; | |
2780 | }; | |
2781 | goog.uri.utils.buildQueryData = function $goog$uri$utils$buildQueryData$(keysAndValues, opt_startIndex) { | |
2782 | var buffer = goog.uri.utils.buildQueryDataBuffer_([], keysAndValues, opt_startIndex); | |
2783 | buffer[0] = ""; | |
2784 | return buffer.join(""); | |
2785 | }; | |
2786 | goog.uri.utils.buildQueryDataBufferFromMap_ = function $goog$uri$utils$buildQueryDataBufferFromMap_$(buffer, map) { | |
2787 | for (var key in map) { | |
2788 | goog.uri.utils.appendKeyValuePairs_(key, map[key], buffer); | |
2789 | } | |
2790 | return buffer; | |
2791 | }; | |
2792 | goog.uri.utils.buildQueryDataFromMap = function $goog$uri$utils$buildQueryDataFromMap$(map) { | |
2793 | var buffer = goog.uri.utils.buildQueryDataBufferFromMap_([], map); | |
2794 | buffer[0] = ""; | |
2795 | return buffer.join(""); | |
2796 | }; | |
2797 | goog.uri.utils.appendParams = function $goog$uri$utils$appendParams$(uri, var_args) { | |
2798 | return goog.uri.utils.appendQueryData_(2 == arguments.length ? goog.uri.utils.buildQueryDataBuffer_([uri], arguments[1], 0) : goog.uri.utils.buildQueryDataBuffer_([uri], arguments, 1)); | |
2799 | }; | |
2800 | goog.uri.utils.appendParamsFromMap = function $goog$uri$utils$appendParamsFromMap$(uri, map) { | |
2801 | return goog.uri.utils.appendQueryData_(goog.uri.utils.buildQueryDataBufferFromMap_([uri], map)); | |
2802 | }; | |
2803 | goog.uri.utils.appendParam = function $goog$uri$utils$appendParam$(uri, key, opt_value) { | |
2804 | var paramArr = [uri, "&", key]; | |
2805 | goog.isDefAndNotNull(opt_value) && paramArr.push("=", goog.string.urlEncode(opt_value)); | |
2806 | return goog.uri.utils.appendQueryData_(paramArr); | |
2807 | }; | |
2808 | goog.uri.utils.findParam_ = function $goog$uri$utils$findParam_$(uri, startIndex, keyEncoded, hashOrEndIndex) { | |
2809 | for (var index = startIndex, keyLength = keyEncoded.length;0 <= (index = uri.indexOf(keyEncoded, index)) && index < hashOrEndIndex;) { | |
2810 | var precedingChar = uri.charCodeAt(index - 1); | |
2811 | if (precedingChar == goog.uri.utils.CharCode_.AMPERSAND || precedingChar == goog.uri.utils.CharCode_.QUESTION) { | |
2812 | var followingChar = uri.charCodeAt(index + keyLength); | |
2813 | if (!followingChar || followingChar == goog.uri.utils.CharCode_.EQUAL || followingChar == goog.uri.utils.CharCode_.AMPERSAND || followingChar == goog.uri.utils.CharCode_.HASH) { | |
2814 | return index; | |
2815 | } | |
2816 | } | |
2817 | index += keyLength + 1; | |
2818 | } | |
2819 | return-1; | |
2820 | }; | |
2821 | goog.uri.utils.hashOrEndRe_ = /#|$/; | |
2822 | goog.uri.utils.hasParam = function $goog$uri$utils$hasParam$(uri, keyEncoded) { | |
2823 | return 0 <= goog.uri.utils.findParam_(uri, 0, keyEncoded, uri.search(goog.uri.utils.hashOrEndRe_)); | |
2824 | }; | |
2825 | goog.uri.utils.getParamValue = function $goog$uri$utils$getParamValue$(uri, keyEncoded) { | |
2826 | var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_), foundIndex = goog.uri.utils.findParam_(uri, 0, keyEncoded, hashOrEndIndex); | |
2827 | if (0 > foundIndex) { | |
2828 | return null; | |
2829 | } | |
2830 | var endPosition = uri.indexOf("&", foundIndex); | |
2831 | if (0 > endPosition || endPosition > hashOrEndIndex) { | |
2832 | endPosition = hashOrEndIndex; | |
2833 | } | |
2834 | foundIndex += keyEncoded.length + 1; | |
2835 | return goog.string.urlDecode(uri.substr(foundIndex, endPosition - foundIndex)); | |
2836 | }; | |
2837 | goog.uri.utils.getParamValues = function $goog$uri$utils$getParamValues$(uri, keyEncoded) { | |
2838 | for (var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_), position = 0, foundIndex, result = [];0 <= (foundIndex = goog.uri.utils.findParam_(uri, position, keyEncoded, hashOrEndIndex));) { | |
2839 | position = uri.indexOf("&", foundIndex); | |
2840 | if (0 > position || position > hashOrEndIndex) { | |
2841 | position = hashOrEndIndex; | |
2842 | } | |
2843 | foundIndex += keyEncoded.length + 1; | |
2844 | result.push(goog.string.urlDecode(uri.substr(foundIndex, position - foundIndex))); | |
2845 | } | |
2846 | return result; | |
2847 | }; | |
2848 | goog.uri.utils.trailingQueryPunctuationRe_ = /[?&]($|#)/; | |
2849 | goog.uri.utils.removeParam = function $goog$uri$utils$removeParam$(uri, keyEncoded) { | |
2850 | for (var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_), position = 0, foundIndex, buffer = [];0 <= (foundIndex = goog.uri.utils.findParam_(uri, position, keyEncoded, hashOrEndIndex));) { | |
2851 | buffer.push(uri.substring(position, foundIndex)), position = Math.min(uri.indexOf("&", foundIndex) + 1 || hashOrEndIndex, hashOrEndIndex); | |
2852 | } | |
2853 | buffer.push(uri.substr(position)); | |
2854 | return buffer.join("").replace(goog.uri.utils.trailingQueryPunctuationRe_, "$1"); | |
2855 | }; | |
2856 | goog.uri.utils.setParam = function $goog$uri$utils$setParam$(uri, keyEncoded, value) { | |
2857 | return goog.uri.utils.appendParam(goog.uri.utils.removeParam(uri, keyEncoded), keyEncoded, value); | |
2858 | }; | |
2859 | goog.uri.utils.appendPath = function $goog$uri$utils$appendPath$(baseUri, path) { | |
2860 | goog.uri.utils.assertNoFragmentsOrQueries_(baseUri); | |
2861 | goog.string.endsWith(baseUri, "/") && (baseUri = baseUri.substr(0, baseUri.length - 1)); | |
2862 | goog.string.startsWith(path, "/") && (path = path.substr(1)); | |
2863 | return goog.string.buildString(baseUri, "/", path); | |
2864 | }; | |
2865 | goog.uri.utils.setPath = function $goog$uri$utils$setPath$(uri, path) { | |
2866 | goog.string.startsWith(path, "/") || (path = "/" + path); | |
2867 | var parts = goog.uri.utils.split(uri); | |
2868 | return goog.uri.utils.buildFromEncodedParts(parts[goog.uri.utils.ComponentIndex.SCHEME], parts[goog.uri.utils.ComponentIndex.USER_INFO], parts[goog.uri.utils.ComponentIndex.DOMAIN], parts[goog.uri.utils.ComponentIndex.PORT], path, parts[goog.uri.utils.ComponentIndex.QUERY_DATA], parts[goog.uri.utils.ComponentIndex.FRAGMENT]); | |
2869 | }; | |
2870 | goog.uri.utils.StandardQueryParam = {RANDOM:"zx"}; | |
2871 | goog.uri.utils.makeUnique = function $goog$uri$utils$makeUnique$(uri) { | |
2872 | return goog.uri.utils.setParam(uri, goog.uri.utils.StandardQueryParam.RANDOM, goog.string.getRandomString()); | |
2873 | }; | |
2874 | goog.Uri = function $goog$Uri$(opt_uri, opt_ignoreCase) { | |
2875 | var m; | |
2876 | opt_uri instanceof goog.Uri ? (this.ignoreCase_ = goog.isDef(opt_ignoreCase) ? opt_ignoreCase : opt_uri.getIgnoreCase(), this.setScheme(opt_uri.getScheme()), this.setUserInfo(opt_uri.getUserInfo()), this.setDomain(opt_uri.getDomain()), this.setPort(opt_uri.getPort()), this.setPath(opt_uri.getPath()), this.setQueryData(opt_uri.getQueryData().clone()), this.setFragment(opt_uri.getFragment())) : opt_uri && (m = goog.uri.utils.split(String(opt_uri))) ? (this.ignoreCase_ = !!opt_ignoreCase, this.setScheme(m[goog.uri.utils.ComponentIndex.SCHEME] || | |
2877 | "", !0), this.setUserInfo(m[goog.uri.utils.ComponentIndex.USER_INFO] || "", !0), this.setDomain(m[goog.uri.utils.ComponentIndex.DOMAIN] || "", !0), this.setPort(m[goog.uri.utils.ComponentIndex.PORT]), this.setPath(m[goog.uri.utils.ComponentIndex.PATH] || "", !0), this.setQueryData(m[goog.uri.utils.ComponentIndex.QUERY_DATA] || "", !0), this.setFragment(m[goog.uri.utils.ComponentIndex.FRAGMENT] || "", !0)) : (this.ignoreCase_ = !!opt_ignoreCase, this.queryData_ = new goog.Uri.QueryData(null, null, | |
2878 | this.ignoreCase_)); | |
2879 | }; | |
2880 | goog.Uri.preserveParameterTypesCompatibilityFlag = !1; | |
2881 | goog.Uri.RANDOM_PARAM = goog.uri.utils.StandardQueryParam.RANDOM; | |
2882 | goog.Uri.prototype.scheme_ = ""; | |
2883 | goog.Uri.prototype.userInfo_ = ""; | |
2884 | goog.Uri.prototype.domain_ = ""; | |
2885 | goog.Uri.prototype.port_ = null; | |
2886 | goog.Uri.prototype.path_ = ""; | |
2887 | goog.Uri.prototype.fragment_ = ""; | |
2888 | goog.Uri.prototype.isReadOnly_ = !1; | |
2889 | goog.Uri.prototype.ignoreCase_ = !1; | |
2890 | goog.Uri.prototype.toString = function $goog$Uri$$toString$() { | |
2891 | var out = [], scheme = this.getScheme(); | |
2892 | scheme && out.push(goog.Uri.encodeSpecialChars_(scheme, goog.Uri.reDisallowedInSchemeOrUserInfo_), ":"); | |
2893 | var domain = this.getDomain(); | |
2894 | if (domain) { | |
2895 | out.push("//"); | |
2896 | var userInfo = this.getUserInfo(); | |
2897 | userInfo && out.push(goog.Uri.encodeSpecialChars_(userInfo, goog.Uri.reDisallowedInSchemeOrUserInfo_), "@"); | |
2898 | out.push(goog.string.urlEncode(domain)); | |
2899 | var port = this.getPort(); | |
2900 | null != port && out.push(":", String(port)); | |
2901 | } | |
2902 | var path = this.getPath(); | |
2903 | path && (this.hasDomain() && "/" != path.charAt(0) && out.push("/"), out.push(goog.Uri.encodeSpecialChars_(path, "/" == path.charAt(0) ? goog.Uri.reDisallowedInAbsolutePath_ : goog.Uri.reDisallowedInRelativePath_))); | |
2904 | var query = this.getEncodedQuery(); | |
2905 | query && out.push("?", query); | |
2906 | var fragment = this.getFragment(); | |
2907 | fragment && out.push("#", goog.Uri.encodeSpecialChars_(fragment, goog.Uri.reDisallowedInFragment_)); | |
2908 | return out.join(""); | |
2909 | }; | |
2910 | goog.Uri.prototype.resolve = function $goog$Uri$$resolve$(relativeUri) { | |
2911 | var absoluteUri = this.clone(), overridden = relativeUri.hasScheme(); | |
2912 | overridden ? absoluteUri.setScheme(relativeUri.getScheme()) : overridden = relativeUri.hasUserInfo(); | |
2913 | overridden ? absoluteUri.setUserInfo(relativeUri.getUserInfo()) : overridden = relativeUri.hasDomain(); | |
2914 | overridden ? absoluteUri.setDomain(relativeUri.getDomain()) : overridden = relativeUri.hasPort(); | |
2915 | var path = relativeUri.getPath(); | |
2916 | if (overridden) { | |
2917 | absoluteUri.setPort(relativeUri.getPort()); | |
2918 | } else { | |
2919 | if (overridden = relativeUri.hasPath()) { | |
2920 | if ("/" != path.charAt(0)) { | |
2921 | if (this.hasDomain() && !this.hasPath()) { | |
2922 | path = "/" + path; | |
2923 | } else { | |
2924 | var lastSlashIndex = absoluteUri.getPath().lastIndexOf("/"); | |
2925 | -1 != lastSlashIndex && (path = absoluteUri.getPath().substr(0, lastSlashIndex + 1) + path); | |
2926 | } | |
2927 | } | |
2928 | path = goog.Uri.removeDotSegments(path); | |
2929 | } | |
2930 | } | |
2931 | overridden ? absoluteUri.setPath(path) : overridden = relativeUri.hasQuery(); | |
2932 | overridden ? absoluteUri.setQueryData(relativeUri.getDecodedQuery()) : overridden = relativeUri.hasFragment(); | |
2933 | overridden && absoluteUri.setFragment(relativeUri.getFragment()); | |
2934 | return absoluteUri; | |
2935 | }; | |
2936 | goog.Uri.prototype.clone = function $goog$Uri$$clone$() { | |
2937 | return new goog.Uri(this); | |
2938 | }; | |
2939 | goog.Uri.prototype.getScheme = function $goog$Uri$$getScheme$() { | |
2940 | return this.scheme_; | |
2941 | }; | |
2942 | goog.Uri.prototype.setScheme = function $goog$Uri$$setScheme$(newScheme, opt_decode) { | |
2943 | this.enforceReadOnly(); | |
2944 | if (this.scheme_ = opt_decode ? goog.Uri.decodeOrEmpty_(newScheme) : newScheme) { | |
2945 | this.scheme_ = this.scheme_.replace(/:$/, ""); | |
2946 | } | |
2947 | return this; | |
2948 | }; | |
2949 | goog.Uri.prototype.hasScheme = function $goog$Uri$$hasScheme$() { | |
2950 | return!!this.scheme_; | |
2951 | }; | |
2952 | goog.Uri.prototype.getUserInfo = function $goog$Uri$$getUserInfo$() { | |
2953 | return this.userInfo_; | |
2954 | }; | |
2955 | goog.Uri.prototype.setUserInfo = function $goog$Uri$$setUserInfo$(newUserInfo, opt_decode) { | |
2956 | this.enforceReadOnly(); | |
2957 | this.userInfo_ = opt_decode ? goog.Uri.decodeOrEmpty_(newUserInfo) : newUserInfo; | |
2958 | return this; | |
2959 | }; | |
2960 | goog.Uri.prototype.hasUserInfo = function $goog$Uri$$hasUserInfo$() { | |
2961 | return!!this.userInfo_; | |
2962 | }; | |
2963 | goog.Uri.prototype.getDomain = function $goog$Uri$$getDomain$() { | |
2964 | return this.domain_; | |
2965 | }; | |
2966 | goog.Uri.prototype.setDomain = function $goog$Uri$$setDomain$(newDomain, opt_decode) { | |
2967 | this.enforceReadOnly(); | |
2968 | this.domain_ = opt_decode ? goog.Uri.decodeOrEmpty_(newDomain) : newDomain; | |
2969 | return this; | |
2970 | }; | |
2971 | goog.Uri.prototype.hasDomain = function $goog$Uri$$hasDomain$() { | |
2972 | return!!this.domain_; | |
2973 | }; | |
2974 | goog.Uri.prototype.getPort = function $goog$Uri$$getPort$() { | |
2975 | return this.port_; | |
2976 | }; | |
2977 | goog.Uri.prototype.setPort = function $goog$Uri$$setPort$(newPort) { | |
2978 | this.enforceReadOnly(); | |
2979 | if (newPort) { | |
2980 | newPort = Number(newPort); | |
2981 | if (isNaN(newPort) || 0 > newPort) { | |
2982 | throw Error("Bad port number " + newPort); | |
2983 | } | |
2984 | this.port_ = newPort; | |
2985 | } else { | |
2986 | this.port_ = null; | |
2987 | } | |
2988 | return this; | |
2989 | }; | |
2990 | goog.Uri.prototype.hasPort = function $goog$Uri$$hasPort$() { | |
2991 | return null != this.port_; | |
2992 | }; | |
2993 | goog.Uri.prototype.getPath = function $goog$Uri$$getPath$() { | |
2994 | return this.path_; | |
2995 | }; | |
2996 | goog.Uri.prototype.setPath = function $goog$Uri$$setPath$(newPath, opt_decode) { | |
2997 | this.enforceReadOnly(); | |
2998 | this.path_ = opt_decode ? goog.Uri.decodeOrEmpty_(newPath) : newPath; | |
2999 | return this; | |
3000 | }; | |
3001 | goog.Uri.prototype.hasPath = function $goog$Uri$$hasPath$() { | |
3002 | return!!this.path_; | |
3003 | }; | |
3004 | goog.Uri.prototype.hasQuery = function $goog$Uri$$hasQuery$() { | |
3005 | return "" !== this.queryData_.toString(); | |
3006 | }; | |
3007 | goog.Uri.prototype.setQueryData = function $goog$Uri$$setQueryData$(queryData, opt_decode) { | |
3008 | this.enforceReadOnly(); | |
3009 | queryData instanceof goog.Uri.QueryData ? (this.queryData_ = queryData, this.queryData_.setIgnoreCase(this.ignoreCase_)) : (opt_decode || (queryData = goog.Uri.encodeSpecialChars_(queryData, goog.Uri.reDisallowedInQuery_)), this.queryData_ = new goog.Uri.QueryData(queryData, null, this.ignoreCase_)); | |
3010 | return this; | |
3011 | }; | |
3012 | goog.Uri.prototype.getEncodedQuery = function $goog$Uri$$getEncodedQuery$() { | |
3013 | return this.queryData_.toString(); | |
3014 | }; | |
3015 | goog.Uri.prototype.getDecodedQuery = function $goog$Uri$$getDecodedQuery$() { | |
3016 | return this.queryData_.toDecodedString(); | |
3017 | }; | |
3018 | goog.Uri.prototype.getQueryData = function $goog$Uri$$getQueryData$() { | |
3019 | return this.queryData_; | |
3020 | }; | |
3021 | goog.Uri.prototype.setParameterValue = function $goog$Uri$$setParameterValue$(key, value) { | |
3022 | this.enforceReadOnly(); | |
3023 | this.queryData_.set(key, value); | |
3024 | return this; | |
3025 | }; | |
3026 | goog.Uri.prototype.setParameterValues = function $goog$Uri$$setParameterValues$(key, values) { | |
3027 | this.enforceReadOnly(); | |
3028 | goog.isArray(values) || (values = [String(values)]); | |
3029 | this.queryData_.setValues(key, values); | |
3030 | return this; | |
3031 | }; | |
3032 | goog.Uri.prototype.getParameterValue = function $goog$Uri$$getParameterValue$(paramName) { | |
3033 | return this.queryData_.get(paramName); | |
3034 | }; | |
3035 | goog.Uri.prototype.getFragment = function $goog$Uri$$getFragment$() { | |
3036 | return this.fragment_; | |
3037 | }; | |
3038 | goog.Uri.prototype.setFragment = function $goog$Uri$$setFragment$(newFragment, opt_decode) { | |
3039 | this.enforceReadOnly(); | |
3040 | this.fragment_ = opt_decode ? goog.Uri.decodeOrEmpty_(newFragment) : newFragment; | |
3041 | return this; | |
3042 | }; | |
3043 | goog.Uri.prototype.hasFragment = function $goog$Uri$$hasFragment$() { | |
3044 | return!!this.fragment_; | |
3045 | }; | |
3046 | goog.Uri.prototype.makeUnique = function $goog$Uri$$makeUnique$() { | |
3047 | this.enforceReadOnly(); | |
3048 | this.setParameterValue(goog.Uri.RANDOM_PARAM, goog.string.getRandomString()); | |
3049 | return this; | |
3050 | }; | |
3051 | goog.Uri.prototype.enforceReadOnly = function $goog$Uri$$enforceReadOnly$() { | |
3052 | if (this.isReadOnly_) { | |
3053 | throw Error("Tried to modify a read-only Uri"); | |
3054 | } | |
3055 | }; | |
3056 | goog.Uri.prototype.setIgnoreCase = function $goog$Uri$$setIgnoreCase$(ignoreCase) { | |
3057 | this.ignoreCase_ = ignoreCase; | |
3058 | this.queryData_ && this.queryData_.setIgnoreCase(ignoreCase); | |
3059 | return this; | |
3060 | }; | |
3061 | goog.Uri.prototype.getIgnoreCase = function $goog$Uri$$getIgnoreCase$() { | |
3062 | return this.ignoreCase_; | |
3063 | }; | |
3064 | goog.Uri.parse = function $goog$Uri$parse$(uri, opt_ignoreCase) { | |
3065 | return uri instanceof goog.Uri ? uri.clone() : new goog.Uri(uri, opt_ignoreCase); | |
3066 | }; | |
3067 | goog.Uri.create = function $goog$Uri$create$(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_query, opt_fragment, opt_ignoreCase) { | |
3068 | var uri = new goog.Uri(null, opt_ignoreCase); | |
3069 | opt_scheme && uri.setScheme(opt_scheme); | |
3070 | opt_userInfo && uri.setUserInfo(opt_userInfo); | |
3071 | opt_domain && uri.setDomain(opt_domain); | |
3072 | opt_port && uri.setPort(opt_port); | |
3073 | opt_path && uri.setPath(opt_path); | |
3074 | opt_query && uri.setQueryData(opt_query); | |
3075 | opt_fragment && uri.setFragment(opt_fragment); | |
3076 | return uri; | |
3077 | }; | |
3078 | goog.Uri.resolve = function $goog$Uri$resolve$(base, rel) { | |
3079 | base instanceof goog.Uri || (base = goog.Uri.parse(base)); | |
3080 | rel instanceof goog.Uri || (rel = goog.Uri.parse(rel)); | |
3081 | return base.resolve(rel); | |
3082 | }; | |
3083 | goog.Uri.removeDotSegments = function $goog$Uri$removeDotSegments$(path) { | |
3084 | if (".." == path || "." == path) { | |
3085 | return ""; | |
3086 | } | |
3087 | if (goog.string.contains(path, "./") || goog.string.contains(path, "/.")) { | |
3088 | for (var leadingSlash = goog.string.startsWith(path, "/"), segments = path.split("/"), out = [], pos = 0;pos < segments.length;) { | |
3089 | var segment = segments[pos++]; | |
3090 | "." == segment ? leadingSlash && pos == segments.length && out.push("") : ".." == segment ? ((1 < out.length || 1 == out.length && "" != out[0]) && out.pop(), leadingSlash && pos == segments.length && out.push("")) : (out.push(segment), leadingSlash = !0); | |
3091 | } | |
3092 | return out.join("/"); | |
3093 | } | |
3094 | return path; | |
3095 | }; | |
3096 | goog.Uri.decodeOrEmpty_ = function $goog$Uri$decodeOrEmpty_$(val) { | |
3097 | return val ? decodeURIComponent(val) : ""; | |
3098 | }; | |
3099 | goog.Uri.encodeSpecialChars_ = function $goog$Uri$encodeSpecialChars_$(unescapedPart, extra) { | |
3100 | return goog.isString(unescapedPart) ? encodeURI(unescapedPart).replace(extra, goog.Uri.encodeChar_) : null; | |
3101 | }; | |
3102 | goog.Uri.encodeChar_ = function $goog$Uri$encodeChar_$(ch) { | |
3103 | var n = ch.charCodeAt(0); | |
3104 | return "%" + (n >> 4 & 15).toString(16) + (n & 15).toString(16); | |
3105 | }; | |
3106 | goog.Uri.reDisallowedInSchemeOrUserInfo_ = /[#\/\?@]/g; | |
3107 | goog.Uri.reDisallowedInRelativePath_ = /[\#\?:]/g; | |
3108 | goog.Uri.reDisallowedInAbsolutePath_ = /[\#\?]/g; | |
3109 | goog.Uri.reDisallowedInQuery_ = /[\#\?@]/g; | |
3110 | goog.Uri.reDisallowedInFragment_ = /#/g; | |
3111 | goog.Uri.haveSameDomain = function $goog$Uri$haveSameDomain$(uri1String, uri2String) { | |
3112 | var pieces1 = goog.uri.utils.split(uri1String), pieces2 = goog.uri.utils.split(uri2String); | |
3113 | return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && pieces1[goog.uri.utils.ComponentIndex.PORT] == pieces2[goog.uri.utils.ComponentIndex.PORT]; | |
3114 | }; | |
3115 | goog.Uri.QueryData = function $goog$Uri$QueryData$(opt_query, opt_uri, opt_ignoreCase) { | |
3116 | this.encodedQuery_ = opt_query || null; | |
3117 | this.ignoreCase_ = !!opt_ignoreCase; | |
3118 | }; | |
3119 | goog.Uri.QueryData.prototype.ensureKeyMapInitialized_ = function $goog$Uri$QueryData$$ensureKeyMapInitialized_$() { | |
3120 | if (!this.keyMap_ && (this.keyMap_ = new goog.structs.Map, this.count_ = 0, this.encodedQuery_)) { | |
3121 | for (var pairs = this.encodedQuery_.split("&"), i = 0;i < pairs.length;i++) { | |
3122 | var indexOfEquals = pairs[i].indexOf("="), name = null, value = null; | |
3123 | 0 <= indexOfEquals ? (name = pairs[i].substring(0, indexOfEquals), value = pairs[i].substring(indexOfEquals + 1)) : name = pairs[i]; | |
3124 | name = goog.string.urlDecode(name); | |
3125 | name = this.getKeyName_(name); | |
3126 | this.add(name, value ? goog.string.urlDecode(value) : ""); | |
3127 | } | |
3128 | } | |
3129 | }; | |
3130 | goog.Uri.QueryData.createFromMap = function $goog$Uri$QueryData$createFromMap$(map, opt_uri, opt_ignoreCase) { | |
3131 | var keys = goog.structs.getKeys(map); | |
3132 | if ("undefined" == typeof keys) { | |
3133 | throw Error("Keys are undefined"); | |
3134 | } | |
3135 | for (var queryData = new goog.Uri.QueryData(null, null, opt_ignoreCase), values = goog.structs.getValues(map), i = 0;i < keys.length;i++) { | |
3136 | var key = keys[i], value = values[i]; | |
3137 | goog.isArray(value) ? queryData.setValues(key, value) : queryData.add(key, value); | |
3138 | } | |
3139 | return queryData; | |
3140 | }; | |
3141 | goog.Uri.QueryData.createFromKeysValues = function $goog$Uri$QueryData$createFromKeysValues$(keys, values, opt_uri, opt_ignoreCase) { | |
3142 | if (keys.length != values.length) { | |
3143 | throw Error("Mismatched lengths for keys/values"); | |
3144 | } | |
3145 | for (var queryData = new goog.Uri.QueryData(null, null, opt_ignoreCase), i = 0;i < keys.length;i++) { | |
3146 | queryData.add(keys[i], values[i]); | |
3147 | } | |
3148 | return queryData; | |
3149 | }; | |
3150 | goog.Uri.QueryData.prototype.keyMap_ = null; | |
3151 | goog.Uri.QueryData.prototype.count_ = null; | |
3152 | goog.Uri.QueryData.prototype.getCount = function $goog$Uri$QueryData$$getCount$() { | |
3153 | this.ensureKeyMapInitialized_(); | |
3154 | return this.count_; | |
3155 | }; | |
3156 | goog.Uri.QueryData.prototype.add = function $goog$Uri$QueryData$$add$(key, value) { | |
3157 | this.ensureKeyMapInitialized_(); | |
3158 | this.invalidateCache_(); | |
3159 | key = this.getKeyName_(key); | |
3160 | var values = this.keyMap_.get(key); | |
3161 | values || this.keyMap_.set(key, values = []); | |
3162 | values.push(value); | |
3163 | this.count_++; | |
3164 | return this; | |
3165 | }; | |
3166 | goog.Uri.QueryData.prototype.remove = function $goog$Uri$QueryData$$remove$(key) { | |
3167 | this.ensureKeyMapInitialized_(); | |
3168 | key = this.getKeyName_(key); | |
3169 | return this.keyMap_.containsKey(key) ? (this.invalidateCache_(), this.count_ -= this.keyMap_.get(key).length, this.keyMap_.remove(key)) : !1; | |
3170 | }; | |
3171 | goog.Uri.QueryData.prototype.clear = function $goog$Uri$QueryData$$clear$() { | |
3172 | this.invalidateCache_(); | |
3173 | this.keyMap_ = null; | |
3174 | this.count_ = 0; | |
3175 | }; | |
3176 | goog.Uri.QueryData.prototype.isEmpty = function $goog$Uri$QueryData$$isEmpty$() { | |
3177 | this.ensureKeyMapInitialized_(); | |
3178 | return 0 == this.count_; | |
3179 | }; | |
3180 | goog.Uri.QueryData.prototype.containsKey = function $goog$Uri$QueryData$$containsKey$(key) { | |
3181 | this.ensureKeyMapInitialized_(); | |
3182 | key = this.getKeyName_(key); | |
3183 | return this.keyMap_.containsKey(key); | |
3184 | }; | |
3185 | goog.Uri.QueryData.prototype.containsValue = function $goog$Uri$QueryData$$containsValue$(value) { | |
3186 | var vals = this.getValues(); | |
3187 | return goog.array.contains(vals, value); | |
3188 | }; | |
3189 | goog.Uri.QueryData.prototype.getKeys = function $goog$Uri$QueryData$$getKeys$() { | |
3190 | this.ensureKeyMapInitialized_(); | |
3191 | for (var vals = this.keyMap_.getValues(), keys = this.keyMap_.getKeys(), rv = [], i = 0;i < keys.length;i++) { | |
3192 | for (var val = vals[i], j = 0;j < val.length;j++) { | |
3193 | rv.push(keys[i]); | |
3194 | } | |
3195 | } | |
3196 | return rv; | |
3197 | }; | |
3198 | goog.Uri.QueryData.prototype.getValues = function $goog$Uri$QueryData$$getValues$(opt_key) { | |
3199 | this.ensureKeyMapInitialized_(); | |
3200 | var rv = []; | |
3201 | if (goog.isString(opt_key)) { | |
3202 | this.containsKey(opt_key) && (rv = goog.array.concat(rv, this.keyMap_.get(this.getKeyName_(opt_key)))); | |
3203 | } else { | |
3204 | for (var values = this.keyMap_.getValues(), i = 0;i < values.length;i++) { | |
3205 | rv = goog.array.concat(rv, values[i]); | |
3206 | } | |
3207 | } | |
3208 | return rv; | |
3209 | }; | |
3210 | goog.Uri.QueryData.prototype.set = function $goog$Uri$QueryData$$set$(key, value) { | |
3211 | this.ensureKeyMapInitialized_(); | |
3212 | this.invalidateCache_(); | |
3213 | key = this.getKeyName_(key); | |
3214 | this.containsKey(key) && (this.count_ -= this.keyMap_.get(key).length); | |
3215 | this.keyMap_.set(key, [value]); | |
3216 | this.count_++; | |
3217 | return this; | |
3218 | }; | |
3219 | goog.Uri.QueryData.prototype.get = function $goog$Uri$QueryData$$get$(key, opt_default) { | |
3220 | var values = key ? this.getValues(key) : []; | |
3221 | return goog.Uri.preserveParameterTypesCompatibilityFlag ? 0 < values.length ? values[0] : opt_default : 0 < values.length ? String(values[0]) : opt_default; | |
3222 | }; | |
3223 | goog.Uri.QueryData.prototype.setValues = function $goog$Uri$QueryData$$setValues$(key, values) { | |
3224 | this.remove(key); | |
3225 | 0 < values.length && (this.invalidateCache_(), this.keyMap_.set(this.getKeyName_(key), goog.array.clone(values)), this.count_ += values.length); | |
3226 | }; | |
3227 | goog.Uri.QueryData.prototype.toString = function $goog$Uri$QueryData$$toString$() { | |
3228 | if (this.encodedQuery_) { | |
3229 | return this.encodedQuery_; | |
3230 | } | |
3231 | if (!this.keyMap_) { | |
3232 | return ""; | |
3233 | } | |
3234 | for (var sb = [], keys = this.keyMap_.getKeys(), i = 0;i < keys.length;i++) { | |
3235 | for (var key = keys[i], encodedKey = goog.string.urlEncode(key), val = this.getValues(key), j = 0;j < val.length;j++) { | |
3236 | var param = encodedKey; | |
3237 | "" !== val[j] && (param += "=" + goog.string.urlEncode(val[j])); | |
3238 | sb.push(param); | |
3239 | } | |
3240 | } | |
3241 | return this.encodedQuery_ = sb.join("&"); | |
3242 | }; | |
3243 | goog.Uri.QueryData.prototype.toDecodedString = function $goog$Uri$QueryData$$toDecodedString$() { | |
3244 | return goog.Uri.decodeOrEmpty_(this.toString()); | |
3245 | }; | |
3246 | goog.Uri.QueryData.prototype.invalidateCache_ = function $goog$Uri$QueryData$$invalidateCache_$() { | |
3247 | this.encodedQuery_ = null; | |
3248 | }; | |
3249 | goog.Uri.QueryData.prototype.clone = function $goog$Uri$QueryData$$clone$() { | |
3250 | var rv = new goog.Uri.QueryData; | |
3251 | rv.encodedQuery_ = this.encodedQuery_; | |
3252 | this.keyMap_ && (rv.keyMap_ = this.keyMap_.clone(), rv.count_ = this.count_); | |
3253 | return rv; | |
3254 | }; | |
3255 | goog.Uri.QueryData.prototype.getKeyName_ = function $goog$Uri$QueryData$$getKeyName_$(arg) { | |
3256 | var keyName = String(arg); | |
3257 | this.ignoreCase_ && (keyName = keyName.toLowerCase()); | |
3258 | return keyName; | |
3259 | }; | |
3260 | goog.Uri.QueryData.prototype.setIgnoreCase = function $goog$Uri$QueryData$$setIgnoreCase$(ignoreCase) { | |
3261 | var resetKeys = ignoreCase && !this.ignoreCase_; | |
3262 | resetKeys && (this.ensureKeyMapInitialized_(), this.invalidateCache_(), this.keyMap_.forEach(function(value, key) { | |
3263 | var lowerCase = key.toLowerCase(); | |
3264 | key != lowerCase && (this.remove(key), this.setValues(lowerCase, value)); | |
3265 | }, this)); | |
3266 | this.ignoreCase_ = ignoreCase; | |
3267 | }; | |
3268 | goog.Uri.QueryData.prototype.extend = function $goog$Uri$QueryData$$extend$(var_args) { | |
3269 | for (var i = 0;i < arguments.length;i++) { | |
3270 | var data = arguments[i]; | |
3271 | goog.structs.forEach(data, function(value, key) { | |
3272 | this.add(key, value); | |
3273 | }, this); | |
3274 | } | |
3275 | }; | |
3276 | var i18n = {input:{}}; | |
3277 | i18n.input.chrome = {}; | |
3278 | i18n.input.chrome.vk = {}; | |
3279 | i18n.input.chrome.vk.DeferredCallManager = function $i18n$input$chrome$vk$DeferredCallManager$() { | |
3280 | this.funcQueue_ = []; | |
3281 | }; | |
3282 | goog.addSingletonGetter(i18n.input.chrome.vk.DeferredCallManager); | |
3283 | i18n.input.chrome.vk.DeferredCallManager.prototype.addCall = function $i18n$input$chrome$vk$DeferredCallManager$$addCall$(func) { | |
3284 | this.funcQueue_.push(func); | |
3285 | }; | |
3286 | i18n.input.chrome.vk.DeferredCallManager.prototype.execAll = function $i18n$input$chrome$vk$DeferredCallManager$$execAll$() { | |
3287 | for (var i = 0;i < this.funcQueue_.length;i++) { | |
3288 | this.funcQueue_[i].call(); | |
3289 | } | |
3290 | this.funcQueue_ = []; | |
3291 | }; | |
3292 | i18n.input.chrome.vk.DeferredApi = {}; | |
3293 | i18n.input.chrome.vk.DeferredApi.commitText = function $i18n$input$chrome$vk$DeferredApi$commitText$(contextId, text) { | |
3294 | i18n.input.chrome.vk.DeferredCallManager.getInstance().addCall(function() { | |
3295 | chrome.input.ime.commitText({contextID:contextId, text:text}); | |
3296 | }); | |
3297 | }; | |
3298 | i18n.input.chrome.vk.DeferredApi.setComposition = function $i18n$input$chrome$vk$DeferredApi$setComposition$(contextId, text, cursor) { | |
3299 | i18n.input.chrome.vk.DeferredCallManager.getInstance().addCall(function() { | |
3300 | chrome.input.ime.setComposition({contextID:contextId, text:text, cursor:cursor}); | |
3301 | }); | |
3302 | }; | |
3303 | i18n.input.chrome.vk.DeferredApi.clearComposition = function $i18n$input$chrome$vk$DeferredApi$clearComposition$(contextId) { | |
3304 | i18n.input.chrome.vk.DeferredCallManager.getInstance().addCall(function() { | |
3305 | chrome.input.ime.clearComposition({contextID:contextId}, function() { | |
3306 | }); | |
3307 | }); | |
3308 | }; | |
3309 | i18n.input.chrome.vk.DeferredApi.deleteSurroundingText = function $i18n$input$chrome$vk$DeferredApi$deleteSurroundingText$(engineId, contextId, back, text) { | |
3310 | i18n.input.chrome.vk.DeferredCallManager.getInstance().addCall(function() { | |
3311 | chrome.input.ime.deleteSurroundingText({engineID:engineId, contextID:contextId, offset:-back, length:back}, function() { | |
3312 | chrome.input.ime.commitText({contextID:contextId, text:text}); | |
3313 | }); | |
3314 | }); | |
3315 | }; | |
3316 | goog.disposable = {}; | |
3317 | goog.disposable.IDisposable = function $goog$disposable$IDisposable$() { | |
3318 | }; | |
3319 | goog.Disposable = function $goog$Disposable$() { | |
3320 | goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF && (goog.Disposable.instances_[goog.getUid(this)] = this); | |
3321 | }; | |
3322 | goog.Disposable.MonitoringMode = {OFF:0, PERMANENT:1, INTERACTIVE:2}; | |
3323 | goog.Disposable.MONITORING_MODE = 0; | |
3324 | goog.Disposable.INCLUDE_STACK_ON_CREATION = !0; | |
3325 | goog.Disposable.instances_ = {}; | |
3326 | goog.Disposable.getUndisposedObjects = function $goog$Disposable$getUndisposedObjects$() { | |
3327 | var ret = [], id; | |
3328 | for (id in goog.Disposable.instances_) { | |
3329 | goog.Disposable.instances_.hasOwnProperty(id) && ret.push(goog.Disposable.instances_[Number(id)]); | |
3330 | } | |
3331 | return ret; | |
3332 | }; | |
3333 | goog.Disposable.clearUndisposedObjects = function $goog$Disposable$clearUndisposedObjects$() { | |
3334 | goog.Disposable.instances_ = {}; | |
3335 | }; | |
3336 | goog.Disposable.prototype.disposed_ = !1; | |
3337 | goog.Disposable.prototype.isDisposed = function $goog$Disposable$$isDisposed$() { | |
3338 | return this.disposed_; | |
3339 | }; | |
3340 | goog.Disposable.prototype.dispose = function $goog$Disposable$$dispose$() { | |
3341 | if (!this.disposed_ && (this.disposed_ = !0, this.disposeInternal(), goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF)) { | |
3342 | var uid = goog.getUid(this); | |
3343 | if (goog.Disposable.MONITORING_MODE == goog.Disposable.MonitoringMode.PERMANENT && !goog.Disposable.instances_.hasOwnProperty(uid)) { | |
3344 | throw Error(this + " did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call"); | |
3345 | } | |
3346 | delete goog.Disposable.instances_[uid]; | |
3347 | } | |
3348 | }; | |
3349 | goog.Disposable.prototype.disposeInternal = function $goog$Disposable$$disposeInternal$() { | |
3350 | if (this.onDisposeCallbacks_) { | |
3351 | for (;this.onDisposeCallbacks_.length;) { | |
3352 | this.onDisposeCallbacks_.shift()(); | |
3353 | } | |
3354 | } | |
3355 | }; | |
3356 | goog.Disposable.isDisposed = function $goog$Disposable$isDisposed$(obj) { | |
3357 | return obj && "function" == typeof obj.isDisposed ? obj.isDisposed() : !1; | |
3358 | }; | |
3359 | goog.dispose = function $goog$dispose$(obj) { | |
3360 | obj && "function" == typeof obj.dispose && obj.dispose(); | |
3361 | }; | |
3362 | goog.disposeAll = function $goog$disposeAll$(var_args) { | |
3363 | for (var i = 0, len = arguments.length;i < len;++i) { | |
3364 | var disposable = arguments[i]; | |
3365 | goog.isArrayLike(disposable) ? goog.disposeAll.apply(null, disposable) : goog.dispose(disposable); | |
3366 | } | |
3367 | }; | |
3368 | goog.events = {}; | |
3369 | goog.events.EventId = function $goog$events$EventId$(eventId) { | |
3370 | this.id = eventId; | |
3371 | }; | |
3372 | goog.events.EventId.prototype.toString = function $goog$events$EventId$$toString$() { | |
3373 | return this.id; | |
3374 | }; | |
3375 | goog.events.Event = function $goog$events$Event$(type, opt_target) { | |
3376 | this.type = type instanceof goog.events.EventId ? String(type) : type; | |
3377 | this.currentTarget = this.target = opt_target; | |
3378 | this.defaultPrevented = this.propagationStopped_ = !1; | |
3379 | this.returnValue_ = !0; | |
3380 | }; | |
3381 | goog.events.Event.prototype.disposeInternal = function $goog$events$Event$$disposeInternal$() { | |
3382 | }; | |
3383 | goog.events.Event.prototype.dispose = function $goog$events$Event$$dispose$() { | |
3384 | }; | |
3385 | goog.events.Event.prototype.stopPropagation = function $goog$events$Event$$stopPropagation$() { | |
3386 | this.propagationStopped_ = !0; | |
3387 | }; | |
3388 | goog.events.Event.prototype.preventDefault = function $goog$events$Event$$preventDefault$() { | |
3389 | this.defaultPrevented = !0; | |
3390 | this.returnValue_ = !1; | |
3391 | }; | |
3392 | goog.events.Event.stopPropagation = function $goog$events$Event$stopPropagation$(e) { | |
3393 | e.stopPropagation(); | |
3394 | }; | |
3395 | goog.events.Event.preventDefault = function $goog$events$Event$preventDefault$(e) { | |
3396 | e.preventDefault(); | |
3397 | }; | |
3398 | goog.events.getVendorPrefixedName_ = function $goog$events$getVendorPrefixedName_$(eventName) { | |
3399 | return goog.userAgent.WEBKIT ? "webkit" + eventName : goog.userAgent.OPERA ? "o" + eventName.toLowerCase() : eventName.toLowerCase(); | |
3400 | }; | |
3401 | goog.events.EventType = {CLICK:"click", DBLCLICK:"dblclick", MOUSEDOWN:"mousedown", MOUSEUP:"mouseup", MOUSEOVER:"mouseover", MOUSEOUT:"mouseout", MOUSEMOVE:"mousemove", MOUSEENTER:"mouseenter", MOUSELEAVE:"mouseleave", SELECTSTART:"selectstart", KEYPRESS:"keypress", KEYDOWN:"keydown", KEYUP:"keyup", BLUR:"blur", FOCUS:"focus", DEACTIVATE:"deactivate", FOCUSIN:goog.userAgent.IE ? "focusin" : "DOMFocusIn", FOCUSOUT:goog.userAgent.IE ? "focusout" : "DOMFocusOut", CHANGE:"change", SELECT:"select", SUBMIT:"submit", | |
3402 | INPUT:"input", PROPERTYCHANGE:"propertychange", DRAGSTART:"dragstart", DRAG:"drag", DRAGENTER:"dragenter", DRAGOVER:"dragover", DRAGLEAVE:"dragleave", DROP:"drop", DRAGEND:"dragend", TOUCHSTART:"touchstart", TOUCHMOVE:"touchmove", TOUCHEND:"touchend", TOUCHCANCEL:"touchcancel", BEFOREUNLOAD:"beforeunload", CONSOLEMESSAGE:"consolemessage", CONTEXTMENU:"contextmenu", DOMCONTENTLOADED:"DOMContentLoaded", ERROR:"error", HELP:"help", LOAD:"load", LOSECAPTURE:"losecapture", ORIENTATIONCHANGE:"orientationchange", | |
3403 | READYSTATECHANGE:"readystatechange", RESIZE:"resize", SCROLL:"scroll", UNLOAD:"unload", HASHCHANGE:"hashchange", PAGEHIDE:"pagehide", PAGESHOW:"pageshow", POPSTATE:"popstate", COPY:"copy", PASTE:"paste", CUT:"cut", BEFORECOPY:"beforecopy", BEFORECUT:"beforecut", BEFOREPASTE:"beforepaste", ONLINE:"online", OFFLINE:"offline", MESSAGE:"message", CONNECT:"connect", ANIMATIONSTART:goog.events.getVendorPrefixedName_("AnimationStart"), ANIMATIONEND:goog.events.getVendorPrefixedName_("AnimationEnd"), ANIMATIONITERATION:goog.events.getVendorPrefixedName_("AnimationIteration"), | |
3404 | TRANSITIONEND:goog.events.getVendorPrefixedName_("TransitionEnd"), POINTERDOWN:"pointerdown", POINTERUP:"pointerup", POINTERCANCEL:"pointercancel", POINTERMOVE:"pointermove", POINTEROVER:"pointerover", POINTEROUT:"pointerout", POINTERENTER:"pointerenter", POINTERLEAVE:"pointerleave", GOTPOINTERCAPTURE:"gotpointercapture", LOSTPOINTERCAPTURE:"lostpointercapture", MSGESTURECHANGE:"MSGestureChange", MSGESTUREEND:"MSGestureEnd", MSGESTUREHOLD:"MSGestureHold", MSGESTURESTART:"MSGestureStart", MSGESTURETAP:"MSGestureTap", | |
3405 | MSGOTPOINTERCAPTURE:"MSGotPointerCapture", MSINERTIASTART:"MSInertiaStart", MSLOSTPOINTERCAPTURE:"MSLostPointerCapture", MSPOINTERCANCEL:"MSPointerCancel", MSPOINTERDOWN:"MSPointerDown", MSPOINTERENTER:"MSPointerEnter", MSPOINTERHOVER:"MSPointerHover", MSPOINTERLEAVE:"MSPointerLeave", MSPOINTERMOVE:"MSPointerMove", MSPOINTEROUT:"MSPointerOut", MSPOINTEROVER:"MSPointerOver", MSPOINTERUP:"MSPointerUp", TEXTINPUT:"textinput", COMPOSITIONSTART:"compositionstart", COMPOSITIONUPDATE:"compositionupdate", | |
3406 | COMPOSITIONEND:"compositionend", EXIT:"exit", LOADABORT:"loadabort", LOADCOMMIT:"loadcommit", LOADREDIRECT:"loadredirect", LOADSTART:"loadstart", LOADSTOP:"loadstop", RESPONSIVE:"responsive", SIZECHANGED:"sizechanged", UNRESPONSIVE:"unresponsive", VISIBILITYCHANGE:"visibilitychange", STORAGE:"storage", DOMSUBTREEMODIFIED:"DOMSubtreeModified", DOMNODEINSERTED:"DOMNodeInserted", DOMNODEREMOVED:"DOMNodeRemoved", DOMNODEREMOVEDFROMDOCUMENT:"DOMNodeRemovedFromDocument", DOMNODEINSERTEDINTODOCUMENT:"DOMNodeInsertedIntoDocument", | |
3407 | DOMATTRMODIFIED:"DOMAttrModified", DOMCHARACTERDATAMODIFIED:"DOMCharacterDataModified"}; | |
3408 | goog.debug.entryPointRegistry = {}; | |
3409 | goog.debug.EntryPointMonitor = function $goog$debug$EntryPointMonitor$() { | |
3410 | }; | |
3411 | goog.debug.entryPointRegistry.refList_ = []; | |
3412 | goog.debug.entryPointRegistry.monitors_ = []; | |
3413 | goog.debug.entryPointRegistry.monitorsMayExist_ = !1; | |
3414 | goog.debug.entryPointRegistry.register = function $goog$debug$entryPointRegistry$register$(callback) { | |
3415 | goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = callback; | |
3416 | if (goog.debug.entryPointRegistry.monitorsMayExist_) { | |
3417 | for (var monitors = goog.debug.entryPointRegistry.monitors_, i = 0;i < monitors.length;i++) { | |
3418 | callback(goog.bind(monitors[i].wrap, monitors[i])); | |
3419 | } | |
3420 | } | |
3421 | }; | |
3422 | goog.debug.entryPointRegistry.monitorAll = function $goog$debug$entryPointRegistry$monitorAll$(monitor) { | |
3423 | goog.debug.entryPointRegistry.monitorsMayExist_ = !0; | |
3424 | for (var transformer = goog.bind(monitor.wrap, monitor), i = 0;i < goog.debug.entryPointRegistry.refList_.length;i++) { | |
3425 | goog.debug.entryPointRegistry.refList_[i](transformer); | |
3426 | } | |
3427 | goog.debug.entryPointRegistry.monitors_.push(monitor); | |
3428 | }; | |
3429 | goog.debug.entryPointRegistry.unmonitorAllIfPossible = function $goog$debug$entryPointRegistry$unmonitorAllIfPossible$(monitor) { | |
3430 | var monitors = goog.debug.entryPointRegistry.monitors_; | |
3431 | goog.asserts.assert(monitor == monitors[monitors.length - 1], "Only the most recent monitor can be unwrapped."); | |
3432 | for (var transformer = goog.bind(monitor.unwrap, monitor), i = 0;i < goog.debug.entryPointRegistry.refList_.length;i++) { | |
3433 | goog.debug.entryPointRegistry.refList_[i](transformer); | |
3434 | } | |
3435 | monitors.length--; | |
3436 | }; | |
3437 | goog.reflect = {}; | |
3438 | goog.reflect.object = function $goog$reflect$object$(type, object) { | |
3439 | return object; | |
3440 | }; | |
3441 | goog.reflect.sinkValue = function $goog$reflect$sinkValue$(x) { | |
3442 | goog.reflect.sinkValue[" "](x); | |
3443 | return x; | |
3444 | }; | |
3445 | goog.reflect.sinkValue[" "] = goog.nullFunction; | |
3446 | goog.reflect.canAccessProperty = function $goog$reflect$canAccessProperty$(obj, prop) { | |
3447 | try { | |
3448 | return goog.reflect.sinkValue(obj[prop]), !0; | |
3449 | } catch (e) { | |
3450 | } | |
3451 | return!1; | |
3452 | }; | |
3453 | goog.events.BrowserFeature = {HAS_W3C_BUTTON:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), HAS_W3C_EVENT_SUPPORT:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), HAS_NAVIGATOR_ONLINE_PROPERTY:!goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("528"), HAS_HTML5_NETWORK_EVENT_SUPPORT:goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9b") || goog.userAgent.IE && | |
3454 | goog.userAgent.isVersionOrHigher("8") || goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher("9.5") || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("528"), HTML5_NETWORK_EVENTS_FIRE_ON_BODY:goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("8") || goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), TOUCH_ENABLED:"ontouchstart" in goog.global || !!(goog.global.document && document.documentElement && "ontouchstart" in document.documentElement) || !(!goog.global.navigator || | |
3455 | !goog.global.navigator.msMaxTouchPoints)}; | |
3456 | goog.events.BrowserEvent = function $goog$events$BrowserEvent$(opt_e, opt_currentTarget) { | |
3457 | goog.events.Event.call(this, opt_e ? opt_e.type : ""); | |
3458 | this.relatedTarget = this.currentTarget = this.target = null; | |
3459 | this.charCode = this.keyCode = this.button = this.screenY = this.screenX = this.clientY = this.clientX = this.offsetY = this.offsetX = 0; | |
3460 | this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1; | |
3461 | this.state = null; | |
3462 | this.platformModifierKey = !1; | |
3463 | this.event_ = null; | |
3464 | opt_e && this.init(opt_e, opt_currentTarget); | |
3465 | }; | |
3466 | goog.inherits(goog.events.BrowserEvent, goog.events.Event); | |
3467 | goog.events.BrowserEvent.MouseButton = {LEFT:0, MIDDLE:1, RIGHT:2}; | |
3468 | goog.events.BrowserEvent.IEButtonMap = [1, 4, 2]; | |
3469 | goog.events.BrowserEvent.prototype.init = function $goog$events$BrowserEvent$$init$(e, opt_currentTarget) { | |
3470 | var type = this.type = e.type; | |
3471 | this.target = e.target || e.srcElement; | |
3472 | this.currentTarget = opt_currentTarget; | |
3473 | var relatedTarget = e.relatedTarget; | |
3474 | relatedTarget ? goog.userAgent.GECKO && (goog.reflect.canAccessProperty(relatedTarget, "nodeName") || (relatedTarget = null)) : type == goog.events.EventType.MOUSEOVER ? relatedTarget = e.fromElement : type == goog.events.EventType.MOUSEOUT && (relatedTarget = e.toElement); | |
3475 | this.relatedTarget = relatedTarget; | |
3476 | this.offsetX = goog.userAgent.WEBKIT || void 0 !== e.offsetX ? e.offsetX : e.layerX; | |
3477 | this.offsetY = goog.userAgent.WEBKIT || void 0 !== e.offsetY ? e.offsetY : e.layerY; | |
3478 | this.clientX = void 0 !== e.clientX ? e.clientX : e.pageX; | |
3479 | this.clientY = void 0 !== e.clientY ? e.clientY : e.pageY; | |
3480 | this.screenX = e.screenX || 0; | |
3481 | this.screenY = e.screenY || 0; | |
3482 | this.button = e.button; | |
3483 | this.keyCode = e.keyCode || 0; | |
3484 | this.charCode = e.charCode || ("keypress" == type ? e.keyCode : 0); | |
3485 | this.ctrlKey = e.ctrlKey; | |
3486 | this.altKey = e.altKey; | |
3487 | this.shiftKey = e.shiftKey; | |
3488 | this.metaKey = e.metaKey; | |
3489 | this.platformModifierKey = goog.userAgent.MAC ? e.metaKey : e.ctrlKey; | |
3490 | this.state = e.state; | |
3491 | this.event_ = e; | |
3492 | e.defaultPrevented && this.preventDefault(); | |
3493 | }; | |
3494 | goog.events.BrowserEvent.prototype.isButton = function $goog$events$BrowserEvent$$isButton$(button) { | |
3495 | return goog.events.BrowserFeature.HAS_W3C_BUTTON ? this.event_.button == button : "click" == this.type ? button == goog.events.BrowserEvent.MouseButton.LEFT : !!(this.event_.button & goog.events.BrowserEvent.IEButtonMap[button]); | |
3496 | }; | |
3497 | goog.events.BrowserEvent.prototype.isMouseActionButton = function $goog$events$BrowserEvent$$isMouseActionButton$() { | |
3498 | return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey); | |
3499 | }; | |
3500 | goog.events.BrowserEvent.prototype.stopPropagation = function $goog$events$BrowserEvent$$stopPropagation$() { | |
3501 | goog.events.BrowserEvent.superClass_.stopPropagation.call(this); | |
3502 | this.event_.stopPropagation ? this.event_.stopPropagation() : this.event_.cancelBubble = !0; | |
3503 | }; | |
3504 | goog.events.BrowserEvent.prototype.preventDefault = function $goog$events$BrowserEvent$$preventDefault$() { | |
3505 | goog.events.BrowserEvent.superClass_.preventDefault.call(this); | |
3506 | var be = this.event_; | |
3507 | if (be.preventDefault) { | |
3508 | be.preventDefault(); | |
3509 | } else { | |
3510 | if (be.returnValue = !1, goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT) { | |
3511 | try { | |
3512 | if (be.ctrlKey || 112 <= be.keyCode && 123 >= be.keyCode) { | |
3513 | be.keyCode = -1; | |
3514 | } | |
3515 | } catch (ex) { | |
3516 | } | |
3517 | } | |
3518 | } | |
3519 | }; | |
3520 | goog.events.BrowserEvent.prototype.getBrowserEvent = function $goog$events$BrowserEvent$$getBrowserEvent$() { | |
3521 | return this.event_; | |
3522 | }; | |
3523 | goog.events.BrowserEvent.prototype.disposeInternal = function $goog$events$BrowserEvent$$disposeInternal$() { | |
3524 | }; | |
3525 | goog.events.Listenable = function $goog$events$Listenable$() { | |
3526 | }; | |
3527 | goog.events.Listenable.IMPLEMENTED_BY_PROP = "closure_listenable_" + (1E6 * Math.random() | 0); | |
3528 | goog.events.Listenable.addImplementation = function $goog$events$Listenable$addImplementation$(cls) { | |
3529 | cls.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = !0; | |
3530 | }; | |
3531 | goog.events.Listenable.isImplementedBy = function $goog$events$Listenable$isImplementedBy$(obj) { | |
3532 | try { | |
3533 | return!(!obj || !obj[goog.events.Listenable.IMPLEMENTED_BY_PROP]); | |
3534 | } catch (e) { | |
3535 | return!1; | |
3536 | } | |
3537 | }; | |
3538 | goog.events.ListenableKey = function $goog$events$ListenableKey$() { | |
3539 | }; | |
3540 | goog.events.ListenableKey.counter_ = 0; | |
3541 | goog.events.ListenableKey.reserveKey = function $goog$events$ListenableKey$reserveKey$() { | |
3542 | return++goog.events.ListenableKey.counter_; | |
3543 | }; | |
3544 | goog.events.Listener = function $goog$events$Listener$(listener, proxy, src, type, capture, opt_handler) { | |
3545 | this.listener = listener; | |
3546 | this.proxy = proxy; | |
3547 | this.src = src; | |
3548 | this.type = type; | |
3549 | this.capture = !!capture; | |
3550 | this.handler = opt_handler; | |
3551 | this.key = goog.events.ListenableKey.reserveKey(); | |
3552 | this.removed = this.callOnce = !1; | |
3553 | }; | |
3554 | goog.events.Listener.ENABLE_MONITORING = !1; | |
3555 | goog.events.Listener.prototype.markAsRemoved = function $goog$events$Listener$$markAsRemoved$() { | |
3556 | this.removed = !0; | |
3557 | this.handler = this.src = this.proxy = this.listener = null; | |
3558 | }; | |
3559 | goog.events.ListenerMap = function $goog$events$ListenerMap$(src) { | |
3560 | this.src = src; | |
3561 | this.listeners = {}; | |
3562 | this.typeCount_ = 0; | |
3563 | }; | |
3564 | goog.events.ListenerMap.prototype.getTypeCount = function $goog$events$ListenerMap$$getTypeCount$() { | |
3565 | return this.typeCount_; | |
3566 | }; | |
3567 | goog.events.ListenerMap.prototype.add = function $goog$events$ListenerMap$$add$(type, listener, callOnce, opt_useCapture, opt_listenerScope) { | |
3568 | var typeStr = type.toString(), listenerArray = this.listeners[typeStr]; | |
3569 | listenerArray || (listenerArray = this.listeners[typeStr] = [], this.typeCount_++); | |
3570 | var listenerObj, index = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, opt_useCapture, opt_listenerScope); | |
3571 | -1 < index ? (listenerObj = listenerArray[index], callOnce || (listenerObj.callOnce = !1)) : (listenerObj = new goog.events.Listener(listener, null, this.src, typeStr, !!opt_useCapture, opt_listenerScope), listenerObj.callOnce = callOnce, listenerArray.push(listenerObj)); | |
3572 | return listenerObj; | |
3573 | }; | |
3574 | goog.events.ListenerMap.prototype.remove = function $goog$events$ListenerMap$$remove$(type, listener, opt_useCapture, opt_listenerScope) { | |
3575 | var typeStr = type.toString(); | |
3576 | if (!(typeStr in this.listeners)) { | |
3577 | return!1; | |
3578 | } | |
3579 | var listenerArray = this.listeners[typeStr], index = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, opt_useCapture, opt_listenerScope); | |
3580 | if (-1 < index) { | |
3581 | var listenerObj = listenerArray[index]; | |
3582 | listenerObj.markAsRemoved(); | |
3583 | goog.array.removeAt(listenerArray, index); | |
3584 | 0 == listenerArray.length && (delete this.listeners[typeStr], this.typeCount_--); | |
3585 | return!0; | |
3586 | } | |
3587 | return!1; | |
3588 | }; | |
3589 | goog.events.ListenerMap.prototype.removeByKey = function $goog$events$ListenerMap$$removeByKey$(listener) { | |
3590 | var type = listener.type; | |
3591 | if (!(type in this.listeners)) { | |
3592 | return!1; | |
3593 | } | |
3594 | var removed = goog.array.remove(this.listeners[type], listener); | |
3595 | removed && (listener.markAsRemoved(), 0 == this.listeners[type].length && (delete this.listeners[type], this.typeCount_--)); | |
3596 | return removed; | |
3597 | }; | |
3598 | goog.events.ListenerMap.prototype.removeAll = function $goog$events$ListenerMap$$removeAll$(opt_type) { | |
3599 | var typeStr = opt_type && opt_type.toString(), count = 0, type; | |
3600 | for (type in this.listeners) { | |
3601 | if (!typeStr || type == typeStr) { | |
3602 | for (var listenerArray = this.listeners[type], i = 0;i < listenerArray.length;i++) { | |
3603 | ++count, listenerArray[i].markAsRemoved(); | |
3604 | } | |
3605 | delete this.listeners[type]; | |
3606 | this.typeCount_--; | |
3607 | } | |
3608 | } | |
3609 | return count; | |
3610 | }; | |
3611 | goog.events.ListenerMap.prototype.getListeners = function $goog$events$ListenerMap$$getListeners$(type, capture) { | |
3612 | var listenerArray = this.listeners[type.toString()], rv = []; | |
3613 | if (listenerArray) { | |
3614 | for (var i = 0;i < listenerArray.length;++i) { | |
3615 | var listenerObj = listenerArray[i]; | |
3616 | listenerObj.capture == capture && rv.push(listenerObj); | |
3617 | } | |
3618 | } | |
3619 | return rv; | |
3620 | }; | |
3621 | goog.events.ListenerMap.prototype.getListener = function $goog$events$ListenerMap$$getListener$(type, listener, capture, opt_listenerScope) { | |
3622 | var listenerArray = this.listeners[type.toString()], i = -1; | |
3623 | listenerArray && (i = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, capture, opt_listenerScope)); | |
3624 | return-1 < i ? listenerArray[i] : null; | |
3625 | }; | |
3626 | goog.events.ListenerMap.prototype.hasListener = function $goog$events$ListenerMap$$hasListener$(opt_type, opt_capture) { | |
3627 | var hasType = goog.isDef(opt_type), typeStr = hasType ? opt_type.toString() : "", hasCapture = goog.isDef(opt_capture); | |
3628 | return goog.object.some(this.listeners, function(listenerArray) { | |
3629 | for (var i = 0;i < listenerArray.length;++i) { | |
3630 | if (!(hasType && listenerArray[i].type != typeStr || hasCapture && listenerArray[i].capture != opt_capture)) { | |
3631 | return!0; | |
3632 | } | |
3633 | } | |
3634 | return!1; | |
3635 | }); | |
3636 | }; | |
3637 | goog.events.ListenerMap.findListenerIndex_ = function $goog$events$ListenerMap$findListenerIndex_$(listenerArray, listener, opt_useCapture, opt_listenerScope) { | |
3638 | for (var i = 0;i < listenerArray.length;++i) { | |
3639 | var listenerObj = listenerArray[i]; | |
3640 | if (!listenerObj.removed && listenerObj.listener == listener && listenerObj.capture == !!opt_useCapture && listenerObj.handler == opt_listenerScope) { | |
3641 | return i; | |
3642 | } | |
3643 | } | |
3644 | return-1; | |
3645 | }; | |
3646 | goog.events.listeners_ = {}; | |
3647 | goog.events.LISTENER_MAP_PROP_ = "closure_lm_" + (1E6 * Math.random() | 0); | |
3648 | goog.events.onString_ = "on"; | |
3649 | goog.events.onStringMap_ = {}; | |
3650 | goog.events.CaptureSimulationMode = {OFF_AND_FAIL:0, OFF_AND_SILENT:1, ON:2}; | |
3651 | goog.events.CAPTURE_SIMULATION_MODE = 2; | |
3652 | goog.events.listenerCountEstimate_ = 0; | |
3653 | goog.events.listen = function $goog$events$listen$(src, type, listener, opt_capt, opt_handler) { | |
3654 | if (goog.isArray(type)) { | |
3655 | for (var i = 0;i < type.length;i++) { | |
3656 | goog.events.listen(src, type[i], listener, opt_capt, opt_handler); | |
3657 | } | |
3658 | return null; | |
3659 | } | |
3660 | listener = goog.events.wrapListener(listener); | |
3661 | return goog.events.Listenable.isImplementedBy(src) ? src.listen(type, listener, opt_capt, opt_handler) : goog.events.listen_(src, type, listener, !1, opt_capt, opt_handler); | |
3662 | }; | |
3663 | goog.events.listen_ = function $goog$events$listen_$(src, type, listener, callOnce, opt_capt, opt_handler) { | |
3664 | if (!type) { | |
3665 | throw Error("Invalid event type"); | |
3666 | } | |
3667 | var capture = !!opt_capt; | |
3668 | if (capture && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) { | |
3669 | if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_FAIL) { | |
3670 | return goog.asserts.fail("Can not register capture listener in IE8-."), null; | |
3671 | } | |
3672 | if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_SILENT) { | |
3673 | return null; | |
3674 | } | |
3675 | } | |
3676 | var listenerMap = goog.events.getListenerMap_(src); | |
3677 | listenerMap || (src[goog.events.LISTENER_MAP_PROP_] = listenerMap = new goog.events.ListenerMap(src)); | |
3678 | var listenerObj = listenerMap.add(type, listener, callOnce, opt_capt, opt_handler); | |
3679 | if (listenerObj.proxy) { | |
3680 | return listenerObj; | |
3681 | } | |
3682 | var proxy = goog.events.getProxy(); | |
3683 | listenerObj.proxy = proxy; | |
3684 | proxy.src = src; | |
3685 | proxy.listener = listenerObj; | |
3686 | src.addEventListener ? src.addEventListener(type.toString(), proxy, capture) : src.attachEvent(goog.events.getOnString_(type.toString()), proxy); | |
3687 | goog.events.listenerCountEstimate_++; | |
3688 | return listenerObj; | |
3689 | }; | |
3690 | goog.events.getProxy = function $goog$events$getProxy$() { | |
3691 | var proxyCallbackFunction = goog.events.handleBrowserEvent_, f = goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT ? function(eventObject) { | |
3692 | return proxyCallbackFunction.call(f.src, f.listener, eventObject); | |
3693 | } : function(eventObject) { | |
3694 | var v = proxyCallbackFunction.call(f.src, f.listener, eventObject); | |
3695 | if (!v) { | |
3696 | return v; | |
3697 | } | |
3698 | }; | |
3699 | return f; | |
3700 | }; | |
3701 | goog.events.listenOnce = function $goog$events$listenOnce$(src, type, listener, opt_capt, opt_handler) { | |
3702 | if (goog.isArray(type)) { | |
3703 | for (var i = 0;i < type.length;i++) { | |
3704 | goog.events.listenOnce(src, type[i], listener, opt_capt, opt_handler); | |
3705 | } | |
3706 | return null; | |
3707 | } | |
3708 | listener = goog.events.wrapListener(listener); | |
3709 | return goog.events.Listenable.isImplementedBy(src) ? src.listenOnce(type, listener, opt_capt, opt_handler) : goog.events.listen_(src, type, listener, !0, opt_capt, opt_handler); | |
3710 | }; | |
3711 | goog.events.listenWithWrapper = function $goog$events$listenWithWrapper$(src, wrapper, listener, opt_capt, opt_handler) { | |
3712 | wrapper.listen(src, listener, opt_capt, opt_handler); | |
3713 | }; | |
3714 | goog.events.unlisten = function $goog$events$unlisten$(src, type, listener, opt_capt, opt_handler) { | |
3715 | if (goog.isArray(type)) { | |
3716 | for (var i = 0;i < type.length;i++) { | |
3717 | goog.events.unlisten(src, type[i], listener, opt_capt, opt_handler); | |
3718 | } | |
3719 | return null; | |
3720 | } | |
3721 | listener = goog.events.wrapListener(listener); | |
3722 | if (goog.events.Listenable.isImplementedBy(src)) { | |
3723 | return src.unlisten(type, listener, opt_capt, opt_handler); | |
3724 | } | |
3725 | if (!src) { | |
3726 | return!1; | |
3727 | } | |
3728 | var capture = !!opt_capt, listenerMap = goog.events.getListenerMap_(src); | |
3729 | if (listenerMap) { | |
3730 | var listenerObj = listenerMap.getListener(type, listener, capture, opt_handler); | |
3731 | if (listenerObj) { | |
3732 | return goog.events.unlistenByKey(listenerObj); | |
3733 | } | |
3734 | } | |
3735 | return!1; | |
3736 | }; | |
3737 | goog.events.unlistenByKey = function $goog$events$unlistenByKey$(key) { | |
3738 | if (goog.isNumber(key)) { | |
3739 | return!1; | |
3740 | } | |
3741 | var listener = key; | |
3742 | if (!listener || listener.removed) { | |
3743 | return!1; | |
3744 | } | |
3745 | var src = listener.src; | |
3746 | if (goog.events.Listenable.isImplementedBy(src)) { | |
3747 | return src.unlistenByKey(listener); | |
3748 | } | |
3749 | var type = listener.type, proxy = listener.proxy; | |
3750 | src.removeEventListener ? src.removeEventListener(type, proxy, listener.capture) : src.detachEvent && src.detachEvent(goog.events.getOnString_(type), proxy); | |
3751 | goog.events.listenerCountEstimate_--; | |
3752 | var listenerMap = goog.events.getListenerMap_(src); | |
3753 | listenerMap ? (listenerMap.removeByKey(listener), 0 == listenerMap.getTypeCount() && (listenerMap.src = null, src[goog.events.LISTENER_MAP_PROP_] = null)) : listener.markAsRemoved(); | |
3754 | return!0; | |
3755 | }; | |
3756 | goog.events.unlistenWithWrapper = function $goog$events$unlistenWithWrapper$(src, wrapper, listener, opt_capt, opt_handler) { | |
3757 | wrapper.unlisten(src, listener, opt_capt, opt_handler); | |
3758 | }; | |
3759 | goog.events.removeAll = function $goog$events$removeAll$(opt_obj, opt_type) { | |
3760 | if (!opt_obj) { | |
3761 | return 0; | |
3762 | } | |
3763 | if (goog.events.Listenable.isImplementedBy(opt_obj)) { | |
3764 | return opt_obj.removeAllListeners(opt_type); | |
3765 | } | |
3766 | var listenerMap = goog.events.getListenerMap_(opt_obj); | |
3767 | if (!listenerMap) { | |
3768 | return 0; | |
3769 | } | |
3770 | var count = 0, typeStr = opt_type && opt_type.toString(), type; | |
3771 | for (type in listenerMap.listeners) { | |
3772 | if (!typeStr || type == typeStr) { | |
3773 | for (var listeners = listenerMap.listeners[type].concat(), i = 0;i < listeners.length;++i) { | |
3774 | goog.events.unlistenByKey(listeners[i]) && ++count; | |
3775 | } | |
3776 | } | |
3777 | } | |
3778 | return count; | |
3779 | }; | |
3780 | goog.events.removeAllNativeListeners = function $goog$events$removeAllNativeListeners$() { | |
3781 | return goog.events.listenerCountEstimate_ = 0; | |
3782 | }; | |
3783 | goog.events.getListeners = function $goog$events$getListeners$(obj, type, capture) { | |
3784 | if (goog.events.Listenable.isImplementedBy(obj)) { | |
3785 | return obj.getListeners(type, capture); | |
3786 | } | |
3787 | if (!obj) { | |
3788 | return[]; | |
3789 | } | |
3790 | var listenerMap = goog.events.getListenerMap_(obj); | |
3791 | return listenerMap ? listenerMap.getListeners(type, capture) : []; | |
3792 | }; | |
3793 | goog.events.getListener = function $goog$events$getListener$(src, type, listener, opt_capt, opt_handler) { | |
3794 | listener = goog.events.wrapListener(listener); | |
3795 | var capture = !!opt_capt; | |
3796 | if (goog.events.Listenable.isImplementedBy(src)) { | |
3797 | return src.getListener(type, listener, capture, opt_handler); | |
3798 | } | |
3799 | if (!src) { | |
3800 | return null; | |
3801 | } | |
3802 | var listenerMap = goog.events.getListenerMap_(src); | |
3803 | return listenerMap ? listenerMap.getListener(type, listener, capture, opt_handler) : null; | |
3804 | }; | |
3805 | goog.events.hasListener = function $goog$events$hasListener$(obj, opt_type, opt_capture) { | |
3806 | if (goog.events.Listenable.isImplementedBy(obj)) { | |
3807 | return obj.hasListener(opt_type, opt_capture); | |
3808 | } | |
3809 | var listenerMap = goog.events.getListenerMap_(obj); | |
3810 | return!!listenerMap && listenerMap.hasListener(opt_type, opt_capture); | |
3811 | }; | |
3812 | goog.events.expose = function $goog$events$expose$(e) { | |
3813 | var str = [], key; | |
3814 | for (key in e) { | |
3815 | e[key] && e[key].id ? str.push(key + " = " + e[key] + " (" + e[key].id + ")") : str.push(key + " = " + e[key]); | |
3816 | } | |
3817 | return str.join("\n"); | |
3818 | }; | |
3819 | goog.events.getOnString_ = function $goog$events$getOnString_$(type) { | |
3820 | return type in goog.events.onStringMap_ ? goog.events.onStringMap_[type] : goog.events.onStringMap_[type] = goog.events.onString_ + type; | |
3821 | }; | |
3822 | goog.events.fireListeners = function $goog$events$fireListeners$(obj, type, capture, eventObject) { | |
3823 | return goog.events.Listenable.isImplementedBy(obj) ? obj.fireListeners(type, capture, eventObject) : goog.events.fireListeners_(obj, type, capture, eventObject); | |
3824 | }; | |
3825 | goog.events.fireListeners_ = function $goog$events$fireListeners_$(obj, type, capture, eventObject) { | |
3826 | var retval = 1, listenerMap = goog.events.getListenerMap_(obj); | |
3827 | if (listenerMap) { | |
3828 | var listenerArray = listenerMap.listeners[type.toString()]; | |
3829 | if (listenerArray) { | |
3830 | for (var listenerArray = listenerArray.concat(), i = 0;i < listenerArray.length;i++) { | |
3831 | var listener = listenerArray[i]; | |
3832 | listener && listener.capture == capture && !listener.removed && (retval &= !1 !== goog.events.fireListener(listener, eventObject)); | |
3833 | } | |
3834 | } | |
3835 | } | |
3836 | return Boolean(retval); | |
3837 | }; | |
3838 | goog.events.fireListener = function $goog$events$fireListener$(listener, eventObject) { | |
3839 | var listenerFn = listener.listener, listenerHandler = listener.handler || listener.src; | |
3840 | listener.callOnce && goog.events.unlistenByKey(listener); | |
3841 | return listenerFn.call(listenerHandler, eventObject); | |
3842 | }; | |
3843 | goog.events.getTotalListenerCount = function $goog$events$getTotalListenerCount$() { | |
3844 | return goog.events.listenerCountEstimate_; | |
3845 | }; | |
3846 | goog.events.dispatchEvent = function $goog$events$dispatchEvent$(src, e) { | |
3847 | goog.asserts.assert(goog.events.Listenable.isImplementedBy(src), "Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance."); | |
3848 | return src.dispatchEvent(e); | |
3849 | }; | |
3850 | goog.events.protectBrowserEventEntryPoint = function $goog$events$protectBrowserEventEntryPoint$(errorHandler) { | |
3851 | goog.events.handleBrowserEvent_ = errorHandler.protectEntryPoint(goog.events.handleBrowserEvent_); | |
3852 | }; | |
3853 | goog.events.handleBrowserEvent_ = function $goog$events$handleBrowserEvent_$(listener, opt_evt) { | |
3854 | if (listener.removed) { | |
3855 | return!0; | |
3856 | } | |
3857 | if (!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) { | |
3858 | var ieEvent = opt_evt || goog.getObjectByName("window.event"), evt = new goog.events.BrowserEvent(ieEvent, this), retval = !0; | |
3859 | if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.ON) { | |
3860 | if (!goog.events.isMarkedIeEvent_(ieEvent)) { | |
3861 | goog.events.markIeEvent_(ieEvent); | |
3862 | for (var ancestors = [], parent = evt.currentTarget;parent;parent = parent.parentNode) { | |
3863 | ancestors.push(parent); | |
3864 | } | |
3865 | for (var type = listener.type, i = ancestors.length - 1;!evt.propagationStopped_ && 0 <= i;i--) { | |
3866 | evt.currentTarget = ancestors[i], retval &= goog.events.fireListeners_(ancestors[i], type, !0, evt); | |
3867 | } | |
3868 | for (i = 0;!evt.propagationStopped_ && i < ancestors.length;i++) { | |
3869 | evt.currentTarget = ancestors[i], retval &= goog.events.fireListeners_(ancestors[i], type, !1, evt); | |
3870 | } | |
3871 | } | |
3872 | } else { | |
3873 | retval = goog.events.fireListener(listener, evt); | |
3874 | } | |
3875 | return retval; | |
3876 | } | |
3877 | return goog.events.fireListener(listener, new goog.events.BrowserEvent(opt_evt, this)); | |
3878 | }; | |
3879 | goog.events.markIeEvent_ = function $goog$events$markIeEvent_$(e) { | |
3880 | var useReturnValue = !1; | |
3881 | if (0 == e.keyCode) { | |
3882 | try { | |
3883 | e.keyCode = -1; | |
3884 | return; | |
3885 | } catch (ex) { | |
3886 | useReturnValue = !0; | |
3887 | } | |
3888 | } | |
3889 | if (useReturnValue || void 0 == e.returnValue) { | |
3890 | e.returnValue = !0; | |
3891 | } | |
3892 | }; | |
3893 | goog.events.isMarkedIeEvent_ = function $goog$events$isMarkedIeEvent_$(e) { | |
3894 | return 0 > e.keyCode || void 0 != e.returnValue; | |
3895 | }; | |
3896 | goog.events.uniqueIdCounter_ = 0; | |
3897 | goog.events.getUniqueId = function $goog$events$getUniqueId$(identifier) { | |
3898 | return identifier + "_" + goog.events.uniqueIdCounter_++; | |
3899 | }; | |
3900 | goog.events.getListenerMap_ = function $goog$events$getListenerMap_$(src) { | |
3901 | var listenerMap = src[goog.events.LISTENER_MAP_PROP_]; | |
3902 | return listenerMap instanceof goog.events.ListenerMap ? listenerMap : null; | |
3903 | }; | |
3904 | goog.events.LISTENER_WRAPPER_PROP_ = "__closure_events_fn_" + (1E9 * Math.random() >>> 0); | |
3905 | goog.events.wrapListener = function $goog$events$wrapListener$(listener) { | |
3906 | goog.asserts.assert(listener, "Listener can not be null."); | |
3907 | if (goog.isFunction(listener)) { | |
3908 | return listener; | |
3909 | } | |
3910 | goog.asserts.assert(listener.handleEvent, "An object listener must have handleEvent method."); | |
3911 | return listener[goog.events.LISTENER_WRAPPER_PROP_] || (listener[goog.events.LISTENER_WRAPPER_PROP_] = function $listener$goog$events$LISTENER_WRAPPER_PROP_$(e) { | |
3912 | return listener.handleEvent(e); | |
3913 | }); | |
3914 | }; | |
3915 | goog.debug.entryPointRegistry.register(function(transformer) { | |
3916 | goog.events.handleBrowserEvent_ = transformer(goog.events.handleBrowserEvent_); | |
3917 | }); | |
3918 | goog.events.EventTarget = function $goog$events$EventTarget$() { | |
3919 | goog.Disposable.call(this); | |
3920 | this.eventTargetListeners_ = new goog.events.ListenerMap(this); | |
3921 | this.actualEventTarget_ = this; | |
3922 | }; | |
3923 | goog.inherits(goog.events.EventTarget, goog.Disposable); | |
3924 | goog.events.Listenable.addImplementation(goog.events.EventTarget); | |
3925 | goog.events.EventTarget.MAX_ANCESTORS_ = 1E3; | |
3926 | goog.events.EventTarget.prototype.parentEventTarget_ = null; | |
3927 | goog.events.EventTarget.prototype.getParentEventTarget = function $goog$events$EventTarget$$getParentEventTarget$() { | |
3928 | return this.parentEventTarget_; | |
3929 | }; | |
3930 | goog.events.EventTarget.prototype.setParentEventTarget = function $goog$events$EventTarget$$setParentEventTarget$(parent) { | |
3931 | this.parentEventTarget_ = parent; | |
3932 | }; | |
3933 | goog.events.EventTarget.prototype.addEventListener = function $goog$events$EventTarget$$addEventListener$(type, handler, opt_capture, opt_handlerScope) { | |
3934 | goog.events.listen(this, type, handler, opt_capture, opt_handlerScope); | |
3935 | }; | |
3936 | goog.events.EventTarget.prototype.removeEventListener = function $goog$events$EventTarget$$removeEventListener$(type, handler, opt_capture, opt_handlerScope) { | |
3937 | goog.events.unlisten(this, type, handler, opt_capture, opt_handlerScope); | |
3938 | }; | |
3939 | goog.events.EventTarget.prototype.dispatchEvent = function $goog$events$EventTarget$$dispatchEvent$(e) { | |
3940 | this.assertInitialized_(); | |
3941 | var ancestorsTree, ancestor = this.getParentEventTarget(); | |
3942 | if (ancestor) { | |
3943 | ancestorsTree = []; | |
3944 | for (var ancestorCount = 1;ancestor;ancestor = ancestor.getParentEventTarget()) { | |
3945 | ancestorsTree.push(ancestor), goog.asserts.assert(++ancestorCount < goog.events.EventTarget.MAX_ANCESTORS_, "infinite loop"); | |
3946 | } | |
3947 | } | |
3948 | return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_, e, ancestorsTree); | |
3949 | }; | |
3950 | goog.events.EventTarget.prototype.disposeInternal = function $goog$events$EventTarget$$disposeInternal$() { | |
3951 | goog.events.EventTarget.superClass_.disposeInternal.call(this); | |
3952 | this.removeAllListeners(); | |
3953 | this.parentEventTarget_ = null; | |
3954 | }; | |
3955 | goog.events.EventTarget.prototype.listen = function $goog$events$EventTarget$$listen$(type, listener, opt_useCapture, opt_listenerScope) { | |
3956 | this.assertInitialized_(); | |
3957 | return this.eventTargetListeners_.add(String(type), listener, !1, opt_useCapture, opt_listenerScope); | |
3958 | }; | |
3959 | goog.events.EventTarget.prototype.listenOnce = function $goog$events$EventTarget$$listenOnce$(type, listener, opt_useCapture, opt_listenerScope) { | |
3960 | return this.eventTargetListeners_.add(String(type), listener, !0, opt_useCapture, opt_listenerScope); | |
3961 | }; | |
3962 | goog.events.EventTarget.prototype.unlisten = function $goog$events$EventTarget$$unlisten$(type, listener, opt_useCapture, opt_listenerScope) { | |
3963 | return this.eventTargetListeners_.remove(String(type), listener, opt_useCapture, opt_listenerScope); | |
3964 | }; | |
3965 | goog.events.EventTarget.prototype.unlistenByKey = function $goog$events$EventTarget$$unlistenByKey$(key) { | |
3966 | return this.eventTargetListeners_.removeByKey(key); | |
3967 | }; | |
3968 | goog.events.EventTarget.prototype.removeAllListeners = function $goog$events$EventTarget$$removeAllListeners$(opt_type) { | |
3969 | return this.eventTargetListeners_ ? this.eventTargetListeners_.removeAll(opt_type) : 0; | |
3970 | }; | |
3971 | goog.events.EventTarget.prototype.fireListeners = function $goog$events$EventTarget$$fireListeners$(type, capture, eventObject) { | |
3972 | var listenerArray = this.eventTargetListeners_.listeners[String(type)]; | |
3973 | if (!listenerArray) { | |
3974 | return!0; | |
3975 | } | |
3976 | for (var listenerArray = goog.array.clone(listenerArray), rv = !0, i = 0;i < listenerArray.length;++i) { | |
3977 | var listener = listenerArray[i]; | |
3978 | if (listener && !listener.removed && listener.capture == capture) { | |
3979 | var listenerFn = listener.listener, listenerHandler = listener.handler || listener.src; | |
3980 | listener.callOnce && this.unlistenByKey(listener); | |
3981 | rv = !1 !== listenerFn.call(listenerHandler, eventObject) && rv; | |
3982 | } | |
3983 | } | |
3984 | return rv && !1 != eventObject.returnValue_; | |
3985 | }; | |
3986 | goog.events.EventTarget.prototype.getListeners = function $goog$events$EventTarget$$getListeners$(type, capture) { | |
3987 | return this.eventTargetListeners_.getListeners(String(type), capture); | |
3988 | }; | |
3989 | goog.events.EventTarget.prototype.getListener = function $goog$events$EventTarget$$getListener$(type, listener, capture, opt_listenerScope) { | |
3990 | return this.eventTargetListeners_.getListener(String(type), listener, capture, opt_listenerScope); | |
3991 | }; | |
3992 | goog.events.EventTarget.prototype.hasListener = function $goog$events$EventTarget$$hasListener$(opt_type, opt_capture) { | |
3993 | var id = goog.isDef(opt_type) ? String(opt_type) : void 0; | |
3994 | return this.eventTargetListeners_.hasListener(id, opt_capture); | |
3995 | }; | |
3996 | goog.events.EventTarget.prototype.assertInitialized_ = function $goog$events$EventTarget$$assertInitialized_$() { | |
3997 | goog.asserts.assert(this.eventTargetListeners_, "Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?"); | |
3998 | }; | |
3999 | goog.events.EventTarget.dispatchEventInternal_ = function $goog$events$EventTarget$dispatchEventInternal_$(target, e, opt_ancestorsTree) { | |
4000 | var type = e.type || e; | |
4001 | if (goog.isString(e)) { | |
4002 | e = new goog.events.Event(e, target); | |
4003 | } else { | |
4004 | if (e instanceof goog.events.Event) { | |
4005 | e.target = e.target || target; | |
4006 | } else { | |
4007 | var oldEvent = e; | |
4008 | e = new goog.events.Event(type, target); | |
4009 | goog.object.extend(e, oldEvent); | |
4010 | } | |
4011 | } | |
4012 | var rv = !0, currentTarget; | |
4013 | if (opt_ancestorsTree) { | |
4014 | for (var i = opt_ancestorsTree.length - 1;!e.propagationStopped_ && 0 <= i;i--) { | |
4015 | currentTarget = e.currentTarget = opt_ancestorsTree[i], rv = currentTarget.fireListeners(type, !0, e) && rv; | |
4016 | } | |
4017 | } | |
4018 | e.propagationStopped_ || (currentTarget = e.currentTarget = target, rv = currentTarget.fireListeners(type, !0, e) && rv, e.propagationStopped_ || (rv = currentTarget.fireListeners(type, !1, e) && rv)); | |
4019 | if (opt_ancestorsTree) { | |
4020 | for (i = 0;!e.propagationStopped_ && i < opt_ancestorsTree.length;i++) { | |
4021 | currentTarget = e.currentTarget = opt_ancestorsTree[i], rv = currentTarget.fireListeners(type, !1, e) && rv; | |
4022 | } | |
4023 | } | |
4024 | return rv; | |
4025 | }; | |
4026 | i18n.input.chrome.inputview = {}; | |
4027 | i18n.input.chrome.inputview.Context = function $i18n$input$chrome$inputview$Context$() { | |
4028 | goog.events.EventTarget.call(this); | |
4029 | }; | |
4030 | goog.inherits(i18n.input.chrome.inputview.Context, goog.events.EventTarget); | |
4031 | i18n.input.chrome.inputview.Context.prototype.isA11yMode = !1; | |
4032 | i18n.input.chrome.inputview.Context.prototype.setCompositionText = goog.functions.NULL; | |
4033 | i18n.input.chrome.inputview.Context.prototype.sendKeyDownAndUpEvent = goog.functions.NULL; | |
4034 | i18n.input.chrome.inputview.Context.prototype.sendKeyDownAndUpMessage = goog.functions.NULL; | |
4035 | i18n.input.chrome.inputview.Context.prototype.sendKeyDownEvent = goog.functions.NULL; | |
4036 | i18n.input.chrome.inputview.Context.prototype.sendKeyUpEvent = goog.functions.NULL; | |
4037 | i18n.input.chrome.inputview.Context.prototype.commitText = goog.functions.NULL; | |
4038 | i18n.input.chrome.inputview.Context.prototype.getCompositionText = goog.functions.constant(""); | |
4039 | i18n.input.chrome.inputview.Context.prototype.getCommittedText = goog.functions.constant(""); | |
4040 | i18n.input.chrome.inputview.Context.prototype.hideKeyboard = goog.functions.NULL; | |
4041 | i18n.input.chrome.inputview.Context.prototype.execAll = goog.functions.NULL; | |
4042 | i18n.input.chrome.inputview.Context.prototype.isPasswdBox = goog.functions.TRUE; | |
4043 | i18n.input.chrome.inputview.Context.prototype.isVisible = goog.functions.FALSE; | |
4044 | i18n.input.chrome.inputview.Context.prototype.setModifierState = goog.functions.NULL; | |
4045 | i18n.input.chrome.inputview.Context.prototype.getQueryText = goog.functions.constant(""); | |
4046 | i18n.input.chrome.inputview.Context.EventType = {UPDATE:"u$0", RESET:"r$1", CONTEXT_CHANGE:"cc$2", VISIBILITY_CHANGE:"vc$3"}; | |
4047 | i18n.input.chrome.inputview.events = {}; | |
4048 | i18n.input.chrome.inputview.events.EventType = {CONFIG_LOADED:"cl$4", DOUBLE_CLICK:"dc$5", KEY_CLICK:"kc$6", LAYOUT_LOADED:"ll$7", LONG_PRESS:"lp$8", LONG_PRESS_END:"lpe$9", POINTER_DOWN:"pd$10", POINTER_UP:"pu$11", POINTER_OVER:"po$12", POINTER_OUT:"po$13", SETTINGS_READY:"sr$14", SWIPE:"s$15"}; | |
4049 | i18n.input.chrome.inputview.events.LayoutLoadedEvent = function $i18n$input$chrome$inputview$events$LayoutLoadedEvent$(data) { | |
4050 | goog.events.Event.call(this, i18n.input.chrome.inputview.events.EventType.LAYOUT_LOADED); | |
4051 | this.data = data; | |
4052 | }; | |
4053 | goog.inherits(i18n.input.chrome.inputview.events.LayoutLoadedEvent, goog.events.Event); | |
4054 | i18n.input.chrome.inputview.events.ConfigLoadedEvent = function $i18n$input$chrome$inputview$events$ConfigLoadedEvent$(data) { | |
4055 | goog.events.Event.call(this, i18n.input.chrome.inputview.events.EventType.CONFIG_LOADED); | |
4056 | this.data = data; | |
4057 | }; | |
4058 | goog.inherits(i18n.input.chrome.inputview.events.ConfigLoadedEvent, goog.events.Event); | |
4059 | i18n.input.chrome.inputview.events.KeyClickEvent = function $i18n$input$chrome$inputview$events$KeyClickEvent$(keyData) { | |
4060 | goog.events.Event.call(this, i18n.input.chrome.inputview.events.EventType.KEY_CLICK); | |
4061 | this.keyData = keyData; | |
4062 | }; | |
4063 | goog.inherits(i18n.input.chrome.inputview.events.KeyClickEvent, goog.events.Event); | |
4064 | i18n.input.chrome.inputview.events.PointerEvent = function $i18n$input$chrome$inputview$events$PointerEvent$(view, type, target, x, y) { | |
4065 | goog.events.Event.call(this, type, target); | |
4066 | this.view = view; | |
4067 | this.x = x; | |
4068 | this.y = y; | |
4069 | }; | |
4070 | goog.inherits(i18n.input.chrome.inputview.events.PointerEvent, goog.events.Event); | |
4071 | i18n.input.chrome.inputview.events.SwipeEvent = function $i18n$input$chrome$inputview$events$SwipeEvent$(view, direction, target, x, y) { | |
4072 | i18n.input.chrome.inputview.events.PointerEvent.call(this, view, i18n.input.chrome.inputview.events.EventType.SWIPE, target, x, y); | |
4073 | this.direction = direction; | |
4074 | }; | |
4075 | goog.inherits(i18n.input.chrome.inputview.events.SwipeEvent, i18n.input.chrome.inputview.events.PointerEvent); | |
4076 | i18n.input.chrome.inputview.ChromeOsContext = function $i18n$input$chrome$inputview$ChromeOsContext$(isKeyEventhandled) { | |
4077 | i18n.input.chrome.inputview.Context.call(this); | |
4078 | this.isHidden_ = document.webkitHidden; | |
4079 | this.context = {contextID:0, type:""}; | |
4080 | this.modifierState_ = {}; | |
4081 | var self = this; | |
4082 | chrome.virtualKeyboardPrivate && chrome.virtualKeyboardPrivate.getKeyboardConfig && chrome.virtualKeyboardPrivate.getKeyboardConfig(function(config) { | |
4083 | self.isA11yMode = !!config.a11ymode; | |
4084 | self.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.events.EventType.SETTINGS_READY)); | |
4085 | }); | |
4086 | window.setTimeout(function() { | |
4087 | self.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.events.EventType.SETTINGS_READY)); | |
4088 | }, 500); | |
4089 | this.registerEventHandler_(isKeyEventhandled); | |
4090 | chrome.inputMethodPrivate && chrome.inputMethodPrivate.startIme && chrome.inputMethodPrivate.startIme(); | |
4091 | }; | |
4092 | goog.inherits(i18n.input.chrome.inputview.ChromeOsContext, i18n.input.chrome.inputview.Context); | |
4093 | i18n.input.chrome.inputview.ChromeOsContext.prototype.compositionText_ = ""; | |
4094 | i18n.input.chrome.inputview.ChromeOsContext.prototype.committedText_ = ""; | |
4095 | i18n.input.chrome.inputview.ChromeOsContext.prototype.requestId_ = 0; | |
4096 | i18n.input.chrome.inputview.ChromeOsContext.prototype.textBeforeCursor_ = ""; | |
4097 | i18n.input.chrome.inputview.ChromeOsContext.prototype.registerEventHandler_ = function $i18n$input$chrome$inputview$ChromeOsContext$$registerEventHandler_$(isKeyEventhandled) { | |
4098 | isKeyEventhandled && chrome.input.ime.onKeyEvent.addListener(this.onKeyEvent_.bind(this)); | |
4099 | chrome.input.ime.onFocus.addListener(this.onFocus_.bind(this)); | |
4100 | chrome.input.ime.onReset.addListener(this.onContextReset_.bind(this)); | |
4101 | chrome.input.ime.onBlur.addListener(this.onBlur_.bind(this)); | |
4102 | chrome.input.ime.onSurroundingTextChanged.addListener(this.onSurroundingTextChanged_.bind(this)); | |
4103 | document.addEventListener("webkitvisibilitychange", this.onVisibilityChange_.bind(this)); | |
4104 | }; | |
4105 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onVisibilityChange_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onVisibilityChange_$() { | |
4106 | this.isHidden_ = document.webkitHidden; | |
4107 | this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.VISIBILITY_CHANGE)); | |
4108 | }; | |
4109 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onKeyEvent_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onKeyEvent_$(engineID, keyData) { | |
4110 | if (this.isHidden_) { | |
4111 | return!1; | |
4112 | } | |
4113 | var ret = this.dispatchEvent(new i18n.input.chrome.inputview.events.KeyClickEvent(keyData)); | |
4114 | return!ret; | |
4115 | }; | |
4116 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onContextReset_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onContextReset_$() { | |
4117 | this.settingComposing_ || (this.committedText_ = this.compositionText_ = "", this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.UPDATE))); | |
4118 | }; | |
4119 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onBlur_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onBlur_$() { | |
4120 | this.context.contextID = 0; | |
4121 | this.committedText_ = this.compositionText_ = this.context.type = ""; | |
4122 | this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.RESET)); | |
4123 | }; | |
4124 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onFocus_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onFocus_$(context) { | |
4125 | this.context = context; | |
4126 | this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.CONTEXT_CHANGE)); | |
4127 | }; | |
4128 | i18n.input.chrome.inputview.ChromeOsContext.prototype.onSurroundingTextChanged_ = function $i18n$input$chrome$inputview$ChromeOsContext$$onSurroundingTextChanged_$(engineID, surroundingInfo) { | |
4129 | if (!this.compositionText_) { | |
4130 | var text = surroundingInfo.text.slice(0, surroundingInfo.anchor), matches = text.match(/([a-zA-Z'-]+)\s*$/); | |
4131 | matches && (this.textBeforeCursor_ = matches[1]); | |
4132 | } | |
4133 | }; | |
4134 | i18n.input.chrome.inputview.ChromeOsContext.prototype.setCompositionText = function $i18n$input$chrome$inputview$ChromeOsContext$$setCompositionText$(compositionText) { | |
4135 | if (0 != this.context.contextID) { | |
4136 | this.maybeSendKickOffEvent_(); | |
4137 | this.committedText_ = ""; | |
4138 | this.compositionText_ = compositionText; | |
4139 | this.settingComposing_ = !0; | |
4140 | i18n.input.chrome.vk.DeferredApi.setComposition(this.context.contextID, compositionText, compositionText.length); | |
4141 | this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.UPDATE)); | |
4142 | var self = this; | |
4143 | window.setTimeout(function() { | |
4144 | self.settingComposing_ = !1; | |
4145 | }, 10); | |
4146 | } | |
4147 | }; | |
4148 | i18n.input.chrome.inputview.ChromeOsContext.prototype.getCompositionText = function $i18n$input$chrome$inputview$ChromeOsContext$$getCompositionText$() { | |
4149 | return this.compositionText_; | |
4150 | }; | |
4151 | i18n.input.chrome.inputview.ChromeOsContext.prototype.getCommittedText = function $i18n$input$chrome$inputview$ChromeOsContext$$getCommittedText$() { | |
4152 | return this.committedText_; | |
4153 | }; | |
4154 | i18n.input.chrome.inputview.ChromeOsContext.prototype.maybeSendKickOffEvent_ = function $i18n$input$chrome$inputview$ChromeOsContext$$maybeSendKickOffEvent_$() { | |
4155 | this.isPasswdBox() || this.sendKeyEvent_([this.generateKeyboardEvent_("keydown", "", "KeyA"), this.generateKeyboardEvent_("keyup", "", "KeyA")]); | |
4156 | }; | |
4157 | i18n.input.chrome.inputview.ChromeOsContext.prototype.commitText = function $i18n$input$chrome$inputview$ChromeOsContext$$commitText$(opt_text) { | |
4158 | var textToCommit = opt_text || this.compositionText_; | |
4159 | if (0 != this.context.contextID && textToCommit) { | |
4160 | this.maybeSendKickOffEvent_(); | |
4161 | var contextID = this.context.contextID; | |
4162 | if (this.compositionText_ || this.isPasswdBox()) { | |
4163 | chrome.input.ime.commitText({contextID:contextID, text:textToCommit}); | |
4164 | } else { | |
4165 | var ch = "\u200b"; | |
4166 | chrome.input.ime.setComposition({contextID:contextID, text:ch, cursor:ch.length}, function() { | |
4167 | chrome.input.ime.commitText({contextID:contextID, text:textToCommit}); | |
4168 | }); | |
4169 | } | |
4170 | this.compositionText_ = ""; | |
4171 | " " != textToCommit && (this.committedText_ = textToCommit); | |
4172 | this.dispatchEvent(new goog.events.Event(i18n.input.chrome.inputview.Context.EventType.UPDATE)); | |
4173 | } | |
4174 | }; | |
4175 | i18n.input.chrome.inputview.ChromeOsContext.prototype.sendKeyDownAndUpEvent = function $i18n$input$chrome$inputview$ChromeOsContext$$sendKeyDownAndUpEvent$(key, code) { | |
4176 | this.commitText(); | |
4177 | this.sendKeyEvent_([this.generateKeyboardEvent_("keydown", key, code), this.generateKeyboardEvent_("keyup", key, code)]); | |
4178 | }; | |
4179 | i18n.input.chrome.inputview.ChromeOsContext.prototype.sendKeyDownAndUpMessage = function $i18n$input$chrome$inputview$ChromeOsContext$$sendKeyDownAndUpMessage$(key, code, opt_callback) { | |
4180 | chrome.runtime.sendMessage(goog.object.create(goog.events.EventType.KEYDOWN, this.generateKeyboardEvent_(goog.events.EventType.KEYDOWN, key, code), goog.events.EventType.KEYUP, this.generateKeyboardEvent_(goog.events.EventType.KEYUP, key, code)), opt_callback); | |
4181 | }; | |
4182 | i18n.input.chrome.inputview.ChromeOsContext.prototype.sendKeyDownEvent = function $i18n$input$chrome$inputview$ChromeOsContext$$sendKeyDownEvent$(key, code) { | |
4183 | this.commitText(); | |
4184 | this.sendKeyEvent_([this.generateKeyboardEvent_("keydown", key, code)]); | |
4185 | }; | |
4186 | i18n.input.chrome.inputview.ChromeOsContext.prototype.sendKeyUpEvent = function $i18n$input$chrome$inputview$ChromeOsContext$$sendKeyUpEvent$(key, code) { | |
4187 | this.commitText(); | |
4188 | this.sendKeyEvent_([this.generateKeyboardEvent_("keyup", key, code)]); | |
4189 | }; | |
4190 | i18n.input.chrome.inputview.ChromeOsContext.prototype.sendKeyEvent_ = function $i18n$input$chrome$inputview$ChromeOsContext$$sendKeyEvent_$(keyData) { | |
4191 | chrome.input.ime.sendKeyEvents({contextID:0, keyData:keyData}); | |
4192 | }; | |
4193 | i18n.input.chrome.inputview.ChromeOsContext.prototype.generateKeyboardEvent_ = function $i18n$input$chrome$inputview$ChromeOsContext$$generateKeyboardEvent_$(type, key, code) { | |
4194 | var result = {type:type, key:key, code:code, requestId:String(this.requestId_++)}, StateType = i18n.input.chrome.inputview.StateType; | |
4195 | result.altKey = !!this.modifierState_[StateType.ALT]; | |
4196 | result.ctrlKey = !!this.modifierState_[StateType.CTRL]; | |
4197 | result.shiftKey = !!this.modifierState_[StateType.SHIFT]; | |
4198 | result.capsLock = !!this.modifierState_[StateType.CAPSLOCK]; | |
4199 | return result; | |
4200 | }; | |
4201 | i18n.input.chrome.inputview.ChromeOsContext.prototype.execAll = function $i18n$input$chrome$inputview$ChromeOsContext$$execAll$() { | |
4202 | i18n.input.chrome.vk.DeferredCallManager.getInstance().execAll(); | |
4203 | }; | |
4204 | i18n.input.chrome.inputview.ChromeOsContext.prototype.hideKeyboard = function $i18n$input$chrome$inputview$ChromeOsContext$$hideKeyboard$() { | |
4205 | chrome.input.ime.hideInputView(); | |
4206 | }; | |
4207 | i18n.input.chrome.inputview.ChromeOsContext.prototype.isPasswdBox = function $i18n$input$chrome$inputview$ChromeOsContext$$isPasswdBox$() { | |
4208 | return!!this.context && (!this.context.type || "password" == this.context.type); | |
4209 | }; | |
4210 | i18n.input.chrome.inputview.ChromeOsContext.prototype.isVisible = function $i18n$input$chrome$inputview$ChromeOsContext$$isVisible$() { | |
4211 | return!this.isHidden_; | |
4212 | }; | |
4213 | i18n.input.chrome.inputview.ChromeOsContext.prototype.setModifierState = function $i18n$input$chrome$inputview$ChromeOsContext$$setModifierState$(stateType, enable) { | |
4214 | this.modifierState_[stateType] = enable; | |
4215 | }; | |
4216 | i18n.input.chrome.inputview.ChromeOsContext.prototype.getQueryText = function $i18n$input$chrome$inputview$ChromeOsContext$$getQueryText$() { | |
4217 | return this.textBeforeCursor_ + "," + this.compositionText_; | |
4218 | }; | |
4219 | i18n.input.chrome.inputview.ChromeOsContext.prototype.setContext = function $i18n$input$chrome$inputview$ChromeOsContext$$setContext$(context) { | |
4220 | this.context = context; | |
4221 | }; | |
4222 | goog.Timer = function $goog$Timer$(opt_interval, opt_timerObject) { | |
4223 | goog.events.EventTarget.call(this); | |
4224 | this.interval_ = opt_interval || 1; | |
4225 | this.timerObject_ = opt_timerObject || goog.Timer.defaultTimerObject; | |
4226 | this.boundTick_ = goog.bind(this.tick_, this); | |
4227 | this.last_ = goog.now(); | |
4228 | }; | |
4229 | goog.inherits(goog.Timer, goog.events.EventTarget); | |
4230 | goog.Timer.MAX_TIMEOUT_ = 2147483647; | |
4231 | goog.Timer.prototype.enabled = !1; | |
4232 | goog.Timer.defaultTimerObject = goog.global; | |
4233 | goog.Timer.intervalScale = .8; | |
4234 | goog.Timer.prototype.timer_ = null; | |
4235 | goog.Timer.prototype.tick_ = function $goog$Timer$$tick_$() { | |
4236 | if (this.enabled) { | |
4237 | var elapsed = goog.now() - this.last_; | |
4238 | 0 < elapsed && elapsed < this.interval_ * goog.Timer.intervalScale ? this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_ - elapsed) : (this.timer_ && (this.timerObject_.clearTimeout(this.timer_), this.timer_ = null), this.dispatchTick(), this.enabled && (this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_), this.last_ = goog.now())); | |
4239 | } | |
4240 | }; | |
4241 | goog.Timer.prototype.dispatchTick = function $goog$Timer$$dispatchTick$() { | |
4242 | this.dispatchEvent(goog.Timer.TICK); | |
4243 | }; | |
4244 | goog.Timer.prototype.start = function $goog$Timer$$start$() { | |
4245 | this.enabled = !0; | |
4246 | this.timer_ || (this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_), this.last_ = goog.now()); | |
4247 | }; | |
4248 | goog.Timer.prototype.stop = function $goog$Timer$$stop$() { | |
4249 | this.enabled = !1; | |
4250 | this.timer_ && (this.timerObject_.clearTimeout(this.timer_), this.timer_ = null); | |
4251 | }; | |
4252 | goog.Timer.prototype.disposeInternal = function $goog$Timer$$disposeInternal$() { | |
4253 | goog.Timer.superClass_.disposeInternal.call(this); | |
4254 | this.stop(); | |
4255 | delete this.timerObject_; | |
4256 | }; | |
4257 | goog.Timer.TICK = "tick"; | |
4258 | goog.Timer.callOnce = function $goog$Timer$callOnce$(listener, opt_delay, opt_handler) { | |
4259 | if (goog.isFunction(listener)) { | |
4260 | opt_handler && (listener = goog.bind(listener, opt_handler)); | |
4261 | } else { | |
4262 | if (listener && "function" == typeof listener.handleEvent) { | |
4263 | listener = goog.bind(listener.handleEvent, listener); | |
4264 | } else { | |
4265 | throw Error("Invalid listener argument"); | |
4266 | } | |
4267 | } | |
4268 | return opt_delay > goog.Timer.MAX_TIMEOUT_ ? -1 : goog.Timer.defaultTimerObject.setTimeout(listener, opt_delay || 0); | |
4269 | }; | |
4270 | goog.Timer.clear = function $goog$Timer$clear$(timerId) { | |
4271 | goog.Timer.defaultTimerObject.clearTimeout(timerId); | |
4272 | }; | |
4273 | goog.async = {}; | |
4274 | goog.async.Delay = function $goog$async$Delay$(listener, opt_interval, opt_handler) { | |
4275 | goog.Disposable.call(this); | |
4276 | this.listener_ = listener; | |
4277 | this.interval_ = opt_interval || 0; | |
4278 | this.handler_ = opt_handler; | |
4279 | this.callback_ = goog.bind(this.doAction_, this); | |
4280 | }; | |
4281 | goog.inherits(goog.async.Delay, goog.Disposable); | |
4282 | goog.Delay = goog.async.Delay; | |
4283 | goog.async.Delay.prototype.id_ = 0; | |
4284 | goog.async.Delay.prototype.disposeInternal = function $goog$async$Delay$$disposeInternal$() { | |
4285 | goog.async.Delay.superClass_.disposeInternal.call(this); | |
4286 | this.stop(); | |
4287 | delete this.listener_; | |
4288 | delete this.handler_; | |
4289 | }; | |
4290 | goog.async.Delay.prototype.start = function $goog$async$Delay$$start$(opt_interval) { | |
4291 | this.stop(); | |
4292 | this.id_ = goog.Timer.callOnce(this.callback_, goog.isDef(opt_interval) ? opt_interval : this.interval_); | |
4293 | }; | |
4294 | goog.async.Delay.prototype.stop = function $goog$async$Delay$$stop$() { | |
4295 | this.isActive() && goog.Timer.clear(this.id_); | |
4296 | this.id_ = 0; | |
4297 | }; | |
4298 | goog.async.Delay.prototype.isActive = function $goog$async$Delay$$isActive$() { | |
4299 | return 0 != this.id_; | |
4300 | }; | |
4301 | goog.async.Delay.prototype.doAction_ = function $goog$async$Delay$$doAction_$() { | |
4302 | this.id_ = 0; | |
4303 | this.listener_ && this.listener_.call(this.handler_); | |
4304 | }; | |
4305 | goog.math.Coordinate = function $goog$math$Coordinate$(opt_x, opt_y) { | |
4306 | this.x = goog.isDef(opt_x) ? opt_x : 0; | |
4307 | this.y = goog.isDef(opt_y) ? opt_y : 0; | |
4308 | }; | |
4309 | goog.math.Coordinate.prototype.clone = function $goog$math$Coordinate$$clone$() { | |
4310 | return new goog.math.Coordinate(this.x, this.y); | |
4311 | }; | |
4312 | goog.DEBUG && (goog.math.Coordinate.prototype.toString = function $goog$math$Coordinate$$toString$() { | |
4313 | return "(" + this.x + ", " + this.y + ")"; | |
4314 | }); | |
4315 | goog.math.Coordinate.equals = function $goog$math$Coordinate$equals$(a, b) { | |
4316 | return a == b ? !0 : a && b ? a.x == b.x && a.y == b.y : !1; | |
4317 | }; | |
4318 | goog.math.Coordinate.distance = function $goog$math$Coordinate$distance$(a, b) { | |
4319 | var dx = a.x - b.x, dy = a.y - b.y; | |
4320 | return Math.sqrt(dx * dx + dy * dy); | |
4321 | }; | |
4322 | goog.math.Coordinate.magnitude = function $goog$math$Coordinate$magnitude$(a) { | |
4323 | return Math.sqrt(a.x * a.x + a.y * a.y); | |
4324 | }; | |
4325 | goog.math.Coordinate.azimuth = function $goog$math$Coordinate$azimuth$(a) { | |
4326 | return goog.math.angle(0, 0, a.x, a.y); | |
4327 | }; | |
4328 | goog.math.Coordinate.squaredDistance = function $goog$math$Coordinate$squaredDistance$(a, b) { | |
4329 | var dx = a.x - b.x, dy = a.y - b.y; | |
4330 | return dx * dx + dy * dy; | |
4331 | }; | |
4332 | goog.math.Coordinate.difference = function $goog$math$Coordinate$difference$(a, b) { | |
4333 | return new goog.math.Coordinate(a.x - b.x, a.y - b.y); | |
4334 | }; | |
4335 | goog.math.Coordinate.sum = function $goog$math$Coordinate$sum$(a, b) { | |
4336 | return new goog.math.Coordinate(a.x + b.x, a.y + b.y); | |
4337 | }; | |
4338 | goog.math.Coordinate.prototype.ceil = function $goog$math$Coordinate$$ceil$() { | |
4339 | this.x = Math.ceil(this.x); | |
4340 | this.y = Math.ceil(this.y); | |
4341 | return this; | |
4342 | }; | |
4343 | goog.math.Coordinate.prototype.floor = function $goog$math$Coordinate$$floor$() { | |
4344 | this.x = Math.floor(this.x); | |
4345 | this.y = Math.floor(this.y); | |
4346 | return this; | |
4347 | }; | |
4348 | goog.math.Coordinate.prototype.round = function $goog$math$Coordinate$$round$() { | |
4349 | this.x = Math.round(this.x); | |
4350 | this.y = Math.round(this.y); | |
4351 | return this; | |
4352 | }; | |
4353 | goog.math.Size = function $goog$math$Size$(width, height) { | |
4354 | this.width = width; | |
4355 | this.height = height; | |
4356 | }; | |
4357 | goog.math.Size.equals = function $goog$math$Size$equals$(a, b) { | |
4358 | return a == b ? !0 : a && b ? a.width == b.width && a.height == b.height : !1; | |
4359 | }; | |
4360 | goog.math.Size.prototype.clone = function $goog$math$Size$$clone$() { | |
4361 | return new goog.math.Size(this.width, this.height); | |
4362 | }; | |
4363 | goog.DEBUG && (goog.math.Size.prototype.toString = function $goog$math$Size$$toString$() { | |
4364 | return "(" + this.width + " x " + this.height + ")"; | |
4365 | }); | |
4366 | goog.math.Size.prototype.area = function $goog$math$Size$$area$() { | |
4367 | return this.width * this.height; | |
4368 | }; | |
4369 | goog.math.Size.prototype.isEmpty = function $goog$math$Size$$isEmpty$() { | |
4370 | return!this.area(); | |
4371 | }; | |
4372 | goog.math.Size.prototype.ceil = function $goog$math$Size$$ceil$() { | |
4373 | this.width = Math.ceil(this.width); | |
4374 | this.height = Math.ceil(this.height); | |
4375 | return this; | |
4376 | }; | |
4377 | goog.math.Size.prototype.floor = function $goog$math$Size$$floor$() { | |
4378 | this.width = Math.floor(this.width); | |
4379 | this.height = Math.floor(this.height); | |
4380 | return this; | |
4381 | }; | |
4382 | goog.math.Size.prototype.round = function $goog$math$Size$$round$() { | |
4383 | this.width = Math.round(this.width); | |
4384 | this.height = Math.round(this.height); | |
4385 | return this; | |
4386 | }; | |
4387 | goog.dom.BrowserFeature = {CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), CAN_USE_CHILDREN_ATTRIBUTE:!goog.userAgent.GECKO && !goog.userAgent.IE || goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9.1"), CAN_USE_INNER_TEXT:goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), CAN_USE_PARENT_ELEMENT_PROPERTY:goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT, | |
4388 | INNER_HTML_NEEDS_SCOPED_ELEMENT:goog.userAgent.IE}; | |
4389 | goog.dom.classes = {}; | |
4390 | goog.dom.classes.set = function $goog$dom$classes$set$(element, className) { | |
4391 | element.className = className; | |
4392 | }; | |
4393 | goog.dom.classes.get = function $goog$dom$classes$get$(element) { | |
4394 | var className = element.className; | |
4395 | return goog.isString(className) && className.match(/\S+/g) || []; | |
4396 | }; | |
4397 | goog.dom.classes.add = function $goog$dom$classes$add$(element, var_args) { | |
4398 | var classes = goog.dom.classes.get(element), args = goog.array.slice(arguments, 1), expectedCount = classes.length + args.length; | |
4399 | goog.dom.classes.add_(classes, args); | |
4400 | goog.dom.classes.set(element, classes.join(" ")); | |
4401 | return classes.length == expectedCount; | |
4402 | }; | |
4403 | goog.dom.classes.remove = function $goog$dom$classes$remove$(element, var_args) { | |
4404 | var classes = goog.dom.classes.get(element), args = goog.array.slice(arguments, 1), newClasses = goog.dom.classes.getDifference_(classes, args); | |
4405 | goog.dom.classes.set(element, newClasses.join(" ")); | |
4406 | return newClasses.length == classes.length - args.length; | |
4407 | }; | |
4408 | goog.dom.classes.add_ = function $goog$dom$classes$add_$(classes, args) { | |
4409 | for (var i = 0;i < args.length;i++) { | |
4410 | goog.array.contains(classes, args[i]) || classes.push(args[i]); | |
4411 | } | |
4412 | }; | |
4413 | goog.dom.classes.getDifference_ = function $goog$dom$classes$getDifference_$(arr1, arr2) { | |
4414 | return goog.array.filter(arr1, function(item) { | |
4415 | return!goog.array.contains(arr2, item); | |
4416 | }); | |
4417 | }; | |
4418 | goog.dom.classes.swap = function $goog$dom$classes$swap$(element, fromClass, toClass) { | |
4419 | for (var classes = goog.dom.classes.get(element), removed = !1, i = 0;i < classes.length;i++) { | |
4420 | classes[i] == fromClass && (goog.array.splice(classes, i--, 1), removed = !0); | |
4421 | } | |
4422 | removed && (classes.push(toClass), goog.dom.classes.set(element, classes.join(" "))); | |
4423 | return removed; | |
4424 | }; | |
4425 | goog.dom.classes.addRemove = function $goog$dom$classes$addRemove$(element, classesToRemove, classesToAdd) { | |
4426 | var classes = goog.dom.classes.get(element); | |
4427 | goog.isString(classesToRemove) ? goog.array.remove(classes, classesToRemove) : goog.isArray(classesToRemove) && (classes = goog.dom.classes.getDifference_(classes, classesToRemove)); | |
4428 | goog.isString(classesToAdd) && !goog.array.contains(classes, classesToAdd) ? classes.push(classesToAdd) : goog.isArray(classesToAdd) && goog.dom.classes.add_(classes, classesToAdd); | |
4429 | goog.dom.classes.set(element, classes.join(" ")); | |
4430 | }; | |
4431 | goog.dom.classes.has = function $goog$dom$classes$has$(element, className) { | |
4432 | return goog.array.contains(goog.dom.classes.get(element), className); | |
4433 | }; | |
4434 | goog.dom.classes.enable = function $goog$dom$classes$enable$(element, className, enabled) { | |
4435 | enabled ? goog.dom.classes.add(element, className) : goog.dom.classes.remove(element, className); | |
4436 | }; | |
4437 | goog.dom.classes.toggle = function $goog$dom$classes$toggle$(element, className) { | |
4438 | var add = !goog.dom.classes.has(element, className); | |
4439 | goog.dom.classes.enable(element, className, add); | |
4440 | return add; | |
4441 | }; | |
4442 | goog.dom.TagName = {A:"A", ABBR:"ABBR", ACRONYM:"ACRONYM", ADDRESS:"ADDRESS", APPLET:"APPLET", AREA:"AREA", ARTICLE:"ARTICLE", ASIDE:"ASIDE", AUDIO:"AUDIO", B:"B", BASE:"BASE", BASEFONT:"BASEFONT", BDI:"BDI", BDO:"BDO", BIG:"BIG", BLOCKQUOTE:"BLOCKQUOTE", BODY:"BODY", BR:"BR", BUTTON:"BUTTON", CANVAS:"CANVAS", CAPTION:"CAPTION", CENTER:"CENTER", CITE:"CITE", CODE:"CODE", COL:"COL", COLGROUP:"COLGROUP", COMMAND:"COMMAND", DATA:"DATA", DATALIST:"DATALIST", DD:"DD", DEL:"DEL", DETAILS:"DETAILS", DFN:"DFN", | |
4443 | DIALOG:"DIALOG", DIR:"DIR", DIV:"DIV", DL:"DL", DT:"DT", EM:"EM", EMBED:"EMBED", FIELDSET:"FIELDSET", FIGCAPTION:"FIGCAPTION", FIGURE:"FIGURE", FONT:"FONT", FOOTER:"FOOTER", FORM:"FORM", FRAME:"FRAME", FRAMESET:"FRAMESET", H1:"H1", H2:"H2", H3:"H3", H4:"H4", H5:"H5", H6:"H6", HEAD:"HEAD", HEADER:"HEADER", HGROUP:"HGROUP", HR:"HR", HTML:"HTML", I:"I", IFRAME:"IFRAME", IMG:"IMG", INPUT:"INPUT", INS:"INS", ISINDEX:"ISINDEX", KBD:"KBD", KEYGEN:"KEYGEN", LABEL:"LABEL", LEGEND:"LEGEND", LI:"LI", LINK:"LINK", | |
4444 | MAP:"MAP", MARK:"MARK", MATH:"MATH", MENU:"MENU", META:"META", METER:"METER", NAV:"NAV", NOFRAMES:"NOFRAMES", NOSCRIPT:"NOSCRIPT", OBJECT:"OBJECT", OL:"OL", OPTGROUP:"OPTGROUP", OPTION:"OPTION", OUTPUT:"OUTPUT", P:"P", PARAM:"PARAM", PRE:"PRE", PROGRESS:"PROGRESS", Q:"Q", RP:"RP", RT:"RT", RUBY:"RUBY", S:"S", SAMP:"SAMP", SCRIPT:"SCRIPT", SECTION:"SECTION", SELECT:"SELECT", SMALL:"SMALL", SOURCE:"SOURCE", SPAN:"SPAN", STRIKE:"STRIKE", STRONG:"STRONG", STYLE:"STYLE", SUB:"SUB", SUMMARY:"SUMMARY", | |
4445 | SUP:"SUP", SVG:"SVG", TABLE:"TABLE", TBODY:"TBODY", TD:"TD", TEXTAREA:"TEXTAREA", TFOOT:"TFOOT", TH:"TH", THEAD:"THEAD", TIME:"TIME", TITLE:"TITLE", TR:"TR", TRACK:"TRACK", TT:"TT", U:"U", UL:"UL", VAR:"VAR", VIDEO:"VIDEO", WBR:"WBR"}; | |
4446 | goog.dom.ASSUME_QUIRKS_MODE = !1; | |
4447 | goog.dom.ASSUME_STANDARDS_MODE = !1; | |
4448 | goog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE; | |
4449 | goog.dom.getDomHelper = function $goog$dom$getDomHelper$(opt_element) { | |
4450 | return opt_element ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) : goog.dom.defaultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper); | |
4451 | }; | |
4452 | goog.dom.getDocument = function $goog$dom$getDocument$() { | |
4453 | return document; | |
4454 | }; | |
4455 | goog.dom.getElement = function $goog$dom$getElement$(element) { | |
4456 | return goog.dom.getElementHelper_(document, element); | |
4457 | }; | |
4458 | goog.dom.getElementHelper_ = function $goog$dom$getElementHelper_$(doc, element) { | |
4459 | return goog.isString(element) ? doc.getElementById(element) : element; | |
4460 | }; | |
4461 | goog.dom.getRequiredElement = function $goog$dom$getRequiredElement$(id) { | |
4462 | return goog.dom.getRequiredElementHelper_(document, id); | |
4463 | }; | |
4464 | goog.dom.getRequiredElementHelper_ = function $goog$dom$getRequiredElementHelper_$(doc, id) { | |
4465 | goog.asserts.assertString(id); | |
4466 | var element = goog.dom.getElementHelper_(doc, id); | |
4467 | return element = goog.asserts.assertElement(element, "No element found with id: " + id); | |
4468 | }; | |
4469 | goog.dom.$ = goog.dom.getElement; | |
4470 | goog.dom.getElementsByTagNameAndClass = function $goog$dom$getElementsByTagNameAndClass$(opt_tag, opt_class, opt_el) { | |
4471 | return goog.dom.getElementsByTagNameAndClass_(document, opt_tag, opt_class, opt_el); | |
4472 | }; | |
4473 | goog.dom.getElementsByClass = function $goog$dom$getElementsByClass$(className, opt_el) { | |
4474 | var parent = opt_el || document; | |
4475 | return goog.dom.canUseQuerySelector_(parent) ? parent.querySelectorAll("." + className) : goog.dom.getElementsByTagNameAndClass_(document, "*", className, opt_el); | |
4476 | }; | |
4477 | goog.dom.getElementByClass = function $goog$dom$getElementByClass$(className, opt_el) { | |
4478 | var parent = opt_el || document, retVal = null; | |
4479 | return(retVal = goog.dom.canUseQuerySelector_(parent) ? parent.querySelector("." + className) : goog.dom.getElementsByTagNameAndClass_(document, "*", className, opt_el)[0]) || null; | |
4480 | }; | |
4481 | goog.dom.getRequiredElementByClass = function $goog$dom$getRequiredElementByClass$(className, opt_root) { | |
4482 | var retValue = goog.dom.getElementByClass(className, opt_root); | |
4483 | return goog.asserts.assert(retValue, "No element found with className: " + className); | |
4484 | }; | |
4485 | goog.dom.canUseQuerySelector_ = function $goog$dom$canUseQuerySelector_$(parent) { | |
4486 | return!(!parent.querySelectorAll || !parent.querySelector); | |
4487 | }; | |
4488 | goog.dom.getElementsByTagNameAndClass_ = function $goog$dom$getElementsByTagNameAndClass_$(doc, opt_tag, opt_class, opt_el) { | |
4489 | var parent = opt_el || doc, tagName = opt_tag && "*" != opt_tag ? opt_tag.toUpperCase() : ""; | |
4490 | if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) { | |
4491 | var query = tagName + (opt_class ? "." + opt_class : ""); | |
4492 | return parent.querySelectorAll(query); | |
4493 | } | |
4494 | if (opt_class && parent.getElementsByClassName) { | |
4495 | var els = parent.getElementsByClassName(opt_class); | |
4496 | if (tagName) { | |
4497 | for (var arrayLike = {}, len = 0, i = 0, el;el = els[i];i++) { | |
4498 | tagName == el.nodeName && (arrayLike[len++] = el); | |
4499 | } | |
4500 | arrayLike.length = len; | |
4501 | return arrayLike; | |
4502 | } | |
4503 | return els; | |
4504 | } | |
4505 | els = parent.getElementsByTagName(tagName || "*"); | |
4506 | if (opt_class) { | |
4507 | arrayLike = {}; | |
4508 | for (i = len = 0;el = els[i];i++) { | |
4509 | var className = el.className; | |
4510 | "function" == typeof className.split && goog.array.contains(className.split(/\s+/), opt_class) && (arrayLike[len++] = el); | |
4511 | } | |
4512 | arrayLike.length = len; | |
4513 | return arrayLike; | |
4514 | } | |
4515 | return els; | |
4516 | }; | |
4517 | goog.dom.$$ = goog.dom.getElementsByTagNameAndClass; | |
4518 | goog.dom.setProperties = function $goog$dom$setProperties$(element, properties) { | |
4519 | goog.object.forEach(properties, function(val, key) { | |
4520 | "style" == key ? element.style.cssText = val : "class" == key ? element.className = val : "for" == key ? element.htmlFor = val : key in goog.dom.DIRECT_ATTRIBUTE_MAP_ ? element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val) : goog.string.startsWith(key, "aria-") || goog.string.startsWith(key, "data-") ? element.setAttribute(key, val) : element[key] = val; | |
4521 | }); | |
4522 | }; | |
4523 | goog.dom.DIRECT_ATTRIBUTE_MAP_ = {cellpadding:"cellPadding", cellspacing:"cellSpacing", colspan:"colSpan", frameborder:"frameBorder", height:"height", maxlength:"maxLength", role:"role", rowspan:"rowSpan", type:"type", usemap:"useMap", valign:"vAlign", width:"width"}; | |
4524 | goog.dom.getViewportSize = function $goog$dom$getViewportSize$(opt_window) { | |
4525 | return goog.dom.getViewportSize_(opt_window || window); | |
4526 | }; | |
4527 | goog.dom.getViewportSize_ = function $goog$dom$getViewportSize_$(win) { | |
4528 | var doc = win.document, el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body; | |
4529 | return new goog.math.Size(el.clientWidth, el.clientHeight); | |
4530 | }; | |
4531 | goog.dom.getDocumentHeight = function $goog$dom$getDocumentHeight$() { | |
4532 | return goog.dom.getDocumentHeight_(window); | |
4533 | }; | |
4534 | goog.dom.getDocumentHeight_ = function $goog$dom$getDocumentHeight_$(win) { | |
4535 | var doc = win.document, height = 0; | |
4536 | if (doc) { | |
4537 | var vh = goog.dom.getViewportSize_(win).height, body = doc.body, docEl = doc.documentElement; | |
4538 | if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) { | |
4539 | height = docEl.scrollHeight != vh ? docEl.scrollHeight : docEl.offsetHeight; | |
4540 | } else { | |
4541 | var sh = docEl.scrollHeight, oh = docEl.offsetHeight; | |
4542 | docEl.clientHeight != oh && (sh = body.scrollHeight, oh = body.offsetHeight); | |
4543 | height = sh > vh ? sh > oh ? sh : oh : sh < oh ? sh : oh; | |
4544 | } | |
4545 | } | |
4546 | return height; | |
4547 | }; | |
4548 | goog.dom.getPageScroll = function $goog$dom$getPageScroll$(opt_window) { | |
4549 | var win = opt_window || goog.global || window; | |
4550 | return goog.dom.getDomHelper(win.document).getDocumentScroll(); | |
4551 | }; | |
4552 | goog.dom.getDocumentScroll = function $goog$dom$getDocumentScroll$() { | |
4553 | return goog.dom.getDocumentScroll_(document); | |
4554 | }; | |
4555 | goog.dom.getDocumentScroll_ = function $goog$dom$getDocumentScroll_$(doc) { | |
4556 | var el = goog.dom.getDocumentScrollElement_(doc), win = goog.dom.getWindow_(doc); | |
4557 | return goog.userAgent.IE && goog.userAgent.isVersionOrHigher("10") && win.pageYOffset != el.scrollTop ? new goog.math.Coordinate(el.scrollLeft, el.scrollTop) : new goog.math.Coordinate(win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop); | |
4558 | }; | |
4559 | goog.dom.getDocumentScrollElement = function $goog$dom$getDocumentScrollElement$() { | |
4560 | return goog.dom.getDocumentScrollElement_(document); | |
4561 | }; | |
4562 | goog.dom.getDocumentScrollElement_ = function $goog$dom$getDocumentScrollElement_$(doc) { | |
4563 | return!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body || doc.documentElement; | |
4564 | }; | |
4565 | goog.dom.getWindow = function $goog$dom$getWindow$(opt_doc) { | |
4566 | return opt_doc ? goog.dom.getWindow_(opt_doc) : window; | |
4567 | }; | |
4568 | goog.dom.getWindow_ = function $goog$dom$getWindow_$(doc) { | |
4569 | return doc.parentWindow || doc.defaultView; | |
4570 | }; | |
4571 | goog.dom.createDom = function $goog$dom$createDom$(tagName, opt_attributes, var_args) { | |
4572 | return goog.dom.createDom_(document, arguments); | |
4573 | }; | |
4574 | goog.dom.createDom_ = function $goog$dom$createDom_$(doc, args) { | |
4575 | var tagName = args[0], attributes = args[1]; | |
4576 | if (!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && attributes && (attributes.name || attributes.type)) { | |
4577 | var tagNameArr = ["<", tagName]; | |
4578 | attributes.name && tagNameArr.push(' name="', goog.string.htmlEscape(attributes.name), '"'); | |
4579 | if (attributes.type) { | |
4580 | tagNameArr.push(' type="', goog.string.htmlEscape(attributes.type), '"'); | |
4581 | var clone = {}; | |
4582 | goog.object.extend(clone, attributes); | |
4583 | delete clone.type; | |
4584 | attributes = clone; | |
4585 | } | |
4586 | tagNameArr.push(">"); | |
4587 | tagName = tagNameArr.join(""); | |
4588 | } | |
4589 | var element = doc.createElement(tagName); | |
4590 | attributes && (goog.isString(attributes) ? element.className = attributes : goog.isArray(attributes) ? goog.dom.classes.add.apply(null, [element].concat(attributes)) : goog.dom.setProperties(element, attributes)); | |
4591 | 2 < args.length && goog.dom.append_(doc, element, args, 2); | |
4592 | return element; | |
4593 | }; | |
4594 | goog.dom.append_ = function $goog$dom$append_$(doc, parent, args, startIndex) { | |
4595 | function childHandler(child) { | |
4596 | child && parent.appendChild(goog.isString(child) ? doc.createTextNode(child) : child); | |
4597 | } | |
4598 | for (var i = startIndex;i < args.length;i++) { | |
4599 | var arg = args[i]; | |
4600 | goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg) ? goog.array.forEach(goog.dom.isNodeList(arg) ? goog.array.toArray(arg) : arg, childHandler) : childHandler(arg); | |
4601 | } | |
4602 | }; | |
4603 | goog.dom.$dom = goog.dom.createDom; | |
4604 | goog.dom.createElement = function $goog$dom$createElement$(name) { | |
4605 | return document.createElement(name); | |
4606 | }; | |
4607 | goog.dom.createTextNode = function $goog$dom$createTextNode$(content) { | |
4608 | return document.createTextNode(String(content)); | |
4609 | }; | |
4610 | goog.dom.createTable = function $goog$dom$createTable$(rows, columns, opt_fillWithNbsp) { | |
4611 | return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp); | |
4612 | }; | |
4613 | goog.dom.createTable_ = function $goog$dom$createTable_$(doc, rows, columns, fillWithNbsp) { | |
4614 | for (var rowHtml = ["<tr>"], i = 0;i < columns;i++) { | |
4615 | rowHtml.push(fillWithNbsp ? "<td> </td>" : "<td></td>"); | |
4616 | } | |
4617 | rowHtml.push("</tr>"); | |
4618 | for (var rowHtml = rowHtml.join(""), totalHtml = ["<table>"], i = 0;i < rows;i++) { | |
4619 | totalHtml.push(rowHtml); | |
4620 | } | |
4621 | totalHtml.push("</table>"); | |
4622 | var elem = doc.createElement(goog.dom.TagName.DIV); | |
4623 | elem.innerHTML = totalHtml.join(""); | |
4624 | return elem.removeChild(elem.firstChild); | |
4625 | }; | |
4626 | goog.dom.htmlToDocumentFragment = function $goog$dom$htmlToDocumentFragment$(htmlString) { | |
4627 | return goog.dom.htmlToDocumentFragment_(document, htmlString); | |
4628 | }; | |
4629 | goog.dom.htmlToDocumentFragment_ = function $goog$dom$htmlToDocumentFragment_$(doc, htmlString) { | |
4630 | var tempDiv = doc.createElement("div"); | |
4631 | goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT ? (tempDiv.innerHTML = "<br>" + htmlString, tempDiv.removeChild(tempDiv.firstChild)) : tempDiv.innerHTML = htmlString; | |
4632 | if (1 == tempDiv.childNodes.length) { | |
4633 | return tempDiv.removeChild(tempDiv.firstChild); | |
4634 | } | |
4635 | for (var fragment = doc.createDocumentFragment();tempDiv.firstChild;) { | |
4636 | fragment.appendChild(tempDiv.firstChild); | |
4637 | } | |
4638 | return fragment; | |
4639 | }; | |
4640 | goog.dom.isCss1CompatMode = function $goog$dom$isCss1CompatMode$() { | |
4641 | return goog.dom.isCss1CompatMode_(document); | |
4642 | }; | |
4643 | goog.dom.isCss1CompatMode_ = function $goog$dom$isCss1CompatMode_$(doc) { | |
4644 | return goog.dom.COMPAT_MODE_KNOWN_ ? goog.dom.ASSUME_STANDARDS_MODE : "CSS1Compat" == doc.compatMode; | |
4645 | }; | |
4646 | goog.dom.canHaveChildren = function $goog$dom$canHaveChildren$(node) { | |
4647 | if (node.nodeType != goog.dom.NodeType.ELEMENT) { | |
4648 | return!1; | |
4649 | } | |
4650 | switch(node.tagName) { | |
4651 | case goog.dom.TagName.APPLET: | |
4652 | ; | |
4653 | case goog.dom.TagName.AREA: | |
4654 | ; | |
4655 | case goog.dom.TagName.BASE: | |
4656 | ; | |
4657 | case goog.dom.TagName.BR: | |
4658 | ; | |
4659 | case goog.dom.TagName.COL: | |
4660 | ; | |
4661 | case goog.dom.TagName.COMMAND: | |
4662 | ; | |
4663 | case goog.dom.TagName.EMBED: | |
4664 | ; | |
4665 | case goog.dom.TagName.FRAME: | |
4666 | ; | |
4667 | case goog.dom.TagName.HR: | |
4668 | ; | |
4669 | case goog.dom.TagName.IMG: | |
4670 | ; | |
4671 | case goog.dom.TagName.INPUT: | |
4672 | ; | |
4673 | case goog.dom.TagName.IFRAME: | |
4674 | ; | |
4675 | case goog.dom.TagName.ISINDEX: | |
4676 | ; | |
4677 | case goog.dom.TagName.KEYGEN: | |
4678 | ; | |
4679 | case goog.dom.TagName.LINK: | |
4680 | ; | |
4681 | case goog.dom.TagName.NOFRAMES: | |
4682 | ; | |
4683 | case goog.dom.TagName.NOSCRIPT: | |
4684 | ; | |
4685 | case goog.dom.TagName.META: | |
4686 | ; | |
4687 | case goog.dom.TagName.OBJECT: | |
4688 | ; | |
4689 | case goog.dom.TagName.PARAM: | |
4690 | ; | |
4691 | case goog.dom.TagName.SCRIPT: | |
4692 | ; | |
4693 | case goog.dom.TagName.SOURCE: | |
4694 | ; | |
4695 | case goog.dom.TagName.STYLE: | |
4696 | ; | |
4697 | case goog.dom.TagName.TRACK: | |
4698 | ; | |
4699 | case goog.dom.TagName.WBR: | |
4700 | return!1; | |
4701 | } | |
4702 | return!0; | |
4703 | }; | |
4704 | goog.dom.appendChild = function $goog$dom$appendChild$(parent, child) { | |
4705 | parent.appendChild(child); | |
4706 | }; | |
4707 | goog.dom.append = function $goog$dom$append$(parent, var_args) { | |
4708 | goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1); | |
4709 | }; | |
4710 | goog.dom.removeChildren = function $goog$dom$removeChildren$(node) { | |
4711 | for (var child;child = node.firstChild;) { | |
4712 | node.removeChild(child); | |
4713 | } | |
4714 | }; | |
4715 | goog.dom.insertSiblingBefore = function $goog$dom$insertSiblingBefore$(newNode, refNode) { | |
4716 | refNode.parentNode && refNode.parentNode.insertBefore(newNode, refNode); | |
4717 | }; | |
4718 | goog.dom.insertSiblingAfter = function $goog$dom$insertSiblingAfter$(newNode, refNode) { | |
4719 | refNode.parentNode && refNode.parentNode.insertBefore(newNode, refNode.nextSibling); | |
4720 | }; | |
4721 | goog.dom.insertChildAt = function $goog$dom$insertChildAt$(parent, child, index) { | |
4722 | parent.insertBefore(child, parent.childNodes[index] || null); | |
4723 | }; | |
4724 | goog.dom.removeNode = function $goog$dom$removeNode$(node) { | |
4725 | return node && node.parentNode ? node.parentNode.removeChild(node) : null; | |
4726 | }; | |
4727 | goog.dom.replaceNode = function $goog$dom$replaceNode$(newNode, oldNode) { | |
4728 | var parent = oldNode.parentNode; | |
4729 | parent && parent.replaceChild(newNode, oldNode); | |
4730 | }; | |
4731 | goog.dom.flattenElement = function $goog$dom$flattenElement$(element) { | |
4732 | var child, parent = element.parentNode; | |
4733 | if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) { | |
4734 | if (element.removeNode) { | |
4735 | return element.removeNode(!1); | |
4736 | } | |
4737 | for (;child = element.firstChild;) { | |
4738 | parent.insertBefore(child, element); | |
4739 | } | |
4740 | return goog.dom.removeNode(element); | |
4741 | } | |
4742 | }; | |
4743 | goog.dom.getChildren = function $goog$dom$getChildren$(element) { | |
4744 | return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && void 0 != element.children ? element.children : goog.array.filter(element.childNodes, function(node) { | |
4745 | return node.nodeType == goog.dom.NodeType.ELEMENT; | |
4746 | }); | |
4747 | }; | |
4748 | goog.dom.getFirstElementChild = function $goog$dom$getFirstElementChild$(node) { | |
4749 | return void 0 != node.firstElementChild ? node.firstElementChild : goog.dom.getNextElementNode_(node.firstChild, !0); | |
4750 | }; | |
4751 | goog.dom.getLastElementChild = function $goog$dom$getLastElementChild$(node) { | |
4752 | return void 0 != node.lastElementChild ? node.lastElementChild : goog.dom.getNextElementNode_(node.lastChild, !1); | |
4753 | }; | |
4754 | goog.dom.getNextElementSibling = function $goog$dom$getNextElementSibling$(node) { | |
4755 | return void 0 != node.nextElementSibling ? node.nextElementSibling : goog.dom.getNextElementNode_(node.nextSibling, !0); | |
4756 | }; | |
4757 | goog.dom.getPreviousElementSibling = function $goog$dom$getPreviousElementSibling$(node) { | |
4758 | return void 0 != node.previousElementSibling ? node.previousElementSibling : goog.dom.getNextElementNode_(node.previousSibling, !1); | |
4759 | }; | |
4760 | goog.dom.getNextElementNode_ = function $goog$dom$getNextElementNode_$(node, forward) { | |
4761 | for (;node && node.nodeType != goog.dom.NodeType.ELEMENT;) { | |
4762 | node = forward ? node.nextSibling : node.previousSibling; | |
4763 | } | |
4764 | return node; | |
4765 | }; | |
4766 | goog.dom.getNextNode = function $goog$dom$getNextNode$(node) { | |
4767 | if (!node) { | |
4768 | return null; | |
4769 | } | |
4770 | if (node.firstChild) { | |
4771 | return node.firstChild; | |
4772 | } | |
4773 | for (;node && !node.nextSibling;) { | |
4774 | node = node.parentNode; | |
4775 | } | |
4776 | return node ? node.nextSibling : null; | |
4777 | }; | |
4778 | goog.dom.getPreviousNode = function $goog$dom$getPreviousNode$(node) { | |
4779 | if (!node) { | |
4780 | return null; | |
4781 | } | |
4782 | if (!node.previousSibling) { | |
4783 | return node.parentNode; | |
4784 | } | |
4785 | for (node = node.previousSibling;node && node.lastChild;) { | |
4786 | node = node.lastChild; | |
4787 | } | |
4788 | return node; | |
4789 | }; | |
4790 | goog.dom.isNodeLike = function $goog$dom$isNodeLike$(obj) { | |
4791 | return goog.isObject(obj) && 0 < obj.nodeType; | |
4792 | }; | |
4793 | goog.dom.isElement = function $goog$dom$isElement$(obj) { | |
4794 | return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT; | |
4795 | }; | |
4796 | goog.dom.isWindow = function $goog$dom$isWindow$(obj) { | |
4797 | return goog.isObject(obj) && obj.window == obj; | |
4798 | }; | |
4799 | goog.dom.getParentElement = function $goog$dom$getParentElement$(element) { | |
4800 | var parent; | |
4801 | if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) { | |
4802 | var isIe9 = goog.userAgent.IE && goog.userAgent.isVersionOrHigher("9") && !goog.userAgent.isVersionOrHigher("10"); | |
4803 | if (!(isIe9 && goog.global.SVGElement && element instanceof goog.global.SVGElement) && (parent = element.parentElement)) { | |
4804 | return parent; | |
4805 | } | |
4806 | } | |
4807 | parent = element.parentNode; | |
4808 | return goog.dom.isElement(parent) ? parent : null; | |
4809 | }; | |
4810 | goog.dom.contains = function $goog$dom$contains$(parent, descendant) { | |
4811 | if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) { | |
4812 | return parent == descendant || parent.contains(descendant); | |
4813 | } | |
4814 | if ("undefined" != typeof parent.compareDocumentPosition) { | |
4815 | return parent == descendant || Boolean(parent.compareDocumentPosition(descendant) & 16); | |
4816 | } | |
4817 | for (;descendant && parent != descendant;) { | |
4818 | descendant = descendant.parentNode; | |
4819 | } | |
4820 | return descendant == parent; | |
4821 | }; | |
4822 | goog.dom.compareNodeOrder = function $goog$dom$compareNodeOrder$(node1, node2) { | |
4823 | if (node1 == node2) { | |
4824 | return 0; | |
4825 | } | |
4826 | if (node1.compareDocumentPosition) { | |
4827 | return node1.compareDocumentPosition(node2) & 2 ? 1 : -1; | |
4828 | } | |
4829 | if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) { | |
4830 | if (node1.nodeType == goog.dom.NodeType.DOCUMENT) { | |
4831 | return-1; | |
4832 | } | |
4833 | if (node2.nodeType == goog.dom.NodeType.DOCUMENT) { | |
4834 | return 1; | |
4835 | } | |
4836 | } | |
4837 | if ("sourceIndex" in node1 || node1.parentNode && "sourceIndex" in node1.parentNode) { | |
4838 | var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT, isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT; | |
4839 | if (isElement1 && isElement2) { | |
4840 | return node1.sourceIndex - node2.sourceIndex; | |
4841 | } | |
4842 | var parent1 = node1.parentNode, parent2 = node2.parentNode; | |
4843 | return parent1 == parent2 ? goog.dom.compareSiblingOrder_(node1, node2) : !isElement1 && goog.dom.contains(parent1, node2) ? -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2) : !isElement2 && goog.dom.contains(parent2, node1) ? goog.dom.compareParentsDescendantNodeIe_(node2, node1) : (isElement1 ? node1.sourceIndex : parent1.sourceIndex) - (isElement2 ? node2.sourceIndex : parent2.sourceIndex); | |
4844 | } | |
4845 | var doc = goog.dom.getOwnerDocument(node1), range1, range2; | |
4846 | range1 = doc.createRange(); | |
4847 | range1.selectNode(node1); | |
4848 | range1.collapse(!0); | |
4849 | range2 = doc.createRange(); | |
4850 | range2.selectNode(node2); | |
4851 | range2.collapse(!0); | |
4852 | return range1.compareBoundaryPoints(goog.global.Range.START_TO_END, range2); | |
4853 | }; | |
4854 | goog.dom.compareParentsDescendantNodeIe_ = function $goog$dom$compareParentsDescendantNodeIe_$(textNode, node) { | |
4855 | var parent = textNode.parentNode; | |
4856 | if (parent == node) { | |
4857 | return-1; | |
4858 | } | |
4859 | for (var sibling = node;sibling.parentNode != parent;) { | |
4860 | sibling = sibling.parentNode; | |
4861 | } | |
4862 | return goog.dom.compareSiblingOrder_(sibling, textNode); | |
4863 | }; | |
4864 | goog.dom.compareSiblingOrder_ = function $goog$dom$compareSiblingOrder_$(node1, node2) { | |
4865 | for (var s = node2;s = s.previousSibling;) { | |
4866 | if (s == node1) { | |
4867 | return-1; | |
4868 | } | |
4869 | } | |
4870 | return 1; | |
4871 | }; | |
4872 | goog.dom.findCommonAncestor = function $goog$dom$findCommonAncestor$(var_args) { | |
4873 | var i, count = arguments.length; | |
4874 | if (!count) { | |
4875 | return null; | |
4876 | } | |
4877 | if (1 == count) { | |
4878 | return arguments[0]; | |
4879 | } | |
4880 | var paths = [], minLength = Infinity; | |
4881 | for (i = 0;i < count;i++) { | |
4882 | for (var ancestors = [], node = arguments[i];node;) { | |
4883 | ancestors.unshift(node), node = node.parentNode; | |
4884 | } | |
4885 | paths.push(ancestors); | |
4886 | minLength = Math.min(minLength, ancestors.length); | |
4887 | } | |
4888 | var output = null; | |
4889 | for (i = 0;i < minLength;i++) { | |
4890 | for (var first = paths[0][i], j = 1;j < count;j++) { | |
4891 | if (first != paths[j][i]) { | |
4892 | return output; | |
4893 | } | |
4894 | } | |
4895 | output = first; | |
4896 | } | |
4897 | return output; | |
4898 | }; | |
4899 | goog.dom.getOwnerDocument = function $goog$dom$getOwnerDocument$(node) { | |
4900 | goog.asserts.assert(node, "Node cannot be null or undefined."); | |
4901 | return node.nodeType == goog.dom.NodeType.DOCUMENT ? node : node.ownerDocument || node.document; | |
4902 | }; | |
4903 | goog.dom.getFrameContentDocument = function $goog$dom$getFrameContentDocument$(frame) { | |
4904 | var doc = frame.contentDocument || frame.contentWindow.document; | |
4905 | return doc; | |
4906 | }; | |
4907 | goog.dom.getFrameContentWindow = function $goog$dom$getFrameContentWindow$(frame) { | |
4908 | return frame.contentWindow || goog.dom.getWindow(goog.dom.getFrameContentDocument(frame)); | |
4909 | }; | |
4910 | goog.dom.setTextContent = function $goog$dom$setTextContent$(node, text) { | |
4911 | goog.asserts.assert(null != node, "goog.dom.setTextContent expects a non-null value for node"); | |
4912 | if ("textContent" in node) { | |
4913 | node.textContent = text; | |
4914 | } else { | |
4915 | if (node.nodeType == goog.dom.NodeType.TEXT) { | |
4916 | node.data = text; | |
4917 | } else { | |
4918 | if (node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) { | |
4919 | for (;node.lastChild != node.firstChild;) { | |
4920 | node.removeChild(node.lastChild); | |
4921 | } | |
4922 | node.firstChild.data = text; | |
4923 | } else { | |
4924 | goog.dom.removeChildren(node); | |
4925 | var doc = goog.dom.getOwnerDocument(node); | |
4926 | node.appendChild(doc.createTextNode(String(text))); | |
4927 | } | |
4928 | } | |
4929 | } | |
4930 | }; | |
4931 | goog.dom.getOuterHtml = function $goog$dom$getOuterHtml$(element) { | |
4932 | if ("outerHTML" in element) { | |
4933 | return element.outerHTML; | |
4934 | } | |
4935 | var doc = goog.dom.getOwnerDocument(element), div = doc.createElement("div"); | |
4936 | div.appendChild(element.cloneNode(!0)); | |
4937 | return div.innerHTML; | |
4938 | }; | |
4939 | goog.dom.findNode = function $goog$dom$findNode$(root, p) { | |
4940 | var rv = [], found = goog.dom.findNodes_(root, p, rv, !0); | |
4941 | return found ? rv[0] : void 0; | |
4942 | }; | |
4943 | goog.dom.findNodes = function $goog$dom$findNodes$(root, p) { | |
4944 | var rv = []; | |
4945 | goog.dom.findNodes_(root, p, rv, !1); | |
4946 | return rv; | |
4947 | }; | |
4948 | goog.dom.findNodes_ = function $goog$dom$findNodes_$(root, p, rv, findOne) { | |
4949 | if (null != root) { | |
4950 | for (var child = root.firstChild;child;) { | |
4951 | if (p(child) && (rv.push(child), findOne) || goog.dom.findNodes_(child, p, rv, findOne)) { | |
4952 | return!0; | |
4953 | } | |
4954 | child = child.nextSibling; | |
4955 | } | |
4956 | } | |
4957 | return!1; | |
4958 | }; | |
4959 | goog.dom.TAGS_TO_IGNORE_ = {SCRIPT:1, STYLE:1, HEAD:1, IFRAME:1, OBJECT:1}; | |
4960 | goog.dom.PREDEFINED_TAG_VALUES_ = {IMG:" ", BR:"\n"}; | |
4961 | goog.dom.isFocusableTabIndex = function $goog$dom$isFocusableTabIndex$(element) { | |
4962 | return goog.dom.hasSpecifiedTabIndex_(element) && goog.dom.isTabIndexFocusable_(element); | |
4963 | }; | |
4964 | goog.dom.setFocusableTabIndex = function $goog$dom$setFocusableTabIndex$(element, enable) { | |
4965 | enable ? element.tabIndex = 0 : (element.tabIndex = -1, element.removeAttribute("tabIndex")); | |
4966 | }; | |
4967 | goog.dom.isFocusable = function $goog$dom$isFocusable$(element) { | |
4968 | var focusable; | |
4969 | return(focusable = goog.dom.nativelySupportsFocus_(element) ? !element.disabled && (!goog.dom.hasSpecifiedTabIndex_(element) || goog.dom.isTabIndexFocusable_(element)) : goog.dom.isFocusableTabIndex(element)) && goog.userAgent.IE ? goog.dom.hasNonZeroBoundingRect_(element) : focusable; | |
4970 | }; | |
4971 | goog.dom.hasSpecifiedTabIndex_ = function $goog$dom$hasSpecifiedTabIndex_$(element) { | |
4972 | var attrNode = element.getAttributeNode("tabindex"); | |
4973 | return goog.isDefAndNotNull(attrNode) && attrNode.specified; | |
4974 | }; | |
4975 | goog.dom.isTabIndexFocusable_ = function $goog$dom$isTabIndexFocusable_$(element) { | |
4976 | var index = element.tabIndex; | |
4977 | return goog.isNumber(index) && 0 <= index && 32768 > index; | |
4978 | }; | |
4979 | goog.dom.nativelySupportsFocus_ = function $goog$dom$nativelySupportsFocus_$(element) { | |
4980 | return element.tagName == goog.dom.TagName.A || element.tagName == goog.dom.TagName.INPUT || element.tagName == goog.dom.TagName.TEXTAREA || element.tagName == goog.dom.TagName.SELECT || element.tagName == goog.dom.TagName.BUTTON; | |
4981 | }; | |
4982 | goog.dom.hasNonZeroBoundingRect_ = function $goog$dom$hasNonZeroBoundingRect_$(element) { | |
4983 | var rect = goog.isFunction(element.getBoundingClientRect) ? element.getBoundingClientRect() : {height:element.offsetHeight, width:element.offsetWidth}; | |
4984 | return goog.isDefAndNotNull(rect) && 0 < rect.height && 0 < rect.width; | |
4985 | }; | |
4986 | goog.dom.getTextContent = function $goog$dom$getTextContent$(node) { | |
4987 | var textContent; | |
4988 | if (goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && "innerText" in node) { | |
4989 | textContent = goog.string.canonicalizeNewlines(node.innerText); | |
4990 | } else { | |
4991 | var buf = []; | |
4992 | goog.dom.getTextContent_(node, buf, !0); | |
4993 | textContent = buf.join(""); | |
4994 | } | |
4995 | textContent = textContent.replace(/ \xAD /g, " ").replace(/\xAD/g, ""); | |
4996 | textContent = textContent.replace(/\u200B/g, ""); | |
4997 | goog.dom.BrowserFeature.CAN_USE_INNER_TEXT || (textContent = textContent.replace(/ +/g, " ")); | |
4998 | " " != textContent && (textContent = textContent.replace(/^\s*/, "")); | |
4999 | return textContent; | |
5000 | }; | |
5001 | goog.dom.getRawTextContent = function $goog$dom$getRawTextContent$(node) { | |
5002 | var buf = []; | |
5003 | goog.dom.getTextContent_(node, buf, !1); | |
5004 | return buf.join(""); | |
5005 | }; | |
5006 | goog.dom.getTextContent_ = function $goog$dom$getTextContent_$(node, buf, normalizeWhitespace) { | |
5007 | if (!(node.nodeName in goog.dom.TAGS_TO_IGNORE_)) { | |
5008 | if (node.nodeType == goog.dom.NodeType.TEXT) { | |
5009 | normalizeWhitespace ? buf.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, "")) : buf.push(node.nodeValue); | |
5010 | } else { | |
5011 | if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { | |
5012 | buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]); | |
5013 | } else { | |
5014 | for (var child = node.firstChild;child;) { | |
5015 | goog.dom.getTextContent_(child, buf, normalizeWhitespace), child = child.nextSibling; | |
5016 | } | |
5017 | } | |
5018 | } | |
5019 | } | |
5020 | }; | |
5021 | goog.dom.getNodeTextLength = function $goog$dom$getNodeTextLength$(node) { | |
5022 | return goog.dom.getTextContent(node).length; | |
5023 | }; | |
5024 | goog.dom.getNodeTextOffset = function $goog$dom$getNodeTextOffset$(node, opt_offsetParent) { | |
5025 | for (var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body, buf = [];node && node != root;) { | |
5026 | for (var cur = node;cur = cur.previousSibling;) { | |
5027 | buf.unshift(goog.dom.getTextContent(cur)); | |
5028 | } | |
5029 | node = node.parentNode; | |
5030 | } | |
5031 | return goog.string.trimLeft(buf.join("")).replace(/ +/g, " ").length; | |
5032 | }; | |
5033 | goog.dom.getNodeAtOffset = function $goog$dom$getNodeAtOffset$(parent, offset, opt_result) { | |
5034 | for (var stack = [parent], pos = 0, cur = null;0 < stack.length && pos < offset;) { | |
5035 | if (cur = stack.pop(), !(cur.nodeName in goog.dom.TAGS_TO_IGNORE_)) { | |
5036 | if (cur.nodeType == goog.dom.NodeType.TEXT) { | |
5037 | var text = cur.nodeValue.replace(/(\r\n|\r|\n)/g, "").replace(/ +/g, " "), pos = pos + text.length | |
5038 | } else { | |
5039 | if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) { | |
5040 | pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length; | |
5041 | } else { | |
5042 | for (var i = cur.childNodes.length - 1;0 <= i;i--) { | |
5043 | stack.push(cur.childNodes[i]); | |
5044 | } | |
5045 | } | |
5046 | } | |
5047 | } | |
5048 | } | |
5049 | goog.isObject(opt_result) && (opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0, opt_result.node = cur); | |
5050 | return cur; | |
5051 | }; | |
5052 | goog.dom.isNodeList = function $goog$dom$isNodeList$(val) { | |
5053 | if (val && "number" == typeof val.length) { | |
5054 | if (goog.isObject(val)) { | |
5055 | return "function" == typeof val.item || "string" == typeof val.item; | |
5056 | } | |
5057 | if (goog.isFunction(val)) { | |
5058 | return "function" == typeof val.item; | |
5059 | } | |
5060 | } | |
5061 | return!1; | |
5062 | }; | |
5063 | goog.dom.getAncestorByTagNameAndClass = function $goog$dom$getAncestorByTagNameAndClass$(element, opt_tag, opt_class) { | |
5064 | if (!opt_tag && !opt_class) { | |
5065 | return null; | |
5066 | } | |
5067 | var tagName = opt_tag ? opt_tag.toUpperCase() : null; | |
5068 | return goog.dom.getAncestor(element, function(node) { | |
5069 | return(!tagName || node.nodeName == tagName) && (!opt_class || goog.dom.classes.has(node, opt_class)); | |
5070 | }, !0); | |
5071 | }; | |
5072 | goog.dom.getAncestorByClass = function $goog$dom$getAncestorByClass$(element, className) { | |
5073 | return goog.dom.getAncestorByTagNameAndClass(element, null, className); | |
5074 | }; | |
5075 | goog.dom.getAncestor = function $goog$dom$getAncestor$(element, matcher, opt_includeNode, opt_maxSearchSteps) { | |
5076 | opt_includeNode || (element = element.parentNode); | |
5077 | for (var ignoreSearchSteps = null == opt_maxSearchSteps, steps = 0;element && (ignoreSearchSteps || steps <= opt_maxSearchSteps);) { | |
5078 | if (matcher(element)) { | |
5079 | return element; | |
5080 | } | |
5081 | element = element.parentNode; | |
5082 | steps++; | |
5083 | } | |
5084 | return null; | |
5085 | }; | |
5086 | goog.dom.getActiveElement = function $goog$dom$getActiveElement$(doc) { | |
5087 | try { | |
5088 | return doc && doc.activeElement; | |
5089 | } catch (e) { | |
5090 | } | |
5091 | return null; | |
5092 | }; | |
5093 | goog.dom.getPixelRatio = goog.functions.cacheReturnValue(function() { | |
5094 | var win = goog.dom.getWindow(), isFirefoxMobile = goog.userAgent.GECKO && goog.userAgent.MOBILE; | |
5095 | return goog.isDef(win.devicePixelRatio) && !isFirefoxMobile ? win.devicePixelRatio : win.matchMedia ? goog.dom.matchesPixelRatio_(.75) || goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(2) || goog.dom.matchesPixelRatio_(3) || 1 : 1; | |
5096 | }); | |
5097 | goog.dom.matchesPixelRatio_ = function $goog$dom$matchesPixelRatio_$(pixelRatio) { | |
5098 | var win = goog.dom.getWindow(), query = "(-webkit-min-device-pixel-ratio: " + pixelRatio + "),(min--moz-device-pixel-ratio: " + pixelRatio + "),(min-resolution: " + pixelRatio + "dppx)"; | |
5099 | return win.matchMedia(query).matches ? pixelRatio : 0; | |
5100 | }; | |
5101 | goog.dom.DomHelper = function $goog$dom$DomHelper$(opt_document) { | |
5102 | this.document_ = opt_document || goog.global.document || document; | |
5103 | }; | |
5104 | goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper; | |
5105 | goog.dom.DomHelper.prototype.getDocument = function $goog$dom$DomHelper$$getDocument$() { | |
5106 | return this.document_; | |
5107 | }; | |
5108 | goog.dom.DomHelper.prototype.getElement = function $goog$dom$DomHelper$$getElement$(element) { | |
5109 | return goog.dom.getElementHelper_(this.document_, element); | |
5110 | }; | |
5111 | goog.dom.DomHelper.prototype.getRequiredElement = function $goog$dom$DomHelper$$getRequiredElement$(id) { | |
5112 | return goog.dom.getRequiredElementHelper_(this.document_, id); | |
5113 | }; | |
5114 | goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement; | |
5115 | goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function $goog$dom$DomHelper$$getElementsByTagNameAndClass$(opt_tag, opt_class, opt_el) { | |
5116 | return goog.dom.getElementsByTagNameAndClass_(this.document_, opt_tag, opt_class, opt_el); | |
5117 | }; | |
5118 | goog.dom.DomHelper.prototype.getElementsByClass = function $goog$dom$DomHelper$$getElementsByClass$(className, opt_el) { | |
5119 | var doc = opt_el || this.document_; | |
5120 | return goog.dom.getElementsByClass(className, doc); | |
5121 | }; | |
5122 | goog.dom.DomHelper.prototype.getElementByClass = function $goog$dom$DomHelper$$getElementByClass$(className, opt_el) { | |
5123 | var doc = opt_el || this.document_; | |
5124 | return goog.dom.getElementByClass(className, doc); | |
5125 | }; | |
5126 | goog.dom.DomHelper.prototype.getRequiredElementByClass = function $goog$dom$DomHelper$$getRequiredElementByClass$(className, opt_root) { | |
5127 | var root = opt_root || this.document_; | |
5128 | return goog.dom.getRequiredElementByClass(className, root); | |
5129 | }; | |
5130 | goog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagNameAndClass; | |
5131 | goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties; | |
5132 | goog.dom.DomHelper.prototype.getViewportSize = function $goog$dom$DomHelper$$getViewportSize$(opt_window) { | |
5133 | return goog.dom.getViewportSize(opt_window || this.getWindow()); | |
5134 | }; | |
5135 | goog.dom.DomHelper.prototype.getDocumentHeight = function $goog$dom$DomHelper$$getDocumentHeight$() { | |
5136 | return goog.dom.getDocumentHeight_(this.getWindow()); | |
5137 | }; | |
5138 | goog.dom.DomHelper.prototype.createDom = function $goog$dom$DomHelper$$createDom$(tagName, opt_attributes, var_args) { | |
5139 | return goog.dom.createDom_(this.document_, arguments); | |
5140 | }; | |
5141 | goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom; | |
5142 | goog.dom.DomHelper.prototype.createElement = function $goog$dom$DomHelper$$createElement$(name) { | |
5143 | return this.document_.createElement(name); | |
5144 | }; | |
5145 | goog.dom.DomHelper.prototype.createTextNode = function $goog$dom$DomHelper$$createTextNode$(content) { | |
5146 | return this.document_.createTextNode(String(content)); | |
5147 | }; | |
5148 | goog.dom.DomHelper.prototype.createTable = function $goog$dom$DomHelper$$createTable$(rows, columns, opt_fillWithNbsp) { | |
5149 | return goog.dom.createTable_(this.document_, rows, columns, !!opt_fillWithNbsp); | |
5150 | }; | |
5151 | goog.dom.DomHelper.prototype.htmlToDocumentFragment = function $goog$dom$DomHelper$$htmlToDocumentFragment$(htmlString) { | |
5152 | return goog.dom.htmlToDocumentFragment_(this.document_, htmlString); | |
5153 | }; | |
5154 | goog.dom.DomHelper.prototype.isCss1CompatMode = function $goog$dom$DomHelper$$isCss1CompatMode$() { | |
5155 | return goog.dom.isCss1CompatMode_(this.document_); | |
5156 | }; | |
5157 | goog.dom.DomHelper.prototype.getWindow = function $goog$dom$DomHelper$$getWindow$() { | |
5158 | return goog.dom.getWindow_(this.document_); | |
5159 | }; | |
5160 | goog.dom.DomHelper.prototype.getDocumentScrollElement = function $goog$dom$DomHelper$$getDocumentScrollElement$() { | |
5161 | return goog.dom.getDocumentScrollElement_(this.document_); | |
5162 | }; | |
5163 | goog.dom.DomHelper.prototype.getDocumentScroll = function $goog$dom$DomHelper$$getDocumentScroll$() { | |
5164 | return goog.dom.getDocumentScroll_(this.document_); | |
5165 | }; | |
5166 | goog.dom.DomHelper.prototype.getActiveElement = function $goog$dom$DomHelper$$getActiveElement$(opt_doc) { | |
5167 | return goog.dom.getActiveElement(opt_doc || this.document_); | |
5168 | }; | |
5169 | goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild; | |
5170 | goog.dom.DomHelper.prototype.append = goog.dom.append; | |
5171 | goog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren; | |
5172 | goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren; | |
5173 | goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore; | |
5174 | goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter; | |
5175 | goog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt; | |
5176 | goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode; | |
5177 | goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode; | |
5178 | goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement; | |
5179 | goog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren; | |
5180 | goog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChild; | |
5181 | goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild; | |
5182 | goog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibling; | |
5183 | goog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousElementSibling; | |
5184 | goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode; | |
5185 | goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode; | |
5186 | goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike; | |
5187 | goog.dom.DomHelper.prototype.isElement = goog.dom.isElement; | |
5188 | goog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow; | |
5189 | goog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement; | |
5190 | goog.dom.DomHelper.prototype.contains = goog.dom.contains; | |
5191 | goog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder; | |
5192 | goog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor; | |
5193 | goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument; | |
5194 | goog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentDocument; | |
5195 | goog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWindow; | |
5196 | goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent; | |
5197 | goog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml; | |
5198 | goog.dom.DomHelper.prototype.findNode = goog.dom.findNode; | |
5199 | goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes; | |
5200 | goog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex; | |
5201 | goog.dom.DomHelper.prototype.setFocusableTabIndex = goog.dom.setFocusableTabIndex; | |
5202 | goog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable; | |
5203 | goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent; | |
5204 | goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength; | |
5205 | goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset; | |
5206 | goog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset; | |
5207 | goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList; | |
5208 | goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestorByTagNameAndClass; | |
5209 | goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass; | |
5210 | goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor; | |
5211 | goog.events.EventHandler = function $goog$events$EventHandler$(opt_scope) { | |
5212 | goog.Disposable.call(this); | |
5213 | this.handler_ = opt_scope; | |
5214 | this.keys_ = {}; | |
5215 | }; | |
5216 | goog.inherits(goog.events.EventHandler, goog.Disposable); | |
5217 | goog.events.EventHandler.typeArray_ = []; | |
5218 | goog.events.EventHandler.prototype.listen = function $goog$events$EventHandler$$listen$(src, type, opt_fn, opt_capture) { | |
5219 | return this.listen_(src, type, opt_fn, opt_capture); | |
5220 | }; | |
5221 | goog.events.EventHandler.prototype.listen_ = function $goog$events$EventHandler$$listen_$(src, type, opt_fn, opt_capture, opt_scope) { | |
5222 | goog.isArray(type) || (type && (goog.events.EventHandler.typeArray_[0] = type.toString()), type = goog.events.EventHandler.typeArray_); | |
5223 | for (var i = 0;i < type.length;i++) { | |
5224 | var listenerObj = goog.events.listen(src, type[i], opt_fn || this.handleEvent, opt_capture || !1, opt_scope || this.handler_ || this); | |
5225 | if (!listenerObj) { | |
5226 | break; | |
5227 | } | |
5228 | var key = listenerObj.key; | |
5229 | this.keys_[key] = listenerObj; | |
5230 | } | |
5231 | return this; | |
5232 | }; | |
5233 | goog.events.EventHandler.prototype.listenOnce = function $goog$events$EventHandler$$listenOnce$(src, type, opt_fn, opt_capture) { | |
5234 | return this.listenOnce_(src, type, opt_fn, opt_capture); | |
5235 | }; | |
5236 | goog.events.EventHandler.prototype.listenOnce_ = function $goog$events$EventHandler$$listenOnce_$(src, type, opt_fn, opt_capture, opt_scope) { | |
5237 | if (goog.isArray(type)) { | |
5238 | for (var i = 0;i < type.length;i++) { | |
5239 | this.listenOnce_(src, type[i], opt_fn, opt_capture, opt_scope); | |
5240 | } | |
5241 | } else { | |
5242 | var listenerObj = goog.events.listenOnce(src, type, opt_fn || this.handleEvent, opt_capture, opt_scope || this.handler_ || this); | |
5243 | if (!listenerObj) { | |
5244 | return this; | |
5245 | } | |
5246 | var key = listenerObj.key; | |
5247 | this.keys_[key] = listenerObj; | |
5248 | } | |
5249 | return this; | |
5250 | }; | |
5251 | goog.events.EventHandler.prototype.listenWithWrapper = function $goog$events$EventHandler$$listenWithWrapper$(src, wrapper, listener, opt_capt) { | |
5252 | return this.listenWithWrapper_(src, wrapper, listener, opt_capt); | |
5253 | }; | |
5254 | goog.events.EventHandler.prototype.listenWithWrapper_ = function $goog$events$EventHandler$$listenWithWrapper_$(src, wrapper, listener, opt_capt, opt_scope) { | |
5255 | wrapper.listen(src, listener, opt_capt, opt_scope || this.handler_ || this, this); | |
5256 | return this; | |
5257 | }; | |
5258 | goog.events.EventHandler.prototype.unlisten = function $goog$events$EventHandler$$unlisten$(src, type, opt_fn, opt_capture, opt_scope) { | |
5259 | if (goog.isArray(type)) { | |
5260 | for (var i = 0;i < type.length;i++) { | |
5261 | this.unlisten(src, type[i], opt_fn, opt_capture, opt_scope); | |
5262 | } | |
5263 | } else { | |
5264 | var listener = goog.events.getListener(src, type, opt_fn || this.handleEvent, opt_capture, opt_scope || this.handler_ || this); | |
5265 | listener && (goog.events.unlistenByKey(listener), delete this.keys_[listener.key]); | |
5266 | } | |
5267 | return this; | |
5268 | }; | |
5269 | goog.events.EventHandler.prototype.unlistenWithWrapper = function $goog$events$EventHandler$$unlistenWithWrapper$(src, wrapper, listener, opt_capt, opt_scope) { | |
5270 | wrapper.unlisten(src, listener, opt_capt, opt_scope || this.handler_ || this, this); | |
5271 | return this; | |
5272 | }; | |
5273 | goog.events.EventHandler.prototype.removeAll = function $goog$events$EventHandler$$removeAll$() { | |
5274 | goog.object.forEach(this.keys_, goog.events.unlistenByKey); | |
5275 | this.keys_ = {}; | |
5276 | }; | |
5277 | goog.events.EventHandler.prototype.disposeInternal = function $goog$events$EventHandler$$disposeInternal$() { | |
5278 | goog.events.EventHandler.superClass_.disposeInternal.call(this); | |
5279 | this.removeAll(); | |
5280 | }; | |
5281 | goog.events.EventHandler.prototype.handleEvent = function $goog$events$EventHandler$$handleEvent$() { | |
5282 | throw Error("EventHandler.handleEvent not implemented"); | |
5283 | }; | |
5284 | goog.a11y = {}; | |
5285 | goog.a11y.aria = {}; | |
5286 | goog.a11y.aria.State = {ACTIVEDESCENDANT:"activedescendant", ATOMIC:"atomic", AUTOCOMPLETE:"autocomplete", BUSY:"busy", CHECKED:"checked", CONTROLS:"controls", DESCRIBEDBY:"describedby", DISABLED:"disabled", DROPEFFECT:"dropeffect", EXPANDED:"expanded", FLOWTO:"flowto", GRABBED:"grabbed", HASPOPUP:"haspopup", HIDDEN:"hidden", INVALID:"invalid", LABEL:"label", LABELLEDBY:"labelledby", LEVEL:"level", LIVE:"live", MULTILINE:"multiline", MULTISELECTABLE:"multiselectable", ORIENTATION:"orientation", OWNS:"owns", | |
5287 | POSINSET:"posinset", PRESSED:"pressed", READONLY:"readonly", RELEVANT:"relevant", REQUIRED:"required", SELECTED:"selected", SETSIZE:"setsize", SORT:"sort", VALUEMAX:"valuemax", VALUEMIN:"valuemin", VALUENOW:"valuenow", VALUETEXT:"valuetext"}; | |
5288 | goog.a11y.aria.AutoCompleteValues = {INLINE:"inline", LIST:"list", BOTH:"both", NONE:"none"}; | |
5289 | goog.a11y.aria.DropEffectValues = {COPY:"copy", MOVE:"move", LINK:"link", EXECUTE:"execute", POPUP:"popup", NONE:"none"}; | |
5290 | goog.a11y.aria.LivePriority = {OFF:"off", POLITE:"polite", ASSERTIVE:"assertive"}; | |
5291 | goog.a11y.aria.OrientationValues = {VERTICAL:"vertical", HORIZONTAL:"horizontal"}; | |
5292 | goog.a11y.aria.RelevantValues = {ADDITIONS:"additions", REMOVALS:"removals", TEXT:"text", ALL:"all"}; | |
5293 | goog.a11y.aria.SortValues = {ASCENDING:"ascending", DESCENDING:"descending", NONE:"none", OTHER:"other"}; | |
5294 | goog.a11y.aria.CheckedValues = {TRUE:"true", FALSE:"false", MIXED:"mixed", UNDEFINED:"undefined"}; | |
5295 | goog.a11y.aria.ExpandedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"}; | |
5296 | goog.a11y.aria.GrabbedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"}; | |
5297 | goog.a11y.aria.InvalidValues = {FALSE:"false", TRUE:"true", GRAMMAR:"grammar", SPELLING:"spelling"}; | |
5298 | goog.a11y.aria.PressedValues = {TRUE:"true", FALSE:"false", MIXED:"mixed", UNDEFINED:"undefined"}; | |
5299 | goog.a11y.aria.SelectedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"}; | |
5300 | goog.a11y.aria.datatables = {}; | |
5301 | goog.a11y.aria.datatables.getDefaultValuesMap = function $goog$a11y$aria$datatables$getDefaultValuesMap$() { | |
5302 | goog.a11y.aria.DefaultStateValueMap_ || (goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(goog.a11y.aria.State.ATOMIC, !1, goog.a11y.aria.State.AUTOCOMPLETE, "none", goog.a11y.aria.State.DROPEFFECT, "none", goog.a11y.aria.State.HASPOPUP, !1, goog.a11y.aria.State.LIVE, "off", goog.a11y.aria.State.MULTILINE, !1, goog.a11y.aria.State.MULTISELECTABLE, !1, goog.a11y.aria.State.ORIENTATION, "vertical", goog.a11y.aria.State.READONLY, !1, goog.a11y.aria.State.RELEVANT, "additions text", goog.a11y.aria.State.REQUIRED, | |
5303 | !1, goog.a11y.aria.State.SORT, "none", goog.a11y.aria.State.BUSY, !1, goog.a11y.aria.State.DISABLED, !1, goog.a11y.aria.State.HIDDEN, !1, goog.a11y.aria.State.INVALID, "false")); | |
5304 | return goog.a11y.aria.DefaultStateValueMap_; | |
5305 | }; | |
5306 | goog.a11y.aria.Role = {ALERT:"alert", ALERTDIALOG:"alertdialog", APPLICATION:"application", ARTICLE:"article", BANNER:"banner", BUTTON:"button", CHECKBOX:"checkbox", COLUMNHEADER:"columnheader", COMBOBOX:"combobox", COMPLEMENTARY:"complementary", CONTENTINFO:"contentinfo", DEFINITION:"definition", DIALOG:"dialog", DIRECTORY:"directory", DOCUMENT:"document", FORM:"form", GRID:"grid", GRIDCELL:"gridcell", GROUP:"group", HEADING:"heading", IMG:"img", LINK:"link", LIST:"list", LISTBOX:"listbox", LISTITEM:"listitem", | |
5307 | LOG:"log", MAIN:"main", MARQUEE:"marquee", MATH:"math", MENU:"menu", MENUBAR:"menubar", MENU_ITEM:"menuitem", MENU_ITEM_CHECKBOX:"menuitemcheckbox", MENU_ITEM_RADIO:"menuitemradio", NAVIGATION:"navigation", NOTE:"note", OPTION:"option", PRESENTATION:"presentation", PROGRESSBAR:"progressbar", RADIO:"radio", RADIOGROUP:"radiogroup", REGION:"region", ROW:"row", ROWGROUP:"rowgroup", ROWHEADER:"rowheader", SCROLLBAR:"scrollbar", SEARCH:"search", SEPARATOR:"separator", SLIDER:"slider", SPINBUTTON:"spinbutton", | |
5308 | STATUS:"status", TAB:"tab", TAB_LIST:"tablist", TAB_PANEL:"tabpanel", TEXTBOX:"textbox", TIMER:"timer", TOOLBAR:"toolbar", TOOLTIP:"tooltip", TREE:"tree", TREEGRID:"treegrid", TREEITEM:"treeitem"}; | |
5309 | goog.a11y.aria.ARIA_PREFIX_ = "aria-"; | |
5310 | goog.a11y.aria.ROLE_ATTRIBUTE_ = "role"; | |
5311 | goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [goog.dom.TagName.A, goog.dom.TagName.AREA, goog.dom.TagName.BUTTON, goog.dom.TagName.HEAD, goog.dom.TagName.INPUT, goog.dom.TagName.LINK, goog.dom.TagName.MENU, goog.dom.TagName.META, goog.dom.TagName.OPTGROUP, goog.dom.TagName.OPTION, goog.dom.TagName.PROGRESS, goog.dom.TagName.STYLE, goog.dom.TagName.SELECT, goog.dom.TagName.SOURCE, goog.dom.TagName.TEXTAREA, goog.dom.TagName.TITLE, goog.dom.TagName.TRACK]; | |
5312 | goog.a11y.aria.setRole = function $goog$a11y$aria$setRole$(element, roleName) { | |
5313 | roleName ? (goog.asserts.ENABLE_ASSERTS && goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role, roleName), "No such ARIA role " + roleName), element.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, roleName)) : goog.a11y.aria.removeRole(element); | |
5314 | }; | |
5315 | goog.a11y.aria.getRole = function $goog$a11y$aria$getRole$(element) { | |
5316 | var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_); | |
5317 | return role || null; | |
5318 | }; | |
5319 | goog.a11y.aria.removeRole = function $goog$a11y$aria$removeRole$(element) { | |
5320 | element.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_); | |
5321 | }; | |
5322 | goog.a11y.aria.setState = function $goog$a11y$aria$setState$(element, stateName, value) { | |
5323 | if (goog.isArrayLike(value)) { | |
5324 | var array = value; | |
5325 | value = array.join(" "); | |
5326 | } | |
5327 | var attrStateName = goog.a11y.aria.getAriaAttributeName_(stateName); | |
5328 | if ("" === value || void 0 == value) { | |
5329 | var defaultValueMap = goog.a11y.aria.datatables.getDefaultValuesMap(); | |
5330 | stateName in defaultValueMap ? element.setAttribute(attrStateName, defaultValueMap[stateName]) : element.removeAttribute(attrStateName); | |
5331 | } else { | |
5332 | element.setAttribute(attrStateName, value); | |
5333 | } | |
5334 | }; | |
5335 | goog.a11y.aria.removeState = function $goog$a11y$aria$removeState$(element, stateName) { | |
5336 | element.removeAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); | |
5337 | }; | |
5338 | goog.a11y.aria.getState = function $goog$a11y$aria$getState$(element, stateName) { | |
5339 | var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)), isNullOrUndefined = null == attr || void 0 == attr; | |
5340 | return isNullOrUndefined ? "" : String(attr); | |
5341 | }; | |
5342 | goog.a11y.aria.getActiveDescendant = function $goog$a11y$aria$getActiveDescendant$(element) { | |
5343 | var id = goog.a11y.aria.getState(element, goog.a11y.aria.State.ACTIVEDESCENDANT); | |
5344 | return goog.dom.getOwnerDocument(element).getElementById(id); | |
5345 | }; | |
5346 | goog.a11y.aria.setActiveDescendant = function $goog$a11y$aria$setActiveDescendant$(element, activeElement) { | |
5347 | var id = ""; | |
5348 | activeElement && (id = activeElement.id, goog.asserts.assert(id, "The active element should have an id.")); | |
5349 | goog.a11y.aria.setState(element, goog.a11y.aria.State.ACTIVEDESCENDANT, id); | |
5350 | }; | |
5351 | goog.a11y.aria.getLabel = function $goog$a11y$aria$getLabel$(element) { | |
5352 | return goog.a11y.aria.getState(element, goog.a11y.aria.State.LABEL); | |
5353 | }; | |
5354 | goog.a11y.aria.setLabel = function $goog$a11y$aria$setLabel$(element, label) { | |
5355 | goog.a11y.aria.setState(element, goog.a11y.aria.State.LABEL, label); | |
5356 | }; | |
5357 | goog.a11y.aria.assertRoleIsSetInternalUtil = function $goog$a11y$aria$assertRoleIsSetInternalUtil$(element, allowedRoles) { | |
5358 | if (!goog.array.contains(goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_, element.tagName)) { | |
5359 | var elementRole = goog.a11y.aria.getRole(element); | |
5360 | goog.asserts.assert(null != elementRole, "The element ARIA role cannot be null."); | |
5361 | goog.asserts.assert(goog.array.contains(allowedRoles, elementRole), 'Non existing or incorrect role set for element.The role set is "' + elementRole + '". The role should be any of "' + allowedRoles + '". Check the ARIA specification for more details http://www.w3.org/TR/wai-aria/roles.'); | |
5362 | } | |
5363 | }; | |
5364 | goog.a11y.aria.getStateBoolean = function $goog$a11y$aria$getStateBoolean$(element, stateName) { | |
5365 | var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); | |
5366 | goog.asserts.assert(goog.isBoolean(attr) || null == attr || "true" == attr || "false" == attr); | |
5367 | return null == attr ? attr : goog.isBoolean(attr) ? attr : "true" == attr; | |
5368 | }; | |
5369 | goog.a11y.aria.getStateNumber = function $goog$a11y$aria$getStateNumber$(element, stateName) { | |
5370 | var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); | |
5371 | goog.asserts.assert((null == attr || !isNaN(Number(attr))) && !goog.isBoolean(attr)); | |
5372 | return null == attr ? null : Number(attr); | |
5373 | }; | |
5374 | goog.a11y.aria.getStateString = function $goog$a11y$aria$getStateString$(element, stateName) { | |
5375 | var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); | |
5376 | goog.asserts.assert((null == attr || goog.isString(attr)) && isNaN(Number(attr)) && "true" != attr && "false" != attr); | |
5377 | return null == attr ? null : attr; | |
5378 | }; | |
5379 | goog.a11y.aria.getStringArrayStateInternalUtil = function $goog$a11y$aria$getStringArrayStateInternalUtil$(element, stateName) { | |
5380 | var attrValue = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName)); | |
5381 | return goog.a11y.aria.splitStringOnWhitespace_(attrValue); | |
5382 | }; | |
5383 | goog.a11y.aria.splitStringOnWhitespace_ = function $goog$a11y$aria$splitStringOnWhitespace_$(stringValue) { | |
5384 | return stringValue ? stringValue.split(/\s+/) : []; | |
5385 | }; | |
5386 | goog.a11y.aria.getAriaAttributeName_ = function $goog$a11y$aria$getAriaAttributeName_$(ariaName) { | |
5387 | goog.asserts.ENABLE_ASSERTS && (goog.asserts.assert(ariaName, "ARIA attribute cannot be empty."), goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State, ariaName), "No such ARIA attribute " + ariaName)); | |
5388 | return goog.a11y.aria.ARIA_PREFIX_ + ariaName; | |
5389 | }; | |
5390 | goog.a11y.aria.Announcer = function $goog$a11y$aria$Announcer$(opt_domHelper) { | |
5391 | goog.Disposable.call(this); | |
5392 | this.domHelper_ = opt_domHelper || goog.dom.getDomHelper(); | |
5393 | this.liveRegions_ = {}; | |
5394 | }; | |
5395 | goog.inherits(goog.a11y.aria.Announcer, goog.Disposable); | |
5396 | goog.a11y.aria.Announcer.prototype.disposeInternal = function $goog$a11y$aria$Announcer$$disposeInternal$() { | |
5397 | goog.object.forEach(this.liveRegions_, this.domHelper_.removeNode, this.domHelper_); | |
5398 | this.domHelper_ = this.liveRegions_ = null; | |
5399 | goog.a11y.aria.Announcer.superClass_.disposeInternal.call(this); | |
5400 | }; | |
5401 | goog.a11y.aria.Announcer.prototype.say = function $goog$a11y$aria$Announcer$$say$(message, opt_priority) { | |
5402 | goog.dom.setTextContent(this.getLiveRegion_(opt_priority || goog.a11y.aria.LivePriority.POLITE), message); | |
5403 | }; | |
5404 | goog.a11y.aria.Announcer.prototype.getLiveRegion_ = function $goog$a11y$aria$Announcer$$getLiveRegion_$(priority) { | |
5405 | var liveRegion = this.liveRegions_[priority]; | |
5406 | if (liveRegion) { | |
5407 | return goog.a11y.aria.removeState(liveRegion, goog.a11y.aria.State.HIDDEN), liveRegion; | |
5408 | } | |
5409 | liveRegion = this.domHelper_.createElement("div"); | |
5410 | liveRegion.style.position = "absolute"; | |
5411 | liveRegion.style.top = "-1000px"; | |
5412 | liveRegion.style.height = "1px"; | |
5413 | liveRegion.style.overflow = "hidden"; | |
5414 | goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.LIVE, priority); | |
5415 | goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.ATOMIC, "true"); | |
5416 | this.domHelper_.getDocument().body.appendChild(liveRegion); | |
5417 | return this.liveRegions_[priority] = liveRegion; | |
5418 | }; | |
5419 | goog.dom.vendor = {}; | |
5420 | goog.dom.vendor.getVendorJsPrefix = function $goog$dom$vendor$getVendorJsPrefix$() { | |
5421 | return goog.userAgent.WEBKIT ? "Webkit" : goog.userAgent.GECKO ? "Moz" : goog.userAgent.IE ? "ms" : goog.userAgent.OPERA ? "O" : null; | |
5422 | }; | |
5423 | goog.dom.vendor.getVendorPrefix = function $goog$dom$vendor$getVendorPrefix$() { | |
5424 | return goog.userAgent.WEBKIT ? "-webkit" : goog.userAgent.GECKO ? "-moz" : goog.userAgent.IE ? "-ms" : goog.userAgent.OPERA ? "-o" : null; | |
5425 | }; | |
5426 | goog.dom.vendor.getPrefixedPropertyName = function $goog$dom$vendor$getPrefixedPropertyName$(propertyName, opt_object) { | |
5427 | if (opt_object && propertyName in opt_object) { | |
5428 | return propertyName; | |
5429 | } | |
5430 | var prefix = goog.dom.vendor.getVendorJsPrefix(); | |
5431 | if (prefix) { | |
5432 | var prefix = prefix.toLowerCase(), prefixedPropertyName = prefix + goog.string.toTitleCase(propertyName); | |
5433 | return!goog.isDef(opt_object) || prefixedPropertyName in opt_object ? prefixedPropertyName : null; | |
5434 | } | |
5435 | return null; | |
5436 | }; | |
5437 | goog.dom.vendor.getPrefixedEventType = function $goog$dom$vendor$getPrefixedEventType$(eventType) { | |
5438 | var prefix = goog.dom.vendor.getVendorJsPrefix() || ""; | |
5439 | return(prefix + eventType).toLowerCase(); | |
5440 | }; | |
5441 | goog.math.Box = function $goog$math$Box$(top, right, bottom, left) { | |
5442 | this.top = top; | |
5443 | this.right = right; | |
5444 | this.bottom = bottom; | |
5445 | this.left = left; | |
5446 | }; | |
5447 | goog.math.Box.boundingBox = function $goog$math$Box$boundingBox$(var_args) { | |
5448 | for (var box = new goog.math.Box(arguments[0].y, arguments[0].x, arguments[0].y, arguments[0].x), i = 1;i < arguments.length;i++) { | |
5449 | var coord = arguments[i]; | |
5450 | box.top = Math.min(box.top, coord.y); | |
5451 | box.right = Math.max(box.right, coord.x); | |
5452 | box.bottom = Math.max(box.bottom, coord.y); | |
5453 | box.left = Math.min(box.left, coord.x); | |
5454 | } | |
5455 | return box; | |
5456 | }; | |
5457 | goog.math.Box.prototype.clone = function $goog$math$Box$$clone$() { | |
5458 | return new goog.math.Box(this.top, this.right, this.bottom, this.left); | |
5459 | }; | |
5460 | goog.DEBUG && (goog.math.Box.prototype.toString = function $goog$math$Box$$toString$() { | |
5461 | return "(" + this.top + "t, " + this.right + "r, " + this.bottom + "b, " + this.left + "l)"; | |
5462 | }); | |
5463 | goog.math.Box.prototype.contains = function $goog$math$Box$$contains$(other) { | |
5464 | return goog.math.Box.contains(this, other); | |
5465 | }; | |
5466 | goog.math.Box.equals = function $goog$math$Box$equals$(a, b) { | |
5467 | return a == b ? !0 : a && b ? a.top == b.top && a.right == b.right && a.bottom == b.bottom && a.left == b.left : !1; | |
5468 | }; | |
5469 | goog.math.Box.contains = function $goog$math$Box$contains$(box, other) { | |
5470 | return box && other ? other instanceof goog.math.Box ? other.left >= box.left && other.right <= box.right && other.top >= box.top && other.bottom <= box.bottom : other.x >= box.left && other.x <= box.right && other.y >= box.top && other.y <= box.bottom : !1; | |
5471 | }; | |
5472 | goog.math.Box.relativePositionX = function $goog$math$Box$relativePositionX$(box, coord) { | |
5473 | return coord.x < box.left ? coord.x - box.left : coord.x > box.right ? coord.x - box.right : 0; | |
5474 | }; | |
5475 | goog.math.Box.relativePositionY = function $goog$math$Box$relativePositionY$(box, coord) { | |
5476 | return coord.y < box.top ? coord.y - box.top : coord.y > box.bottom ? coord.y - box.bottom : 0; | |
5477 | }; | |
5478 | goog.math.Box.distance = function $goog$math$Box$distance$(box, coord) { | |
5479 | var x = goog.math.Box.relativePositionX(box, coord), y = goog.math.Box.relativePositionY(box, coord); | |
5480 | return Math.sqrt(x * x + y * y); | |
5481 | }; | |
5482 | goog.math.Box.intersects = function $goog$math$Box$intersects$(a, b) { | |
5483 | return a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <= a.bottom; | |
5484 | }; | |
5485 | goog.math.Box.intersectsWithPadding = function $goog$math$Box$intersectsWithPadding$(a, b, padding) { | |
5486 | return a.left <= b.right + padding && b.left <= a.right + padding && a.top <= b.bottom + padding && b.top <= a.bottom + padding; | |
5487 | }; | |
5488 | goog.math.Box.prototype.ceil = function $goog$math$Box$$ceil$() { | |
5489 | this.top = Math.ceil(this.top); | |
5490 | this.right = Math.ceil(this.right); | |
5491 | this.bottom = Math.ceil(this.bottom); | |
5492 | this.left = Math.ceil(this.left); | |
5493 | return this; | |
5494 | }; | |
5495 | goog.math.Box.prototype.floor = function $goog$math$Box$$floor$() { | |
5496 | this.top = Math.floor(this.top); | |
5497 | this.right = Math.floor(this.right); | |
5498 | this.bottom = Math.floor(this.bottom); | |
5499 | this.left = Math.floor(this.left); | |
5500 | return this; | |
5501 | }; | |
5502 | goog.math.Box.prototype.round = function $goog$math$Box$$round$() { | |
5503 | this.top = Math.round(this.top); | |
5504 | this.right = Math.round(this.right); | |
5505 | this.bottom = Math.round(this.bottom); | |
5506 | this.left = Math.round(this.left); | |
5507 | return this; | |
5508 | }; | |
5509 | goog.math.Rect = function $goog$math$Rect$(x, y, w, h) { | |
5510 | this.left = x; | |
5511 | this.top = y; | |
5512 | this.width = w; | |
5513 | this.height = h; | |
5514 | }; | |
5515 | goog.math.Rect.prototype.clone = function $goog$math$Rect$$clone$() { | |
5516 | return new goog.math.Rect(this.left, this.top, this.width, this.height); | |
5517 | }; | |
5518 | goog.math.Rect.createFromBox = function $goog$math$Rect$createFromBox$(box) { | |
5519 | return new goog.math.Rect(box.left, box.top, box.right - box.left, box.bottom - box.top); | |
5520 | }; | |
5521 | goog.DEBUG && (goog.math.Rect.prototype.toString = function $goog$math$Rect$$toString$() { | |
5522 | return "(" + this.left + ", " + this.top + " - " + this.width + "w x " + this.height + "h)"; | |
5523 | }); | |
5524 | goog.math.Rect.equals = function $goog$math$Rect$equals$(a, b) { | |
5525 | return a == b ? !0 : a && b ? a.left == b.left && a.width == b.width && a.top == b.top && a.height == b.height : !1; | |
5526 | }; | |
5527 | goog.math.Rect.prototype.intersection = function $goog$math$Rect$$intersection$(rect) { | |
5528 | var x0 = Math.max(this.left, rect.left), x1 = Math.min(this.left + this.width, rect.left + rect.width); | |
5529 | if (x0 <= x1) { | |
5530 | var y0 = Math.max(this.top, rect.top), y1 = Math.min(this.top + this.height, rect.top + rect.height); | |
5531 | if (y0 <= y1) { | |
5532 | return this.left = x0, this.top = y0, this.width = x1 - x0, this.height = y1 - y0, !0; | |
5533 | } | |
5534 | } | |
5535 | return!1; | |
5536 | }; | |
5537 | goog.math.Rect.intersection = function $goog$math$Rect$intersection$(a, b) { | |
5538 | var x0 = Math.max(a.left, b.left), x1 = Math.min(a.left + a.width, b.left + b.width); | |
5539 | if (x0 <= x1) { | |
5540 | var y0 = Math.max(a.top, b.top), y1 = Math.min(a.top + a.height, b.top + b.height); | |
5541 | if (y0 <= y1) { | |
5542 | return new goog.math.Rect(x0, y0, x1 - x0, y1 - y0); | |
5543 | } | |
5544 | } | |
5545 | return null; | |
5546 | }; | |
5547 | goog.math.Rect.intersects = function $goog$math$Rect$intersects$(a, b) { | |
5548 | 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; | |
5549 | }; | |
5550 | goog.math.Rect.prototype.intersects = function $goog$math$Rect$$intersects$(rect) { | |
5551 | return goog.math.Rect.intersects(this, rect); | |
5552 | }; | |
5553 | goog.math.Rect.difference = function $goog$math$Rect$difference$(a, b) { | |
5554 | var intersection = goog.math.Rect.intersection(a, b); | |
5555 | if (!intersection || !intersection.height || !intersection.width) { | |
5556 | return[a.clone()]; | |
5557 | } | |
5558 | var result = [], top = a.top, height = a.height, ar = a.left + a.width, ab = a.top + a.height, br = b.left + b.width, bb = b.top + b.height; | |
5559 | b.top > a.top && (result.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top)), top = b.top, height -= b.top - a.top); | |
5560 | bb < ab && (result.push(new goog.math.Rect(a.left, bb, a.width, ab - bb)), height = bb - top); | |
5561 | b.left > a.left && result.push(new goog.math.Rect(a.left, top, b.left - a.left, height)); | |
5562 | br < ar && result.push(new goog.math.Rect(br, top, ar - br, height)); | |
5563 | return result; | |
5564 | }; | |
5565 | goog.math.Rect.prototype.difference = function $goog$math$Rect$$difference$(rect) { | |
5566 | return goog.math.Rect.difference(this, rect); | |
5567 | }; | |
5568 | goog.math.Rect.prototype.boundingRect = function $goog$math$Rect$$boundingRect$(rect) { | |
5569 | var right = Math.max(this.left + this.width, rect.left + rect.width), bottom = Math.max(this.top + this.height, rect.top + rect.height); | |
5570 | this.left = Math.min(this.left, rect.left); | |
5571 | this.top = Math.min(this.top, rect.top); | |
5572 | this.width = right - this.left; | |
5573 | this.height = bottom - this.top; | |
5574 | }; | |
5575 | goog.math.Rect.boundingRect = function $goog$math$Rect$boundingRect$(a, b) { | |
5576 | if (!a || !b) { | |
5577 | return null; | |
5578 | } | |
5579 | var clone = a.clone(); | |
5580 | clone.boundingRect(b); | |
5581 | return clone; | |
5582 | }; | |
5583 | goog.math.Rect.prototype.contains = function $goog$math$Rect$$contains$(another) { | |
5584 | return another instanceof goog.math.Rect ? this.left <= another.left && this.left + this.width >= another.left + another.width && this.top <= another.top && this.top + this.height >= another.top + another.height : another.x >= this.left && another.x <= this.left + this.width && another.y >= this.top && another.y <= this.top + this.height; | |
5585 | }; | |
5586 | goog.math.Rect.prototype.squaredDistance = function $goog$math$Rect$$squaredDistance$(point) { | |
5587 | var dx = point.x < this.left ? this.left - point.x : Math.max(point.x - (this.left + this.width), 0), dy = point.y < this.top ? this.top - point.y : Math.max(point.y - (this.top + this.height), 0); | |
5588 | return dx * dx + dy * dy; | |
5589 | }; | |
5590 | goog.math.Rect.prototype.distance = function $goog$math$Rect$$distance$(point) { | |
5591 | return Math.sqrt(this.squaredDistance(point)); | |
5592 | }; | |
5593 | goog.math.Rect.prototype.getSize = function $goog$math$Rect$$getSize$() { | |
5594 | return new goog.math.Size(this.width, this.height); | |
5595 | }; | |
5596 | goog.math.Rect.prototype.ceil = function $goog$math$Rect$$ceil$() { | |
5597 | this.left = Math.ceil(this.left); | |
5598 | this.top = Math.ceil(this.top); | |
5599 | this.width = Math.ceil(this.width); | |
5600 | this.height = Math.ceil(this.height); | |
5601 | return this; | |
5602 | }; | |
5603 | goog.math.Rect.prototype.floor = function $goog$math$Rect$$floor$() { | |
5604 | this.left = Math.floor(this.left); | |
5605 | this.top = Math.floor(this.top); | |
5606 | this.width = Math.floor(this.width); | |
5607 | this.height = Math.floor(this.height); | |
5608 | return this; | |
5609 | }; | |
5610 | goog.math.Rect.prototype.round = function $goog$math$Rect$$round$() { | |
5611 | this.left = Math.round(this.left); | |
5612 | this.top = Math.round(this.top); | |
5613 | this.width = Math.round(this.width); | |
5614 | this.height = Math.round(this.height); | |
5615 | return this; | |
5616 | }; | |
5617 | goog.style = {}; | |
5618 | goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS = !1; | |
5619 | goog.style.setStyle = function $goog$style$setStyle$(element, style, opt_value) { | |
5620 | goog.isString(style) ? goog.style.setStyle_(element, opt_value, style) : goog.object.forEach(style, goog.partial(goog.style.setStyle_, element)); | |
5621 | }; | |
5622 | goog.style.setStyle_ = function $goog$style$setStyle_$(element, value, style) { | |
5623 | var propertyName = goog.style.getVendorJsStyleName_(element, style); | |
5624 | propertyName && (element.style[propertyName] = value); | |
5625 | }; | |
5626 | goog.style.getVendorJsStyleName_ = function $goog$style$getVendorJsStyleName_$(element, style) { | |
5627 | var camelStyle = goog.string.toCamelCase(style); | |
5628 | if (void 0 === element.style[camelStyle]) { | |
5629 | var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(camelStyle); | |
5630 | if (void 0 !== element.style[prefixedStyle]) { | |
5631 | return prefixedStyle; | |
5632 | } | |
5633 | } | |
5634 | return camelStyle; | |
5635 | }; | |
5636 | goog.style.getVendorStyleName_ = function $goog$style$getVendorStyleName_$(element, style) { | |
5637 | var camelStyle = goog.string.toCamelCase(style); | |
5638 | if (void 0 === element.style[camelStyle]) { | |
5639 | var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(camelStyle); | |
5640 | if (void 0 !== element.style[prefixedStyle]) { | |
5641 | return goog.dom.vendor.getVendorPrefix() + "-" + style; | |
5642 | } | |
5643 | } | |
5644 | return style; | |
5645 | }; | |
5646 | goog.style.getStyle = function $goog$style$getStyle$(element, property) { | |
5647 | var styleValue = element.style[goog.string.toCamelCase(property)]; | |
5648 | return "undefined" !== typeof styleValue ? styleValue : element.style[goog.style.getVendorJsStyleName_(element, property)] || ""; | |
5649 | }; | |
5650 | goog.style.getComputedStyle = function $goog$style$getComputedStyle$(element, property) { | |
5651 | var doc = goog.dom.getOwnerDocument(element); | |
5652 | if (doc.defaultView && doc.defaultView.getComputedStyle) { | |
5653 | var styles = doc.defaultView.getComputedStyle(element, null); | |
5654 | if (styles) { | |
5655 | return styles[property] || styles.getPropertyValue(property) || ""; | |
5656 | } | |
5657 | } | |
5658 | return ""; | |
5659 | }; | |
5660 | goog.style.getCascadedStyle = function $goog$style$getCascadedStyle$(element, style) { | |
5661 | return element.currentStyle ? element.currentStyle[style] : null; | |
5662 | }; | |
5663 | goog.style.getStyle_ = function $goog$style$getStyle_$(element, style) { | |
5664 | return goog.style.getComputedStyle(element, style) || goog.style.getCascadedStyle(element, style) || element.style && element.style[style]; | |
5665 | }; | |
5666 | goog.style.getComputedBoxSizing = function $goog$style$getComputedBoxSizing$(element) { | |
5667 | return goog.style.getStyle_(element, "boxSizing") || goog.style.getStyle_(element, "MozBoxSizing") || goog.style.getStyle_(element, "WebkitBoxSizing") || null; | |
5668 | }; | |
5669 | goog.style.getComputedPosition = function $goog$style$getComputedPosition$(element) { | |
5670 | return goog.style.getStyle_(element, "position"); | |
5671 | }; | |
5672 | goog.style.getBackgroundColor = function $goog$style$getBackgroundColor$(element) { | |
5673 | return goog.style.getStyle_(element, "backgroundColor"); | |
5674 | }; | |
5675 | goog.style.getComputedOverflowX = function $goog$style$getComputedOverflowX$(element) { | |
5676 | return goog.style.getStyle_(element, "overflowX"); | |
5677 | }; | |
5678 | goog.style.getComputedOverflowY = function $goog$style$getComputedOverflowY$(element) { | |
5679 | return goog.style.getStyle_(element, "overflowY"); | |
5680 | }; | |
5681 | goog.style.getComputedZIndex = function $goog$style$getComputedZIndex$(element) { | |
5682 | return goog.style.getStyle_(element, "zIndex"); | |
5683 | }; | |
5684 | goog.style.getComputedTextAlign = function $goog$style$getComputedTextAlign$(element) { | |
5685 | return goog.style.getStyle_(element, "textAlign"); | |
5686 | }; | |
5687 | goog.style.getComputedCursor = function $goog$style$getComputedCursor$(element) { | |
5688 | return goog.style.getStyle_(element, "cursor"); | |
5689 | }; | |
5690 | goog.style.getComputedTransform = function $goog$style$getComputedTransform$(element) { | |
5691 | var property = goog.style.getVendorStyleName_(element, "transform"); | |
5692 | return goog.style.getStyle_(element, property) || goog.style.getStyle_(element, "transform"); | |
5693 | }; | |
5694 | goog.style.setPosition = function $goog$style$setPosition$(el, arg1, opt_arg2) { | |
5695 | var x, y, buggyGeckoSubPixelPos = goog.userAgent.GECKO && (goog.userAgent.MAC || goog.userAgent.X11) && goog.userAgent.isVersionOrHigher("1.9"); | |
5696 | arg1 instanceof goog.math.Coordinate ? (x = arg1.x, y = arg1.y) : (x = arg1, y = opt_arg2); | |
5697 | el.style.left = goog.style.getPixelStyleValue_(x, buggyGeckoSubPixelPos); | |
5698 | el.style.top = goog.style.getPixelStyleValue_(y, buggyGeckoSubPixelPos); | |
5699 | }; | |
5700 | goog.style.getPosition = function $goog$style$getPosition$(element) { | |
5701 | return new goog.math.Coordinate(element.offsetLeft, element.offsetTop); | |
5702 | }; | |
5703 | goog.style.getClientViewportElement = function $goog$style$getClientViewportElement$(opt_node) { | |
5704 | var doc; | |
5705 | doc = opt_node ? goog.dom.getOwnerDocument(opt_node) : goog.dom.getDocument(); | |
5706 | return!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9) || goog.dom.getDomHelper(doc).isCss1CompatMode() ? doc.documentElement : doc.body; | |
5707 | }; | |
5708 | goog.style.getViewportPageOffset = function $goog$style$getViewportPageOffset$(doc) { | |
5709 | var body = doc.body, documentElement = doc.documentElement, scrollLeft = body.scrollLeft || documentElement.scrollLeft, scrollTop = body.scrollTop || documentElement.scrollTop; | |
5710 | return new goog.math.Coordinate(scrollLeft, scrollTop); | |
5711 | }; | |
5712 | goog.style.getBoundingClientRect_ = function $goog$style$getBoundingClientRect_$(el) { | |
5713 | var rect; | |
5714 | try { | |
5715 | rect = el.getBoundingClientRect(); | |
5716 | } catch (e) { | |
5717 | return{left:0, top:0, right:0, bottom:0}; | |
5718 | } | |
5719 | if (goog.userAgent.IE && el.ownerDocument.body) { | |
5720 | var doc = el.ownerDocument; | |
5721 | rect.left -= doc.documentElement.clientLeft + doc.body.clientLeft; | |
5722 | rect.top -= doc.documentElement.clientTop + doc.body.clientTop; | |
5723 | } | |
5724 | return rect; | |
5725 | }; | |
5726 | goog.style.getOffsetParent = function $goog$style$getOffsetParent$(element) { | |
5727 | if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8)) { | |
5728 | return element.offsetParent; | |
5729 | } | |
5730 | for (var doc = goog.dom.getOwnerDocument(element), positionStyle = goog.style.getStyle_(element, "position"), skipStatic = "fixed" == positionStyle || "absolute" == positionStyle, parent = element.parentNode;parent && parent != doc;parent = parent.parentNode) { | |
5731 | if (positionStyle = goog.style.getStyle_(parent, "position"), skipStatic = skipStatic && "static" == positionStyle && parent != doc.documentElement && parent != doc.body, !skipStatic && (parent.scrollWidth > parent.clientWidth || parent.scrollHeight > parent.clientHeight || "fixed" == positionStyle || "absolute" == positionStyle || "relative" == positionStyle)) { | |
5732 | return parent; | |
5733 | } | |
5734 | } | |
5735 | return null; | |
5736 | }; | |
5737 | goog.style.getVisibleRectForElement = function $goog$style$getVisibleRectForElement$(element) { | |
5738 | for (var visibleRect = new goog.math.Box(0, Infinity, Infinity, 0), dom = goog.dom.getDomHelper(element), body = dom.getDocument().body, documentElement = dom.getDocument().documentElement, scrollEl = dom.getDocumentScrollElement(), el = element;el = goog.style.getOffsetParent(el);) { | |
5739 | if (!(goog.userAgent.IE && 0 == el.clientWidth || goog.userAgent.WEBKIT && 0 == el.clientHeight && el == body) && el != body && el != documentElement && "visible" != goog.style.getStyle_(el, "overflow")) { | |
5740 | var pos = goog.style.getPageOffset(el), client = goog.style.getClientLeftTop(el); | |
5741 | pos.x += client.x; | |
5742 | pos.y += client.y; | |
5743 | visibleRect.top = Math.max(visibleRect.top, pos.y); | |
5744 | visibleRect.right = Math.min(visibleRect.right, pos.x + el.clientWidth); | |
5745 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.y + el.clientHeight); | |
5746 | visibleRect.left = Math.max(visibleRect.left, pos.x); | |
5747 | } | |
5748 | } | |
5749 | var scrollX = scrollEl.scrollLeft, scrollY = scrollEl.scrollTop; | |
5750 | visibleRect.left = Math.max(visibleRect.left, scrollX); | |
5751 | visibleRect.top = Math.max(visibleRect.top, scrollY); | |
5752 | var winSize = dom.getViewportSize(); | |
5753 | visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); | |
5754 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); | |
5755 | return 0 <= visibleRect.top && 0 <= visibleRect.left && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; | |
5756 | }; | |
5757 | goog.style.getContainerOffsetToScrollInto = function $goog$style$getContainerOffsetToScrollInto$(element, container, opt_center) { | |
5758 | var elementPos = goog.style.getPageOffset(element), containerPos = goog.style.getPageOffset(container), containerBorder = goog.style.getBorderBox(container), relX = elementPos.x - containerPos.x - containerBorder.left, relY = elementPos.y - containerPos.y - containerBorder.top, spaceX = container.clientWidth - element.offsetWidth, spaceY = container.clientHeight - element.offsetHeight, scrollLeft = container.scrollLeft, scrollTop = container.scrollTop; | |
5759 | opt_center ? (scrollLeft += relX - spaceX / 2, scrollTop += relY - spaceY / 2) : (scrollLeft += Math.min(relX, Math.max(relX - spaceX, 0)), scrollTop += Math.min(relY, Math.max(relY - spaceY, 0))); | |
5760 | return new goog.math.Coordinate(scrollLeft, scrollTop); | |
5761 | }; | |
5762 | goog.style.scrollIntoContainerView = function $goog$style$scrollIntoContainerView$(element, container, opt_center) { | |
5763 | var offset = goog.style.getContainerOffsetToScrollInto(element, container, opt_center); | |
5764 | container.scrollLeft = offset.x; | |
5765 | container.scrollTop = offset.y; | |
5766 | }; | |
5767 | goog.style.getClientLeftTop = function $goog$style$getClientLeftTop$(el) { | |
5768 | if (goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("1.9")) { | |
5769 | var left = parseFloat(goog.style.getComputedStyle(el, "borderLeftWidth")); | |
5770 | if (goog.style.isRightToLeft(el)) { | |
5771 | var scrollbarWidth = el.offsetWidth - el.clientWidth - left - parseFloat(goog.style.getComputedStyle(el, "borderRightWidth")), left = left + scrollbarWidth | |
5772 | } | |
5773 | return new goog.math.Coordinate(left, parseFloat(goog.style.getComputedStyle(el, "borderTopWidth"))); | |
5774 | } | |
5775 | return new goog.math.Coordinate(el.clientLeft, el.clientTop); | |
5776 | }; | |
5777 | goog.style.getPageOffset = function $goog$style$getPageOffset$(el) { | |
5778 | var box, doc = goog.dom.getOwnerDocument(el), positionStyle = goog.style.getStyle_(el, "position"); | |
5779 | goog.asserts.assertObject(el, "Parameter is required"); | |
5780 | var BUGGY_GECKO_BOX_OBJECT = !goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS && goog.userAgent.GECKO && doc.getBoxObjectFor && !el.getBoundingClientRect && "absolute" == positionStyle && (box = doc.getBoxObjectFor(el)) && (0 > box.screenX || 0 > box.screenY), pos = new goog.math.Coordinate(0, 0), viewportElement = goog.style.getClientViewportElement(doc); | |
5781 | if (el == viewportElement) { | |
5782 | return pos; | |
5783 | } | |
5784 | if (goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS || el.getBoundingClientRect) { | |
5785 | box = goog.style.getBoundingClientRect_(el); | |
5786 | var scrollCoord = goog.dom.getDomHelper(doc).getDocumentScroll(); | |
5787 | pos.x = box.left + scrollCoord.x; | |
5788 | pos.y = box.top + scrollCoord.y; | |
5789 | } else { | |
5790 | if (doc.getBoxObjectFor && !BUGGY_GECKO_BOX_OBJECT) { | |
5791 | box = doc.getBoxObjectFor(el); | |
5792 | var vpBox = doc.getBoxObjectFor(viewportElement); | |
5793 | pos.x = box.screenX - vpBox.screenX; | |
5794 | pos.y = box.screenY - vpBox.screenY; | |
5795 | } else { | |
5796 | var parent = el; | |
5797 | do { | |
5798 | pos.x += parent.offsetLeft; | |
5799 | pos.y += parent.offsetTop; | |
5800 | parent != el && (pos.x += parent.clientLeft || 0, pos.y += parent.clientTop || 0); | |
5801 | if (goog.userAgent.WEBKIT && "fixed" == goog.style.getComputedPosition(parent)) { | |
5802 | pos.x += doc.body.scrollLeft; | |
5803 | pos.y += doc.body.scrollTop; | |
5804 | break; | |
5805 | } | |
5806 | parent = parent.offsetParent; | |
5807 | } while (parent && parent != el); | |
5808 | if (goog.userAgent.OPERA || goog.userAgent.WEBKIT && "absolute" == positionStyle) { | |
5809 | pos.y -= doc.body.offsetTop; | |
5810 | } | |
5811 | for (parent = el;(parent = goog.style.getOffsetParent(parent)) && parent != doc.body && parent != viewportElement;) { | |
5812 | pos.x -= parent.scrollLeft, goog.userAgent.OPERA && "TR" == parent.tagName || (pos.y -= parent.scrollTop); | |
5813 | } | |
5814 | } | |
5815 | } | |
5816 | return pos; | |
5817 | }; | |
5818 | goog.style.getPageOffsetLeft = function $goog$style$getPageOffsetLeft$(el) { | |
5819 | return goog.style.getPageOffset(el).x; | |
5820 | }; | |
5821 | goog.style.getPageOffsetTop = function $goog$style$getPageOffsetTop$(el) { | |
5822 | return goog.style.getPageOffset(el).y; | |
5823 | }; | |
5824 | goog.style.getFramedPageOffset = function $goog$style$getFramedPageOffset$(el, relativeWin) { | |
5825 | var position = new goog.math.Coordinate(0, 0), currentWin = goog.dom.getWindow(goog.dom.getOwnerDocument(el)), currentEl = el; | |
5826 | do { | |
5827 | var offset = currentWin == relativeWin ? goog.style.getPageOffset(currentEl) : goog.style.getClientPositionForElement_(goog.asserts.assert(currentEl)); | |
5828 | position.x += offset.x; | |
5829 | position.y += offset.y; | |
5830 | } while (currentWin && currentWin != relativeWin && (currentEl = currentWin.frameElement) && (currentWin = currentWin.parent)); | |
5831 | return position; | |
5832 | }; | |
5833 | goog.style.translateRectForAnotherFrame = function $goog$style$translateRectForAnotherFrame$(rect, origBase, newBase) { | |
5834 | if (origBase.getDocument() != newBase.getDocument()) { | |
5835 | var body = origBase.getDocument().body, pos = goog.style.getFramedPageOffset(body, newBase.getWindow()), pos = goog.math.Coordinate.difference(pos, goog.style.getPageOffset(body)); | |
5836 | goog.userAgent.IE && !origBase.isCss1CompatMode() && (pos = goog.math.Coordinate.difference(pos, origBase.getDocumentScroll())); | |
5837 | rect.left += pos.x; | |
5838 | rect.top += pos.y; | |
5839 | } | |
5840 | }; | |
5841 | goog.style.getRelativePosition = function $goog$style$getRelativePosition$(a, b) { | |
5842 | var ap = goog.style.getClientPosition(a), bp = goog.style.getClientPosition(b); | |
5843 | return new goog.math.Coordinate(ap.x - bp.x, ap.y - bp.y); | |
5844 | }; | |
5845 | goog.style.getClientPositionForElement_ = function $goog$style$getClientPositionForElement_$(el) { | |
5846 | var pos; | |
5847 | if (goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS || el.getBoundingClientRect) { | |
5848 | var box = goog.style.getBoundingClientRect_(el); | |
5849 | pos = new goog.math.Coordinate(box.left, box.top); | |
5850 | } else { | |
5851 | var scrollCoord = goog.dom.getDomHelper(el).getDocumentScroll(), pageCoord = goog.style.getPageOffset(el); | |
5852 | pos = new goog.math.Coordinate(pageCoord.x - scrollCoord.x, pageCoord.y - scrollCoord.y); | |
5853 | } | |
5854 | return goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher(12) ? goog.math.Coordinate.sum(pos, goog.style.getCssTranslation(el)) : pos; | |
5855 | }; | |
5856 | goog.style.getClientPosition = function $goog$style$getClientPosition$(el) { | |
5857 | goog.asserts.assert(el); | |
5858 | if (el.nodeType == goog.dom.NodeType.ELEMENT) { | |
5859 | return goog.style.getClientPositionForElement_(el); | |
5860 | } | |
5861 | var isAbstractedEvent = goog.isFunction(el.getBrowserEvent), be = el, targetEvent = el; | |
5862 | el.targetTouches ? targetEvent = el.targetTouches[0] : isAbstractedEvent && be.getBrowserEvent().targetTouches && (targetEvent = be.getBrowserEvent().targetTouches[0]); | |
5863 | return new goog.math.Coordinate(targetEvent.clientX, targetEvent.clientY); | |
5864 | }; | |
5865 | goog.style.setPageOffset = function $goog$style$setPageOffset$(el, x, opt_y) { | |
5866 | var cur = goog.style.getPageOffset(el); | |
5867 | x instanceof goog.math.Coordinate && (opt_y = x.y, x = x.x); | |
5868 | var dx = x - cur.x, dy = opt_y - cur.y; | |
5869 | goog.style.setPosition(el, el.offsetLeft + dx, el.offsetTop + dy); | |
5870 | }; | |
5871 | goog.style.setSize = function $goog$style$setSize$(element, w, opt_h) { | |
5872 | var h; | |
5873 | if (w instanceof goog.math.Size) { | |
5874 | h = w.height, w = w.width; | |
5875 | } else { | |
5876 | if (void 0 == opt_h) { | |
5877 | throw Error("missing height argument"); | |
5878 | } | |
5879 | h = opt_h; | |
5880 | } | |
5881 | goog.style.setWidth(element, w); | |
5882 | goog.style.setHeight(element, h); | |
5883 | }; | |
5884 | goog.style.getPixelStyleValue_ = function $goog$style$getPixelStyleValue_$(value, round) { | |
5885 | "number" == typeof value && (value = (round ? Math.round(value) : value) + "px"); | |
5886 | return value; | |
5887 | }; | |
5888 | goog.style.setHeight = function $goog$style$setHeight$(element, height) { | |
5889 | element.style.height = goog.style.getPixelStyleValue_(height, !0); | |
5890 | }; | |
5891 | goog.style.setWidth = function $goog$style$setWidth$(element, width) { | |
5892 | element.style.width = goog.style.getPixelStyleValue_(width, !0); | |
5893 | }; | |
5894 | goog.style.getSize = function $goog$style$getSize$(element) { | |
5895 | return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_, element); | |
5896 | }; | |
5897 | goog.style.evaluateWithTemporaryDisplay_ = function $goog$style$evaluateWithTemporaryDisplay_$(fn, element) { | |
5898 | if ("none" != goog.style.getStyle_(element, "display")) { | |
5899 | return fn(element); | |
5900 | } | |
5901 | var style = element.style, originalDisplay = style.display, originalVisibility = style.visibility, originalPosition = style.position; | |
5902 | style.visibility = "hidden"; | |
5903 | style.position = "absolute"; | |
5904 | style.display = "inline"; | |
5905 | var retVal = fn(element); | |
5906 | style.display = originalDisplay; | |
5907 | style.position = originalPosition; | |
5908 | style.visibility = originalVisibility; | |
5909 | return retVal; | |
5910 | }; | |
5911 | goog.style.getSizeWithDisplay_ = function $goog$style$getSizeWithDisplay_$(element) { | |
5912 | var offsetWidth = element.offsetWidth, offsetHeight = element.offsetHeight, webkitOffsetsZero = goog.userAgent.WEBKIT && !offsetWidth && !offsetHeight; | |
5913 | if ((!goog.isDef(offsetWidth) || webkitOffsetsZero) && element.getBoundingClientRect) { | |
5914 | var clientRect = goog.style.getBoundingClientRect_(element); | |
5915 | return new goog.math.Size(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top); | |
5916 | } | |
5917 | return new goog.math.Size(offsetWidth, offsetHeight); | |
5918 | }; | |
5919 | goog.style.getTransformedSize = function $goog$style$getTransformedSize$(element) { | |
5920 | if (!element.getBoundingClientRect) { | |
5921 | return null; | |
5922 | } | |
5923 | var clientRect = goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_, element); | |
5924 | return new goog.math.Size(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top); | |
5925 | }; | |
5926 | goog.style.getBounds = function $goog$style$getBounds$(element) { | |
5927 | var o = goog.style.getPageOffset(element), s = goog.style.getSize(element); | |
5928 | return new goog.math.Rect(o.x, o.y, s.width, s.height); | |
5929 | }; | |
5930 | goog.style.toCamelCase = function $goog$style$toCamelCase$(selector) { | |
5931 | return goog.string.toCamelCase(String(selector)); | |
5932 | }; | |
5933 | goog.style.toSelectorCase = function $goog$style$toSelectorCase$(selector) { | |
5934 | return goog.string.toSelectorCase(selector); | |
5935 | }; | |
5936 | goog.style.getOpacity = function $goog$style$getOpacity$(el) { | |
5937 | var style = el.style, result = ""; | |
5938 | if ("opacity" in style) { | |
5939 | result = style.opacity; | |
5940 | } else { | |
5941 | if ("MozOpacity" in style) { | |
5942 | result = style.MozOpacity; | |
5943 | } else { | |
5944 | if ("filter" in style) { | |
5945 | var match = style.filter.match(/alpha\(opacity=([\d.]+)\)/); | |
5946 | match && (result = String(match[1] / 100)); | |
5947 | } | |
5948 | } | |
5949 | } | |
5950 | return "" == result ? result : Number(result); | |
5951 | }; | |
5952 | goog.style.setOpacity = function $goog$style$setOpacity$(el, alpha) { | |
5953 | var style = el.style; | |
5954 | "opacity" in style ? style.opacity = alpha : "MozOpacity" in style ? style.MozOpacity = alpha : "filter" in style && (style.filter = "" === alpha ? "" : "alpha(opacity=" + 100 * alpha + ")"); | |
5955 | }; | |
5956 | goog.style.setTransparentBackgroundImage = function $goog$style$setTransparentBackgroundImage$(el, src) { | |
5957 | var style = el.style; | |
5958 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")' : (style.backgroundImage = "url(" + src + ")", style.backgroundPosition = "top left", style.backgroundRepeat = "no-repeat"); | |
5959 | }; | |
5960 | goog.style.clearTransparentBackgroundImage = function $goog$style$clearTransparentBackgroundImage$(el) { | |
5961 | var style = el.style; | |
5962 | "filter" in style ? style.filter = "" : style.backgroundImage = "none"; | |
5963 | }; | |
5964 | goog.style.showElement = function $goog$style$showElement$(el, display) { | |
5965 | goog.style.setElementShown(el, display); | |
5966 | }; | |
5967 | goog.style.setElementShown = function $goog$style$setElementShown$(el, isShown) { | |
5968 | el.style.display = isShown ? "" : "none"; | |
5969 | }; | |
5970 | goog.style.isElementShown = function $goog$style$isElementShown$(el) { | |
5971 | return "none" != el.style.display; | |
5972 | }; | |
5973 | goog.style.installStyles = function $goog$style$installStyles$(stylesString, opt_node) { | |
5974 | var dh = goog.dom.getDomHelper(opt_node), styleSheet = null, doc = dh.getDocument(); | |
5975 | if (goog.userAgent.IE && doc.createStyleSheet) { | |
5976 | styleSheet = doc.createStyleSheet(), goog.style.setStyles(styleSheet, stylesString); | |
5977 | } else { | |
5978 | var head = dh.getElementsByTagNameAndClass("head")[0]; | |
5979 | if (!head) { | |
5980 | var body = dh.getElementsByTagNameAndClass("body")[0], head = dh.createDom("head"); | |
5981 | body.parentNode.insertBefore(head, body); | |
5982 | } | |
5983 | styleSheet = dh.createDom("style"); | |
5984 | goog.style.setStyles(styleSheet, stylesString); | |
5985 | dh.appendChild(head, styleSheet); | |
5986 | } | |
5987 | return styleSheet; | |
5988 | }; | |
5989 | goog.style.uninstallStyles = function $goog$style$uninstallStyles$(styleSheet) { | |
5990 | var node = styleSheet.ownerNode || styleSheet.owningElement || styleSheet; | |
5991 | goog.dom.removeNode(node); | |
5992 | }; | |
5993 | goog.style.setStyles = function $goog$style$setStyles$(element, stylesString) { | |
5994 | goog.userAgent.IE && goog.isDef(element.cssText) ? element.cssText = stylesString : element.innerHTML = stylesString; | |
5995 | }; | |
5996 | goog.style.setPreWrap = function $goog$style$setPreWrap$(el) { | |
5997 | var style = el.style; | |
5998 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (style.whiteSpace = "pre", style.wordWrap = "break-word") : style.whiteSpace = goog.userAgent.GECKO ? "-moz-pre-wrap" : "pre-wrap"; | |
5999 | }; | |
6000 | goog.style.setInlineBlock = function $goog$style$setInlineBlock$(el) { | |
6001 | var style = el.style; | |
6002 | style.position = "relative"; | |
6003 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (style.zoom = "1", style.display = "inline") : style.display = goog.userAgent.GECKO ? goog.userAgent.isVersionOrHigher("1.9a") ? "inline-block" : "-moz-inline-box" : "inline-block"; | |
6004 | }; | |
6005 | goog.style.isRightToLeft = function $goog$style$isRightToLeft$(el) { | |
6006 | return "rtl" == goog.style.getStyle_(el, "direction"); | |
6007 | }; | |
6008 | goog.style.unselectableStyle_ = goog.userAgent.GECKO ? "MozUserSelect" : goog.userAgent.WEBKIT ? "WebkitUserSelect" : null; | |
6009 | goog.style.isUnselectable = function $goog$style$isUnselectable$(el) { | |
6010 | return goog.style.unselectableStyle_ ? "none" == el.style[goog.style.unselectableStyle_].toLowerCase() : goog.userAgent.IE || goog.userAgent.OPERA ? "on" == el.getAttribute("unselectable") : !1; | |
6011 | }; | |
6012 | goog.style.setUnselectable = function $goog$style$setUnselectable$(el, unselectable, opt_noRecurse) { | |
6013 | var descendants = opt_noRecurse ? null : el.getElementsByTagName("*"), name = goog.style.unselectableStyle_; | |
6014 | if (name) { | |
6015 | var value = unselectable ? "none" : ""; | |
6016 | el.style[name] = value; | |
6017 | if (descendants) { | |
6018 | for (var i = 0, descendant;descendant = descendants[i];i++) { | |
6019 | descendant.style[name] = value; | |
6020 | } | |
6021 | } | |
6022 | } else { | |
6023 | if (goog.userAgent.IE || goog.userAgent.OPERA) { | |
6024 | if (value = unselectable ? "on" : "", el.setAttribute("unselectable", value), descendants) { | |
6025 | for (i = 0;descendant = descendants[i];i++) { | |
6026 | descendant.setAttribute("unselectable", value); | |
6027 | } | |
6028 | } | |
6029 | } | |
6030 | } | |
6031 | }; | |
6032 | goog.style.getBorderBoxSize = function $goog$style$getBorderBoxSize$(element) { | |
6033 | return new goog.math.Size(element.offsetWidth, element.offsetHeight); | |
6034 | }; | |
6035 | goog.style.setBorderBoxSize = function $goog$style$setBorderBoxSize$(element, size) { | |
6036 | var doc = goog.dom.getOwnerDocument(element), isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode(); | |
6037 | if (!goog.userAgent.IE || isCss1CompatMode && goog.userAgent.isVersionOrHigher("8")) { | |
6038 | goog.style.setBoxSizingSize_(element, size, "border-box"); | |
6039 | } else { | |
6040 | var style = element.style; | |
6041 | if (isCss1CompatMode) { | |
6042 | var paddingBox = goog.style.getPaddingBox(element), borderBox = goog.style.getBorderBox(element); | |
6043 | style.pixelWidth = size.width - borderBox.left - paddingBox.left - paddingBox.right - borderBox.right; | |
6044 | style.pixelHeight = size.height - borderBox.top - paddingBox.top - paddingBox.bottom - borderBox.bottom; | |
6045 | } else { | |
6046 | style.pixelWidth = size.width, style.pixelHeight = size.height; | |
6047 | } | |
6048 | } | |
6049 | }; | |
6050 | goog.style.getContentBoxSize = function $goog$style$getContentBoxSize$(element) { | |
6051 | var doc = goog.dom.getOwnerDocument(element), ieCurrentStyle = goog.userAgent.IE && element.currentStyle; | |
6052 | if (ieCurrentStyle && goog.dom.getDomHelper(doc).isCss1CompatMode() && "auto" != ieCurrentStyle.width && "auto" != ieCurrentStyle.height && !ieCurrentStyle.boxSizing) { | |
6053 | var width = goog.style.getIePixelValue_(element, ieCurrentStyle.width, "width", "pixelWidth"), height = goog.style.getIePixelValue_(element, ieCurrentStyle.height, "height", "pixelHeight"); | |
6054 | return new goog.math.Size(width, height); | |
6055 | } | |
6056 | var borderBoxSize = goog.style.getBorderBoxSize(element), paddingBox = goog.style.getPaddingBox(element), borderBox = goog.style.getBorderBox(element); | |
6057 | return new goog.math.Size(borderBoxSize.width - borderBox.left - paddingBox.left - paddingBox.right - borderBox.right, borderBoxSize.height - borderBox.top - paddingBox.top - paddingBox.bottom - borderBox.bottom); | |
6058 | }; | |
6059 | goog.style.setContentBoxSize = function $goog$style$setContentBoxSize$(element, size) { | |
6060 | var doc = goog.dom.getOwnerDocument(element), isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode(); | |
6061 | if (!goog.userAgent.IE || isCss1CompatMode && goog.userAgent.isVersionOrHigher("8")) { | |
6062 | goog.style.setBoxSizingSize_(element, size, "content-box"); | |
6063 | } else { | |
6064 | var style = element.style; | |
6065 | if (isCss1CompatMode) { | |
6066 | style.pixelWidth = size.width, style.pixelHeight = size.height; | |
6067 | } else { | |
6068 | var paddingBox = goog.style.getPaddingBox(element), borderBox = goog.style.getBorderBox(element); | |
6069 | style.pixelWidth = size.width + borderBox.left + paddingBox.left + paddingBox.right + borderBox.right; | |
6070 | style.pixelHeight = size.height + borderBox.top + paddingBox.top + paddingBox.bottom + borderBox.bottom; | |
6071 | } | |
6072 | } | |
6073 | }; | |
6074 | goog.style.setBoxSizingSize_ = function $goog$style$setBoxSizingSize_$(element, size, boxSizing) { | |
6075 | var style = element.style; | |
6076 | goog.userAgent.GECKO ? style.MozBoxSizing = boxSizing : goog.userAgent.WEBKIT ? style.WebkitBoxSizing = boxSizing : style.boxSizing = boxSizing; | |
6077 | style.width = Math.max(size.width, 0) + "px"; | |
6078 | style.height = Math.max(size.height, 0) + "px"; | |
6079 | }; | |
6080 | goog.style.getIePixelValue_ = function $goog$style$getIePixelValue_$(element, value, name, pixelName) { | |
6081 | if (/^\d+px?$/.test(value)) { | |
6082 | return parseInt(value, 10); | |
6083 | } | |
6084 | var oldStyleValue = element.style[name], oldRuntimeValue = element.runtimeStyle[name]; | |
6085 | element.runtimeStyle[name] = element.currentStyle[name]; | |
6086 | element.style[name] = value; | |
6087 | var pixelValue = element.style[pixelName]; | |
6088 | element.style[name] = oldStyleValue; | |
6089 | element.runtimeStyle[name] = oldRuntimeValue; | |
6090 | return pixelValue; | |
6091 | }; | |
6092 | goog.style.getIePixelDistance_ = function $goog$style$getIePixelDistance_$(element, propName) { | |
6093 | var value = goog.style.getCascadedStyle(element, propName); | |
6094 | return value ? goog.style.getIePixelValue_(element, value, "left", "pixelLeft") : 0; | |
6095 | }; | |
6096 | goog.style.getBox_ = function $goog$style$getBox_$(element, stylePrefix) { | |
6097 | if (goog.userAgent.IE) { | |
6098 | var left = goog.style.getIePixelDistance_(element, stylePrefix + "Left"), right = goog.style.getIePixelDistance_(element, stylePrefix + "Right"), top = goog.style.getIePixelDistance_(element, stylePrefix + "Top"), bottom = goog.style.getIePixelDistance_(element, stylePrefix + "Bottom"); | |
6099 | return new goog.math.Box(top, right, bottom, left); | |
6100 | } | |
6101 | left = goog.style.getComputedStyle(element, stylePrefix + "Left"); | |
6102 | right = goog.style.getComputedStyle(element, stylePrefix + "Right"); | |
6103 | top = goog.style.getComputedStyle(element, stylePrefix + "Top"); | |
6104 | bottom = goog.style.getComputedStyle(element, stylePrefix + "Bottom"); | |
6105 | return new goog.math.Box(parseFloat(top), parseFloat(right), parseFloat(bottom), parseFloat(left)); | |
6106 | }; | |
6107 | goog.style.getPaddingBox = function $goog$style$getPaddingBox$(element) { | |
6108 | return goog.style.getBox_(element, "padding"); | |
6109 | }; | |
6110 | goog.style.getMarginBox = function $goog$style$getMarginBox$(element) { | |
6111 | return goog.style.getBox_(element, "margin"); | |
6112 | }; | |
6113 | goog.style.ieBorderWidthKeywords_ = {thin:2, medium:4, thick:6}; | |
6114 | goog.style.getIePixelBorder_ = function $goog$style$getIePixelBorder_$(element, prop) { | |
6115 | if ("none" == goog.style.getCascadedStyle(element, prop + "Style")) { | |
6116 | return 0; | |
6117 | } | |
6118 | var width = goog.style.getCascadedStyle(element, prop + "Width"); | |
6119 | return width in goog.style.ieBorderWidthKeywords_ ? goog.style.ieBorderWidthKeywords_[width] : goog.style.getIePixelValue_(element, width, "left", "pixelLeft"); | |
6120 | }; | |
6121 | goog.style.getBorderBox = function $goog$style$getBorderBox$(element) { | |
6122 | if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) { | |
6123 | var left = goog.style.getIePixelBorder_(element, "borderLeft"), right = goog.style.getIePixelBorder_(element, "borderRight"), top = goog.style.getIePixelBorder_(element, "borderTop"), bottom = goog.style.getIePixelBorder_(element, "borderBottom"); | |
6124 | return new goog.math.Box(top, right, bottom, left); | |
6125 | } | |
6126 | left = goog.style.getComputedStyle(element, "borderLeftWidth"); | |
6127 | right = goog.style.getComputedStyle(element, "borderRightWidth"); | |
6128 | top = goog.style.getComputedStyle(element, "borderTopWidth"); | |
6129 | bottom = goog.style.getComputedStyle(element, "borderBottomWidth"); | |
6130 | return new goog.math.Box(parseFloat(top), parseFloat(right), parseFloat(bottom), parseFloat(left)); | |
6131 | }; | |
6132 | goog.style.getFontFamily = function $goog$style$getFontFamily$(el) { | |
6133 | var doc = goog.dom.getOwnerDocument(el), font = ""; | |
6134 | if (doc.body.createTextRange && goog.dom.contains(doc, el)) { | |
6135 | var range = doc.body.createTextRange(); | |
6136 | range.moveToElementText(el); | |
6137 | try { | |
6138 | font = range.queryCommandValue("FontName"); | |
6139 | } catch (e) { | |
6140 | font = ""; | |
6141 | } | |
6142 | } | |
6143 | font || (font = goog.style.getStyle_(el, "fontFamily")); | |
6144 | var fontsArray = font.split(","); | |
6145 | 1 < fontsArray.length && (font = fontsArray[0]); | |
6146 | return goog.string.stripQuotes(font, "\"'"); | |
6147 | }; | |
6148 | goog.style.lengthUnitRegex_ = /[^\d]+$/; | |
6149 | goog.style.getLengthUnits = function $goog$style$getLengthUnits$(value) { | |
6150 | var units = value.match(goog.style.lengthUnitRegex_); | |
6151 | return units && units[0] || null; | |
6152 | }; | |
6153 | goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = {cm:1, "in":1, mm:1, pc:1, pt:1}; | |
6154 | goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = {em:1, ex:1}; | |
6155 | goog.style.getFontSize = function $goog$style$getFontSize$(el) { | |
6156 | var fontSize = goog.style.getStyle_(el, "fontSize"), sizeUnits = goog.style.getLengthUnits(fontSize); | |
6157 | if (fontSize && "px" == sizeUnits) { | |
6158 | return parseInt(fontSize, 10); | |
6159 | } | |
6160 | if (goog.userAgent.IE) { | |
6161 | if (sizeUnits in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_) { | |
6162 | return goog.style.getIePixelValue_(el, fontSize, "left", "pixelLeft"); | |
6163 | } | |
6164 | if (el.parentNode && el.parentNode.nodeType == goog.dom.NodeType.ELEMENT && sizeUnits in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_) { | |
6165 | var parentElement = el.parentNode, parentSize = goog.style.getStyle_(parentElement, "fontSize"); | |
6166 | return goog.style.getIePixelValue_(parentElement, fontSize == parentSize ? "1em" : fontSize, "left", "pixelLeft"); | |
6167 | } | |
6168 | } | |
6169 | var sizeElement = goog.dom.createDom("span", {style:"visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"}); | |
6170 | goog.dom.appendChild(el, sizeElement); | |
6171 | fontSize = sizeElement.offsetHeight; | |
6172 | goog.dom.removeNode(sizeElement); | |
6173 | return fontSize; | |
6174 | }; | |
6175 | goog.style.parseStyleAttribute = function $goog$style$parseStyleAttribute$(value) { | |
6176 | var result = {}; | |
6177 | goog.array.forEach(value.split(/\s*;\s*/), function(pair) { | |
6178 | var keyValue = pair.split(/\s*:\s*/); | |
6179 | 2 == keyValue.length && (result[goog.string.toCamelCase(keyValue[0].toLowerCase())] = keyValue[1]); | |
6180 | }); | |
6181 | return result; | |
6182 | }; | |
6183 | goog.style.toStyleAttribute = function $goog$style$toStyleAttribute$(obj) { | |
6184 | var buffer = []; | |
6185 | goog.object.forEach(obj, function(value, key) { | |
6186 | buffer.push(goog.string.toSelectorCase(key), ":", value, ";"); | |
6187 | }); | |
6188 | return buffer.join(""); | |
6189 | }; | |
6190 | goog.style.setFloat = function $goog$style$setFloat$(el, value) { | |
6191 | el.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] = value; | |
6192 | }; | |
6193 | goog.style.getFloat = function $goog$style$getFloat$(el) { | |
6194 | return el.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] || ""; | |
6195 | }; | |
6196 | goog.style.getScrollbarWidth = function $goog$style$getScrollbarWidth$(opt_className) { | |
6197 | var outerDiv = goog.dom.createElement("div"); | |
6198 | opt_className && (outerDiv.className = opt_className); | |
6199 | outerDiv.style.cssText = "overflow:auto;position:absolute;top:0;width:100px;height:100px"; | |
6200 | var innerDiv = goog.dom.createElement("div"); | |
6201 | goog.style.setSize(innerDiv, "200px", "200px"); | |
6202 | outerDiv.appendChild(innerDiv); | |
6203 | goog.dom.appendChild(goog.dom.getDocument().body, outerDiv); | |
6204 | var width = outerDiv.offsetWidth - outerDiv.clientWidth; | |
6205 | goog.dom.removeNode(outerDiv); | |
6206 | return width; | |
6207 | }; | |
6208 | goog.style.MATRIX_TRANSLATION_REGEX_ = /matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/; | |
6209 | goog.style.getCssTranslation = function $goog$style$getCssTranslation$(element) { | |
6210 | var transform = goog.style.getComputedTransform(element); | |
6211 | if (!transform) { | |
6212 | return new goog.math.Coordinate(0, 0); | |
6213 | } | |
6214 | var matches = transform.match(goog.style.MATRIX_TRANSLATION_REGEX_); | |
6215 | return matches ? new goog.math.Coordinate(parseFloat(matches[1]), parseFloat(matches[2])) : new goog.math.Coordinate(0, 0); | |
6216 | }; | |
6217 | i18n.input.chrome.inputview.Css = {ALTDATA_VIEW:"inputview-altdata-view", ALTDATA_KEY:"inputview-altdata-key", ALTDATA_COVER:"inputview-altdata-cover", ALTGR_CONTENT:"inputview-ac", ARROW_KEY:"inputview-arrow-key", BACKSPACE_ICON:"inputview-backspace-icon", CANDIDATE:"inputview-candidate", CANDIDATE_SEPARATOR:"inputview-candidate-separator", CANDIDATE_VIEW:"inputview-candidate-view", CAPSLOCK_DOT:"inputview-capslock-dot", CAPSLOCK_DOT_HIGHLIGHT:"inputview-capslock-dot-highlight", CANDIDATE_HIGHLIGHT:"inputview-candidate-highlight", | |
6218 | CHARACTER:"inputview-character", CHARACTER_HIGHLIGHT:"inputview-ch", COMPACT_KEY:"inputview-compact-key", COMPACT_SWITCHER:"inputview-compact-switcher", DEFAULT_CONTENT:"inputview-dc", DOWN_KEY:"inputview-down-key", ELEMENT_HIGHLIGHT:"inputview-element-highlight", ENTER_ICON:"inputview-enter-icon", FONT:"inputview-font", HIDE_KEYBOARD_ICON:"inputview-hide-keyboard-icon", HINT_TEXT:"inputview-hint-text", MODIFIER_ON:"inputview-modifier-on", HOLD:"inputview-hold", KEY_HOLD:"inputview-key-hold", LAYOUT_VIEW:"inputview-layoutview", | |
6219 | LEFT_KEY:"inputview-left-key", LINEAR_LAYOUT:"inputview-linear", MODIFIER:"inputview-modifier", MODIFIER_STATE_ICON:"inputview-modifier-state-icon", REGULAR_SWITCHER:"inputview-regular-switcher", RIGHT_KEY:"inputview-right-key", SHIFT_ICON:"inputview-shift-icon", SPECIAL_KEY_HIGHLIGHT:"inputview-special-key-highlight", SPECIAL_KEY_BG:"inputview-special-key-bg", SPECIAL_KEY_NAME:"inputview-special-key-name", SOFT_KEY:"inputview-sk", SOFT_KEY_VIEW:"inputview-skv", TABLE_CELL:"inputview-table-cell", | |
6220 | TAB_ICON:"inputview-tab-icon", TITLE:"inputview-title", TITLE_BAR:"inputview-title-bar", UP_KEY:"inputview-up-key", VERTICAL_LAYOUT:"inputview-vertical", VIEW:"inputview-view"}; | |
6221 | goog.ui = {}; | |
6222 | goog.ui.IdGenerator = function $goog$ui$IdGenerator$() { | |
6223 | }; | |
6224 | goog.addSingletonGetter(goog.ui.IdGenerator); | |
6225 | goog.ui.IdGenerator.prototype.nextId_ = 0; | |
6226 | goog.ui.IdGenerator.prototype.getNextUniqueId = function $goog$ui$IdGenerator$$getNextUniqueId$() { | |
6227 | return ":" + (this.nextId_++).toString(36); | |
6228 | }; | |
6229 | goog.ui.Component = function $goog$ui$Component$(opt_domHelper) { | |
6230 | goog.events.EventTarget.call(this); | |
6231 | this.dom_ = opt_domHelper || goog.dom.getDomHelper(); | |
6232 | this.rightToLeft_ = goog.ui.Component.defaultRightToLeft_; | |
6233 | }; | |
6234 | goog.inherits(goog.ui.Component, goog.events.EventTarget); | |
6235 | goog.ui.Component.ALLOW_DETACHED_DECORATION = !1; | |
6236 | goog.ui.Component.prototype.idGenerator_ = goog.ui.IdGenerator.getInstance(); | |
6237 | goog.ui.Component.DEFAULT_BIDI_DIR = 0; | |
6238 | goog.ui.Component.defaultRightToLeft_ = 1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !1 : -1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !0 : null; | |
6239 | goog.ui.Component.EventType = {BEFORE_SHOW:"beforeshow", SHOW:"show", HIDE:"hide", DISABLE:"disable", ENABLE:"enable", HIGHLIGHT:"highlight", UNHIGHLIGHT:"unhighlight", 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:"change"}; | |
6240 | goog.ui.Component.Error = {NOT_SUPPORTED:"Method not supported", DECORATE_INVALID:"Invalid element to decorate", ALREADY_RENDERED:"Component already rendered", PARENT_UNABLE_TO_BE_SET:"Unable to set parent component", CHILD_INDEX_OUT_OF_BOUNDS:"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"}; | |
6241 | goog.ui.Component.State = {ALL:255, DISABLED:1, HOVER:2, ACTIVE:4, SELECTED:8, CHECKED:16, FOCUSED:32, OPENED:64}; | |
6242 | goog.ui.Component.getStateTransitionEvent = function $goog$ui$Component$getStateTransitionEvent$(state, isEntering) { | |
6243 | switch(state) { | |
6244 | case goog.ui.Component.State.DISABLED: | |
6245 | return isEntering ? goog.ui.Component.EventType.DISABLE : goog.ui.Component.EventType.ENABLE; | |
6246 | case goog.ui.Component.State.HOVER: | |
6247 | return isEntering ? goog.ui.Component.EventType.HIGHLIGHT : goog.ui.Component.EventType.UNHIGHLIGHT; | |
6248 | case goog.ui.Component.State.ACTIVE: | |
6249 | return isEntering ? goog.ui.Component.EventType.ACTIVATE : goog.ui.Component.EventType.DEACTIVATE; | |
6250 | case goog.ui.Component.State.SELECTED: | |
6251 | return isEntering ? goog.ui.Component.EventType.SELECT : goog.ui.Component.EventType.UNSELECT; | |
6252 | case goog.ui.Component.State.CHECKED: | |
6253 | return isEntering ? goog.ui.Component.EventType.CHECK : goog.ui.Component.EventType.UNCHECK; | |
6254 | case goog.ui.Component.State.FOCUSED: | |
6255 | return isEntering ? goog.ui.Component.EventType.FOCUS : goog.ui.Component.EventType.BLUR; | |
6256 | case goog.ui.Component.State.OPENED: | |
6257 | return isEntering ? goog.ui.Component.EventType.OPEN : goog.ui.Component.EventType.CLOSE; | |
6258 | } | |
6259 | throw Error(goog.ui.Component.Error.STATE_INVALID); | |
6260 | }; | |
6261 | goog.ui.Component.setDefaultRightToLeft = function $goog$ui$Component$setDefaultRightToLeft$(rightToLeft) { | |
6262 | goog.ui.Component.defaultRightToLeft_ = rightToLeft; | |
6263 | }; | |
6264 | goog.ui.Component.prototype.id_ = null; | |
6265 | goog.ui.Component.prototype.inDocument_ = !1; | |
6266 | goog.ui.Component.prototype.element_ = null; | |
6267 | goog.ui.Component.prototype.rightToLeft_ = null; | |
6268 | goog.ui.Component.prototype.model_ = null; | |
6269 | goog.ui.Component.prototype.parent_ = null; | |
6270 | goog.ui.Component.prototype.children_ = null; | |
6271 | goog.ui.Component.prototype.childIndex_ = null; | |
6272 | goog.ui.Component.prototype.wasDecorated_ = !1; | |
6273 | goog.ui.Component.prototype.getId = function $goog$ui$Component$$getId$() { | |
6274 | return this.id_ || (this.id_ = this.idGenerator_.getNextUniqueId()); | |
6275 | }; | |
6276 | goog.ui.Component.prototype.setId = function $goog$ui$Component$$setId$(id) { | |
6277 | this.parent_ && this.parent_.childIndex_ && (goog.object.remove(this.parent_.childIndex_, this.id_), goog.object.add(this.parent_.childIndex_, id, this)); | |
6278 | this.id_ = id; | |
6279 | }; | |
6280 | goog.ui.Component.prototype.getElement = function $goog$ui$Component$$getElement$() { | |
6281 | return this.element_; | |
6282 | }; | |
6283 | goog.ui.Component.prototype.setElementInternal = function $goog$ui$Component$$setElementInternal$(element) { | |
6284 | this.element_ = element; | |
6285 | }; | |
6286 | goog.ui.Component.prototype.getElementsByClass = function $goog$ui$Component$$getElementsByClass$(className) { | |
6287 | return this.element_ ? this.dom_.getElementsByClass(className, this.element_) : []; | |
6288 | }; | |
6289 | goog.ui.Component.prototype.getElementByClass = function $goog$ui$Component$$getElementByClass$(className) { | |
6290 | return this.element_ ? this.dom_.getElementByClass(className, this.element_) : null; | |
6291 | }; | |
6292 | goog.ui.Component.prototype.getRequiredElementByClass = function $goog$ui$Component$$getRequiredElementByClass$(className) { | |
6293 | var el = this.getElementByClass(className); | |
6294 | goog.asserts.assert(el, "Expected element in component with class: %s", className); | |
6295 | return el; | |
6296 | }; | |
6297 | goog.ui.Component.prototype.getHandler = function $goog$ui$Component$$getHandler$() { | |
6298 | this.googUiComponentHandler_ || (this.googUiComponentHandler_ = new goog.events.EventHandler(this)); | |
6299 | return this.googUiComponentHandler_; | |
6300 | }; | |
6301 | goog.ui.Component.prototype.setParent = function $goog$ui$Component$$setParent$(parent) { | |
6302 | if (this == parent) { | |
6303 | throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET); | |
6304 | } | |
6305 | if (parent && this.parent_ && this.id_ && this.parent_.getChild(this.id_) && this.parent_ != parent) { | |
6306 | throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET); | |
6307 | } | |
6308 | this.parent_ = parent; | |
6309 | goog.ui.Component.superClass_.setParentEventTarget.call(this, parent); | |
6310 | }; | |
6311 | goog.ui.Component.prototype.getParent = function $goog$ui$Component$$getParent$() { | |
6312 | return this.parent_; | |
6313 | }; | |
6314 | goog.ui.Component.prototype.setParentEventTarget = function $goog$ui$Component$$setParentEventTarget$(parent) { | |
6315 | if (this.parent_ && this.parent_ != parent) { | |
6316 | throw Error(goog.ui.Component.Error.NOT_SUPPORTED); | |
6317 | } | |
6318 | goog.ui.Component.superClass_.setParentEventTarget.call(this, parent); | |
6319 | }; | |
6320 | goog.ui.Component.prototype.getDomHelper = function $goog$ui$Component$$getDomHelper$() { | |
6321 | return this.dom_; | |
6322 | }; | |
6323 | goog.ui.Component.prototype.isInDocument = function $goog$ui$Component$$isInDocument$() { | |
6324 | return this.inDocument_; | |
6325 | }; | |
6326 | goog.ui.Component.prototype.createDom = function $goog$ui$Component$$createDom$() { | |
6327 | this.element_ = this.dom_.createElement("div"); | |
6328 | }; | |
6329 | goog.ui.Component.prototype.render = function $goog$ui$Component$$render$(opt_parentElement) { | |
6330 | this.render_(opt_parentElement); | |
6331 | }; | |
6332 | goog.ui.Component.prototype.render_ = function $goog$ui$Component$$render_$(opt_parentElement, opt_beforeNode) { | |
6333 | if (this.inDocument_) { | |
6334 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
6335 | } | |
6336 | this.element_ || this.createDom(); | |
6337 | opt_parentElement ? opt_parentElement.insertBefore(this.element_, opt_beforeNode || null) : this.dom_.getDocument().body.appendChild(this.element_); | |
6338 | this.parent_ && !this.parent_.isInDocument() || this.enterDocument(); | |
6339 | }; | |
6340 | goog.ui.Component.prototype.decorate = function $goog$ui$Component$$decorate$(element) { | |
6341 | if (this.inDocument_) { | |
6342 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
6343 | } | |
6344 | if (element && this.canDecorate(element)) { | |
6345 | this.wasDecorated_ = !0; | |
6346 | var doc = goog.dom.getOwnerDocument(element); | |
6347 | this.dom_ && this.dom_.getDocument() == doc || (this.dom_ = goog.dom.getDomHelper(element)); | |
6348 | this.decorateInternal(element); | |
6349 | goog.ui.Component.ALLOW_DETACHED_DECORATION && !goog.dom.contains(doc, element) || this.enterDocument(); | |
6350 | } else { | |
6351 | throw Error(goog.ui.Component.Error.DECORATE_INVALID); | |
6352 | } | |
6353 | }; | |
6354 | goog.ui.Component.prototype.canDecorate = function $goog$ui$Component$$canDecorate$() { | |
6355 | return!0; | |
6356 | }; | |
6357 | goog.ui.Component.prototype.decorateInternal = function $goog$ui$Component$$decorateInternal$(element) { | |
6358 | this.element_ = element; | |
6359 | }; | |
6360 | goog.ui.Component.prototype.enterDocument = function $goog$ui$Component$$enterDocument$() { | |
6361 | this.inDocument_ = !0; | |
6362 | this.forEachChild(function(child) { | |
6363 | !child.isInDocument() && child.getElement() && child.enterDocument(); | |
6364 | }); | |
6365 | }; | |
6366 | goog.ui.Component.prototype.exitDocument = function $goog$ui$Component$$exitDocument$() { | |
6367 | this.forEachChild(function(child) { | |
6368 | child.isInDocument() && child.exitDocument(); | |
6369 | }); | |
6370 | this.googUiComponentHandler_ && this.googUiComponentHandler_.removeAll(); | |
6371 | this.inDocument_ = !1; | |
6372 | }; | |
6373 | goog.ui.Component.prototype.disposeInternal = function $goog$ui$Component$$disposeInternal$() { | |
6374 | this.inDocument_ && this.exitDocument(); | |
6375 | this.googUiComponentHandler_ && (this.googUiComponentHandler_.dispose(), delete this.googUiComponentHandler_); | |
6376 | this.forEachChild(function(child) { | |
6377 | child.dispose(); | |
6378 | }); | |
6379 | !this.wasDecorated_ && this.element_ && goog.dom.removeNode(this.element_); | |
6380 | this.parent_ = this.model_ = this.element_ = this.childIndex_ = this.children_ = null; | |
6381 | goog.ui.Component.superClass_.disposeInternal.call(this); | |
6382 | }; | |
6383 | goog.ui.Component.prototype.addChild = function $goog$ui$Component$$addChild$(child, opt_render) { | |
6384 | this.addChildAt(child, this.getChildCount(), opt_render); | |
6385 | }; | |
6386 | goog.ui.Component.prototype.addChildAt = function $goog$ui$Component$$addChildAt$(child, index, opt_render) { | |
6387 | goog.asserts.assert(!!child, "Provided element must not be null."); | |
6388 | if (child.inDocument_ && (opt_render || !this.inDocument_)) { | |
6389 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
6390 | } | |
6391 | if (0 > index || index > this.getChildCount()) { | |
6392 | throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS); | |
6393 | } | |
6394 | this.childIndex_ && this.children_ || (this.childIndex_ = {}, this.children_ = []); | |
6395 | child.getParent() == this ? (goog.object.set(this.childIndex_, child.getId(), child), goog.array.remove(this.children_, child)) : goog.object.add(this.childIndex_, child.getId(), child); | |
6396 | child.setParent(this); | |
6397 | goog.array.insertAt(this.children_, child, index); | |
6398 | if (child.inDocument_ && this.inDocument_ && child.getParent() == this) { | |
6399 | var contentElement = this.getContentElement(); | |
6400 | contentElement.insertBefore(child.getElement(), contentElement.childNodes[index] || null); | |
6401 | } else { | |
6402 | if (opt_render) { | |
6403 | this.element_ || this.createDom(); | |
6404 | var sibling = this.getChildAt(index + 1); | |
6405 | child.render_(this.getContentElement(), sibling ? sibling.element_ : null); | |
6406 | } else { | |
6407 | this.inDocument_ && !child.inDocument_ && child.element_ && child.element_.parentNode && child.element_.parentNode.nodeType == goog.dom.NodeType.ELEMENT && child.enterDocument(); | |
6408 | } | |
6409 | } | |
6410 | }; | |
6411 | goog.ui.Component.prototype.getContentElement = function $goog$ui$Component$$getContentElement$() { | |
6412 | return this.element_; | |
6413 | }; | |
6414 | goog.ui.Component.prototype.isRightToLeft = function $goog$ui$Component$$isRightToLeft$() { | |
6415 | null == this.rightToLeft_ && (this.rightToLeft_ = goog.style.isRightToLeft(this.inDocument_ ? this.element_ : this.dom_.getDocument().body)); | |
6416 | return this.rightToLeft_; | |
6417 | }; | |
6418 | goog.ui.Component.prototype.setRightToLeft = function $goog$ui$Component$$setRightToLeft$(rightToLeft) { | |
6419 | if (this.inDocument_) { | |
6420 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
6421 | } | |
6422 | this.rightToLeft_ = rightToLeft; | |
6423 | }; | |
6424 | goog.ui.Component.prototype.hasChildren = function $goog$ui$Component$$hasChildren$() { | |
6425 | return!!this.children_ && 0 != this.children_.length; | |
6426 | }; | |
6427 | goog.ui.Component.prototype.getChildCount = function $goog$ui$Component$$getChildCount$() { | |
6428 | return this.children_ ? this.children_.length : 0; | |
6429 | }; | |
6430 | goog.ui.Component.prototype.getChild = function $goog$ui$Component$$getChild$(id) { | |
6431 | return this.childIndex_ && id ? goog.object.get(this.childIndex_, id) || null : null; | |
6432 | }; | |
6433 | goog.ui.Component.prototype.getChildAt = function $goog$ui$Component$$getChildAt$(index) { | |
6434 | return this.children_ ? this.children_[index] || null : null; | |
6435 | }; | |
6436 | goog.ui.Component.prototype.forEachChild = function $goog$ui$Component$$forEachChild$(f, opt_obj) { | |
6437 | this.children_ && goog.array.forEach(this.children_, f, opt_obj); | |
6438 | }; | |
6439 | goog.ui.Component.prototype.indexOfChild = function $goog$ui$Component$$indexOfChild$(child) { | |
6440 | return this.children_ && child ? goog.array.indexOf(this.children_, child) : -1; | |
6441 | }; | |
6442 | goog.ui.Component.prototype.removeChild = function $goog$ui$Component$$removeChild$(child, opt_unrender) { | |
6443 | if (child) { | |
6444 | var id = goog.isString(child) ? child : child.getId(); | |
6445 | child = this.getChild(id); | |
6446 | id && child && (goog.object.remove(this.childIndex_, id), goog.array.remove(this.children_, child), opt_unrender && (child.exitDocument(), child.element_ && goog.dom.removeNode(child.element_)), child.setParent(null)); | |
6447 | } | |
6448 | if (!child) { | |
6449 | throw Error(goog.ui.Component.Error.NOT_OUR_CHILD); | |
6450 | } | |
6451 | return child; | |
6452 | }; | |
6453 | goog.ui.Component.prototype.removeChildAt = function $goog$ui$Component$$removeChildAt$(index, opt_unrender) { | |
6454 | return this.removeChild(this.getChildAt(index), opt_unrender); | |
6455 | }; | |
6456 | goog.ui.Component.prototype.removeChildren = function $goog$ui$Component$$removeChildren$(opt_unrender) { | |
6457 | for (var removedChildren = [];this.hasChildren();) { | |
6458 | removedChildren.push(this.removeChildAt(0, opt_unrender)); | |
6459 | } | |
6460 | return removedChildren; | |
6461 | }; | |
6462 | i18n.input.chrome.inputview.PointerConfig = function $i18n$input$chrome$inputview$PointerConfig$(dblClick, longPressWithPointerUp, longPressWithoutPointerUp) { | |
6463 | this.dblClick = dblClick; | |
6464 | this.longPressWithPointerUp = longPressWithPointerUp; | |
6465 | this.longPressWithoutPointerUp = longPressWithoutPointerUp; | |
6466 | this.flickerDirection = 0; | |
6467 | }; | |
6468 | i18n.input.chrome.inputview.Element = function $i18n$input$chrome$inputview$Element$(id, type, opt_eventTarget) { | |
6469 | goog.ui.Component.call(this); | |
6470 | this.setParentEventTarget(opt_eventTarget || null); | |
6471 | this.id = id; | |
6472 | this.type = type; | |
6473 | this.display_ = ""; | |
6474 | this.handler = new goog.events.EventHandler(this); | |
6475 | this.pointerConfig = new i18n.input.chrome.inputview.PointerConfig(!1, !1, !1); | |
6476 | }; | |
6477 | goog.inherits(i18n.input.chrome.inputview.Element, goog.ui.Component); | |
6478 | i18n.input.chrome.inputview.Element.prototype.resize = function $i18n$input$chrome$inputview$Element$$resize$(width, height) { | |
6479 | this.width = width; | |
6480 | this.height = height; | |
6481 | }; | |
6482 | i18n.input.chrome.inputview.Element.prototype.createDom = function $i18n$input$chrome$inputview$Element$$createDom$() { | |
6483 | i18n.input.chrome.inputview.Element.superClass_.createDom.call(this); | |
6484 | this.getElement().id = this.id; | |
6485 | this.getElement().view = this; | |
6486 | }; | |
6487 | i18n.input.chrome.inputview.Element.prototype.enterDocument = function $i18n$input$chrome$inputview$Element$$enterDocument$() { | |
6488 | i18n.input.chrome.inputview.Element.superClass_.enterDocument.call(this); | |
6489 | this.display_ = this.getElement().style.display; | |
6490 | }; | |
6491 | i18n.input.chrome.inputview.Element.prototype.isVisible = function $i18n$input$chrome$inputview$Element$$isVisible$() { | |
6492 | return goog.style.isElementShown(this.getElement()); | |
6493 | }; | |
6494 | i18n.input.chrome.inputview.Element.prototype.setVisible = function $i18n$input$chrome$inputview$Element$$setVisible$(visibility) { | |
6495 | this.getElement().style.display = visibility ? this.display_ : "none"; | |
6496 | }; | |
6497 | i18n.input.chrome.inputview.Element.prototype.update = function $i18n$input$chrome$inputview$Element$$update$() { | |
6498 | this.setHighlighted(!1); | |
6499 | for (var i = 0;i < this.getChildCount();i++) { | |
6500 | var child = this.getChildAt(i); | |
6501 | child.update(); | |
6502 | } | |
6503 | }; | |
6504 | i18n.input.chrome.inputview.Element.prototype.setHighlighted = function $i18n$input$chrome$inputview$Element$$setHighlighted$(highlight) { | |
6505 | highlight ? goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.ELEMENT_HIGHLIGHT) : goog.dom.classes.remove(this.getElement(), i18n.input.chrome.inputview.Css.ELEMENT_HIGHLIGHT); | |
6506 | }; | |
6507 | i18n.input.chrome.inputview.Element.prototype.disposeInternal = function $i18n$input$chrome$inputview$Element$$disposeInternal$() { | |
6508 | this.getElement().view = null; | |
6509 | goog.dispose(this.handler); | |
6510 | i18n.input.chrome.inputview.Element.superClass_.disposeInternal.call(this); | |
6511 | }; | |
6512 | i18n.input.chrome.inputview.SwipeDirection = {UP:1, DOWN:2, LEFT:4, RIGHT:8}; | |
6513 | i18n.input.chrome.inputview.SwipeState = function $i18n$input$chrome$inputview$SwipeState$() { | |
6514 | this.previousY = this.previousX = this.offsetY = this.offsetX = 0; | |
6515 | }; | |
6516 | i18n.input.chrome.inputview.SwipeState.prototype.reset = function $i18n$input$chrome$inputview$SwipeState$$reset$() { | |
6517 | this.offsetX = this.offsetY = this.previousX = this.previousY = 0; | |
6518 | }; | |
6519 | i18n.input.chrome.inputview.PointerHandler = function $i18n$input$chrome$inputview$PointerHandler$(target, opt_parentEventTarget) { | |
6520 | goog.events.EventTarget.call(this); | |
6521 | this.setParentEventTarget(opt_parentEventTarget || null); | |
6522 | this.view_ = this.getView_(target); | |
6523 | this.swipeState_ = new i18n.input.chrome.inputview.SwipeState; | |
6524 | }; | |
6525 | goog.inherits(i18n.input.chrome.inputview.PointerHandler, goog.events.EventTarget); | |
6526 | i18n.input.chrome.inputview.PointerHandler.LONG_PRESS_DELAY_ = 500; | |
6527 | i18n.input.chrome.inputview.PointerHandler.DOUBLE_CLICK_INTERVAL_ = 500; | |
6528 | i18n.input.chrome.inputview.PointerHandler.MINIMUM_SWIPE_DISTANCE_ = 20; | |
6529 | i18n.input.chrome.inputview.PointerHandler.prototype.pointerDownTimeStamp_ = 0; | |
6530 | i18n.input.chrome.inputview.PointerHandler.prototype.isDBLClicking_ = !1; | |
6531 | i18n.input.chrome.inputview.PointerHandler.prototype.isLongPressing_ = !1; | |
6532 | i18n.input.chrome.inputview.PointerHandler.prototype.isFlickering_ = !1; | |
6533 | i18n.input.chrome.inputview.PointerHandler.prototype.getView_ = function $i18n$input$chrome$inputview$PointerHandler$$getView_$(target) { | |
6534 | if (!target) { | |
6535 | return null; | |
6536 | } | |
6537 | for (var element = target, view = element.view;!view && element;) { | |
6538 | view = element.view, element = goog.dom.getParentElement(element); | |
6539 | } | |
6540 | return view; | |
6541 | }; | |
6542 | i18n.input.chrome.inputview.PointerHandler.prototype.handleTouchMove = function $i18n$input$chrome$inputview$PointerHandler$$handleTouchMove$(touchEvent) { | |
6543 | var direction = 0, deltaX = 0 == this.swipeState_.previousX ? 0 : touchEvent.pageX - this.swipeState_.previousX, deltaY = 0 == this.swipeState_.previousY ? 0 : touchEvent.pageY - this.swipeState_.previousY; | |
6544 | this.swipeState_.offsetX += deltaX; | |
6545 | this.swipeState_.offsetY += deltaY; | |
6546 | var minimumSwipeDist = i18n.input.chrome.inputview.PointerHandler.MINIMUM_SWIPE_DISTANCE_; | |
6547 | this.swipeState_.offsetX > minimumSwipeDist ? (direction |= i18n.input.chrome.inputview.SwipeDirection.RIGHT, this.swipeState_.offsetX = 0) : this.swipeState_.offsetX < -minimumSwipeDist && (direction |= i18n.input.chrome.inputview.SwipeDirection.LEFT, this.swipeState_.offsetX = 0); | |
6548 | Math.abs(deltaY) > Math.abs(deltaX) && (this.swipeState_.offsetY > minimumSwipeDist ? (direction |= i18n.input.chrome.inputview.SwipeDirection.DOWN, this.swipeState_.offsetY = 0) : this.swipeState_.offsetY < -minimumSwipeDist && (direction |= i18n.input.chrome.inputview.SwipeDirection.UP, this.swipeState_.offsetY = 0)); | |
6549 | this.swipeState_.previousX = touchEvent.pageX; | |
6550 | this.swipeState_.previousY = touchEvent.pageY; | |
6551 | 0 < direction && (goog.Timer.clear(this.longPressTimer_), this.dispatchEvent(new i18n.input.chrome.inputview.events.SwipeEvent(this.view_, direction, touchEvent.target, touchEvent.pageX, touchEvent.pageY)), this.isFlickering_ = !this.isLongPressing_ && !!(this.view_.pointerConfig.flickerDirection & direction)); | |
6552 | if (!this.isFlickering_) { | |
6553 | var actualTarget = document.elementFromPoint(touchEvent.pageX, touchEvent.pageY), currentTargetView = this.getView_(this.currentTarget_), actualTargetView = this.getView_(actualTarget); | |
6554 | currentTargetView != actualTargetView && (currentTargetView && this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(currentTargetView, i18n.input.chrome.inputview.events.EventType.POINTER_OUT, this.currentTarget_, touchEvent.pageX, touchEvent.pageY)), actualTargetView && this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(actualTargetView, i18n.input.chrome.inputview.events.EventType.POINTER_OVER, actualTarget, touchEvent.pageX, touchEvent.pageY)), this.currentTarget_ = | |
6555 | actualTarget); | |
6556 | } | |
6557 | }; | |
6558 | i18n.input.chrome.inputview.PointerHandler.prototype.handlePointerUp = function $i18n$input$chrome$inputview$PointerHandler$$handlePointerUp$(e) { | |
6559 | goog.Timer.clear(this.longPressTimer_); | |
6560 | var nativeEvt = e.getBrowserEvent(); | |
6561 | this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(this.view_, i18n.input.chrome.inputview.events.EventType.LONG_PRESS_END, e.target, nativeEvt.pageX, nativeEvt.pageY)); | |
6562 | if (!(this.isDBLClicking_ || this.isLongPressing_ && this.view_.pointerConfig.longPressWithoutPointerUp)) { | |
6563 | var view = this.isFlickering_ ? this.view_ : this.getView_(this.currentTarget_); | |
6564 | view && this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(view, i18n.input.chrome.inputview.events.EventType.POINTER_UP, this.currentTarget_, nativeEvt.pageX, nativeEvt.pageY)); | |
6565 | } | |
6566 | this.isFlickering_ = this.isLongPressing_ = this.isDBLClicking_ = !1; | |
6567 | this.swipeState_.reset(); | |
6568 | e.preventDefault(); | |
6569 | e.stopPropagation(); | |
6570 | }; | |
6571 | i18n.input.chrome.inputview.PointerHandler.prototype.handlePointerDown = function $i18n$input$chrome$inputview$PointerHandler$$handlePointerDown$(e) { | |
6572 | this.currentTarget_ = e.target; | |
6573 | var nativeEvt = e.getBrowserEvent(); | |
6574 | goog.Timer.clear(this.longPressTimer_); | |
6575 | this.maybeTriggerKeyDownLongPress_(e); | |
6576 | this.maybeHandleDBLClick_(e); | |
6577 | this.isDBLClicking_ || this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(this.view_, i18n.input.chrome.inputview.events.EventType.POINTER_DOWN, e.target, nativeEvt.pageX, nativeEvt.pageY)); | |
6578 | e.preventDefault(); | |
6579 | e.stopPropagation(); | |
6580 | }; | |
6581 | i18n.input.chrome.inputview.PointerHandler.prototype.maybeTriggerKeyDownLongPress_ = function $i18n$input$chrome$inputview$PointerHandler$$maybeTriggerKeyDownLongPress_$(e) { | |
6582 | if (this.view_.pointerConfig.longPressWithPointerUp || this.view_.pointerConfig.longPressWithoutPointerUp) { | |
6583 | this.longPressTimer_ = goog.Timer.callOnce(goog.bind(this.triggerLongPress_, this, e), i18n.input.chrome.inputview.PointerHandler.LONG_PRESS_DELAY_, this); | |
6584 | } | |
6585 | }; | |
6586 | i18n.input.chrome.inputview.PointerHandler.prototype.maybeHandleDBLClick_ = function $i18n$input$chrome$inputview$PointerHandler$$maybeHandleDBLClick_$(e) { | |
6587 | if (this.view_.pointerConfig.dblClick) { | |
6588 | var timeInMs = (new Date).getTime(), interval = i18n.input.chrome.inputview.PointerHandler.DOUBLE_CLICK_INTERVAL_, nativeEvt = e.getBrowserEvent(); | |
6589 | timeInMs - this.pointerDownTimeStamp_ < interval && (this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(this.view_, i18n.input.chrome.inputview.events.EventType.DOUBLE_CLICK, e.target, nativeEvt.pageX, nativeEvt.pageY)), this.isDBLClicking_ = !0); | |
6590 | this.pointerDownTimeStamp_ = timeInMs; | |
6591 | } | |
6592 | }; | |
6593 | i18n.input.chrome.inputview.PointerHandler.prototype.triggerLongPress_ = function $i18n$input$chrome$inputview$PointerHandler$$triggerLongPress_$(e) { | |
6594 | var nativeEvt = e.getBrowserEvent(); | |
6595 | this.dispatchEvent(new i18n.input.chrome.inputview.events.PointerEvent(this.view_, i18n.input.chrome.inputview.events.EventType.LONG_PRESS, e.target, nativeEvt.pageX, nativeEvt.pageY)); | |
6596 | this.isLongPressing_ = !0; | |
6597 | }; | |
6598 | i18n.input.chrome.inputview.PointerHandler.prototype.disposeInternal = function $i18n$input$chrome$inputview$PointerHandler$$disposeInternal$() { | |
6599 | goog.dispose(this.longPressTimer_); | |
6600 | i18n.input.chrome.inputview.PointerHandler.superClass_.disposeInternal.call(this); | |
6601 | }; | |
6602 | i18n.input.chrome.inputview.AltDataView = function $i18n$input$chrome$inputview$AltDataView$(opt_eventTarget) { | |
6603 | i18n.input.chrome.inputview.Element.call(this, "", i18n.input.chrome.inputview.ElementType.ALTDATA_VIEW, opt_eventTarget); | |
6604 | this.altdataElements_ = []; | |
6605 | }; | |
6606 | goog.inherits(i18n.input.chrome.inputview.AltDataView, i18n.input.chrome.inputview.Element); | |
6607 | i18n.input.chrome.inputview.AltDataView.PADDING_ = 6; | |
6608 | i18n.input.chrome.inputview.AltDataView.FINGER_DISTANCE_TO_CANCEL_ALTDATA_ = 100; | |
6609 | i18n.input.chrome.inputview.AltDataView.prototype.highlightIndex_ = 0; | |
6610 | i18n.input.chrome.inputview.AltDataView.prototype.createDom = function $i18n$input$chrome$inputview$AltDataView$$createDom$() { | |
6611 | i18n.input.chrome.inputview.AltDataView.superClass_.createDom.call(this); | |
6612 | var dom = this.getDomHelper(), elem = this.getElement(); | |
6613 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.ALTDATA_VIEW); | |
6614 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.FONT); | |
6615 | this.coverElement_ = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.ALTDATA_COVER); | |
6616 | dom.appendChild(document.body, this.coverElement_); | |
6617 | goog.style.setElementShown(this.coverElement_, !1); | |
6618 | this.coverElement_.view = this; | |
6619 | }; | |
6620 | i18n.input.chrome.inputview.AltDataView.prototype.enterDocument = function $i18n$input$chrome$inputview$AltDataView$$enterDocument$() { | |
6621 | i18n.input.chrome.inputview.AltDataView.superClass_.enterDocument.call(this); | |
6622 | goog.style.setElementShown(this.getElement(), !1); | |
6623 | }; | |
6624 | i18n.input.chrome.inputview.AltDataView.prototype.show = function $i18n$input$chrome$inputview$AltDataView$$show$(key) { | |
6625 | this.triggeredBy = key; | |
6626 | var coordinate = goog.style.getClientPosition(key.getElement()), x = coordinate.x, y = coordinate.y, width = key.availableWidth, height = key.availableHeight, ElementType = i18n.input.chrome.inputview.ElementType, characters; | |
6627 | if (key.type == ElementType.CHARACTER_KEY) { | |
6628 | characters = key.getAltCharacters(); | |
6629 | } else { | |
6630 | if (key.type == ElementType.COMPACT_KEY) { | |
6631 | var accents = i18n.input.chrome.inputview.util.ACCENT_MAP[key.text]; | |
6632 | characters = []; | |
6633 | accents && (characters = goog.array.clone(accents)); | |
6634 | key.hintText && goog.array.insertAt(characters, key.hintText, 0); | |
6635 | } | |
6636 | } | |
6637 | if (characters && 0 != characters.length) { | |
6638 | goog.style.setElementShown(this.getElement(), !0); | |
6639 | this.getDomHelper().removeChildren(this.getElement()); | |
6640 | var altDataWidth = width * characters.length, showingLeft = x + altDataWidth > screen.width; | |
6641 | showingLeft && characters.reverse(); | |
6642 | for (var i = 0;i < characters.length;i++) { | |
6643 | var keyElem = this.addKey_(characters[i]); | |
6644 | goog.style.setSize(keyElem, width, height); | |
6645 | this.altdataElements_.push(keyElem); | |
6646 | } | |
6647 | var left = x; | |
6648 | showingLeft ? (left = x + width - altDataWidth, this.highlightIndex_ = this.altdataElements_.length - 1, this.setElementBackground_(this.altdataElements_[this.highlightIndex_], !0)) : this.setElementBackground_(this.altdataElements_[0], !0); | |
6649 | var elemTop = y - height - i18n.input.chrome.inputview.AltDataView.PADDING_; | |
6650 | 0 > elemTop && (elemTop = y + height + i18n.input.chrome.inputview.AltDataView.PADDING_); | |
6651 | goog.style.setPosition(this.getElement(), left, elemTop); | |
6652 | goog.style.setElementShown(this.coverElement_, !0); | |
6653 | } | |
6654 | }; | |
6655 | i18n.input.chrome.inputview.AltDataView.prototype.hide = function $i18n$input$chrome$inputview$AltDataView$$hide$() { | |
6656 | this.altdataElements_ = []; | |
6657 | this.highlightIndex_ = 0; | |
6658 | goog.style.setElementShown(this.getElement(), !1); | |
6659 | goog.style.setElementShown(this.coverElement_, !1); | |
6660 | }; | |
6661 | i18n.input.chrome.inputview.AltDataView.prototype.highlightItem = function $i18n$input$chrome$inputview$AltDataView$$highlightItem$(x, y) { | |
6662 | for (var i = 0;i < this.altdataElements_.length;i++) { | |
6663 | var elem = this.altdataElements_[i], coordinate = goog.style.getClientPosition(elem), size = goog.style.getSize(elem); | |
6664 | coordinate.x < x && coordinate.x + size.width > x && (this.highlightIndex_ = i, this.clearAllHighlights_(), this.setElementBackground_(elem, !0)); | |
6665 | var verticalDist = Math.min(Math.abs(y - coordinate.y), Math.abs(y - coordinate.y - size.height)); | |
6666 | if (verticalDist > i18n.input.chrome.inputview.AltDataView.FINGER_DISTANCE_TO_CANCEL_ALTDATA_) { | |
6667 | this.hide(); | |
6668 | break; | |
6669 | } | |
6670 | } | |
6671 | }; | |
6672 | i18n.input.chrome.inputview.AltDataView.prototype.clearAllHighlights_ = function $i18n$input$chrome$inputview$AltDataView$$clearAllHighlights_$() { | |
6673 | for (var i = 0;i < this.altdataElements_.length;i++) { | |
6674 | this.setElementBackground_(this.altdataElements_[i], !1); | |
6675 | } | |
6676 | }; | |
6677 | i18n.input.chrome.inputview.AltDataView.prototype.setElementBackground_ = function $i18n$input$chrome$inputview$AltDataView$$setElementBackground_$(element, highlight) { | |
6678 | highlight ? goog.dom.classes.add(element, i18n.input.chrome.inputview.Css.ELEMENT_HIGHLIGHT) : goog.dom.classes.remove(element, i18n.input.chrome.inputview.Css.ELEMENT_HIGHLIGHT); | |
6679 | }; | |
6680 | i18n.input.chrome.inputview.AltDataView.prototype.getHighlightedCharacter = function $i18n$input$chrome$inputview$AltDataView$$getHighlightedCharacter$() { | |
6681 | return goog.dom.getTextContent(this.altdataElements_[this.highlightIndex_]); | |
6682 | }; | |
6683 | i18n.input.chrome.inputview.AltDataView.prototype.addKey_ = function $i18n$input$chrome$inputview$AltDataView$$addKey_$(character) { | |
6684 | var dom = this.getDomHelper(), keyElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.ALTDATA_KEY, i18n.input.chrome.inputview.util.getVisibleCharacter(character)); | |
6685 | dom.appendChild(this.getElement(), keyElem); | |
6686 | return keyElem; | |
6687 | }; | |
6688 | i18n.input.chrome.inputview.AltDataView.prototype.getCoverElement = function $i18n$input$chrome$inputview$AltDataView$$getCoverElement$() { | |
6689 | return this.coverElement_; | |
6690 | }; | |
6691 | i18n.input.chrome.inputview.AltDataView.prototype.resize = function $i18n$input$chrome$inputview$AltDataView$$resize$(width, height) { | |
6692 | i18n.input.chrome.inputview.AltDataView.superClass_.resize.call(this, width, height); | |
6693 | goog.style.setSize(this.coverElement_, width, height); | |
6694 | }; | |
6695 | i18n.input.chrome.inputview.AltDataView.prototype.disposeInternal = function $i18n$input$chrome$inputview$AltDataView$$disposeInternal$() { | |
6696 | this.getElement().view = null; | |
6697 | i18n.input.chrome.inputview.AltDataView.superClass_.disposeInternal.call(this); | |
6698 | }; | |
6699 | i18n.input.chrome.inputview.ElementType = {CHARACTER:0, FUNCTIONAL_KEY:1, KEYBOARD:2, LAYOUT_VIEW:3, LINEAR_LAYOUT:4, MODIFIER_KEY:5, CHARACTER_KEY:6, SOFT_KEY:7, SOFT_KEY_VIEW:8, VERTICAL_LAYOUT:9, CANDIDATE_VIEW:10, SPACE_KEY:11, ENTER_KEY:12, BACKSPACE_KEY:13, TAB_KEY:14, ARROW_UP:15, ARROW_DOWN:16, ARROW_LEFT:17, ARROW_RIGHT:18, HIDE_KEYBOARD_KEY:19, ALTDATA_VIEW:20, SWITCHER_KEY:21, COMPACT_KEY:22}; | |
6700 | i18n.input.chrome.inputview.CandidateView = function $i18n$input$chrome$inputview$CandidateView$(id, widthInWeight, heightInWeight, numberRowWeight, opt_eventTarget) { | |
6701 | i18n.input.chrome.inputview.Element.call(this, id, i18n.input.chrome.inputview.ElementType.CANDIDATE_VIEW, opt_eventTarget); | |
6702 | this.widthInWeight_ = widthInWeight; | |
6703 | this.heightInWeight_ = heightInWeight; | |
6704 | this.numberRowWeight_ = numberRowWeight; | |
6705 | }; | |
6706 | goog.inherits(i18n.input.chrome.inputview.CandidateView, i18n.input.chrome.inputview.Element); | |
6707 | i18n.input.chrome.inputview.CandidateView.PADDING_ = 50; | |
6708 | i18n.input.chrome.inputview.CandidateView.prototype.showingCandidates = !1; | |
6709 | i18n.input.chrome.inputview.CandidateView.prototype.showingNumberRow = !1; | |
6710 | i18n.input.chrome.inputview.CandidateView.WIDTH_FOR_THREE_CANDIDATES_ = 235; | |
6711 | i18n.input.chrome.inputview.CandidateView.prototype.createDom = function $i18n$input$chrome$inputview$CandidateView$$createDom$() { | |
6712 | i18n.input.chrome.inputview.CandidateView.superClass_.createDom.call(this); | |
6713 | goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.CANDIDATE_VIEW); | |
6714 | }; | |
6715 | i18n.input.chrome.inputview.CandidateView.prototype.getWidthInWeight = function $i18n$input$chrome$inputview$CandidateView$$getWidthInWeight$() { | |
6716 | return this.widthInWeight_; | |
6717 | }; | |
6718 | i18n.input.chrome.inputview.CandidateView.prototype.getHeightInWeight = function $i18n$input$chrome$inputview$CandidateView$$getHeightInWeight$() { | |
6719 | return this.heightInWeight_; | |
6720 | }; | |
6721 | i18n.input.chrome.inputview.CandidateView.prototype.hideNumberRow = function $i18n$input$chrome$inputview$CandidateView$$hideNumberRow$() { | |
6722 | this.showingNumberRow && (this.getDomHelper().removeChildren(this.getElement()), this.showingNumberRow = !1); | |
6723 | }; | |
6724 | i18n.input.chrome.inputview.CandidateView.prototype.showNumberRow = function $i18n$input$chrome$inputview$CandidateView$$showNumberRow$() { | |
6725 | if (this.numberRowWeight_) { | |
6726 | var dom = this.getDomHelper(), numberWidth = this.numberRowWeight_ / this.widthInWeight_ / 10 * this.width - 1; | |
6727 | dom.removeChildren(this.getElement()); | |
6728 | for (var i = 0;10 > i;i++) { | |
6729 | this.createSeparator_(); | |
6730 | var numberElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.CANDIDATE, String((i + 1) % 10)); | |
6731 | dom.appendChild(this.getElement(), numberElem); | |
6732 | numberElem.style.height = this.height + "px"; | |
6733 | numberElem.style.width = numberWidth + "px"; | |
6734 | } | |
6735 | this.createSeparator_(); | |
6736 | this.getElement().style.paddingLeft = "0"; | |
6737 | this.showingNumberRow = !0; | |
6738 | } | |
6739 | }; | |
6740 | i18n.input.chrome.inputview.CandidateView.prototype.showCandidates = function $i18n$input$chrome$inputview$CandidateView$$showCandidates$(candidates, showThreeCandidates) { | |
6741 | this.clearCandidates(); | |
6742 | 0 < candidates.length && (showThreeCandidates ? this.addThreeCandidates_(candidates) : this.addFullCandidates_(candidates), this.showingCandidates = !0); | |
6743 | }; | |
6744 | i18n.input.chrome.inputview.CandidateView.prototype.addThreeCandidates_ = function $i18n$input$chrome$inputview$CandidateView$$addThreeCandidates_$(candidates) { | |
6745 | for (var width = i18n.input.chrome.inputview.CandidateView.WIDTH_FOR_THREE_CANDIDATES_, num = Math.min(3, candidates.length), dom = this.getDomHelper(), i = 0;i < num;i++) { | |
6746 | this.createSeparator_(); | |
6747 | var candidateElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.CANDIDATE, candidates[i]); | |
6748 | candidateElem.style.height = this.height + "px"; | |
6749 | candidateElem.style.width = width + "px"; | |
6750 | 0 == i && goog.dom.classes.add(candidateElem, i18n.input.chrome.inputview.Css.CANDIDATE_HIGHLIGHT); | |
6751 | 1 == i ? dom.insertChildAt(this.getElement(), candidateElem, 0) : dom.appendChild(this.getElement(), candidateElem); | |
6752 | } | |
6753 | this.createSeparator_(); | |
6754 | var padding = (this.width - width * i - i - 1) / 2; | |
6755 | this.getElement().style.paddingLeft = padding + "px"; | |
6756 | }; | |
6757 | i18n.input.chrome.inputview.CandidateView.prototype.clearCandidates = function $i18n$input$chrome$inputview$CandidateView$$clearCandidates$() { | |
6758 | this.showingCandidates && (this.getDomHelper().removeChildren(this.getElement()), this.showingCandidates = !1); | |
6759 | }; | |
6760 | i18n.input.chrome.inputview.CandidateView.prototype.addFullCandidates_ = function $i18n$input$chrome$inputview$CandidateView$$addFullCandidates_$(candidates) { | |
6761 | for (var w = 0, dom = this.getDomHelper(), i = 0;i < candidates.length;i++) { | |
6762 | this.createSeparator_(); | |
6763 | var candidateElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.CANDIDATE, candidates[i]); | |
6764 | dom.appendChild(this.getElement(), candidateElem); | |
6765 | var size = goog.style.getSize(candidateElem), w = w + (size.width + 2 * i18n.input.chrome.inputview.CandidateView.PADDING_); | |
6766 | if (w >= this.width) { | |
6767 | this.getElement().removeChild(candidateElem); | |
6768 | return; | |
6769 | } | |
6770 | candidateElem.style.height = this.height + "px"; | |
6771 | candidateElem.style.paddingLeft = i18n.input.chrome.inputview.CandidateView.PADDING_ + "px"; | |
6772 | candidateElem.style.paddingRight = i18n.input.chrome.inputview.CandidateView.PADDING_ + "px"; | |
6773 | } | |
6774 | this.getElement().style.paddingLeft = "0"; | |
6775 | }; | |
6776 | i18n.input.chrome.inputview.CandidateView.prototype.createSeparator_ = function $i18n$input$chrome$inputview$CandidateView$$createSeparator_$() { | |
6777 | var dom = this.getDomHelper(), tableCell = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.TABLE_CELL), separator = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.CANDIDATE_SEPARATOR); | |
6778 | separator.style.height = Math.floor(.5 * this.height) + "px"; | |
6779 | dom.appendChild(tableCell, separator); | |
6780 | dom.appendChild(this.getElement(), tableCell); | |
6781 | }; | |
6782 | i18n.input.chrome.inputview.CandidateView.prototype.resize = function $i18n$input$chrome$inputview$CandidateView$$resize$(width, height) { | |
6783 | i18n.input.chrome.inputview.CandidateView.superClass_.resize.call(this, width, height); | |
6784 | var elem = this.getElement(); | |
6785 | elem.style.width = width + "px"; | |
6786 | elem.style.height = height + "px"; | |
6787 | }; | |
6788 | i18n.input.chrome.inputview.Character = function $i18n$input$chrome$inputview$Character$(id, model) { | |
6789 | i18n.input.chrome.inputview.Element.call(this, id, i18n.input.chrome.inputview.ElementType.CHARACTER); | |
6790 | this.characterModel_ = model; | |
6791 | }; | |
6792 | goog.inherits(i18n.input.chrome.inputview.Character, i18n.input.chrome.inputview.Element); | |
6793 | i18n.input.chrome.inputview.Character.PADDING_ = 3; | |
6794 | i18n.input.chrome.inputview.Character.prototype.createDom = function $i18n$input$chrome$inputview$Character$$createDom$() { | |
6795 | i18n.input.chrome.inputview.Character.superClass_.createDom.call(this); | |
6796 | var elem = this.getElement(), dom = this.getDomHelper(); | |
6797 | this.getElement().view = null; | |
6798 | dom.appendChild(elem, dom.createTextNode(this.characterModel_.getContent())); | |
6799 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.CHARACTER); | |
6800 | }; | |
6801 | i18n.input.chrome.inputview.Character.prototype.reposition_ = function $i18n$input$chrome$inputview$Character$$reposition_$() { | |
6802 | var width = this.width, height = this.height, size = goog.style.getSize(this.getElement()), paddingVertical, paddingHorizontal; | |
6803 | paddingHorizontal = this.characterModel_.isHorizontalAlignCenter() ? Math.floor((width - size.width) / 2) : i18n.input.chrome.inputview.Character.PADDING_; | |
6804 | paddingVertical = this.characterModel_.isVerticalAlignCenter() ? Math.floor((height - size.height) / 2) : i18n.input.chrome.inputview.Character.PADDING_; | |
6805 | var attributes = this.characterModel_.getPositionAttribute(), elem = this.getElement(); | |
6806 | elem.style[attributes[0]] = paddingVertical + "px"; | |
6807 | elem.style[attributes[1]] = paddingHorizontal + "px"; | |
6808 | }; | |
6809 | i18n.input.chrome.inputview.Character.prototype.highlight = function $i18n$input$chrome$inputview$Character$$highlight$() { | |
6810 | this.characterModel_.isHighlighted() ? goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.CHARACTER_HIGHLIGHT) : goog.dom.classes.remove(this.getElement(), i18n.input.chrome.inputview.Css.CHARACTER_HIGHLIGHT); | |
6811 | }; | |
6812 | i18n.input.chrome.inputview.Character.prototype.updateContent = function $i18n$input$chrome$inputview$Character$$updateContent$() { | |
6813 | var ch = this.characterModel_.getContent(); | |
6814 | goog.dom.setTextContent(this.getElement(), i18n.input.chrome.inputview.util.getVisibleCharacter(ch)); | |
6815 | }; | |
6816 | i18n.input.chrome.inputview.Character.prototype.setVisible = function $i18n$input$chrome$inputview$Character$$setVisible$(visibility) { | |
6817 | this.getElement().style.display = visibility ? "inline-block" : "none"; | |
6818 | }; | |
6819 | i18n.input.chrome.inputview.Character.prototype.resize = function $i18n$input$chrome$inputview$Character$$resize$(width, height) { | |
6820 | i18n.input.chrome.inputview.Character.superClass_.resize.call(this, width, height); | |
6821 | this.update(); | |
6822 | }; | |
6823 | i18n.input.chrome.inputview.Character.prototype.update = function $i18n$input$chrome$inputview$Character$$update$() { | |
6824 | this.highlight(); | |
6825 | this.reposition_(); | |
6826 | this.updateContent(); | |
6827 | this.setVisible(this.characterModel_.isVisible()); | |
6828 | }; | |
6829 | i18n.input.chrome.inputview.Character.prototype.getContent = function $i18n$input$chrome$inputview$Character$$getContent$() { | |
6830 | return this.characterModel_.getContent(); | |
6831 | }; | |
6832 | i18n.input.chrome.inputview.Character.prototype.isVisible = function $i18n$input$chrome$inputview$Character$$isVisible$() { | |
6833 | return this.characterModel_.isVisible(); | |
6834 | }; | |
6835 | i18n.input.chrome.inputview.Character.prototype.isHighlighted = function $i18n$input$chrome$inputview$Character$$isHighlighted$() { | |
6836 | return this.characterModel_.isHighlighted(); | |
6837 | }; | |
6838 | i18n.input.chrome.inputview.StateType = {DEFAULT:0, SHIFT:1, ALTGR:2, CAPSLOCK:4, CTRL:8, ALT:16}; | |
6839 | i18n.input.chrome.inputview.CharacterModel = function $i18n$input$chrome$inputview$CharacterModel$(character, belongToLetterKey, hasAltGrCharacterInTheKeyset, alwaysRenderAltGrCharacter, stateType, stateManager) { | |
6840 | this.character_ = character; | |
6841 | this.belongToLetterKey_ = belongToLetterKey; | |
6842 | this.stateType_ = stateType; | |
6843 | this.stateManager_ = stateManager; | |
6844 | this.alwaysRenderAltGrCharacter_ = alwaysRenderAltGrCharacter; | |
6845 | this.hasAltGrCharacterInTheKeyset_ = hasAltGrCharacterInTheKeyset; | |
6846 | }; | |
6847 | i18n.input.chrome.inputview.CharacterModel.AlignType = {CENTER:0, CORNER:1}; | |
6848 | i18n.input.chrome.inputview.CharacterModel.CORNERS_ = [["bottom", "left"], ["top", "left"], ["bottom", "right"], ["top", "right"]]; | |
6849 | i18n.input.chrome.inputview.CharacterModel.prototype.isHighlighted = function $i18n$input$chrome$inputview$CharacterModel$$isHighlighted$() { | |
6850 | var state = this.stateManager_.getState(), state = state & (i18n.input.chrome.inputview.StateType.SHIFT | i18n.input.chrome.inputview.StateType.ALTGR); | |
6851 | return this.stateType_ == state; | |
6852 | }; | |
6853 | i18n.input.chrome.inputview.CharacterModel.prototype.isVisible = function $i18n$input$chrome$inputview$CharacterModel$$isVisible$() { | |
6854 | return this.stateType_ == i18n.input.chrome.inputview.StateType.DEFAULT ? !this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.ALTGR) && (!this.belongToLetterKey_ || !this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT)) : this.stateType_ == i18n.input.chrome.inputview.StateType.SHIFT ? !this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.ALTGR) && (!this.belongToLetterKey_ || this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT)) : | |
6855 | 0 != (this.stateType_ & i18n.input.chrome.inputview.StateType.ALTGR) ? this.alwaysRenderAltGrCharacter_ || this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.ALTGR) : !1; | |
6856 | }; | |
6857 | i18n.input.chrome.inputview.CharacterModel.prototype.toReversedCase_ = function $i18n$input$chrome$inputview$CharacterModel$$toReversedCase_$() { | |
6858 | var reversed; | |
6859 | return reversed = this.character_.toUpperCase() == this.character_ ? this.character_.toLowerCase() : this.character_.toUpperCase(); | |
6860 | }; | |
6861 | i18n.input.chrome.inputview.CharacterModel.prototype.getContent = function $i18n$input$chrome$inputview$CharacterModel$$getContent$() { | |
6862 | return this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.CAPSLOCK) ? this.toReversedCase_() : this.character_; | |
6863 | }; | |
6864 | i18n.input.chrome.inputview.CharacterModel.prototype.isHorizontalAlignCenter = function $i18n$input$chrome$inputview$CharacterModel$$isHorizontalAlignCenter$() { | |
6865 | return this.stateType_ == i18n.input.chrome.inputview.StateType.DEFAULT || this.stateType_ == i18n.input.chrome.inputview.StateType.SHIFT ? !this.alwaysRenderAltGrCharacter_ || !this.hasAltGrCharacterInTheKeyset_ : !1; | |
6866 | }; | |
6867 | i18n.input.chrome.inputview.CharacterModel.prototype.isVerticalAlignCenter = function $i18n$input$chrome$inputview$CharacterModel$$isVerticalAlignCenter$() { | |
6868 | return this.stateType_ == i18n.input.chrome.inputview.StateType.DEFAULT || this.stateType_ == i18n.input.chrome.inputview.StateType.SHIFT ? this.belongToLetterKey_ : !1; | |
6869 | }; | |
6870 | i18n.input.chrome.inputview.CharacterModel.prototype.getPositionAttribute = function $i18n$input$chrome$inputview$CharacterModel$$getPositionAttribute$() { | |
6871 | switch(this.stateType_) { | |
6872 | case i18n.input.chrome.inputview.StateType.DEFAULT: | |
6873 | return i18n.input.chrome.inputview.CharacterModel.CORNERS_[0]; | |
6874 | case i18n.input.chrome.inputview.StateType.SHIFT: | |
6875 | return i18n.input.chrome.inputview.CharacterModel.CORNERS_[1]; | |
6876 | case i18n.input.chrome.inputview.StateType.ALTGR: | |
6877 | return i18n.input.chrome.inputview.CharacterModel.CORNERS_[2]; | |
6878 | default: | |
6879 | return i18n.input.chrome.inputview.CharacterModel.CORNERS_[3]; | |
6880 | } | |
6881 | }; | |
6882 | i18n.input.chrome.inputview.util = {}; | |
6883 | i18n.input.chrome.inputview.util.DISPLAY_MAPPING = {"\u0300":"`", "\u0301":"\u00b4", "\u0302":"\u02c6", "\u0303":"\u02dc", "\u0304":"\u02c9", "\u0305":"\u00af", "\u0306":"\u02d8", "\u0307":"\u02d9", "\u0308":"\u00a8", "\u0309":"\u02c0", "\u030a":"\u02da", "\u030b":"\u02dd", "\u030c":"\u02c7", "\u030d":"\u02c8", "\u030e":'"', "\u0327":"\u00b8", "\u0328":"\u02db", "\u0345":"\u037a", "\u030f":"\u030f ", "\u031b":"\u031b ", "\u0323":"\u0323 "}; | |
6884 | i18n.input.chrome.inputview.util.ACCENT_MAP = {A:"\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u0100".split(""), C:["\u00c7"], E:["\u00c8", "\u00c9", "\u00ca", "\u00cb", "\u0112"], I:["\u00cc", "\u00cd", "\u00ce", "\u00cf", "\u012a"], N:["\u00d1"], O:"\u00d2\u00d3\u00d4\u00d5\u00d6\u014c\u0152".split(""), S:["\u1e9e"], U:["\u00d9", "\u00da", "\u00db", "\u00dc", "\u016a"], a:"\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u0101".split(""), c:["\u00e7"], e:["\u00e8", "\u00e9", "\u00ea", "\u00eb", "\u0113"], | |
6885 | i:["\u00ec", "\u00ed", "\u00ee", "\u00ef", "\u012b"], n:["\u00f1"], o:"\u00f2\u00f3\u00f4\u00f5\u00f6\u00f8\u0153".split(""), s:["\u00df"], u:["\u00f9", "\u00fa", "\u00fb", "\u00fc", "\u016b"]}; | |
6886 | i18n.input.chrome.inputview.util.REGEX_CHARACTER_SUPPORT_DEADKEY_ = /^[a-zA-Z\u00e6\u00c6\u0153\u0152]+$/; | |
6887 | i18n.input.chrome.inputview.util.REGEX_LANGUAGE_MODEL_CHARACTERS = /^[a-zA-Z\u00e6\u00c6\u0153\u0152\'-]$/; | |
6888 | i18n.input.chrome.inputview.util.splitValue = function $i18n$input$chrome$inputview$util$splitValue$(weightArray, totalValue) { | |
6889 | if (0 == weightArray.length) { | |
6890 | return[]; | |
6891 | } | |
6892 | if (1 == weightArray.length) { | |
6893 | return[totalValue]; | |
6894 | } | |
6895 | for (var totalWeight = 0, i = 0;i < weightArray.length;i++) { | |
6896 | totalWeight += weightArray[i]; | |
6897 | } | |
6898 | for (var tmp = totalValue / totalWeight, values = [], totalFlooredValue = 0, diffs = [], i = 0;i < weightArray.length;i++) { | |
6899 | var result = weightArray[i] * tmp; | |
6900 | values.push(result); | |
6901 | diffs.push(result - Math.floor(result)); | |
6902 | totalFlooredValue += Math.floor(result); | |
6903 | } | |
6904 | for (var diff = totalValue - totalFlooredValue, i = 0;i < diff;i++) { | |
6905 | for (var max = 0, index = 0, j = 0;j < diffs.length;j++) { | |
6906 | diffs[j] > max && (max = diffs[j], index = j); | |
6907 | } | |
6908 | values[index] += 1; | |
6909 | diffs[index] = 0; | |
6910 | } | |
6911 | for (i = 0;i < values.length;i++) { | |
6912 | values[i] = Math.floor(values[i]); | |
6913 | } | |
6914 | return values; | |
6915 | }; | |
6916 | i18n.input.chrome.inputview.util.getPropertyValue = function $i18n$input$chrome$inputview$util$getPropertyValue$(elem, property) { | |
6917 | var value = goog.style.getComputedStyle(elem, property); | |
6918 | return value ? parseInt(value.replace("px", ""), 10) : 0; | |
6919 | }; | |
6920 | i18n.input.chrome.inputview.util.toUpper = function $i18n$input$chrome$inputview$util$toUpper$(character) { | |
6921 | return "\u00b5" == character ? "[5" : character.toUpperCase(); | |
6922 | }; | |
6923 | i18n.input.chrome.inputview.util.toLower = function $i18n$input$chrome$inputview$util$toLower$(character) { | |
6924 | return "I" == character ? "\u0131" : character.toLowerCase(); | |
6925 | }; | |
6926 | i18n.input.chrome.inputview.util.isCommitCharacter = function $i18n$input$chrome$inputview$util$isCommitCharacter$(character) { | |
6927 | return i18n.input.chrome.inputview.util.DISPLAY_MAPPING[character] || i18n.input.chrome.inputview.util.REGEX_LANGUAGE_MODEL_CHARACTERS.test(character) ? !1 : character.toUpperCase() == character && character.toLowerCase() == character; | |
6928 | }; | |
6929 | i18n.input.chrome.inputview.util.getVisibleCharacter = function $i18n$input$chrome$inputview$util$getVisibleCharacter$(invisibleCharacter) { | |
6930 | var map = i18n.input.chrome.inputview.util.DISPLAY_MAPPING; | |
6931 | return map[invisibleCharacter] ? map[invisibleCharacter] : invisibleCharacter; | |
6932 | }; | |
6933 | i18n.input.chrome.inputview.util.getStandardLanguageCode = function $i18n$input$chrome$inputview$util$getStandardLanguageCode$(code) { | |
6934 | var lang = code.split("-")[0]; | |
6935 | "us" == lang || 0 == lang.indexOf("en") ? lang = "en" : 0 == lang.indexOf("pt") && (lang = "pt"); | |
6936 | return lang; | |
6937 | }; | |
6938 | i18n.input.chrome.inputview.util.isLetterKey = function $i18n$input$chrome$inputview$util$isLetterKey$(characters) { | |
6939 | return characters[1] == i18n.input.chrome.inputview.util.toUpper(characters[0]) || characters[1] == i18n.input.chrome.inputview.util.toLower(characters[0]) ? !0 : !1; | |
6940 | }; | |
6941 | i18n.input.chrome.inputview.util.supportDeadKey = function $i18n$input$chrome$inputview$util$supportDeadKey$(character) { | |
6942 | return i18n.input.chrome.inputview.util.REGEX_CHARACTER_SUPPORT_DEADKEY_.test(character); | |
6943 | }; | |
6944 | i18n.input.chrome.inputview.SoftKey = function $i18n$input$chrome$inputview$SoftKey$(id, type, opt_eventTarget) { | |
6945 | i18n.input.chrome.inputview.Element.call(this, id, type, opt_eventTarget); | |
6946 | this.availableHeight = this.availableWidth = 0; | |
6947 | this.nearbyKeys = []; | |
6948 | }; | |
6949 | goog.inherits(i18n.input.chrome.inputview.SoftKey, i18n.input.chrome.inputview.Element); | |
6950 | i18n.input.chrome.inputview.SoftKey.prototype.createDom = function $i18n$input$chrome$inputview$SoftKey$$createDom$() { | |
6951 | i18n.input.chrome.inputview.SoftKey.superClass_.createDom.call(this); | |
6952 | goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.SOFT_KEY); | |
6953 | }; | |
6954 | i18n.input.chrome.inputview.SoftKey.prototype.resize = function $i18n$input$chrome$inputview$SoftKey$$resize$(width, height) { | |
6955 | i18n.input.chrome.inputview.SoftKey.superClass_.resize.call(this, width, height); | |
6956 | var elem = this.getElement(), borderWidth = i18n.input.chrome.inputview.util.getPropertyValue(elem, "borderWidth"), marginTop = i18n.input.chrome.inputview.util.getPropertyValue(elem, "marginTop"), marginBottom = i18n.input.chrome.inputview.util.getPropertyValue(elem, "marginBottom"), marginLeft = i18n.input.chrome.inputview.util.getPropertyValue(elem, "marginLeft"), marginRight = i18n.input.chrome.inputview.util.getPropertyValue(elem, "marginRight"), w = width - 2 * borderWidth - marginLeft - | |
6957 | marginRight, h = height - 2 * borderWidth - marginTop - marginBottom; | |
6958 | elem.style.width = w + "px"; | |
6959 | elem.style.height = h + "px"; | |
6960 | this.availableWidth = w; | |
6961 | this.availableHeight = h; | |
6962 | this.topLeftCoordinate = goog.style.getClientPosition(elem); | |
6963 | this.centerCoordinate = new goog.math.Coordinate(this.topLeftCoordinate.x + width / 2, this.topLeftCoordinate.y + height / 2); | |
6964 | }; | |
6965 | i18n.input.chrome.inputview.CharacterKey = function $i18n$input$chrome$inputview$CharacterKey$(id, characters, isLetterKey, hasAltGrCharacterInTheKeyset, alwaysRenderAltGrCharacter, stateManager, opt_eventTarget) { | |
6966 | i18n.input.chrome.inputview.SoftKey.call(this, id, i18n.input.chrome.inputview.ElementType.CHARACTER_KEY, opt_eventTarget); | |
6967 | this.characters = characters; | |
6968 | this.isLetterKey = isLetterKey; | |
6969 | this.hasAltGrCharacterInTheKeyset_ = hasAltGrCharacterInTheKeyset; | |
6970 | this.stateManager_ = stateManager; | |
6971 | this.alwaysRenderAltGrCharacter_ = alwaysRenderAltGrCharacter; | |
6972 | this.pointerConfig.longPressWithPointerUp = !0; | |
6973 | }; | |
6974 | goog.inherits(i18n.input.chrome.inputview.CharacterKey, i18n.input.chrome.inputview.SoftKey); | |
6975 | i18n.input.chrome.inputview.CharacterKey.prototype.flickerredCharacter = ""; | |
6976 | i18n.input.chrome.inputview.CharacterKey.STATE_LIST_ = [i18n.input.chrome.inputview.StateType.DEFAULT, i18n.input.chrome.inputview.StateType.SHIFT, i18n.input.chrome.inputview.StateType.ALTGR, i18n.input.chrome.inputview.StateType.ALTGR | i18n.input.chrome.inputview.StateType.SHIFT]; | |
6977 | i18n.input.chrome.inputview.CharacterKey.prototype.createDom = function $i18n$input$chrome$inputview$CharacterKey$$createDom$() { | |
6978 | i18n.input.chrome.inputview.CharacterKey.superClass_.createDom.call(this); | |
6979 | this.getDomHelper(); | |
6980 | for (var i = 0;i < this.characters.length;i++) { | |
6981 | var model = new i18n.input.chrome.inputview.CharacterModel(this.characters[i], this.isLetterKey, this.hasAltGrCharacterInTheKeyset_, this.alwaysRenderAltGrCharacter_, i18n.input.chrome.inputview.CharacterKey.STATE_LIST_[i], this.stateManager_), character = new i18n.input.chrome.inputview.Character(this.id + "-" + i, model); | |
6982 | this.addChild(character, !0); | |
6983 | } | |
6984 | }; | |
6985 | i18n.input.chrome.inputview.CharacterKey.prototype.resize = function $i18n$input$chrome$inputview$CharacterKey$$resize$(width, height) { | |
6986 | i18n.input.chrome.inputview.CharacterKey.superClass_.resize.call(this, width, height); | |
6987 | for (var i = 0;i < this.getChildCount();i++) { | |
6988 | var child = this.getChildAt(i); | |
6989 | child.resize(this.availableWidth, this.availableHeight); | |
6990 | } | |
6991 | }; | |
6992 | i18n.input.chrome.inputview.CharacterKey.prototype.getAltCharacters = function $i18n$input$chrome$inputview$CharacterKey$$getAltCharacters$() { | |
6993 | for (var altCharacters = [], i = 0;i < this.characters.length;i++) { | |
6994 | var ch = this.characters[i]; | |
6995 | ch && (goog.array.insert(altCharacters, ch), goog.array.insert(altCharacters, ch.toUpperCase()), goog.array.insert(altCharacters, ch.toLowerCase())); | |
6996 | } | |
6997 | return altCharacters; | |
6998 | }; | |
6999 | i18n.input.chrome.inputview.CharacterKey.prototype.getActiveCharacter = function $i18n$input$chrome$inputview$CharacterKey$$getActiveCharacter$() { | |
7000 | if (this.flickerredCharacter) { | |
7001 | return this.flickerredCharacter; | |
7002 | } | |
7003 | for (var i = 0;i < this.getChildCount();i++) { | |
7004 | var child = this.getChildAt(i); | |
7005 | if (child.isHighlighted()) { | |
7006 | return child.getContent(); | |
7007 | } | |
7008 | } | |
7009 | return ""; | |
7010 | }; | |
7011 | i18n.input.chrome.inputview.CharacterKey.prototype.getCharacterByGesture = function $i18n$input$chrome$inputview$CharacterKey$$getCharacterByGesture$(upOrDown) { | |
7012 | var hasAltGrState = this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.ALTGR), hasShiftState = this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT); | |
7013 | if (upOrDown == hasShiftState) { | |
7014 | return ""; | |
7015 | } | |
7016 | var index = 0; | |
7017 | upOrDown && hasAltGrState ? index = 3 : upOrDown && !hasAltGrState ? index = 1 : !upOrDown && hasAltGrState && (index = 2); | |
7018 | var character = index >= this.getChildCount() ? null : this.getChildAt(index); | |
7019 | return character && character.isVisible() ? character.getContent() : ""; | |
7020 | }; | |
7021 | i18n.input.chrome.inputview.CharacterKey.prototype.update = function $i18n$input$chrome$inputview$CharacterKey$$update$() { | |
7022 | i18n.input.chrome.inputview.CharacterKey.superClass_.update.call(this); | |
7023 | this.pointerConfig.flickerDirection = this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT) ? i18n.input.chrome.inputview.SwipeDirection.DOWN : i18n.input.chrome.inputview.SwipeDirection.UP; | |
7024 | }; | |
7025 | i18n.input.common = {}; | |
7026 | i18n.input.common.CommandType = {CHANGE_STATE:"changeState", CHANGE_FOCUS:"cfx", CHANGE_DIRECTION:"cd", TOGGLE_ITA:"tita", HIDE_EDITOR:"he", TOGGLE_SBC:"tsbc", TOGGLE_LANGUAGE:"tlang", PUNCTUATION:"pun", LOAD_CONFIG:"lc", SHOW_KEYBOARD:"sk", MINIMIZE_KEYBOARD:"mk", LOAD_LAYOUT:"ll", REPOSITION_ELEMENT:"re", COMMIT:"cm", SHOW_STATUSBAR:"ss"}; | |
7027 | i18n.input.common.Metrics = {}; | |
7028 | i18n.input.common.Metrics.Param = {ACTION:"act", SHOW_TIME:"st", BAR_LANG_KEY_COUNT:"ltkc", BAR_LANG_CLICK_COUNT:"ltcc", BAR_BC_KEY_COUNT:"bckc", BAR_BC_CLICK_COUNT:"bccc", BAR_PUNC_KEY_COUNT:"ptkc", BAR_PUNC_CLICK_COUNT:"ptcc", BAR_DRAG_COUNT:"bdc", PPE_CANDIDATE_INDEX:"ci", PPE_SOURCE_LENGTH:"slen", PPE_TARGET_LENGTH:"tlen", PPE_SELECT_DURATION:"dur", PPE_BACKSPACE_COUNT:"bsc", PPE_COMMIT_KEY:"key", SGM_CANDIDATE_INDEX:"ci", SGM_CANDIDATE_CLICK_COUNT:"ccc", VK_LAYOUT:"lay", VK_KEY_CLICK_COUNT:"kcc", | |
7029 | VK_KEY_KEY_COUNT:"kkc", VK_WORD_COUNT:"wc", VK_DRAG_COUNT:"kdc", VK_MINIMIZED_TIME:"mt", QUERY_LATENCY:"ql", PREDICTION:"pre", OFFLINE_DECODER:"od"}; | |
7030 | i18n.input.common.Metrics.Type = {POPUP_EDITOR:"ppe", STATUS_BAR:"bar", SUGGEST_MENU:"sgm", VIRTUAL_KEYBOARD:"vk", HANDWRITING:"hwt"}; | |
7031 | i18n.input.common.Metrics.Action = {PAGE_UNLOAD:"ul", CLOSE:"cl", SWITCH:"sw", PPE_COMMIT_SOURCE:"cmts", PPE_COMMIT_TARGET:"cmtt", PPE_COMMIT_DELAY:"cmtd"}; | |
7032 | i18n.input.common.Metrics.STATUSBAR_MAP = goog.object.create(i18n.input.common.CommandType.TOGGLE_LANGUAGE, [i18n.input.common.Metrics.Param.BAR_LANG_KEY_COUNT, i18n.input.common.Metrics.Param.BAR_LANG_CLICK_COUNT], i18n.input.common.CommandType.TOGGLE_SBC, [i18n.input.common.Metrics.Param.BAR_BC_KEY_COUNT, i18n.input.common.Metrics.Param.BAR_BC_CLICK_COUNT], i18n.input.common.CommandType.PUNCTUATION, [i18n.input.common.Metrics.Param.BAR_PUNC_KEY_COUNT, i18n.input.common.Metrics.Param.BAR_PUNC_CLICK_COUNT]); | |
7033 | i18n.input.common.AbstractStatSession = function $i18n$input$common$AbstractStatSession$() { | |
7034 | }; | |
7035 | goog.inherits(i18n.input.common.AbstractStatSession, goog.Disposable); | |
7036 | i18n.input.common.AbstractStatSession.nullFunction_ = function $i18n$input$common$AbstractStatSession$nullFunction_$() { | |
7037 | }; | |
7038 | i18n.input.common.AbstractStatSession.prototype.get = goog.nullFunction; | |
7039 | i18n.input.common.AbstractStatSession.prototype.set = goog.functions.NULL; | |
7040 | i18n.input.common.AbstractStatSession.prototype.push = goog.functions.NULL; | |
7041 | i18n.input.common.AbstractStatSession.prototype.pop = goog.functions.withReturnValue(goog.nullFunction, ""); | |
7042 | i18n.input.common.Statistics = function $i18n$input$common$Statistics$() { | |
7043 | this.sessions_ = {}; | |
7044 | this.eventHandler_ = new goog.events.EventHandler(this); | |
7045 | this.eventHandler_.listen(window, [goog.events.EventType.BEFOREUNLOAD, goog.events.EventType.UNLOAD], this.handleUnload_); | |
7046 | }; | |
7047 | goog.inherits(i18n.input.common.Statistics, goog.Disposable); | |
7048 | goog.addSingletonGetter(i18n.input.common.Statistics); | |
7049 | i18n.input.common.Statistics.prototype.getSession = function $i18n$input$common$Statistics$$getSession$(type) { | |
7050 | return this.sessions_[type] || new i18n.input.common.AbstractStatSession(type); | |
7051 | }; | |
7052 | i18n.input.common.Statistics.prototype.handleUnload_ = function $i18n$input$common$Statistics$$handleUnload_$() { | |
7053 | this.dispose(); | |
7054 | }; | |
7055 | i18n.input.common.Statistics.prototype.disposeInternal = function $i18n$input$common$Statistics$$disposeInternal$() { | |
7056 | goog.dispose(this.eventHandler_); | |
7057 | for (var type in this.sessions_) { | |
7058 | goog.dispose(this.sessions_[type]), delete this.sessions_[type]; | |
7059 | } | |
7060 | i18n.input.common.Statistics.superClass_.disposeInternal.call(this); | |
7061 | }; | |
7062 | goog.async.throwException = function $goog$async$throwException$(exception) { | |
7063 | goog.global.setTimeout(function() { | |
7064 | throw exception; | |
7065 | }, 0); | |
7066 | }; | |
7067 | goog.async.nextTick = function $goog$async$nextTick$(callback, opt_context) { | |
7068 | var cb = callback; | |
7069 | opt_context && (cb = goog.bind(callback, opt_context)); | |
7070 | cb = goog.async.nextTick.wrapCallback_(cb); | |
7071 | goog.isFunction(goog.global.setImmediate) ? goog.global.setImmediate(cb) : (goog.async.nextTick.setImmediate_ || (goog.async.nextTick.setImmediate_ = goog.async.nextTick.getSetImmediateEmulator_()), goog.async.nextTick.setImmediate_(cb)); | |
7072 | }; | |
7073 | goog.async.nextTick.getSetImmediateEmulator_ = function $goog$async$nextTick$getSetImmediateEmulator_$() { | |
7074 | if (goog.global.Promise && goog.global.Promise.resolve) { | |
7075 | var promise = goog.global.Promise.resolve(); | |
7076 | return function(cb) { | |
7077 | promise.then(function() { | |
7078 | try { | |
7079 | cb(); | |
7080 | } catch (e) { | |
7081 | goog.async.throwException(e); | |
7082 | } | |
7083 | }); | |
7084 | }; | |
7085 | } | |
7086 | var Channel = goog.global.MessageChannel; | |
7087 | "undefined" === typeof Channel && "undefined" !== typeof window && window.postMessage && window.addEventListener && (Channel = function $Channel$() { | |
7088 | var iframe = document.createElement("iframe"); | |
7089 | iframe.style.display = "none"; | |
7090 | iframe.src = ""; | |
7091 | document.documentElement.appendChild(iframe); | |
7092 | var win = iframe.contentWindow, doc = win.document; | |
7093 | doc.open(); | |
7094 | doc.write(""); | |
7095 | doc.close(); | |
7096 | var message = "callImmediate" + Math.random(), origin = win.location.protocol + "//" + win.location.host, onmessage = goog.bind(function(e) { | |
7097 | if (e.origin == origin || e.data == message) { | |
7098 | this.port1.onmessage(); | |
7099 | } | |
7100 | }, this); | |
7101 | win.addEventListener("message", onmessage, !1); | |
7102 | this.port1 = {}; | |
7103 | this.port2 = {postMessage:function $this$port2$postMessage$() { | |
7104 | win.postMessage(message, origin); | |
7105 | }}; | |
7106 | }); | |
7107 | if ("undefined" !== typeof Channel) { | |
7108 | var channel = new Channel, head = {}, tail = head; | |
7109 | channel.port1.onmessage = function $channel$port1$onmessage$() { | |
7110 | head = head.next; | |
7111 | var cb = head.cb; | |
7112 | head.cb = null; | |
7113 | cb(); | |
7114 | }; | |
7115 | return function(cb) { | |
7116 | tail.next = {cb:cb}; | |
7117 | tail = tail.next; | |
7118 | channel.port2.postMessage(0); | |
7119 | }; | |
7120 | } | |
7121 | return "undefined" !== typeof document && "onreadystatechange" in document.createElement("script") ? function(cb) { | |
7122 | var script = document.createElement("script"); | |
7123 | script.onreadystatechange = function $script$onreadystatechange$() { | |
7124 | script.onreadystatechange = null; | |
7125 | script.parentNode.removeChild(script); | |
7126 | script = null; | |
7127 | cb(); | |
7128 | cb = null; | |
7129 | }; | |
7130 | document.documentElement.appendChild(script); | |
7131 | } : function(cb) { | |
7132 | goog.global.setTimeout(cb, 0); | |
7133 | }; | |
7134 | }; | |
7135 | goog.async.nextTick.wrapCallback_ = goog.functions.identity; | |
7136 | goog.debug.entryPointRegistry.register(function(transformer) { | |
7137 | goog.async.nextTick.wrapCallback_ = transformer; | |
7138 | }); | |
7139 | goog.testing = {}; | |
7140 | goog.testing.watchers = {}; | |
7141 | goog.testing.watchers.resetWatchers_ = []; | |
7142 | goog.testing.watchers.signalClockReset = function $goog$testing$watchers$signalClockReset$() { | |
7143 | for (var watchers = goog.testing.watchers.resetWatchers_, i = 0;i < watchers.length;i++) { | |
7144 | goog.testing.watchers.resetWatchers_[i](); | |
7145 | } | |
7146 | }; | |
7147 | goog.testing.watchers.watchClockReset = function $goog$testing$watchers$watchClockReset$(fn) { | |
7148 | goog.testing.watchers.resetWatchers_.push(fn); | |
7149 | }; | |
7150 | goog.async.run = function $goog$async$run$(callback, opt_context) { | |
7151 | goog.async.run.workQueueScheduled_ || (goog.async.nextTick(goog.async.run.processWorkQueue), goog.async.run.workQueueScheduled_ = !0); | |
7152 | goog.async.run.workQueue_.push(new goog.async.run.WorkItem_(callback, opt_context)); | |
7153 | }; | |
7154 | goog.async.run.workQueueScheduled_ = !1; | |
7155 | goog.async.run.workQueue_ = []; | |
7156 | goog.DEBUG && (goog.async.run.resetQueue_ = function $goog$async$run$resetQueue_$() { | |
7157 | goog.async.run.workQueueScheduled_ = !1; | |
7158 | goog.async.run.workQueue_ = []; | |
7159 | }, goog.testing.watchers.watchClockReset(goog.async.run.resetQueue_)); | |
7160 | goog.async.run.processWorkQueue = function $goog$async$run$processWorkQueue$() { | |
7161 | for (;goog.async.run.workQueue_.length;) { | |
7162 | var workItems = goog.async.run.workQueue_; | |
7163 | goog.async.run.workQueue_ = []; | |
7164 | for (var i = 0;i < workItems.length;i++) { | |
7165 | var workItem = workItems[i]; | |
7166 | try { | |
7167 | workItem.fn.call(workItem.scope); | |
7168 | } catch (e) { | |
7169 | goog.async.throwException(e); | |
7170 | } | |
7171 | } | |
7172 | } | |
7173 | goog.async.run.workQueueScheduled_ = !1; | |
7174 | }; | |
7175 | goog.async.run.WorkItem_ = function $goog$async$run$WorkItem_$(fn, scope) { | |
7176 | this.fn = fn; | |
7177 | this.scope = scope; | |
7178 | }; | |
7179 | goog.promise = {}; | |
7180 | goog.promise.Resolver = function $goog$promise$Resolver$() { | |
7181 | }; | |
7182 | goog.Thenable = function $goog$Thenable$() { | |
7183 | }; | |
7184 | goog.Thenable.prototype.then = function $goog$Thenable$$then$() { | |
7185 | }; | |
7186 | goog.Thenable.IMPLEMENTED_BY_PROP = "$goog_Thenable"; | |
7187 | goog.Thenable.addImplementation = function $goog$Thenable$addImplementation$(ctor) { | |
7188 | goog.exportProperty(ctor.prototype, "then", ctor.prototype.then); | |
7189 | ctor.prototype[goog.Thenable.IMPLEMENTED_BY_PROP] = !0; | |
7190 | }; | |
7191 | goog.Thenable.isImplementedBy = function $goog$Thenable$isImplementedBy$(object) { | |
7192 | if (!object) { | |
7193 | return!1; | |
7194 | } | |
7195 | try { | |
7196 | return!!object[goog.Thenable.IMPLEMENTED_BY_PROP]; | |
7197 | } catch (e) { | |
7198 | return!1; | |
7199 | } | |
7200 | }; | |
7201 | goog.Promise = function $goog$Promise$(resolver, opt_context) { | |
7202 | this.state_ = goog.Promise.State_.PENDING; | |
7203 | this.result_ = void 0; | |
7204 | this.callbackEntries_ = this.parent_ = null; | |
7205 | this.executing_ = !1; | |
7206 | 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? this.unhandledRejectionId_ = 0 : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (this.hadUnhandledRejection_ = !1); | |
7207 | goog.Promise.LONG_STACK_TRACES && (this.stack_ = [], this.addStackTrace_(Error("created")), this.currentStep_ = 0); | |
7208 | try { | |
7209 | var self = this; | |
7210 | resolver.call(opt_context, function(value) { | |
7211 | self.resolve_(goog.Promise.State_.FULFILLED, value); | |
7212 | }, function(reason) { | |
7213 | self.resolve_(goog.Promise.State_.REJECTED, reason); | |
7214 | }); | |
7215 | } catch (e) { | |
7216 | this.resolve_(goog.Promise.State_.REJECTED, e); | |
7217 | } | |
7218 | }; | |
7219 | goog.Promise.LONG_STACK_TRACES = goog.DEBUG; | |
7220 | goog.Promise.UNHANDLED_REJECTION_DELAY = 0; | |
7221 | goog.Promise.State_ = {PENDING:0, BLOCKED:1, FULFILLED:2, REJECTED:3}; | |
7222 | goog.Promise.resolve = function $goog$Promise$resolve$(opt_value) { | |
7223 | return new goog.Promise(function(resolve) { | |
7224 | resolve(opt_value); | |
7225 | }); | |
7226 | }; | |
7227 | goog.Promise.reject = function $goog$Promise$reject$(opt_reason) { | |
7228 | return new goog.Promise(function(resolve, reject) { | |
7229 | reject(opt_reason); | |
7230 | }); | |
7231 | }; | |
7232 | goog.Promise.race = function $goog$Promise$race$(promises) { | |
7233 | return new goog.Promise(function(resolve, reject) { | |
7234 | promises.length || resolve(void 0); | |
7235 | for (var i = 0, promise;promise = promises[i];i++) { | |
7236 | promise.then(resolve, reject); | |
7237 | } | |
7238 | }); | |
7239 | }; | |
7240 | goog.Promise.all = function $goog$Promise$all$(promises) { | |
7241 | return new goog.Promise(function(resolve, reject) { | |
7242 | var toFulfill = promises.length, values = []; | |
7243 | if (toFulfill) { | |
7244 | for (var onFulfill = function $onFulfill$(index, value) { | |
7245 | toFulfill--; | |
7246 | values[index] = value; | |
7247 | 0 == toFulfill && resolve(values); | |
7248 | }, onReject = function $onReject$(reason) { | |
7249 | reject(reason); | |
7250 | }, i = 0, promise;promise = promises[i];i++) { | |
7251 | promise.then(goog.partial(onFulfill, i), onReject); | |
7252 | } | |
7253 | } else { | |
7254 | resolve(values); | |
7255 | } | |
7256 | }); | |
7257 | }; | |
7258 | goog.Promise.firstFulfilled = function $goog$Promise$firstFulfilled$(promises) { | |
7259 | return new goog.Promise(function(resolve, reject) { | |
7260 | var toReject = promises.length, reasons = []; | |
7261 | if (toReject) { | |
7262 | for (var onFulfill = function $onFulfill$(value) { | |
7263 | resolve(value); | |
7264 | }, onReject = function $onReject$(index, reason) { | |
7265 | toReject--; | |
7266 | reasons[index] = reason; | |
7267 | 0 == toReject && reject(reasons); | |
7268 | }, i = 0, promise;promise = promises[i];i++) { | |
7269 | promise.then(onFulfill, goog.partial(onReject, i)); | |
7270 | } | |
7271 | } else { | |
7272 | resolve(void 0); | |
7273 | } | |
7274 | }); | |
7275 | }; | |
7276 | goog.Promise.withResolver = function $goog$Promise$withResolver$() { | |
7277 | var resolve, reject, promise = new goog.Promise(function(rs, rj) { | |
7278 | resolve = rs; | |
7279 | reject = rj; | |
7280 | }); | |
7281 | return new goog.Promise.Resolver_(promise, resolve, reject); | |
7282 | }; | |
7283 | goog.Promise.prototype.then = function $goog$Promise$$then$(opt_onFulfilled, opt_onRejected, opt_context) { | |
7284 | null != opt_onFulfilled && goog.asserts.assertFunction(opt_onFulfilled, "opt_onFulfilled should be a function."); | |
7285 | null != opt_onRejected && goog.asserts.assertFunction(opt_onRejected, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"); | |
7286 | goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("then")); | |
7287 | return this.addChildPromise_(goog.isFunction(opt_onFulfilled) ? opt_onFulfilled : null, goog.isFunction(opt_onRejected) ? opt_onRejected : null, opt_context); | |
7288 | }; | |
7289 | goog.Thenable.addImplementation(goog.Promise); | |
7290 | goog.Promise.prototype.cancel = function $goog$Promise$$cancel$(opt_message) { | |
7291 | this.state_ == goog.Promise.State_.PENDING && goog.async.run(function() { | |
7292 | var err = new goog.Promise.CancellationError(opt_message); | |
7293 | this.cancelInternal_(err); | |
7294 | }, this); | |
7295 | }; | |
7296 | goog.Promise.prototype.cancelInternal_ = function $goog$Promise$$cancelInternal_$(err) { | |
7297 | this.state_ == goog.Promise.State_.PENDING && (this.parent_ ? this.parent_.cancelChild_(this, err) : this.resolve_(goog.Promise.State_.REJECTED, err)); | |
7298 | }; | |
7299 | goog.Promise.prototype.cancelChild_ = function $goog$Promise$$cancelChild_$(childPromise, err) { | |
7300 | if (this.callbackEntries_) { | |
7301 | for (var childCount = 0, childIndex = -1, i = 0, entry;entry = this.callbackEntries_[i];i++) { | |
7302 | var child = entry.child; | |
7303 | if (child && (childCount++, child == childPromise && (childIndex = i), 0 <= childIndex && 1 < childCount)) { | |
7304 | break; | |
7305 | } | |
7306 | } | |
7307 | if (0 <= childIndex) { | |
7308 | if (this.state_ == goog.Promise.State_.PENDING && 1 == childCount) { | |
7309 | this.cancelInternal_(err); | |
7310 | } else { | |
7311 | var callbackEntry = this.callbackEntries_.splice(childIndex, 1)[0]; | |
7312 | this.executeCallback_(callbackEntry, goog.Promise.State_.REJECTED, err); | |
7313 | } | |
7314 | } | |
7315 | } | |
7316 | }; | |
7317 | goog.Promise.prototype.addCallbackEntry_ = function $goog$Promise$$addCallbackEntry_$(callbackEntry) { | |
7318 | this.callbackEntries_ && this.callbackEntries_.length || this.state_ != goog.Promise.State_.FULFILLED && this.state_ != goog.Promise.State_.REJECTED || this.scheduleCallbacks_(); | |
7319 | this.callbackEntries_ || (this.callbackEntries_ = []); | |
7320 | this.callbackEntries_.push(callbackEntry); | |
7321 | }; | |
7322 | goog.Promise.prototype.addChildPromise_ = function $goog$Promise$$addChildPromise_$(onFulfilled, onRejected, opt_context) { | |
7323 | var callbackEntry = {child:null, onFulfilled:null, onRejected:null}; | |
7324 | callbackEntry.child = new goog.Promise(function(resolve, reject) { | |
7325 | callbackEntry.onFulfilled = onFulfilled ? function(value) { | |
7326 | try { | |
7327 | var result = onFulfilled.call(opt_context, value); | |
7328 | resolve(result); | |
7329 | } catch (err) { | |
7330 | reject(err); | |
7331 | } | |
7332 | } : resolve; | |
7333 | callbackEntry.onRejected = onRejected ? function(reason) { | |
7334 | try { | |
7335 | var result = onRejected.call(opt_context, reason); | |
7336 | !goog.isDef(result) && reason instanceof goog.Promise.CancellationError ? reject(reason) : resolve(result); | |
7337 | } catch (err) { | |
7338 | reject(err); | |
7339 | } | |
7340 | } : reject; | |
7341 | }); | |
7342 | callbackEntry.child.parent_ = this; | |
7343 | this.addCallbackEntry_(callbackEntry); | |
7344 | return callbackEntry.child; | |
7345 | }; | |
7346 | goog.Promise.prototype.unblockAndFulfill_ = function $goog$Promise$$unblockAndFulfill_$(value) { | |
7347 | goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED); | |
7348 | this.state_ = goog.Promise.State_.PENDING; | |
7349 | this.resolve_(goog.Promise.State_.FULFILLED, value); | |
7350 | }; | |
7351 | goog.Promise.prototype.unblockAndReject_ = function $goog$Promise$$unblockAndReject_$(reason) { | |
7352 | goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED); | |
7353 | this.state_ = goog.Promise.State_.PENDING; | |
7354 | this.resolve_(goog.Promise.State_.REJECTED, reason); | |
7355 | }; | |
7356 | goog.Promise.prototype.resolve_ = function $goog$Promise$$resolve_$(state, x) { | |
7357 | if (this.state_ == goog.Promise.State_.PENDING) { | |
7358 | if (this == x) { | |
7359 | state = goog.Promise.State_.REJECTED, x = new TypeError("Promise cannot resolve to itself"); | |
7360 | } else { | |
7361 | if (goog.Thenable.isImplementedBy(x)) { | |
7362 | this.state_ = goog.Promise.State_.BLOCKED; | |
7363 | x.then(this.unblockAndFulfill_, this.unblockAndReject_, this); | |
7364 | return; | |
7365 | } | |
7366 | if (goog.isObject(x)) { | |
7367 | try { | |
7368 | var then = x.then; | |
7369 | if (goog.isFunction(then)) { | |
7370 | this.tryThen_(x, then); | |
7371 | return; | |
7372 | } | |
7373 | } catch (e) { | |
7374 | state = goog.Promise.State_.REJECTED, x = e; | |
7375 | } | |
7376 | } | |
7377 | } | |
7378 | this.result_ = x; | |
7379 | this.state_ = state; | |
7380 | this.scheduleCallbacks_(); | |
7381 | state != goog.Promise.State_.REJECTED || x instanceof goog.Promise.CancellationError || goog.Promise.addUnhandledRejection_(this, x); | |
7382 | } | |
7383 | }; | |
7384 | goog.Promise.prototype.tryThen_ = function $goog$Promise$$tryThen_$(thenable, then) { | |
7385 | this.state_ = goog.Promise.State_.BLOCKED; | |
7386 | var promise = this, called = !1, resolve = function $resolve$(value) { | |
7387 | called || (called = !0, promise.unblockAndFulfill_(value)); | |
7388 | }, reject = function $reject$(reason) { | |
7389 | called || (called = !0, promise.unblockAndReject_(reason)); | |
7390 | }; | |
7391 | try { | |
7392 | then.call(thenable, resolve, reject); | |
7393 | } catch (e) { | |
7394 | reject(e); | |
7395 | } | |
7396 | }; | |
7397 | goog.Promise.prototype.scheduleCallbacks_ = function $goog$Promise$$scheduleCallbacks_$() { | |
7398 | this.executing_ || (this.executing_ = !0, goog.async.run(this.executeCallbacks_, this)); | |
7399 | }; | |
7400 | goog.Promise.prototype.executeCallbacks_ = function $goog$Promise$$executeCallbacks_$() { | |
7401 | for (;this.callbackEntries_ && this.callbackEntries_.length;) { | |
7402 | var entries = this.callbackEntries_; | |
7403 | this.callbackEntries_ = []; | |
7404 | for (var i = 0;i < entries.length;i++) { | |
7405 | goog.Promise.LONG_STACK_TRACES && this.currentStep_++, this.executeCallback_(entries[i], this.state_, this.result_); | |
7406 | } | |
7407 | } | |
7408 | this.executing_ = !1; | |
7409 | }; | |
7410 | goog.Promise.prototype.executeCallback_ = function $goog$Promise$$executeCallback_$(callbackEntry, state, result) { | |
7411 | if (state == goog.Promise.State_.FULFILLED) { | |
7412 | callbackEntry.onFulfilled(result); | |
7413 | } else { | |
7414 | this.removeUnhandledRejection_(), callbackEntry.onRejected(result); | |
7415 | } | |
7416 | }; | |
7417 | goog.Promise.prototype.addStackTrace_ = function $goog$Promise$$addStackTrace_$(err) { | |
7418 | if (goog.Promise.LONG_STACK_TRACES && goog.isString(err.stack)) { | |
7419 | var trace = err.stack.split("\n", 4)[3], message = err.message, message = message + Array(11 - message.length).join(" "); | |
7420 | this.stack_.push(message + trace); | |
7421 | } | |
7422 | }; | |
7423 | goog.Promise.prototype.appendLongStack_ = function $goog$Promise$$appendLongStack_$(err) { | |
7424 | if (goog.Promise.LONG_STACK_TRACES && err && goog.isString(err.stack) && this.stack_.length) { | |
7425 | for (var longTrace = ["Promise trace:"], promise = this;promise;promise = promise.parent_) { | |
7426 | for (var i = this.currentStep_;0 <= i;i--) { | |
7427 | longTrace.push(promise.stack_[i]); | |
7428 | } | |
7429 | longTrace.push("Value: [" + (promise.state_ == goog.Promise.State_.REJECTED ? "REJECTED" : "FULFILLED") + "] <" + String(promise.result_) + ">"); | |
7430 | } | |
7431 | err.stack += "\n\n" + longTrace.join("\n"); | |
7432 | } | |
7433 | }; | |
7434 | goog.Promise.prototype.removeUnhandledRejection_ = function $goog$Promise$$removeUnhandledRejection_$() { | |
7435 | if (0 < goog.Promise.UNHANDLED_REJECTION_DELAY) { | |
7436 | for (var p = this;p && p.unhandledRejectionId_;p = p.parent_) { | |
7437 | goog.global.clearTimeout(p.unhandledRejectionId_), p.unhandledRejectionId_ = 0; | |
7438 | } | |
7439 | } else { | |
7440 | if (0 == goog.Promise.UNHANDLED_REJECTION_DELAY) { | |
7441 | for (p = this;p && p.hadUnhandledRejection_;p = p.parent_) { | |
7442 | p.hadUnhandledRejection_ = !1; | |
7443 | } | |
7444 | } | |
7445 | } | |
7446 | }; | |
7447 | goog.Promise.addUnhandledRejection_ = function $goog$Promise$addUnhandledRejection_$(promise, reason) { | |
7448 | 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? promise.unhandledRejectionId_ = goog.global.setTimeout(function() { | |
7449 | promise.appendLongStack_(reason); | |
7450 | goog.Promise.handleRejection_.call(null, reason); | |
7451 | }, goog.Promise.UNHANDLED_REJECTION_DELAY) : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (promise.hadUnhandledRejection_ = !0, goog.async.run(function() { | |
7452 | promise.hadUnhandledRejection_ && (promise.appendLongStack_(reason), goog.Promise.handleRejection_.call(null, reason)); | |
7453 | })); | |
7454 | }; | |
7455 | goog.Promise.handleRejection_ = goog.async.throwException; | |
7456 | goog.Promise.setUnhandledRejectionHandler = function $goog$Promise$setUnhandledRejectionHandler$(handler) { | |
7457 | goog.Promise.handleRejection_ = handler; | |
7458 | }; | |
7459 | goog.Promise.CancellationError = function $goog$Promise$CancellationError$(opt_message) { | |
7460 | goog.debug.Error.call(this, opt_message); | |
7461 | }; | |
7462 | goog.inherits(goog.Promise.CancellationError, goog.debug.Error); | |
7463 | goog.Promise.CancellationError.prototype.name = "cancel"; | |
7464 | goog.Promise.Resolver_ = function $goog$Promise$Resolver_$(promise, resolve, reject) { | |
7465 | this.promise = promise; | |
7466 | this.resolve = resolve; | |
7467 | this.reject = reject; | |
7468 | }; | |
7469 | /* | |
7470 | Portions of this code are from MochiKit, received by | |
7471 | The Closure Authors under the MIT license. All other code is Copyright | |
7472 | 2005-2009 The Closure Authors. All Rights Reserved. | |
7473 | */ | |
7474 | goog.async.Deferred = function $goog$async$Deferred$(opt_onCancelFunction, opt_defaultScope) { | |
7475 | this.sequence_ = []; | |
7476 | this.onCancelFunction_ = opt_onCancelFunction; | |
7477 | this.defaultScope_ = opt_defaultScope || null; | |
7478 | this.hadError_ = this.fired_ = !1; | |
7479 | this.result_ = void 0; | |
7480 | this.silentlyCanceled_ = this.blocking_ = this.blocked_ = !1; | |
7481 | this.unhandledErrorId_ = 0; | |
7482 | this.parent_ = null; | |
7483 | this.branches_ = 0; | |
7484 | if (goog.async.Deferred.LONG_STACK_TRACES && (this.constructorStack_ = null, Error.captureStackTrace)) { | |
7485 | var target = {stack:""}; | |
7486 | Error.captureStackTrace(target, goog.async.Deferred); | |
7487 | "string" == typeof target.stack && (this.constructorStack_ = target.stack.replace(/^[^\n]*\n/, "")); | |
7488 | } | |
7489 | }; | |
7490 | goog.async.Deferred.STRICT_ERRORS = !1; | |
7491 | goog.async.Deferred.LONG_STACK_TRACES = goog.DEBUG; | |
7492 | goog.async.Deferred.prototype.cancel = function $goog$async$Deferred$$cancel$(opt_deepCancel) { | |
7493 | if (this.hasFired()) { | |
7494 | this.result_ instanceof goog.async.Deferred && this.result_.cancel(); | |
7495 | } else { | |
7496 | if (this.parent_) { | |
7497 | var parent = this.parent_; | |
7498 | delete this.parent_; | |
7499 | opt_deepCancel ? parent.cancel(opt_deepCancel) : parent.branchCancel_(); | |
7500 | } | |
7501 | this.onCancelFunction_ ? this.onCancelFunction_.call(this.defaultScope_, this) : this.silentlyCanceled_ = !0; | |
7502 | this.hasFired() || this.errback(new goog.async.Deferred.CanceledError(this)); | |
7503 | } | |
7504 | }; | |
7505 | goog.async.Deferred.prototype.branchCancel_ = function $goog$async$Deferred$$branchCancel_$() { | |
7506 | this.branches_--; | |
7507 | 0 >= this.branches_ && this.cancel(); | |
7508 | }; | |
7509 | goog.async.Deferred.prototype.continue_ = function $goog$async$Deferred$$continue_$(isSuccess, res) { | |
7510 | this.blocked_ = !1; | |
7511 | this.updateResult_(isSuccess, res); | |
7512 | }; | |
7513 | goog.async.Deferred.prototype.updateResult_ = function $goog$async$Deferred$$updateResult_$(isSuccess, res) { | |
7514 | this.fired_ = !0; | |
7515 | this.result_ = res; | |
7516 | this.hadError_ = !isSuccess; | |
7517 | this.fire_(); | |
7518 | }; | |
7519 | goog.async.Deferred.prototype.check_ = function $goog$async$Deferred$$check_$() { | |
7520 | if (this.hasFired()) { | |
7521 | if (!this.silentlyCanceled_) { | |
7522 | throw new goog.async.Deferred.AlreadyCalledError(this); | |
7523 | } | |
7524 | this.silentlyCanceled_ = !1; | |
7525 | } | |
7526 | }; | |
7527 | goog.async.Deferred.prototype.callback = function $goog$async$Deferred$$callback$(opt_result) { | |
7528 | this.check_(); | |
7529 | this.assertNotDeferred_(opt_result); | |
7530 | this.updateResult_(!0, opt_result); | |
7531 | }; | |
7532 | goog.async.Deferred.prototype.errback = function $goog$async$Deferred$$errback$(opt_result) { | |
7533 | this.check_(); | |
7534 | this.assertNotDeferred_(opt_result); | |
7535 | this.makeStackTraceLong_(opt_result); | |
7536 | this.updateResult_(!1, opt_result); | |
7537 | }; | |
7538 | goog.async.Deferred.prototype.makeStackTraceLong_ = function $goog$async$Deferred$$makeStackTraceLong_$(error) { | |
7539 | goog.async.Deferred.LONG_STACK_TRACES && this.constructorStack_ && goog.isObject(error) && error.stack && /^[^\n]+(\n [^\n]+)+/.test(error.stack) && (error.stack = error.stack + "\nDEFERRED OPERATION:\n" + this.constructorStack_); | |
7540 | }; | |
7541 | goog.async.Deferred.prototype.assertNotDeferred_ = function $goog$async$Deferred$$assertNotDeferred_$(obj) { | |
7542 | goog.asserts.assert(!(obj instanceof goog.async.Deferred), "An execution sequence may not be initiated with a blocking Deferred."); | |
7543 | }; | |
7544 | goog.async.Deferred.prototype.addCallback = function $goog$async$Deferred$$addCallback$(cb, opt_scope) { | |
7545 | return this.addCallbacks(cb, null, opt_scope); | |
7546 | }; | |
7547 | goog.async.Deferred.prototype.addErrback = function $goog$async$Deferred$$addErrback$(eb, opt_scope) { | |
7548 | return this.addCallbacks(null, eb, opt_scope); | |
7549 | }; | |
7550 | goog.async.Deferred.prototype.addBoth = function $goog$async$Deferred$$addBoth$(f, opt_scope) { | |
7551 | return this.addCallbacks(f, f, opt_scope); | |
7552 | }; | |
7553 | goog.async.Deferred.prototype.addCallbacks = function $goog$async$Deferred$$addCallbacks$(cb, eb, opt_scope) { | |
7554 | goog.asserts.assert(!this.blocking_, "Blocking Deferreds can not be re-used"); | |
7555 | this.sequence_.push([cb, eb, opt_scope]); | |
7556 | this.hasFired() && this.fire_(); | |
7557 | return this; | |
7558 | }; | |
7559 | goog.async.Deferred.prototype.then = function $goog$async$Deferred$$then$(opt_onFulfilled, opt_onRejected, opt_context) { | |
7560 | var resolve, reject, promise = new goog.Promise(function(res, rej) { | |
7561 | resolve = res; | |
7562 | reject = rej; | |
7563 | }); | |
7564 | this.addCallbacks(resolve, function(reason) { | |
7565 | reason instanceof goog.async.Deferred.CanceledError ? promise.cancel() : reject(reason); | |
7566 | }); | |
7567 | return promise.then(opt_onFulfilled, opt_onRejected, opt_context); | |
7568 | }; | |
7569 | goog.Thenable.addImplementation(goog.async.Deferred); | |
7570 | goog.async.Deferred.prototype.chainDeferred = function $goog$async$Deferred$$chainDeferred$(otherDeferred) { | |
7571 | this.addCallbacks(otherDeferred.callback, otherDeferred.errback, otherDeferred); | |
7572 | return this; | |
7573 | }; | |
7574 | goog.async.Deferred.prototype.branch = function $goog$async$Deferred$$branch$(opt_propagateCancel) { | |
7575 | var d = new goog.async.Deferred; | |
7576 | this.chainDeferred(d); | |
7577 | opt_propagateCancel && (d.parent_ = this, this.branches_++); | |
7578 | return d; | |
7579 | }; | |
7580 | goog.async.Deferred.prototype.hasFired = function $goog$async$Deferred$$hasFired$() { | |
7581 | return this.fired_; | |
7582 | }; | |
7583 | goog.async.Deferred.prototype.isError = function $goog$async$Deferred$$isError$(res) { | |
7584 | return res instanceof Error; | |
7585 | }; | |
7586 | goog.async.Deferred.prototype.hasErrback_ = function $goog$async$Deferred$$hasErrback_$() { | |
7587 | return goog.array.some(this.sequence_, function(sequenceRow) { | |
7588 | return goog.isFunction(sequenceRow[1]); | |
7589 | }); | |
7590 | }; | |
7591 | goog.async.Deferred.prototype.fire_ = function $goog$async$Deferred$$fire_$() { | |
7592 | this.unhandledErrorId_ && this.hasFired() && this.hasErrback_() && (goog.async.Deferred.unscheduleError_(this.unhandledErrorId_), this.unhandledErrorId_ = 0); | |
7593 | this.parent_ && (this.parent_.branches_--, delete this.parent_); | |
7594 | for (var res = this.result_, unhandledException = !1, isNewlyBlocked = !1;this.sequence_.length && !this.blocked_;) { | |
7595 | var sequenceEntry = this.sequence_.shift(), callback = sequenceEntry[0], errback = sequenceEntry[1], scope = sequenceEntry[2], f = this.hadError_ ? errback : callback; | |
7596 | if (f) { | |
7597 | try { | |
7598 | var ret = f.call(scope || this.defaultScope_, res); | |
7599 | goog.isDef(ret) && (this.hadError_ = this.hadError_ && (ret == res || this.isError(ret)), this.result_ = res = ret); | |
7600 | goog.Thenable.isImplementedBy(res) && (this.blocked_ = isNewlyBlocked = !0); | |
7601 | } catch (ex) { | |
7602 | res = ex, this.hadError_ = !0, this.makeStackTraceLong_(res), this.hasErrback_() || (unhandledException = !0); | |
7603 | } | |
7604 | } | |
7605 | } | |
7606 | this.result_ = res; | |
7607 | if (isNewlyBlocked) { | |
7608 | var onCallback = goog.bind(this.continue_, this, !0), onErrback = goog.bind(this.continue_, this, !1); | |
7609 | res instanceof goog.async.Deferred ? (res.addCallbacks(onCallback, onErrback), res.blocking_ = !0) : res.then(onCallback, onErrback); | |
7610 | } else { | |
7611 | !goog.async.Deferred.STRICT_ERRORS || !this.isError(res) || res instanceof goog.async.Deferred.CanceledError || (unhandledException = this.hadError_ = !0); | |
7612 | } | |
7613 | unhandledException && (this.unhandledErrorId_ = goog.async.Deferred.scheduleError_(res)); | |
7614 | }; | |
7615 | goog.async.Deferred.succeed = function $goog$async$Deferred$succeed$(opt_result) { | |
7616 | var d = new goog.async.Deferred; | |
7617 | d.callback(opt_result); | |
7618 | return d; | |
7619 | }; | |
7620 | goog.async.Deferred.fromPromise = function $goog$async$Deferred$fromPromise$(promise) { | |
7621 | var d = new goog.async.Deferred; | |
7622 | d.callback(); | |
7623 | d.addCallback(function() { | |
7624 | return promise; | |
7625 | }); | |
7626 | return d; | |
7627 | }; | |
7628 | goog.async.Deferred.fail = function $goog$async$Deferred$fail$(res) { | |
7629 | var d = new goog.async.Deferred; | |
7630 | d.errback(res); | |
7631 | return d; | |
7632 | }; | |
7633 | goog.async.Deferred.canceled = function $goog$async$Deferred$canceled$() { | |
7634 | var d = new goog.async.Deferred; | |
7635 | d.cancel(); | |
7636 | return d; | |
7637 | }; | |
7638 | goog.async.Deferred.when = function $goog$async$Deferred$when$(value, callback, opt_scope) { | |
7639 | return value instanceof goog.async.Deferred ? value.branch(!0).addCallback(callback, opt_scope) : goog.async.Deferred.succeed(value).addCallback(callback, opt_scope); | |
7640 | }; | |
7641 | goog.async.Deferred.AlreadyCalledError = function $goog$async$Deferred$AlreadyCalledError$() { | |
7642 | goog.debug.Error.call(this); | |
7643 | }; | |
7644 | goog.inherits(goog.async.Deferred.AlreadyCalledError, goog.debug.Error); | |
7645 | goog.async.Deferred.AlreadyCalledError.prototype.message = "Deferred has already fired"; | |
7646 | goog.async.Deferred.AlreadyCalledError.prototype.name = "AlreadyCalledError"; | |
7647 | goog.async.Deferred.CanceledError = function $goog$async$Deferred$CanceledError$() { | |
7648 | goog.debug.Error.call(this); | |
7649 | }; | |
7650 | goog.inherits(goog.async.Deferred.CanceledError, goog.debug.Error); | |
7651 | goog.async.Deferred.CanceledError.prototype.message = "Deferred was canceled"; | |
7652 | goog.async.Deferred.CanceledError.prototype.name = "CanceledError"; | |
7653 | goog.async.Deferred.Error_ = function $goog$async$Deferred$Error_$(error) { | |
7654 | this.id_ = goog.global.setTimeout(goog.bind(this.throwError, this), 0); | |
7655 | this.error_ = error; | |
7656 | }; | |
7657 | goog.async.Deferred.Error_.prototype.throwError = function $goog$async$Deferred$Error_$$throwError$() { | |
7658 | goog.asserts.assert(goog.async.Deferred.errorMap_[this.id_], "Cannot throw an error that is not scheduled."); | |
7659 | delete goog.async.Deferred.errorMap_[this.id_]; | |
7660 | throw this.error_; | |
7661 | }; | |
7662 | goog.async.Deferred.Error_.prototype.resetTimer = function $goog$async$Deferred$Error_$$resetTimer$() { | |
7663 | goog.global.clearTimeout(this.id_); | |
7664 | }; | |
7665 | goog.async.Deferred.errorMap_ = {}; | |
7666 | goog.async.Deferred.scheduleError_ = function $goog$async$Deferred$scheduleError_$(error) { | |
7667 | var deferredError = new goog.async.Deferred.Error_(error); | |
7668 | goog.async.Deferred.errorMap_[deferredError.id_] = deferredError; | |
7669 | return deferredError.id_; | |
7670 | }; | |
7671 | goog.async.Deferred.unscheduleError_ = function $goog$async$Deferred$unscheduleError_$(id) { | |
7672 | var error = goog.async.Deferred.errorMap_[id]; | |
7673 | error && (error.resetTimer(), delete goog.async.Deferred.errorMap_[id]); | |
7674 | }; | |
7675 | goog.async.Deferred.assertNoErrors = function $goog$async$Deferred$assertNoErrors$() { | |
7676 | var map = goog.async.Deferred.errorMap_, key; | |
7677 | for (key in map) { | |
7678 | var error = map[key]; | |
7679 | error.resetTimer(); | |
7680 | error.throwError(); | |
7681 | } | |
7682 | }; | |
7683 | goog.net = {}; | |
7684 | goog.net.jsloader = {}; | |
7685 | goog.net.jsloader.GLOBAL_VERIFY_OBJS_ = "closure_verification"; | |
7686 | goog.net.jsloader.DEFAULT_TIMEOUT = 5E3; | |
7687 | goog.net.jsloader.scriptsToLoad_ = []; | |
7688 | goog.net.jsloader.loadMany = function $goog$net$jsloader$loadMany$(uris, opt_options) { | |
7689 | if (uris.length) { | |
7690 | var isAnotherModuleLoading = goog.net.jsloader.scriptsToLoad_.length; | |
7691 | goog.array.extend(goog.net.jsloader.scriptsToLoad_, uris); | |
7692 | if (!isAnotherModuleLoading) { | |
7693 | uris = goog.net.jsloader.scriptsToLoad_; | |
7694 | var popAndLoadNextScript = function $popAndLoadNextScript$() { | |
7695 | var uri = uris.shift(), deferred = goog.net.jsloader.load(uri, opt_options); | |
7696 | uris.length && deferred.addBoth(popAndLoadNextScript); | |
7697 | }; | |
7698 | popAndLoadNextScript(); | |
7699 | } | |
7700 | } | |
7701 | }; | |
7702 | goog.net.jsloader.load = function $goog$net$jsloader$load$(uri, opt_options) { | |
7703 | var options = opt_options || {}, doc = options.document || document, script = goog.dom.createElement(goog.dom.TagName.SCRIPT), request = {script_:script, timeout_:void 0}, deferred = new goog.async.Deferred(goog.net.jsloader.cancel_, request), timeout = null, timeoutDuration = goog.isDefAndNotNull(options.timeout) ? options.timeout : goog.net.jsloader.DEFAULT_TIMEOUT; | |
7704 | 0 < timeoutDuration && (timeout = window.setTimeout(function() { | |
7705 | goog.net.jsloader.cleanup_(script, !0); | |
7706 | deferred.errback(new goog.net.jsloader.Error(goog.net.jsloader.ErrorCode.TIMEOUT, "Timeout reached for loading script " + uri)); | |
7707 | }, timeoutDuration), request.timeout_ = timeout); | |
7708 | script.onload = script.onreadystatechange = function $script$onreadystatechange$() { | |
7709 | if (!script.readyState || "loaded" == script.readyState || "complete" == script.readyState) { | |
7710 | var removeScriptNode = options.cleanupWhenDone || !1; | |
7711 | goog.net.jsloader.cleanup_(script, removeScriptNode, timeout); | |
7712 | deferred.callback(null); | |
7713 | } | |
7714 | }; | |
7715 | script.onerror = function $script$onerror$() { | |
7716 | goog.net.jsloader.cleanup_(script, !0, timeout); | |
7717 | deferred.errback(new goog.net.jsloader.Error(goog.net.jsloader.ErrorCode.LOAD_ERROR, "Error while loading script " + uri)); | |
7718 | }; | |
7719 | goog.dom.setProperties(script, {type:"text/javascript", charset:"UTF-8", src:uri}); | |
7720 | var scriptParent = goog.net.jsloader.getScriptParentElement_(doc); | |
7721 | scriptParent.appendChild(script); | |
7722 | return deferred; | |
7723 | }; | |
7724 | goog.net.jsloader.loadAndVerify = function $goog$net$jsloader$loadAndVerify$(uri, verificationObjName, options) { | |
7725 | goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_] || (goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_] = {}); | |
7726 | var verifyObjs = goog.global[goog.net.jsloader.GLOBAL_VERIFY_OBJS_]; | |
7727 | if (goog.isDef(verifyObjs[verificationObjName])) { | |
7728 | return goog.async.Deferred.fail(new goog.net.jsloader.Error(goog.net.jsloader.ErrorCode.VERIFY_OBJECT_ALREADY_EXISTS, "Verification object " + verificationObjName + " already defined.")); | |
7729 | } | |
7730 | var sendDeferred = goog.net.jsloader.load(uri, options), deferred = new goog.async.Deferred(goog.bind(sendDeferred.cancel, sendDeferred)); | |
7731 | sendDeferred.addCallback(function() { | |
7732 | var result = verifyObjs[verificationObjName]; | |
7733 | goog.isDef(result) ? (deferred.callback(result), delete verifyObjs[verificationObjName]) : deferred.errback(new goog.net.jsloader.Error(goog.net.jsloader.ErrorCode.VERIFY_ERROR, "Script " + uri + " loaded, but verification object " + verificationObjName + " was not defined.")); | |
7734 | }); | |
7735 | sendDeferred.addErrback(function(error) { | |
7736 | goog.isDef(verifyObjs[verificationObjName]) && delete verifyObjs[verificationObjName]; | |
7737 | deferred.errback(error); | |
7738 | }); | |
7739 | return deferred; | |
7740 | }; | |
7741 | goog.net.jsloader.getScriptParentElement_ = function $goog$net$jsloader$getScriptParentElement_$(doc) { | |
7742 | var headElements = doc.getElementsByTagName(goog.dom.TagName.HEAD); | |
7743 | return!headElements || goog.array.isEmpty(headElements) ? doc.documentElement : headElements[0]; | |
7744 | }; | |
7745 | goog.net.jsloader.cancel_ = function $goog$net$jsloader$cancel_$() { | |
7746 | var request = this; | |
7747 | if (request && request.script_) { | |
7748 | var scriptNode = request.script_; | |
7749 | scriptNode && "SCRIPT" == scriptNode.tagName && goog.net.jsloader.cleanup_(scriptNode, !0, request.timeout_); | |
7750 | } | |
7751 | }; | |
7752 | goog.net.jsloader.cleanup_ = function $goog$net$jsloader$cleanup_$(scriptNode, removeScriptNode, opt_timeout) { | |
7753 | goog.isDefAndNotNull(opt_timeout) && goog.global.clearTimeout(opt_timeout); | |
7754 | scriptNode.onload = goog.nullFunction; | |
7755 | scriptNode.onerror = goog.nullFunction; | |
7756 | scriptNode.onreadystatechange = goog.nullFunction; | |
7757 | removeScriptNode && window.setTimeout(function() { | |
7758 | goog.dom.removeNode(scriptNode); | |
7759 | }, 0); | |
7760 | }; | |
7761 | goog.net.jsloader.ErrorCode = {LOAD_ERROR:0, TIMEOUT:1, VERIFY_ERROR:2, VERIFY_OBJECT_ALREADY_EXISTS:3}; | |
7762 | goog.net.jsloader.Error = function $goog$net$jsloader$Error$(code, opt_message) { | |
7763 | var msg = "Jsloader error (code #" + code + ")"; | |
7764 | opt_message && (msg += ": " + opt_message); | |
7765 | goog.debug.Error.call(this, msg); | |
7766 | this.code = code; | |
7767 | }; | |
7768 | goog.inherits(goog.net.jsloader.Error, goog.debug.Error); | |
7769 | goog.net.Jsonp = function $goog$net$Jsonp$(uri, opt_callbackParamName) { | |
7770 | this.uri_ = new goog.Uri(uri); | |
7771 | this.callbackParamName_ = opt_callbackParamName ? opt_callbackParamName : "callback"; | |
7772 | this.timeout_ = 5E3; | |
7773 | }; | |
7774 | goog.net.Jsonp.CALLBACKS = "_callbacks_"; | |
7775 | goog.net.Jsonp.scriptCounter_ = 0; | |
7776 | goog.net.Jsonp.prototype.send = function $goog$net$Jsonp$$send$(opt_payload, opt_replyCallback, opt_errorCallback, opt_callbackParamValue) { | |
7777 | var payload = opt_payload || null, id = opt_callbackParamValue || "_" + (goog.net.Jsonp.scriptCounter_++).toString(36) + goog.now().toString(36); | |
7778 | goog.global[goog.net.Jsonp.CALLBACKS] || (goog.global[goog.net.Jsonp.CALLBACKS] = {}); | |
7779 | var uri = this.uri_.clone(); | |
7780 | payload && goog.net.Jsonp.addPayloadToUri_(payload, uri); | |
7781 | if (opt_replyCallback) { | |
7782 | var reply = goog.net.Jsonp.newReplyHandler_(id, opt_replyCallback); | |
7783 | goog.global[goog.net.Jsonp.CALLBACKS][id] = reply; | |
7784 | uri.setParameterValues(this.callbackParamName_, goog.net.Jsonp.CALLBACKS + "." + id); | |
7785 | } | |
7786 | var deferred = goog.net.jsloader.load(uri.toString(), {timeout:this.timeout_, cleanupWhenDone:!0}), error = goog.net.Jsonp.newErrorHandler_(id, payload, opt_errorCallback); | |
7787 | deferred.addErrback(error); | |
7788 | return{id_:id, deferred_:deferred}; | |
7789 | }; | |
7790 | goog.net.Jsonp.prototype.cancel = function $goog$net$Jsonp$$cancel$(request) { | |
7791 | request && (request.deferred_ && request.deferred_.cancel(), request.id_ && goog.net.Jsonp.cleanup_(request.id_, !1)); | |
7792 | }; | |
7793 | goog.net.Jsonp.newErrorHandler_ = function $goog$net$Jsonp$newErrorHandler_$(id, payload, opt_errorCallback) { | |
7794 | return function() { | |
7795 | goog.net.Jsonp.cleanup_(id, !1); | |
7796 | opt_errorCallback && opt_errorCallback(payload); | |
7797 | }; | |
7798 | }; | |
7799 | goog.net.Jsonp.newReplyHandler_ = function $goog$net$Jsonp$newReplyHandler_$(id, replyCallback) { | |
7800 | return function(var_args) { | |
7801 | goog.net.Jsonp.cleanup_(id, !0); | |
7802 | replyCallback.apply(void 0, arguments); | |
7803 | }; | |
7804 | }; | |
7805 | goog.net.Jsonp.cleanup_ = function $goog$net$Jsonp$cleanup_$(id, deleteReplyHandler) { | |
7806 | goog.global[goog.net.Jsonp.CALLBACKS][id] && (deleteReplyHandler ? delete goog.global[goog.net.Jsonp.CALLBACKS][id] : goog.global[goog.net.Jsonp.CALLBACKS][id] = goog.nullFunction); | |
7807 | }; | |
7808 | goog.net.Jsonp.addPayloadToUri_ = function $goog$net$Jsonp$addPayloadToUri_$(payload, uri) { | |
7809 | for (var name in payload) { | |
7810 | payload.hasOwnProperty && !payload.hasOwnProperty(name) || uri.setParameterValues(name, payload[name]); | |
7811 | } | |
7812 | return uri; | |
7813 | }; | |
7814 | goog.json = {}; | |
7815 | goog.json.USE_NATIVE_JSON = !1; | |
7816 | goog.json.isValid_ = function $goog$json$isValid_$(s) { | |
7817 | if (/^\s*$/.test(s)) { | |
7818 | return!1; | |
7819 | } | |
7820 | var backslashesRe = /\\["\\\/bfnrtu]/g, simpleValuesRe = /"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, openBracketsRe = /(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g, remainderRe = /^[\],:{}\s\u2028\u2029]*$/; | |
7821 | return remainderRe.test(s.replace(backslashesRe, "@").replace(simpleValuesRe, "]").replace(openBracketsRe, "")); | |
7822 | }; | |
7823 | goog.json.parse = goog.json.USE_NATIVE_JSON ? goog.global.JSON.parse : function(s) { | |
7824 | var o = String(s); | |
7825 | if (goog.json.isValid_(o)) { | |
7826 | try { | |
7827 | return eval("(" + o + ")"); | |
7828 | } catch (ex) { | |
7829 | } | |
7830 | } | |
7831 | throw Error("Invalid JSON string: " + o); | |
7832 | }; | |
7833 | goog.json.unsafeParse = goog.json.USE_NATIVE_JSON ? goog.global.JSON.parse : function(s) { | |
7834 | return eval("(" + s + ")"); | |
7835 | }; | |
7836 | goog.json.serialize = goog.json.USE_NATIVE_JSON ? goog.global.JSON.stringify : function(object, opt_replacer) { | |
7837 | return(new goog.json.Serializer(opt_replacer)).serialize(object); | |
7838 | }; | |
7839 | goog.json.Serializer = function $goog$json$Serializer$(opt_replacer) { | |
7840 | this.replacer_ = opt_replacer; | |
7841 | }; | |
7842 | goog.json.Serializer.prototype.serialize = function $goog$json$Serializer$$serialize$(object) { | |
7843 | var sb = []; | |
7844 | this.serializeInternal(object, sb); | |
7845 | return sb.join(""); | |
7846 | }; | |
7847 | goog.json.Serializer.prototype.serializeInternal = function $goog$json$Serializer$$serializeInternal$(object, sb) { | |
7848 | switch(typeof object) { | |
7849 | case "string": | |
7850 | this.serializeString_(object, sb); | |
7851 | break; | |
7852 | case "number": | |
7853 | this.serializeNumber_(object, sb); | |
7854 | break; | |
7855 | case "boolean": | |
7856 | sb.push(object); | |
7857 | break; | |
7858 | case "undefined": | |
7859 | sb.push("null"); | |
7860 | break; | |
7861 | case "object": | |
7862 | if (null == object) { | |
7863 | sb.push("null"); | |
7864 | break; | |
7865 | } | |
7866 | if (goog.isArray(object)) { | |
7867 | this.serializeArray(object, sb); | |
7868 | break; | |
7869 | } | |
7870 | this.serializeObject_(object, sb); | |
7871 | break; | |
7872 | case "function": | |
7873 | break; | |
7874 | default: | |
7875 | throw Error("Unknown type: " + typeof object);; | |
7876 | } | |
7877 | }; | |
7878 | goog.json.Serializer.charToJsonCharCache_ = {'"':'\\"', "\\":"\\\\", "/":"\\/", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t", "\x0B":"\\u000b"}; | |
7879 | goog.json.Serializer.charsToReplace_ = /\uffff/.test("\uffff") ? /[\\\"\x00-\x1f\x7f-\uffff]/g : /[\\\"\x00-\x1f\x7f-\xff]/g; | |
7880 | goog.json.Serializer.prototype.serializeString_ = function $goog$json$Serializer$$serializeString_$(s, sb) { | |
7881 | sb.push('"', s.replace(goog.json.Serializer.charsToReplace_, function(c) { | |
7882 | if (c in goog.json.Serializer.charToJsonCharCache_) { | |
7883 | return goog.json.Serializer.charToJsonCharCache_[c]; | |
7884 | } | |
7885 | var cc = c.charCodeAt(0), rv = "\\u"; | |
7886 | 16 > cc ? rv += "000" : 256 > cc ? rv += "00" : 4096 > cc && (rv += "0"); | |
7887 | return goog.json.Serializer.charToJsonCharCache_[c] = rv + cc.toString(16); | |
7888 | }), '"'); | |
7889 | }; | |
7890 | goog.json.Serializer.prototype.serializeNumber_ = function $goog$json$Serializer$$serializeNumber_$(n, sb) { | |
7891 | sb.push(isFinite(n) && !isNaN(n) ? n : "null"); | |
7892 | }; | |
7893 | goog.json.Serializer.prototype.serializeArray = function $goog$json$Serializer$$serializeArray$(arr, sb) { | |
7894 | var l = arr.length; | |
7895 | sb.push("["); | |
7896 | for (var sep = "", i = 0;i < l;i++) { | |
7897 | sb.push(sep); | |
7898 | var value = arr[i]; | |
7899 | this.serializeInternal(this.replacer_ ? this.replacer_.call(arr, String(i), value) : value, sb); | |
7900 | sep = ","; | |
7901 | } | |
7902 | sb.push("]"); | |
7903 | }; | |
7904 | goog.json.Serializer.prototype.serializeObject_ = function $goog$json$Serializer$$serializeObject_$(obj, sb) { | |
7905 | sb.push("{"); | |
7906 | var sep = "", key; | |
7907 | for (key in obj) { | |
7908 | if (Object.prototype.hasOwnProperty.call(obj, key)) { | |
7909 | var value = obj[key]; | |
7910 | "function" != typeof value && (sb.push(sep), this.serializeString_(key, sb), sb.push(":"), this.serializeInternal(this.replacer_ ? this.replacer_.call(obj, key, value) : value, sb), sep = ","); | |
7911 | } | |
7912 | } | |
7913 | sb.push("}"); | |
7914 | }; | |
7915 | goog.structs.Collection = function $goog$structs$Collection$() { | |
7916 | }; | |
7917 | goog.structs.Set = function $goog$structs$Set$(opt_values) { | |
7918 | this.map_ = new goog.structs.Map; | |
7919 | opt_values && this.addAll(opt_values); | |
7920 | }; | |
7921 | goog.structs.Set.getKey_ = function $goog$structs$Set$getKey_$(val) { | |
7922 | var type = typeof val; | |
7923 | return "object" == type && val || "function" == type ? "o" + goog.getUid(val) : type.substr(0, 1) + val; | |
7924 | }; | |
7925 | goog.structs.Set.prototype.getCount = function $goog$structs$Set$$getCount$() { | |
7926 | return this.map_.getCount(); | |
7927 | }; | |
7928 | goog.structs.Set.prototype.add = function $goog$structs$Set$$add$(element) { | |
7929 | this.map_.set(goog.structs.Set.getKey_(element), element); | |
7930 | }; | |
7931 | goog.structs.Set.prototype.addAll = function $goog$structs$Set$$addAll$(col) { | |
7932 | for (var values = goog.structs.getValues(col), l = values.length, i = 0;i < l;i++) { | |
7933 | this.add(values[i]); | |
7934 | } | |
7935 | }; | |
7936 | goog.structs.Set.prototype.removeAll = function $goog$structs$Set$$removeAll$(col) { | |
7937 | for (var values = goog.structs.getValues(col), l = values.length, i = 0;i < l;i++) { | |
7938 | this.remove(values[i]); | |
7939 | } | |
7940 | }; | |
7941 | goog.structs.Set.prototype.remove = function $goog$structs$Set$$remove$(element) { | |
7942 | return this.map_.remove(goog.structs.Set.getKey_(element)); | |
7943 | }; | |
7944 | goog.structs.Set.prototype.clear = function $goog$structs$Set$$clear$() { | |
7945 | this.map_.clear(); | |
7946 | }; | |
7947 | goog.structs.Set.prototype.isEmpty = function $goog$structs$Set$$isEmpty$() { | |
7948 | return this.map_.isEmpty(); | |
7949 | }; | |
7950 | goog.structs.Set.prototype.contains = function $goog$structs$Set$$contains$(element) { | |
7951 | return this.map_.containsKey(goog.structs.Set.getKey_(element)); | |
7952 | }; | |
7953 | goog.structs.Set.prototype.intersection = function $goog$structs$Set$$intersection$(col) { | |
7954 | for (var result = new goog.structs.Set, values = goog.structs.getValues(col), i = 0;i < values.length;i++) { | |
7955 | var value = values[i]; | |
7956 | this.contains(value) && result.add(value); | |
7957 | } | |
7958 | return result; | |
7959 | }; | |
7960 | goog.structs.Set.prototype.difference = function $goog$structs$Set$$difference$(col) { | |
7961 | var result = this.clone(); | |
7962 | result.removeAll(col); | |
7963 | return result; | |
7964 | }; | |
7965 | goog.structs.Set.prototype.getValues = function $goog$structs$Set$$getValues$() { | |
7966 | return this.map_.getValues(); | |
7967 | }; | |
7968 | goog.structs.Set.prototype.clone = function $goog$structs$Set$$clone$() { | |
7969 | return new goog.structs.Set(this); | |
7970 | }; | |
7971 | goog.structs.Set.prototype.equals = function $goog$structs$Set$$equals$(col) { | |
7972 | return this.getCount() == goog.structs.getCount(col) && this.isSubsetOf(col); | |
7973 | }; | |
7974 | goog.structs.Set.prototype.isSubsetOf = function $goog$structs$Set$$isSubsetOf$(col) { | |
7975 | var colCount = goog.structs.getCount(col); | |
7976 | if (this.getCount() > colCount) { | |
7977 | return!1; | |
7978 | } | |
7979 | !(col instanceof goog.structs.Set) && 5 < colCount && (col = new goog.structs.Set(col)); | |
7980 | return goog.structs.every(this, function(value) { | |
7981 | return goog.structs.contains(col, value); | |
7982 | }); | |
7983 | }; | |
7984 | goog.structs.Set.prototype.__iterator__ = function $goog$structs$Set$$__iterator__$() { | |
7985 | return this.map_.__iterator__(!1); | |
7986 | }; | |
7987 | goog.debug.LOGGING_ENABLED = goog.DEBUG; | |
7988 | goog.debug.catchErrors = function $goog$debug$catchErrors$(logFunc, opt_cancel, opt_target) { | |
7989 | var target = opt_target || goog.global, oldErrorHandler = target.onerror, retVal = !!opt_cancel; | |
7990 | goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("535.3") && (retVal = !retVal); | |
7991 | target.onerror = function $target$onerror$(message, url, line, opt_col, opt_error) { | |
7992 | oldErrorHandler && oldErrorHandler(message, url, line, opt_col, opt_error); | |
7993 | logFunc({message:message, fileName:url, line:line, col:opt_col, error:opt_error}); | |
7994 | return retVal; | |
7995 | }; | |
7996 | }; | |
7997 | goog.debug.expose = function $goog$debug$expose$(obj, opt_showFn) { | |
7998 | if ("undefined" == typeof obj) { | |
7999 | return "undefined"; | |
8000 | } | |
8001 | if (null == obj) { | |
8002 | return "NULL"; | |
8003 | } | |
8004 | var str = [], x; | |
8005 | for (x in obj) { | |
8006 | if (opt_showFn || !goog.isFunction(obj[x])) { | |
8007 | var s = x + " = "; | |
8008 | try { | |
8009 | s += obj[x]; | |
8010 | } catch (e) { | |
8011 | s += "*** " + e + " ***"; | |
8012 | } | |
8013 | str.push(s); | |
8014 | } | |
8015 | } | |
8016 | return str.join("\n"); | |
8017 | }; | |
8018 | goog.debug.deepExpose = function $goog$debug$deepExpose$(obj$$0, opt_showFn) { | |
8019 | var str = [], helper = function $helper$(obj, space, parentSeen) { | |
8020 | var nestspace = space + " ", seen = new goog.structs.Set(parentSeen); | |
8021 | try { | |
8022 | if (goog.isDef(obj)) { | |
8023 | if (goog.isNull(obj)) { | |
8024 | str.push("NULL"); | |
8025 | } else { | |
8026 | if (goog.isString(obj)) { | |
8027 | str.push('"' + obj.replace(/\n/g, "\n" + space) + '"'); | |
8028 | } else { | |
8029 | if (goog.isFunction(obj)) { | |
8030 | str.push(String(obj).replace(/\n/g, "\n" + space)); | |
8031 | } else { | |
8032 | if (goog.isObject(obj)) { | |
8033 | if (seen.contains(obj)) { | |
8034 | str.push("*** reference loop detected ***"); | |
8035 | } else { | |
8036 | seen.add(obj); | |
8037 | str.push("{"); | |
8038 | for (var x in obj) { | |
8039 | if (opt_showFn || !goog.isFunction(obj[x])) { | |
8040 | str.push("\n"), str.push(nestspace), str.push(x + " = "), helper(obj[x], nestspace, seen); | |
8041 | } | |
8042 | } | |
8043 | str.push("\n" + space + "}"); | |
8044 | } | |
8045 | } else { | |
8046 | str.push(obj); | |
8047 | } | |
8048 | } | |
8049 | } | |
8050 | } | |
8051 | } else { | |
8052 | str.push("undefined"); | |
8053 | } | |
8054 | } catch (e) { | |
8055 | str.push("*** " + e + " ***"); | |
8056 | } | |
8057 | }; | |
8058 | helper(obj$$0, "", new goog.structs.Set); | |
8059 | return str.join(""); | |
8060 | }; | |
8061 | goog.debug.exposeArray = function $goog$debug$exposeArray$(arr) { | |
8062 | for (var str = [], i = 0;i < arr.length;i++) { | |
8063 | goog.isArray(arr[i]) ? str.push(goog.debug.exposeArray(arr[i])) : str.push(arr[i]); | |
8064 | } | |
8065 | return "[ " + str.join(", ") + " ]"; | |
8066 | }; | |
8067 | goog.debug.exposeException = function $goog$debug$exposeException$(err, opt_fn) { | |
8068 | try { | |
8069 | var e = goog.debug.normalizeErrorObject(err), error = "Message: " + goog.string.htmlEscape(e.message) + '\nUrl: <a href="view-source:' + e.fileName + '" target="_new">' + e.fileName + "</a>\nLine: " + e.lineNumber + "\n\nBrowser stack:\n" + goog.string.htmlEscape(e.stack + "-> ") + "[end]\n\nJS stack traversal:\n" + goog.string.htmlEscape(goog.debug.getStacktrace(opt_fn) + "-> "); | |
8070 | return error; | |
8071 | } catch (e2) { | |
8072 | return "Exception trying to expose exception! You win, we lose. " + e2; | |
8073 | } | |
8074 | }; | |
8075 | goog.debug.normalizeErrorObject = function $goog$debug$normalizeErrorObject$(err) { | |
8076 | var href = goog.getObjectByName("window.location.href"); | |
8077 | if (goog.isString(err)) { | |
8078 | return{message:err, name:"Unknown error", lineNumber:"Not available", fileName:href, stack:"Not available"}; | |
8079 | } | |
8080 | var lineNumber, fileName, threwError = !1; | |
8081 | try { | |
8082 | lineNumber = err.lineNumber || err.line || "Not available"; | |
8083 | } catch (e) { | |
8084 | lineNumber = "Not available", threwError = !0; | |
8085 | } | |
8086 | try { | |
8087 | fileName = err.fileName || err.filename || err.sourceURL || goog.global.$googDebugFname || href; | |
8088 | } catch (e$$0) { | |
8089 | fileName = "Not available", threwError = !0; | |
8090 | } | |
8091 | return!threwError && err.lineNumber && err.fileName && err.stack && err.message && err.name ? err : {message:err.message || "Not available", name:err.name || "UnknownError", lineNumber:lineNumber, fileName:fileName, stack:err.stack || "Not available"}; | |
8092 | }; | |
8093 | goog.debug.enhanceError = function $goog$debug$enhanceError$(err, opt_message) { | |
8094 | var error; | |
8095 | "string" == typeof err ? (error = Error(err), Error.captureStackTrace && Error.captureStackTrace(error, goog.debug.enhanceError)) : error = err; | |
8096 | error.stack || (error.stack = goog.debug.getStacktrace(goog.debug.enhanceError)); | |
8097 | if (opt_message) { | |
8098 | for (var x = 0;error["message" + x];) { | |
8099 | ++x; | |
8100 | } | |
8101 | error["message" + x] = String(opt_message); | |
8102 | } | |
8103 | return error; | |
8104 | }; | |
8105 | goog.debug.getStacktraceSimple = function $goog$debug$getStacktraceSimple$(opt_depth) { | |
8106 | if (goog.STRICT_MODE_COMPATIBLE) { | |
8107 | var stack = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple); | |
8108 | if (stack) { | |
8109 | return stack; | |
8110 | } | |
8111 | } | |
8112 | for (var sb = [], fn = arguments.callee.caller, depth = 0;fn && (!opt_depth || depth < opt_depth);) { | |
8113 | sb.push(goog.debug.getFunctionName(fn)); | |
8114 | sb.push("()\n"); | |
8115 | try { | |
8116 | fn = fn.caller; | |
8117 | } catch (e) { | |
8118 | sb.push("[exception trying to get caller]\n"); | |
8119 | break; | |
8120 | } | |
8121 | depth++; | |
8122 | if (depth >= goog.debug.MAX_STACK_DEPTH) { | |
8123 | sb.push("[...long stack...]"); | |
8124 | break; | |
8125 | } | |
8126 | } | |
8127 | opt_depth && depth >= opt_depth ? sb.push("[...reached max depth limit...]") : sb.push("[end]"); | |
8128 | return sb.join(""); | |
8129 | }; | |
8130 | goog.debug.MAX_STACK_DEPTH = 50; | |
8131 | goog.debug.getNativeStackTrace_ = function $goog$debug$getNativeStackTrace_$(fn) { | |
8132 | var tempErr = Error(); | |
8133 | if (Error.captureStackTrace) { | |
8134 | return Error.captureStackTrace(tempErr, fn), String(tempErr.stack); | |
8135 | } | |
8136 | try { | |
8137 | throw tempErr; | |
8138 | } catch (e) { | |
8139 | tempErr = e; | |
8140 | } | |
8141 | var stack = tempErr.stack; | |
8142 | return stack ? String(stack) : null; | |
8143 | }; | |
8144 | goog.debug.getStacktrace = function $goog$debug$getStacktrace$(opt_fn) { | |
8145 | var stack; | |
8146 | if (goog.STRICT_MODE_COMPATIBLE) { | |
8147 | var contextFn = opt_fn || goog.debug.getStacktrace; | |
8148 | stack = goog.debug.getNativeStackTrace_(contextFn); | |
8149 | } | |
8150 | stack || (stack = goog.debug.getStacktraceHelper_(opt_fn || arguments.callee.caller, [])); | |
8151 | return stack; | |
8152 | }; | |
8153 | goog.debug.getStacktraceHelper_ = function $goog$debug$getStacktraceHelper_$(fn, visited) { | |
8154 | var sb = []; | |
8155 | if (goog.array.contains(visited, fn)) { | |
8156 | sb.push("[...circular reference...]"); | |
8157 | } else { | |
8158 | if (fn && visited.length < goog.debug.MAX_STACK_DEPTH) { | |
8159 | sb.push(goog.debug.getFunctionName(fn) + "("); | |
8160 | for (var args = fn.arguments, i = 0;args && i < args.length;i++) { | |
8161 | 0 < i && sb.push(", "); | |
8162 | var argDesc, arg = args[i]; | |
8163 | switch(typeof arg) { | |
8164 | case "object": | |
8165 | argDesc = arg ? "object" : "null"; | |
8166 | break; | |
8167 | case "string": | |
8168 | argDesc = arg; | |
8169 | break; | |
8170 | case "number": | |
8171 | argDesc = String(arg); | |
8172 | break; | |
8173 | case "boolean": | |
8174 | argDesc = arg ? "true" : "false"; | |
8175 | break; | |
8176 | case "function": | |
8177 | argDesc = (argDesc = goog.debug.getFunctionName(arg)) ? argDesc : "[fn]"; | |
8178 | break; | |
8179 | default: | |
8180 | argDesc = typeof arg; | |
8181 | } | |
8182 | 40 < argDesc.length && (argDesc = argDesc.substr(0, 40) + "..."); | |
8183 | sb.push(argDesc); | |
8184 | } | |
8185 | visited.push(fn); | |
8186 | sb.push(")\n"); | |
8187 | try { | |
8188 | sb.push(goog.debug.getStacktraceHelper_(fn.caller, visited)); | |
8189 | } catch (e) { | |
8190 | sb.push("[exception trying to get caller]\n"); | |
8191 | } | |
8192 | } else { | |
8193 | fn ? sb.push("[...long stack...]") : sb.push("[end]"); | |
8194 | } | |
8195 | } | |
8196 | return sb.join(""); | |
8197 | }; | |
8198 | goog.debug.setFunctionResolver = function $goog$debug$setFunctionResolver$(resolver) { | |
8199 | goog.debug.fnNameResolver_ = resolver; | |
8200 | }; | |
8201 | goog.debug.getFunctionName = function $goog$debug$getFunctionName$(fn) { | |
8202 | if (goog.debug.fnNameCache_[fn]) { | |
8203 | return goog.debug.fnNameCache_[fn]; | |
8204 | } | |
8205 | if (goog.debug.fnNameResolver_) { | |
8206 | var name = goog.debug.fnNameResolver_(fn); | |
8207 | if (name) { | |
8208 | return goog.debug.fnNameCache_[fn] = name; | |
8209 | } | |
8210 | } | |
8211 | var functionSource = String(fn); | |
8212 | if (!goog.debug.fnNameCache_[functionSource]) { | |
8213 | var matches = /function ([^\(]+)/.exec(functionSource); | |
8214 | if (matches) { | |
8215 | var method = matches[1]; | |
8216 | goog.debug.fnNameCache_[functionSource] = method; | |
8217 | } else { | |
8218 | goog.debug.fnNameCache_[functionSource] = "[Anonymous]"; | |
8219 | } | |
8220 | } | |
8221 | return goog.debug.fnNameCache_[functionSource]; | |
8222 | }; | |
8223 | goog.debug.makeWhitespaceVisible = function $goog$debug$makeWhitespaceVisible$(string) { | |
8224 | return string.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]"); | |
8225 | }; | |
8226 | goog.debug.fnNameCache_ = {}; | |
8227 | goog.debug.LogRecord = function $goog$debug$LogRecord$(level, msg, loggerName, opt_time, opt_sequenceNumber) { | |
8228 | this.reset(level, msg, loggerName, opt_time, opt_sequenceNumber); | |
8229 | }; | |
8230 | goog.debug.LogRecord.prototype.exception_ = null; | |
8231 | goog.debug.LogRecord.prototype.exceptionText_ = null; | |
8232 | goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS = !0; | |
8233 | goog.debug.LogRecord.nextSequenceNumber_ = 0; | |
8234 | goog.debug.LogRecord.prototype.reset = function $goog$debug$LogRecord$$reset$(level, msg, loggerName, opt_time, opt_sequenceNumber) { | |
8235 | goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS && ("number" == typeof opt_sequenceNumber || goog.debug.LogRecord.nextSequenceNumber_++); | |
8236 | opt_time || goog.now(); | |
8237 | this.level_ = level; | |
8238 | this.msg_ = msg; | |
8239 | delete this.exception_; | |
8240 | delete this.exceptionText_; | |
8241 | }; | |
8242 | goog.debug.LogRecord.prototype.setException = function $goog$debug$LogRecord$$setException$(exception) { | |
8243 | this.exception_ = exception; | |
8244 | }; | |
8245 | goog.debug.LogRecord.prototype.setExceptionText = function $goog$debug$LogRecord$$setExceptionText$(text) { | |
8246 | this.exceptionText_ = text; | |
8247 | }; | |
8248 | goog.debug.LogRecord.prototype.setLevel = function $goog$debug$LogRecord$$setLevel$(level) { | |
8249 | this.level_ = level; | |
8250 | }; | |
8251 | goog.debug.LogRecord.prototype.getMessage = function $goog$debug$LogRecord$$getMessage$() { | |
8252 | return this.msg_; | |
8253 | }; | |
8254 | goog.debug.LogBuffer = function $goog$debug$LogBuffer$() { | |
8255 | goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), "Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY."); | |
8256 | this.clear(); | |
8257 | }; | |
8258 | goog.debug.LogBuffer.getInstance = function $goog$debug$LogBuffer$getInstance$() { | |
8259 | goog.debug.LogBuffer.instance_ || (goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer); | |
8260 | return goog.debug.LogBuffer.instance_; | |
8261 | }; | |
8262 | goog.debug.LogBuffer.CAPACITY = 0; | |
8263 | goog.debug.LogBuffer.prototype.addRecord = function $goog$debug$LogBuffer$$addRecord$(level, msg, loggerName) { | |
8264 | var curIndex = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY; | |
8265 | this.curIndex_ = curIndex; | |
8266 | if (this.isFull_) { | |
8267 | var ret = this.buffer_[curIndex]; | |
8268 | ret.reset(level, msg, loggerName); | |
8269 | return ret; | |
8270 | } | |
8271 | this.isFull_ = curIndex == goog.debug.LogBuffer.CAPACITY - 1; | |
8272 | return this.buffer_[curIndex] = new goog.debug.LogRecord(level, msg, loggerName); | |
8273 | }; | |
8274 | goog.debug.LogBuffer.isBufferingEnabled = function $goog$debug$LogBuffer$isBufferingEnabled$() { | |
8275 | return 0 < goog.debug.LogBuffer.CAPACITY; | |
8276 | }; | |
8277 | goog.debug.LogBuffer.prototype.clear = function $goog$debug$LogBuffer$$clear$() { | |
8278 | this.buffer_ = Array(goog.debug.LogBuffer.CAPACITY); | |
8279 | this.curIndex_ = -1; | |
8280 | this.isFull_ = !1; | |
8281 | }; | |
8282 | goog.debug.Logger = function $goog$debug$Logger$(name) { | |
8283 | this.name_ = name; | |
8284 | this.handlers_ = this.children_ = this.level_ = this.parent_ = null; | |
8285 | }; | |
8286 | goog.debug.Logger.ENABLE_HIERARCHY = !0; | |
8287 | goog.debug.Logger.ENABLE_HIERARCHY || (goog.debug.Logger.rootHandlers_ = []); | |
8288 | goog.debug.Logger.Level = function $goog$debug$Logger$Level$(name, value) { | |
8289 | this.name = name; | |
8290 | this.value = value; | |
8291 | }; | |
8292 | goog.debug.Logger.Level.prototype.toString = function $goog$debug$Logger$Level$$toString$() { | |
8293 | return this.name; | |
8294 | }; | |
8295 | goog.debug.Logger.Level.OFF = new goog.debug.Logger.Level("OFF", Infinity); | |
8296 | goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level("SHOUT", 1200); | |
8297 | goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level("SEVERE", 1E3); | |
8298 | goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level("WARNING", 900); | |
8299 | goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level("INFO", 800); | |
8300 | goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level("CONFIG", 700); | |
8301 | goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level("FINE", 500); | |
8302 | goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level("FINER", 400); | |
8303 | goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level("FINEST", 300); | |
8304 | goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level("ALL", 0); | |
8305 | goog.debug.Logger.Level.PREDEFINED_LEVELS = [goog.debug.Logger.Level.OFF, goog.debug.Logger.Level.SHOUT, goog.debug.Logger.Level.SEVERE, goog.debug.Logger.Level.WARNING, goog.debug.Logger.Level.INFO, goog.debug.Logger.Level.CONFIG, goog.debug.Logger.Level.FINE, goog.debug.Logger.Level.FINER, goog.debug.Logger.Level.FINEST, goog.debug.Logger.Level.ALL]; | |
8306 | goog.debug.Logger.Level.predefinedLevelsCache_ = null; | |
8307 | goog.debug.Logger.Level.createPredefinedLevelsCache_ = function $goog$debug$Logger$Level$createPredefinedLevelsCache_$() { | |
8308 | goog.debug.Logger.Level.predefinedLevelsCache_ = {}; | |
8309 | for (var i = 0, level;level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i];i++) { | |
8310 | goog.debug.Logger.Level.predefinedLevelsCache_[level.value] = level, goog.debug.Logger.Level.predefinedLevelsCache_[level.name] = level; | |
8311 | } | |
8312 | }; | |
8313 | goog.debug.Logger.Level.getPredefinedLevel = function $goog$debug$Logger$Level$getPredefinedLevel$(name) { | |
8314 | goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_(); | |
8315 | return goog.debug.Logger.Level.predefinedLevelsCache_[name] || null; | |
8316 | }; | |
8317 | goog.debug.Logger.Level.getPredefinedLevelByValue = function $goog$debug$Logger$Level$getPredefinedLevelByValue$(value) { | |
8318 | goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_(); | |
8319 | if (value in goog.debug.Logger.Level.predefinedLevelsCache_) { | |
8320 | return goog.debug.Logger.Level.predefinedLevelsCache_[value]; | |
8321 | } | |
8322 | for (var i = 0;i < goog.debug.Logger.Level.PREDEFINED_LEVELS.length;++i) { | |
8323 | var level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i]; | |
8324 | if (level.value <= value) { | |
8325 | return level; | |
8326 | } | |
8327 | } | |
8328 | return null; | |
8329 | }; | |
8330 | goog.debug.Logger.getLogger = function $goog$debug$Logger$getLogger$(name) { | |
8331 | return goog.debug.LogManager.getLogger(name); | |
8332 | }; | |
8333 | goog.debug.Logger.logToProfilers = function $goog$debug$Logger$logToProfilers$(msg) { | |
8334 | goog.global.console && (goog.global.console.timeStamp ? goog.global.console.timeStamp(msg) : goog.global.console.markTimeline && goog.global.console.markTimeline(msg)); | |
8335 | goog.global.msWriteProfilerMark && goog.global.msWriteProfilerMark(msg); | |
8336 | }; | |
8337 | goog.debug.Logger.prototype.addHandler = function $goog$debug$Logger$$addHandler$(handler) { | |
8338 | goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? (this.handlers_ || (this.handlers_ = []), this.handlers_.push(handler)) : (goog.asserts.assert(!this.name_, "Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."), goog.debug.Logger.rootHandlers_.push(handler))); | |
8339 | }; | |
8340 | goog.debug.Logger.prototype.removeHandler = function $goog$debug$Logger$$removeHandler$(handler) { | |
8341 | if (goog.debug.LOGGING_ENABLED) { | |
8342 | var handlers = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : goog.debug.Logger.rootHandlers_; | |
8343 | return!!handlers && goog.array.remove(handlers, handler); | |
8344 | } | |
8345 | return!1; | |
8346 | }; | |
8347 | goog.debug.Logger.prototype.getParent = function $goog$debug$Logger$$getParent$() { | |
8348 | return this.parent_; | |
8349 | }; | |
8350 | goog.debug.Logger.prototype.getChildren = function $goog$debug$Logger$$getChildren$() { | |
8351 | this.children_ || (this.children_ = {}); | |
8352 | return this.children_; | |
8353 | }; | |
8354 | goog.debug.Logger.prototype.setLevel = function $goog$debug$Logger$$setLevel$(level) { | |
8355 | goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? this.level_ = level : (goog.asserts.assert(!this.name_, "Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."), goog.debug.Logger.rootLevel_ = level)); | |
8356 | }; | |
8357 | goog.debug.Logger.prototype.getEffectiveLevel = function $goog$debug$Logger$$getEffectiveLevel$() { | |
8358 | if (!goog.debug.LOGGING_ENABLED) { | |
8359 | return goog.debug.Logger.Level.OFF; | |
8360 | } | |
8361 | if (!goog.debug.Logger.ENABLE_HIERARCHY) { | |
8362 | return goog.debug.Logger.rootLevel_; | |
8363 | } | |
8364 | if (this.level_) { | |
8365 | return this.level_; | |
8366 | } | |
8367 | if (this.parent_) { | |
8368 | return this.parent_.getEffectiveLevel(); | |
8369 | } | |
8370 | goog.asserts.fail("Root logger has no level set."); | |
8371 | return null; | |
8372 | }; | |
8373 | goog.debug.Logger.prototype.isLoggable = function $goog$debug$Logger$$isLoggable$(level) { | |
8374 | return goog.debug.LOGGING_ENABLED && level.value >= this.getEffectiveLevel().value; | |
8375 | }; | |
8376 | goog.debug.Logger.prototype.log = function $goog$debug$Logger$$log$(level, msg, opt_exception) { | |
8377 | goog.debug.LOGGING_ENABLED && this.isLoggable(level) && (goog.isFunction(msg) && (msg = msg()), this.doLogRecord_(this.getLogRecord(level, msg, opt_exception, goog.debug.Logger.prototype.log))); | |
8378 | }; | |
8379 | goog.debug.Logger.prototype.getLogRecord = function $goog$debug$Logger$$getLogRecord$(level, msg, opt_exception, opt_fnStackContext) { | |
8380 | var logRecord = goog.debug.LogBuffer.isBufferingEnabled() ? goog.debug.LogBuffer.getInstance().addRecord(level, msg, this.name_) : new goog.debug.LogRecord(level, String(msg), this.name_); | |
8381 | opt_exception && (logRecord.setException(opt_exception), logRecord.setExceptionText(goog.debug.exposeException(opt_exception, opt_fnStackContext || goog.debug.Logger.prototype.getLogRecord))); | |
8382 | return logRecord; | |
8383 | }; | |
8384 | goog.debug.Logger.prototype.severe = function $goog$debug$Logger$$severe$(msg, opt_exception) { | |
8385 | goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SEVERE, msg, opt_exception); | |
8386 | }; | |
8387 | goog.debug.Logger.prototype.warning = function $goog$debug$Logger$$warning$(msg, opt_exception) { | |
8388 | goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.WARNING, msg, opt_exception); | |
8389 | }; | |
8390 | goog.debug.Logger.prototype.info = function $goog$debug$Logger$$info$(msg, opt_exception) { | |
8391 | goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.INFO, msg, opt_exception); | |
8392 | }; | |
8393 | goog.debug.Logger.prototype.fine = function $goog$debug$Logger$$fine$(msg, opt_exception) { | |
8394 | goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINE, msg, opt_exception); | |
8395 | }; | |
8396 | goog.debug.Logger.prototype.doLogRecord_ = function $goog$debug$Logger$$doLogRecord_$(logRecord) { | |
8397 | goog.debug.Logger.logToProfilers("log:" + logRecord.getMessage()); | |
8398 | if (goog.debug.Logger.ENABLE_HIERARCHY) { | |
8399 | for (var target = this;target;) { | |
8400 | target.callPublish_(logRecord), target = target.getParent(); | |
8401 | } | |
8402 | } else { | |
8403 | for (var i = 0, handler;handler = goog.debug.Logger.rootHandlers_[i++];) { | |
8404 | handler(logRecord); | |
8405 | } | |
8406 | } | |
8407 | }; | |
8408 | goog.debug.Logger.prototype.callPublish_ = function $goog$debug$Logger$$callPublish_$(logRecord) { | |
8409 | if (this.handlers_) { | |
8410 | for (var i = 0, handler;handler = this.handlers_[i];i++) { | |
8411 | handler(logRecord); | |
8412 | } | |
8413 | } | |
8414 | }; | |
8415 | goog.debug.Logger.prototype.setParent_ = function $goog$debug$Logger$$setParent_$(parent) { | |
8416 | this.parent_ = parent; | |
8417 | }; | |
8418 | goog.debug.Logger.prototype.addChild_ = function $goog$debug$Logger$$addChild_$(name, logger) { | |
8419 | this.getChildren()[name] = logger; | |
8420 | }; | |
8421 | goog.debug.LogManager = {}; | |
8422 | goog.debug.LogManager.loggers_ = {}; | |
8423 | goog.debug.LogManager.rootLogger_ = null; | |
8424 | goog.debug.LogManager.initialize = function $goog$debug$LogManager$initialize$() { | |
8425 | goog.debug.LogManager.rootLogger_ || (goog.debug.LogManager.rootLogger_ = new goog.debug.Logger(""), goog.debug.LogManager.loggers_[""] = goog.debug.LogManager.rootLogger_, goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG)); | |
8426 | }; | |
8427 | goog.debug.LogManager.getLoggers = function $goog$debug$LogManager$getLoggers$() { | |
8428 | return goog.debug.LogManager.loggers_; | |
8429 | }; | |
8430 | goog.debug.LogManager.getRoot = function $goog$debug$LogManager$getRoot$() { | |
8431 | goog.debug.LogManager.initialize(); | |
8432 | return goog.debug.LogManager.rootLogger_; | |
8433 | }; | |
8434 | goog.debug.LogManager.getLogger = function $goog$debug$LogManager$getLogger$(name) { | |
8435 | goog.debug.LogManager.initialize(); | |
8436 | var ret = goog.debug.LogManager.loggers_[name]; | |
8437 | return ret || goog.debug.LogManager.createLogger_(name); | |
8438 | }; | |
8439 | goog.debug.LogManager.createFunctionForCatchErrors = function $goog$debug$LogManager$createFunctionForCatchErrors$(opt_logger) { | |
8440 | return function(info) { | |
8441 | var logger = opt_logger || goog.debug.LogManager.getRoot(); | |
8442 | logger.severe("Error: " + info.message + " (" + info.fileName + " @ Line: " + info.line + ")"); | |
8443 | }; | |
8444 | }; | |
8445 | goog.debug.LogManager.createLogger_ = function $goog$debug$LogManager$createLogger_$(name) { | |
8446 | var logger = new goog.debug.Logger(name); | |
8447 | if (goog.debug.Logger.ENABLE_HIERARCHY) { | |
8448 | var lastDotIndex = name.lastIndexOf("."), parentName = name.substr(0, lastDotIndex), leafName = name.substr(lastDotIndex + 1), parentLogger = goog.debug.LogManager.getLogger(parentName); | |
8449 | parentLogger.addChild_(leafName, logger); | |
8450 | logger.setParent_(parentLogger); | |
8451 | } | |
8452 | return goog.debug.LogManager.loggers_[name] = logger; | |
8453 | }; | |
8454 | goog.log = {}; | |
8455 | goog.log.ENABLED = goog.debug.LOGGING_ENABLED; | |
8456 | goog.log.Logger = goog.debug.Logger; | |
8457 | goog.log.Level = goog.debug.Logger.Level; | |
8458 | goog.log.LogRecord = goog.debug.LogRecord; | |
8459 | goog.log.getLogger = function $goog$log$getLogger$(name, opt_level) { | |
8460 | if (goog.log.ENABLED) { | |
8461 | var logger = goog.debug.LogManager.getLogger(name); | |
8462 | opt_level && logger && logger.setLevel(opt_level); | |
8463 | return logger; | |
8464 | } | |
8465 | return null; | |
8466 | }; | |
8467 | goog.log.addHandler = function $goog$log$addHandler$(logger, handler) { | |
8468 | goog.log.ENABLED && logger && logger.addHandler(handler); | |
8469 | }; | |
8470 | goog.log.removeHandler = function $goog$log$removeHandler$(logger, handler) { | |
8471 | return goog.log.ENABLED && logger ? logger.removeHandler(handler) : !1; | |
8472 | }; | |
8473 | goog.log.log = function $goog$log$log$(logger, level, msg, opt_exception) { | |
8474 | goog.log.ENABLED && logger && logger.log(level, msg, opt_exception); | |
8475 | }; | |
8476 | goog.log.error = function $goog$log$error$(logger, msg, opt_exception) { | |
8477 | goog.log.ENABLED && logger && logger.severe(msg, opt_exception); | |
8478 | }; | |
8479 | goog.log.warning = function $goog$log$warning$(logger, msg, opt_exception) { | |
8480 | goog.log.ENABLED && logger && logger.warning(msg, opt_exception); | |
8481 | }; | |
8482 | goog.log.info = function $goog$log$info$(logger, msg, opt_exception) { | |
8483 | goog.log.ENABLED && logger && logger.info(msg, opt_exception); | |
8484 | }; | |
8485 | goog.log.fine = function $goog$log$fine$(logger, msg, opt_exception) { | |
8486 | goog.log.ENABLED && logger && logger.fine(msg, opt_exception); | |
8487 | }; | |
8488 | goog.net.ErrorCode = {NO_ERROR:0, ACCESS_DENIED:1, FILE_NOT_FOUND:2, FF_SILENT_ERROR:3, CUSTOM_ERROR:4, EXCEPTION:5, HTTP_ERROR:6, ABORT:7, TIMEOUT:8, OFFLINE:9}; | |
8489 | goog.net.ErrorCode.getDebugMessage = function $goog$net$ErrorCode$getDebugMessage$(errorCode) { | |
8490 | switch(errorCode) { | |
8491 | case goog.net.ErrorCode.NO_ERROR: | |
8492 | return "No Error"; | |
8493 | case goog.net.ErrorCode.ACCESS_DENIED: | |
8494 | return "Access denied to content document"; | |
8495 | case goog.net.ErrorCode.FILE_NOT_FOUND: | |
8496 | return "File not found"; | |
8497 | case goog.net.ErrorCode.FF_SILENT_ERROR: | |
8498 | return "Firefox silently errored"; | |
8499 | case goog.net.ErrorCode.CUSTOM_ERROR: | |
8500 | return "Application custom error"; | |
8501 | case goog.net.ErrorCode.EXCEPTION: | |
8502 | return "An exception occurred"; | |
8503 | case goog.net.ErrorCode.HTTP_ERROR: | |
8504 | return "Http response at 400 or 500 level"; | |
8505 | case goog.net.ErrorCode.ABORT: | |
8506 | return "Request was aborted"; | |
8507 | case goog.net.ErrorCode.TIMEOUT: | |
8508 | return "Request timed out"; | |
8509 | case goog.net.ErrorCode.OFFLINE: | |
8510 | return "The resource is not available offline"; | |
8511 | default: | |
8512 | return "Unrecognized error code"; | |
8513 | } | |
8514 | }; | |
8515 | goog.net.EventType = {COMPLETE:"complete", SUCCESS:"success", ERROR:"error", ABORT:"abort", READY:"ready", READY_STATE_CHANGE:"readystatechange", TIMEOUT:"timeout", INCREMENTAL_DATA:"incrementaldata", PROGRESS:"progress"}; | |
8516 | goog.net.HttpStatus = {CONTINUE:100, SWITCHING_PROTOCOLS:101, OK:200, CREATED:201, ACCEPTED:202, NON_AUTHORITATIVE_INFORMATION:203, NO_CONTENT:204, RESET_CONTENT:205, PARTIAL_CONTENT:206, MULTIPLE_CHOICES:300, MOVED_PERMANENTLY:301, FOUND:302, SEE_OTHER:303, NOT_MODIFIED:304, USE_PROXY:305, TEMPORARY_REDIRECT:307, BAD_REQUEST:400, UNAUTHORIZED:401, PAYMENT_REQUIRED:402, FORBIDDEN:403, NOT_FOUND:404, METHOD_NOT_ALLOWED:405, NOT_ACCEPTABLE:406, PROXY_AUTHENTICATION_REQUIRED:407, REQUEST_TIMEOUT:408, | |
8517 | CONFLICT:409, GONE:410, LENGTH_REQUIRED:411, PRECONDITION_FAILED:412, REQUEST_ENTITY_TOO_LARGE:413, REQUEST_URI_TOO_LONG:414, UNSUPPORTED_MEDIA_TYPE:415, REQUEST_RANGE_NOT_SATISFIABLE:416, EXPECTATION_FAILED:417, INTERNAL_SERVER_ERROR:500, NOT_IMPLEMENTED:501, BAD_GATEWAY:502, SERVICE_UNAVAILABLE:503, GATEWAY_TIMEOUT:504, HTTP_VERSION_NOT_SUPPORTED:505, QUIRK_IE_NO_CONTENT:1223}; | |
8518 | goog.net.HttpStatus.isSuccess = function $goog$net$HttpStatus$isSuccess$(status) { | |
8519 | switch(status) { | |
8520 | case goog.net.HttpStatus.OK: | |
8521 | ; | |
8522 | case goog.net.HttpStatus.CREATED: | |
8523 | ; | |
8524 | case goog.net.HttpStatus.ACCEPTED: | |
8525 | ; | |
8526 | case goog.net.HttpStatus.NO_CONTENT: | |
8527 | ; | |
8528 | case goog.net.HttpStatus.PARTIAL_CONTENT: | |
8529 | ; | |
8530 | case goog.net.HttpStatus.NOT_MODIFIED: | |
8531 | ; | |
8532 | case goog.net.HttpStatus.QUIRK_IE_NO_CONTENT: | |
8533 | return!0; | |
8534 | default: | |
8535 | return!1; | |
8536 | } | |
8537 | }; | |
8538 | goog.net.XhrLike = function $goog$net$XhrLike$() { | |
8539 | }; | |
8540 | goog.net.XhrLike.prototype.open = function $goog$net$XhrLike$$open$() { | |
8541 | }; | |
8542 | goog.net.XhrLike.prototype.send = function $goog$net$XhrLike$$send$() { | |
8543 | }; | |
8544 | goog.net.XhrLike.prototype.abort = function $goog$net$XhrLike$$abort$() { | |
8545 | }; | |
8546 | goog.net.XhrLike.prototype.setRequestHeader = function $goog$net$XhrLike$$setRequestHeader$() { | |
8547 | }; | |
8548 | goog.net.XmlHttpFactory = function $goog$net$XmlHttpFactory$() { | |
8549 | }; | |
8550 | goog.net.XmlHttpFactory.prototype.cachedOptions_ = null; | |
8551 | goog.net.XmlHttpFactory.prototype.getOptions = function $goog$net$XmlHttpFactory$$getOptions$() { | |
8552 | return this.cachedOptions_ || (this.cachedOptions_ = this.internalGetOptions()); | |
8553 | }; | |
8554 | goog.net.WrapperXmlHttpFactory = function $goog$net$WrapperXmlHttpFactory$(xhrFactory, optionsFactory) { | |
8555 | this.xhrFactory_ = xhrFactory; | |
8556 | this.optionsFactory_ = optionsFactory; | |
8557 | }; | |
8558 | goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory); | |
8559 | goog.net.WrapperXmlHttpFactory.prototype.createInstance = function $goog$net$WrapperXmlHttpFactory$$createInstance$() { | |
8560 | return this.xhrFactory_(); | |
8561 | }; | |
8562 | goog.net.WrapperXmlHttpFactory.prototype.getOptions = function $goog$net$WrapperXmlHttpFactory$$getOptions$() { | |
8563 | return this.optionsFactory_(); | |
8564 | }; | |
8565 | goog.net.XmlHttp = function $goog$net$XmlHttp$() { | |
8566 | return goog.net.XmlHttp.factory_.createInstance(); | |
8567 | }; | |
8568 | goog.net.XmlHttp.ASSUME_NATIVE_XHR = !1; | |
8569 | goog.net.XmlHttpDefines = {}; | |
8570 | goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR = !1; | |
8571 | goog.net.XmlHttp.getOptions = function $goog$net$XmlHttp$getOptions$() { | |
8572 | return goog.net.XmlHttp.factory_.getOptions(); | |
8573 | }; | |
8574 | goog.net.XmlHttp.OptionType = {USE_NULL_FUNCTION:0, LOCAL_REQUEST_ERROR:1}; | |
8575 | goog.net.XmlHttp.ReadyState = {UNINITIALIZED:0, LOADING:1, LOADED:2, INTERACTIVE:3, COMPLETE:4}; | |
8576 | goog.net.XmlHttp.setFactory = function $goog$net$XmlHttp$setFactory$(factory, optionsFactory) { | |
8577 | goog.net.XmlHttp.setGlobalFactory(new goog.net.WrapperXmlHttpFactory(goog.asserts.assert(factory), goog.asserts.assert(optionsFactory))); | |
8578 | }; | |
8579 | goog.net.XmlHttp.setGlobalFactory = function $goog$net$XmlHttp$setGlobalFactory$(factory) { | |
8580 | goog.net.XmlHttp.factory_ = factory; | |
8581 | }; | |
8582 | goog.net.DefaultXmlHttpFactory = function $goog$net$DefaultXmlHttpFactory$() { | |
8583 | }; | |
8584 | goog.inherits(goog.net.DefaultXmlHttpFactory, goog.net.XmlHttpFactory); | |
8585 | goog.net.DefaultXmlHttpFactory.prototype.createInstance = function $goog$net$DefaultXmlHttpFactory$$createInstance$() { | |
8586 | var progId = this.getProgId_(); | |
8587 | return progId ? new ActiveXObject(progId) : new XMLHttpRequest; | |
8588 | }; | |
8589 | goog.net.DefaultXmlHttpFactory.prototype.internalGetOptions = function $goog$net$DefaultXmlHttpFactory$$internalGetOptions$() { | |
8590 | var progId = this.getProgId_(), options = {}; | |
8591 | progId && (options[goog.net.XmlHttp.OptionType.USE_NULL_FUNCTION] = !0, options[goog.net.XmlHttp.OptionType.LOCAL_REQUEST_ERROR] = !0); | |
8592 | return options; | |
8593 | }; | |
8594 | goog.net.DefaultXmlHttpFactory.prototype.getProgId_ = function $goog$net$DefaultXmlHttpFactory$$getProgId_$() { | |
8595 | if (goog.net.XmlHttp.ASSUME_NATIVE_XHR || goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR) { | |
8596 | return ""; | |
8597 | } | |
8598 | if (!this.ieProgId_ && "undefined" == typeof XMLHttpRequest && "undefined" != typeof ActiveXObject) { | |
8599 | for (var ACTIVE_X_IDENTS = ["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], i = 0;i < ACTIVE_X_IDENTS.length;i++) { | |
8600 | var candidate = ACTIVE_X_IDENTS[i]; | |
8601 | try { | |
8602 | return new ActiveXObject(candidate), this.ieProgId_ = candidate; | |
8603 | } catch (e) { | |
8604 | } | |
8605 | } | |
8606 | throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed"); | |
8607 | } | |
8608 | return this.ieProgId_; | |
8609 | }; | |
8610 | goog.net.XmlHttp.setGlobalFactory(new goog.net.DefaultXmlHttpFactory); | |
8611 | goog.net.XhrIo = function $goog$net$XhrIo$(opt_xmlHttpFactory) { | |
8612 | goog.events.EventTarget.call(this); | |
8613 | this.headers = new goog.structs.Map; | |
8614 | this.xmlHttpFactory_ = opt_xmlHttpFactory || null; | |
8615 | this.active_ = !1; | |
8616 | this.xhrOptions_ = this.xhr_ = null; | |
8617 | this.lastError_ = this.lastMethod_ = this.lastUri_ = ""; | |
8618 | this.inAbort_ = this.inOpen_ = this.inSend_ = this.errorDispatched_ = !1; | |
8619 | this.timeoutInterval_ = 0; | |
8620 | this.timeoutId_ = null; | |
8621 | this.responseType_ = goog.net.XhrIo.ResponseType.DEFAULT; | |
8622 | this.useXhr2Timeout_ = this.withCredentials_ = !1; | |
8623 | }; | |
8624 | goog.inherits(goog.net.XhrIo, goog.events.EventTarget); | |
8625 | goog.net.XhrIo.ResponseType = {DEFAULT:"", TEXT:"text", DOCUMENT:"document", BLOB:"blob", ARRAY_BUFFER:"arraybuffer"}; | |
8626 | goog.net.XhrIo.prototype.logger_ = goog.log.getLogger("goog.net.XhrIo"); | |
8627 | goog.net.XhrIo.CONTENT_TYPE_HEADER = "Content-Type"; | |
8628 | goog.net.XhrIo.HTTP_SCHEME_PATTERN = /^https?$/i; | |
8629 | goog.net.XhrIo.METHODS_WITH_FORM_DATA = ["POST", "PUT"]; | |
8630 | goog.net.XhrIo.FORM_CONTENT_TYPE = "application/x-www-form-urlencoded;charset=utf-8"; | |
8631 | goog.net.XhrIo.XHR2_TIMEOUT_ = "timeout"; | |
8632 | goog.net.XhrIo.XHR2_ON_TIMEOUT_ = "ontimeout"; | |
8633 | goog.net.XhrIo.sendInstances_ = []; | |
8634 | goog.net.XhrIo.send = function $goog$net$XhrIo$send$(url, opt_callback, opt_method, opt_content, opt_headers, opt_timeoutInterval, opt_withCredentials) { | |
8635 | var x = new goog.net.XhrIo; | |
8636 | goog.net.XhrIo.sendInstances_.push(x); | |
8637 | opt_callback && x.listen(goog.net.EventType.COMPLETE, opt_callback); | |
8638 | x.listenOnce(goog.net.EventType.READY, x.cleanupSend_); | |
8639 | opt_timeoutInterval && x.setTimeoutInterval(opt_timeoutInterval); | |
8640 | opt_withCredentials && x.setWithCredentials(opt_withCredentials); | |
8641 | x.send(url, opt_method, opt_content, opt_headers); | |
8642 | }; | |
8643 | goog.net.XhrIo.cleanup = function $goog$net$XhrIo$cleanup$() { | |
8644 | for (var instances = goog.net.XhrIo.sendInstances_;instances.length;) { | |
8645 | instances.pop().dispose(); | |
8646 | } | |
8647 | }; | |
8648 | goog.net.XhrIo.protectEntryPoints = function $goog$net$XhrIo$protectEntryPoints$(errorHandler) { | |
8649 | goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = errorHandler.protectEntryPoint(goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_); | |
8650 | }; | |
8651 | goog.net.XhrIo.prototype.cleanupSend_ = function $goog$net$XhrIo$$cleanupSend_$() { | |
8652 | this.dispose(); | |
8653 | goog.array.remove(goog.net.XhrIo.sendInstances_, this); | |
8654 | }; | |
8655 | goog.net.XhrIo.prototype.setTimeoutInterval = function $goog$net$XhrIo$$setTimeoutInterval$(ms) { | |
8656 | this.timeoutInterval_ = Math.max(0, ms); | |
8657 | }; | |
8658 | goog.net.XhrIo.prototype.setWithCredentials = function $goog$net$XhrIo$$setWithCredentials$(withCredentials) { | |
8659 | this.withCredentials_ = withCredentials; | |
8660 | }; | |
8661 | goog.net.XhrIo.prototype.send = function $goog$net$XhrIo$$send$(url, opt_method, opt_content, opt_headers) { | |
8662 | if (this.xhr_) { | |
8663 | throw Error("[goog.net.XhrIo] Object is active with another request=" + this.lastUri_ + "; newUri=" + url); | |
8664 | } | |
8665 | var method = opt_method ? opt_method.toUpperCase() : "GET"; | |
8666 | this.lastUri_ = url; | |
8667 | this.lastError_ = ""; | |
8668 | this.lastMethod_ = method; | |
8669 | this.errorDispatched_ = !1; | |
8670 | this.active_ = !0; | |
8671 | this.xhr_ = this.createXhr(); | |
8672 | this.xhrOptions_ = this.xmlHttpFactory_ ? this.xmlHttpFactory_.getOptions() : goog.net.XmlHttp.getOptions(); | |
8673 | this.xhr_.onreadystatechange = goog.bind(this.onReadyStateChange_, this); | |
8674 | try { | |
8675 | goog.log.fine(this.logger_, this.formatMsg_("Opening Xhr")), this.inOpen_ = !0, this.xhr_.open(method, String(url), !0), this.inOpen_ = !1; | |
8676 | } catch (err) { | |
8677 | goog.log.fine(this.logger_, this.formatMsg_("Error opening Xhr: " + err.message)); | |
8678 | this.error_(goog.net.ErrorCode.EXCEPTION, err); | |
8679 | return; | |
8680 | } | |
8681 | var content = opt_content || "", headers = this.headers.clone(); | |
8682 | opt_headers && goog.structs.forEach(opt_headers, function(value, key) { | |
8683 | headers.set(key, value); | |
8684 | }); | |
8685 | var contentTypeKey = goog.array.find(headers.getKeys(), goog.net.XhrIo.isContentTypeHeader_), contentIsFormData = goog.global.FormData && content instanceof goog.global.FormData; | |
8686 | !goog.array.contains(goog.net.XhrIo.METHODS_WITH_FORM_DATA, method) || contentTypeKey || contentIsFormData || headers.set(goog.net.XhrIo.CONTENT_TYPE_HEADER, goog.net.XhrIo.FORM_CONTENT_TYPE); | |
8687 | headers.forEach(function(value, key) { | |
8688 | this.xhr_.setRequestHeader(key, value); | |
8689 | }, this); | |
8690 | this.responseType_ && (this.xhr_.responseType = this.responseType_); | |
8691 | goog.object.containsKey(this.xhr_, "withCredentials") && (this.xhr_.withCredentials = this.withCredentials_); | |
8692 | try { | |
8693 | this.cleanUpTimeoutTimer_(), 0 < this.timeoutInterval_ && (this.useXhr2Timeout_ = goog.net.XhrIo.shouldUseXhr2Timeout_(this.xhr_), goog.log.fine(this.logger_, this.formatMsg_("Will abort after " + this.timeoutInterval_ + "ms if incomplete, xhr2 " + this.useXhr2Timeout_)), this.useXhr2Timeout_ ? (this.xhr_[goog.net.XhrIo.XHR2_TIMEOUT_] = this.timeoutInterval_, this.xhr_[goog.net.XhrIo.XHR2_ON_TIMEOUT_] = goog.bind(this.timeout_, this)) : this.timeoutId_ = goog.Timer.callOnce(this.timeout_, this.timeoutInterval_, | |
8694 | this)), goog.log.fine(this.logger_, this.formatMsg_("Sending request")), this.inSend_ = !0, this.xhr_.send(content), this.inSend_ = !1; | |
8695 | } catch (err$$0) { | |
8696 | goog.log.fine(this.logger_, this.formatMsg_("Send error: " + err$$0.message)), this.error_(goog.net.ErrorCode.EXCEPTION, err$$0); | |
8697 | } | |
8698 | }; | |
8699 | goog.net.XhrIo.shouldUseXhr2Timeout_ = function $goog$net$XhrIo$shouldUseXhr2Timeout_$(xhr) { | |
8700 | return goog.userAgent.IE && goog.userAgent.isVersionOrHigher(9) && goog.isNumber(xhr[goog.net.XhrIo.XHR2_TIMEOUT_]) && goog.isDef(xhr[goog.net.XhrIo.XHR2_ON_TIMEOUT_]); | |
8701 | }; | |
8702 | goog.net.XhrIo.isContentTypeHeader_ = function $goog$net$XhrIo$isContentTypeHeader_$(header) { | |
8703 | return goog.string.caseInsensitiveEquals(goog.net.XhrIo.CONTENT_TYPE_HEADER, header); | |
8704 | }; | |
8705 | goog.net.XhrIo.prototype.createXhr = function $goog$net$XhrIo$$createXhr$() { | |
8706 | return this.xmlHttpFactory_ ? this.xmlHttpFactory_.createInstance() : goog.net.XmlHttp(); | |
8707 | }; | |
8708 | goog.net.XhrIo.prototype.timeout_ = function $goog$net$XhrIo$$timeout_$() { | |
8709 | "undefined" != typeof goog && this.xhr_ && (this.lastError_ = "Timed out after " + this.timeoutInterval_ + "ms, aborting", goog.log.fine(this.logger_, this.formatMsg_(this.lastError_)), this.dispatchEvent(goog.net.EventType.TIMEOUT), this.abort(goog.net.ErrorCode.TIMEOUT)); | |
8710 | }; | |
8711 | goog.net.XhrIo.prototype.error_ = function $goog$net$XhrIo$$error_$(errorCode, err) { | |
8712 | this.active_ = !1; | |
8713 | this.xhr_ && (this.inAbort_ = !0, this.xhr_.abort(), this.inAbort_ = !1); | |
8714 | this.lastError_ = err; | |
8715 | this.dispatchErrors_(); | |
8716 | this.cleanUpXhr_(); | |
8717 | }; | |
8718 | goog.net.XhrIo.prototype.dispatchErrors_ = function $goog$net$XhrIo$$dispatchErrors_$() { | |
8719 | this.errorDispatched_ || (this.errorDispatched_ = !0, this.dispatchEvent(goog.net.EventType.COMPLETE), this.dispatchEvent(goog.net.EventType.ERROR)); | |
8720 | }; | |
8721 | goog.net.XhrIo.prototype.abort = function $goog$net$XhrIo$$abort$() { | |
8722 | this.xhr_ && this.active_ && (goog.log.fine(this.logger_, this.formatMsg_("Aborting")), this.active_ = !1, this.inAbort_ = !0, this.xhr_.abort(), this.inAbort_ = !1, this.dispatchEvent(goog.net.EventType.COMPLETE), this.dispatchEvent(goog.net.EventType.ABORT), this.cleanUpXhr_()); | |
8723 | }; | |
8724 | goog.net.XhrIo.prototype.disposeInternal = function $goog$net$XhrIo$$disposeInternal$() { | |
8725 | this.xhr_ && (this.active_ && (this.active_ = !1, this.inAbort_ = !0, this.xhr_.abort(), this.inAbort_ = !1), this.cleanUpXhr_(!0)); | |
8726 | goog.net.XhrIo.superClass_.disposeInternal.call(this); | |
8727 | }; | |
8728 | goog.net.XhrIo.prototype.onReadyStateChange_ = function $goog$net$XhrIo$$onReadyStateChange_$() { | |
8729 | if (!this.isDisposed()) { | |
8730 | if (this.inOpen_ || this.inSend_ || this.inAbort_) { | |
8731 | this.onReadyStateChangeHelper_(); | |
8732 | } else { | |
8733 | this.onReadyStateChangeEntryPoint_(); | |
8734 | } | |
8735 | } | |
8736 | }; | |
8737 | goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = function $goog$net$XhrIo$$onReadyStateChangeEntryPoint_$() { | |
8738 | this.onReadyStateChangeHelper_(); | |
8739 | }; | |
8740 | goog.net.XhrIo.prototype.onReadyStateChangeHelper_ = function $goog$net$XhrIo$$onReadyStateChangeHelper_$() { | |
8741 | if (this.active_ && "undefined" != typeof goog) { | |
8742 | if (this.xhrOptions_[goog.net.XmlHttp.OptionType.LOCAL_REQUEST_ERROR] && this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE && 2 == this.getStatus()) { | |
8743 | goog.log.fine(this.logger_, this.formatMsg_("Local request error detected and ignored")); | |
8744 | } else { | |
8745 | if (this.inSend_ && this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE) { | |
8746 | goog.Timer.callOnce(this.onReadyStateChange_, 0, this); | |
8747 | } else { | |
8748 | if (this.dispatchEvent(goog.net.EventType.READY_STATE_CHANGE), this.isComplete()) { | |
8749 | goog.log.fine(this.logger_, this.formatMsg_("Request complete")); | |
8750 | this.active_ = !1; | |
8751 | try { | |
8752 | this.isSuccess() ? (this.dispatchEvent(goog.net.EventType.COMPLETE), this.dispatchEvent(goog.net.EventType.SUCCESS)) : (this.lastError_ = this.getStatusText() + " [" + this.getStatus() + "]", this.dispatchErrors_()); | |
8753 | } finally { | |
8754 | this.cleanUpXhr_(); | |
8755 | } | |
8756 | } | |
8757 | } | |
8758 | } | |
8759 | } | |
8760 | }; | |
8761 | goog.net.XhrIo.prototype.cleanUpXhr_ = function $goog$net$XhrIo$$cleanUpXhr_$(opt_fromDispose) { | |
8762 | if (this.xhr_) { | |
8763 | this.cleanUpTimeoutTimer_(); | |
8764 | var xhr = this.xhr_, clearedOnReadyStateChange = this.xhrOptions_[goog.net.XmlHttp.OptionType.USE_NULL_FUNCTION] ? goog.nullFunction : null; | |
8765 | this.xhrOptions_ = this.xhr_ = null; | |
8766 | opt_fromDispose || this.dispatchEvent(goog.net.EventType.READY); | |
8767 | try { | |
8768 | xhr.onreadystatechange = clearedOnReadyStateChange; | |
8769 | } catch (e) { | |
8770 | goog.log.error(this.logger_, "Problem encountered resetting onreadystatechange: " + e.message); | |
8771 | } | |
8772 | } | |
8773 | }; | |
8774 | goog.net.XhrIo.prototype.cleanUpTimeoutTimer_ = function $goog$net$XhrIo$$cleanUpTimeoutTimer_$() { | |
8775 | this.xhr_ && this.useXhr2Timeout_ && (this.xhr_[goog.net.XhrIo.XHR2_ON_TIMEOUT_] = null); | |
8776 | goog.isNumber(this.timeoutId_) && (goog.Timer.clear(this.timeoutId_), this.timeoutId_ = null); | |
8777 | }; | |
8778 | goog.net.XhrIo.prototype.isActive = function $goog$net$XhrIo$$isActive$() { | |
8779 | return!!this.xhr_; | |
8780 | }; | |
8781 | goog.net.XhrIo.prototype.isComplete = function $goog$net$XhrIo$$isComplete$() { | |
8782 | return this.getReadyState() == goog.net.XmlHttp.ReadyState.COMPLETE; | |
8783 | }; | |
8784 | goog.net.XhrIo.prototype.isSuccess = function $goog$net$XhrIo$$isSuccess$() { | |
8785 | var status = this.getStatus(); | |
8786 | return goog.net.HttpStatus.isSuccess(status) || 0 === status && !this.isLastUriEffectiveSchemeHttp_(); | |
8787 | }; | |
8788 | goog.net.XhrIo.prototype.isLastUriEffectiveSchemeHttp_ = function $goog$net$XhrIo$$isLastUriEffectiveSchemeHttp_$() { | |
8789 | var scheme = goog.uri.utils.getEffectiveScheme(String(this.lastUri_)); | |
8790 | return goog.net.XhrIo.HTTP_SCHEME_PATTERN.test(scheme); | |
8791 | }; | |
8792 | goog.net.XhrIo.prototype.getReadyState = function $goog$net$XhrIo$$getReadyState$() { | |
8793 | return this.xhr_ ? this.xhr_.readyState : goog.net.XmlHttp.ReadyState.UNINITIALIZED; | |
8794 | }; | |
8795 | goog.net.XhrIo.prototype.getStatus = function $goog$net$XhrIo$$getStatus$() { | |
8796 | try { | |
8797 | return this.getReadyState() > goog.net.XmlHttp.ReadyState.LOADED ? this.xhr_.status : -1; | |
8798 | } catch (e) { | |
8799 | return-1; | |
8800 | } | |
8801 | }; | |
8802 | goog.net.XhrIo.prototype.getStatusText = function $goog$net$XhrIo$$getStatusText$() { | |
8803 | try { | |
8804 | return this.getReadyState() > goog.net.XmlHttp.ReadyState.LOADED ? this.xhr_.statusText : ""; | |
8805 | } catch (e) { | |
8806 | return goog.log.fine(this.logger_, "Can not get status: " + e.message), ""; | |
8807 | } | |
8808 | }; | |
8809 | goog.net.XhrIo.prototype.formatMsg_ = function $goog$net$XhrIo$$formatMsg_$(msg) { | |
8810 | return msg + " [" + this.lastMethod_ + " " + this.lastUri_ + " " + this.getStatus() + "]"; | |
8811 | }; | |
8812 | goog.debug.entryPointRegistry.register(function(transformer) { | |
8813 | goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_ = transformer(goog.net.XhrIo.prototype.onReadyStateChangeEntryPoint_); | |
8814 | }); | |
8815 | goog.userAgent.product = {}; | |
8816 | goog.userAgent.product.ASSUME_FIREFOX = !1; | |
8817 | goog.userAgent.product.ASSUME_CAMINO = !1; | |
8818 | goog.userAgent.product.ASSUME_IPHONE = !1; | |
8819 | goog.userAgent.product.ASSUME_IPAD = !1; | |
8820 | goog.userAgent.product.ASSUME_ANDROID = !1; | |
8821 | goog.userAgent.product.ASSUME_CHROME = !1; | |
8822 | goog.userAgent.product.ASSUME_SAFARI = !1; | |
8823 | goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_CAMINO || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI; | |
8824 | goog.userAgent.product.init_ = function $goog$userAgent$product$init_$() { | |
8825 | goog.userAgent.product.detectedFirefox_ = !1; | |
8826 | goog.userAgent.product.detectedCamino_ = !1; | |
8827 | goog.userAgent.product.detectedIphone_ = !1; | |
8828 | goog.userAgent.product.detectedIpad_ = !1; | |
8829 | goog.userAgent.product.detectedAndroid_ = !1; | |
8830 | goog.userAgent.product.detectedChrome_ = !1; | |
8831 | goog.userAgent.product.detectedSafari_ = !1; | |
8832 | var ua = goog.userAgent.getUserAgentString(); | |
8833 | ua && (-1 != ua.indexOf("Firefox") ? goog.userAgent.product.detectedFirefox_ = !0 : -1 != ua.indexOf("Camino") ? goog.userAgent.product.detectedCamino_ = !0 : -1 != ua.indexOf("iPhone") || -1 != ua.indexOf("iPod") ? goog.userAgent.product.detectedIphone_ = !0 : -1 != ua.indexOf("iPad") ? goog.userAgent.product.detectedIpad_ = !0 : -1 != ua.indexOf("Chrome") ? goog.userAgent.product.detectedChrome_ = !0 : -1 != ua.indexOf("Android") ? goog.userAgent.product.detectedAndroid_ = !0 : -1 != ua.indexOf("Safari") && | |
8834 | (goog.userAgent.product.detectedSafari_ = !0)); | |
8835 | }; | |
8836 | goog.userAgent.product.PRODUCT_KNOWN_ || goog.userAgent.product.init_(); | |
8837 | goog.userAgent.product.OPERA = goog.userAgent.OPERA; | |
8838 | goog.userAgent.product.IE = goog.userAgent.IE; | |
8839 | goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.userAgent.product.detectedFirefox_; | |
8840 | goog.userAgent.product.CAMINO = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CAMINO : goog.userAgent.product.detectedCamino_; | |
8841 | goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.detectedIphone_; | |
8842 | goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.userAgent.product.detectedIpad_; | |
8843 | goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.userAgent.product.detectedAndroid_; | |
8844 | goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.userAgent.product.detectedChrome_; | |
8845 | goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.detectedSafari_; | |
8846 | goog.userAgent.product.determineVersion_ = function $goog$userAgent$product$determineVersion_$() { | |
8847 | if (goog.userAgent.product.FIREFOX) { | |
8848 | return goog.userAgent.product.getFirstRegExpGroup_(/Firefox\/([0-9.]+)/); | |
8849 | } | |
8850 | if (goog.userAgent.product.IE || goog.userAgent.product.OPERA) { | |
8851 | return goog.userAgent.VERSION; | |
8852 | } | |
8853 | if (goog.userAgent.product.CHROME) { | |
8854 | return goog.userAgent.product.getFirstRegExpGroup_(/Chrome\/([0-9.]+)/); | |
8855 | } | |
8856 | if (goog.userAgent.product.SAFARI) { | |
8857 | return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/); | |
8858 | } | |
8859 | if (goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) { | |
8860 | var arr = goog.userAgent.product.execRegExp_(/Version\/(\S+).*Mobile\/(\S+)/); | |
8861 | if (arr) { | |
8862 | return arr[1] + "." + arr[2]; | |
8863 | } | |
8864 | } else { | |
8865 | if (goog.userAgent.product.ANDROID) { | |
8866 | var version = goog.userAgent.product.getFirstRegExpGroup_(/Android\s+([0-9.]+)/); | |
8867 | return version ? version : goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/); | |
8868 | } | |
8869 | if (goog.userAgent.product.CAMINO) { | |
8870 | return goog.userAgent.product.getFirstRegExpGroup_(/Camino\/([0-9.]+)/); | |
8871 | } | |
8872 | } | |
8873 | return ""; | |
8874 | }; | |
8875 | goog.userAgent.product.getFirstRegExpGroup_ = function $goog$userAgent$product$getFirstRegExpGroup_$(re) { | |
8876 | var arr = goog.userAgent.product.execRegExp_(re); | |
8877 | return arr ? arr[1] : ""; | |
8878 | }; | |
8879 | goog.userAgent.product.execRegExp_ = function $goog$userAgent$product$execRegExp_$(re) { | |
8880 | return re.exec(goog.userAgent.getUserAgentString()); | |
8881 | }; | |
8882 | goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_(); | |
8883 | goog.userAgent.product.isVersion = function $goog$userAgent$product$isVersion$(version) { | |
8884 | return 0 <= goog.string.compareVersions(goog.userAgent.product.VERSION, version); | |
8885 | }; | |
8886 | i18n.input.net = {}; | |
8887 | i18n.input.net.AsyncHttpRequest = function $i18n$input$net$AsyncHttpRequest$(url, payload, opt_data) { | |
8888 | this.url = url; | |
8889 | this.data = opt_data ? opt_data : null; | |
8890 | }; | |
8891 | i18n.input.net.AsyncHttpService = function $i18n$input$net$AsyncHttpService$() { | |
8892 | }; | |
8893 | i18n.input.net.AsyncHttpService.DEFAULT_SERVER_URL = "https://inputtools.google.com"; | |
8894 | i18n.input.net.AsyncHttpRequest.JSON_HEADER = goog.object.create(goog.net.XhrIo.CONTENT_TYPE_HEADER, "application/json; charset=UTF-8"); | |
8895 | i18n.input.net.AsyncHttpService.isCORSSupported = function $i18n$input$net$AsyncHttpService$isCORSSupported$() { | |
8896 | return goog.userAgent.product.CHROME && goog.userAgent.product.isVersion(25) || goog.userAgent.product.IE && goog.userAgent.product.isVersion(8) || goog.userAgent.product.FIREFOX && goog.userAgent.product.isVersion(19) || goog.userAgent.product.OPERA && goog.userAgent.product.isVersion(12.1) || goog.userAgent.product.SAFARI && goog.userAgent.product.isVersion(5.1) || goog.userAgent.product.IPAD && goog.userAgent.product.isVersion(3.2) || goog.userAgent.product.ANDROID && goog.userAgent.product.isVersion(2.1); | |
8897 | }; | |
8898 | i18n.input.net.AsyncHttpService.isHandwritingSupported = function $i18n$input$net$AsyncHttpService$isHandwritingSupported$() { | |
8899 | return goog.userAgent.product.IE ? goog.userAgent.product.isVersion(9) : i18n.input.net.AsyncHttpService.isCORSSupported(); | |
8900 | }; | |
8901 | i18n.input.net.JsonpService = function $i18n$input$net$JsonpService$(opt_server, opt_callbackParam) { | |
8902 | goog.Disposable.call(this); | |
8903 | this.server_ = opt_server || i18n.input.net.AsyncHttpService.DEFAULT_SERVER_URL; | |
8904 | this.callbackParam_ = opt_callbackParam || i18n.input.net.JsonpService.CALLBACK_PARAM; | |
8905 | this.statSession_ = i18n.input.common.Statistics.getInstance().getSession(i18n.input.common.Metrics.Type.POPUP_EDITOR); | |
8906 | }; | |
8907 | goog.inherits(i18n.input.net.JsonpService, goog.Disposable); | |
8908 | i18n.input.net.JsonpService.CALLBACK_PARAM = "cb"; | |
8909 | i18n.input.net.JsonpService.prototype.timeStamp_ = 0; | |
8910 | i18n.input.net.JsonpService.prototype.disposeInternal = function $i18n$input$net$JsonpService$$disposeInternal$() { | |
8911 | this.jsonp_ && this.abort(this.pendingRequestId_); | |
8912 | this.jsonp_ = null; | |
8913 | }; | |
8914 | i18n.input.net.JsonpService.prototype.send = function $i18n$input$net$JsonpService$$send$(url, payload, callback, opt_handler) { | |
8915 | this.pendingRequestId_ && this.abort(this.pendingRequestId_); | |
8916 | url = this.server_ + url; | |
8917 | var jsonpId = url + "&" + this.callbackParam_; | |
8918 | jsonpId != this.jsonpId_ && (this.jsonp_ = new goog.net.Jsonp(url, this.callbackParam_), this.jsonpId_ = jsonpId); | |
8919 | payload && goog.Uri.QueryData.createFromMap(payload); | |
8920 | var handlerCallback = goog.bind(callback, opt_handler), requestId = this.jsonp_.send(payload, goog.bind(this.responseHandler_, this, handlerCallback, !0), goog.bind(this.responseHandler_, this, handlerCallback, !1)); | |
8921 | this.pendingRequestId_ = {reqId:requestId, key:this.jsonpId_}; | |
8922 | this.timeStamp_ = goog.now(); | |
8923 | return this.pendingRequestId_; | |
8924 | }; | |
8925 | i18n.input.net.JsonpService.prototype.abort = function $i18n$input$net$JsonpService$$abort$(id) { | |
8926 | id.key == this.jsonpId_ && this.jsonp_.cancel(id.reqId); | |
8927 | }; | |
8928 | i18n.input.net.JsonpService.prototype.responseHandler_ = function $i18n$input$net$JsonpService$$responseHandler_$(callback, isSuccess, responseJson) { | |
8929 | isSuccess && this.statSession_.push(i18n.input.common.Metrics.Param.QUERY_LATENCY, goog.now() - this.timeStamp_); | |
8930 | callback(isSuccess, isSuccess ? responseJson : null); | |
8931 | this.pendingRequestId_ = null; | |
8932 | }; | |
8933 | i18n.input.chrome.inputview.DataSource = function $i18n$input$chrome$inputview$DataSource$(numOfCanddiate) { | |
8934 | goog.events.EventTarget.call(this); | |
8935 | this.numOfCandidate = numOfCanddiate; | |
8936 | }; | |
8937 | goog.inherits(i18n.input.chrome.inputview.DataSource, goog.events.EventTarget); | |
8938 | i18n.input.chrome.inputview.DataSource.prototype.setLanguage = function $i18n$input$chrome$inputview$DataSource$$setLanguage$(language) { | |
8939 | this.language = language; | |
8940 | }; | |
8941 | i18n.input.chrome.inputview.DataSource.prototype.createCommonPayload = function $i18n$input$chrome$inputview$DataSource$$createCommonPayload$() { | |
8942 | return{itc:this.language + "-t-i0-und", num:this.numOfCandidate}; | |
8943 | }; | |
8944 | i18n.input.chrome.inputview.DataSource.prototype.sendAutoComplete = goog.functions.NULL; | |
8945 | i18n.input.chrome.inputview.DataSource.prototype.sendAutoPrediction = goog.functions.NULL; | |
8946 | i18n.input.chrome.inputview.DataSource.EventType = {AUTO_COMPLETE:"ac$16", AUTO_PREDICTION:"ap$17"}; | |
8947 | i18n.input.chrome.inputview.DataSource.AutoCompleteEvent = function $i18n$input$chrome$inputview$DataSource$AutoCompleteEvent$(source, candidates, matchedLengths) { | |
8948 | goog.events.Event.call(this, i18n.input.chrome.inputview.DataSource.EventType.AUTO_COMPLETE); | |
8949 | this.source = source; | |
8950 | this.candidates = candidates; | |
8951 | this.matchedLengths = matchedLengths; | |
8952 | }; | |
8953 | goog.inherits(i18n.input.chrome.inputview.DataSource.AutoCompleteEvent, goog.events.Event); | |
8954 | i18n.input.chrome.inputview.DataSource.prototype.isReady = function $i18n$input$chrome$inputview$DataSource$$isReady$() { | |
8955 | return!1; | |
8956 | }; | |
8957 | i18n.input.chrome.inputview.DataSource.AutoPredictionEvent = function $i18n$input$chrome$inputview$DataSource$AutoPredictionEvent$(candidates) { | |
8958 | goog.events.Event.call(this, i18n.input.chrome.inputview.DataSource.EventType.AUTO_PREDICTION); | |
8959 | this.candidates = candidates; | |
8960 | }; | |
8961 | goog.inherits(i18n.input.chrome.inputview.DataSource.AutoPredictionEvent, goog.events.Event); | |
8962 | i18n.input.chrome.inputview.Weightable = function $i18n$input$chrome$inputview$Weightable$() { | |
8963 | }; | |
8964 | i18n.input.chrome.inputview.VerticalLayout = function $i18n$input$chrome$inputview$VerticalLayout$(id, opt_eventTarget, opt_type) { | |
8965 | var type = opt_type || i18n.input.chrome.inputview.ElementType.VERTICAL_LAYOUT; | |
8966 | i18n.input.chrome.inputview.Element.call(this, id, type, opt_eventTarget); | |
8967 | }; | |
8968 | goog.inherits(i18n.input.chrome.inputview.VerticalLayout, i18n.input.chrome.inputview.Element); | |
8969 | i18n.input.chrome.inputview.VerticalLayout.prototype.heightInWeight_ = 0; | |
8970 | i18n.input.chrome.inputview.VerticalLayout.prototype.widthInWeight_ = 0; | |
8971 | i18n.input.chrome.inputview.VerticalLayout.prototype.createDom = function $i18n$input$chrome$inputview$VerticalLayout$$createDom$() { | |
8972 | i18n.input.chrome.inputview.VerticalLayout.superClass_.createDom.call(this); | |
8973 | goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.VERTICAL_LAYOUT); | |
8974 | }; | |
8975 | i18n.input.chrome.inputview.VerticalLayout.prototype.enterDocument = function $i18n$input$chrome$inputview$VerticalLayout$$enterDocument$() { | |
8976 | i18n.input.chrome.inputview.VerticalLayout.superClass_.enterDocument.call(this); | |
8977 | this.calculate_(); | |
8978 | }; | |
8979 | i18n.input.chrome.inputview.VerticalLayout.prototype.calculate_ = function $i18n$input$chrome$inputview$VerticalLayout$$calculate_$() { | |
8980 | for (var i = 0;i < this.getChildCount();i++) { | |
8981 | var child = this.getChildAt(i); | |
8982 | this.widthInWeight_ < child.getWidthInWeight() && (this.widthInWeight_ = child.getWidthInWeight()); | |
8983 | this.heightInWeight_ += child.getHeightInWeight(); | |
8984 | } | |
8985 | }; | |
8986 | i18n.input.chrome.inputview.VerticalLayout.prototype.getHeightInWeight = function $i18n$input$chrome$inputview$VerticalLayout$$getHeightInWeight$() { | |
8987 | return this.heightInWeight_; | |
8988 | }; | |
8989 | i18n.input.chrome.inputview.VerticalLayout.prototype.getWidthInWeight = function $i18n$input$chrome$inputview$VerticalLayout$$getWidthInWeight$() { | |
8990 | return this.widthInWeight_; | |
8991 | }; | |
8992 | i18n.input.chrome.inputview.VerticalLayout.prototype.resize = function $i18n$input$chrome$inputview$VerticalLayout$$resize$(width, height) { | |
8993 | i18n.input.chrome.inputview.VerticalLayout.superClass_.resize.call(this, width, height); | |
8994 | this.getElement().style.width = width + "px"; | |
8995 | for (var weightArray = [], i = 0;i < this.getChildCount();i++) { | |
8996 | var child = this.getChildAt(i); | |
8997 | weightArray.push(child.getHeightInWeight()); | |
8998 | } | |
8999 | for (var splitedHeight = i18n.input.chrome.inputview.util.splitValue(weightArray, height), i = 0;i < this.getChildCount();i++) { | |
9000 | child = this.getChildAt(i), child.resize(width, splitedHeight[i]); | |
9001 | } | |
9002 | }; | |
9003 | i18n.input.chrome.inputview.KeyboardView = function $i18n$input$chrome$inputview$KeyboardView$(id, opt_eventTarget) { | |
9004 | i18n.input.chrome.inputview.VerticalLayout.call(this, id, opt_eventTarget, i18n.input.chrome.inputview.ElementType.LAYOUT_VIEW); | |
9005 | }; | |
9006 | goog.inherits(i18n.input.chrome.inputview.KeyboardView, i18n.input.chrome.inputview.VerticalLayout); | |
9007 | i18n.input.chrome.inputview.KeyboardView.SQUARED_NEARBY_FACTOR_ = 1.2; | |
9008 | i18n.input.chrome.inputview.KeyboardView.prototype.createDom = function $i18n$input$chrome$inputview$KeyboardView$$createDom$() { | |
9009 | i18n.input.chrome.inputview.KeyboardView.superClass_.createDom.call(this); | |
9010 | var elem = this.getElement(); | |
9011 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.LAYOUT_VIEW); | |
9012 | }; | |
9013 | i18n.input.chrome.inputview.KeyboardView.prototype.setUp = function $i18n$input$chrome$inputview$KeyboardView$$setUp$(softKeyList, softKeyViewMap, mapping) { | |
9014 | this.softKeyMap_ = {}; | |
9015 | this.softKeyViewMap_ = softKeyViewMap; | |
9016 | for (var i = 0;i < softKeyList.length;i++) { | |
9017 | var sk = softKeyList[i], skv = this.softKeyViewMap_[mapping[sk.id]]; | |
9018 | skv && skv.bindSoftKey(sk); | |
9019 | this.softKeyMap_[sk.id] = sk; | |
9020 | } | |
9021 | }; | |
9022 | i18n.input.chrome.inputview.KeyboardView.prototype.getViewForKey = function $i18n$input$chrome$inputview$KeyboardView$$getViewForKey$(code) { | |
9023 | return code ? this.softKeyMap_[code] : null; | |
9024 | }; | |
9025 | i18n.input.chrome.inputview.KeyboardView.prototype.setUpNearbyKeys_ = function $i18n$input$chrome$inputview$KeyboardView$$setUpNearbyKeys_$() { | |
9026 | for (var softKeys = goog.object.getValues(this.softKeyMap_), i = 0;i < softKeys.length;i++) { | |
9027 | var key1 = softKeys[i]; | |
9028 | if (this.isQualifiedForSpatial_(key1)) { | |
9029 | for (var j = i + 1;j < softKeys.length;j++) { | |
9030 | var key2 = softKeys[j]; | |
9031 | this.isQualifiedForSpatial_(key2) && this.isNearby(key1, key2) && (key1.nearbyKeys.push(key2), key2.nearbyKeys.push(key1)); | |
9032 | } | |
9033 | } | |
9034 | } | |
9035 | }; | |
9036 | i18n.input.chrome.inputview.KeyboardView.prototype.isQualifiedForSpatial_ = function $i18n$input$chrome$inputview$KeyboardView$$isQualifiedForSpatial_$(key) { | |
9037 | return key.type == i18n.input.chrome.inputview.ElementType.CHARACTER_KEY || key.type == i18n.input.chrome.inputview.ElementType.COMPACT_KEY; | |
9038 | }; | |
9039 | i18n.input.chrome.inputview.KeyboardView.prototype.isNearby = function $i18n$input$chrome$inputview$KeyboardView$$isNearby$(key1, key2) { | |
9040 | var key2Center = key2.centerCoordinate, key1Left = key1.topLeftCoordinate.x, key1Right = key1Left + key1.width, key1Top = key1.topLeftCoordinate.y, key1Bottom = key1Top + key1.height, edgeX = key2Center.x < key1Left ? key1Left : key2Center.x > key1Right ? key1Right : key2Center.x, edgeY = key2Center.y < key1Top ? key1Top : key2Center.y > key1Bottom ? key1Bottom : key2Center.y, dx = key2Center.x - edgeX, dy = key2Center.y - edgeY; | |
9041 | return dx * dx + dy * dy < i18n.input.chrome.inputview.KeyboardView.SQUARED_NEARBY_FACTOR_ * key1.width * key1.width; | |
9042 | }; | |
9043 | i18n.input.chrome.inputview.KeyboardView.prototype.resize = function $i18n$input$chrome$inputview$KeyboardView$$resize$(width, height) { | |
9044 | i18n.input.chrome.inputview.KeyboardView.superClass_.resize.call(this, width, height); | |
9045 | this.setUpNearbyKeys_(); | |
9046 | }; | |
9047 | i18n.input.chrome.inputview.LinearLayout = function $i18n$input$chrome$inputview$LinearLayout$(id, opt_eventTarget) { | |
9048 | i18n.input.chrome.inputview.Element.call(this, id, i18n.input.chrome.inputview.ElementType.LINEAR_LAYOUT, opt_eventTarget); | |
9049 | }; | |
9050 | goog.inherits(i18n.input.chrome.inputview.LinearLayout, i18n.input.chrome.inputview.Element); | |
9051 | i18n.input.chrome.inputview.LinearLayout.prototype.heightInWeight_ = 0; | |
9052 | i18n.input.chrome.inputview.LinearLayout.prototype.widthInWeight_ = 0; | |
9053 | i18n.input.chrome.inputview.LinearLayout.prototype.createDom = function $i18n$input$chrome$inputview$LinearLayout$$createDom$() { | |
9054 | i18n.input.chrome.inputview.LinearLayout.superClass_.createDom.call(this); | |
9055 | goog.dom.classes.add(this.getElement(), i18n.input.chrome.inputview.Css.LINEAR_LAYOUT); | |
9056 | }; | |
9057 | i18n.input.chrome.inputview.LinearLayout.prototype.enterDocument = function $i18n$input$chrome$inputview$LinearLayout$$enterDocument$() { | |
9058 | i18n.input.chrome.inputview.LinearLayout.superClass_.enterDocument.call(this); | |
9059 | this.calculate_(); | |
9060 | }; | |
9061 | i18n.input.chrome.inputview.LinearLayout.prototype.calculate_ = function $i18n$input$chrome$inputview$LinearLayout$$calculate_$() { | |
9062 | for (var i = 0;i < this.getChildCount();i++) { | |
9063 | var child = this.getChildAt(i); | |
9064 | this.heightInWeight_ < child.getHeightInWeight() && (this.heightInWeight_ = child.getHeightInWeight()); | |
9065 | this.widthInWeight_ += child.getWidthInWeight(); | |
9066 | } | |
9067 | }; | |
9068 | i18n.input.chrome.inputview.LinearLayout.prototype.getHeightInWeight = function $i18n$input$chrome$inputview$LinearLayout$$getHeightInWeight$() { | |
9069 | return this.heightInWeight_; | |
9070 | }; | |
9071 | i18n.input.chrome.inputview.LinearLayout.prototype.getWidthInWeight = function $i18n$input$chrome$inputview$LinearLayout$$getWidthInWeight$() { | |
9072 | return this.widthInWeight_; | |
9073 | }; | |
9074 | i18n.input.chrome.inputview.LinearLayout.prototype.resize = function $i18n$input$chrome$inputview$LinearLayout$$resize$(width, height) { | |
9075 | i18n.input.chrome.inputview.LinearLayout.superClass_.resize.call(this, width, height); | |
9076 | for (var weightArray = [], i = 0;i < this.getChildCount();i++) { | |
9077 | var child = this.getChildAt(i); | |
9078 | weightArray.push(child.getWidthInWeight()); | |
9079 | } | |
9080 | for (var splitedWidth = i18n.input.chrome.inputview.util.splitValue(weightArray, width), i = 0;i < this.getChildCount();i++) { | |
9081 | child = this.getChildAt(i), child.resize(splitedWidth[i], height); | |
9082 | } | |
9083 | }; | |
9084 | i18n.input.chrome.inputview.FunctionalKey = function $i18n$input$chrome$inputview$FunctionalKey$(id, type, text, iconCssClass, opt_eventTarget) { | |
9085 | i18n.input.chrome.inputview.SoftKey.call(this, id, type, opt_eventTarget); | |
9086 | this.text = text; | |
9087 | this.iconCssClass_ = iconCssClass; | |
9088 | }; | |
9089 | goog.inherits(i18n.input.chrome.inputview.FunctionalKey, i18n.input.chrome.inputview.SoftKey); | |
9090 | i18n.input.chrome.inputview.FunctionalKey.prototype.createDom = function $i18n$input$chrome$inputview$FunctionalKey$$createDom$() { | |
9091 | i18n.input.chrome.inputview.FunctionalKey.superClass_.createDom.call(this); | |
9092 | var dom = this.getDomHelper(), elem = this.getElement(); | |
9093 | this.bgElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.SPECIAL_KEY_BG); | |
9094 | dom.appendChild(elem, this.bgElem); | |
9095 | this.tableCell = dom.createDom(goog.dom.TagName.DIV); | |
9096 | goog.dom.classes.add(this.tableCell, i18n.input.chrome.inputview.Css.MODIFIER); | |
9097 | this.text && (this.textElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.SPECIAL_KEY_NAME, this.text), dom.appendChild(this.tableCell, this.textElem)); | |
9098 | if (this.iconCssClass_) { | |
9099 | var iconElem = dom.createDom(goog.dom.TagName.DIV, this.iconCssClass_); | |
9100 | dom.appendChild(this.tableCell, iconElem); | |
9101 | } | |
9102 | dom.appendChild(this.bgElem, this.tableCell); | |
9103 | }; | |
9104 | i18n.input.chrome.inputview.FunctionalKey.prototype.resize = function $i18n$input$chrome$inputview$FunctionalKey$$resize$(width, height) { | |
9105 | i18n.input.chrome.inputview.FunctionalKey.superClass_.resize.call(this, width, height); | |
9106 | this.tableCell.style.paddingLeft = "15px"; | |
9107 | this.tableCell.style.paddingRight = "15px"; | |
9108 | this.tableCell.style.width = this.availableWidth - 30 + "px"; | |
9109 | this.tableCell.style.height = this.availableHeight + "px"; | |
9110 | }; | |
9111 | i18n.input.chrome.inputview.FunctionalKey.prototype.setHighlighted = function $i18n$input$chrome$inputview$FunctionalKey$$setHighlighted$(highlight) { | |
9112 | highlight ? goog.dom.classes.add(this.bgElem, i18n.input.chrome.inputview.Css.SPECIAL_KEY_HIGHLIGHT) : goog.dom.classes.remove(this.bgElem, i18n.input.chrome.inputview.Css.SPECIAL_KEY_HIGHLIGHT); | |
9113 | }; | |
9114 | i18n.input.chrome.inputview.ModifierKey = function $i18n$input$chrome$inputview$ModifierKey$(id, name, iconCssClass, toState, stateManager, supportSticky, opt_eventTarget) { | |
9115 | i18n.input.chrome.inputview.FunctionalKey.call(this, id, i18n.input.chrome.inputview.ElementType.MODIFIER_KEY, name, iconCssClass, opt_eventTarget); | |
9116 | this.toState = toState; | |
9117 | this.stateManager_ = stateManager; | |
9118 | if (this.supportSticky = supportSticky) { | |
9119 | this.pointerConfig.dblClick = !0, this.pointerConfig.longPressWithoutPointerUp = !0; | |
9120 | } | |
9121 | }; | |
9122 | goog.inherits(i18n.input.chrome.inputview.ModifierKey, i18n.input.chrome.inputview.FunctionalKey); | |
9123 | i18n.input.chrome.inputview.ModifierKey.prototype.createDom = function $i18n$input$chrome$inputview$ModifierKey$$createDom$() { | |
9124 | i18n.input.chrome.inputview.ModifierKey.superClass_.createDom.call(this); | |
9125 | if (this.toState == i18n.input.chrome.inputview.StateType.CAPSLOCK || this.supportSticky) { | |
9126 | var dom = this.getDomHelper(); | |
9127 | this.dotIcon_ = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.CAPSLOCK_DOT); | |
9128 | dom.appendChild(this.tableCell, this.dotIcon_); | |
9129 | } | |
9130 | }; | |
9131 | i18n.input.chrome.inputview.ModifierKey.prototype.update = function $i18n$input$chrome$inputview$ModifierKey$$update$() { | |
9132 | var isStateEnabled = this.stateManager_.hasState(this.toState), isSticky = this.stateManager_.isSticky(this.toState); | |
9133 | this.setHighlighted(isStateEnabled); | |
9134 | this.dotIcon_ && (isStateEnabled && isSticky ? goog.dom.classes.add(this.dotIcon_, i18n.input.chrome.inputview.Css.CAPSLOCK_DOT_HIGHLIGHT) : goog.dom.classes.remove(this.dotIcon_, i18n.input.chrome.inputview.Css.CAPSLOCK_DOT_HIGHLIGHT)); | |
9135 | }; | |
9136 | i18n.input.chrome.inputview.SoftKeyView = function $i18n$input$chrome$inputview$SoftKeyView$(id, opt_widthInWeight, opt_heightInWeight, opt_condition, opt_giveWeightTo, opt_eventTarget) { | |
9137 | i18n.input.chrome.inputview.Element.call(this, id, i18n.input.chrome.inputview.ElementType.SOFT_KEY_VIEW, opt_eventTarget); | |
9138 | this.widthInWeight = opt_widthInWeight || 1; | |
9139 | this.heightInWeight = opt_heightInWeight || 1; | |
9140 | this.giveWeightTo = opt_giveWeightTo || ""; | |
9141 | }; | |
9142 | goog.inherits(i18n.input.chrome.inputview.SoftKeyView, i18n.input.chrome.inputview.Element); | |
9143 | i18n.input.chrome.inputview.SoftKeyView.prototype.dynamicaGrantedWeight = 0; | |
9144 | i18n.input.chrome.inputview.SoftKeyView.prototype.createDom = function $i18n$input$chrome$inputview$SoftKeyView$$createDom$() { | |
9145 | i18n.input.chrome.inputview.SoftKeyView.superClass_.createDom.call(this); | |
9146 | var elem = this.getElement(); | |
9147 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.SOFT_KEY_VIEW); | |
9148 | }; | |
9149 | i18n.input.chrome.inputview.SoftKeyView.prototype.getWidthInWeight = function $i18n$input$chrome$inputview$SoftKeyView$$getWidthInWeight$() { | |
9150 | return this.isVisible() ? this.widthInWeight + this.dynamicaGrantedWeight : 0; | |
9151 | }; | |
9152 | i18n.input.chrome.inputview.SoftKeyView.prototype.getHeightInWeight = function $i18n$input$chrome$inputview$SoftKeyView$$getHeightInWeight$() { | |
9153 | return this.isVisible() ? this.heightInWeight : 0; | |
9154 | }; | |
9155 | i18n.input.chrome.inputview.SoftKeyView.prototype.resize = function $i18n$input$chrome$inputview$SoftKeyView$$resize$(width, height) { | |
9156 | i18n.input.chrome.inputview.SoftKeyView.superClass_.resize.call(this, width, height); | |
9157 | var elem = this.getElement(); | |
9158 | elem.style.width = width + "px"; | |
9159 | elem.style.height = height + "px"; | |
9160 | this.softKey && this.softKey.resize(width, height); | |
9161 | }; | |
9162 | i18n.input.chrome.inputview.SoftKeyView.prototype.bindSoftKey = function $i18n$input$chrome$inputview$SoftKeyView$$bindSoftKey$(softKey) { | |
9163 | this.softKey = softKey; | |
9164 | this.removeChildren(!0); | |
9165 | this.addChild(softKey, !0); | |
9166 | }; | |
9167 | i18n.input.chrome.inputview.SpaceKey = function $i18n$input$chrome$inputview$SpaceKey$(id, stateManager, title, opt_characters, opt_eventTarget) { | |
9168 | i18n.input.chrome.inputview.FunctionalKey.call(this, id, i18n.input.chrome.inputview.ElementType.SPACE_KEY, title, "", opt_eventTarget); | |
9169 | this.characters_ = opt_characters || []; | |
9170 | this.stateManager_ = stateManager; | |
9171 | }; | |
9172 | goog.inherits(i18n.input.chrome.inputview.SpaceKey, i18n.input.chrome.inputview.FunctionalKey); | |
9173 | i18n.input.chrome.inputview.SpaceKey.prototype.createDom = function $i18n$input$chrome$inputview$SpaceKey$$createDom$() { | |
9174 | i18n.input.chrome.inputview.SpaceKey.superClass_.createDom.call(this); | |
9175 | goog.dom.classes.remove(this.bgElem, i18n.input.chrome.inputview.Css.SPECIAL_KEY_BG); | |
9176 | }; | |
9177 | i18n.input.chrome.inputview.SpaceKey.prototype.getCharacter = function $i18n$input$chrome$inputview$SpaceKey$$getCharacter$() { | |
9178 | if (this.characters_) { | |
9179 | var index = this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT) ? 1 : 0 + this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.ALTGR) ? 2 : 0; | |
9180 | if (this.characters_.length > index && this.characters_[index]) { | |
9181 | return this.characters_[index]; | |
9182 | } | |
9183 | } | |
9184 | return " "; | |
9185 | }; | |
9186 | i18n.input.chrome.inputview.SpaceKey.prototype.setTitleVisible = function $i18n$input$chrome$inputview$SpaceKey$$setTitleVisible$(visible) { | |
9187 | goog.dom.setTextContent(this.textElem, visible ? this.text : ""); | |
9188 | }; | |
9189 | i18n.input.chrome.inputview.SpecNodeName = {ALIGN:"align", CHARACTERS:"characters", CHILDREN:"children", CONDITION:"condition", DIRECTION:"direction", FULL_HEIGHT_IN_WEIGHT:"fullHeightInWeight", GIVE_WEIGHT_TO:"giveWeightTo", HAS_ALTGR_KEY:"hasAltGrKey", HEIGHT:"height", HEIGHT_IN_WEIGHT:"heightInWeight", HEIGHT_PERCENT:"heightPercent", HINT_TEXT:"hintText", ICON_CSS_CLASS:"iconCssClass", ID:"id", IS_GREY:"isGrey", LAYOUT:"layout", LAYOUT_ID:"layoutID", HEIGHT_PERCENT_OF_WIDTH:"heightPercentOfWidth", | |
9190 | MARGIN_LEFT_PERCENT:"marginLeftPercent", MINIMUM_HEIGHT:"minimumHeight", NUMBER_ROW_WEIGHT:"numberRowWeight", KEY_LIST:"keyList", MAPPING:"mapping", NAME:"name", PADDING:"padding", RECORD:"record", SUPPORT_STICKY:"supportSticky", SPEC:"spec", TEXT:"text", TITLE:"title", TYPE:"type", TO_STATE:"toState", TO_KEYSET:"toKeyset", WIDTH:"width", WIDTH_IN_WEIGHT:"widthInWeight", WIDTH_PERCENT:"widthPercent"}; | |
9191 | i18n.input.chrome.inputview.StateManager = function $i18n$input$chrome$inputview$StateManager$() { | |
9192 | this.chording_ = this.stateKeyDown_ = this.sticky_ = this.state_ = 0; | |
9193 | }; | |
9194 | i18n.input.chrome.inputview.StateManager.prototype.setKeyDown = function $i18n$input$chrome$inputview$StateManager$$setKeyDown$(stateType, isKeyDown) { | |
9195 | isKeyDown ? this.stateKeyDown_ |= stateType : (this.stateKeyDown_ &= ~stateType, this.chording_ &= ~stateType); | |
9196 | }; | |
9197 | i18n.input.chrome.inputview.StateManager.prototype.triggerChording = function $i18n$input$chrome$inputview$StateManager$$triggerChording$() { | |
9198 | this.chording_ |= this.stateKeyDown_; | |
9199 | }; | |
9200 | i18n.input.chrome.inputview.StateManager.prototype.isChording = function $i18n$input$chrome$inputview$StateManager$$isChording$(stateType) { | |
9201 | return 0 != (this.chording_ & stateType); | |
9202 | }; | |
9203 | i18n.input.chrome.inputview.StateManager.prototype.setSticky = function $i18n$input$chrome$inputview$StateManager$$setSticky$(stateType, isSticky) { | |
9204 | this.sticky_ = isSticky ? this.sticky_ | stateType : this.sticky_ & ~stateType; | |
9205 | }; | |
9206 | i18n.input.chrome.inputview.StateManager.prototype.isSticky = function $i18n$input$chrome$inputview$StateManager$$isSticky$(stateType) { | |
9207 | return 0 != (this.sticky_ & stateType); | |
9208 | }; | |
9209 | i18n.input.chrome.inputview.StateManager.prototype.setState = function $i18n$input$chrome$inputview$StateManager$$setState$(stateType, enable) { | |
9210 | this.state_ = enable ? this.state_ | stateType : this.state_ & ~stateType; | |
9211 | }; | |
9212 | i18n.input.chrome.inputview.StateManager.prototype.hasState = function $i18n$input$chrome$inputview$StateManager$$hasState$(stateType) { | |
9213 | return 0 != (this.state_ & stateType); | |
9214 | }; | |
9215 | i18n.input.chrome.inputview.StateManager.prototype.getState = function $i18n$input$chrome$inputview$StateManager$$getState$() { | |
9216 | return this.state_; | |
9217 | }; | |
9218 | i18n.input.chrome.inputview.StateManager.prototype.clearUnstickyState = function $i18n$input$chrome$inputview$StateManager$$clearUnstickyState$() { | |
9219 | this.state_ &= this.sticky_; | |
9220 | }; | |
9221 | i18n.input.chrome.inputview.StateManager.prototype.hasUnStickyState = function $i18n$input$chrome$inputview$StateManager$$hasUnStickyState$() { | |
9222 | return this.state_ != this.sticky_; | |
9223 | }; | |
9224 | i18n.input.chrome.inputview.StateManager.prototype.reset = function $i18n$input$chrome$inputview$StateManager$$reset$() { | |
9225 | this.sticky_ = this.state_ = 0; | |
9226 | }; | |
9227 | i18n.input.chrome.inputview.ChromeVoxHandler = function $i18n$input$chrome$inputview$ChromeVoxHandler$(stateManager) { | |
9228 | this.announcer_ = new goog.a11y.aria.Announcer; | |
9229 | this.stateManager_ = stateManager; | |
9230 | }; | |
9231 | goog.inherits(i18n.input.chrome.inputview.ChromeVoxHandler, goog.Disposable); | |
9232 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPITAL = "capital"; | |
9233 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_BACKSPACE = "backspace"; | |
9234 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_TAB = "tab"; | |
9235 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ENTER = "enter"; | |
9236 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SPACE = "space"; | |
9237 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SHIFT_ON = "shift on"; | |
9238 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SHIFT_OFF = "shift off"; | |
9239 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPSLOCK_ON = "capslock on"; | |
9240 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPSLOCK_OFF = "capslock off"; | |
9241 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALTGR_ON = "alter on"; | |
9242 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALTGR_OFF = "alter off"; | |
9243 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CTRL_ON = "ctrl on"; | |
9244 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CTRL_OFF = "ctrl off"; | |
9245 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALT_ON = "alt on"; | |
9246 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALT_OFF = "alt off"; | |
9247 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_LEFT_ARROW = "left arrow"; | |
9248 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_RIGHT_ARROW = "right arrow"; | |
9249 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_UP_ARROW = "up arrow"; | |
9250 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_DOWN_ARROW = "down arrow"; | |
9251 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_HIDE_KEYBOARD = "hide keyboard"; | |
9252 | i18n.input.chrome.inputview.ChromeVoxHandler.MSG_IS_SELECTED = "is selected"; | |
9253 | i18n.input.chrome.inputview.ChromeVoxHandler.prototype.handleCandidateEvent = function $i18n$input$chrome$inputview$ChromeVoxHandler$$handleCandidateEvent$(candidate) { | |
9254 | this.announcer_.say(candidate + i18n.input.chrome.inputview.ChromeVoxHandler.MSG_IS_SELECTED, goog.a11y.aria.LivePriority.ASSERTIVE); | |
9255 | }; | |
9256 | i18n.input.chrome.inputview.ChromeVoxHandler.prototype.handleKeyEvent = function $i18n$input$chrome$inputview$ChromeVoxHandler$$handleKeyEvent$(key) { | |
9257 | var message; | |
9258 | switch(key.type) { | |
9259 | case i18n.input.chrome.inputview.ElementType.CHARACTER_KEY: | |
9260 | var ch = key.getActiveCharacter(); | |
9261 | message = ch; | |
9262 | key.isLetterKey && i18n.input.chrome.inputview.util.toUpper(ch) == ch && (message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPITAL + ch); | |
9263 | break; | |
9264 | case i18n.input.chrome.inputview.ElementType.BACKSPACE_KEY: | |
9265 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_BACKSPACE; | |
9266 | break; | |
9267 | case i18n.input.chrome.inputview.ElementType.SPACE_KEY: | |
9268 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SPACE; | |
9269 | break; | |
9270 | case i18n.input.chrome.inputview.ElementType.TAB_KEY: | |
9271 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_TAB; | |
9272 | break; | |
9273 | case i18n.input.chrome.inputview.ElementType.ENTER_KEY: | |
9274 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ENTER; | |
9275 | break; | |
9276 | case i18n.input.chrome.inputview.ElementType.MODIFIER_KEY: | |
9277 | var toState = key.toState, isStateEnabled = this.stateManager_.hasState(toState); | |
9278 | switch(toState) { | |
9279 | case i18n.input.chrome.inputview.StateType.SHIFT: | |
9280 | message = isStateEnabled ? i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SHIFT_ON : i18n.input.chrome.inputview.ChromeVoxHandler.MSG_SHIFT_OFF; | |
9281 | break; | |
9282 | case i18n.input.chrome.inputview.StateType.ALTGR: | |
9283 | message = isStateEnabled ? i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALTGR_ON : i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALTGR_OFF; | |
9284 | break; | |
9285 | case i18n.input.chrome.inputview.StateType.CAPSLOCK: | |
9286 | message = isStateEnabled ? i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPSLOCK_ON : i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CAPSLOCK_OFF; | |
9287 | break; | |
9288 | case i18n.input.chrome.inputview.StateType.CTRL: | |
9289 | message = isStateEnabled ? i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CTRL_ON : i18n.input.chrome.inputview.ChromeVoxHandler.MSG_CTRL_OFF; | |
9290 | break; | |
9291 | case i18n.input.chrome.inputview.StateType.ALT: | |
9292 | message = isStateEnabled ? i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALT_ON : i18n.input.chrome.inputview.ChromeVoxHandler.MSG_ALT_OFF; | |
9293 | } | |
9294 | break; | |
9295 | case i18n.input.chrome.inputview.ElementType.ARROW_UP: | |
9296 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_UP_ARROW; | |
9297 | break; | |
9298 | case i18n.input.chrome.inputview.ElementType.ARROW_DOWN: | |
9299 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_DOWN_ARROW; | |
9300 | break; | |
9301 | case i18n.input.chrome.inputview.ElementType.ARROW_LEFT: | |
9302 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_LEFT_ARROW; | |
9303 | break; | |
9304 | case i18n.input.chrome.inputview.ElementType.ARROW_RIGHT: | |
9305 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_RIGHT_ARROW; | |
9306 | break; | |
9307 | case i18n.input.chrome.inputview.ElementType.HIDE_KEYBOARD_KEY: | |
9308 | message = i18n.input.chrome.inputview.ChromeVoxHandler.MSG_HIDE_KEYBOARD; | |
9309 | } | |
9310 | message && this.announcer_.say(message, goog.a11y.aria.LivePriority.ASSERTIVE); | |
9311 | }; | |
9312 | i18n.input.chrome.inputview.ConditionName = {SHOW_TITLE_BAR:"showTitleBar", SHOW_COMPACT_LAYOUT_SWITCHER:"showCompactLayoutSwitcher", SHOW_ALTGR:"showAltGr"}; | |
9313 | i18n.input.chrome.inputview.M17nCodes = "ar bn_phone deva_phone ethi fa gu_phone kn_phone ml_phone ta_inscript ta_itrans ta_phone ta_tamil99 ta_typewriter te_phone th th_pattajoti th_tis vi_tcvn vi_telex vi_viqr vi_vni".split(" "); | |
9314 | i18n.input.chrome.inputview.Direction = {UP:0, DOWN:1, LEFT:2, RIGHT:3}; | |
9315 | i18n.input.chrome.inputview.content = {}; | |
9316 | i18n.input.chrome.inputview.content.util = {}; | |
9317 | i18n.input.chrome.inputview.content.util.keyIdPrefix_ = "sk-"; | |
9318 | i18n.input.chrome.inputview.content.util.CompactKeysetType = {LETTER:0, NUMBER:1, MORE:2}; | |
9319 | i18n.input.chrome.inputview.content.util.createHideKeyboardKey = function $i18n$input$chrome$inputview$content$util$createHideKeyboardKey$() { | |
9320 | var spec = {}; | |
9321 | spec.iconCssClass = i18n.input.chrome.inputview.Css.HIDE_KEYBOARD_ICON; | |
9322 | spec.type = i18n.input.chrome.inputview.ElementType.HIDE_KEYBOARD_KEY; | |
9323 | spec.id = "HideKeyboard"; | |
9324 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9325 | }; | |
9326 | i18n.input.chrome.inputview.content.util.createShiftKey = function $i18n$input$chrome$inputview$content$util$createShiftKey$(isLeft, opt_supportSticky) { | |
9327 | var spec = {}; | |
9328 | spec.toState = i18n.input.chrome.inputview.StateType.SHIFT; | |
9329 | spec.iconCssClass = i18n.input.chrome.inputview.Css.SHIFT_ICON; | |
9330 | spec.type = i18n.input.chrome.inputview.ElementType.MODIFIER_KEY; | |
9331 | spec.id = isLeft ? "ShiftLeft" : "ShiftRight"; | |
9332 | spec.supportSticky = opt_supportSticky; | |
9333 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9334 | }; | |
9335 | i18n.input.chrome.inputview.content.util.createCtrlKey = function $i18n$input$chrome$inputview$content$util$createCtrlKey$() { | |
9336 | var spec = {}; | |
9337 | spec.toState = i18n.input.chrome.inputview.StateType.CTRL; | |
9338 | spec.name = "ctrl"; | |
9339 | spec.type = i18n.input.chrome.inputview.ElementType.MODIFIER_KEY; | |
9340 | spec.id = "ControlLeft"; | |
9341 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9342 | }; | |
9343 | i18n.input.chrome.inputview.content.util.createAltKey = function $i18n$input$chrome$inputview$content$util$createAltKey$() { | |
9344 | var spec = {}; | |
9345 | spec.toState = i18n.input.chrome.inputview.StateType.ALT; | |
9346 | spec.name = "alt"; | |
9347 | spec.type = i18n.input.chrome.inputview.ElementType.MODIFIER_KEY; | |
9348 | spec.id = "AltLeft"; | |
9349 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9350 | }; | |
9351 | i18n.input.chrome.inputview.content.util.createAltgrKey = function $i18n$input$chrome$inputview$content$util$createAltgrKey$() { | |
9352 | var spec = {}; | |
9353 | spec.toState = i18n.input.chrome.inputview.StateType.ALTGR; | |
9354 | spec.name = "altgr"; | |
9355 | spec.type = i18n.input.chrome.inputview.ElementType.MODIFIER_KEY; | |
9356 | spec.id = "AltRight"; | |
9357 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9358 | }; | |
9359 | i18n.input.chrome.inputview.content.util.createCapslockKey = function $i18n$input$chrome$inputview$content$util$createCapslockKey$() { | |
9360 | var spec = {}; | |
9361 | spec.toState = i18n.input.chrome.inputview.StateType.CAPSLOCK; | |
9362 | spec.name = "caps"; | |
9363 | spec.type = i18n.input.chrome.inputview.ElementType.MODIFIER_KEY; | |
9364 | spec.id = "OsLeft"; | |
9365 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9366 | }; | |
9367 | i18n.input.chrome.inputview.content.util.createEnterKey = function $i18n$input$chrome$inputview$content$util$createEnterKey$() { | |
9368 | var spec = {}; | |
9369 | spec.iconCssClass = i18n.input.chrome.inputview.Css.ENTER_ICON; | |
9370 | spec.type = i18n.input.chrome.inputview.ElementType.ENTER_KEY; | |
9371 | spec.id = "Enter"; | |
9372 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9373 | }; | |
9374 | i18n.input.chrome.inputview.content.util.createTabKey = function $i18n$input$chrome$inputview$content$util$createTabKey$() { | |
9375 | var spec = {}; | |
9376 | spec.iconCssClass = i18n.input.chrome.inputview.Css.TAB_ICON; | |
9377 | spec.type = i18n.input.chrome.inputview.ElementType.TAB_KEY; | |
9378 | spec.id = "Tab"; | |
9379 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9380 | }; | |
9381 | i18n.input.chrome.inputview.content.util.createBackspaceKey = function $i18n$input$chrome$inputview$content$util$createBackspaceKey$() { | |
9382 | var spec = {}; | |
9383 | spec.iconCssClass = i18n.input.chrome.inputview.Css.BACKSPACE_ICON; | |
9384 | spec.type = i18n.input.chrome.inputview.ElementType.BACKSPACE_KEY; | |
9385 | spec.id = "Backspace"; | |
9386 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9387 | }; | |
9388 | i18n.input.chrome.inputview.content.util.createSpaceKey = function $i18n$input$chrome$inputview$content$util$createSpaceKey$() { | |
9389 | var spec = {name:" "}; | |
9390 | spec.type = i18n.input.chrome.inputview.ElementType.SPACE_KEY; | |
9391 | spec.id = "Space"; | |
9392 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9393 | }; | |
9394 | i18n.input.chrome.inputview.content.util.createNormalKey = function $i18n$input$chrome$inputview$content$util$createNormalKey$(spec) { | |
9395 | spec.type = i18n.input.chrome.inputview.ElementType.CHARACTER_KEY; | |
9396 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9397 | }; | |
9398 | i18n.input.chrome.inputview.content.util.createArrowKey = function $i18n$input$chrome$inputview$content$util$createArrowKey$(direction) { | |
9399 | var spec = {}; | |
9400 | spec.iconCssClass = i18n.input.chrome.inputview.Css.ARROW_KEY + " "; | |
9401 | direction == i18n.input.chrome.inputview.Direction.UP ? (spec.id = "ArrowUp", spec.iconCssClass += i18n.input.chrome.inputview.Css.UP_KEY, spec.type = i18n.input.chrome.inputview.ElementType.ARROW_UP) : direction == i18n.input.chrome.inputview.Direction.DOWN ? (spec.id = "ArrowDown", spec.iconCssClass += i18n.input.chrome.inputview.Css.DOWN_KEY, spec.type = i18n.input.chrome.inputview.ElementType.ARROW_DOWN) : direction == i18n.input.chrome.inputview.Direction.LEFT ? (spec.id = "ArrowLeft", spec.iconCssClass += | |
9402 | i18n.input.chrome.inputview.Css.LEFT_KEY, spec.type = i18n.input.chrome.inputview.ElementType.ARROW_LEFT) : direction == i18n.input.chrome.inputview.Direction.RIGHT && (spec.id = "ArrowRight", spec.iconCssClass += i18n.input.chrome.inputview.Css.RIGHT_KEY, spec.type = i18n.input.chrome.inputview.ElementType.ARROW_RIGHT); | |
9403 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9404 | }; | |
9405 | i18n.input.chrome.inputview.content.util.createKey = function $i18n$input$chrome$inputview$content$util$createKey$(spec) { | |
9406 | var newSpec = {}, key; | |
9407 | for (key in spec) { | |
9408 | newSpec[key] = spec[key]; | |
9409 | } | |
9410 | return{spec:newSpec}; | |
9411 | }; | |
9412 | i18n.input.chrome.inputview.content.util.KEY_CODES_101 = "Backquote Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Digit0 Minus Equal KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash".split(" "); | |
9413 | i18n.input.chrome.inputview.content.util.KEY_CODES_102 = "Backquote Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Digit0 Minus Equal KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote Backslash IntlBackslash KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash".split(" "); | |
9414 | i18n.input.chrome.inputview.content.util.createData = function $i18n$input$chrome$inputview$content$util$createData$(keyCharacters, viewIdPrefix, is102, hasAltGrKey) { | |
9415 | for (var keyList = [], mapping = {}, keyIds = is102 ? i18n.input.chrome.inputview.content.util.KEY_CODES_102 : i18n.input.chrome.inputview.content.util.KEY_CODES_101, i = 0;i < keyCharacters.length - 1;i++) { | |
9416 | var spec = {id:keyIds[i], type:i18n.input.chrome.inputview.ElementType.CHARACTER_KEY, characters:keyCharacters[i]}, key = i18n.input.chrome.inputview.content.util.createKey(spec); | |
9417 | keyList.push(key); | |
9418 | } | |
9419 | var spaceKey = i18n.input.chrome.inputview.content.util.createSpaceKey(); | |
9420 | i18n.input.chrome.inputview.content.util.insertModifierKeys_(keyList, is102, spaceKey); | |
9421 | for (i = 0;i < keyList.length;i++) { | |
9422 | key = keyList[i], mapping[key.spec.id] = viewIdPrefix + i; | |
9423 | } | |
9424 | var layout = is102 ? "102kbd" : "101kbd"; | |
9425 | return{keyList:keyList, mapping:mapping, layout:layout, hasAltGrKey:hasAltGrKey}; | |
9426 | }; | |
9427 | i18n.input.chrome.inputview.content.util.createCompactData = function $i18n$input$chrome$inputview$content$util$createCompactData$(keyCharacters, viewIdPrefix, keyIdPrefix, compactKeysetType) { | |
9428 | for (var keyList = [], mapping = {}, i = 0;i < keyCharacters.length - 1;i++) { | |
9429 | var hintText = 2 == keyCharacters[i].length ? keyCharacters[i][1] : void 0, marginLeftPercent = 10 == i ? .33 : 0, isGrey = 3 == keyCharacters[i].length ? !!keyCharacters[i][2] : !1, key = i18n.input.chrome.inputview.content.util.createCompactKey(keyIdPrefix + i, keyCharacters[i][0], hintText, marginLeftPercent, isGrey); | |
9430 | keyList.push(key); | |
9431 | } | |
9432 | var spaceKey = i18n.input.chrome.inputview.content.util.createSpaceKey(); | |
9433 | i18n.input.chrome.inputview.content.util.insertCompactModifierKeys_(keyIdPrefix, keyList, spaceKey, compactKeysetType); | |
9434 | for (i = 0;i < keyList.length;i++) { | |
9435 | key = keyList[i], mapping[key.spec.id] = viewIdPrefix + i; | |
9436 | } | |
9437 | return{keyList:keyList, mapping:mapping, layout:"compactkbd"}; | |
9438 | }; | |
9439 | i18n.input.chrome.inputview.content.util.createCompactKey = function $i18n$input$chrome$inputview$content$util$createCompactKey$(id, text, opt_hintText, opt_marginLeftPercent, opt_isGrey) { | |
9440 | var spec = {}; | |
9441 | spec.id = id; | |
9442 | spec.type = i18n.input.chrome.inputview.ElementType.COMPACT_KEY; | |
9443 | spec.text = text; | |
9444 | opt_hintText && (spec.hintText = opt_hintText); | |
9445 | opt_marginLeftPercent && (spec.marginLeftPercent = opt_marginLeftPercent); | |
9446 | spec.isGrey = !!opt_isGrey; | |
9447 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9448 | }; | |
9449 | i18n.input.chrome.inputview.content.util.createSwitcherKey = function $i18n$input$chrome$inputview$content$util$createSwitcherKey$(id, name, toKeyset, opt_iconCssClass, opt_record) { | |
9450 | var spec = {}; | |
9451 | spec.id = id; | |
9452 | spec.name = name; | |
9453 | spec.toKeyset = toKeyset; | |
9454 | spec.iconCssClass = opt_iconCssClass; | |
9455 | spec.type = i18n.input.chrome.inputview.ElementType.SWITCHER_KEY; | |
9456 | spec.record = !!opt_record; | |
9457 | return i18n.input.chrome.inputview.content.util.createKey(spec); | |
9458 | }; | |
9459 | i18n.input.chrome.inputview.content.util.insertModifierKeys_ = function $i18n$input$chrome$inputview$content$util$insertModifierKeys_$(keyList, is102, spaceKey) { | |
9460 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createBackspaceKey(), 13); | |
9461 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createTabKey(), 14); | |
9462 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createCapslockKey(), is102 ? 27 : 28); | |
9463 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createEnterKey(), 40); | |
9464 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createShiftKey(!0), 41); | |
9465 | keyList.push(i18n.input.chrome.inputview.content.util.createShiftKey(!1)); | |
9466 | keyList.push(i18n.input.chrome.inputview.content.util.createCtrlKey()); | |
9467 | keyList.push(i18n.input.chrome.inputview.content.util.createAltKey()); | |
9468 | keyList.push(i18n.input.chrome.inputview.content.util.createSwitcherKey("toCompact", "", "us.compact", i18n.input.chrome.inputview.Css.COMPACT_SWITCHER, !0)); | |
9469 | keyList.push(spaceKey); | |
9470 | keyList.push(i18n.input.chrome.inputview.content.util.createAltgrKey()); | |
9471 | keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey(i18n.input.chrome.inputview.Direction.LEFT)); | |
9472 | keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey(i18n.input.chrome.inputview.Direction.RIGHT)); | |
9473 | keyList.push(i18n.input.chrome.inputview.content.util.createHideKeyboardKey()); | |
9474 | }; | |
9475 | i18n.input.chrome.inputview.content.util.insertCompactModifierKeys_ = function $i18n$input$chrome$inputview$content$util$insertCompactModifierKeys_$(keyIdPrefix, keyList, spaceKey, compactKeysetType) { | |
9476 | var id = keyList.length; | |
9477 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createBackspaceKey(), 10); | |
9478 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createEnterKey(), 20); | |
9479 | switch(compactKeysetType) { | |
9480 | case i18n.input.chrome.inputview.content.util.CompactKeysetType.LETTER: | |
9481 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createShiftKey(!0, !0), 21); | |
9482 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createShiftKey(!1, !0), 31); | |
9483 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "?123", "us.compact.123"), 32); | |
9484 | break; | |
9485 | case i18n.input.chrome.inputview.content.util.CompactKeysetType.NUMBER: | |
9486 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "~[<", "us.compact.more"), 21); | |
9487 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "~[<", "us.compact.more"), 31); | |
9488 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "abc", "us.compact"), 32); | |
9489 | break; | |
9490 | case i18n.input.chrome.inputview.content.util.CompactKeysetType.MORE: | |
9491 | goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "?123", "us.compact.123"), 21), goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "?123", "us.compact.123"), 31), goog.array.insertAt(keyList, i18n.input.chrome.inputview.content.util.createSwitcherKey(keyIdPrefix + id++, "abc", "us.compact"), 32); | |
9492 | } | |
9493 | goog.array.insertAt(keyList, spaceKey, 35); | |
9494 | keyList.push(i18n.input.chrome.inputview.content.util.createHideKeyboardKey()); | |
9495 | }; | |
9496 | i18n.input.chrome.vk.TextInput = function $i18n$input$chrome$vk$TextInput$(context) { | |
9497 | this.context = context; | |
9498 | }; | |
9499 | i18n.input.chrome.vk.TextInput.prototype.textBeforeCursor = ""; | |
9500 | i18n.input.chrome.vk.TextInput.prototype.setContext = function $i18n$input$chrome$vk$TextInput$$setContext$(context) { | |
9501 | this.context = context; | |
9502 | }; | |
9503 | i18n.input.chrome.vk.TextInput.prototype.reset = goog.nullFunction; | |
9504 | i18n.input.chrome.vk.ComposeTextInput = function $i18n$input$chrome$vk$ComposeTextInput$(context, model) { | |
9505 | i18n.input.chrome.vk.TextInput.call(this, context); | |
9506 | this.model_ = model; | |
9507 | var nonSpacingCharSet = "\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b62\u0b63\u0b82\u0bc0\u0bcd\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc6\u0ccc\u0ccd\u0ce2\u0ce3\u0d41-\u0d44\u0d4d\u0d62\u0d63\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1bab\u1be6\u1be8\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u3099\u309a\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaec\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f", | |
9508 | otherMarkCharSet = "\u0488\u0489\u0903\u093b\u093e-\u0940\u0949-\u094c\u094e\u094f\u0982\u0983\u09be-\u09c0\u09c7\u09c8\u09cb\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb\u0acc\u0b02\u0b03\u0b3e\u0b40\u0b47\u0b48\u0b4b\u0b4c\u0b57\u0bbe\u0bbf\u0bc1\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7\u0cc8\u0cca\u0ccb\u0cd5\u0cd6\u0d02\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2\u0df3\u0f3e\u0f3f\u0f7f\u102b\u102c\u1031\u1038\u103b\u103c\u1056\u1057\u1062-\u1064\u1067-\u106d\u1083\u1084\u1087-\u108c\u108f\u109a-\u109c\u17b6\u17be-\u17c5\u17c7\u17c8\u1923-\u1926\u1929-\u192b\u1930\u1931\u1933-\u1938\u19b0-\u19c0\u19c8\u19c9\u1a19-\u1a1b\u1a55\u1a57\u1a61\u1a63\u1a64\u1a6d-\u1a72\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43\u1b44\u1b82\u1ba1\u1ba6\u1ba7\u1baa\u1bac\u1bad\u1be7\u1bea-\u1bec\u1bee\u1bf2\u1bf3\u1c24-\u1c2b\u1c34\u1c35\u1ce1\u1cf2\u1cf3\u20dd-\u20e0\u20e2-\u20e4\u302e\u302f\ua670-\ua672\ua823\ua824\ua827\ua880\ua881\ua8b4-\ua8c3\ua952\ua953\ua983\ua9b4\ua9b5\ua9ba\ua9bb\ua9bd-\ua9c0\uaa2f\uaa30\uaa33\uaa34\uaa4d\uaa7b\uaaeb\uaaee\uaaef\uaaf5\uabe3\uabe4\uabe6\uabe7\uabe9\uabea"; | |
9509 | this.reMarks_ = new RegExp("((?:A(?:NA?)+)|(?:(?:AN*)+S))$".replace(/N/g, "[" + nonSpacingCharSet + "]").replace(/S/g, "[" + otherMarkCharSet + "]").replace(/A/g, "[^" + nonSpacingCharSet + otherMarkCharSet + "]")); | |
9510 | }; | |
9511 | goog.inherits(i18n.input.chrome.vk.ComposeTextInput, i18n.input.chrome.vk.TextInput); | |
9512 | i18n.input.chrome.vk.ComposeTextInput.prototype.setComposingText_ = function $i18n$input$chrome$vk$ComposeTextInput$$setComposingText_$(text) { | |
9513 | i18n.input.chrome.vk.DeferredApi.setComposition(this.context.contextID, text, text.length); | |
9514 | this.textBeforeCursor = text; | |
9515 | }; | |
9516 | i18n.input.chrome.vk.ComposeTextInput.prototype.commitText_ = function $i18n$input$chrome$vk$ComposeTextInput$$commitText_$(text) { | |
9517 | i18n.input.chrome.vk.DeferredApi.commitText(this.context.contextID, text); | |
9518 | this.textBeforeCursor = ""; | |
9519 | }; | |
9520 | i18n.input.chrome.vk.ComposeTextInput.prototype.commitText = function $i18n$input$chrome$vk$ComposeTextInput$$commitText$(text, back) { | |
9521 | var onStage = !!this.textBeforeCursor; | |
9522 | if (!onStage && (1 == back && !text || 0 == back && " " == text)) { | |
9523 | return!1; | |
9524 | } | |
9525 | if (onStage && " " == text && 0 == back) { | |
9526 | return this.commitText_(this.textBeforeCursor + " "), this.textBeforeCursor = "", !0; | |
9527 | } | |
9528 | var len = this.textBeforeCursor.length; | |
9529 | text = this.textBeforeCursor.slice(0, len - back) + text; | |
9530 | if (!text) { | |
9531 | return this.setComposingText_(text), !0; | |
9532 | } | |
9533 | var pos = this.model_.predictHistory(); | |
9534 | if (0 < pos) { | |
9535 | var text2 = text.slice(0, pos + 1), matches = this.reMarks_.exec(text2); | |
9536 | matches && (pos = text2.length - matches[0].length); | |
9537 | } | |
9538 | 0 > pos ? (this.commitText_(text), this.model_.clearHistory()) : 0 == pos ? this.setComposingText_(text) : (i18n.input.chrome.vk.DeferredApi.commitText(this.context.contextID, text.slice(0, pos)), this.setComposingText_(text.slice(pos)), this.model_.pruneHistory(pos)); | |
9539 | return!0; | |
9540 | }; | |
9541 | i18n.input.chrome.vk.ComposeTextInput.prototype.reset = function $i18n$input$chrome$vk$ComposeTextInput$$reset$() { | |
9542 | this.textBeforeCursor && (i18n.input.chrome.vk.DeferredApi.commitText(this.context.contextID, this.textBeforeCursor), this.textBeforeCursor = ""); | |
9543 | }; | |
9544 | i18n.input.chrome.vk.KeyCode = {}; | |
9545 | i18n.input.chrome.vk.KeyCode.CODES101 = "\u00c01234567890\u00bd\u00bbQWERTYUIOP\u00db\u00dd\u00dcASDFGHJKL\u00ba\u00deZXCVBNM\u00bc\u00be\u00bf "; | |
9546 | i18n.input.chrome.vk.KeyCode.CODES102 = "\u00c01234567890\u00bd\u00bbQWERTYUIOP\u00db\u00ddASDFGHJKL\u00ba\u00de\u00dc\u00e2ZXCVBNM\u00bc\u00be\u00bf "; | |
9547 | i18n.input.chrome.vk.KeyCode.ALLCODES101 = "\u00c01234567890\u00bd\u00bb\b\tQWERTYUIOP\u00db\u00dd\u00dc\u0014ASDFGHJKL\u00ba\u00de\r\u0010ZXCVBNM\u00bc\u00be\u00bf\u0010\u0111 \u0111"; | |
9548 | i18n.input.chrome.vk.KeyCode.ALLCODES102 = "\u00c01234567890\u00bd\u00bb\b\tQWERTYUIOP\u00db\u00dd\r\u0014ASDFGHJKL\u00ba\u00de\u00dc\r\u0010\u00e2ZXCVBNM\u00bc\u00be\u00bf\u0010\u0111 \u0111"; | |
9549 | i18n.input.chrome.vk.EventType = {LAYOUT_LOADED:"lld"}; | |
9550 | i18n.input.chrome.vk.LayoutEvent = function $i18n$input$chrome$vk$LayoutEvent$(type, layoutView) { | |
9551 | goog.events.Event.call(this, type); | |
9552 | this.layoutCode = (this.layoutView = layoutView) ? layoutView.id : null; | |
9553 | }; | |
9554 | goog.inherits(i18n.input.chrome.vk.LayoutEvent, goog.events.Event); | |
9555 | i18n.input.chrome.vk.ParsedLayout = function $i18n$input$chrome$vk$ParsedLayout$(layout) { | |
9556 | this.id = layout.id; | |
9557 | this.view = {id:layout.id, title:layout.title, isRTL:"rtl" == layout.direction, is102:!!layout.is102Keyboard, mappings:goog.object.create(["", null, "s", null, "c", null, "l", null, "sc", null, "cl", null, "sl", null, "scl", null])}; | |
9558 | this.transforms = null; | |
9559 | this.parseKeyMappings_(layout); | |
9560 | this.parseTransforms_(layout); | |
9561 | }; | |
9562 | i18n.input.chrome.vk.ParsedLayout.prototype.parseKeyMappings_ = function $i18n$input$chrome$vk$ParsedLayout$$parseKeyMappings_$(layout) { | |
9563 | var codes = this.view.is102 ? i18n.input.chrome.vk.KeyCode.CODES102 : i18n.input.chrome.vk.KeyCode.CODES101, mappings = layout.mappings, m; | |
9564 | for (m in mappings) { | |
9565 | var map = mappings[m], modes = m.split(/,/); | |
9566 | modes.join(",") != m && modes.push(""); | |
9567 | var parsed = {}, from; | |
9568 | for (from in map) { | |
9569 | var to = map[from]; | |
9570 | if ("" == from && (from = codes, this.view.is102)) { | |
9571 | var normalizedTo = to.slice(0, 25), normalizedTo = normalizedTo + to.slice(26, 37), normalizedTo = normalizedTo + to.charAt(25), to = normalizedTo += to.slice(37) | |
9572 | } | |
9573 | from = from.replace("m", "\u00bd"); | |
9574 | from = from.replace("=", "\u00bb"); | |
9575 | from = from.replace(";", "\u00ba"); | |
9576 | if (1 == from.length) { | |
9577 | parsed[from] = ["S", to, to]; | |
9578 | } else { | |
9579 | for (var j = 0, i = 0, c;c = from.charAt(i);++i) { | |
9580 | var t = to.charAt(j++); | |
9581 | if (t == to.charAt(j) && "{" == t) { | |
9582 | var k = to.indexOf("}}", j); | |
9583 | if (k < j) { | |
9584 | break; | |
9585 | } | |
9586 | var s = to.slice(j + 1, k), parts = s.split("||"); | |
9587 | 3 == parts.length ? parsed[c] = parts : 1 == parts.length && (parsed[c] = ["S", s, s]); | |
9588 | j = k + 2; | |
9589 | } else { | |
9590 | parsed[c] = ["S", t, t]; | |
9591 | } | |
9592 | } | |
9593 | } | |
9594 | } | |
9595 | for (var i = 0, mode;mode = modes[i], void 0 != mode;++i) { | |
9596 | this.view.mappings[mode] = parsed; | |
9597 | } | |
9598 | } | |
9599 | }; | |
9600 | i18n.input.chrome.vk.ParsedLayout.prototype.prefixalizeRegexString_ = function $i18n$input$chrome$vk$ParsedLayout$$prefixalizeRegexString_$(re_str) { | |
9601 | re_str = re_str.replace(/\\./g, function(m) { | |
9602 | return/^\\\[/.test(m) ? "\u0001" : /^\\\]/.test(m) ? "\u0002" : m; | |
9603 | }); | |
9604 | re_str = re_str.replace(/\\.|\[[^\[\]]*\]|\{.*\}|[^\|\\\(\)\[\]\{\}\*\+\?]/g, function(m) { | |
9605 | return/^\{/.test(m) ? m : "(?:" + m + "|$)"; | |
9606 | }); | |
9607 | re_str = re_str.replace(/\u0001/g, "\\["); | |
9608 | return re_str = re_str.replace(/\u0002/g, "\\]"); | |
9609 | }; | |
9610 | i18n.input.chrome.vk.ParsedLayout.prototype.parseTransforms_ = function $i18n$input$chrome$vk$ParsedLayout$$parseTransforms_$(layout) { | |
9611 | var transforms = layout.transform; | |
9612 | if (transforms) { | |
9613 | var regobjs = [], regexesalone = [], partialRegexs = [], sum_numgrps = 1, regex; | |
9614 | for (regex in transforms) { | |
9615 | var regobj = new RegExp(regex + "$"), repl = transforms[regex]; | |
9616 | regobjs[sum_numgrps] = [regobj, repl]; | |
9617 | regexesalone.push("(" + regex + "$)"); | |
9618 | partialRegexs.push("^(" + this.prefixalizeRegexString_(regex) + ")"); | |
9619 | var grpCountRegexp = new RegExp(regex + "|.*"), numgrps = grpCountRegexp.exec("").length, sum_numgrps = sum_numgrps + numgrps; | |
9620 | } | |
9621 | var longregobj = new RegExp(regexesalone.join("|")), prefixregobj = new RegExp(partialRegexs.join("|")), prefixregobj2 = new RegExp(partialRegexs.reverse().join("|")); | |
9622 | this.transforms = [longregobj, regobjs, prefixregobj, prefixregobj2]; | |
9623 | } | |
9624 | }; | |
9625 | i18n.input.chrome.vk.ParsedLayout.prototype.predictTransform = function $i18n$input$chrome$vk$ParsedLayout$$predictTransform$(text) { | |
9626 | if (!this.transforms || !text) { | |
9627 | return-1; | |
9628 | } | |
9629 | for (var i = 0;i < text.length;i++) { | |
9630 | var s = text.slice(i - text.length), matches = s.match(this.transforms[2]); | |
9631 | if (matches && matches[0]) { | |
9632 | for (var j = 1;j < matches.length && !matches[j];j++) { | |
9633 | } | |
9634 | var matchedIndex = j; | |
9635 | if ((matches = s.match(this.transforms[3])) && matches[0]) { | |
9636 | for (j = 1;j < matches.length && !matches[j];j++) { | |
9637 | } | |
9638 | if (matchedIndex != matches.length - j) { | |
9639 | return i; | |
9640 | } | |
9641 | var re = this.transforms[1][matchedIndex][0], re = new RegExp(re.toString().match(/\/(.*)\//)[1] + "\u0001"); | |
9642 | if (!(s + "\u0001").match(re)) { | |
9643 | return i; | |
9644 | } | |
9645 | } | |
9646 | } | |
9647 | } | |
9648 | return-1; | |
9649 | }; | |
9650 | i18n.input.chrome.vk.Model = function $i18n$input$chrome$vk$Model$() { | |
9651 | goog.events.EventTarget.call(this); | |
9652 | this.layouts_ = {}; | |
9653 | this.delayActiveLayout_ = this.activeLayout_ = ""; | |
9654 | this.historyState_ = {previous:{text:"", transat:-1}, ambi:"", current:{text:"", transat:-1}}; | |
9655 | goog.exportSymbol("cros_vk_loadme", goog.bind(this.onLayoutLoaded_, this)); | |
9656 | }; | |
9657 | goog.inherits(i18n.input.chrome.vk.Model, goog.events.EventTarget); | |
9658 | i18n.input.chrome.vk.Model.prototype.loadLayout = function $i18n$input$chrome$vk$Model$$loadLayout$(layoutCode) { | |
9659 | if (layoutCode) { | |
9660 | var parsedLayout = this.layouts_[layoutCode]; | |
9661 | void 0 == parsedLayout ? (this.layouts_[layoutCode] = !1, i18n.input.chrome.vk.Model.loadLayoutScript_(layoutCode)) : parsedLayout && this.dispatchEvent(new i18n.input.chrome.vk.LayoutEvent(i18n.input.chrome.vk.EventType.LAYOUT_LOADED, parsedLayout)); | |
9662 | } | |
9663 | }; | |
9664 | i18n.input.chrome.vk.Model.prototype.activateLayout = function $i18n$input$chrome$vk$Model$$activateLayout$(layoutCode) { | |
9665 | if (layoutCode && this.activeLayout_ != layoutCode) { | |
9666 | var parsedLayout = this.layouts_[layoutCode]; | |
9667 | parsedLayout ? (this.activeLayout_ = layoutCode, this.delayActiveLayout_ = "", this.clearHistory()) : !1 == parsedLayout && (this.delayActiveLayout_ = layoutCode); | |
9668 | } | |
9669 | }; | |
9670 | i18n.input.chrome.vk.Model.prototype.predictHistory = function $i18n$input$chrome$vk$Model$$predictHistory$() { | |
9671 | if (!this.activeLayout_ || !this.layouts_[this.activeLayout_]) { | |
9672 | return-1; | |
9673 | } | |
9674 | var parsedLayout = this.layouts_[this.activeLayout_], history = this.historyState_, text, transat; | |
9675 | if (history.ambi && (text = history.previous.text, transat = history.previous.transat, text = 0 < transat ? text.slice(0, transat) + "\u001d" + text.slice(transat) + history.ambi : text + history.ambi, 0 <= parsedLayout.predictTransform(text))) { | |
9676 | return 0; | |
9677 | } | |
9678 | text = history.current.text; | |
9679 | transat = history.current.transat; | |
9680 | 0 <= transat && (text = text.slice(0, transat) + "\u001d" + text.slice(transat)); | |
9681 | var pos = parsedLayout.predictTransform(text); | |
9682 | 0 <= transat && pos > transat && pos--; | |
9683 | return pos; | |
9684 | }; | |
9685 | i18n.input.chrome.vk.Model.prototype.onLayoutLoaded_ = function $i18n$input$chrome$vk$Model$$onLayoutLoaded_$(layout) { | |
9686 | var parsedLayout = new i18n.input.chrome.vk.ParsedLayout(layout); | |
9687 | parsedLayout.id && (this.layouts_[parsedLayout.id] = parsedLayout); | |
9688 | this.delayActiveLayout_ == layout.id && (this.activateLayout(this.delayActiveLayout_), this.delayActiveLayout_ = ""); | |
9689 | this.dispatchEvent(new i18n.input.chrome.vk.LayoutEvent(i18n.input.chrome.vk.EventType.LAYOUT_LOADED, parsedLayout)); | |
9690 | }; | |
9691 | i18n.input.chrome.vk.Model.prototype.clearHistory = function $i18n$input$chrome$vk$Model$$clearHistory$() { | |
9692 | this.historyState_.ambi = ""; | |
9693 | this.historyState_.previous = {text:"", transat:-1}; | |
9694 | this.historyState_.current = goog.object.clone(this.historyState_.previous); | |
9695 | }; | |
9696 | i18n.input.chrome.vk.Model.prototype.pruneHistory = function $i18n$input$chrome$vk$Model$$pruneHistory$(count) { | |
9697 | var pruneFunc = function $pruneFunc$(his) { | |
9698 | his.text = his.text.slice(count); | |
9699 | 0 < his.transat && (his.transat -= count, 0 >= his.transat && (his.transat = -1)); | |
9700 | }; | |
9701 | pruneFunc(this.historyState_.previous); | |
9702 | pruneFunc(this.historyState_.current); | |
9703 | }; | |
9704 | i18n.input.chrome.vk.Model.loadLayoutScript_ = function $i18n$input$chrome$vk$Model$loadLayoutScript_$(layoutCode) { | |
9705 | goog.net.jsloader.load("layouts/" + layoutCode + ".js"); | |
9706 | }; | |
9707 | i18n.input.chrome.inputview.Settings = function $i18n$input$chrome$inputview$Settings$() { | |
9708 | }; | |
9709 | i18n.input.chrome.inputview.Settings.prototype.alwaysRenderAltGrCharacter = !1; | |
9710 | i18n.input.chrome.inputview.Settings.Preference = {KEY_SET:"keyset"}; | |
9711 | i18n.input.chrome.inputview.Settings.prototype.savePreference = function $i18n$input$chrome$inputview$Settings$$savePreference$(preference, value) { | |
9712 | window.localStorage.setItem(preference, value); | |
9713 | }; | |
9714 | i18n.input.chrome.inputview.Settings.prototype.getPreference = function $i18n$input$chrome$inputview$Settings$$getPreference$(preference) { | |
9715 | return window.localStorage.getItem(preference); | |
9716 | }; | |
9717 | i18n.input.chrome.inputview.M17nModel = function $i18n$input$chrome$inputview$M17nModel$() { | |
9718 | goog.events.EventTarget.call(this); | |
9719 | this.handler_ = new goog.events.EventHandler(this); | |
9720 | this.model_ = new i18n.input.chrome.vk.Model; | |
9721 | this.handler_.listen(this.model_, i18n.input.chrome.vk.EventType.LAYOUT_LOADED, this.onLayoutLoaded_); | |
9722 | }; | |
9723 | goog.inherits(i18n.input.chrome.inputview.M17nModel, goog.events.EventTarget); | |
9724 | i18n.input.chrome.inputview.M17nModel.prototype.loadConfig = function $i18n$input$chrome$inputview$M17nModel$$loadConfig$(lang) { | |
9725 | this.model_.loadLayout(lang); | |
9726 | this.model_.activateLayout(lang); | |
9727 | }; | |
9728 | i18n.input.chrome.inputview.M17nModel.prototype.onLayoutLoaded_ = function $i18n$input$chrome$inputview$M17nModel$$onLayoutLoaded_$(e) { | |
9729 | for (var layoutView = e.layoutView, is102 = layoutView.view.is102, codes = is102 ? i18n.input.chrome.vk.KeyCode.CODES102 : i18n.input.chrome.vk.KeyCode.CODES101, keyCount = is102 ? 48 : 47, keyCharacters = [], i = 0;i < keyCount;i++) { | |
9730 | var characters = this.findCharacters_(layoutView.view.mappings, codes[i]); | |
9731 | keyCharacters.push(characters); | |
9732 | } | |
9733 | keyCharacters.push([" ", " "]); | |
9734 | var hasAltGrKey = !!layoutView.view.mappings.c, skvPrefix = is102 ? "102kbd-k-" : "101kbd-k-", data = i18n.input.chrome.inputview.content.util.createData(keyCharacters, skvPrefix, is102, hasAltGrKey); | |
9735 | data && (data[i18n.input.chrome.inputview.SpecNodeName.TITLE] = layoutView.view.title, data[i18n.input.chrome.inputview.SpecNodeName.ID] = e.layoutCode, this.dispatchEvent(new i18n.input.chrome.inputview.events.ConfigLoadedEvent(data))); | |
9736 | }; | |
9737 | i18n.input.chrome.inputview.M17nModel.prototype.findCharacters_ = function $i18n$input$chrome$inputview$M17nModel$$findCharacters_$(mappings, code) { | |
9738 | for (var characters = [], states = ["", "s", "c", "sc"], i = 0;i < states.length;i++) { | |
9739 | characters[i] = mappings[states[i]] && mappings[states[i]][code] ? mappings[states[i]][code][1] : ""; | |
9740 | } | |
9741 | return characters; | |
9742 | }; | |
9743 | i18n.input.chrome.inputview.M17nModel.prototype.setContext = function $i18n$input$chrome$inputview$M17nModel$$setContext$(context) { | |
9744 | this.textInput = new i18n.input.chrome.vk.ComposeTextInput(context, this.model_); | |
9745 | }; | |
9746 | i18n.input.chrome.inputview.M17nModel.prototype.clearHistory = function $i18n$input$chrome$inputview$M17nModel$$clearHistory$() { | |
9747 | this.textInput && (this.textInput.textBeforeCursor = ""); | |
9748 | }; | |
9749 | i18n.input.chrome.inputview.M17nModel.prototype.disposeInternal = function $i18n$input$chrome$inputview$M17nModel$$disposeInternal$() { | |
9750 | goog.dispose(this.handler_); | |
9751 | i18n.input.chrome.inputview.M17nModel.superClass_.disposeInternal.call(this); | |
9752 | }; | |
9753 | i18n.input.chrome.inputview.Model = function $i18n$input$chrome$inputview$Model$() { | |
9754 | goog.events.EventTarget.call(this); | |
9755 | this.stateManager = new i18n.input.chrome.inputview.StateManager; | |
9756 | this.settings = new i18n.input.chrome.inputview.Settings; | |
9757 | goog.exportSymbol("google.ime.chrome.inputview.onLayoutLoaded", goog.bind(this.onLayoutLoaded_, this)); | |
9758 | goog.exportSymbol("google.ime.chrome.inputview.onConfigLoaded", goog.bind(this.onConfigLoaded_, this)); | |
9759 | }; | |
9760 | goog.inherits(i18n.input.chrome.inputview.Model, goog.events.EventTarget); | |
9761 | i18n.input.chrome.inputview.Model.LAYOUTS_PATH_ = "/inputview_layouts/"; | |
9762 | i18n.input.chrome.inputview.Model.CONTENT_PATH_ = "/config/"; | |
9763 | i18n.input.chrome.inputview.Model.prototype.onConfigLoaded_ = function $i18n$input$chrome$inputview$Model$$onConfigLoaded_$(data) { | |
9764 | this.dispatchEvent(new i18n.input.chrome.inputview.events.ConfigLoadedEvent(data)); | |
9765 | }; | |
9766 | i18n.input.chrome.inputview.Model.prototype.onLayoutLoaded_ = function $i18n$input$chrome$inputview$Model$$onLayoutLoaded_$(data) { | |
9767 | this.dispatchEvent(new i18n.input.chrome.inputview.events.LayoutLoadedEvent(data)); | |
9768 | }; | |
9769 | i18n.input.chrome.inputview.Model.prototype.loadLayout = function $i18n$input$chrome$inputview$Model$$loadLayout$(layout) { | |
9770 | var url = i18n.input.chrome.inputview.Model.LAYOUTS_PATH_ + layout + ".js"; | |
9771 | goog.net.jsloader.load(url); | |
9772 | }; | |
9773 | i18n.input.chrome.inputview.Model.prototype.loadConfig = function $i18n$input$chrome$inputview$Model$$loadConfig$(keyboardCode) { | |
9774 | var configId = keyboardCode.replace(/\..*$/, ""), url = i18n.input.chrome.inputview.Model.CONTENT_PATH_ + configId + ".js"; | |
9775 | goog.net.jsloader.load(url); | |
9776 | }; | |
9777 | i18n.input.chrome.inputview.OfflineDataSource = function $i18n$input$chrome$inputview$OfflineDataSource$(numOfCandidate) { | |
9778 | i18n.input.chrome.inputview.DataSource.call(this, numOfCandidate); | |
9779 | this.naclModule = null; | |
9780 | }; | |
9781 | goog.inherits(i18n.input.chrome.inputview.OfflineDataSource, i18n.input.chrome.inputview.DataSource); | |
9782 | i18n.input.chrome.inputview.OfflineDataSource.prototype.spatialCache_ = {}; | |
9783 | i18n.input.chrome.inputview.OfflineDataSource.prototype.isReady_ = !1; | |
9784 | i18n.input.chrome.inputview.OfflineDataSource.prototype.setLanguage = function $i18n$input$chrome$inputview$OfflineDataSource$$setLanguage$(language) { | |
9785 | i18n.input.chrome.inputview.OfflineDataSource.superClass_.setLanguage.call(this, language); | |
9786 | this.installNacl(); | |
9787 | }; | |
9788 | i18n.input.chrome.inputview.OfflineDataSource.prototype.installNacl = function $i18n$input$chrome$inputview$OfflineDataSource$$installNacl$() { | |
9789 | this.naclModule = document.createElement("embed"); | |
9790 | this.naclModule.width = 0; | |
9791 | this.naclModule.height = 0; | |
9792 | this.naclModule.id = "nacl_module"; | |
9793 | this.naclModule.src = "nacl_module.nmf"; | |
9794 | this.naclModule.type = "application/x-nacl"; | |
9795 | document.body.appendChild(this.naclModule); | |
9796 | this.naclModule.addEventListener("message", goog.bind(this.onResponse_, this), !0); | |
9797 | this.naclModule.addEventListener("load", goog.bind(this.onNaclLoaded_, this), !0); | |
9798 | this.naclModule.addEventListener("crash", goog.bind(this.onNaclCrash_, this), !0); | |
9799 | }; | |
9800 | i18n.input.chrome.inputview.OfflineDataSource.prototype.onNaclCrash_ = function $i18n$input$chrome$inputview$OfflineDataSource$$onNaclCrash_$() { | |
9801 | this.naclModule && this.naclModule.parentNode && (this.naclModule.parentNode.removeChild(this.naclModule), this.naclModule = null, this.isReady_ = !1); | |
9802 | goog.Timer.callOnce(this.installNacl, 1E3, this); | |
9803 | }; | |
9804 | i18n.input.chrome.inputview.OfflineDataSource.prototype.isReady = function $i18n$input$chrome$inputview$OfflineDataSource$$isReady$() { | |
9805 | return this.isReady_; | |
9806 | }; | |
9807 | i18n.input.chrome.inputview.OfflineDataSource.prototype.onNaclLoaded_ = function $i18n$input$chrome$inputview$OfflineDataSource$$onNaclLoaded_$() { | |
9808 | this.isReady_ = !0; | |
9809 | }; | |
9810 | i18n.input.chrome.inputview.OfflineDataSource.prototype.sendAutoComplete = function $i18n$input$chrome$inputview$OfflineDataSource$$sendAutoComplete$(query, opt_charactersForSpatial) { | |
9811 | var payload = this.createCommonPayload(), source = query.replace(/^.+,/, ""); | |
9812 | payload.text = query.slice(0, query.length - source.length); | |
9813 | payload.source = source; | |
9814 | payload.multi_text = []; | |
9815 | if (opt_charactersForSpatial) { | |
9816 | var segment = {}; | |
9817 | segment.source = opt_charactersForSpatial.map(function(value) { | |
9818 | return value.toLowerCase(); | |
9819 | }); | |
9820 | segment.score = opt_charactersForSpatial.map(function(value, i) { | |
9821 | return 0 == i ? 9 : 1; | |
9822 | }); | |
9823 | this.spatialCache_[source[source.length - 1]] = segment; | |
9824 | } | |
9825 | for (var i$$0 = 0;i$$0 < source.length;i$$0++) { | |
9826 | payload.multi_text.push(this.spatialCache_[source[i$$0]]); | |
9827 | } | |
9828 | this.isReady() && this.naclModule.postMessage(JSON.stringify(payload)); | |
9829 | }; | |
9830 | i18n.input.chrome.inputview.OfflineDataSource.prototype.sendAutoPrediction = function $i18n$input$chrome$inputview$OfflineDataSource$$sendAutoPrediction$(query) { | |
9831 | var payload = this.createCommonPayload(); | |
9832 | payload.text = query + ","; | |
9833 | this.isReady() && this.naclModule.postMessage(JSON.stringify(payload)); | |
9834 | }; | |
9835 | i18n.input.chrome.inputview.OfflineDataSource.prototype.onResponse_ = function $i18n$input$chrome$inputview$OfflineDataSource$$onResponse_$(responseJSON) { | |
9836 | var data = JSON.parse(responseJSON.data); | |
9837 | if (2 <= data.length) { | |
9838 | var source = data[1][0][0], candidates = data[1][0][1], annotations = data[1][0][2], matchedLengths = annotations ? annotations.matched_length : []; | |
9839 | goog.array.removeDuplicates(candidates, void 0, function(candidate) { | |
9840 | return candidate.replace(/ $/, ""); | |
9841 | }); | |
9842 | candidates = goog.array.splice(candidates, 0, this.numOfCandidate); | |
9843 | source ? this.dispatchEvent(new i18n.input.chrome.inputview.DataSource.AutoCompleteEvent(source, candidates, matchedLengths)) : this.dispatchEvent(new i18n.input.chrome.inputview.DataSource.AutoPredictionEvent(candidates)); | |
9844 | } | |
9845 | }; | |
9846 | i18n.input.chrome.inputview.PointerController = function $i18n$input$chrome$inputview$PointerController$() { | |
9847 | goog.events.EventTarget.call(this); | |
9848 | this.pointerHandlers_ = {}; | |
9849 | this.eventHandler_ = new goog.events.EventHandler(this); | |
9850 | this.eventHandler_.listen(document, [goog.events.EventType.MOUSEDOWN, goog.events.EventType.TOUCHSTART], this.onPointerDown_, !0).listen(document, [goog.events.EventType.MOUSEUP, goog.events.EventType.TOUCHEND], this.onPointerUp_, !0).listen(document, goog.events.EventType.TOUCHMOVE, this.onTouchMove_, !0); | |
9851 | }; | |
9852 | goog.inherits(i18n.input.chrome.inputview.PointerController, goog.events.EventTarget); | |
9853 | i18n.input.chrome.inputview.PointerController.prototype.createPointerHandler_ = function $i18n$input$chrome$inputview$PointerController$$createPointerHandler_$(target) { | |
9854 | var uid = goog.getUid(target); | |
9855 | this.pointerHandlers_[uid] || (this.pointerHandlers_[uid] = new i18n.input.chrome.inputview.PointerHandler(target, this)); | |
9856 | return this.pointerHandlers_[uid]; | |
9857 | }; | |
9858 | i18n.input.chrome.inputview.PointerController.prototype.onPointerDown_ = function $i18n$input$chrome$inputview$PointerController$$onPointerDown_$(e) { | |
9859 | var pointerHandler = this.createPointerHandler_(e.target); | |
9860 | pointerHandler.handlePointerDown(e); | |
9861 | }; | |
9862 | i18n.input.chrome.inputview.PointerController.prototype.onPointerUp_ = function $i18n$input$chrome$inputview$PointerController$$onPointerUp_$(e) { | |
9863 | var uid = goog.getUid(e.target), pointerHandler = this.pointerHandlers_[uid]; | |
9864 | pointerHandler && pointerHandler.handlePointerUp(e); | |
9865 | }; | |
9866 | i18n.input.chrome.inputview.PointerController.prototype.onTouchMove_ = function $i18n$input$chrome$inputview$PointerController$$onTouchMove_$(e) { | |
9867 | var touches = e.getBrowserEvent().touches; | |
9868 | if (touches && 0 != touches.length) { | |
9869 | for (var i = 0;i < touches.length;i++) { | |
9870 | var uid = goog.getUid(touches[i].target), pointerHandler = this.pointerHandlers_[uid]; | |
9871 | pointerHandler && pointerHandler.handleTouchMove(touches[i]); | |
9872 | } | |
9873 | e.stopPropagation(); | |
9874 | e.preventDefault(); | |
9875 | } | |
9876 | }; | |
9877 | i18n.input.chrome.inputview.PointerController.prototype.disposeInternal = function $i18n$input$chrome$inputview$PointerController$$disposeInternal$() { | |
9878 | for (var pointerHandler in this.pointerHandlers_) { | |
9879 | goog.dispose(pointerHandler); | |
9880 | } | |
9881 | goog.dispose(this.eventHandler_); | |
9882 | i18n.input.chrome.inputview.PointerController.superClass_.disposeInternal.call(this); | |
9883 | }; | |
9884 | goog.i18n = {}; | |
9885 | goog.i18n.bidi = {}; | |
9886 | goog.i18n.bidi.FORCE_RTL = !1; | |
9887 | goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || ("ar" == goog.LOCALE.substring(0, 2).toLowerCase() || "fa" == goog.LOCALE.substring(0, 2).toLowerCase() || "he" == goog.LOCALE.substring(0, 2).toLowerCase() || "iw" == goog.LOCALE.substring(0, 2).toLowerCase() || "ps" == goog.LOCALE.substring(0, 2).toLowerCase() || "sd" == goog.LOCALE.substring(0, 2).toLowerCase() || "ug" == goog.LOCALE.substring(0, 2).toLowerCase() || "ur" == goog.LOCALE.substring(0, 2).toLowerCase() || "yi" == goog.LOCALE.substring(0, | |
9888 | 2).toLowerCase()) && (2 == goog.LOCALE.length || "-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) || 3 <= goog.LOCALE.length && "ckb" == goog.LOCALE.substring(0, 3).toLowerCase() && (3 == goog.LOCALE.length || "-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)); | |
9889 | goog.i18n.bidi.Format = {LRE:"\u202a", RLE:"\u202b", PDF:"\u202c", LRM:"\u200e", RLM:"\u200f"}; | |
9890 | goog.i18n.bidi.Dir = {LTR:1, RTL:-1, NEUTRAL:0, UNKNOWN:0}; | |
9891 | goog.i18n.bidi.RIGHT = "right"; | |
9892 | goog.i18n.bidi.LEFT = "left"; | |
9893 | goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT; | |
9894 | goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT; | |
9895 | goog.i18n.bidi.toDir = function $goog$i18n$bidi$toDir$(givenDir, opt_noNeutral) { | |
9896 | return "number" == typeof givenDir ? 0 < givenDir ? goog.i18n.bidi.Dir.LTR : 0 > givenDir ? goog.i18n.bidi.Dir.RTL : opt_noNeutral ? null : goog.i18n.bidi.Dir.NEUTRAL : null == givenDir ? null : givenDir ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; | |
9897 | }; | |
9898 | goog.i18n.bidi.ltrChars_ = "A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff"; | |
9899 | goog.i18n.bidi.rtlChars_ = "\u0591-\u07ff\u200f\ufb1d-\ufdff\ufe70-\ufefc"; | |
9900 | goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g; | |
9901 | goog.i18n.bidi.stripHtmlIfNeeded_ = function $goog$i18n$bidi$stripHtmlIfNeeded_$(str, opt_isStripNeeded) { | |
9902 | return opt_isStripNeeded ? str.replace(goog.i18n.bidi.htmlSkipReg_, "") : str; | |
9903 | }; | |
9904 | goog.i18n.bidi.rtlCharReg_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "]"); | |
9905 | goog.i18n.bidi.ltrCharReg_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "]"); | |
9906 | goog.i18n.bidi.hasAnyRtl = function $goog$i18n$bidi$hasAnyRtl$(str, opt_isHtml) { | |
9907 | return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9908 | }; | |
9909 | goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl; | |
9910 | goog.i18n.bidi.hasAnyLtr = function $goog$i18n$bidi$hasAnyLtr$(str, opt_isHtml) { | |
9911 | return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9912 | }; | |
9913 | goog.i18n.bidi.ltrRe_ = new RegExp("^[" + goog.i18n.bidi.ltrChars_ + "]"); | |
9914 | goog.i18n.bidi.rtlRe_ = new RegExp("^[" + goog.i18n.bidi.rtlChars_ + "]"); | |
9915 | goog.i18n.bidi.isRtlChar = function $goog$i18n$bidi$isRtlChar$(str) { | |
9916 | return goog.i18n.bidi.rtlRe_.test(str); | |
9917 | }; | |
9918 | goog.i18n.bidi.isLtrChar = function $goog$i18n$bidi$isLtrChar$(str) { | |
9919 | return goog.i18n.bidi.ltrRe_.test(str); | |
9920 | }; | |
9921 | goog.i18n.bidi.isNeutralChar = function $goog$i18n$bidi$isNeutralChar$(str) { | |
9922 | return!goog.i18n.bidi.isLtrChar(str) && !goog.i18n.bidi.isRtlChar(str); | |
9923 | }; | |
9924 | goog.i18n.bidi.ltrDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.rtlChars_ + "]*[" + goog.i18n.bidi.ltrChars_ + "]"); | |
9925 | goog.i18n.bidi.rtlDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.ltrChars_ + "]*[" + goog.i18n.bidi.rtlChars_ + "]"); | |
9926 | goog.i18n.bidi.startsWithRtl = function $goog$i18n$bidi$startsWithRtl$(str, opt_isHtml) { | |
9927 | return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9928 | }; | |
9929 | goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl; | |
9930 | goog.i18n.bidi.startsWithLtr = function $goog$i18n$bidi$startsWithLtr$(str, opt_isHtml) { | |
9931 | return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9932 | }; | |
9933 | goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr; | |
9934 | goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/; | |
9935 | goog.i18n.bidi.isNeutralText = function $goog$i18n$bidi$isNeutralText$(str, opt_isHtml) { | |
9936 | str = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml); | |
9937 | return goog.i18n.bidi.isRequiredLtrRe_.test(str) || !goog.i18n.bidi.hasAnyLtr(str) && !goog.i18n.bidi.hasAnyRtl(str); | |
9938 | }; | |
9939 | goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "][^" + goog.i18n.bidi.rtlChars_ + "]*$"); | |
9940 | goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "][^" + goog.i18n.bidi.ltrChars_ + "]*$"); | |
9941 | goog.i18n.bidi.endsWithLtr = function $goog$i18n$bidi$endsWithLtr$(str, opt_isHtml) { | |
9942 | return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9943 | }; | |
9944 | goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr; | |
9945 | goog.i18n.bidi.endsWithRtl = function $goog$i18n$bidi$endsWithRtl$(str, opt_isHtml) { | |
9946 | return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml)); | |
9947 | }; | |
9948 | goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl; | |
9949 | goog.i18n.bidi.rtlLocalesRe_ = RegExp("^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)", "i"); | |
9950 | goog.i18n.bidi.isRtlLanguage = function $goog$i18n$bidi$isRtlLanguage$(lang) { | |
9951 | return goog.i18n.bidi.rtlLocalesRe_.test(lang); | |
9952 | }; | |
9953 | goog.i18n.bidi.bracketGuardHtmlRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?(>)+)/g; | |
9954 | goog.i18n.bidi.bracketGuardTextRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g; | |
9955 | goog.i18n.bidi.guardBracketInHtml = function $goog$i18n$bidi$guardBracketInHtml$(s, opt_isRtlContext) { | |
9956 | var useRtl = void 0 === opt_isRtlContext ? goog.i18n.bidi.hasAnyRtl(s) : opt_isRtlContext; | |
9957 | return useRtl ? s.replace(goog.i18n.bidi.bracketGuardHtmlRe_, "<span dir=rtl>$&</span>") : s.replace(goog.i18n.bidi.bracketGuardHtmlRe_, "<span dir=ltr>$&</span>"); | |
9958 | }; | |
9959 | goog.i18n.bidi.guardBracketInText = function $goog$i18n$bidi$guardBracketInText$(s, opt_isRtlContext) { | |
9960 | var useRtl = void 0 === opt_isRtlContext ? goog.i18n.bidi.hasAnyRtl(s) : opt_isRtlContext, mark = useRtl ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM; | |
9961 | return s.replace(goog.i18n.bidi.bracketGuardTextRe_, mark + "$&" + mark); | |
9962 | }; | |
9963 | goog.i18n.bidi.enforceRtlInHtml = function $goog$i18n$bidi$enforceRtlInHtml$(html) { | |
9964 | return "<" == html.charAt(0) ? html.replace(/<\w+/, "$& dir=rtl") : "\n<span dir=rtl>" + html + "</span>"; | |
9965 | }; | |
9966 | goog.i18n.bidi.enforceRtlInText = function $goog$i18n$bidi$enforceRtlInText$(text) { | |
9967 | return goog.i18n.bidi.Format.RLE + text + goog.i18n.bidi.Format.PDF; | |
9968 | }; | |
9969 | goog.i18n.bidi.enforceLtrInHtml = function $goog$i18n$bidi$enforceLtrInHtml$(html) { | |
9970 | return "<" == html.charAt(0) ? html.replace(/<\w+/, "$& dir=ltr") : "\n<span dir=ltr>" + html + "</span>"; | |
9971 | }; | |
9972 | goog.i18n.bidi.enforceLtrInText = function $goog$i18n$bidi$enforceLtrInText$(text) { | |
9973 | return goog.i18n.bidi.Format.LRE + text + goog.i18n.bidi.Format.PDF; | |
9974 | }; | |
9975 | goog.i18n.bidi.dimensionsRe_ = /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g; | |
9976 | goog.i18n.bidi.leftRe_ = /left/gi; | |
9977 | goog.i18n.bidi.rightRe_ = /right/gi; | |
9978 | goog.i18n.bidi.tempRe_ = /%%%%/g; | |
9979 | goog.i18n.bidi.mirrorCSS = function $goog$i18n$bidi$mirrorCSS$(cssStr) { | |
9980 | return cssStr.replace(goog.i18n.bidi.dimensionsRe_, ":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_, "%%%%").replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT); | |
9981 | }; | |
9982 | goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g; | |
9983 | goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g; | |
9984 | goog.i18n.bidi.normalizeHebrewQuote = function $goog$i18n$bidi$normalizeHebrewQuote$(str) { | |
9985 | return str.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, "$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_, "$1\u05f3"); | |
9986 | }; | |
9987 | goog.i18n.bidi.wordSeparatorRe_ = /\s+/; | |
9988 | goog.i18n.bidi.hasNumeralsRe_ = /\d/; | |
9989 | goog.i18n.bidi.rtlDetectionThreshold_ = .4; | |
9990 | goog.i18n.bidi.estimateDirection = function $goog$i18n$bidi$estimateDirection$(str, opt_isHtml) { | |
9991 | for (var rtlCount = 0, totalCount = 0, hasWeaklyLtr = !1, tokens = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml).split(goog.i18n.bidi.wordSeparatorRe_), i = 0;i < tokens.length;i++) { | |
9992 | var token = tokens[i]; | |
9993 | goog.i18n.bidi.startsWithRtl(token) ? (rtlCount++, totalCount++) : goog.i18n.bidi.isRequiredLtrRe_.test(token) ? hasWeaklyLtr = !0 : goog.i18n.bidi.hasAnyLtr(token) ? totalCount++ : goog.i18n.bidi.hasNumeralsRe_.test(token) && (hasWeaklyLtr = !0); | |
9994 | } | |
9995 | return 0 == totalCount ? hasWeaklyLtr ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL : rtlCount / totalCount > goog.i18n.bidi.rtlDetectionThreshold_ ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; | |
9996 | }; | |
9997 | goog.i18n.bidi.detectRtlDirectionality = function $goog$i18n$bidi$detectRtlDirectionality$(str, opt_isHtml) { | |
9998 | return goog.i18n.bidi.estimateDirection(str, opt_isHtml) == goog.i18n.bidi.Dir.RTL; | |
9999 | }; | |
10000 | goog.i18n.bidi.setElementDirAndAlign = function $goog$i18n$bidi$setElementDirAndAlign$(element, dir) { | |
10001 | element && (dir = goog.i18n.bidi.toDir(dir)) && (element.style.textAlign = dir == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT, element.dir = dir == goog.i18n.bidi.Dir.RTL ? "rtl" : "ltr"); | |
10002 | }; | |
10003 | goog.i18n.bidi.DirectionalString = function $goog$i18n$bidi$DirectionalString$() { | |
10004 | }; | |
10005 | goog.events.KeyCodes = {WIN_KEY_FF_LINUX:0, 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:33, PAGE_DOWN:34, END:35, HOME:36, LEFT:37, UP:38, RIGHT:39, DOWN:40, PRINT_SCREEN: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, FF_SEMICOLON:59, FF_EQUALS:61, FF_DASH:173, 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, | |
10006 | L:76, M:77, N:78, O:79, P:80, Q:81, R:82, S:83, T:84, U:85, V:86, W:87, X:88, Y:89, Z:90, META:91, WIN_KEY_RIGHT:92, CONTEXT_MENU:93, NUM_ZERO: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:115, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, F12:123, NUMLOCK:144, SCROLL_LOCK:145, FIRST_MEDIA_KEY:166, | |
10007 | LAST_MEDIA_KEY:183, SEMICOLON:186, DASH:189, EQUALS:187, COMMA:188, PERIOD:190, SLASH:191, APOSTROPHE:192, TILDE:192, SINGLE_QUOTE:222, OPEN_SQUARE_BRACKET:219, BACKSLASH:220, CLOSE_SQUARE_BRACKET:221, WIN_KEY:224, MAC_FF_META:224, MAC_WK_CMD_LEFT:91, MAC_WK_CMD_RIGHT:93, WIN_IME:229, PHANTOM:255}; | |
10008 | goog.events.KeyCodes.isTextModifyingKeyEvent = function $goog$events$KeyCodes$isTextModifyingKeyEvent$(e) { | |
10009 | if (e.altKey && !e.ctrlKey || e.metaKey || e.keyCode >= goog.events.KeyCodes.F1 && e.keyCode <= goog.events.KeyCodes.F12) { | |
10010 | return!1; | |
10011 | } | |
10012 | switch(e.keyCode) { | |
10013 | case goog.events.KeyCodes.ALT: | |
10014 | ; | |
10015 | case goog.events.KeyCodes.CAPS_LOCK: | |
10016 | ; | |
10017 | case goog.events.KeyCodes.CONTEXT_MENU: | |
10018 | ; | |
10019 | case goog.events.KeyCodes.CTRL: | |
10020 | ; | |
10021 | case goog.events.KeyCodes.DOWN: | |
10022 | ; | |
10023 | case goog.events.KeyCodes.END: | |
10024 | ; | |
10025 | case goog.events.KeyCodes.ESC: | |
10026 | ; | |
10027 | case goog.events.KeyCodes.HOME: | |
10028 | ; | |
10029 | case goog.events.KeyCodes.INSERT: | |
10030 | ; | |
10031 | case goog.events.KeyCodes.LEFT: | |
10032 | ; | |
10033 | case goog.events.KeyCodes.MAC_FF_META: | |
10034 | ; | |
10035 | case goog.events.KeyCodes.META: | |
10036 | ; | |
10037 | case goog.events.KeyCodes.NUMLOCK: | |
10038 | ; | |
10039 | case goog.events.KeyCodes.NUM_CENTER: | |
10040 | ; | |
10041 | case goog.events.KeyCodes.PAGE_DOWN: | |
10042 | ; | |
10043 | case goog.events.KeyCodes.PAGE_UP: | |
10044 | ; | |
10045 | case goog.events.KeyCodes.PAUSE: | |
10046 | ; | |
10047 | case goog.events.KeyCodes.PHANTOM: | |
10048 | ; | |
10049 | case goog.events.KeyCodes.PRINT_SCREEN: | |
10050 | ; | |
10051 | case goog.events.KeyCodes.RIGHT: | |
10052 | ; | |
10053 | case goog.events.KeyCodes.SCROLL_LOCK: | |
10054 | ; | |
10055 | case goog.events.KeyCodes.SHIFT: | |
10056 | ; | |
10057 | case goog.events.KeyCodes.UP: | |
10058 | ; | |
10059 | case goog.events.KeyCodes.WIN_KEY: | |
10060 | ; | |
10061 | case goog.events.KeyCodes.WIN_KEY_RIGHT: | |
10062 | return!1; | |
10063 | case goog.events.KeyCodes.WIN_KEY_FF_LINUX: | |
10064 | return!goog.userAgent.GECKO; | |
10065 | default: | |
10066 | return e.keyCode < goog.events.KeyCodes.FIRST_MEDIA_KEY || e.keyCode > goog.events.KeyCodes.LAST_MEDIA_KEY; | |
10067 | } | |
10068 | }; | |
10069 | goog.events.KeyCodes.firesKeyPressEvent = function $goog$events$KeyCodes$firesKeyPressEvent$(keyCode, opt_heldKeyCode, opt_shiftKey, opt_ctrlKey, opt_altKey) { | |
10070 | if (!(goog.userAgent.IE || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("525"))) { | |
10071 | return!0; | |
10072 | } | |
10073 | if (goog.userAgent.MAC && opt_altKey) { | |
10074 | return goog.events.KeyCodes.isCharacterKey(keyCode); | |
10075 | } | |
10076 | if (opt_altKey && !opt_ctrlKey) { | |
10077 | return!1; | |
10078 | } | |
10079 | goog.isNumber(opt_heldKeyCode) && (opt_heldKeyCode = goog.events.KeyCodes.normalizeKeyCode(opt_heldKeyCode)); | |
10080 | if (!opt_shiftKey && (opt_heldKeyCode == goog.events.KeyCodes.CTRL || opt_heldKeyCode == goog.events.KeyCodes.ALT || goog.userAgent.MAC && opt_heldKeyCode == goog.events.KeyCodes.META)) { | |
10081 | return!1; | |
10082 | } | |
10083 | if (goog.userAgent.WEBKIT && opt_ctrlKey && opt_shiftKey) { | |
10084 | switch(keyCode) { | |
10085 | case goog.events.KeyCodes.BACKSLASH: | |
10086 | ; | |
10087 | case goog.events.KeyCodes.OPEN_SQUARE_BRACKET: | |
10088 | ; | |
10089 | case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET: | |
10090 | ; | |
10091 | case goog.events.KeyCodes.TILDE: | |
10092 | ; | |
10093 | case goog.events.KeyCodes.SEMICOLON: | |
10094 | ; | |
10095 | case goog.events.KeyCodes.DASH: | |
10096 | ; | |
10097 | case goog.events.KeyCodes.EQUALS: | |
10098 | ; | |
10099 | case goog.events.KeyCodes.COMMA: | |
10100 | ; | |
10101 | case goog.events.KeyCodes.PERIOD: | |
10102 | ; | |
10103 | case goog.events.KeyCodes.SLASH: | |
10104 | ; | |
10105 | case goog.events.KeyCodes.APOSTROPHE: | |
10106 | ; | |
10107 | case goog.events.KeyCodes.SINGLE_QUOTE: | |
10108 | return!1; | |
10109 | } | |
10110 | } | |
10111 | if (goog.userAgent.IE && opt_ctrlKey && opt_heldKeyCode == keyCode) { | |
10112 | return!1; | |
10113 | } | |
10114 | switch(keyCode) { | |
10115 | case goog.events.KeyCodes.ENTER: | |
10116 | return!(goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9)); | |
10117 | case goog.events.KeyCodes.ESC: | |
10118 | return!goog.userAgent.WEBKIT; | |
10119 | } | |
10120 | return goog.events.KeyCodes.isCharacterKey(keyCode); | |
10121 | }; | |
10122 | goog.events.KeyCodes.isCharacterKey = function $goog$events$KeyCodes$isCharacterKey$(keyCode) { | |
10123 | if (keyCode >= goog.events.KeyCodes.ZERO && keyCode <= goog.events.KeyCodes.NINE || keyCode >= goog.events.KeyCodes.NUM_ZERO && keyCode <= goog.events.KeyCodes.NUM_MULTIPLY || keyCode >= goog.events.KeyCodes.A && keyCode <= goog.events.KeyCodes.Z || goog.userAgent.WEBKIT && 0 == keyCode) { | |
10124 | return!0; | |
10125 | } | |
10126 | switch(keyCode) { | |
10127 | case goog.events.KeyCodes.SPACE: | |
10128 | ; | |
10129 | case goog.events.KeyCodes.QUESTION_MARK: | |
10130 | ; | |
10131 | case goog.events.KeyCodes.NUM_PLUS: | |
10132 | ; | |
10133 | case goog.events.KeyCodes.NUM_MINUS: | |
10134 | ; | |
10135 | case goog.events.KeyCodes.NUM_PERIOD: | |
10136 | ; | |
10137 | case goog.events.KeyCodes.NUM_DIVISION: | |
10138 | ; | |
10139 | case goog.events.KeyCodes.SEMICOLON: | |
10140 | ; | |
10141 | case goog.events.KeyCodes.FF_SEMICOLON: | |
10142 | ; | |
10143 | case goog.events.KeyCodes.DASH: | |
10144 | ; | |
10145 | case goog.events.KeyCodes.EQUALS: | |
10146 | ; | |
10147 | case goog.events.KeyCodes.FF_EQUALS: | |
10148 | ; | |
10149 | case goog.events.KeyCodes.COMMA: | |
10150 | ; | |
10151 | case goog.events.KeyCodes.PERIOD: | |
10152 | ; | |
10153 | case goog.events.KeyCodes.SLASH: | |
10154 | ; | |
10155 | case goog.events.KeyCodes.APOSTROPHE: | |
10156 | ; | |
10157 | case goog.events.KeyCodes.SINGLE_QUOTE: | |
10158 | ; | |
10159 | case goog.events.KeyCodes.OPEN_SQUARE_BRACKET: | |
10160 | ; | |
10161 | case goog.events.KeyCodes.BACKSLASH: | |
10162 | ; | |
10163 | case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET: | |
10164 | return!0; | |
10165 | default: | |
10166 | return!1; | |
10167 | } | |
10168 | }; | |
10169 | goog.events.KeyCodes.normalizeKeyCode = function $goog$events$KeyCodes$normalizeKeyCode$(keyCode) { | |
10170 | return goog.userAgent.GECKO ? goog.events.KeyCodes.normalizeGeckoKeyCode(keyCode) : goog.userAgent.MAC && goog.userAgent.WEBKIT ? goog.events.KeyCodes.normalizeMacWebKitKeyCode(keyCode) : keyCode; | |
10171 | }; | |
10172 | goog.events.KeyCodes.normalizeGeckoKeyCode = function $goog$events$KeyCodes$normalizeGeckoKeyCode$(keyCode) { | |
10173 | switch(keyCode) { | |
10174 | case goog.events.KeyCodes.FF_EQUALS: | |
10175 | return goog.events.KeyCodes.EQUALS; | |
10176 | case goog.events.KeyCodes.FF_SEMICOLON: | |
10177 | return goog.events.KeyCodes.SEMICOLON; | |
10178 | case goog.events.KeyCodes.FF_DASH: | |
10179 | return goog.events.KeyCodes.DASH; | |
10180 | case goog.events.KeyCodes.MAC_FF_META: | |
10181 | return goog.events.KeyCodes.META; | |
10182 | case goog.events.KeyCodes.WIN_KEY_FF_LINUX: | |
10183 | return goog.events.KeyCodes.WIN_KEY; | |
10184 | default: | |
10185 | return keyCode; | |
10186 | } | |
10187 | }; | |
10188 | goog.events.KeyCodes.normalizeMacWebKitKeyCode = function $goog$events$KeyCodes$normalizeMacWebKitKeyCode$(keyCode) { | |
10189 | switch(keyCode) { | |
10190 | case goog.events.KeyCodes.MAC_WK_CMD_RIGHT: | |
10191 | return goog.events.KeyCodes.META; | |
10192 | default: | |
10193 | return keyCode; | |
10194 | } | |
10195 | }; | |
10196 | goog.events.KeyHandler = function $goog$events$KeyHandler$(opt_element, opt_capture) { | |
10197 | goog.events.EventTarget.call(this); | |
10198 | opt_element && this.attach(opt_element, opt_capture); | |
10199 | }; | |
10200 | goog.inherits(goog.events.KeyHandler, goog.events.EventTarget); | |
10201 | goog.events.KeyHandler.prototype.element_ = null; | |
10202 | goog.events.KeyHandler.prototype.keyPressKey_ = null; | |
10203 | goog.events.KeyHandler.prototype.keyDownKey_ = null; | |
10204 | goog.events.KeyHandler.prototype.keyUpKey_ = null; | |
10205 | goog.events.KeyHandler.prototype.lastKey_ = -1; | |
10206 | goog.events.KeyHandler.prototype.keyCode_ = -1; | |
10207 | goog.events.KeyHandler.prototype.altKey_ = !1; | |
10208 | goog.events.KeyHandler.EventType = {KEY:"key"}; | |
10209 | goog.events.KeyHandler.safariKey_ = {3:goog.events.KeyCodes.ENTER, 12:goog.events.KeyCodes.NUMLOCK, 63232:goog.events.KeyCodes.UP, 63233:goog.events.KeyCodes.DOWN, 63234:goog.events.KeyCodes.LEFT, 63235:goog.events.KeyCodes.RIGHT, 63236:goog.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.events.KeyCodes.F6, 63242:goog.events.KeyCodes.F7, 63243:goog.events.KeyCodes.F8, 63244:goog.events.KeyCodes.F9, | |
10210 | 63245:goog.events.KeyCodes.F10, 63246:goog.events.KeyCodes.F11, 63247:goog.events.KeyCodes.F12, 63248:goog.events.KeyCodes.PRINT_SCREEN, 63272:goog.events.KeyCodes.DELETE, 63273:goog.events.KeyCodes.HOME, 63275:goog.events.KeyCodes.END, 63276:goog.events.KeyCodes.PAGE_UP, 63277:goog.events.KeyCodes.PAGE_DOWN, 63289:goog.events.KeyCodes.NUMLOCK, 63302:goog.events.KeyCodes.INSERT}; | |
10211 | goog.events.KeyHandler.keyIdentifier_ = {Up:goog.events.KeyCodes.UP, Down:goog.events.KeyCodes.DOWN, Left:goog.events.KeyCodes.LEFT, Right:goog.events.KeyCodes.RIGHT, Enter:goog.events.KeyCodes.ENTER, F1:goog.events.KeyCodes.F1, F2:goog.events.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.F10, F11:goog.events.KeyCodes.F11, | |
10212 | F12:goog.events.KeyCodes.F12, "U+007F":goog.events.KeyCodes.DELETE, Home:goog.events.KeyCodes.HOME, End:goog.events.KeyCodes.END, PageUp:goog.events.KeyCodes.PAGE_UP, PageDown:goog.events.KeyCodes.PAGE_DOWN, Insert:goog.events.KeyCodes.INSERT}; | |
10213 | goog.events.KeyHandler.USES_KEYDOWN_ = goog.userAgent.IE || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("525"); | |
10214 | goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ = goog.userAgent.MAC && goog.userAgent.GECKO; | |
10215 | goog.events.KeyHandler.prototype.handleKeyDown_ = function $goog$events$KeyHandler$$handleKeyDown_$(e) { | |
10216 | goog.userAgent.WEBKIT && (this.lastKey_ == goog.events.KeyCodes.CTRL && !e.ctrlKey || this.lastKey_ == goog.events.KeyCodes.ALT && !e.altKey || goog.userAgent.MAC && this.lastKey_ == goog.events.KeyCodes.META && !e.metaKey) && (this.keyCode_ = this.lastKey_ = -1); | |
10217 | -1 == this.lastKey_ && (e.ctrlKey && e.keyCode != goog.events.KeyCodes.CTRL ? this.lastKey_ = goog.events.KeyCodes.CTRL : e.altKey && e.keyCode != goog.events.KeyCodes.ALT ? this.lastKey_ = goog.events.KeyCodes.ALT : e.metaKey && e.keyCode != goog.events.KeyCodes.META && (this.lastKey_ = goog.events.KeyCodes.META)); | |
10218 | goog.events.KeyHandler.USES_KEYDOWN_ && !goog.events.KeyCodes.firesKeyPressEvent(e.keyCode, this.lastKey_, e.shiftKey, e.ctrlKey, e.altKey) ? this.handleEvent(e) : (this.keyCode_ = goog.events.KeyCodes.normalizeKeyCode(e.keyCode), goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (this.altKey_ = e.altKey)); | |
10219 | }; | |
10220 | goog.events.KeyHandler.prototype.resetState = function $goog$events$KeyHandler$$resetState$() { | |
10221 | this.keyCode_ = this.lastKey_ = -1; | |
10222 | }; | |
10223 | goog.events.KeyHandler.prototype.handleKeyup_ = function $goog$events$KeyHandler$$handleKeyup_$(e) { | |
10224 | this.resetState(); | |
10225 | this.altKey_ = e.altKey; | |
10226 | }; | |
10227 | goog.events.KeyHandler.prototype.handleEvent = function $goog$events$KeyHandler$$handleEvent$(e) { | |
10228 | var be = e.getBrowserEvent(), keyCode, charCode, altKey = be.altKey; | |
10229 | goog.userAgent.IE && e.type == goog.events.EventType.KEYPRESS ? (keyCode = this.keyCode_, charCode = keyCode != goog.events.KeyCodes.ENTER && keyCode != goog.events.KeyCodes.ESC ? be.keyCode : 0) : goog.userAgent.WEBKIT && e.type == goog.events.EventType.KEYPRESS ? (keyCode = this.keyCode_, charCode = 0 <= be.charCode && 63232 > be.charCode && goog.events.KeyCodes.isCharacterKey(keyCode) ? be.charCode : 0) : goog.userAgent.OPERA ? (keyCode = this.keyCode_, charCode = goog.events.KeyCodes.isCharacterKey(keyCode) ? | |
10230 | be.keyCode : 0) : (keyCode = be.keyCode || this.keyCode_, charCode = be.charCode || 0, goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (altKey = this.altKey_), goog.userAgent.MAC && charCode == goog.events.KeyCodes.QUESTION_MARK && keyCode == goog.events.KeyCodes.WIN_KEY && (keyCode = goog.events.KeyCodes.SLASH)); | |
10231 | var key = keyCode = goog.events.KeyCodes.normalizeKeyCode(keyCode), keyIdentifier = be.keyIdentifier; | |
10232 | keyCode ? 63232 <= keyCode && keyCode in goog.events.KeyHandler.safariKey_ ? key = goog.events.KeyHandler.safariKey_[keyCode] : 25 == keyCode && e.shiftKey && (key = 9) : keyIdentifier && keyIdentifier in goog.events.KeyHandler.keyIdentifier_ && (key = goog.events.KeyHandler.keyIdentifier_[keyIdentifier]); | |
10233 | var repeat = key == this.lastKey_; | |
10234 | this.lastKey_ = key; | |
10235 | var event = new goog.events.KeyEvent(key, charCode, repeat, be); | |
10236 | event.altKey = altKey; | |
10237 | this.dispatchEvent(event); | |
10238 | }; | |
10239 | goog.events.KeyHandler.prototype.getElement = function $goog$events$KeyHandler$$getElement$() { | |
10240 | return this.element_; | |
10241 | }; | |
10242 | goog.events.KeyHandler.prototype.attach = function $goog$events$KeyHandler$$attach$(element, opt_capture) { | |
10243 | this.keyUpKey_ && this.detach(); | |
10244 | this.element_ = element; | |
10245 | this.keyPressKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYPRESS, this, opt_capture); | |
10246 | this.keyDownKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYDOWN, this.handleKeyDown_, opt_capture, this); | |
10247 | this.keyUpKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYUP, this.handleKeyup_, opt_capture, this); | |
10248 | }; | |
10249 | goog.events.KeyHandler.prototype.detach = function $goog$events$KeyHandler$$detach$() { | |
10250 | this.keyPressKey_ && (goog.events.unlistenByKey(this.keyPressKey_), goog.events.unlistenByKey(this.keyDownKey_), goog.events.unlistenByKey(this.keyUpKey_), this.keyUpKey_ = this.keyDownKey_ = this.keyPressKey_ = null); | |
10251 | this.element_ = null; | |
10252 | this.keyCode_ = this.lastKey_ = -1; | |
10253 | }; | |
10254 | goog.events.KeyHandler.prototype.disposeInternal = function $goog$events$KeyHandler$$disposeInternal$() { | |
10255 | goog.events.KeyHandler.superClass_.disposeInternal.call(this); | |
10256 | this.detach(); | |
10257 | }; | |
10258 | goog.events.KeyEvent = function $goog$events$KeyEvent$(keyCode, charCode, repeat, browserEvent) { | |
10259 | goog.events.BrowserEvent.call(this, browserEvent); | |
10260 | this.type = goog.events.KeyHandler.EventType.KEY; | |
10261 | this.keyCode = keyCode; | |
10262 | this.charCode = charCode; | |
10263 | this.repeat = repeat; | |
10264 | }; | |
10265 | goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent); | |
10266 | goog.dom.classlist = {}; | |
10267 | goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST = !1; | |
10268 | goog.dom.classlist.get = function $goog$dom$classlist$get$(element) { | |
10269 | if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { | |
10270 | return element.classList; | |
10271 | } | |
10272 | var className = element.className; | |
10273 | return goog.isString(className) && className.match(/\S+/g) || []; | |
10274 | }; | |
10275 | goog.dom.classlist.set = function $goog$dom$classlist$set$(element, className) { | |
10276 | element.className = className; | |
10277 | }; | |
10278 | goog.dom.classlist.contains = function $goog$dom$classlist$contains$(element, className) { | |
10279 | return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList ? element.classList.contains(className) : goog.array.contains(goog.dom.classlist.get(element), className); | |
10280 | }; | |
10281 | goog.dom.classlist.add = function $goog$dom$classlist$add$(element, className) { | |
10282 | goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList ? element.classList.add(className) : goog.dom.classlist.contains(element, className) || (element.className += 0 < element.className.length ? " " + className : className); | |
10283 | }; | |
10284 | goog.dom.classlist.addAll = function $goog$dom$classlist$addAll$(element, classesToAdd) { | |
10285 | if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) { | |
10286 | goog.array.forEach(classesToAdd, function(className) { | |
10287 | goog.dom.classlist.add(element, className); | |
10288 | }); | |
10289 | } else { | |
10290 | var classMap = {}; | |
10291 | goog.array.forEach(goog.dom.classlist.get(element), function(className) { | |
10292 | classMap[className] = !0; | |
10293 | }); | |
10294 | goog.array.forEach(classesToAdd, function(className) { | |
10295 | classMap[className] = !0; | |
10296 | }); | |
10297 | element.className = ""; | |
10298 | for (var className$$0 in classMap) { | |
10299 | element.className += 0 < element.className.length ? " " + className$$0 : className$$0; | |
10300 | } | |
10301 | } | |
10302 | }; | |
10303 | goog.dom.classlist.remove = function $goog$dom$classlist$remove$(element, className) { | |
10304 | goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList ? element.classList.remove(className) : goog.dom.classlist.contains(element, className) && (element.className = goog.array.filter(goog.dom.classlist.get(element), function(c) { | |
10305 | return c != className; | |
10306 | }).join(" ")); | |
10307 | }; | |
10308 | goog.dom.classlist.removeAll = function $goog$dom$classlist$removeAll$(element, classesToRemove) { | |
10309 | goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList ? goog.array.forEach(classesToRemove, function(className) { | |
10310 | goog.dom.classlist.remove(element, className); | |
10311 | }) : element.className = goog.array.filter(goog.dom.classlist.get(element), function(className) { | |
10312 | return!goog.array.contains(classesToRemove, className); | |
10313 | }).join(" "); | |
10314 | }; | |
10315 | goog.dom.classlist.enable = function $goog$dom$classlist$enable$(element, className, enabled) { | |
10316 | enabled ? goog.dom.classlist.add(element, className) : goog.dom.classlist.remove(element, className); | |
10317 | }; | |
10318 | goog.dom.classlist.enableAll = function $goog$dom$classlist$enableAll$(element, classesToEnable, enabled) { | |
10319 | var f = enabled ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll; | |
10320 | f(element, classesToEnable); | |
10321 | }; | |
10322 | goog.dom.classlist.swap = function $goog$dom$classlist$swap$(element, fromClass, toClass) { | |
10323 | return goog.dom.classlist.contains(element, fromClass) ? (goog.dom.classlist.remove(element, fromClass), goog.dom.classlist.add(element, toClass), !0) : !1; | |
10324 | }; | |
10325 | goog.dom.classlist.toggle = function $goog$dom$classlist$toggle$(element, className) { | |
10326 | var add = !goog.dom.classlist.contains(element, className); | |
10327 | goog.dom.classlist.enable(element, className, add); | |
10328 | return add; | |
10329 | }; | |
10330 | goog.dom.classlist.addRemove = function $goog$dom$classlist$addRemove$(element, classToRemove, classToAdd) { | |
10331 | goog.dom.classlist.remove(element, classToRemove); | |
10332 | goog.dom.classlist.add(element, classToAdd); | |
10333 | }; | |
10334 | goog.ui.registry = {}; | |
10335 | goog.ui.registry.getDefaultRenderer = function $goog$ui$registry$getDefaultRenderer$(componentCtor) { | |
10336 | for (var key, rendererCtor;componentCtor;) { | |
10337 | key = goog.getUid(componentCtor); | |
10338 | if (rendererCtor = goog.ui.registry.defaultRenderers_[key]) { | |
10339 | break; | |
10340 | } | |
10341 | componentCtor = componentCtor.superClass_ ? componentCtor.superClass_.constructor : null; | |
10342 | } | |
10343 | return rendererCtor ? goog.isFunction(rendererCtor.getInstance) ? rendererCtor.getInstance() : new rendererCtor : null; | |
10344 | }; | |
10345 | goog.ui.registry.setDefaultRenderer = function $goog$ui$registry$setDefaultRenderer$(componentCtor, rendererCtor) { | |
10346 | if (!goog.isFunction(componentCtor)) { | |
10347 | throw Error("Invalid component class " + componentCtor); | |
10348 | } | |
10349 | if (!goog.isFunction(rendererCtor)) { | |
10350 | throw Error("Invalid renderer class " + rendererCtor); | |
10351 | } | |
10352 | var key = goog.getUid(componentCtor); | |
10353 | goog.ui.registry.defaultRenderers_[key] = rendererCtor; | |
10354 | }; | |
10355 | goog.ui.registry.getDecoratorByClassName = function $goog$ui$registry$getDecoratorByClassName$(className) { | |
10356 | return className in goog.ui.registry.decoratorFunctions_ ? goog.ui.registry.decoratorFunctions_[className]() : null; | |
10357 | }; | |
10358 | goog.ui.registry.setDecoratorByClassName = function $goog$ui$registry$setDecoratorByClassName$(className, decoratorFn) { | |
10359 | if (!className) { | |
10360 | throw Error("Invalid class name " + className); | |
10361 | } | |
10362 | if (!goog.isFunction(decoratorFn)) { | |
10363 | throw Error("Invalid decorator function " + decoratorFn); | |
10364 | } | |
10365 | goog.ui.registry.decoratorFunctions_[className] = decoratorFn; | |
10366 | }; | |
10367 | goog.ui.registry.getDecorator = function $goog$ui$registry$getDecorator$(element) { | |
10368 | var decorator; | |
10369 | goog.asserts.assert(element); | |
10370 | for (var classNames = goog.dom.classlist.get(element), i = 0, len = classNames.length;i < len;i++) { | |
10371 | if (decorator = goog.ui.registry.getDecoratorByClassName(classNames[i])) { | |
10372 | return decorator; | |
10373 | } | |
10374 | } | |
10375 | return null; | |
10376 | }; | |
10377 | goog.ui.registry.reset = function $goog$ui$registry$reset$() { | |
10378 | goog.ui.registry.defaultRenderers_ = {}; | |
10379 | goog.ui.registry.decoratorFunctions_ = {}; | |
10380 | }; | |
10381 | goog.ui.registry.defaultRenderers_ = {}; | |
10382 | goog.ui.registry.decoratorFunctions_ = {}; | |
10383 | goog.ui.ContainerRenderer = function $goog$ui$ContainerRenderer$(opt_ariaRole) { | |
10384 | this.ariaRole_ = opt_ariaRole; | |
10385 | }; | |
10386 | goog.addSingletonGetter(goog.ui.ContainerRenderer); | |
10387 | goog.ui.ContainerRenderer.getCustomRenderer = function $goog$ui$ContainerRenderer$getCustomRenderer$(ctor, cssClassName) { | |
10388 | var renderer = new ctor; | |
10389 | renderer.getCssClass = function $renderer$getCssClass$() { | |
10390 | return cssClassName; | |
10391 | }; | |
10392 | return renderer; | |
10393 | }; | |
10394 | goog.ui.ContainerRenderer.CSS_CLASS = "goog-container"; | |
10395 | goog.ui.ContainerRenderer.prototype.getAriaRole = function $goog$ui$ContainerRenderer$$getAriaRole$() { | |
10396 | return this.ariaRole_; | |
10397 | }; | |
10398 | goog.ui.ContainerRenderer.prototype.enableTabIndex = function $goog$ui$ContainerRenderer$$enableTabIndex$(element, enable) { | |
10399 | element && (element.tabIndex = enable ? 0 : -1); | |
10400 | }; | |
10401 | goog.ui.ContainerRenderer.prototype.createDom = function $goog$ui$ContainerRenderer$$createDom$(container) { | |
10402 | return container.getDomHelper().createDom("div", this.getClassNames(container).join(" ")); | |
10403 | }; | |
10404 | goog.ui.ContainerRenderer.prototype.getContentElement = function $goog$ui$ContainerRenderer$$getContentElement$(element) { | |
10405 | return element; | |
10406 | }; | |
10407 | goog.ui.ContainerRenderer.prototype.canDecorate = function $goog$ui$ContainerRenderer$$canDecorate$(element) { | |
10408 | return "DIV" == element.tagName; | |
10409 | }; | |
10410 | goog.ui.ContainerRenderer.prototype.decorate = function $goog$ui$ContainerRenderer$$decorate$(container, element) { | |
10411 | element.id && container.setId(element.id); | |
10412 | var baseClass = this.getCssClass(), hasBaseClass = !1, classNames = goog.dom.classlist.get(element); | |
10413 | classNames && goog.array.forEach(classNames, function(className) { | |
10414 | className == baseClass ? hasBaseClass = !0 : className && this.setStateFromClassName(container, className, baseClass); | |
10415 | }, this); | |
10416 | hasBaseClass || goog.dom.classlist.add(element, baseClass); | |
10417 | this.decorateChildren(container, this.getContentElement(element)); | |
10418 | return element; | |
10419 | }; | |
10420 | goog.ui.ContainerRenderer.prototype.setStateFromClassName = function $goog$ui$ContainerRenderer$$setStateFromClassName$(container, className, baseClass) { | |
10421 | className == baseClass + "-disabled" ? container.setEnabled(!1) : className == baseClass + "-horizontal" ? container.setOrientation(goog.ui.Container.Orientation.HORIZONTAL) : className == baseClass + "-vertical" && container.setOrientation(goog.ui.Container.Orientation.VERTICAL); | |
10422 | }; | |
10423 | goog.ui.ContainerRenderer.prototype.decorateChildren = function $goog$ui$ContainerRenderer$$decorateChildren$(container, element, opt_firstChild) { | |
10424 | if (element) { | |
10425 | for (var node = opt_firstChild || element.firstChild, next;node && node.parentNode == element;) { | |
10426 | next = node.nextSibling; | |
10427 | if (node.nodeType == goog.dom.NodeType.ELEMENT) { | |
10428 | var child = this.getDecoratorForChild(node); | |
10429 | child && (child.setElementInternal(node), container.isEnabled() || child.setEnabled(!1), container.addChild(child), child.decorate(node)); | |
10430 | } else { | |
10431 | node.nodeValue && "" != goog.string.trim(node.nodeValue) || element.removeChild(node); | |
10432 | } | |
10433 | node = next; | |
10434 | } | |
10435 | } | |
10436 | }; | |
10437 | goog.ui.ContainerRenderer.prototype.getDecoratorForChild = function $goog$ui$ContainerRenderer$$getDecoratorForChild$(element) { | |
10438 | return goog.ui.registry.getDecorator(element); | |
10439 | }; | |
10440 | goog.ui.ContainerRenderer.prototype.initializeDom = function $goog$ui$ContainerRenderer$$initializeDom$(container) { | |
10441 | var elem = container.getElement(); | |
10442 | goog.asserts.assert(elem, "The container DOM element cannot be null."); | |
10443 | goog.style.setUnselectable(elem, !0, goog.userAgent.GECKO); | |
10444 | goog.userAgent.IE && (elem.hideFocus = !0); | |
10445 | var ariaRole = this.getAriaRole(); | |
10446 | ariaRole && goog.a11y.aria.setRole(elem, ariaRole); | |
10447 | }; | |
10448 | goog.ui.ContainerRenderer.prototype.getKeyEventTarget = function $goog$ui$ContainerRenderer$$getKeyEventTarget$(container) { | |
10449 | return container.getElement(); | |
10450 | }; | |
10451 | goog.ui.ContainerRenderer.prototype.getCssClass = function $goog$ui$ContainerRenderer$$getCssClass$() { | |
10452 | return goog.ui.ContainerRenderer.CSS_CLASS; | |
10453 | }; | |
10454 | goog.ui.ContainerRenderer.prototype.getClassNames = function $goog$ui$ContainerRenderer$$getClassNames$(container) { | |
10455 | var baseClass = this.getCssClass(), isHorizontal = container.getOrientation() == goog.ui.Container.Orientation.HORIZONTAL, classNames = [baseClass, isHorizontal ? baseClass + "-horizontal" : baseClass + "-vertical"]; | |
10456 | container.isEnabled() || classNames.push(baseClass + "-disabled"); | |
10457 | return classNames; | |
10458 | }; | |
10459 | goog.ui.ContainerRenderer.prototype.getDefaultOrientation = function $goog$ui$ContainerRenderer$$getDefaultOrientation$() { | |
10460 | return goog.ui.Container.Orientation.VERTICAL; | |
10461 | }; | |
10462 | goog.ui.ControlRenderer = function $goog$ui$ControlRenderer$() { | |
10463 | }; | |
10464 | goog.addSingletonGetter(goog.ui.ControlRenderer); | |
10465 | goog.ui.ControlRenderer.getCustomRenderer = function $goog$ui$ControlRenderer$getCustomRenderer$(ctor, cssClassName) { | |
10466 | var renderer = new ctor; | |
10467 | renderer.getCssClass = function $renderer$getCssClass$() { | |
10468 | return cssClassName; | |
10469 | }; | |
10470 | return renderer; | |
10471 | }; | |
10472 | goog.ui.ControlRenderer.CSS_CLASS = "goog-control"; | |
10473 | goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS = []; | |
10474 | goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_ = goog.object.create(goog.a11y.aria.Role.BUTTON, goog.a11y.aria.State.PRESSED, goog.a11y.aria.Role.CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.MENU_ITEM_CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM_RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.TAB, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.TREEITEM, | |
10475 | goog.a11y.aria.State.SELECTED); | |
10476 | goog.ui.ControlRenderer.prototype.getAriaRole = function $goog$ui$ControlRenderer$$getAriaRole$() { | |
10477 | }; | |
10478 | goog.ui.ControlRenderer.prototype.createDom = function $goog$ui$ControlRenderer$$createDom$(control) { | |
10479 | var element = control.getDomHelper().createDom("div", this.getClassNames(control).join(" "), control.getContent()); | |
10480 | this.setAriaStates(control, element); | |
10481 | return element; | |
10482 | }; | |
10483 | goog.ui.ControlRenderer.prototype.getContentElement = function $goog$ui$ControlRenderer$$getContentElement$(element) { | |
10484 | return element; | |
10485 | }; | |
10486 | goog.ui.ControlRenderer.prototype.enableClassName = function $goog$ui$ControlRenderer$$enableClassName$(control, className, enable) { | |
10487 | var element = control.getElement ? control.getElement() : control; | |
10488 | if (element) { | |
10489 | var classNames = [className]; | |
10490 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && (classNames = this.getAppliedCombinedClassNames_(goog.dom.classlist.get(element), className), classNames.push(className)); | |
10491 | goog.dom.classlist.enableAll(element, classNames, enable); | |
10492 | } | |
10493 | }; | |
10494 | goog.ui.ControlRenderer.prototype.enableExtraClassName = function $goog$ui$ControlRenderer$$enableExtraClassName$(control, className, enable) { | |
10495 | this.enableClassName(control, className, enable); | |
10496 | }; | |
10497 | goog.ui.ControlRenderer.prototype.canDecorate = function $goog$ui$ControlRenderer$$canDecorate$() { | |
10498 | return!0; | |
10499 | }; | |
10500 | goog.ui.ControlRenderer.prototype.decorate = function $goog$ui$ControlRenderer$$decorate$(control, element) { | |
10501 | element.id && control.setId(element.id); | |
10502 | var contentElem = this.getContentElement(element); | |
10503 | contentElem && contentElem.firstChild ? control.setContentInternal(contentElem.firstChild.nextSibling ? goog.array.clone(contentElem.childNodes) : contentElem.firstChild) : control.setContentInternal(null); | |
10504 | var state = 0, rendererClassName = this.getCssClass(), structuralClassName = this.getStructuralCssClass(), hasRendererClassName = !1, hasStructuralClassName = !1, hasCombinedClassName = !1, classNames = goog.array.toArray(goog.dom.classlist.get(element)); | |
10505 | goog.array.forEach(classNames, function(className) { | |
10506 | hasRendererClassName || className != rendererClassName ? hasStructuralClassName || className != structuralClassName ? state |= this.getStateFromClass(className) : hasStructuralClassName = !0 : (hasRendererClassName = !0, structuralClassName == rendererClassName && (hasStructuralClassName = !0)); | |
10507 | }, this); | |
10508 | control.setStateInternal(state); | |
10509 | hasRendererClassName || (classNames.push(rendererClassName), structuralClassName == rendererClassName && (hasStructuralClassName = !0)); | |
10510 | hasStructuralClassName || classNames.push(structuralClassName); | |
10511 | var extraClassNames = control.getExtraClassNames(); | |
10512 | extraClassNames && classNames.push.apply(classNames, extraClassNames); | |
10513 | if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7")) { | |
10514 | var combinedClasses = this.getAppliedCombinedClassNames_(classNames); | |
10515 | 0 < combinedClasses.length && (classNames.push.apply(classNames, combinedClasses), hasCombinedClassName = !0); | |
10516 | } | |
10517 | hasRendererClassName && hasStructuralClassName && !extraClassNames && !hasCombinedClassName || goog.dom.classlist.set(element, classNames.join(" ")); | |
10518 | this.setAriaStates(control, element); | |
10519 | return element; | |
10520 | }; | |
10521 | goog.ui.ControlRenderer.prototype.initializeDom = function $goog$ui$ControlRenderer$$initializeDom$(control) { | |
10522 | control.isRightToLeft() && this.setRightToLeft(control.getElement(), !0); | |
10523 | control.isEnabled() && this.setFocusable(control, control.isVisible()); | |
10524 | }; | |
10525 | goog.ui.ControlRenderer.prototype.setAriaRole = function $goog$ui$ControlRenderer$$setAriaRole$(element, opt_preferredRole) { | |
10526 | var ariaRole = opt_preferredRole || this.getAriaRole(); | |
10527 | if (ariaRole) { | |
10528 | goog.asserts.assert(element, "The element passed as a first parameter cannot be null."); | |
10529 | var currentRole = goog.a11y.aria.getRole(element); | |
10530 | ariaRole != currentRole && goog.a11y.aria.setRole(element, ariaRole); | |
10531 | } | |
10532 | }; | |
10533 | goog.ui.ControlRenderer.prototype.setAriaStates = function $goog$ui$ControlRenderer$$setAriaStates$(control, element) { | |
10534 | goog.asserts.assert(control); | |
10535 | goog.asserts.assert(element); | |
10536 | control.isVisible() || goog.a11y.aria.setState(element, goog.a11y.aria.State.HIDDEN, !control.isVisible()); | |
10537 | control.isEnabled() || this.updateAriaState(element, goog.ui.Component.State.DISABLED, !control.isEnabled()); | |
10538 | control.isSupportedState(goog.ui.Component.State.SELECTED) && this.updateAriaState(element, goog.ui.Component.State.SELECTED, control.isSelected()); | |
10539 | control.isSupportedState(goog.ui.Component.State.CHECKED) && this.updateAriaState(element, goog.ui.Component.State.CHECKED, control.isChecked()); | |
10540 | control.isSupportedState(goog.ui.Component.State.OPENED) && this.updateAriaState(element, goog.ui.Component.State.OPENED, control.isOpen()); | |
10541 | }; | |
10542 | goog.ui.ControlRenderer.prototype.setAllowTextSelection = function $goog$ui$ControlRenderer$$setAllowTextSelection$(element, allow) { | |
10543 | goog.style.setUnselectable(element, !allow, !goog.userAgent.IE && !goog.userAgent.OPERA); | |
10544 | }; | |
10545 | goog.ui.ControlRenderer.prototype.setRightToLeft = function $goog$ui$ControlRenderer$$setRightToLeft$(element, rightToLeft) { | |
10546 | this.enableClassName(element, this.getStructuralCssClass() + "-rtl", rightToLeft); | |
10547 | }; | |
10548 | goog.ui.ControlRenderer.prototype.isFocusable = function $goog$ui$ControlRenderer$$isFocusable$(control) { | |
10549 | var keyTarget; | |
10550 | return control.isSupportedState(goog.ui.Component.State.FOCUSED) && (keyTarget = control.getKeyEventTarget()) ? goog.dom.isFocusableTabIndex(keyTarget) : !1; | |
10551 | }; | |
10552 | goog.ui.ControlRenderer.prototype.setFocusable = function $goog$ui$ControlRenderer$$setFocusable$(control, focusable) { | |
10553 | var keyTarget; | |
10554 | if (control.isSupportedState(goog.ui.Component.State.FOCUSED) && (keyTarget = control.getKeyEventTarget())) { | |
10555 | if (!focusable && control.isFocused()) { | |
10556 | try { | |
10557 | keyTarget.blur(); | |
10558 | } catch (e) { | |
10559 | } | |
10560 | control.isFocused() && control.handleBlur(null); | |
10561 | } | |
10562 | goog.dom.isFocusableTabIndex(keyTarget) != focusable && goog.dom.setFocusableTabIndex(keyTarget, focusable); | |
10563 | } | |
10564 | }; | |
10565 | goog.ui.ControlRenderer.prototype.setVisible = function $goog$ui$ControlRenderer$$setVisible$(element, visible) { | |
10566 | goog.style.setElementShown(element, visible); | |
10567 | element && goog.a11y.aria.setState(element, goog.a11y.aria.State.HIDDEN, !visible); | |
10568 | }; | |
10569 | goog.ui.ControlRenderer.prototype.setState = function $goog$ui$ControlRenderer$$setState$(control, state, enable) { | |
10570 | var element = control.getElement(); | |
10571 | if (element) { | |
10572 | var className = this.getClassForState(state); | |
10573 | className && this.enableClassName(control, className, enable); | |
10574 | this.updateAriaState(element, state, enable); | |
10575 | } | |
10576 | }; | |
10577 | goog.ui.ControlRenderer.prototype.updateAriaState = function $goog$ui$ControlRenderer$$updateAriaState$(element, state, enable) { | |
10578 | goog.ui.ControlRenderer.ARIA_ATTRIBUTE_MAP_ || (goog.ui.ControlRenderer.ARIA_ATTRIBUTE_MAP_ = goog.object.create(goog.ui.Component.State.DISABLED, goog.a11y.aria.State.DISABLED, goog.ui.Component.State.SELECTED, goog.a11y.aria.State.SELECTED, goog.ui.Component.State.CHECKED, goog.a11y.aria.State.CHECKED, goog.ui.Component.State.OPENED, goog.a11y.aria.State.EXPANDED)); | |
10579 | goog.asserts.assert(element, "The element passed as a first parameter cannot be null."); | |
10580 | var ariaAttr = goog.ui.ControlRenderer.getAriaStateForAriaRole_(element, goog.ui.ControlRenderer.ARIA_ATTRIBUTE_MAP_[state]); | |
10581 | ariaAttr && goog.a11y.aria.setState(element, ariaAttr, enable); | |
10582 | }; | |
10583 | goog.ui.ControlRenderer.getAriaStateForAriaRole_ = function $goog$ui$ControlRenderer$getAriaStateForAriaRole_$(element, attr) { | |
10584 | var role = goog.a11y.aria.getRole(element); | |
10585 | if (!role) { | |
10586 | return attr; | |
10587 | } | |
10588 | var matchAttr = goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_[role] || attr; | |
10589 | return goog.ui.ControlRenderer.isAriaState_(attr) ? matchAttr : attr; | |
10590 | }; | |
10591 | goog.ui.ControlRenderer.isAriaState_ = function $goog$ui$ControlRenderer$isAriaState_$(attr) { | |
10592 | return attr == goog.a11y.aria.State.CHECKED || attr == goog.a11y.aria.State.SELECTED; | |
10593 | }; | |
10594 | goog.ui.ControlRenderer.prototype.getKeyEventTarget = function $goog$ui$ControlRenderer$$getKeyEventTarget$(control) { | |
10595 | return control.getElement(); | |
10596 | }; | |
10597 | goog.ui.ControlRenderer.prototype.getCssClass = function $goog$ui$ControlRenderer$$getCssClass$() { | |
10598 | return goog.ui.ControlRenderer.CSS_CLASS; | |
10599 | }; | |
10600 | goog.ui.ControlRenderer.prototype.getIe6ClassCombinations = function $goog$ui$ControlRenderer$$getIe6ClassCombinations$() { | |
10601 | return[]; | |
10602 | }; | |
10603 | goog.ui.ControlRenderer.prototype.getStructuralCssClass = function $goog$ui$ControlRenderer$$getStructuralCssClass$() { | |
10604 | return this.getCssClass(); | |
10605 | }; | |
10606 | goog.ui.ControlRenderer.prototype.getClassNames = function $goog$ui$ControlRenderer$$getClassNames$(control) { | |
10607 | var cssClass = this.getCssClass(), classNames = [cssClass], structuralCssClass = this.getStructuralCssClass(); | |
10608 | structuralCssClass != cssClass && classNames.push(structuralCssClass); | |
10609 | var classNamesForState = this.getClassNamesForState(control.getState()); | |
10610 | classNames.push.apply(classNames, classNamesForState); | |
10611 | var extraClassNames = control.getExtraClassNames(); | |
10612 | extraClassNames && classNames.push.apply(classNames, extraClassNames); | |
10613 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && classNames.push.apply(classNames, this.getAppliedCombinedClassNames_(classNames)); | |
10614 | return classNames; | |
10615 | }; | |
10616 | goog.ui.ControlRenderer.prototype.getAppliedCombinedClassNames_ = function $goog$ui$ControlRenderer$$getAppliedCombinedClassNames_$(classes, opt_includedClass) { | |
10617 | var toAdd = []; | |
10618 | opt_includedClass && (classes = classes.concat([opt_includedClass])); | |
10619 | goog.array.forEach(this.getIe6ClassCombinations(), function(combo) { | |
10620 | !goog.array.every(combo, goog.partial(goog.array.contains, classes)) || opt_includedClass && !goog.array.contains(combo, opt_includedClass) || toAdd.push(combo.join("_")); | |
10621 | }); | |
10622 | return toAdd; | |
10623 | }; | |
10624 | goog.ui.ControlRenderer.prototype.getClassNamesForState = function $goog$ui$ControlRenderer$$getClassNamesForState$(state) { | |
10625 | for (var classNames = [];state;) { | |
10626 | var mask = state & -state; | |
10627 | classNames.push(this.getClassForState(mask)); | |
10628 | state &= ~mask; | |
10629 | } | |
10630 | return classNames; | |
10631 | }; | |
10632 | goog.ui.ControlRenderer.prototype.getClassForState = function $goog$ui$ControlRenderer$$getClassForState$(state) { | |
10633 | this.classByState_ || this.createClassByStateMap_(); | |
10634 | return this.classByState_[state]; | |
10635 | }; | |
10636 | goog.ui.ControlRenderer.prototype.getStateFromClass = function $goog$ui$ControlRenderer$$getStateFromClass$(className) { | |
10637 | this.stateByClass_ || this.createStateByClassMap_(); | |
10638 | var state = parseInt(this.stateByClass_[className], 10); | |
10639 | return isNaN(state) ? 0 : state; | |
10640 | }; | |
10641 | goog.ui.ControlRenderer.prototype.createClassByStateMap_ = function $goog$ui$ControlRenderer$$createClassByStateMap_$() { | |
10642 | var baseClass = this.getStructuralCssClass(), isValidClassName = !goog.string.contains(goog.string.normalizeWhitespace(baseClass), " "); | |
10643 | goog.asserts.assert(isValidClassName, "ControlRenderer has an invalid css class: '" + baseClass + "'"); | |
10644 | this.classByState_ = goog.object.create(goog.ui.Component.State.DISABLED, baseClass + "-disabled", goog.ui.Component.State.HOVER, baseClass + "-hover", goog.ui.Component.State.ACTIVE, baseClass + "-active", goog.ui.Component.State.SELECTED, baseClass + "-selected", goog.ui.Component.State.CHECKED, baseClass + "-checked", goog.ui.Component.State.FOCUSED, baseClass + "-focused", goog.ui.Component.State.OPENED, baseClass + "-open"); | |
10645 | }; | |
10646 | goog.ui.ControlRenderer.prototype.createStateByClassMap_ = function $goog$ui$ControlRenderer$$createStateByClassMap_$() { | |
10647 | this.classByState_ || this.createClassByStateMap_(); | |
10648 | this.stateByClass_ = goog.object.transpose(this.classByState_); | |
10649 | }; | |
10650 | goog.ui.decorate = function $goog$ui$decorate$(element) { | |
10651 | var decorator = goog.ui.registry.getDecorator(element); | |
10652 | decorator && decorator.decorate(element); | |
10653 | return decorator; | |
10654 | }; | |
10655 | goog.ui.Control = function $goog$ui$Control$(opt_content, opt_renderer, opt_domHelper) { | |
10656 | goog.ui.Component.call(this, opt_domHelper); | |
10657 | this.renderer_ = opt_renderer || goog.ui.registry.getDefaultRenderer(this.constructor); | |
10658 | this.setContentInternal(goog.isDef(opt_content) ? opt_content : null); | |
10659 | }; | |
10660 | goog.inherits(goog.ui.Control, goog.ui.Component); | |
10661 | goog.ui.Control.registerDecorator = goog.ui.registry.setDecoratorByClassName; | |
10662 | goog.ui.Control.getDecorator = goog.ui.registry.getDecorator; | |
10663 | goog.ui.Control.decorate = goog.ui.decorate; | |
10664 | goog.ui.Control.prototype.content_ = null; | |
10665 | goog.ui.Control.prototype.state_ = 0; | |
10666 | goog.ui.Control.prototype.supportedStates_ = goog.ui.Component.State.DISABLED | goog.ui.Component.State.HOVER | goog.ui.Component.State.ACTIVE | goog.ui.Component.State.FOCUSED; | |
10667 | goog.ui.Control.prototype.autoStates_ = goog.ui.Component.State.ALL; | |
10668 | goog.ui.Control.prototype.statesWithTransitionEvents_ = 0; | |
10669 | goog.ui.Control.prototype.visible_ = !0; | |
10670 | goog.ui.Control.prototype.extraClassNames_ = null; | |
10671 | goog.ui.Control.prototype.handleMouseEvents_ = !0; | |
10672 | goog.ui.Control.prototype.allowTextSelection_ = !1; | |
10673 | goog.ui.Control.prototype.preferredAriaRole_ = null; | |
10674 | goog.ui.Control.prototype.isHandleMouseEvents = function $goog$ui$Control$$isHandleMouseEvents$() { | |
10675 | return this.handleMouseEvents_; | |
10676 | }; | |
10677 | goog.ui.Control.prototype.setHandleMouseEvents = function $goog$ui$Control$$setHandleMouseEvents$(enable) { | |
10678 | this.isInDocument() && enable != this.handleMouseEvents_ && this.enableMouseEventHandling_(enable); | |
10679 | this.handleMouseEvents_ = enable; | |
10680 | }; | |
10681 | goog.ui.Control.prototype.getKeyEventTarget = function $goog$ui$Control$$getKeyEventTarget$() { | |
10682 | return this.renderer_.getKeyEventTarget(this); | |
10683 | }; | |
10684 | goog.ui.Control.prototype.getKeyHandler = function $goog$ui$Control$$getKeyHandler$() { | |
10685 | return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler); | |
10686 | }; | |
10687 | goog.ui.Control.prototype.getExtraClassNames = function $goog$ui$Control$$getExtraClassNames$() { | |
10688 | return this.extraClassNames_; | |
10689 | }; | |
10690 | goog.ui.Control.prototype.addClassName = function $goog$ui$Control$$addClassName$(className) { | |
10691 | className && (this.extraClassNames_ ? goog.array.contains(this.extraClassNames_, className) || this.extraClassNames_.push(className) : this.extraClassNames_ = [className], this.renderer_.enableExtraClassName(this, className, !0)); | |
10692 | }; | |
10693 | goog.ui.Control.prototype.removeClassName = function $goog$ui$Control$$removeClassName$(className) { | |
10694 | className && this.extraClassNames_ && goog.array.remove(this.extraClassNames_, className) && (0 == this.extraClassNames_.length && (this.extraClassNames_ = null), this.renderer_.enableExtraClassName(this, className, !1)); | |
10695 | }; | |
10696 | goog.ui.Control.prototype.enableClassName = function $goog$ui$Control$$enableClassName$(className, enable) { | |
10697 | enable ? this.addClassName(className) : this.removeClassName(className); | |
10698 | }; | |
10699 | goog.ui.Control.prototype.createDom = function $goog$ui$Control$$createDom$() { | |
10700 | var element = this.renderer_.createDom(this); | |
10701 | this.setElementInternal(element); | |
10702 | this.renderer_.setAriaRole(element, this.getPreferredAriaRole()); | |
10703 | this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(element, !1); | |
10704 | this.isVisible() || this.renderer_.setVisible(element, !1); | |
10705 | }; | |
10706 | goog.ui.Control.prototype.getPreferredAriaRole = function $goog$ui$Control$$getPreferredAriaRole$() { | |
10707 | return this.preferredAriaRole_; | |
10708 | }; | |
10709 | goog.ui.Control.prototype.getContentElement = function $goog$ui$Control$$getContentElement$() { | |
10710 | return this.renderer_.getContentElement(this.getElement()); | |
10711 | }; | |
10712 | goog.ui.Control.prototype.canDecorate = function $goog$ui$Control$$canDecorate$(element) { | |
10713 | return this.renderer_.canDecorate(element); | |
10714 | }; | |
10715 | goog.ui.Control.prototype.decorateInternal = function $goog$ui$Control$$decorateInternal$(element) { | |
10716 | element = this.renderer_.decorate(this, element); | |
10717 | this.setElementInternal(element); | |
10718 | this.renderer_.setAriaRole(element, this.getPreferredAriaRole()); | |
10719 | this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(element, !1); | |
10720 | this.visible_ = "none" != element.style.display; | |
10721 | }; | |
10722 | goog.ui.Control.prototype.enterDocument = function $goog$ui$Control$$enterDocument$() { | |
10723 | goog.ui.Control.superClass_.enterDocument.call(this); | |
10724 | this.renderer_.initializeDom(this); | |
10725 | if (this.supportedStates_ & ~goog.ui.Component.State.DISABLED && (this.isHandleMouseEvents() && this.enableMouseEventHandling_(!0), this.isSupportedState(goog.ui.Component.State.FOCUSED))) { | |
10726 | var keyTarget = this.getKeyEventTarget(); | |
10727 | if (keyTarget) { | |
10728 | var keyHandler = this.getKeyHandler(); | |
10729 | keyHandler.attach(keyTarget); | |
10730 | this.getHandler().listen(keyHandler, goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent).listen(keyTarget, goog.events.EventType.FOCUS, this.handleFocus).listen(keyTarget, goog.events.EventType.BLUR, this.handleBlur); | |
10731 | } | |
10732 | } | |
10733 | }; | |
10734 | goog.ui.Control.prototype.enableMouseEventHandling_ = function $goog$ui$Control$$enableMouseEventHandling_$(enable) { | |
10735 | var handler = this.getHandler(), element = this.getElement(); | |
10736 | enable ? (handler.listen(element, goog.events.EventType.MOUSEOVER, this.handleMouseOver).listen(element, goog.events.EventType.MOUSEDOWN, this.handleMouseDown).listen(element, goog.events.EventType.MOUSEUP, this.handleMouseUp).listen(element, goog.events.EventType.MOUSEOUT, this.handleMouseOut), this.handleContextMenu != goog.nullFunction && handler.listen(element, goog.events.EventType.CONTEXTMENU, this.handleContextMenu), goog.userAgent.IE && handler.listen(element, goog.events.EventType.DBLCLICK, | |
10737 | this.handleDblClick)) : (handler.unlisten(element, goog.events.EventType.MOUSEOVER, this.handleMouseOver).unlisten(element, goog.events.EventType.MOUSEDOWN, this.handleMouseDown).unlisten(element, goog.events.EventType.MOUSEUP, this.handleMouseUp).unlisten(element, goog.events.EventType.MOUSEOUT, this.handleMouseOut), this.handleContextMenu != goog.nullFunction && handler.unlisten(element, goog.events.EventType.CONTEXTMENU, this.handleContextMenu), goog.userAgent.IE && handler.unlisten(element, | |
10738 | goog.events.EventType.DBLCLICK, this.handleDblClick)); | |
10739 | }; | |
10740 | goog.ui.Control.prototype.exitDocument = function $goog$ui$Control$$exitDocument$() { | |
10741 | goog.ui.Control.superClass_.exitDocument.call(this); | |
10742 | this.keyHandler_ && this.keyHandler_.detach(); | |
10743 | this.isVisible() && this.isEnabled() && this.renderer_.setFocusable(this, !1); | |
10744 | }; | |
10745 | goog.ui.Control.prototype.disposeInternal = function $goog$ui$Control$$disposeInternal$() { | |
10746 | goog.ui.Control.superClass_.disposeInternal.call(this); | |
10747 | this.keyHandler_ && (this.keyHandler_.dispose(), delete this.keyHandler_); | |
10748 | delete this.renderer_; | |
10749 | this.extraClassNames_ = this.content_ = null; | |
10750 | }; | |
10751 | goog.ui.Control.prototype.getContent = function $goog$ui$Control$$getContent$() { | |
10752 | return this.content_; | |
10753 | }; | |
10754 | goog.ui.Control.prototype.setContentInternal = function $goog$ui$Control$$setContentInternal$(content) { | |
10755 | this.content_ = content; | |
10756 | }; | |
10757 | goog.ui.Control.prototype.setRightToLeft = function $goog$ui$Control$$setRightToLeft$(rightToLeft) { | |
10758 | goog.ui.Control.superClass_.setRightToLeft.call(this, rightToLeft); | |
10759 | var element = this.getElement(); | |
10760 | element && this.renderer_.setRightToLeft(element, rightToLeft); | |
10761 | }; | |
10762 | goog.ui.Control.prototype.isAllowTextSelection = function $goog$ui$Control$$isAllowTextSelection$() { | |
10763 | return this.allowTextSelection_; | |
10764 | }; | |
10765 | goog.ui.Control.prototype.setAllowTextSelection = function $goog$ui$Control$$setAllowTextSelection$(allow) { | |
10766 | this.allowTextSelection_ = allow; | |
10767 | var element = this.getElement(); | |
10768 | element && this.renderer_.setAllowTextSelection(element, allow); | |
10769 | }; | |
10770 | goog.ui.Control.prototype.isVisible = function $goog$ui$Control$$isVisible$() { | |
10771 | return this.visible_; | |
10772 | }; | |
10773 | goog.ui.Control.prototype.setVisible = function $goog$ui$Control$$setVisible$(visible, opt_force) { | |
10774 | if (opt_force || this.visible_ != visible && this.dispatchEvent(visible ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) { | |
10775 | var element = this.getElement(); | |
10776 | element && this.renderer_.setVisible(element, visible); | |
10777 | this.isEnabled() && this.renderer_.setFocusable(this, visible); | |
10778 | this.visible_ = visible; | |
10779 | return!0; | |
10780 | } | |
10781 | return!1; | |
10782 | }; | |
10783 | goog.ui.Control.prototype.isEnabled = function $goog$ui$Control$$isEnabled$() { | |
10784 | return!this.hasState(goog.ui.Component.State.DISABLED); | |
10785 | }; | |
10786 | goog.ui.Control.prototype.isParentDisabled_ = function $goog$ui$Control$$isParentDisabled_$() { | |
10787 | var parent = this.getParent(); | |
10788 | return!!parent && "function" == typeof parent.isEnabled && !parent.isEnabled(); | |
10789 | }; | |
10790 | goog.ui.Control.prototype.setEnabled = function $goog$ui$Control$$setEnabled$(enable) { | |
10791 | !this.isParentDisabled_() && this.isTransitionAllowed(goog.ui.Component.State.DISABLED, !enable) && (enable || (this.setActive(!1), this.setHighlighted(!1)), this.isVisible() && this.renderer_.setFocusable(this, enable), this.setState(goog.ui.Component.State.DISABLED, !enable)); | |
10792 | }; | |
10793 | goog.ui.Control.prototype.isHighlighted = function $goog$ui$Control$$isHighlighted$() { | |
10794 | return this.hasState(goog.ui.Component.State.HOVER); | |
10795 | }; | |
10796 | goog.ui.Control.prototype.setHighlighted = function $goog$ui$Control$$setHighlighted$(highlight) { | |
10797 | this.isTransitionAllowed(goog.ui.Component.State.HOVER, highlight) && this.setState(goog.ui.Component.State.HOVER, highlight); | |
10798 | }; | |
10799 | goog.ui.Control.prototype.isActive = function $goog$ui$Control$$isActive$() { | |
10800 | return this.hasState(goog.ui.Component.State.ACTIVE); | |
10801 | }; | |
10802 | goog.ui.Control.prototype.setActive = function $goog$ui$Control$$setActive$(active) { | |
10803 | this.isTransitionAllowed(goog.ui.Component.State.ACTIVE, active) && this.setState(goog.ui.Component.State.ACTIVE, active); | |
10804 | }; | |
10805 | goog.ui.Control.prototype.isSelected = function $goog$ui$Control$$isSelected$() { | |
10806 | return this.hasState(goog.ui.Component.State.SELECTED); | |
10807 | }; | |
10808 | goog.ui.Control.prototype.setSelected = function $goog$ui$Control$$setSelected$(select) { | |
10809 | this.isTransitionAllowed(goog.ui.Component.State.SELECTED, select) && this.setState(goog.ui.Component.State.SELECTED, select); | |
10810 | }; | |
10811 | goog.ui.Control.prototype.isChecked = function $goog$ui$Control$$isChecked$() { | |
10812 | return this.hasState(goog.ui.Component.State.CHECKED); | |
10813 | }; | |
10814 | goog.ui.Control.prototype.setChecked = function $goog$ui$Control$$setChecked$(check) { | |
10815 | this.isTransitionAllowed(goog.ui.Component.State.CHECKED, check) && this.setState(goog.ui.Component.State.CHECKED, check); | |
10816 | }; | |
10817 | goog.ui.Control.prototype.isFocused = function $goog$ui$Control$$isFocused$() { | |
10818 | return this.hasState(goog.ui.Component.State.FOCUSED); | |
10819 | }; | |
10820 | goog.ui.Control.prototype.setFocused = function $goog$ui$Control$$setFocused$(focused) { | |
10821 | this.isTransitionAllowed(goog.ui.Component.State.FOCUSED, focused) && this.setState(goog.ui.Component.State.FOCUSED, focused); | |
10822 | }; | |
10823 | goog.ui.Control.prototype.isOpen = function $goog$ui$Control$$isOpen$() { | |
10824 | return this.hasState(goog.ui.Component.State.OPENED); | |
10825 | }; | |
10826 | goog.ui.Control.prototype.setOpen = function $goog$ui$Control$$setOpen$(open) { | |
10827 | this.isTransitionAllowed(goog.ui.Component.State.OPENED, open) && this.setState(goog.ui.Component.State.OPENED, open); | |
10828 | }; | |
10829 | goog.ui.Control.prototype.getState = function $goog$ui$Control$$getState$() { | |
10830 | return this.state_; | |
10831 | }; | |
10832 | goog.ui.Control.prototype.hasState = function $goog$ui$Control$$hasState$(state) { | |
10833 | return!!(this.state_ & state); | |
10834 | }; | |
10835 | goog.ui.Control.prototype.setState = function $goog$ui$Control$$setState$(state, enable) { | |
10836 | this.isSupportedState(state) && enable != this.hasState(state) && (this.renderer_.setState(this, state, enable), this.state_ = enable ? this.state_ | state : this.state_ & ~state); | |
10837 | }; | |
10838 | goog.ui.Control.prototype.setStateInternal = function $goog$ui$Control$$setStateInternal$(state) { | |
10839 | this.state_ = state; | |
10840 | }; | |
10841 | goog.ui.Control.prototype.isSupportedState = function $goog$ui$Control$$isSupportedState$(state) { | |
10842 | return!!(this.supportedStates_ & state); | |
10843 | }; | |
10844 | goog.ui.Control.prototype.setSupportedState = function $goog$ui$Control$$setSupportedState$(state, support) { | |
10845 | if (this.isInDocument() && this.hasState(state) && !support) { | |
10846 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
10847 | } | |
10848 | !support && this.hasState(state) && this.setState(state, !1); | |
10849 | this.supportedStates_ = support ? this.supportedStates_ | state : this.supportedStates_ & ~state; | |
10850 | }; | |
10851 | goog.ui.Control.prototype.isAutoState = function $goog$ui$Control$$isAutoState$(state) { | |
10852 | return!!(this.autoStates_ & state) && this.isSupportedState(state); | |
10853 | }; | |
10854 | goog.ui.Control.prototype.setDispatchTransitionEvents = function $goog$ui$Control$$setDispatchTransitionEvents$(states, enable) { | |
10855 | this.statesWithTransitionEvents_ = enable ? this.statesWithTransitionEvents_ | states : this.statesWithTransitionEvents_ & ~states; | |
10856 | }; | |
10857 | goog.ui.Control.prototype.isTransitionAllowed = function $goog$ui$Control$$isTransitionAllowed$(state, enable) { | |
10858 | return this.isSupportedState(state) && this.hasState(state) != enable && (!(this.statesWithTransitionEvents_ & state) || this.dispatchEvent(goog.ui.Component.getStateTransitionEvent(state, enable))) && !this.isDisposed(); | |
10859 | }; | |
10860 | goog.ui.Control.prototype.handleMouseOver = function $goog$ui$Control$$handleMouseOver$(e) { | |
10861 | !goog.ui.Control.isMouseEventWithinElement_(e, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.ENTER) && this.isEnabled() && this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0); | |
10862 | }; | |
10863 | goog.ui.Control.prototype.handleMouseOut = function $goog$ui$Control$$handleMouseOut$(e) { | |
10864 | !goog.ui.Control.isMouseEventWithinElement_(e, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.LEAVE) && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1), this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!1)); | |
10865 | }; | |
10866 | goog.ui.Control.prototype.handleContextMenu = goog.nullFunction; | |
10867 | goog.ui.Control.isMouseEventWithinElement_ = function $goog$ui$Control$isMouseEventWithinElement_$(e, elem) { | |
10868 | return!!e.relatedTarget && goog.dom.contains(elem, e.relatedTarget); | |
10869 | }; | |
10870 | goog.ui.Control.prototype.handleMouseDown = function $goog$ui$Control$$handleMouseDown$(e) { | |
10871 | this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0), e.isMouseActionButton() && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!0), this.renderer_.isFocusable(this) && this.getKeyEventTarget().focus())); | |
10872 | !this.isAllowTextSelection() && e.isMouseActionButton() && e.preventDefault(); | |
10873 | }; | |
10874 | goog.ui.Control.prototype.handleMouseUp = function $goog$ui$Control$$handleMouseUp$(e) { | |
10875 | this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0), this.isActive() && this.performActionInternal(e) && this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1)); | |
10876 | }; | |
10877 | goog.ui.Control.prototype.handleDblClick = function $goog$ui$Control$$handleDblClick$(e) { | |
10878 | this.isEnabled() && this.performActionInternal(e); | |
10879 | }; | |
10880 | goog.ui.Control.prototype.performActionInternal = function $goog$ui$Control$$performActionInternal$(e) { | |
10881 | this.isAutoState(goog.ui.Component.State.CHECKED) && this.setChecked(!this.isChecked()); | |
10882 | this.isAutoState(goog.ui.Component.State.SELECTED) && this.setSelected(!0); | |
10883 | this.isAutoState(goog.ui.Component.State.OPENED) && this.setOpen(!this.isOpen()); | |
10884 | var actionEvent = new goog.events.Event(goog.ui.Component.EventType.ACTION, this); | |
10885 | e && (actionEvent.altKey = e.altKey, actionEvent.ctrlKey = e.ctrlKey, actionEvent.metaKey = e.metaKey, actionEvent.shiftKey = e.shiftKey, actionEvent.platformModifierKey = e.platformModifierKey); | |
10886 | return this.dispatchEvent(actionEvent); | |
10887 | }; | |
10888 | goog.ui.Control.prototype.handleFocus = function $goog$ui$Control$$handleFocus$() { | |
10889 | this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!0); | |
10890 | }; | |
10891 | goog.ui.Control.prototype.handleBlur = function $goog$ui$Control$$handleBlur$() { | |
10892 | this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1); | |
10893 | this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!1); | |
10894 | }; | |
10895 | goog.ui.Control.prototype.handleKeyEvent = function $goog$ui$Control$$handleKeyEvent$(e) { | |
10896 | return this.isVisible() && this.isEnabled() && this.handleKeyEventInternal(e) ? (e.preventDefault(), e.stopPropagation(), !0) : !1; | |
10897 | }; | |
10898 | goog.ui.Control.prototype.handleKeyEventInternal = function $goog$ui$Control$$handleKeyEventInternal$(e) { | |
10899 | return e.keyCode == goog.events.KeyCodes.ENTER && this.performActionInternal(e); | |
10900 | }; | |
10901 | goog.ui.registry.setDefaultRenderer(goog.ui.Control, goog.ui.ControlRenderer); | |
10902 | goog.ui.registry.setDecoratorByClassName(goog.ui.ControlRenderer.CSS_CLASS, function() { | |
10903 | return new goog.ui.Control(null); | |
10904 | }); | |
10905 | goog.ui.Container = function $goog$ui$Container$(opt_orientation, opt_renderer, opt_domHelper) { | |
10906 | goog.ui.Component.call(this, opt_domHelper); | |
10907 | this.renderer_ = opt_renderer || goog.ui.ContainerRenderer.getInstance(); | |
10908 | this.orientation_ = opt_orientation || this.renderer_.getDefaultOrientation(); | |
10909 | }; | |
10910 | goog.inherits(goog.ui.Container, goog.ui.Component); | |
10911 | goog.ui.Container.EventType = {AFTER_SHOW:"aftershow", AFTER_HIDE:"afterhide"}; | |
10912 | goog.ui.Container.Orientation = {HORIZONTAL:"horizontal", VERTICAL:"vertical"}; | |
10913 | goog.ui.Container.prototype.keyEventTarget_ = null; | |
10914 | goog.ui.Container.prototype.keyHandler_ = null; | |
10915 | goog.ui.Container.prototype.renderer_ = null; | |
10916 | goog.ui.Container.prototype.orientation_ = null; | |
10917 | goog.ui.Container.prototype.visible_ = !0; | |
10918 | goog.ui.Container.prototype.enabled_ = !0; | |
10919 | goog.ui.Container.prototype.focusable_ = !0; | |
10920 | goog.ui.Container.prototype.highlightedIndex_ = -1; | |
10921 | goog.ui.Container.prototype.openItem_ = null; | |
10922 | goog.ui.Container.prototype.mouseButtonPressed_ = !1; | |
10923 | goog.ui.Container.prototype.allowFocusableChildren_ = !1; | |
10924 | goog.ui.Container.prototype.openFollowsHighlight_ = !0; | |
10925 | goog.ui.Container.prototype.childElementIdMap_ = null; | |
10926 | goog.ui.Container.prototype.getKeyEventTarget = function $goog$ui$Container$$getKeyEventTarget$() { | |
10927 | return this.keyEventTarget_ || this.renderer_.getKeyEventTarget(this); | |
10928 | }; | |
10929 | goog.ui.Container.prototype.getKeyHandler = function $goog$ui$Container$$getKeyHandler$() { | |
10930 | return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler(this.getKeyEventTarget())); | |
10931 | }; | |
10932 | goog.ui.Container.prototype.createDom = function $goog$ui$Container$$createDom$() { | |
10933 | this.setElementInternal(this.renderer_.createDom(this)); | |
10934 | }; | |
10935 | goog.ui.Container.prototype.getContentElement = function $goog$ui$Container$$getContentElement$() { | |
10936 | return this.renderer_.getContentElement(this.getElement()); | |
10937 | }; | |
10938 | goog.ui.Container.prototype.canDecorate = function $goog$ui$Container$$canDecorate$(element) { | |
10939 | return this.renderer_.canDecorate(element); | |
10940 | }; | |
10941 | goog.ui.Container.prototype.decorateInternal = function $goog$ui$Container$$decorateInternal$(element) { | |
10942 | this.setElementInternal(this.renderer_.decorate(this, element)); | |
10943 | "none" == element.style.display && (this.visible_ = !1); | |
10944 | }; | |
10945 | goog.ui.Container.prototype.enterDocument = function $goog$ui$Container$$enterDocument$() { | |
10946 | goog.ui.Container.superClass_.enterDocument.call(this); | |
10947 | this.forEachChild(function(child) { | |
10948 | child.isInDocument() && this.registerChildId_(child); | |
10949 | }, this); | |
10950 | var elem = this.getElement(); | |
10951 | this.renderer_.initializeDom(this); | |
10952 | this.setVisible(this.visible_, !0); | |
10953 | this.getHandler().listen(this, goog.ui.Component.EventType.ENTER, this.handleEnterItem).listen(this, goog.ui.Component.EventType.HIGHLIGHT, this.handleHighlightItem).listen(this, goog.ui.Component.EventType.UNHIGHLIGHT, this.handleUnHighlightItem).listen(this, goog.ui.Component.EventType.OPEN, this.handleOpenItem).listen(this, goog.ui.Component.EventType.CLOSE, this.handleCloseItem).listen(elem, goog.events.EventType.MOUSEDOWN, this.handleMouseDown).listen(goog.dom.getOwnerDocument(elem), goog.events.EventType.MOUSEUP, | |
10954 | this.handleDocumentMouseUp).listen(elem, [goog.events.EventType.MOUSEDOWN, goog.events.EventType.MOUSEUP, goog.events.EventType.MOUSEOVER, goog.events.EventType.MOUSEOUT, goog.events.EventType.CONTEXTMENU], this.handleChildMouseEvents); | |
10955 | this.isFocusable() && this.enableFocusHandling_(!0); | |
10956 | }; | |
10957 | goog.ui.Container.prototype.enableFocusHandling_ = function $goog$ui$Container$$enableFocusHandling_$(enable) { | |
10958 | var handler = this.getHandler(), keyTarget = this.getKeyEventTarget(); | |
10959 | enable ? handler.listen(keyTarget, goog.events.EventType.FOCUS, this.handleFocus).listen(keyTarget, goog.events.EventType.BLUR, this.handleBlur).listen(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent) : handler.unlisten(keyTarget, goog.events.EventType.FOCUS, this.handleFocus).unlisten(keyTarget, goog.events.EventType.BLUR, this.handleBlur).unlisten(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent); | |
10960 | }; | |
10961 | goog.ui.Container.prototype.exitDocument = function $goog$ui$Container$$exitDocument$() { | |
10962 | this.setHighlightedIndex(-1); | |
10963 | this.openItem_ && this.openItem_.setOpen(!1); | |
10964 | this.mouseButtonPressed_ = !1; | |
10965 | goog.ui.Container.superClass_.exitDocument.call(this); | |
10966 | }; | |
10967 | goog.ui.Container.prototype.disposeInternal = function $goog$ui$Container$$disposeInternal$() { | |
10968 | goog.ui.Container.superClass_.disposeInternal.call(this); | |
10969 | this.keyHandler_ && (this.keyHandler_.dispose(), this.keyHandler_ = null); | |
10970 | this.renderer_ = this.openItem_ = this.childElementIdMap_ = this.keyEventTarget_ = null; | |
10971 | }; | |
10972 | goog.ui.Container.prototype.handleEnterItem = function $goog$ui$Container$$handleEnterItem$() { | |
10973 | return!0; | |
10974 | }; | |
10975 | goog.ui.Container.prototype.handleHighlightItem = function $goog$ui$Container$$handleHighlightItem$(e) { | |
10976 | var index = this.indexOfChild(e.target); | |
10977 | if (-1 < index && index != this.highlightedIndex_) { | |
10978 | var item = this.getHighlighted(); | |
10979 | item && item.setHighlighted(!1); | |
10980 | this.highlightedIndex_ = index; | |
10981 | item = this.getHighlighted(); | |
10982 | this.isMouseButtonPressed() && item.setActive(!0); | |
10983 | this.openFollowsHighlight_ && this.openItem_ && item != this.openItem_ && (item.isSupportedState(goog.ui.Component.State.OPENED) ? item.setOpen(!0) : this.openItem_.setOpen(!1)); | |
10984 | } | |
10985 | var element = this.getElement(); | |
10986 | goog.asserts.assert(element, "The DOM element for the container cannot be null."); | |
10987 | null != e.target.getElement() && goog.a11y.aria.setState(element, goog.a11y.aria.State.ACTIVEDESCENDANT, e.target.getElement().id); | |
10988 | }; | |
10989 | goog.ui.Container.prototype.handleUnHighlightItem = function $goog$ui$Container$$handleUnHighlightItem$(e) { | |
10990 | e.target == this.getHighlighted() && (this.highlightedIndex_ = -1); | |
10991 | var element = this.getElement(); | |
10992 | goog.asserts.assert(element, "The DOM element for the container cannot be null."); | |
10993 | goog.a11y.aria.removeState(element, goog.a11y.aria.State.ACTIVEDESCENDANT); | |
10994 | }; | |
10995 | goog.ui.Container.prototype.handleOpenItem = function $goog$ui$Container$$handleOpenItem$(e) { | |
10996 | var item = e.target; | |
10997 | item && item != this.openItem_ && item.getParent() == this && (this.openItem_ && this.openItem_.setOpen(!1), this.openItem_ = item); | |
10998 | }; | |
10999 | goog.ui.Container.prototype.handleCloseItem = function $goog$ui$Container$$handleCloseItem$(e) { | |
11000 | e.target == this.openItem_ && (this.openItem_ = null); | |
11001 | }; | |
11002 | goog.ui.Container.prototype.handleMouseDown = function $goog$ui$Container$$handleMouseDown$(e) { | |
11003 | this.enabled_ && this.setMouseButtonPressed(!0); | |
11004 | var keyTarget = this.getKeyEventTarget(); | |
11005 | keyTarget && goog.dom.isFocusableTabIndex(keyTarget) ? keyTarget.focus() : e.preventDefault(); | |
11006 | }; | |
11007 | goog.ui.Container.prototype.handleDocumentMouseUp = function $goog$ui$Container$$handleDocumentMouseUp$() { | |
11008 | this.setMouseButtonPressed(!1); | |
11009 | }; | |
11010 | goog.ui.Container.prototype.handleChildMouseEvents = function $goog$ui$Container$$handleChildMouseEvents$(e) { | |
11011 | var control = this.getOwnerControl(e.target); | |
11012 | if (control) { | |
11013 | switch(e.type) { | |
11014 | case goog.events.EventType.MOUSEDOWN: | |
11015 | control.handleMouseDown(e); | |
11016 | break; | |
11017 | case goog.events.EventType.MOUSEUP: | |
11018 | control.handleMouseUp(e); | |
11019 | break; | |
11020 | case goog.events.EventType.MOUSEOVER: | |
11021 | control.handleMouseOver(e); | |
11022 | break; | |
11023 | case goog.events.EventType.MOUSEOUT: | |
11024 | control.handleMouseOut(e); | |
11025 | break; | |
11026 | case goog.events.EventType.CONTEXTMENU: | |
11027 | control.handleContextMenu(e); | |
11028 | } | |
11029 | } | |
11030 | }; | |
11031 | goog.ui.Container.prototype.getOwnerControl = function $goog$ui$Container$$getOwnerControl$(node) { | |
11032 | if (this.childElementIdMap_) { | |
11033 | for (var elem = this.getElement();node && node !== elem;) { | |
11034 | var id = node.id; | |
11035 | if (id in this.childElementIdMap_) { | |
11036 | return this.childElementIdMap_[id]; | |
11037 | } | |
11038 | node = node.parentNode; | |
11039 | } | |
11040 | } | |
11041 | return null; | |
11042 | }; | |
11043 | goog.ui.Container.prototype.handleFocus = function $goog$ui$Container$$handleFocus$() { | |
11044 | }; | |
11045 | goog.ui.Container.prototype.handleBlur = function $goog$ui$Container$$handleBlur$() { | |
11046 | this.setHighlightedIndex(-1); | |
11047 | this.setMouseButtonPressed(!1); | |
11048 | this.openItem_ && this.openItem_.setOpen(!1); | |
11049 | }; | |
11050 | goog.ui.Container.prototype.handleKeyEvent = function $goog$ui$Container$$handleKeyEvent$(e) { | |
11051 | return this.isEnabled() && this.isVisible() && (0 != this.getChildCount() || this.keyEventTarget_) && this.handleKeyEventInternal(e) ? (e.preventDefault(), e.stopPropagation(), !0) : !1; | |
11052 | }; | |
11053 | goog.ui.Container.prototype.handleKeyEventInternal = function $goog$ui$Container$$handleKeyEventInternal$(e) { | |
11054 | var highlighted = this.getHighlighted(); | |
11055 | if (highlighted && "function" == typeof highlighted.handleKeyEvent && highlighted.handleKeyEvent(e) || this.openItem_ && this.openItem_ != highlighted && "function" == typeof this.openItem_.handleKeyEvent && this.openItem_.handleKeyEvent(e)) { | |
11056 | return!0; | |
11057 | } | |
11058 | if (e.shiftKey || e.ctrlKey || e.metaKey || e.altKey) { | |
11059 | return!1; | |
11060 | } | |
11061 | switch(e.keyCode) { | |
11062 | case goog.events.KeyCodes.ESC: | |
11063 | if (this.isFocusable()) { | |
11064 | this.getKeyEventTarget().blur(); | |
11065 | } else { | |
11066 | return!1; | |
11067 | } | |
11068 | break; | |
11069 | case goog.events.KeyCodes.HOME: | |
11070 | this.highlightFirst(); | |
11071 | break; | |
11072 | case goog.events.KeyCodes.END: | |
11073 | this.highlightLast(); | |
11074 | break; | |
11075 | case goog.events.KeyCodes.UP: | |
11076 | if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL) { | |
11077 | this.highlightPrevious(); | |
11078 | } else { | |
11079 | return!1; | |
11080 | } | |
11081 | break; | |
11082 | case goog.events.KeyCodes.LEFT: | |
11083 | if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL) { | |
11084 | this.isRightToLeft() ? this.highlightNext() : this.highlightPrevious(); | |
11085 | } else { | |
11086 | return!1; | |
11087 | } | |
11088 | break; | |
11089 | case goog.events.KeyCodes.DOWN: | |
11090 | if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL) { | |
11091 | this.highlightNext(); | |
11092 | } else { | |
11093 | return!1; | |
11094 | } | |
11095 | break; | |
11096 | case goog.events.KeyCodes.RIGHT: | |
11097 | if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL) { | |
11098 | this.isRightToLeft() ? this.highlightPrevious() : this.highlightNext(); | |
11099 | } else { | |
11100 | return!1; | |
11101 | } | |
11102 | break; | |
11103 | default: | |
11104 | return!1; | |
11105 | } | |
11106 | return!0; | |
11107 | }; | |
11108 | goog.ui.Container.prototype.registerChildId_ = function $goog$ui$Container$$registerChildId_$(child) { | |
11109 | var childElem = child.getElement(), id = childElem.id || (childElem.id = child.getId()); | |
11110 | this.childElementIdMap_ || (this.childElementIdMap_ = {}); | |
11111 | this.childElementIdMap_[id] = child; | |
11112 | }; | |
11113 | goog.ui.Container.prototype.addChild = function $goog$ui$Container$$addChild$(child, opt_render) { | |
11114 | goog.asserts.assertInstanceof(child, goog.ui.Control, "The child of a container must be a control"); | |
11115 | goog.ui.Container.superClass_.addChild.call(this, child, opt_render); | |
11116 | }; | |
11117 | goog.ui.Container.prototype.addChildAt = function $goog$ui$Container$$addChildAt$(control, index, opt_render) { | |
11118 | control.setDispatchTransitionEvents(goog.ui.Component.State.HOVER, !0); | |
11119 | control.setDispatchTransitionEvents(goog.ui.Component.State.OPENED, !0); | |
11120 | !this.isFocusable() && this.isFocusableChildrenAllowed() || control.setSupportedState(goog.ui.Component.State.FOCUSED, !1); | |
11121 | control.setHandleMouseEvents(!1); | |
11122 | goog.ui.Container.superClass_.addChildAt.call(this, control, index, opt_render); | |
11123 | control.isInDocument() && this.isInDocument() && this.registerChildId_(control); | |
11124 | index <= this.highlightedIndex_ && this.highlightedIndex_++; | |
11125 | }; | |
11126 | goog.ui.Container.prototype.removeChild = function $goog$ui$Container$$removeChild$(control, opt_unrender) { | |
11127 | if (control = goog.isString(control) ? this.getChild(control) : control) { | |
11128 | var index = this.indexOfChild(control); | |
11129 | -1 != index && (index == this.highlightedIndex_ ? (control.setHighlighted(!1), this.highlightedIndex_ = -1) : index < this.highlightedIndex_ && this.highlightedIndex_--); | |
11130 | var childElem = control.getElement(); | |
11131 | childElem && childElem.id && this.childElementIdMap_ && goog.object.remove(this.childElementIdMap_, childElem.id); | |
11132 | } | |
11133 | control = goog.ui.Container.superClass_.removeChild.call(this, control, opt_unrender); | |
11134 | control.setHandleMouseEvents(!0); | |
11135 | return control; | |
11136 | }; | |
11137 | goog.ui.Container.prototype.getOrientation = function $goog$ui$Container$$getOrientation$() { | |
11138 | return this.orientation_; | |
11139 | }; | |
11140 | goog.ui.Container.prototype.setOrientation = function $goog$ui$Container$$setOrientation$(orientation) { | |
11141 | if (this.getElement()) { | |
11142 | throw Error(goog.ui.Component.Error.ALREADY_RENDERED); | |
11143 | } | |
11144 | this.orientation_ = orientation; | |
11145 | }; | |
11146 | goog.ui.Container.prototype.isVisible = function $goog$ui$Container$$isVisible$() { | |
11147 | return this.visible_; | |
11148 | }; | |
11149 | goog.ui.Container.prototype.setVisible = function $goog$ui$Container$$setVisible$(visible, opt_force) { | |
11150 | if (opt_force || this.visible_ != visible && this.dispatchEvent(visible ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) { | |
11151 | this.visible_ = visible; | |
11152 | var elem = this.getElement(); | |
11153 | elem && (goog.style.setElementShown(elem, visible), this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), this.enabled_ && this.visible_), opt_force || this.dispatchEvent(this.visible_ ? goog.ui.Container.EventType.AFTER_SHOW : goog.ui.Container.EventType.AFTER_HIDE)); | |
11154 | return!0; | |
11155 | } | |
11156 | return!1; | |
11157 | }; | |
11158 | goog.ui.Container.prototype.isEnabled = function $goog$ui$Container$$isEnabled$() { | |
11159 | return this.enabled_; | |
11160 | }; | |
11161 | goog.ui.Container.prototype.setEnabled = function $goog$ui$Container$$setEnabled$(enable) { | |
11162 | this.enabled_ != enable && this.dispatchEvent(enable ? goog.ui.Component.EventType.ENABLE : goog.ui.Component.EventType.DISABLE) && (enable ? (this.enabled_ = !0, this.forEachChild(function(child) { | |
11163 | child.wasDisabled ? delete child.wasDisabled : child.setEnabled(!0); | |
11164 | })) : (this.forEachChild(function(child) { | |
11165 | child.isEnabled() ? child.setEnabled(!1) : child.wasDisabled = !0; | |
11166 | }), this.enabled_ = !1, this.setMouseButtonPressed(!1)), this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), enable && this.visible_)); | |
11167 | }; | |
11168 | goog.ui.Container.prototype.isFocusable = function $goog$ui$Container$$isFocusable$() { | |
11169 | return this.focusable_; | |
11170 | }; | |
11171 | goog.ui.Container.prototype.setFocusable = function $goog$ui$Container$$setFocusable$(focusable) { | |
11172 | focusable != this.focusable_ && this.isInDocument() && this.enableFocusHandling_(focusable); | |
11173 | this.focusable_ = focusable; | |
11174 | this.enabled_ && this.visible_ && this.renderer_.enableTabIndex(this.getKeyEventTarget(), focusable); | |
11175 | }; | |
11176 | goog.ui.Container.prototype.isFocusableChildrenAllowed = function $goog$ui$Container$$isFocusableChildrenAllowed$() { | |
11177 | return this.allowFocusableChildren_; | |
11178 | }; | |
11179 | goog.ui.Container.prototype.setFocusableChildrenAllowed = function $goog$ui$Container$$setFocusableChildrenAllowed$(focusable) { | |
11180 | this.allowFocusableChildren_ = focusable; | |
11181 | }; | |
11182 | goog.ui.Container.prototype.setHighlightedIndex = function $goog$ui$Container$$setHighlightedIndex$(index) { | |
11183 | var child = this.getChildAt(index); | |
11184 | child ? child.setHighlighted(!0) : -1 < this.highlightedIndex_ && this.getHighlighted().setHighlighted(!1); | |
11185 | }; | |
11186 | goog.ui.Container.prototype.setHighlighted = function $goog$ui$Container$$setHighlighted$(item) { | |
11187 | this.setHighlightedIndex(this.indexOfChild(item)); | |
11188 | }; | |
11189 | goog.ui.Container.prototype.getHighlighted = function $goog$ui$Container$$getHighlighted$() { | |
11190 | return this.getChildAt(this.highlightedIndex_); | |
11191 | }; | |
11192 | goog.ui.Container.prototype.highlightFirst = function $goog$ui$Container$$highlightFirst$() { | |
11193 | this.highlightHelper(function(index, max) { | |
11194 | return(index + 1) % max; | |
11195 | }, this.getChildCount() - 1); | |
11196 | }; | |
11197 | goog.ui.Container.prototype.highlightLast = function $goog$ui$Container$$highlightLast$() { | |
11198 | this.highlightHelper(function(index, max) { | |
11199 | index--; | |
11200 | return 0 > index ? max - 1 : index; | |
11201 | }, 0); | |
11202 | }; | |
11203 | goog.ui.Container.prototype.highlightNext = function $goog$ui$Container$$highlightNext$() { | |
11204 | this.highlightHelper(function(index, max) { | |
11205 | return(index + 1) % max; | |
11206 | }, this.highlightedIndex_); | |
11207 | }; | |
11208 | goog.ui.Container.prototype.highlightPrevious = function $goog$ui$Container$$highlightPrevious$() { | |
11209 | this.highlightHelper(function(index, max) { | |
11210 | index--; | |
11211 | return 0 > index ? max - 1 : index; | |
11212 | }, this.highlightedIndex_); | |
11213 | }; | |
11214 | goog.ui.Container.prototype.highlightHelper = function $goog$ui$Container$$highlightHelper$(fn, startIndex) { | |
11215 | for (var curIndex = 0 > startIndex ? this.indexOfChild(this.openItem_) : startIndex, numItems = this.getChildCount(), curIndex = fn.call(this, curIndex, numItems), visited = 0;visited <= numItems;) { | |
11216 | var control = this.getChildAt(curIndex); | |
11217 | if (control && this.canHighlightItem(control)) { | |
11218 | return this.setHighlightedIndexFromKeyEvent(curIndex), !0; | |
11219 | } | |
11220 | visited++; | |
11221 | curIndex = fn.call(this, curIndex, numItems); | |
11222 | } | |
11223 | return!1; | |
11224 | }; | |
11225 | goog.ui.Container.prototype.canHighlightItem = function $goog$ui$Container$$canHighlightItem$(item) { | |
11226 | return item.isVisible() && item.isEnabled() && item.isSupportedState(goog.ui.Component.State.HOVER); | |
11227 | }; | |
11228 | goog.ui.Container.prototype.setHighlightedIndexFromKeyEvent = function $goog$ui$Container$$setHighlightedIndexFromKeyEvent$(index) { | |
11229 | this.setHighlightedIndex(index); | |
11230 | }; | |
11231 | goog.ui.Container.prototype.isMouseButtonPressed = function $goog$ui$Container$$isMouseButtonPressed$() { | |
11232 | return this.mouseButtonPressed_; | |
11233 | }; | |
11234 | goog.ui.Container.prototype.setMouseButtonPressed = function $goog$ui$Container$$setMouseButtonPressed$(pressed) { | |
11235 | this.mouseButtonPressed_ = pressed; | |
11236 | }; | |
11237 | i18n.input.chrome.inputview.CompactKey = function $i18n$input$chrome$inputview$CompactKey$(id, text, hintText, stateManager, opt_marginLeftPercent, opt_isGrey, opt_eventTarget) { | |
11238 | i18n.input.chrome.inputview.FunctionalKey.call(this, id, i18n.input.chrome.inputview.ElementType.COMPACT_KEY, text, "", opt_eventTarget); | |
11239 | this.hintText = hintText; | |
11240 | this.marginLeftPercent_ = opt_marginLeftPercent || 0; | |
11241 | this.stateManager_ = stateManager; | |
11242 | this.isGrey_ = !!opt_isGrey; | |
11243 | this.pointerConfig.longPressWithPointerUp = !0; | |
11244 | this.pointerConfig.flickerDirection = i18n.input.chrome.inputview.SwipeDirection.UP; | |
11245 | }; | |
11246 | goog.inherits(i18n.input.chrome.inputview.CompactKey, i18n.input.chrome.inputview.FunctionalKey); | |
11247 | i18n.input.chrome.inputview.CompactKey.prototype.flickerredCharacter = ""; | |
11248 | i18n.input.chrome.inputview.CompactKey.prototype.createDom = function $i18n$input$chrome$inputview$CompactKey$$createDom$() { | |
11249 | i18n.input.chrome.inputview.CompactKey.superClass_.createDom.call(this); | |
11250 | goog.dom.classes.add(this.tableCell, i18n.input.chrome.inputview.Css.COMPACT_KEY); | |
11251 | this.isGrey_ || goog.dom.classes.remove(this.bgElem, i18n.input.chrome.inputview.Css.SPECIAL_KEY_BG); | |
11252 | if (this.hintText) { | |
11253 | var dom = this.getDomHelper(), hintTextElem = dom.createDom(goog.dom.TagName.DIV, i18n.input.chrome.inputview.Css.HINT_TEXT, this.hintText); | |
11254 | dom.appendChild(this.tableCell, hintTextElem); | |
11255 | } | |
11256 | }; | |
11257 | i18n.input.chrome.inputview.CompactKey.prototype.resize = function $i18n$input$chrome$inputview$CompactKey$$resize$(width, height) { | |
11258 | var marginLeft = Math.floor(width * this.marginLeftPercent_); | |
11259 | this.getElement().style.marginLeft = marginLeft + "px"; | |
11260 | i18n.input.chrome.inputview.CompactKey.superClass_.resize.call(this, width, height); | |
11261 | }; | |
11262 | i18n.input.chrome.inputview.CompactKey.prototype.update = function $i18n$input$chrome$inputview$CompactKey$$update$() { | |
11263 | i18n.input.chrome.inputview.CompactKey.superClass_.update.call(this); | |
11264 | this.text = this.stateManager_.hasState(i18n.input.chrome.inputview.StateType.SHIFT) ? this.text.toUpperCase() : this.text.toLowerCase(); | |
11265 | goog.dom.setTextContent(this.textElem, this.text); | |
11266 | }; | |
11267 | i18n.input.chrome.inputview.SwitcherKey = function $i18n$input$chrome$inputview$SwitcherKey$(id, type, text, iconCssClass, toKeyset, record, opt_eventTarget) { | |
11268 | i18n.input.chrome.inputview.FunctionalKey.call(this, id, type, text, iconCssClass, opt_eventTarget); | |
11269 | this.toKeyset = toKeyset; | |
11270 | this.record = record; | |
11271 | }; | |
11272 | goog.inherits(i18n.input.chrome.inputview.SwitcherKey, i18n.input.chrome.inputview.FunctionalKey); | |
11273 | i18n.input.chrome.inputview.View = function $i18n$input$chrome$inputview$View$(keyData, layoutData, keyboardCode, languageCode, model, name) { | |
11274 | goog.ui.Container.call(this); | |
11275 | this.keyData_ = keyData; | |
11276 | this.layoutData_ = layoutData; | |
11277 | this.keyboardCode_ = keyboardCode; | |
11278 | this.languageCode_ = languageCode; | |
11279 | this.dataModel_ = model; | |
11280 | this.altDataView_ = new i18n.input.chrome.inputview.AltDataView(this); | |
11281 | this.horizontalPaddingPercent_ = .06; | |
11282 | this.rows_ = []; | |
11283 | this.softKeyViewMap_ = {}; | |
11284 | this.softKeyConditionMap_ = {}; | |
11285 | this.title_ = name; | |
11286 | this.fullHeightInWeight_ = layoutData[i18n.input.chrome.inputview.SpecNodeName.FULL_HEIGHT_IN_WEIGHT]; | |
11287 | this.heightPercentOfWidth_ = layoutData[i18n.input.chrome.inputview.SpecNodeName.HEIGHT_PERCENT_OF_WIDTH]; | |
11288 | this.minimumHeight_ = layoutData[i18n.input.chrome.inputview.SpecNodeName.MINIMUM_HEIGHT]; | |
11289 | }; | |
11290 | goog.inherits(i18n.input.chrome.inputview.View, goog.ui.Container); | |
11291 | i18n.input.chrome.inputview.View.PADDING_BOTTOM_ = 7; | |
11292 | i18n.input.chrome.inputview.View.prototype.outerHeight_ = 0; | |
11293 | i18n.input.chrome.inputview.View.prototype.outerWidth_ = 0; | |
11294 | i18n.input.chrome.inputview.View.prototype.createDom = function $i18n$input$chrome$inputview$View$$createDom$() { | |
11295 | i18n.input.chrome.inputview.View.superClass_.createDom.call(this); | |
11296 | var elem = this.getElement(); | |
11297 | elem.id = this.keyboardCode_.replace(".", "-"); | |
11298 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.VIEW); | |
11299 | goog.dom.classes.add(elem, i18n.input.chrome.inputview.Css.FONT); | |
11300 | elem.setAttribute("lang", this.languageCode_); | |
11301 | for (var children = this.layoutData_.children, i = 0;i < children.length;i++) { | |
11302 | var child = children[i], layoutElem = this.createLayoutElement_(child[i18n.input.chrome.inputview.SpecNodeName.SPEC], this); | |
11303 | layoutElem && (layoutElem.render(elem), this.rows_.push(layoutElem)); | |
11304 | } | |
11305 | for (var softKeyList = [], keySpecs = this.keyData_[i18n.input.chrome.inputview.SpecNodeName.KEY_LIST], hasAltGrCharacterInTheKeyset = this.hasAltGrCharacterInTheKeyset_(keySpecs), i = 0;i < keySpecs.length;i++) { | |
11306 | var softKey = this.createKey_(keySpecs[i][i18n.input.chrome.inputview.SpecNodeName.SPEC], hasAltGrCharacterInTheKeyset); | |
11307 | softKey && softKeyList.push(softKey); | |
11308 | } | |
11309 | var mapping = this.keyData_[i18n.input.chrome.inputview.SpecNodeName.MAPPING]; | |
11310 | this.keyboardView_.setUp(softKeyList, this.softKeyViewMap_, mapping); | |
11311 | }; | |
11312 | i18n.input.chrome.inputview.View.prototype.enterDocument = function $i18n$input$chrome$inputview$View$$enterDocument$() { | |
11313 | i18n.input.chrome.inputview.View.superClass_.enterDocument.call(this); | |
11314 | if (this.candidateView_ && goog.i18n.bidi.isRtlLanguage(this.languageCode_)) { | |
11315 | var topBar = goog.dom.getParentElement(this.candidateView_.getElement()); | |
11316 | topBar.dir = "rtl"; | |
11317 | } | |
11318 | this.altDataView_.render(); | |
11319 | this.setFocusable(!1); | |
11320 | this.setFocusableChildrenAllowed(!1); | |
11321 | }; | |
11322 | i18n.input.chrome.inputview.View.prototype.update = function $i18n$input$chrome$inputview$View$$update$() { | |
11323 | this.keyboardView_.update(); | |
11324 | }; | |
11325 | i18n.input.chrome.inputview.View.prototype.resize = function $i18n$input$chrome$inputview$View$$resize$(outerWidth, outerHeight) { | |
11326 | if (this.getElement() && (this.outerHeight_ != outerHeight || this.outerWidth_ != outerWidth)) { | |
11327 | this.outerHeight_ = outerHeight; | |
11328 | this.outerWidth_ = outerWidth; | |
11329 | var padding = this.horizontalPaddingPercent_ * outerWidth, elem = this.getElement(); | |
11330 | elem.style.paddingBottom = i18n.input.chrome.inputview.View.PADDING_BOTTOM_ + "px"; | |
11331 | elem.style.paddingLeft = elem.style.paddingRight = padding + "px"; | |
11332 | this.altDataView_.resize(outerWidth, outerHeight); | |
11333 | var width = Math.floor(outerWidth * (1 - 2 * this.horizontalPaddingPercent_)), height = outerHeight - i18n.input.chrome.inputview.View.PADDING_BOTTOM_; | |
11334 | goog.style.setSize(elem, width, height); | |
11335 | for (var weightArray = [], i = 0;i < this.rows_.length;i++) { | |
11336 | var row = this.rows_[i]; | |
11337 | weightArray.push(row.getHeightInWeight()); | |
11338 | } | |
11339 | for (var splitedHeight = i18n.input.chrome.inputview.util.splitValue(weightArray, height), i = 0;i < this.rows_.length;i++) { | |
11340 | row = this.rows_[i], row.resize(width, splitedHeight[i]); | |
11341 | } | |
11342 | } | |
11343 | }; | |
11344 | i18n.input.chrome.inputview.View.prototype.getHeightInWeight = function $i18n$input$chrome$inputview$View$$getHeightInWeight$() { | |
11345 | for (var heightInWeight = 0, i = 0;i < this.rows_.length;i++) { | |
11346 | var row = this.rows_[i], heightInWeight = heightInWeight + row.getHeightInWeight() | |
11347 | } | |
11348 | return heightInWeight; | |
11349 | }; | |
11350 | i18n.input.chrome.inputview.View.prototype.getAltDataView = function $i18n$input$chrome$inputview$View$$getAltDataView$() { | |
11351 | return this.altDataView_; | |
11352 | }; | |
11353 | i18n.input.chrome.inputview.View.prototype.showCandidates = function $i18n$input$chrome$inputview$View$$showCandidates$(candidates, showThreeCandidates) { | |
11354 | this.candidateView_ && this.candidateView_.showCandidates(candidates, showThreeCandidates); | |
11355 | }; | |
11356 | i18n.input.chrome.inputview.View.prototype.showNumberRow = function $i18n$input$chrome$inputview$View$$showNumberRow$() { | |
11357 | this.candidateView_ && this.candidateView_.showNumberRow(); | |
11358 | }; | |
11359 | i18n.input.chrome.inputview.View.prototype.hideNumberRow = function $i18n$input$chrome$inputview$View$$hideNumberRow$() { | |
11360 | this.candidateView_ && this.candidateView_.hideNumberRow(); | |
11361 | }; | |
11362 | i18n.input.chrome.inputview.View.prototype.clearCandidates = function $i18n$input$chrome$inputview$View$$clearCandidates$() { | |
11363 | this.candidateView_ && this.candidateView_.clearCandidates(); | |
11364 | }; | |
11365 | i18n.input.chrome.inputview.View.prototype.applyConditions = function $i18n$input$chrome$inputview$View$$applyConditions$(conditions) { | |
11366 | for (var condition in conditions) { | |
11367 | var softKeyView = this.softKeyConditionMap_[condition], isConditionEnabled = conditions[condition]; | |
11368 | if (softKeyView) { | |
11369 | softKeyView.setVisible(isConditionEnabled); | |
11370 | var softKeyViewGetWeight = this.softKeyViewMap_[softKeyView.giveWeightTo]; | |
11371 | softKeyViewGetWeight && (softKeyViewGetWeight.dynamicaGrantedWeight += isConditionEnabled ? 0 : softKeyView.widthInWeight); | |
11372 | } | |
11373 | } | |
11374 | }; | |
11375 | i18n.input.chrome.inputview.View.prototype.createElement_ = function $i18n$input$chrome$inputview$View$$createElement_$(spec, opt_eventTarget) { | |
11376 | var type = spec[i18n.input.chrome.inputview.SpecNodeName.TYPE], id = spec[i18n.input.chrome.inputview.SpecNodeName.ID], widthInWeight = spec[i18n.input.chrome.inputview.SpecNodeName.WIDTH_IN_WEIGHT], heightInWeight = spec[i18n.input.chrome.inputview.SpecNodeName.HEIGHT_IN_WEIGHT]; | |
11377 | switch(type) { | |
11378 | case i18n.input.chrome.inputview.ElementType.SOFT_KEY_VIEW: | |
11379 | var condition = spec[i18n.input.chrome.inputview.SpecNodeName.CONDITION], giveWeightTo = spec[i18n.input.chrome.inputview.SpecNodeName.GIVE_WEIGHT_TO], softKeyView = new i18n.input.chrome.inputview.SoftKeyView(id, widthInWeight, heightInWeight, condition, giveWeightTo, opt_eventTarget); | |
11380 | return this.softKeyConditionMap_[condition] = softKeyView; | |
11381 | case i18n.input.chrome.inputview.ElementType.LINEAR_LAYOUT: | |
11382 | return new i18n.input.chrome.inputview.LinearLayout(id, opt_eventTarget); | |
11383 | case i18n.input.chrome.inputview.ElementType.VERTICAL_LAYOUT: | |
11384 | return new i18n.input.chrome.inputview.VerticalLayout(id, opt_eventTarget); | |
11385 | case i18n.input.chrome.inputview.ElementType.LAYOUT_VIEW: | |
11386 | return this.keyboardView_ = new i18n.input.chrome.inputview.KeyboardView(id, opt_eventTarget); | |
11387 | case i18n.input.chrome.inputview.ElementType.CANDIDATE_VIEW: | |
11388 | var numberRowWeight = spec[i18n.input.chrome.inputview.SpecNodeName.NUMBER_ROW_WEIGHT]; | |
11389 | return this.candidateView_ = new i18n.input.chrome.inputview.CandidateView(id, widthInWeight, heightInWeight, numberRowWeight, opt_eventTarget); | |
11390 | } | |
11391 | return null; | |
11392 | }; | |
11393 | i18n.input.chrome.inputview.View.prototype.createLayoutElement_ = function $i18n$input$chrome$inputview$View$$createLayoutElement_$(spec, opt_parentEventTarget) { | |
11394 | var element = this.createElement_(spec, opt_parentEventTarget); | |
11395 | if (!element) { | |
11396 | return null; | |
11397 | } | |
11398 | var children = spec[i18n.input.chrome.inputview.SpecNodeName.CHILDREN]; | |
11399 | if (children) { | |
11400 | for (var children = goog.array.flatten(children), i = 0;i < children.length;i++) { | |
11401 | var child = children[i], childElem = this.createLayoutElement_(child[i18n.input.chrome.inputview.SpecNodeName.SPEC], element); | |
11402 | childElem && element.addChild(childElem, !0); | |
11403 | } | |
11404 | } | |
11405 | element.type == i18n.input.chrome.inputview.ElementType.SOFT_KEY_VIEW && (this.softKeyViewMap_[element.id] = element); | |
11406 | return element; | |
11407 | }; | |
11408 | i18n.input.chrome.inputview.View.prototype.hasAltGrCharacterInTheKeyset_ = function $i18n$input$chrome$inputview$View$$hasAltGrCharacterInTheKeyset_$(keySpecs) { | |
11409 | for (var result = [!1, !1], i = 0;i < keySpecs.length;i++) { | |
11410 | var spec = keySpecs[i], characters = spec[i18n.input.chrome.inputview.SpecNodeName.CHARACTERS]; | |
11411 | if (characters && (characters[2] || characters[3])) { | |
11412 | var index = i18n.input.chrome.inputview.util.isLetterKey(characters) ? 0 : 1; | |
11413 | result[index] = !0; | |
11414 | } | |
11415 | } | |
11416 | return result; | |
11417 | }; | |
11418 | i18n.input.chrome.inputview.View.prototype.createKey_ = function $i18n$input$chrome$inputview$View$$createKey_$(spec, hasAltGrCharacterInTheKeyset) { | |
11419 | var type = spec[i18n.input.chrome.inputview.SpecNodeName.TYPE], id = spec[i18n.input.chrome.inputview.SpecNodeName.ID], name = spec[i18n.input.chrome.inputview.SpecNodeName.NAME], characters = spec[i18n.input.chrome.inputview.SpecNodeName.CHARACTERS], iconCssClass = spec[i18n.input.chrome.inputview.SpecNodeName.ICON_CSS_CLASS], hintText = spec[i18n.input.chrome.inputview.SpecNodeName.HINT_TEXT], text = spec[i18n.input.chrome.inputview.SpecNodeName.TEXT], toKeyset = spec[i18n.input.chrome.inputview.SpecNodeName.TO_KEYSET]; | |
11420 | switch(type) { | |
11421 | case i18n.input.chrome.inputview.ElementType.MODIFIER_KEY: | |
11422 | var toState = spec[i18n.input.chrome.inputview.SpecNodeName.TO_STATE], supportSticky = spec[i18n.input.chrome.inputview.SpecNodeName.SUPPORT_STICKY]; | |
11423 | return new i18n.input.chrome.inputview.ModifierKey(id, name, iconCssClass, toState, this.dataModel_.stateManager, supportSticky); | |
11424 | case i18n.input.chrome.inputview.ElementType.SPACE_KEY: | |
11425 | return this.spaceKey_ = new i18n.input.chrome.inputview.SpaceKey(id, this.dataModel_.stateManager, this.title_, characters); | |
11426 | case i18n.input.chrome.inputview.ElementType.BACKSPACE_KEY: | |
11427 | ; | |
11428 | case i18n.input.chrome.inputview.ElementType.ENTER_KEY: | |
11429 | ; | |
11430 | case i18n.input.chrome.inputview.ElementType.TAB_KEY: | |
11431 | ; | |
11432 | case i18n.input.chrome.inputview.ElementType.ARROW_UP: | |
11433 | ; | |
11434 | case i18n.input.chrome.inputview.ElementType.ARROW_DOWN: | |
11435 | ; | |
11436 | case i18n.input.chrome.inputview.ElementType.ARROW_LEFT: | |
11437 | ; | |
11438 | case i18n.input.chrome.inputview.ElementType.ARROW_RIGHT: | |
11439 | ; | |
11440 | case i18n.input.chrome.inputview.ElementType.HIDE_KEYBOARD_KEY: | |
11441 | return new i18n.input.chrome.inputview.FunctionalKey(id, type, name, iconCssClass); | |
11442 | case i18n.input.chrome.inputview.ElementType.SWITCHER_KEY: | |
11443 | var record = spec[i18n.input.chrome.inputview.SpecNodeName.RECORD]; | |
11444 | return new i18n.input.chrome.inputview.SwitcherKey(id, type, name, iconCssClass, toKeyset, record); | |
11445 | case i18n.input.chrome.inputview.ElementType.COMPACT_KEY: | |
11446 | var marginLeftPercent = spec[i18n.input.chrome.inputview.SpecNodeName.MARGIN_LEFT_PERCENT], isGrey = spec[i18n.input.chrome.inputview.SpecNodeName.IS_GREY]; | |
11447 | return new i18n.input.chrome.inputview.CompactKey(id, text, hintText, this.dataModel_.stateManager, marginLeftPercent, isGrey); | |
11448 | case i18n.input.chrome.inputview.ElementType.CHARACTER_KEY: | |
11449 | var isLetterKey = i18n.input.chrome.inputview.util.isLetterKey(characters); | |
11450 | return new i18n.input.chrome.inputview.CharacterKey(id, characters, isLetterKey, hasAltGrCharacterInTheKeyset[isLetterKey], this.dataModel_.settings.alwaysRenderAltGrCharacter, this.dataModel_.stateManager); | |
11451 | } | |
11452 | return null; | |
11453 | }; | |
11454 | i18n.input.chrome.inputview.View.prototype.getViewForKey = function $i18n$input$chrome$inputview$View$$getViewForKey$(code) { | |
11455 | return this.keyboardView_.getViewForKey(code); | |
11456 | }; | |
11457 | i18n.input.chrome.inputview.View.prototype.getRequiredOuterHeight = function $i18n$input$chrome$inputview$View$$getRequiredOuterHeight$() { | |
11458 | var rate = this.getHeightInWeight() / this.fullHeightInWeight_, height = Math.floor(screen.width * this.heightPercentOfWidth_); | |
11459 | height < this.minimumHeight_ && (height = this.minimumHeight_); | |
11460 | return Math.round(height * rate); | |
11461 | }; | |
11462 | i18n.input.chrome.inputview.View.prototype.setTitleVisible = function $i18n$input$chrome$inputview$View$$setTitleVisible$(visible) { | |
11463 | this.spaceKey_ && this.spaceKey_.setTitleVisible(visible); | |
11464 | }; | |
11465 | i18n.input.chrome.inputview.View.prototype.disposeInternal = function $i18n$input$chrome$inputview$View$$disposeInternal$() { | |
11466 | goog.dispose(this.altDataView_); | |
11467 | i18n.input.chrome.inputview.View.superClass_.disposeInternal.call(this); | |
11468 | }; | |
11469 | i18n.input.chrome.inputview.Controller = function $i18n$input$chrome$inputview$Controller$(context) { | |
11470 | this.model_ = new i18n.input.chrome.inputview.Model; | |
11471 | this.handler_ = new goog.events.EventHandler(this); | |
11472 | this.layouts_ = {}; | |
11473 | this.keyConfigurations_ = {}; | |
11474 | this.m17nModel_ = new i18n.input.chrome.inputview.M17nModel; | |
11475 | this.pointerController_ = new i18n.input.chrome.inputview.PointerController; | |
11476 | this.context_ = context; | |
11477 | this.viewMap_ = {}; | |
11478 | this.chromeVoxHandler_ = new i18n.input.chrome.inputview.ChromeVoxHandler(this.model_.stateManager); | |
11479 | this.registerEventHandler_(); | |
11480 | }; | |
11481 | goog.inherits(i18n.input.chrome.inputview.Controller, goog.Disposable); | |
11482 | i18n.input.chrome.inputview.Controller.NACL_LANGUAGES_ = "de en es fr it nl pt".split(" "); | |
11483 | i18n.input.chrome.inputview.Controller.prototype.isSettingReady = !1; | |
11484 | i18n.input.chrome.inputview.Controller.prototype.sendBackspaceDown_ = !1; | |
11485 | i18n.input.chrome.inputview.Controller.prototype.sendEnterDown_ = !1; | |
11486 | i18n.input.chrome.inputview.Controller.prototype.dataSource_ = null; | |
11487 | i18n.input.chrome.inputview.Controller.prototype.deadKey_ = ""; | |
11488 | i18n.input.chrome.inputview.Controller.prototype.isFakeEventUsed_ = !1; | |
11489 | i18n.input.chrome.inputview.Controller.prototype.isMessageUsed_ = !1; | |
11490 | i18n.input.chrome.inputview.Controller.prototype.registerEventHandler_ = function $i18n$input$chrome$inputview$Controller$$registerEventHandler_$() { | |
11491 | this.handler_.listen(this.model_, i18n.input.chrome.inputview.events.EventType.LAYOUT_LOADED, this.onLayoutLoaded_).listen(this.model_, i18n.input.chrome.inputview.events.EventType.CONFIG_LOADED, this.onConfigLoaded_).listen(this.m17nModel_, i18n.input.chrome.inputview.events.EventType.CONFIG_LOADED, this.onConfigLoaded_).listen(this.context_, i18n.input.chrome.inputview.Context.EventType.VISIBILITY_CHANGE, this.onVisibilityChange_).listen(this.pointerController_, [i18n.input.chrome.inputview.events.EventType.LONG_PRESS, | |
11492 | i18n.input.chrome.inputview.events.EventType.DOUBLE_CLICK, i18n.input.chrome.inputview.events.EventType.POINTER_UP, i18n.input.chrome.inputview.events.EventType.POINTER_DOWN, i18n.input.chrome.inputview.events.EventType.POINTER_OVER, i18n.input.chrome.inputview.events.EventType.POINTER_OUT, i18n.input.chrome.inputview.events.EventType.SWIPE], this.onPointerEvent_).listen(window, goog.events.EventType.RESIZE, this.resize).listen(this.context_, i18n.input.chrome.inputview.Context.EventType.CONTEXT_CHANGE, | |
11493 | this.onContextChange_).listen(this.context_, i18n.input.chrome.inputview.Context.EventType.RESET, this.onContextReset_).listen(this.context_, i18n.input.chrome.inputview.Context.EventType.UPDATE, this.onContextUpdate_).listen(this.context_, i18n.input.chrome.inputview.events.EventType.SETTINGS_READY, this.onSettingsReady_); | |
11494 | this.isFakeEventUsed_ || this.isMessageUsed_ || this.handler_.listen(this.context_, i18n.input.chrome.inputview.events.EventType.KEY_CLICK, this.handlePhysicalKeyboardEvent_); | |
11495 | }; | |
11496 | i18n.input.chrome.inputview.Controller.prototype.onSettingsReady_ = function $i18n$input$chrome$inputview$Controller$$onSettingsReady_$() { | |
11497 | if (!this.isSettingReady) { | |
11498 | this.isSettingReady = !0; | |
11499 | if ("us" == this.keyboardKeyset_ && "en-US" == this.languageCode_) { | |
11500 | if (this.context_.isA11yMode) { | |
11501 | this.passwordKeyset_ = this.currentKeyset_ = this.keyboardKeyset_ = "us"; | |
11502 | } else { | |
11503 | var preferredKeyset = this.model_.settings.getPreference(i18n.input.chrome.inputview.Settings.Preference.KEY_SET); | |
11504 | this.passwordKeyset_ = this.currentKeyset_ = this.keyboardKeyset_ = preferredKeyset || "us.compact"; | |
11505 | } | |
11506 | } | |
11507 | this.switchToKeyboard(this.currentKeyset_); | |
11508 | } | |
11509 | }; | |
11510 | i18n.input.chrome.inputview.Controller.prototype.getCharactersForSpatial_ = function $i18n$input$chrome$inputview$Controller$$getCharactersForSpatial_$(key) { | |
11511 | var characters = []; | |
11512 | characters.push(this.getKeyContent_(key)); | |
11513 | for (var i = 0;i < key.nearbyKeys.length;i++) { | |
11514 | var content = this.getKeyContent_(key.nearbyKeys[i]); | |
11515 | content && i18n.input.chrome.inputview.util.REGEX_LANGUAGE_MODEL_CHARACTERS.test(content) && characters.push(content); | |
11516 | } | |
11517 | return characters; | |
11518 | }; | |
11519 | i18n.input.chrome.inputview.Controller.prototype.getKeyContent_ = function $i18n$input$chrome$inputview$Controller$$getKeyContent_$(key) { | |
11520 | return key.type == i18n.input.chrome.inputview.ElementType.CHARACTER_KEY ? key.getActiveCharacter() : key.type == i18n.input.chrome.inputview.ElementType.COMPACT_KEY ? key.text : ""; | |
11521 | }; | |
11522 | i18n.input.chrome.inputview.Controller.prototype.initializeDataSource_ = function $i18n$input$chrome$inputview$Controller$$initializeDataSource_$(language) { | |
11523 | this.dataSource_ = new i18n.input.chrome.inputview.OfflineDataSource(20); | |
11524 | this.dataSource_.setLanguage(language); | |
11525 | this.handler_.listen(this.dataSource_, i18n.input.chrome.inputview.DataSource.EventType.AUTO_COMPLETE, this.onAutoComplete_).listen(this.dataSource_, i18n.input.chrome.inputview.DataSource.EventType.AUTO_PREDICTION, this.onAutoPrediction_); | |
11526 | }; | |
11527 | i18n.input.chrome.inputview.Controller.prototype.shouldSendKeyEvent_ = function $i18n$input$chrome$inputview$Controller$$shouldSendKeyEvent_$() { | |
11528 | var ctrlKey = this.model_.stateManager.hasState(i18n.input.chrome.inputview.StateType.CTRL), altKey = this.model_.stateManager.hasState(i18n.input.chrome.inputview.StateType.ALT); | |
11529 | return this.isFakeEventUsed_ || ctrlKey || altKey; | |
11530 | }; | |
11531 | i18n.input.chrome.inputview.Controller.prototype.onPointerEvent_ = function $i18n$input$chrome$inputview$Controller$$onPointerEvent_$(e) { | |
11532 | this.getCurrentView_() && e.view && e.view && this.handlePointerAction_(e.view, e); | |
11533 | }; | |
11534 | i18n.input.chrome.inputview.Controller.prototype.handleSwipeAction_ = function $i18n$input$chrome$inputview$Controller$$handleSwipeAction_$(view, e) { | |
11535 | var direction = e.direction, alternativeDataView = this.getCurrentView_().getAltDataView(); | |
11536 | if (alternativeDataView.isVisible()) { | |
11537 | alternativeDataView.highlightItem(e.x, e.y); | |
11538 | } else { | |
11539 | if (view.type == i18n.input.chrome.inputview.ElementType.CHARACTER_KEY && (direction & i18n.input.chrome.inputview.SwipeDirection.UP || direction & i18n.input.chrome.inputview.SwipeDirection.DOWN)) { | |
11540 | var ch = view.getCharacterByGesture(!!(direction & i18n.input.chrome.inputview.SwipeDirection.UP)); | |
11541 | ch && (view.flickerredCharacter = ch); | |
11542 | } | |
11543 | view.type == i18n.input.chrome.inputview.ElementType.COMPACT_KEY && direction & i18n.input.chrome.inputview.SwipeDirection.UP && view.hintText && (view.flickerredCharacter = view.hintText); | |
11544 | } | |
11545 | }; | |
11546 | i18n.input.chrome.inputview.Controller.prototype.handlePointerAction_ = function $i18n$input$chrome$inputview$Controller$$handlePointerAction_$(view, e) { | |
11547 | e.type == i18n.input.chrome.inputview.events.EventType.SWIPE && this.handleSwipeAction_(view, e); | |
11548 | switch(view.type) { | |
11549 | case i18n.input.chrome.inputview.ElementType.CANDIDATE_VIEW: | |
11550 | if ((view.showingCandidates || view.showingNumberRow) && e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP) { | |
11551 | var candidate = goog.dom.getTextContent(e.target); | |
11552 | view.showingCandidates && (candidate += " "); | |
11553 | this.commitText_("", candidate, !0, !0, !1); | |
11554 | this.chromeVoxHandler_.handleCandidateEvent(candidate); | |
11555 | } | |
11556 | return; | |
11557 | case i18n.input.chrome.inputview.ElementType.ALTDATA_VIEW: | |
11558 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN && e.target == view.getCoverElement()) { | |
11559 | view.hide(); | |
11560 | } else { | |
11561 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP) { | |
11562 | var ch = view.getHighlightedCharacter(); | |
11563 | this.shouldSendKeyEvent_() ? this.context_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id) : this.commitText_(ch, "", i18n.input.chrome.inputview.util.isCommitCharacter(ch), !0, !0); | |
11564 | view.hide(); | |
11565 | } | |
11566 | } | |
11567 | return; | |
11568 | case i18n.input.chrome.inputview.ElementType.SOFT_KEY_VIEW: | |
11569 | view = view.softKey; | |
11570 | } | |
11571 | view.type != i18n.input.chrome.inputview.ElementType.MODIFIER_KEY && (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_OVER || e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? view.setHighlighted(!0) : e.type != i18n.input.chrome.inputview.events.EventType.POINTER_OUT && e.type != i18n.input.chrome.inputview.events.EventType.POINTER_UP || view.setHighlighted(!1)); | |
11572 | this.handlePointerEventForSoftKey_(view, e); | |
11573 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN && this.chromeVoxHandler_.handleKeyEvent(view); | |
11574 | this.updateContextModifierState_(); | |
11575 | }; | |
11576 | i18n.input.chrome.inputview.Controller.prototype.handlePointerEventForSoftKey_ = function $i18n$input$chrome$inputview$Controller$$handlePointerEventForSoftKey_$(softKey, e) { | |
11577 | var key; | |
11578 | switch(softKey.type) { | |
11579 | case i18n.input.chrome.inputview.ElementType.CHARACTER_KEY: | |
11580 | key = softKey; | |
11581 | if (e.type == i18n.input.chrome.inputview.events.EventType.LONG_PRESS) { | |
11582 | this.isFakeEventUsed_ || (this.getCurrentView_().getAltDataView().show(key), key.setHighlighted(!1)); | |
11583 | } else { | |
11584 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP) { | |
11585 | var ch = key.getActiveCharacter(); | |
11586 | if (this.isMessageUsed_) { | |
11587 | this.context_.sendKeyDownAndUpMessage(ch, key.id, this.commitText_.bind(this, ch, "", i18n.input.chrome.inputview.util.isCommitCharacter(ch), !0, !0)); | |
11588 | } else { | |
11589 | if (this.shouldSendKeyEvent_()) { | |
11590 | this.context_.sendKeyDownAndUpEvent(ch, key.id), this.model_.stateManager.hasUnStickyState() && (this.model_.stateManager.clearUnstickyState(), this.getCurrentView_().update()); | |
11591 | } else { | |
11592 | var charactersForSpatial = this.getCharactersForSpatial_(key); | |
11593 | this.commitText_(ch, "", i18n.input.chrome.inputview.util.isCommitCharacter(ch), !0, !0, charactersForSpatial); | |
11594 | } | |
11595 | } | |
11596 | key.flickerredCharacter = ""; | |
11597 | } | |
11598 | } | |
11599 | break; | |
11600 | case i18n.input.chrome.inputview.ElementType.MODIFIER_KEY: | |
11601 | key = softKey; | |
11602 | var isStateEnabled = this.model_.stateManager.hasState(key.toState), isChording = this.model_.stateManager.isChording(key.toState); | |
11603 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? (this.changeState_(key.toState, !isStateEnabled, !0), this.model_.stateManager.setKeyDown(key.toState, !0)) : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP || e.type == i18n.input.chrome.inputview.events.EventType.POINTER_OUT ? (isChording ? this.changeState_(key.toState, !1, !1) : key.toState != i18n.input.chrome.inputview.StateType.CAPSLOCK && this.changeState_(key.toState, isStateEnabled, !1), this.model_.stateManager.setKeyDown(key.toState, | |
11604 | !1), key.pointerConfig.longPressWithoutPointerUp = !0) : e.type == i18n.input.chrome.inputview.events.EventType.DOUBLE_CLICK ? this.changeState_(key.toState, isStateEnabled, !0) : e.type == i18n.input.chrome.inputview.events.EventType.LONG_PRESS && (isChording ? key.pointerConfig.longPressWithoutPointerUp = !1 : (this.changeState_(key.toState, !0, !0), this.model_.stateManager.setKeyDown(key.toState, !1))); | |
11605 | break; | |
11606 | case i18n.input.chrome.inputview.ElementType.BACKSPACE_KEY: | |
11607 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN) { | |
11608 | this.backspaceTick_(); | |
11609 | } else { | |
11610 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP || e.type == i18n.input.chrome.inputview.events.EventType.POINTER_OUT) { | |
11611 | goog.dispose(this.backspaceAutoRepeat_), this.backspaceAutoRepeat_ = null, this.backspaceUp_(); | |
11612 | } | |
11613 | } | |
11614 | break; | |
11615 | case i18n.input.chrome.inputview.ElementType.TAB_KEY: | |
11616 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.tabDown_() : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.tabUp_(); | |
11617 | break; | |
11618 | case i18n.input.chrome.inputview.ElementType.ENTER_KEY: | |
11619 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.enterDown_(!0) : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.enterUp_(); | |
11620 | break; | |
11621 | case i18n.input.chrome.inputview.ElementType.ARROW_UP: | |
11622 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.context_.sendKeyDownEvent("Up", "ArrowUp") : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.context_.sendKeyUpEvent("Up", "ArrowUp"); | |
11623 | break; | |
11624 | case i18n.input.chrome.inputview.ElementType.ARROW_DOWN: | |
11625 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.context_.sendKeyDownEvent("Down", "ArrowDown") : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.context_.sendKeyUpEvent("Down", "ArrowDown"); | |
11626 | break; | |
11627 | case i18n.input.chrome.inputview.ElementType.ARROW_LEFT: | |
11628 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.context_.sendKeyDownEvent("Left", "ArrowLeft") : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.context_.sendKeyUpEvent("Left", "ArrowLeft"); | |
11629 | break; | |
11630 | case i18n.input.chrome.inputview.ElementType.ARROW_RIGHT: | |
11631 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_DOWN ? this.context_.sendKeyDownEvent("Right", "ArrowRight") : e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.context_.sendKeyUpEvent("Right", "ArrowRight"); | |
11632 | break; | |
11633 | case i18n.input.chrome.inputview.ElementType.SPACE_KEY: | |
11634 | key = softKey; | |
11635 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && (this.shouldSendKeyEvent_() ? this.context_.sendKeyDownAndUpEvent(key.getCharacter(), "Space") : this.commitText_(key.getCharacter(), "", !0, !0, !0)); | |
11636 | break; | |
11637 | case i18n.input.chrome.inputview.ElementType.SWITCHER_KEY: | |
11638 | key = softKey; | |
11639 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && (this.switchToKeyboard(key.toKeyset), key.record && (this.model_.settings.savePreference(i18n.input.chrome.inputview.Settings.Preference.KEY_SET, key.toKeyset), this.keyboardKeyset_ = key.toKeyset)); | |
11640 | break; | |
11641 | case i18n.input.chrome.inputview.ElementType.COMPACT_KEY: | |
11642 | key = softKey; | |
11643 | if (e.type == i18n.input.chrome.inputview.events.EventType.LONG_PRESS) { | |
11644 | this.getCurrentView_().getAltDataView().show(key); | |
11645 | } else { | |
11646 | if (e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP) { | |
11647 | var text = key.flickerredCharacter || key.text; | |
11648 | this.commitText_(text, "", i18n.input.chrome.inputview.util.isCommitCharacter(text), !0, !0, this.getCharactersForSpatial_(key)); | |
11649 | key.flickerredCharacter = ""; | |
11650 | } | |
11651 | } | |
11652 | break; | |
11653 | case i18n.input.chrome.inputview.ElementType.HIDE_KEYBOARD_KEY: | |
11654 | e.type == i18n.input.chrome.inputview.events.EventType.POINTER_UP && this.context_.hideKeyboard(); | |
11655 | } | |
11656 | }; | |
11657 | i18n.input.chrome.inputview.Controller.prototype.handlePhysicalKeyboardEvent_ = function $i18n$input$chrome$inputview$Controller$$handlePhysicalKeyboardEvent_$(e) { | |
11658 | if (this.isFakeEventUsed_ || this.isMessageUsed_) { | |
11659 | return!0; | |
11660 | } | |
11661 | var keyData = e.keyData; | |
11662 | if (keyData.extensionId) { | |
11663 | return "KeyA" != keyData.code; | |
11664 | } | |
11665 | keyData.capsLock ? this.changeState_(i18n.input.chrome.inputview.StateType.CAPSLOCK, !0, !0) : this.changeState_(i18n.input.chrome.inputview.StateType.CAPSLOCK, !1, !1); | |
11666 | var code = keyData.code; | |
11667 | "ControlRight" == code && (code = "ControlLeft"); | |
11668 | var currentView = this.getCurrentView_(); | |
11669 | if (!currentView) { | |
11670 | return!0; | |
11671 | } | |
11672 | var keyView = this.getCurrentView_().getViewForKey(code), evtType = keyData.type, ret = !0; | |
11673 | if (keyView) { | |
11674 | evtType == goog.events.EventType.KEYDOWN ? keyView.setHighlighted(!0) : evtType == goog.events.EventType.KEYUP && keyView.setHighlighted(!1); | |
11675 | if ("AltRight" != keyData.code && (keyData.altKey || keyData.ctrlKey)) { | |
11676 | return!0; | |
11677 | } | |
11678 | switch(keyView.type) { | |
11679 | case i18n.input.chrome.inputview.ElementType.CHARACTER_KEY: | |
11680 | if (evtType == goog.events.EventType.KEYDOWN) { | |
11681 | var ch = keyView.getActiveCharacter(); | |
11682 | this.commitText_(ch, "", i18n.input.chrome.inputview.util.isCommitCharacter(ch), !1, !0); | |
11683 | } | |
11684 | ret = !1; | |
11685 | break; | |
11686 | case i18n.input.chrome.inputview.ElementType.MODIFIER_KEY: | |
11687 | evtType == goog.events.EventType.KEYDOWN ? this.changeState_(keyView.toState, !0, !0) : evtType == goog.events.EventType.KEYUP && this.changeState_(keyView.toState, !1, !1); | |
11688 | ret = !1; | |
11689 | break; | |
11690 | case i18n.input.chrome.inputview.ElementType.BACKSPACE_KEY: | |
11691 | evtType == goog.events.EventType.KEYDOWN && (ret = this.backspaceDown_(!1)); | |
11692 | break; | |
11693 | case i18n.input.chrome.inputview.ElementType.ENTER_KEY: | |
11694 | evtType == goog.events.EventType.KEYDOWN && (ret = this.enterDown_(!1)); | |
11695 | break; | |
11696 | case i18n.input.chrome.inputview.ElementType.SPACE_KEY: | |
11697 | evtType == goog.events.EventType.KEYDOWN && (this.commitText_(keyView.getCharacter(), "", !0, !1, !0), ret = !1); | |
11698 | } | |
11699 | } | |
11700 | this.updateContextModifierState_(); | |
11701 | return ret; | |
11702 | }; | |
11703 | i18n.input.chrome.inputview.Controller.prototype.backspaceTick_ = function $i18n$input$chrome$inputview$Controller$$backspaceTick_$() { | |
11704 | this.backspaceDown_(!0); | |
11705 | this.backspaceAutoRepeat_ ? this.backspaceAutoRepeat_.start(75) : (this.backspaceAutoRepeat_ = new goog.async.Delay(goog.bind(this.backspaceTick_, this), 300), this.backspaceAutoRepeat_.start()); | |
11706 | }; | |
11707 | i18n.input.chrome.inputview.Controller.prototype.onVisibilityChange_ = function $i18n$input$chrome$inputview$Controller$$onVisibilityChange_$() { | |
11708 | this.context_.isVisible() && (this.resetAll_(), this.resize()); | |
11709 | }; | |
11710 | i18n.input.chrome.inputview.Controller.prototype.onContextChange_ = function $i18n$input$chrome$inputview$Controller$$onContextChange_$() { | |
11711 | var isPassword = this.context_.isPasswdBox(); | |
11712 | this.switchToKeyboard(isPassword ? this.passwordKeyset_ : this.keyboardKeyset_); | |
11713 | this.m17nModel_.setContext(this.context_.context); | |
11714 | }; | |
11715 | i18n.input.chrome.inputview.Controller.prototype.onContextUpdate_ = function $i18n$input$chrome$inputview$Controller$$onContextUpdate_$() { | |
11716 | if (this.getCurrentView_() && !this.context_.isPasswdBox()) { | |
11717 | this.getCurrentView_().clearCandidates(); | |
11718 | var commitText = this.context_.getCommittedText(); | |
11719 | commitText && this.dataSource_ && this.dataSource_.sendAutoPrediction(commitText); | |
11720 | this.m17nModel_ && this.m17nModel_.clearHistory(); | |
11721 | } | |
11722 | }; | |
11723 | i18n.input.chrome.inputview.Controller.prototype.onContextReset_ = function $i18n$input$chrome$inputview$Controller$$onContextReset_$() { | |
11724 | var currentView = this.getCurrentView_(); | |
11725 | currentView && currentView.clearCandidates(); | |
11726 | this.m17nModel_ && this.m17nModel_.clearHistory(); | |
11727 | this.deadKey_ = ""; | |
11728 | }; | |
11729 | i18n.input.chrome.inputview.Controller.prototype.resetAll_ = function $i18n$input$chrome$inputview$Controller$$resetAll_$() { | |
11730 | var currentView = this.getCurrentView_(); | |
11731 | currentView && (currentView.clearCandidates(), this.model_.stateManager.reset(), currentView.update(), this.m17nModel_ && this.m17nModel_.clearHistory(), this.deadKey_ = ""); | |
11732 | }; | |
11733 | i18n.input.chrome.inputview.Controller.prototype.backspaceDown_ = function $i18n$input$chrome$inputview$Controller$$backspaceDown_$(isPointerEvent) { | |
11734 | var ret = !0; | |
11735 | if (this.context_.getCompositionText()) { | |
11736 | var compositionText = this.context_.getCompositionText(), compositionText = compositionText.substring(0, compositionText.length - 1); | |
11737 | this.setCompositionText_(compositionText); | |
11738 | ret = !1; | |
11739 | } else { | |
11740 | isPointerEvent && (this.context_.sendKeyDownEvent("Backspace", "Backspace"), this.sendBackspaceDown_ = !0), this.getCurrentView_().clearCandidates(); | |
11741 | } | |
11742 | this.context_.execAll(); | |
11743 | return ret; | |
11744 | }; | |
11745 | i18n.input.chrome.inputview.Controller.prototype.backspaceUp_ = function $i18n$input$chrome$inputview$Controller$$backspaceUp_$() { | |
11746 | this.sendBackspaceDown_ && this.context_.sendKeyUpEvent("Backspace", "Backspace"); | |
11747 | this.sendBackspaceDown_ = !1; | |
11748 | }; | |
11749 | i18n.input.chrome.inputview.Controller.prototype.tabDown_ = function $i18n$input$chrome$inputview$Controller$$tabDown_$() { | |
11750 | this.context_.sendKeyDownEvent("Tab", "Tab"); | |
11751 | }; | |
11752 | i18n.input.chrome.inputview.Controller.prototype.tabUp_ = function $i18n$input$chrome$inputview$Controller$$tabUp_$() { | |
11753 | this.context_.sendKeyUpEvent("Tab", "Tab"); | |
11754 | }; | |
11755 | i18n.input.chrome.inputview.Controller.prototype.enterDown_ = function $i18n$input$chrome$inputview$Controller$$enterDown_$(isPointerEvent) { | |
11756 | var ret = !0; | |
11757 | if (this.context_.getCompositionText() || isPointerEvent) { | |
11758 | this.context_.sendKeyDownEvent("Enter", "Enter"), this.sendEnterDown_ = !0, ret = !this.context_.getCompositionText(); | |
11759 | } | |
11760 | this.context_.execAll(); | |
11761 | return ret; | |
11762 | }; | |
11763 | i18n.input.chrome.inputview.Controller.prototype.enterUp_ = function $i18n$input$chrome$inputview$Controller$$enterUp_$() { | |
11764 | this.sendEnterDown_ && this.context_.sendKeyUpEvent("Enter", "Enter"); | |
11765 | this.sendEnterDown_ = !1; | |
11766 | }; | |
11767 | i18n.input.chrome.inputview.Controller.prototype.changeState_ = function $i18n$input$chrome$inputview$Controller$$changeState_$(stateType, enable, isSticky) { | |
11768 | stateType == i18n.input.chrome.inputview.StateType.ALTGR && (enable ? this.context_.sendKeyDownEvent("", "AltRight") : this.context_.sendKeyUpEvent("", "AltRight")); | |
11769 | var isEnabledBefore = this.model_.stateManager.hasState(stateType), isStickyBefore = this.model_.stateManager.isSticky(stateType); | |
11770 | this.model_.stateManager.setState(stateType, enable); | |
11771 | this.model_.stateManager.setSticky(stateType, isSticky); | |
11772 | isEnabledBefore == enable && isStickyBefore == isSticky || this.getCurrentView_().update(); | |
11773 | }; | |
11774 | i18n.input.chrome.inputview.Controller.prototype.updateContextModifierState_ = function $i18n$input$chrome$inputview$Controller$$updateContextModifierState_$() { | |
11775 | var StateType = i18n.input.chrome.inputview.StateType, stateManager = this.model_.stateManager; | |
11776 | this.context_.setModifierState(StateType.ALT, stateManager.hasState(StateType.ALT)); | |
11777 | this.context_.setModifierState(StateType.CTRL, stateManager.hasState(StateType.CTRL)); | |
11778 | this.context_.setModifierState(StateType.CAPSLOCK, stateManager.hasState(StateType.CAPSLOCK)); | |
11779 | this.context_.setModifierState(StateType.SHIFT, stateManager.hasState(StateType.SHIFT)); | |
11780 | }; | |
11781 | i18n.input.chrome.inputview.Controller.prototype.commitText_ = function $i18n$input$chrome$inputview$Controller$$commitText_$(compositionText, commitText, commit, isPointerEvent, doNormalize, opt_charactersForSpatial) { | |
11782 | this.model_.stateManager.triggerChording(); | |
11783 | this.model_.stateManager.hasUnStickyState() && (this.model_.stateManager.clearUnstickyState(), this.getCurrentView_().update()); | |
11784 | var ret = !1, text = commitText || compositionText, deadKey = this.deadKey_; | |
11785 | this.deadKey_ = ""; | |
11786 | if (i18n.input.chrome.inputview.util.DISPLAY_MAPPING[text]) { | |
11787 | if (deadKey == text) { | |
11788 | text = i18n.input.chrome.inputview.util.DISPLAY_MAPPING[text]; | |
11789 | } else { | |
11790 | return this.deadKey_ = text, ret; | |
11791 | } | |
11792 | } else { | |
11793 | if (doNormalize && deadKey) { | |
11794 | if (!i18n.input.chrome.inputview.util.supportDeadKey(text)) { | |
11795 | return ret; | |
11796 | } | |
11797 | text = (text + deadKey).normalize(); | |
11798 | } | |
11799 | } | |
11800 | commit || !this.dataSource_ || !this.dataSource_.isReady() || this.context_.isPasswdBox() ? (commitText || (text = this.context_.getCompositionText() + text), this.context_.commitText(text)) : this.setCompositionText_(this.context_.getCompositionText() + text, opt_charactersForSpatial); | |
11801 | this.context_.execAll(); | |
11802 | return ret; | |
11803 | }; | |
11804 | i18n.input.chrome.inputview.Controller.prototype.setCompositionText_ = function $i18n$input$chrome$inputview$Controller$$setCompositionText_$(text, opt_charactersForSpatial) { | |
11805 | this.context_.setCompositionText(text); | |
11806 | this.dataSource_ && text && this.dataSource_.sendAutoComplete(this.context_.getQueryText(), opt_charactersForSpatial); | |
11807 | }; | |
11808 | i18n.input.chrome.inputview.Controller.prototype.onAutoComplete_ = function $i18n$input$chrome$inputview$Controller$$onAutoComplete_$(e) { | |
11809 | var candidates = e.candidates, source = this.context_.getCompositionText(); | |
11810 | if (source == e.source) { | |
11811 | var matchedLengths = e.matchedLengths, candidates = goog.array.filter(candidates, function(candidate, i) { | |
11812 | return void 0 == matchedLengths[i] || matchedLengths[i] == source.replace(/['-]/g, "").length; | |
11813 | }), candidates = goog.array.map(candidates, function(candidate) { | |
11814 | if (0 == candidate.toLowerCase().indexOf(source.toLowerCase())) { | |
11815 | return source + candidate.slice(source.length); | |
11816 | } | |
11817 | if (source.toUpperCase() == source) { | |
11818 | return candidate.toUpperCase(); | |
11819 | } | |
11820 | var ch = source.charAt(0); | |
11821 | return ch.toUpperCase() == ch ? candidate.charAt(0).toUpperCase() + candidate.slice(1) : candidate; | |
11822 | }), isThreeCandidates = "us.compact" == this.currentKeyset_; | |
11823 | isThreeCandidates && (goog.array.insertAt(candidates, source, 0), goog.array.removeDuplicates(candidates)); | |
11824 | this.getCurrentView_().showCandidates(candidates, isThreeCandidates); | |
11825 | } | |
11826 | }; | |
11827 | i18n.input.chrome.inputview.Controller.prototype.onAutoPrediction_ = function $i18n$input$chrome$inputview$Controller$$onAutoPrediction_$(e) { | |
11828 | this.getCurrentView_().showCandidates(e.candidates, "us.compact" == this.currentKeyset_); | |
11829 | }; | |
11830 | i18n.input.chrome.inputview.Controller.prototype.onLayoutLoaded_ = function $i18n$input$chrome$inputview$Controller$$onLayoutLoaded_$(e) { | |
11831 | var layoutID = e.data.layoutID; | |
11832 | this.layouts_[layoutID] = e.data; | |
11833 | this.maybeCreateViews_(); | |
11834 | }; | |
11835 | i18n.input.chrome.inputview.Controller.prototype.maybeCreateViews_ = function $i18n$input$chrome$inputview$Controller$$maybeCreateViews_$() { | |
11836 | for (var keyboardCode in this.keyConfigurations_) { | |
11837 | var keyData = this.keyConfigurations_[keyboardCode], layoutId = keyData[i18n.input.chrome.inputview.SpecNodeName.LAYOUT], layoutData = this.layouts_[layoutId]; | |
11838 | if (!this.viewMap_[keyboardCode] && layoutData) { | |
11839 | var conditions = {}; | |
11840 | conditions[i18n.input.chrome.inputview.ConditionName.SHOW_COMPACT_LAYOUT_SWITCHER] = !1; | |
11841 | conditions[i18n.input.chrome.inputview.ConditionName.SHOW_ALTGR] = keyData[i18n.input.chrome.inputview.SpecNodeName.HAS_ALTGR_KEY]; | |
11842 | var view = new i18n.input.chrome.inputview.View(keyData, layoutData, keyboardCode, this.languageCode_, this.model_, this.inputToolName_); | |
11843 | view.render(); | |
11844 | view.applyConditions(conditions); | |
11845 | this.viewMap_[keyboardCode] = view; | |
11846 | this.viewMap_[keyboardCode].setVisible(!1); | |
11847 | this.switchToKeyboard(this.currentKeyset_); | |
11848 | } | |
11849 | } | |
11850 | }; | |
11851 | i18n.input.chrome.inputview.Controller.prototype.switchToKeyboard = function $i18n$input$chrome$inputview$Controller$$switchToKeyboard$(keyboardCode) { | |
11852 | if (this.viewMap_[keyboardCode] && this.isSettingReady) { | |
11853 | this.currentKeyset_ = keyboardCode; | |
11854 | for (var code in this.viewMap_) { | |
11855 | var view = this.viewMap_[code]; | |
11856 | code == keyboardCode ? (view.setVisible(!0), view.update(), this.resize(), this.context_.isPasswdBox() && "us.compact" == code ? view.showNumberRow() : view.hideNumberRow(), view.setTitleVisible(!this.context_.isPasswdBox())) : view.setVisible(!1); | |
11857 | } | |
11858 | } | |
11859 | }; | |
11860 | i18n.input.chrome.inputview.Controller.prototype.getCurrentView_ = function $i18n$input$chrome$inputview$Controller$$getCurrentView_$() { | |
11861 | return this.viewMap_[this.currentKeyset_] || null; | |
11862 | }; | |
11863 | i18n.input.chrome.inputview.Controller.prototype.onConfigLoaded_ = function $i18n$input$chrome$inputview$Controller$$onConfigLoaded_$(e) { | |
11864 | var data = e.data, keyboardCode = data[i18n.input.chrome.inputview.SpecNodeName.ID]; | |
11865 | this.keyConfigurations_[keyboardCode] = data; | |
11866 | var layoutId = data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT], layoutData = this.layouts_[layoutId]; | |
11867 | layoutData ? this.maybeCreateViews_() : this.model_.loadLayout(data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT]); | |
11868 | }; | |
11869 | i18n.input.chrome.inputview.Controller.prototype.resize = function $i18n$input$chrome$inputview$Controller$$resize$() { | |
11870 | var currentView = this.getCurrentView_(); | |
11871 | if (currentView) { | |
11872 | var computedHeight = currentView.getRequiredOuterHeight(); | |
11873 | currentView.resize(screen.width, computedHeight); | |
11874 | var viewportSize = goog.dom.getViewportSize(); | |
11875 | viewportSize.height != computedHeight && window.setTimeout(function() { | |
11876 | window.resizeTo(screen.width, computedHeight); | |
11877 | }, 100); | |
11878 | } | |
11879 | }; | |
11880 | i18n.input.chrome.inputview.Controller.prototype.initialize = function $i18n$input$chrome$inputview$Controller$$initialize$(keyset, languageCode, passwordLayout, isFakeEventUsed, name, isMessageUsed) { | |
11881 | this.languageCode_ = languageCode; | |
11882 | this.passwordKeyset_ = passwordLayout; | |
11883 | var standardLanguage = i18n.input.chrome.inputview.util.getStandardLanguageCode(languageCode); | |
11884 | goog.array.contains(i18n.input.chrome.inputview.Controller.NACL_LANGUAGES_, standardLanguage) && this.initializeDataSource_(standardLanguage); | |
11885 | this.currentKeyset_ = this.keyboardKeyset_ = keyset; | |
11886 | this.isFakeEventUsed_ = isFakeEventUsed; | |
11887 | this.inputToolName_ = name; | |
11888 | this.isMessageUsed_ = isMessageUsed; | |
11889 | goog.array.contains(i18n.input.chrome.inputview.M17nCodes, keyset) ? this.m17nModel_.loadConfig(keyset) : this.model_.loadConfig(keyset); | |
11890 | this.model_.loadConfig(this.passwordKeyset_); | |
11891 | }; | |
11892 | i18n.input.chrome.inputview.Controller.prototype.disposeInternal = function $i18n$input$chrome$inputview$Controller$$disposeInternal$() { | |
11893 | for (var keyboardCode in this.viewMap_) { | |
11894 | goog.dispose(this.viewMap_[keyboardCode]); | |
11895 | } | |
11896 | goog.dispose(this.dataSource_); | |
11897 | goog.dispose(this.handler_); | |
11898 | i18n.input.chrome.inputview.Controller.superClass_.disposeInternal.call(this); | |
11899 | }; | |
11900 | window.onload = function $window$onload$() { | |
11901 | var uri = new goog.Uri(window.location.href), code = uri.getParameterValue("id") || "us", language = uri.getParameterValue("language") || "en", passwordLayout = uri.getParameterValue("passwordLayout") || "us", isFakeEventUsed = !!uri.getParameterValue("isFakeEventUsed"), name = chrome.i18n.getMessage(uri.getParameterValue("name") || "English"), isMessageUsed = !!uri.getParameterValue("isMessageUsed"), context = new i18n.input.chrome.inputview.ChromeOsContext(!isFakeEventUsed && !isMessageUsed), | |
11902 | controller = new i18n.input.chrome.inputview.Controller(context); | |
11903 | controller.initialize(code, language, passwordLayout, isFakeEventUsed, name, isMessageUsed); | |
11904 | window.setContext = function $window$setContext$(mockContext) { | |
11905 | context.setContext(mockContext); | |
11906 | }; | |
11907 | window.unload = function $window$unload$() { | |
11908 | goog.dispose(controller); | |
11909 | goog.dispose(this.context_); | |
11910 | }; | |
11911 | }; | |
11912 |
0 | /** | |
1 | * Copyright 2010-2015, Google Inc. | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * * Redistributions in binary form must reproduce the above | |
11 | * copyright notice, this list of conditions and the following disclaimer | |
12 | * in the documentation and/or other materials provided with the | |
13 | * distribution. | |
14 | * * Neither the name of Google Inc. nor the names of its | |
15 | * contributors may be used to endorse or promote products derived from | |
16 | * this software without specific prior written permission. | |
17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | |
30 | /* Copyright 2014 Google Inc. All Rights Reserved. */ | |
31 | .inputview-layoutview{position:relative;-webkit-user-select:none}.inputview-skv{display:inline-block;overflow:hidden}.inputview-sk{margin:0 7px 7px 0;position:relative;background-color:#ffffff}#us-compact .inputview-sk{margin:0 11px 11px 0}.inputview-character{position:absolute;text-align:center;color:#bbb;font-size:16px;display:inline-block}.inputview-ch{color:#666;font-size:23px}.inputview-vertical{display:inline-block}.inputview-linear{display:inline-block}.inputview-view{position:fixed;bottom:0;left:0;-webkit-box-shadow:-5px 0 5px #ccc;border:1px solid #cfcfcf;background-color:#eeeeee;-webkit-user-select:none}.inputview-font{font-family:Roboto,Noto Sans,Sans-Serif}.inputview-font[lang=am]{font-family:Roboto,Noto Sans Armenian,Sans-Serif}.inputview-font[lang=il]{font-family:Roboto,Noto Sans Hebrew,Sans-Serif}.inputview-font[lang=jp]{font-family:Roboto,MotoyaG04Gothic,IPAGothic,Sans-Serif}.inputview-font[lang=ar]{font-family:Roboto,Noto Arabic Naskh ui,Sans-Serif}.inputview-font[lang=bn]{font-family:Roboto,Noto Sans Bengali,Sans-Serif}.inputview-font[lang=ethi]{font-family:Roboto,Noto Sans Ethiopic,Sans-Serif}.inputview-font[lang=fa]{font-family:Roboto,Noto Arabic Naskh ui,Sans-Serif}.inputview-font[lang=gu]{font-family:Roboto,Noto Sans Gujarati,Lohit Gujarati,Sans-Serif}.inputview-font[lang=kn]{font-family:Roboto,Noto Sans Kannada,Lohit Kannada,Sans-Serif}.inputview-font[lang=ml]{font-family:Roboto,Noto Sans Malayalam,Lohit Malayalam,Sans-Serif}.inputview-font[lang=ta]{font-family:Roboto,Noto Sans Tamil,Lohit Tamil,Sans-Serif}.inputview-font[lang=te]{font-family:Roboto,Noto Sans Telugu,Lohit Telugu,Sans-Serif}.inputview-font[lang=th]{font-family:Roboto,Noto Sans Thai,Sans-Serif}.inputview-font[lang=zh-CN]{font-family:Roboto,MYingHeiGB18030,Droid Sans Fallback,Sans-Serif}.inputview-font[lang=zh-TW],.inputview-font[lang=zh-HK]{font-family:Roboto,MYingHeiB5HK,Droid Sans Fallback,Sans-Serif}.inputview-font[lang=kr]{font-family:Roboto,NanumGothic,Sans-Serif}.inputview-modifier{display:table-cell;vertical-align:middle;font-size:15px;text-align:center;position:relative}.inputview-altdata-view{position:absolute;z-index:999;border:1px solid #ccc;background-color:white}.inputview-altdata-key{display:table-cell;font-size:23px;vertical-align:middle;text-align:center}.inputview-candidate.inputview-candidate-highlight{color:#262626}.inputview-candidate-view{overflow:hidden;display:inline-block}.inputview-candidate{display:table-cell;font-size:18px;color:#555555;vertical-align:middle;text-align:center}.inputview-candidate-separator{border-left:1px solid #ddd;position:relative;display:inline-block}.inputview-table-cell{display:table-cell;vertical-align:middle;text-align:center}.inputview-title{font-size:15px;color:#bfbfbf}.inputview-special-key-name{display:block}.inputview-modifier-state-icon{background-image:url('images/modifier-off.png');background-repeat:no-repeat;background-size:16px 4px;display:inline-block;width:16px;height:4px}.inputview-modifier-state-icon.inputview-modifier-on{background-image:url('images/modifier-on.png')}.inputview-modifier-state-icon.inputview-hold{-webkit-box-shadow:0 0 5px 1px #397ffb;opacity:0.9}.inputview-altdata-cover{position:fixed;bottom:0;left:0;background-color:white;opacity:0.5;z-index:1}.inputview-arrow-key{background-repeat:no-repeat;display:inline-block;width:16px;height:13px;background-size:16px 13px}.inputview-up-key{background-image:url('images/up.png')}.inputview-down-key{background-image:url('images/down.png')}.inputview-left-key{background-image:url('images/left.png')}.inputview-right-key{background-image:url('images/right.png')}.inputview-special-key-bg{background-color:#ddd}.inputview-hide-keyboard-icon{background:transparent url('images/hide.png') 0 0 no-repeat;background-size:18px 18.5px;display:inline-block;width:18px;height:18.5px}.inputview-element-highlight{background-color:#dddddd}.inputview-special-key-highlight{background-color:#cccccc}.inputview-backspace-icon{background:transparent url('images/backspace.png');background-size:22.5px 13.5px;display:inline-block;width:22.5px;height:13.5px}.inputview-enter-icon{background:transparent url('images/enter.png');background-size:18px 13.5px;display:inline-block;width:18px;height:13.5px}.inputview-shift-icon{background:transparent url('images/shift.png');background-size:18.5px 13.5px;display:inline-block;width:18.5px;height:13.5px}.inputview-tab-icon{background:transparent url('images/tab.png');background-size:25.5px 13.5px;display:inline-block;width:25.5px;height:13.5px}.inputview-capslock-dot{background-color:#ccc;width:4px;height:4px;position:absolute;top:8px;right:8px}.inputview-capslock-dot-highlight{background-color:#4285f4}.inputview-hint-text{font-size:12px;color:grey;position:absolute;top:8px;right:8px}.inputview-compact-key{font-size:28px;color:#555555}.inputview-compact-switcher{background:transparent url('images/compact.png');background-size:19px 9px;display:inline-block;width:19px;height:9px}.inputview-regular-switcher{background:transparent url('images/regular_size.png');background-size:19px 14px;display:inline-block;width:19px;height:14px}#Space{color:#bbbbbb;font-size:18px}⏎ |
0 | // Copyright 2010-2015, Google Inc. | |
1 | // All rights reserved. | |
2 | // | |
3 | // Redistribution and use in source and binary forms, with or without | |
4 | // modification, are permitted provided that the following conditions are | |
5 | // met: | |
6 | // | |
7 | // * Redistributions of source code must retain the above copyright | |
8 | // notice, this list of conditions and the following disclaimer. | |
9 | // * Redistributions in binary form must reproduce the above | |
10 | // copyright notice, this list of conditions and the following disclaimer | |
11 | // in the documentation and/or other materials provided with the | |
12 | // distribution. | |
13 | // * Neither the name of Google Inc. nor the names of its | |
14 | // contributors may be used to endorse or promote products derived from | |
15 | // this software without specific prior written permission. | |
16 | // | |
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | (function() { function a(b){for(var e=d,f=[],c=0;c<b;c++)f.push(g(e));return f}function g(b){var e=h+l++;return m(8,b,e)}function n(b){return m(4,b,void 0)}function m(b,e,f){var c={},k;for(k in e)c[k]=e[k];c.type=b;f&&(c.id=f);return{spec:c}};var l=0,h="";var h="101kbd-k-",p;p=n({id:"topBar",children:[m(10,{id:"candidateView",widthInWeight:15,heightInWeight:1},void 0)],condition:"showTitleBar"});var q,d={widthInWeight:1,heightInWeight:1},r=a(13),s=g({widthInWeight:2}),t=n({id:"row1",children:[r,s]}),u=g({widthInWeight:1.5}),v=a(12),w=g({widthInWeight:1.5}),x=n({id:"row2",children:[u,v,w]}),y=g({widthInWeight:1.75}),z=a(11),A=g({widthInWeight:2.25}),B=n({id:"row3",children:[y,z,A]}),C=g({widthInWeight:2.5}),D=a(10),E=g({widthInWeight:2.5}); | |
30 | q=[t,x,B,n({id:"row4",children:[C,D,E]})];var F=g({widthInWeight:1}),G=g({widthInWeight:1}),H=g({widthInWeight:1,condition:"showCompactLayoutSwitcher"}),I=g({widthInWeight:8}),J=g({widthInWeight:1,condition:"showAltGr"});H.spec.giveWeightTo=I.spec.id;J.spec.giveWeightTo=I.spec.id;var K=g({widthInWeight:1}),L=g({widthInWeight:1}),M=g({widthInWeight:1}); | |
31 | google.ime.chrome.inputview.onLayoutLoaded({layoutID:"101kbd",heightPercentOfWidth:.3,minimumHeight:380,fullHeightInWeight:6,children:[p,n({id:"keyboardContainer",children:[m(3,{id:"keyboardView",children:[q,n({id:"spaceKeyrow",children:[F,G,H,I,J,K,L,M]})],widthPercent:100,heightPercent:100},void 0)]})]}); })() |
0 | // Copyright 2010-2015, Google Inc. | |
1 | // All rights reserved. | |
2 | // | |
3 | // Redistribution and use in source and binary forms, with or without | |
4 | // modification, are permitted provided that the following conditions are | |
5 | // met: | |
6 | // | |
7 | // * Redistributions of source code must retain the above copyright | |
8 | // notice, this list of conditions and the following disclaimer. | |
9 | // * Redistributions in binary form must reproduce the above | |
10 | // copyright notice, this list of conditions and the following disclaimer | |
11 | // in the documentation and/or other materials provided with the | |
12 | // distribution. | |
13 | // * Neither the name of Google Inc. nor the names of its | |
14 | // contributors may be used to endorse or promote products derived from | |
15 | // this software without specific prior written permission. | |
16 | // | |
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | ||
29 | (function() { function a(b){for(var d=e,f=[],c=0;c<b;c++)f.push(g(d));return f}function g(b){var d=h+l++;return m(8,b,d)}function n(b){return m(4,b,void 0)}function m(b,d,f){var c={},k;for(k in d)c[k]=d[k];c.type=b;f&&(c.id=f);return{spec:c}};var l=0,h="";var h="compactkbd-k-",p;p=n({id:"topBar",children:[m(10,{id:"candidateView",widthInWeight:11.2,heightInWeight:.6,numberRowWeight:10},void 0)],condition:"showTitleBar"}); | |
30 | var e={widthInWeight:1,heightInWeight:1},q=a(10),r=g({widthInWeight:1.2}),s=n({id:"row1",children:[q,r]}),t=g({widthInWeight:1.5}),u=a(8),v=g({widthInWeight:1.7}),w=n({id:"row2",children:[t,u,v]}),x=g({widthInWeight:1.1}),y=a(9),z=g({widthInWeight:1.1}),A=n({id:"row3",children:[x,y,z]}),B=g({widthInWeight:1.1}),C=g({widthInWeight:1}),D=g({widthInWeight:1}),E=g({widthInWeight:5}),F=g({widthInWeight:1}),G=g({widthInWeight:1}),H=g({widthInWeight:1.1}); | |
31 | google.ime.chrome.inputview.onLayoutLoaded({layoutID:"compactkbd",heightPercentOfWidth:.3,minimumHeight:380,fullHeightInWeight:4.6,children:[p,n({id:"keyboardContainer",children:[m(3,{id:"keyboardView",children:[[s,w,A,n({id:"row4",children:[B,C,D,E,F,G,H]})]],widthPercent:100,heightPercent:100},void 0)]})]}); })() |
421 | 421 | // Do not disturb taking screenshot. |
422 | 422 | if (keyData.ctrlKey && keyData.key == 'ChromeOSSwitchWindow') { |
423 | 423 | return /** @type {!mozc.KeyEvent} */ ({}); |
424 | } else if (mozc.MODIFIER_KEY_CODE_MASK_MAP_[keyData.code]) { | |
425 | return this.translateModifierKeyEvent_(keyData); | |
426 | } else if (keyData.type == 'keydown') { | |
427 | return this.translateKeyDownEvent_(keyData, isKanaMode, keyboardLayout); | |
424 | } else { | |
425 | // Since IME API can't send the correct upper case alphabet. | |
426 | // Need to make a transform first. JP IME use shift status to input upper | |
427 | // case letter. | |
428 | var key = keyData.key; | |
429 | if (keyData.capsLock && key) { | |
430 | if (key.toUpperCase() != key) { | |
431 | keyData.shiftKey = !keyData.shiftKey; | |
432 | } | |
433 | } | |
434 | if (mozc.MODIFIER_KEY_CODE_MASK_MAP_[keyData.code]) { | |
435 | return this.translateModifierKeyEvent_(keyData); | |
436 | } else if (keyData.type == 'keydown') { | |
437 | return this.translateKeyDownEvent_(keyData, isKanaMode, keyboardLayout); | |
438 | } | |
428 | 439 | } |
429 | 440 | return /** @type {!mozc.KeyEvent} */ ({}); |
430 | 441 | }; |
56 | 56 | '<(gen_out_dir)/nacl_mozc/options.css', |
57 | 57 | '<(gen_out_dir)/nacl_mozc/options.html', |
58 | 58 | '<(gen_out_dir)/nacl_mozc/options.js', |
59 | '<(gen_out_dir)/nacl_mozc/config', | |
60 | '<(gen_out_dir)/nacl_mozc/images', | |
61 | '<(gen_out_dir)/nacl_mozc/inputview.html', | |
62 | '<(gen_out_dir)/nacl_mozc/inputview.js', | |
63 | '<(gen_out_dir)/nacl_mozc/inputview_css.css', | |
64 | '<(gen_out_dir)/nacl_mozc/inputview_layouts', | |
59 | 65 | ], |
60 | 66 | 'partial_supported_messages': [ |
61 | 67 | '<(gen_out_dir)/nacl_mozc/_locales/am/messages.json', |
388 | 394 | 'options.css', |
389 | 395 | 'options.html', |
390 | 396 | 'options.js', |
397 | 'inputview/config', | |
398 | 'inputview/images', | |
399 | 'inputview/inputview.html', | |
400 | 'inputview/inputview.js', | |
401 | 'inputview/inputview_css.css', | |
402 | 'inputview/inputview_layouts', | |
391 | 403 | ], |
392 | 404 | 'conditions': [ |
393 | 405 | ['branding=="GoogleJapaneseInput"', { |