diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/awesomplete.css | 97 | ||||
-rw-r--r-- | inc/awesomplete.js | 388 | ||||
-rw-r--r-- | inc/awesomplete.min.js | 10 | ||||
-rw-r--r-- | inc/jquery-1.11.2.js | 10346 | ||||
-rw-r--r-- | inc/jquery-1.11.2.min.js | 4 | ||||
-rw-r--r-- | inc/jquery-ui-1.11.2.js | 16582 | ||||
-rw-r--r-- | inc/jquery-ui-1.11.2.min.js | 13 | ||||
-rw-r--r-- | inc/shaarli.css | 31 |
8 files changed, 514 insertions, 26957 deletions
diff --git a/inc/awesomplete.css b/inc/awesomplete.css new file mode 100644 index 00000000..76f903f7 --- /dev/null +++ b/inc/awesomplete.css | |||
@@ -0,0 +1,97 @@ | |||
1 | [hidden] { display: none; } | ||
2 | |||
3 | .visually-hidden { | ||
4 | position: absolute; | ||
5 | clip: rect(0, 0, 0, 0); | ||
6 | } | ||
7 | |||
8 | div.awesomplete { | ||
9 | display: inline-block; | ||
10 | position: relative; | ||
11 | width: 100%; | ||
12 | } | ||
13 | |||
14 | div.awesomplete > input { | ||
15 | display: block; | ||
16 | } | ||
17 | |||
18 | div.awesomplete > ul { | ||
19 | position: absolute; | ||
20 | left: 0; | ||
21 | z-index: 1; | ||
22 | min-width: 100%; | ||
23 | box-sizing: border-box; | ||
24 | list-style: none; | ||
25 | padding: 0; | ||
26 | border-radius: .3em; | ||
27 | margin: .2em 0 0; | ||
28 | background: #FFF; | ||
29 | border: 1px solid rgba(0,0,0,.3); | ||
30 | box-shadow: .05em .2em .6em rgba(0,0,0,.2); | ||
31 | text-shadow: none; | ||
32 | } | ||
33 | |||
34 | div.awesomplete > ul[hidden], | ||
35 | div.awesomplete > ul:empty { | ||
36 | display: none; | ||
37 | } | ||
38 | |||
39 | @supports (transform: scale(0)) { | ||
40 | div.awesomplete > ul { | ||
41 | transition: .3s cubic-bezier(.4,.2,.5,1.4); | ||
42 | transform-origin: 1.43em -.43em; | ||
43 | } | ||
44 | |||
45 | div.awesomplete > ul[hidden], | ||
46 | div.awesomplete > ul:empty { | ||
47 | opacity: 0; | ||
48 | transform: scale(0); | ||
49 | display: block; | ||
50 | transition-timing-function: ease; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | /* Pointer */ | ||
55 | div.awesomplete > ul:before { | ||
56 | content: ""; | ||
57 | position: absolute; | ||
58 | top: -.43em; | ||
59 | left: 1em; | ||
60 | width: 0; height: 0; | ||
61 | padding: .4em; | ||
62 | background: white; | ||
63 | border: inherit; | ||
64 | border-right: 0; | ||
65 | border-bottom: 0; | ||
66 | -webkit-transform: rotate(45deg); | ||
67 | transform: rotate(45deg); | ||
68 | } | ||
69 | |||
70 | div.awesomplete > ul > li { | ||
71 | position: relative; | ||
72 | padding: .2em .5em; | ||
73 | cursor: pointer; | ||
74 | } | ||
75 | |||
76 | div.awesomplete > ul > li:hover { | ||
77 | background: hsl(200, 40%, 80%); | ||
78 | color: black; | ||
79 | } | ||
80 | |||
81 | div.awesomplete > ul > li[aria-selected="true"] { | ||
82 | background: hsl(205, 40%, 40%); | ||
83 | color: white; | ||
84 | } | ||
85 | |||
86 | div.awesomplete mark { | ||
87 | background: hsl(65, 100%, 50%); | ||
88 | } | ||
89 | |||
90 | div.awesomplete li:hover mark { | ||
91 | background: hsl(68, 101%, 41%); | ||
92 | } | ||
93 | |||
94 | div.awesomplete li[aria-selected="true"] mark { | ||
95 | background: hsl(86, 102%, 21%); | ||
96 | color: inherit; | ||
97 | } \ No newline at end of file | ||
diff --git a/inc/awesomplete.js b/inc/awesomplete.js new file mode 100644 index 00000000..fae550e2 --- /dev/null +++ b/inc/awesomplete.js | |||
@@ -0,0 +1,388 @@ | |||
1 | /** | ||
2 | * Simple, lightweight, usable local autocomplete library for modern browsers | ||
3 | * Because there weren’t enough autocomplete scripts in the world? Because I’m completely insane and have NIH syndrome? Probably both. :P | ||
4 | * @author Lea Verou http://leaverou.github.io/awesomplete | ||
5 | * MIT license | ||
6 | */ | ||
7 | |||
8 | (function () { | ||
9 | |||
10 | var _ = function (input, o) { | ||
11 | var me = this; | ||
12 | |||
13 | // Setup | ||
14 | |||
15 | this.input = $(input); | ||
16 | this.input.setAttribute("aria-autocomplete", "list"); | ||
17 | |||
18 | o = o || {}; | ||
19 | |||
20 | configure.call(this, { | ||
21 | minChars: 2, | ||
22 | maxItems: 10, | ||
23 | autoFirst: false, | ||
24 | filter: _.FILTER_CONTAINS, | ||
25 | sort: _.SORT_BYLENGTH, | ||
26 | item: function (text, input) { | ||
27 | return $.create("li", { | ||
28 | innerHTML: text.replace(RegExp($.regExpEscape(input.trim()), "gi"), "<mark>$&</mark>"), | ||
29 | "aria-selected": "false" | ||
30 | }); | ||
31 | }, | ||
32 | replace: function (text) { | ||
33 | this.input.value = text; | ||
34 | } | ||
35 | }, o); | ||
36 | |||
37 | this.index = -1; | ||
38 | |||
39 | // Create necessary elements | ||
40 | |||
41 | this.container = $.create("div", { | ||
42 | className: "awesomplete", | ||
43 | around: input | ||
44 | }); | ||
45 | |||
46 | this.ul = $.create("ul", { | ||
47 | hidden: "", | ||
48 | inside: this.container | ||
49 | }); | ||
50 | |||
51 | this.status = $.create("span", { | ||
52 | className: "visually-hidden", | ||
53 | role: "status", | ||
54 | "aria-live": "assertive", | ||
55 | "aria-relevant": "additions", | ||
56 | inside: this.container | ||
57 | }); | ||
58 | |||
59 | // Bind events | ||
60 | |||
61 | $.bind(this.input, { | ||
62 | "input": this.evaluate.bind(this), | ||
63 | "blur": this.close.bind(this), | ||
64 | "keydown": function(evt) { | ||
65 | var c = evt.keyCode; | ||
66 | |||
67 | // If the dropdown `ul` is in view, then act on keydown for the following keys: | ||
68 | // Enter / Esc / Up / Down | ||
69 | if(me.opened) { | ||
70 | if (c === 13 && me.selected) { // Enter | ||
71 | evt.preventDefault(); | ||
72 | me.select(); | ||
73 | } | ||
74 | else if (c === 27) { // Esc | ||
75 | me.close(); | ||
76 | } | ||
77 | else if (c === 38 || c === 40) { // Down/Up arrow | ||
78 | evt.preventDefault(); | ||
79 | me[c === 38? "previous" : "next"](); | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | }); | ||
84 | |||
85 | $.bind(this.input.form, {"submit": this.close.bind(this)}); | ||
86 | |||
87 | $.bind(this.ul, {"mousedown": function(evt) { | ||
88 | var li = evt.target; | ||
89 | |||
90 | if (li !== this) { | ||
91 | |||
92 | while (li && !/li/i.test(li.nodeName)) { | ||
93 | li = li.parentNode; | ||
94 | } | ||
95 | |||
96 | if (li) { | ||
97 | me.select(li); | ||
98 | } | ||
99 | } | ||
100 | }}); | ||
101 | |||
102 | if (this.input.hasAttribute("list")) { | ||
103 | this.list = "#" + input.getAttribute("list"); | ||
104 | input.removeAttribute("list"); | ||
105 | } | ||
106 | else { | ||
107 | this.list = this.input.getAttribute("data-list") || o.list || []; | ||
108 | } | ||
109 | |||
110 | _.all.push(this); | ||
111 | }; | ||
112 | |||
113 | _.prototype = { | ||
114 | set list(list) { | ||
115 | if (Array.isArray(list)) { | ||
116 | this._list = list; | ||
117 | } | ||
118 | else if (typeof list === "string" && list.indexOf(",") > -1) { | ||
119 | this._list = list.split(/\s*,\s*/); | ||
120 | } | ||
121 | else { // Element or CSS selector | ||
122 | list = $(list); | ||
123 | |||
124 | if (list && list.children) { | ||
125 | this._list = slice.apply(list.children).map(function (el) { | ||
126 | return el.innerHTML.trim(); | ||
127 | }); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | if (document.activeElement === this.input) { | ||
132 | this.evaluate(); | ||
133 | } | ||
134 | }, | ||
135 | |||
136 | get selected() { | ||
137 | return this.index > -1; | ||
138 | }, | ||
139 | |||
140 | get opened() { | ||
141 | return this.ul && this.ul.getAttribute("hidden") == null; | ||
142 | }, | ||
143 | |||
144 | close: function () { | ||
145 | this.ul.setAttribute("hidden", ""); | ||
146 | this.index = -1; | ||
147 | |||
148 | $.fire(this.input, "awesomplete-close"); | ||
149 | }, | ||
150 | |||
151 | open: function () { | ||
152 | this.ul.removeAttribute("hidden"); | ||
153 | |||
154 | if (this.autoFirst && this.index === -1) { | ||
155 | this.goto(0); | ||
156 | } | ||
157 | |||
158 | $.fire(this.input, "awesomplete-open"); | ||
159 | }, | ||
160 | |||
161 | next: function () { | ||
162 | var count = this.ul.children.length; | ||
163 | |||
164 | this.goto(this.index < count - 1? this.index + 1 : -1); | ||
165 | }, | ||
166 | |||
167 | previous: function () { | ||
168 | var count = this.ul.children.length; | ||
169 | |||
170 | this.goto(this.selected? this.index - 1 : count - 1); | ||
171 | }, | ||
172 | |||
173 | // Should not be used, highlights specific item without any checks! | ||
174 | goto: function (i) { | ||
175 | var lis = this.ul.children; | ||
176 | |||
177 | if (this.selected) { | ||
178 | lis[this.index].setAttribute("aria-selected", "false"); | ||
179 | } | ||
180 | |||
181 | this.index = i; | ||
182 | |||
183 | if (i > -1 && lis.length > 0) { | ||
184 | lis[i].setAttribute("aria-selected", "true"); | ||
185 | this.status.textContent = lis[i].textContent; | ||
186 | } | ||
187 | |||
188 | $.fire(this.input, "awesomplete-highlight"); | ||
189 | }, | ||
190 | |||
191 | select: function (selected) { | ||
192 | selected = selected || this.ul.children[this.index]; | ||
193 | |||
194 | if (selected) { | ||
195 | var prevented; | ||
196 | |||
197 | $.fire(this.input, "awesomplete-select", { | ||
198 | text: selected.textContent, | ||
199 | preventDefault: function () { | ||
200 | prevented = true; | ||
201 | } | ||
202 | }); | ||
203 | |||
204 | if (!prevented) { | ||
205 | this.replace(selected.textContent); | ||
206 | this.close(); | ||
207 | $.fire(this.input, "awesomplete-selectcomplete"); | ||
208 | } | ||
209 | } | ||
210 | }, | ||
211 | |||
212 | evaluate: function() { | ||
213 | var me = this; | ||
214 | var value = this.input.value; | ||
215 | |||
216 | if (value.length >= this.minChars && this._list.length > 0) { | ||
217 | this.index = -1; | ||
218 | // Populate list with options that match | ||
219 | this.ul.innerHTML = ""; | ||
220 | |||
221 | this._list | ||
222 | .filter(function(item) { | ||
223 | return me.filter(item, value); | ||
224 | }) | ||
225 | .sort(this.sort) | ||
226 | .every(function(text, i) { | ||
227 | me.ul.appendChild(me.item(text, value)); | ||
228 | |||
229 | return i < me.maxItems - 1; | ||
230 | }); | ||
231 | |||
232 | if (this.ul.children.length === 0) { | ||
233 | this.close(); | ||
234 | } else { | ||
235 | this.open(); | ||
236 | } | ||
237 | } | ||
238 | else { | ||
239 | this.close(); | ||
240 | } | ||
241 | } | ||
242 | }; | ||
243 | |||
244 | // Static methods/properties | ||
245 | |||
246 | _.all = []; | ||
247 | |||
248 | _.FILTER_CONTAINS = function (text, input) { | ||
249 | return RegExp($.regExpEscape(input.trim()), "i").test(text); | ||
250 | }; | ||
251 | |||
252 | _.FILTER_STARTSWITH = function (text, input) { | ||
253 | return RegExp("^" + $.regExpEscape(input.trim()), "i").test(text); | ||
254 | }; | ||
255 | |||
256 | _.SORT_BYLENGTH = function (a, b) { | ||
257 | if (a.length !== b.length) { | ||
258 | return a.length - b.length; | ||
259 | } | ||
260 | |||
261 | return a < b? -1 : 1; | ||
262 | }; | ||
263 | |||
264 | // Private functions | ||
265 | |||
266 | function configure(properties, o) { | ||
267 | for (var i in properties) { | ||
268 | var initial = properties[i], | ||
269 | attrValue = this.input.getAttribute("data-" + i.toLowerCase()); | ||
270 | |||
271 | if (typeof initial === "number") { | ||
272 | this[i] = +attrValue; | ||
273 | } | ||
274 | else if (initial === false) { // Boolean options must be false by default anyway | ||
275 | this[i] = attrValue !== null; | ||
276 | } | ||
277 | else if (initial instanceof Function) { | ||
278 | this[i] = null; | ||
279 | } | ||
280 | else { | ||
281 | this[i] = attrValue; | ||
282 | } | ||
283 | |||
284 | this[i] = this[i] || o[i] || initial; | ||
285 | } | ||
286 | } | ||
287 | |||
288 | // Helpers | ||
289 | |||
290 | var slice = Array.prototype.slice; | ||
291 | |||
292 | function $(expr, con) { | ||
293 | return typeof expr === "string"? (con || document).querySelector(expr) : expr || null; | ||
294 | } | ||
295 | |||
296 | function $$(expr, con) { | ||
297 | return slice.call((con || document).querySelectorAll(expr)); | ||
298 | } | ||
299 | |||
300 | $.create = function(tag, o) { | ||
301 | var element = document.createElement(tag); | ||
302 | |||
303 | for (var i in o) { | ||
304 | var val = o[i]; | ||
305 | |||
306 | if (i === "inside") { | ||
307 | $(val).appendChild(element); | ||
308 | } | ||
309 | else if (i === "around") { | ||
310 | var ref = $(val); | ||
311 | ref.parentNode.insertBefore(element, ref); | ||
312 | element.appendChild(ref); | ||
313 | } | ||
314 | else if (i in element) { | ||
315 | element[i] = val; | ||
316 | } | ||
317 | else { | ||
318 | element.setAttribute(i, val); | ||
319 | } | ||
320 | } | ||
321 | |||
322 | return element; | ||
323 | }; | ||
324 | |||
325 | $.bind = function(element, o) { | ||
326 | if (element) { | ||
327 | for (var event in o) { | ||
328 | var callback = o[event]; | ||
329 | |||
330 | event.split(/\s+/).forEach(function (event) { | ||
331 | element.addEventListener(event, callback); | ||
332 | }); | ||
333 | } | ||
334 | } | ||
335 | }; | ||
336 | |||
337 | $.fire = function(target, type, properties) { | ||
338 | var evt = document.createEvent("HTMLEvents"); | ||
339 | |||
340 | evt.initEvent(type, true, true ); | ||
341 | |||
342 | for (var j in properties) { | ||
343 | evt[j] = properties[j]; | ||
344 | } | ||
345 | |||
346 | target.dispatchEvent(evt); | ||
347 | }; | ||
348 | |||
349 | $.regExpEscape = function (s) { | ||
350 | return s.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); | ||
351 | } | ||
352 | |||
353 | // Initialization | ||
354 | |||
355 | function init() { | ||
356 | $$("input.awesomplete").forEach(function (input) { | ||
357 | new Awesomplete(input); | ||
358 | }); | ||
359 | } | ||
360 | |||
361 | // Are we in a browser? Check for Document constructor | ||
362 | if (typeof Document !== 'undefined') { | ||
363 | // DOM already loaded? | ||
364 | if (document.readyState !== "loading") { | ||
365 | init(); | ||
366 | } | ||
367 | else { | ||
368 | // Wait for it | ||
369 | document.addEventListener("DOMContentLoaded", init); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | _.$ = $; | ||
374 | _.$$ = $$; | ||
375 | |||
376 | // Make sure to export Awesomplete on self when in a browser | ||
377 | if (typeof self !== 'undefined') { | ||
378 | self.Awesomplete = _; | ||
379 | } | ||
380 | |||
381 | // Expose Awesomplete as a CJS module | ||
382 | if (typeof exports === 'object') { | ||
383 | module.exports = _; | ||
384 | } | ||
385 | |||
386 | return _; | ||
387 | |||
388 | }()); | ||
diff --git a/inc/awesomplete.min.js b/inc/awesomplete.min.js new file mode 100644 index 00000000..3bfb05e8 --- /dev/null +++ b/inc/awesomplete.min.js | |||
@@ -0,0 +1,10 @@ | |||
1 | // Awesomplete - Lea Verou - MIT license | ||
2 | (function(){function m(a,b){for(var c in a){var f=a[c],e=this.input.getAttribute("data-"+c.toLowerCase());this[c]="number"===typeof f?+e:!1===f?null!==e:f instanceof Function?null:e;this[c]=this[c]||b[c]||f}}function d(a,b){return"string"===typeof a?(b||document).querySelector(a):a||null}function h(a,b){return k.call((b||document).querySelectorAll(a))}function l(){h("input.awesomplete").forEach(function(a){new Awesomplete(a)})}var g=self.Awesomplete=function(a,b){var c=this;this.input=d(a);this.input.setAttribute("aria-autocomplete", | ||
3 | "list");b=b||{};m.call(this,{minChars:2,maxItems:10,autoFirst:!1,filter:g.FILTER_CONTAINS,sort:g.SORT_BYLENGTH,item:function(a,b){return d.create("li",{innerHTML:a.replace(RegExp(d.regExpEscape(b.trim()),"gi"),"<mark>$&</mark>"),"aria-selected":"false"})},replace:function(a){this.input.value=a}},b);this.index=-1;this.container=d.create("div",{className:"awesomplete",around:a});this.ul=d.create("ul",{hidden:"",inside:this.container});this.status=d.create("span",{className:"visually-hidden",role:"status", | ||
4 | "aria-live":"assertive","aria-relevant":"additions",inside:this.container});d.bind(this.input,{input:this.evaluate.bind(this),blur:this.close.bind(this),keydown:function(a){var b=a.keyCode;if(c.opened)if(13===b&&c.selected)a.preventDefault(),c.select();else if(27===b)c.close();else if(38===b||40===b)a.preventDefault(),c[38===b?"previous":"next"]()}});d.bind(this.input.form,{submit:this.close.bind(this)});d.bind(this.ul,{mousedown:function(a){a=a.target;if(a!==this){for(;a&&!/li/i.test(a.nodeName);)a= | ||
5 | a.parentNode;a&&c.select(a)}}});this.input.hasAttribute("list")?(this.list="#"+a.getAttribute("list"),a.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||b.list||[];g.all.push(this)};g.prototype={set list(a){Array.isArray(a)?this._list=a:"string"===typeof a&&-1<a.indexOf(",")?this._list=a.split(/\s*,\s*/):(a=d(a))&&a.children&&(this._list=k.apply(a.children).map(function(a){return a.innerHTML.trim()}));document.activeElement===this.input&&this.evaluate()},get selected(){return-1< | ||
6 | this.index},get opened(){return this.ul&&null==this.ul.getAttribute("hidden")},close:function(){this.ul.setAttribute("hidden","");this.index=-1;d.fire(this.input,"awesomplete-close")},open:function(){this.ul.removeAttribute("hidden");this.autoFirst&&-1===this.index&&this.goto(0);d.fire(this.input,"awesomplete-open")},next:function(){this.goto(this.index<this.ul.children.length-1?this.index+1:-1)},previous:function(){var a=this.ul.children.length;this.goto(this.selected?this.index-1:a-1)},goto:function(a){var b= | ||
7 | this.ul.children;this.selected&&b[this.index].setAttribute("aria-selected","false");this.index=a;-1<a&&0<b.length&&(b[a].setAttribute("aria-selected","true"),this.status.textContent=b[a].textContent)},select:function(a){if(a=a||this.ul.children[this.index]){var b;d.fire(this.input,"awesomplete-select",{text:a.textContent,preventDefault:function(){b=!0}});b||(this.replace(a.textContent),this.close(),d.fire(this.input,"awesomplete-selectcomplete"))}},evaluate:function(){var a=this,b=this.input.value; | ||
8 | b.length>=this.minChars&&0<this._list.length?(this.index=-1,this.ul.innerHTML="",this._list.filter(function(c){return a.filter(c,b)}).sort(this.sort).every(function(c,d){a.ul.appendChild(a.item(c,b));return d<a.maxItems-1}),0===this.ul.children.length?this.close():this.open()):this.close()}};g.all=[];g.FILTER_CONTAINS=function(a,b){return RegExp(d.regExpEscape(b.trim()),"i").test(a)};g.FILTER_STARTSWITH=function(a,b){return RegExp("^"+d.regExpEscape(b.trim()),"i").test(a)};g.SORT_BYLENGTH=function(a, | ||
9 | b){return a.length!==b.length?a.length-b.length:a<b?-1:1};var k=Array.prototype.slice;d.create=function(a,b){var c=document.createElement(a),f;for(f in b){var e=b[f];"inside"===f?d(e).appendChild(c):"around"===f?(e=d(e),e.parentNode.insertBefore(c,e),c.appendChild(e)):f in c?c[f]=e:c.setAttribute(f,e)}return c};d.bind=function(a,b){if(a)for(var c in b){var d=b[c];c.split(/\s+/).forEach(function(b){a.addEventListener(b,d)})}};d.fire=function(a,b,c){var d=document.createEvent("HTMLEvents");d.initEvent(b, | ||
10 | !0,!0);for(var e in c)d[e]=c[e];a.dispatchEvent(d)};d.regExpEscape=function(a){return a.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")};"loading"!==document.readyState?l():document.addEventListener("DOMContentLoaded",l);g.$=d;g.$$=h})(); | ||
diff --git a/inc/jquery-1.11.2.js b/inc/jquery-1.11.2.js deleted file mode 100644 index 1c3aa822..00000000 --- a/inc/jquery-1.11.2.js +++ /dev/null | |||
@@ -1,10346 +0,0 @@ | |||
1 | /*! | ||
2 | * jQuery JavaScript Library v1.11.2 | ||
3 | * http://jquery.com/ | ||
4 | * | ||
5 | * Includes Sizzle.js | ||
6 | * http://sizzlejs.com/ | ||
7 | * | ||
8 | * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors | ||
9 | * Released under the MIT license | ||
10 | * http://jquery.org/license | ||
11 | * | ||
12 | * Date: 2014-12-17T15:27Z | ||
13 | */ | ||
14 | |||
15 | (function( global, factory ) { | ||
16 | |||
17 | if ( typeof module === "object" && typeof module.exports === "object" ) { | ||
18 | // For CommonJS and CommonJS-like environments where a proper window is present, | ||
19 | // execute the factory and get jQuery | ||
20 | // For environments that do not inherently posses a window with a document | ||
21 | // (such as Node.js), expose a jQuery-making factory as module.exports | ||
22 | // This accentuates the need for the creation of a real window | ||
23 | // e.g. var jQuery = require("jquery")(window); | ||
24 | // See ticket #14549 for more info | ||
25 | module.exports = global.document ? | ||
26 | factory( global, true ) : | ||
27 | function( w ) { | ||
28 | if ( !w.document ) { | ||
29 | throw new Error( "jQuery requires a window with a document" ); | ||
30 | } | ||
31 | return factory( w ); | ||
32 | }; | ||
33 | } else { | ||
34 | factory( global ); | ||
35 | } | ||
36 | |||
37 | // Pass this if window is not defined yet | ||
38 | }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { | ||
39 | |||
40 | // Can't do this because several apps including ASP.NET trace | ||
41 | // the stack via arguments.caller.callee and Firefox dies if | ||
42 | // you try to trace through "use strict" call chains. (#13335) | ||
43 | // Support: Firefox 18+ | ||
44 | // | ||
45 | |||
46 | var deletedIds = []; | ||
47 | |||
48 | var slice = deletedIds.slice; | ||
49 | |||
50 | var concat = deletedIds.concat; | ||
51 | |||
52 | var push = deletedIds.push; | ||
53 | |||
54 | var indexOf = deletedIds.indexOf; | ||
55 | |||
56 | var class2type = {}; | ||
57 | |||
58 | var toString = class2type.toString; | ||
59 | |||
60 | var hasOwn = class2type.hasOwnProperty; | ||
61 | |||
62 | var support = {}; | ||
63 | |||
64 | |||
65 | |||
66 | var | ||
67 | version = "1.11.2", | ||
68 | |||
69 | // Define a local copy of jQuery | ||
70 | jQuery = function( selector, context ) { | ||
71 | // The jQuery object is actually just the init constructor 'enhanced' | ||
72 | // Need init if jQuery is called (just allow error to be thrown if not included) | ||
73 | return new jQuery.fn.init( selector, context ); | ||
74 | }, | ||
75 | |||
76 | // Support: Android<4.1, IE<9 | ||
77 | // Make sure we trim BOM and NBSP | ||
78 | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | ||
79 | |||
80 | // Matches dashed string for camelizing | ||
81 | rmsPrefix = /^-ms-/, | ||
82 | rdashAlpha = /-([\da-z])/gi, | ||
83 | |||
84 | // Used by jQuery.camelCase as callback to replace() | ||
85 | fcamelCase = function( all, letter ) { | ||
86 | return letter.toUpperCase(); | ||
87 | }; | ||
88 | |||
89 | jQuery.fn = jQuery.prototype = { | ||
90 | // The current version of jQuery being used | ||
91 | jquery: version, | ||
92 | |||
93 | constructor: jQuery, | ||
94 | |||
95 | // Start with an empty selector | ||
96 | selector: "", | ||
97 | |||
98 | // The default length of a jQuery object is 0 | ||
99 | length: 0, | ||
100 | |||
101 | toArray: function() { | ||
102 | return slice.call( this ); | ||
103 | }, | ||
104 | |||
105 | // Get the Nth element in the matched element set OR | ||
106 | // Get the whole matched element set as a clean array | ||
107 | get: function( num ) { | ||
108 | return num != null ? | ||
109 | |||
110 | // Return just the one element from the set | ||
111 | ( num < 0 ? this[ num + this.length ] : this[ num ] ) : | ||
112 | |||
113 | // Return all the elements in a clean array | ||
114 | slice.call( this ); | ||
115 | }, | ||
116 | |||
117 | // Take an array of elements and push it onto the stack | ||
118 | // (returning the new matched element set) | ||
119 | pushStack: function( elems ) { | ||
120 | |||
121 | // Build a new jQuery matched element set | ||
122 | var ret = jQuery.merge( this.constructor(), elems ); | ||
123 | |||
124 | // Add the old object onto the stack (as a reference) | ||
125 | ret.prevObject = this; | ||
126 | ret.context = this.context; | ||
127 | |||
128 | // Return the newly-formed element set | ||
129 | return ret; | ||
130 | }, | ||
131 | |||
132 | // Execute a callback for every element in the matched set. | ||
133 | // (You can seed the arguments with an array of args, but this is | ||
134 | // only used internally.) | ||
135 | each: function( callback, args ) { | ||
136 | return jQuery.each( this, callback, args ); | ||
137 | }, | ||
138 | |||
139 | map: function( callback ) { | ||
140 | return this.pushStack( jQuery.map(this, function( elem, i ) { | ||
141 | return callback.call( elem, i, elem ); | ||
142 | })); | ||
143 | }, | ||
144 | |||
145 | slice: function() { | ||
146 | return this.pushStack( slice.apply( this, arguments ) ); | ||
147 | }, | ||
148 | |||
149 | first: function() { | ||
150 | return this.eq( 0 ); | ||
151 | }, | ||
152 | |||
153 | last: function() { | ||
154 | return this.eq( -1 ); | ||
155 | }, | ||
156 | |||
157 | eq: function( i ) { | ||
158 | var len = this.length, | ||
159 | j = +i + ( i < 0 ? len : 0 ); | ||
160 | return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); | ||
161 | }, | ||
162 | |||
163 | end: function() { | ||
164 | return this.prevObject || this.constructor(null); | ||
165 | }, | ||
166 | |||
167 | // For internal use only. | ||
168 | // Behaves like an Array's method, not like a jQuery method. | ||
169 | push: push, | ||
170 | sort: deletedIds.sort, | ||
171 | splice: deletedIds.splice | ||
172 | }; | ||
173 | |||
174 | jQuery.extend = jQuery.fn.extend = function() { | ||
175 | var src, copyIsArray, copy, name, options, clone, | ||
176 | target = arguments[0] || {}, | ||
177 | i = 1, | ||
178 | length = arguments.length, | ||
179 | deep = false; | ||
180 | |||
181 | // Handle a deep copy situation | ||
182 | if ( typeof target === "boolean" ) { | ||
183 | deep = target; | ||
184 | |||
185 | // skip the boolean and the target | ||
186 | target = arguments[ i ] || {}; | ||
187 | i++; | ||
188 | } | ||
189 | |||
190 | // Handle case when target is a string or something (possible in deep copy) | ||
191 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { | ||
192 | target = {}; | ||
193 | } | ||
194 | |||
195 | // extend jQuery itself if only one argument is passed | ||
196 | if ( i === length ) { | ||
197 | target = this; | ||
198 | i--; | ||
199 | } | ||
200 | |||
201 | for ( ; i < length; i++ ) { | ||
202 | // Only deal with non-null/undefined values | ||
203 | if ( (options = arguments[ i ]) != null ) { | ||
204 | // Extend the base object | ||
205 | for ( name in options ) { | ||
206 | src = target[ name ]; | ||
207 | copy = options[ name ]; | ||
208 | |||
209 | // Prevent never-ending loop | ||
210 | if ( target === copy ) { | ||
211 | continue; | ||
212 | } | ||
213 | |||
214 | // Recurse if we're merging plain objects or arrays | ||
215 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { | ||
216 | if ( copyIsArray ) { | ||
217 | copyIsArray = false; | ||
218 | clone = src && jQuery.isArray(src) ? src : []; | ||
219 | |||
220 | } else { | ||
221 | clone = src && jQuery.isPlainObject(src) ? src : {}; | ||
222 | } | ||
223 | |||
224 | // Never move original objects, clone them | ||
225 | target[ name ] = jQuery.extend( deep, clone, copy ); | ||
226 | |||
227 | // Don't bring in undefined values | ||
228 | } else if ( copy !== undefined ) { | ||
229 | target[ name ] = copy; | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | |||
235 | // Return the modified object | ||
236 | return target; | ||
237 | }; | ||
238 | |||
239 | jQuery.extend({ | ||
240 | // Unique for each copy of jQuery on the page | ||
241 | expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), | ||
242 | |||
243 | // Assume jQuery is ready without the ready module | ||
244 | isReady: true, | ||
245 | |||
246 | error: function( msg ) { | ||
247 | throw new Error( msg ); | ||
248 | }, | ||
249 | |||
250 | noop: function() {}, | ||
251 | |||
252 | // See test/unit/core.js for details concerning isFunction. | ||
253 | // Since version 1.3, DOM methods and functions like alert | ||
254 | // aren't supported. They return false on IE (#2968). | ||
255 | isFunction: function( obj ) { | ||
256 | return jQuery.type(obj) === "function"; | ||
257 | }, | ||
258 | |||
259 | isArray: Array.isArray || function( obj ) { | ||
260 | return jQuery.type(obj) === "array"; | ||
261 | }, | ||
262 | |||
263 | isWindow: function( obj ) { | ||
264 | /* jshint eqeqeq: false */ | ||
265 | return obj != null && obj == obj.window; | ||
266 | }, | ||
267 | |||
268 | isNumeric: function( obj ) { | ||
269 | // parseFloat NaNs numeric-cast false positives (null|true|false|"") | ||
270 | // ...but misinterprets leading-number strings, particularly hex literals ("0x...") | ||
271 | // subtraction forces infinities to NaN | ||
272 | // adding 1 corrects loss of precision from parseFloat (#15100) | ||
273 | return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; | ||
274 | }, | ||
275 | |||
276 | isEmptyObject: function( obj ) { | ||
277 | var name; | ||
278 | for ( name in obj ) { | ||
279 | return false; | ||
280 | } | ||
281 | return true; | ||
282 | }, | ||
283 | |||
284 | isPlainObject: function( obj ) { | ||
285 | var key; | ||
286 | |||
287 | // Must be an Object. | ||
288 | // Because of IE, we also have to check the presence of the constructor property. | ||
289 | // Make sure that DOM nodes and window objects don't pass through, as well | ||
290 | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | ||
291 | return false; | ||
292 | } | ||
293 | |||
294 | try { | ||
295 | // Not own constructor property must be Object | ||
296 | if ( obj.constructor && | ||
297 | !hasOwn.call(obj, "constructor") && | ||
298 | !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { | ||
299 | return false; | ||
300 | } | ||
301 | } catch ( e ) { | ||
302 | // IE8,9 Will throw exceptions on certain host objects #9897 | ||
303 | return false; | ||
304 | } | ||
305 | |||
306 | // Support: IE<9 | ||
307 | // Handle iteration over inherited properties before own properties. | ||
308 | if ( support.ownLast ) { | ||
309 | for ( key in obj ) { | ||
310 | return hasOwn.call( obj, key ); | ||
311 | } | ||
312 | } | ||
313 | |||
314 | // Own properties are enumerated firstly, so to speed up, | ||
315 | // if last one is own, then all properties are own. | ||
316 | for ( key in obj ) {} | ||
317 | |||
318 | return key === undefined || hasOwn.call( obj, key ); | ||
319 | }, | ||
320 | |||
321 | type: function( obj ) { | ||
322 | if ( obj == null ) { | ||
323 | return obj + ""; | ||
324 | } | ||
325 | return typeof obj === "object" || typeof obj === "function" ? | ||
326 | class2type[ toString.call(obj) ] || "object" : | ||
327 | typeof obj; | ||
328 | }, | ||
329 | |||
330 | // Evaluates a script in a global context | ||
331 | // Workarounds based on findings by Jim Driscoll | ||
332 | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | ||
333 | globalEval: function( data ) { | ||
334 | if ( data && jQuery.trim( data ) ) { | ||
335 | // We use execScript on Internet Explorer | ||
336 | // We use an anonymous function so that context is window | ||
337 | // rather than jQuery in Firefox | ||
338 | ( window.execScript || function( data ) { | ||
339 | window[ "eval" ].call( window, data ); | ||
340 | } )( data ); | ||
341 | } | ||
342 | }, | ||
343 | |||
344 | // Convert dashed to camelCase; used by the css and data modules | ||
345 | // Microsoft forgot to hump their vendor prefix (#9572) | ||
346 | camelCase: function( string ) { | ||
347 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | ||
348 | }, | ||
349 | |||
350 | nodeName: function( elem, name ) { | ||
351 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | ||
352 | }, | ||
353 | |||
354 | // args is for internal usage only | ||
355 | each: function( obj, callback, args ) { | ||
356 | var value, | ||
357 | i = 0, | ||
358 | length = obj.length, | ||
359 | isArray = isArraylike( obj ); | ||
360 | |||
361 | if ( args ) { | ||
362 | if ( isArray ) { | ||
363 | for ( ; i < length; i++ ) { | ||
364 | value = callback.apply( obj[ i ], args ); | ||
365 | |||
366 | if ( value === false ) { | ||
367 | break; | ||
368 | } | ||
369 | } | ||
370 | } else { | ||
371 | for ( i in obj ) { | ||
372 | value = callback.apply( obj[ i ], args ); | ||
373 | |||
374 | if ( value === false ) { | ||
375 | break; | ||
376 | } | ||
377 | } | ||
378 | } | ||
379 | |||
380 | // A special, fast, case for the most common use of each | ||
381 | } else { | ||
382 | if ( isArray ) { | ||
383 | for ( ; i < length; i++ ) { | ||
384 | value = callback.call( obj[ i ], i, obj[ i ] ); | ||
385 | |||
386 | if ( value === false ) { | ||
387 | break; | ||
388 | } | ||
389 | } | ||
390 | } else { | ||
391 | for ( i in obj ) { | ||
392 | value = callback.call( obj[ i ], i, obj[ i ] ); | ||
393 | |||
394 | if ( value === false ) { | ||
395 | break; | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | } | ||
400 | |||
401 | return obj; | ||
402 | }, | ||
403 | |||
404 | // Support: Android<4.1, IE<9 | ||
405 | trim: function( text ) { | ||
406 | return text == null ? | ||
407 | "" : | ||
408 | ( text + "" ).replace( rtrim, "" ); | ||
409 | }, | ||
410 | |||
411 | // results is for internal usage only | ||
412 | makeArray: function( arr, results ) { | ||
413 | var ret = results || []; | ||
414 | |||
415 | if ( arr != null ) { | ||
416 | if ( isArraylike( Object(arr) ) ) { | ||
417 | jQuery.merge( ret, | ||
418 | typeof arr === "string" ? | ||
419 | [ arr ] : arr | ||
420 | ); | ||
421 | } else { | ||
422 | push.call( ret, arr ); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | return ret; | ||
427 | }, | ||
428 | |||
429 | inArray: function( elem, arr, i ) { | ||
430 | var len; | ||
431 | |||
432 | if ( arr ) { | ||
433 | if ( indexOf ) { | ||
434 | return indexOf.call( arr, elem, i ); | ||
435 | } | ||
436 | |||
437 | len = arr.length; | ||
438 | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; | ||
439 | |||
440 | for ( ; i < len; i++ ) { | ||
441 | // Skip accessing in sparse arrays | ||
442 | if ( i in arr && arr[ i ] === elem ) { | ||
443 | return i; | ||
444 | } | ||
445 | } | ||
446 | } | ||
447 | |||
448 | return -1; | ||
449 | }, | ||
450 | |||
451 | merge: function( first, second ) { | ||
452 | var len = +second.length, | ||
453 | j = 0, | ||
454 | i = first.length; | ||
455 | |||
456 | while ( j < len ) { | ||
457 | first[ i++ ] = second[ j++ ]; | ||
458 | } | ||
459 | |||
460 | // Support: IE<9 | ||
461 | // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) | ||
462 | if ( len !== len ) { | ||
463 | while ( second[j] !== undefined ) { | ||
464 | first[ i++ ] = second[ j++ ]; | ||
465 | } | ||
466 | } | ||
467 | |||
468 | first.length = i; | ||
469 | |||
470 | return first; | ||
471 | }, | ||
472 | |||
473 | grep: function( elems, callback, invert ) { | ||
474 | var callbackInverse, | ||
475 | matches = [], | ||
476 | i = 0, | ||
477 | length = elems.length, | ||
478 | callbackExpect = !invert; | ||
479 | |||
480 | // Go through the array, only saving the items | ||
481 | // that pass the validator function | ||
482 | for ( ; i < length; i++ ) { | ||
483 | callbackInverse = !callback( elems[ i ], i ); | ||
484 | if ( callbackInverse !== callbackExpect ) { | ||
485 | matches.push( elems[ i ] ); | ||
486 | } | ||
487 | } | ||
488 | |||
489 | return matches; | ||
490 | }, | ||
491 | |||
492 | // arg is for internal usage only | ||
493 | map: function( elems, callback, arg ) { | ||
494 | var value, | ||
495 | i = 0, | ||
496 | length = elems.length, | ||
497 | isArray = isArraylike( elems ), | ||
498 | ret = []; | ||
499 | |||
500 | // Go through the array, translating each of the items to their new values | ||
501 | if ( isArray ) { | ||
502 | for ( ; i < length; i++ ) { | ||
503 | value = callback( elems[ i ], i, arg ); | ||
504 | |||
505 | if ( value != null ) { | ||
506 | ret.push( value ); | ||
507 | } | ||
508 | } | ||
509 | |||
510 | // Go through every key on the object, | ||
511 | } else { | ||
512 | for ( i in elems ) { | ||
513 | value = callback( elems[ i ], i, arg ); | ||
514 | |||
515 | if ( value != null ) { | ||
516 | ret.push( value ); | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | |||
521 | // Flatten any nested arrays | ||
522 | return concat.apply( [], ret ); | ||
523 | }, | ||
524 | |||
525 | // A global GUID counter for objects | ||
526 | guid: 1, | ||
527 | |||
528 | // Bind a function to a context, optionally partially applying any | ||
529 | // arguments. | ||
530 | proxy: function( fn, context ) { | ||
531 | var args, proxy, tmp; | ||
532 | |||
533 | if ( typeof context === "string" ) { | ||
534 | tmp = fn[ context ]; | ||
535 | context = fn; | ||
536 | fn = tmp; | ||
537 | } | ||
538 | |||
539 | // Quick check to determine if target is callable, in the spec | ||
540 | // this throws a TypeError, but we will just return undefined. | ||
541 | if ( !jQuery.isFunction( fn ) ) { | ||
542 | return undefined; | ||
543 | } | ||
544 | |||
545 | // Simulated bind | ||
546 | args = slice.call( arguments, 2 ); | ||
547 | proxy = function() { | ||
548 | return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); | ||
549 | }; | ||
550 | |||
551 | // Set the guid of unique handler to the same of original handler, so it can be removed | ||
552 | proxy.guid = fn.guid = fn.guid || jQuery.guid++; | ||
553 | |||
554 | return proxy; | ||
555 | }, | ||
556 | |||
557 | now: function() { | ||
558 | return +( new Date() ); | ||
559 | }, | ||
560 | |||
561 | // jQuery.support is not used in Core but other projects attach their | ||
562 | // properties to it so it needs to exist. | ||
563 | support: support | ||
564 | }); | ||
565 | |||
566 | // Populate the class2type map | ||
567 | jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { | ||
568 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); | ||
569 | }); | ||
570 | |||
571 | function isArraylike( obj ) { | ||
572 | var length = obj.length, | ||
573 | type = jQuery.type( obj ); | ||
574 | |||
575 | if ( type === "function" || jQuery.isWindow( obj ) ) { | ||
576 | return false; | ||
577 | } | ||
578 | |||
579 | if ( obj.nodeType === 1 && length ) { | ||
580 | return true; | ||
581 | } | ||
582 | |||
583 | return type === "array" || length === 0 || | ||
584 | typeof length === "number" && length > 0 && ( length - 1 ) in obj; | ||
585 | } | ||
586 | var Sizzle = | ||
587 | /*! | ||
588 | * Sizzle CSS Selector Engine v2.2.0-pre | ||
589 | * http://sizzlejs.com/ | ||
590 | * | ||
591 | * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors | ||
592 | * Released under the MIT license | ||
593 | * http://jquery.org/license | ||
594 | * | ||
595 | * Date: 2014-12-16 | ||
596 | */ | ||
597 | (function( window ) { | ||
598 | |||
599 | var i, | ||
600 | support, | ||
601 | Expr, | ||
602 | getText, | ||
603 | isXML, | ||
604 | tokenize, | ||
605 | compile, | ||
606 | select, | ||
607 | outermostContext, | ||
608 | sortInput, | ||
609 | hasDuplicate, | ||
610 | |||
611 | // Local document vars | ||
612 | setDocument, | ||
613 | document, | ||
614 | docElem, | ||
615 | documentIsHTML, | ||
616 | rbuggyQSA, | ||
617 | rbuggyMatches, | ||
618 | matches, | ||
619 | contains, | ||
620 | |||
621 | // Instance-specific data | ||
622 | expando = "sizzle" + 1 * new Date(), | ||
623 | preferredDoc = window.document, | ||
624 | dirruns = 0, | ||
625 | done = 0, | ||
626 | classCache = createCache(), | ||
627 | tokenCache = createCache(), | ||
628 | compilerCache = createCache(), | ||
629 | sortOrder = function( a, b ) { | ||
630 | if ( a === b ) { | ||
631 | hasDuplicate = true; | ||
632 | } | ||
633 | return 0; | ||
634 | }, | ||
635 | |||
636 | // General-purpose constants | ||
637 | MAX_NEGATIVE = 1 << 31, | ||
638 | |||
639 | // Instance methods | ||
640 | hasOwn = ({}).hasOwnProperty, | ||
641 | arr = [], | ||
642 | pop = arr.pop, | ||
643 | push_native = arr.push, | ||
644 | push = arr.push, | ||
645 | slice = arr.slice, | ||
646 | // Use a stripped-down indexOf as it's faster than native | ||
647 | // http://jsperf.com/thor-indexof-vs-for/5 | ||
648 | indexOf = function( list, elem ) { | ||
649 | var i = 0, | ||
650 | len = list.length; | ||
651 | for ( ; i < len; i++ ) { | ||
652 | if ( list[i] === elem ) { | ||
653 | return i; | ||
654 | } | ||
655 | } | ||
656 | return -1; | ||
657 | }, | ||
658 | |||
659 | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | ||
660 | |||
661 | // Regular expressions | ||
662 | |||
663 | // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace | ||
664 | whitespace = "[\\x20\\t\\r\\n\\f]", | ||
665 | // http://www.w3.org/TR/css3-syntax/#characters | ||
666 | characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | ||
667 | |||
668 | // Loosely modeled on CSS identifier characters | ||
669 | // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors | ||
670 | // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | ||
671 | identifier = characterEncoding.replace( "w", "w#" ), | ||
672 | |||
673 | // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors | ||
674 | attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + | ||
675 | // Operator (capture 2) | ||
676 | "*([*^$|!~]?=)" + whitespace + | ||
677 | // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" | ||
678 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + | ||
679 | "*\\]", | ||
680 | |||
681 | pseudos = ":(" + characterEncoding + ")(?:\\((" + | ||
682 | // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: | ||
683 | // 1. quoted (capture 3; capture 4 or capture 5) | ||
684 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + | ||
685 | // 2. simple (capture 6) | ||
686 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + | ||
687 | // 3. anything else (capture 2) | ||
688 | ".*" + | ||
689 | ")\\)|)", | ||
690 | |||
691 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | ||
692 | rwhitespace = new RegExp( whitespace + "+", "g" ), | ||
693 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), | ||
694 | |||
695 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), | ||
696 | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), | ||
697 | |||
698 | rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), | ||
699 | |||
700 | rpseudo = new RegExp( pseudos ), | ||
701 | ridentifier = new RegExp( "^" + identifier + "$" ), | ||
702 | |||
703 | matchExpr = { | ||
704 | "ID": new RegExp( "^#(" + characterEncoding + ")" ), | ||
705 | "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), | ||
706 | "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), | ||
707 | "ATTR": new RegExp( "^" + attributes ), | ||
708 | "PSEUDO": new RegExp( "^" + pseudos ), | ||
709 | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + | ||
710 | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | ||
711 | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), | ||
712 | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), | ||
713 | // For use in libraries implementing .is() | ||
714 | // We use this for POS matching in `select` | ||
715 | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | ||
716 | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | ||
717 | }, | ||
718 | |||
719 | rinputs = /^(?:input|select|textarea|button)$/i, | ||
720 | rheader = /^h\d$/i, | ||
721 | |||
722 | rnative = /^[^{]+\{\s*\[native \w/, | ||
723 | |||
724 | // Easily-parseable/retrievable ID or TAG or CLASS selectors | ||
725 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | ||
726 | |||
727 | rsibling = /[+~]/, | ||
728 | rescape = /'|\\/g, | ||
729 | |||
730 | // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | ||
731 | runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), | ||
732 | funescape = function( _, escaped, escapedWhitespace ) { | ||
733 | var high = "0x" + escaped - 0x10000; | ||
734 | // NaN means non-codepoint | ||
735 | // Support: Firefox<24 | ||
736 | // Workaround erroneous numeric interpretation of +"0x" | ||
737 | return high !== high || escapedWhitespace ? | ||
738 | escaped : | ||
739 | high < 0 ? | ||
740 | // BMP codepoint | ||
741 | String.fromCharCode( high + 0x10000 ) : | ||
742 | // Supplemental Plane codepoint (surrogate pair) | ||
743 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); | ||
744 | }, | ||
745 | |||
746 | // Used for iframes | ||
747 | // See setDocument() | ||
748 | // Removing the function wrapper causes a "Permission Denied" | ||
749 | // error in IE | ||
750 | unloadHandler = function() { | ||
751 | setDocument(); | ||
752 | }; | ||
753 | |||
754 | // Optimize for push.apply( _, NodeList ) | ||
755 | try { | ||
756 | push.apply( | ||
757 | (arr = slice.call( preferredDoc.childNodes )), | ||
758 | preferredDoc.childNodes | ||
759 | ); | ||
760 | // Support: Android<4.0 | ||
761 | // Detect silently failing push.apply | ||
762 | arr[ preferredDoc.childNodes.length ].nodeType; | ||
763 | } catch ( e ) { | ||
764 | push = { apply: arr.length ? | ||
765 | |||
766 | // Leverage slice if possible | ||
767 | function( target, els ) { | ||
768 | push_native.apply( target, slice.call(els) ); | ||
769 | } : | ||
770 | |||
771 | // Support: IE<9 | ||
772 | // Otherwise append directly | ||
773 | function( target, els ) { | ||
774 | var j = target.length, | ||
775 | i = 0; | ||
776 | // Can't trust NodeList.length | ||
777 | while ( (target[j++] = els[i++]) ) {} | ||
778 | target.length = j - 1; | ||
779 | } | ||
780 | }; | ||
781 | } | ||
782 | |||
783 | function Sizzle( selector, context, results, seed ) { | ||
784 | var match, elem, m, nodeType, | ||
785 | // QSA vars | ||
786 | i, groups, old, nid, newContext, newSelector; | ||
787 | |||
788 | if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { | ||
789 | setDocument( context ); | ||
790 | } | ||
791 | |||
792 | context = context || document; | ||
793 | results = results || []; | ||
794 | nodeType = context.nodeType; | ||
795 | |||
796 | if ( typeof selector !== "string" || !selector || | ||
797 | nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { | ||
798 | |||
799 | return results; | ||
800 | } | ||
801 | |||
802 | if ( !seed && documentIsHTML ) { | ||
803 | |||
804 | // Try to shortcut find operations when possible (e.g., not under DocumentFragment) | ||
805 | if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { | ||
806 | // Speed-up: Sizzle("#ID") | ||
807 | if ( (m = match[1]) ) { | ||
808 | if ( nodeType === 9 ) { | ||
809 | elem = context.getElementById( m ); | ||
810 | // Check parentNode to catch when Blackberry 4.6 returns | ||
811 | // nodes that are no longer in the document (jQuery #6963) | ||
812 | if ( elem && elem.parentNode ) { | ||
813 | // Handle the case where IE, Opera, and Webkit return items | ||
814 | // by name instead of ID | ||
815 | if ( elem.id === m ) { | ||
816 | results.push( elem ); | ||
817 | return results; | ||
818 | } | ||
819 | } else { | ||
820 | return results; | ||
821 | } | ||
822 | } else { | ||
823 | // Context is not a document | ||
824 | if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && | ||
825 | contains( context, elem ) && elem.id === m ) { | ||
826 | results.push( elem ); | ||
827 | return results; | ||
828 | } | ||
829 | } | ||
830 | |||
831 | // Speed-up: Sizzle("TAG") | ||
832 | } else if ( match[2] ) { | ||
833 | push.apply( results, context.getElementsByTagName( selector ) ); | ||
834 | return results; | ||
835 | |||
836 | // Speed-up: Sizzle(".CLASS") | ||
837 | } else if ( (m = match[3]) && support.getElementsByClassName ) { | ||
838 | push.apply( results, context.getElementsByClassName( m ) ); | ||
839 | return results; | ||
840 | } | ||
841 | } | ||
842 | |||
843 | // QSA path | ||
844 | if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { | ||
845 | nid = old = expando; | ||
846 | newContext = context; | ||
847 | newSelector = nodeType !== 1 && selector; | ||
848 | |||
849 | // qSA works strangely on Element-rooted queries | ||
850 | // We can work around this by specifying an extra ID on the root | ||
851 | // and working up from there (Thanks to Andrew Dupont for the technique) | ||
852 | // IE 8 doesn't work on object elements | ||
853 | if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { | ||
854 | groups = tokenize( selector ); | ||
855 | |||
856 | if ( (old = context.getAttribute("id")) ) { | ||
857 | nid = old.replace( rescape, "\\$&" ); | ||
858 | } else { | ||
859 | context.setAttribute( "id", nid ); | ||
860 | } | ||
861 | nid = "[id='" + nid + "'] "; | ||
862 | |||
863 | i = groups.length; | ||
864 | while ( i-- ) { | ||
865 | groups[i] = nid + toSelector( groups[i] ); | ||
866 | } | ||
867 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; | ||
868 | newSelector = groups.join(","); | ||
869 | } | ||
870 | |||
871 | if ( newSelector ) { | ||
872 | try { | ||
873 | push.apply( results, | ||
874 | newContext.querySelectorAll( newSelector ) | ||
875 | ); | ||
876 | return results; | ||
877 | } catch(qsaError) { | ||
878 | } finally { | ||
879 | if ( !old ) { | ||
880 | context.removeAttribute("id"); | ||
881 | } | ||
882 | } | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | |||
887 | // All others | ||
888 | return select( selector.replace( rtrim, "$1" ), context, results, seed ); | ||
889 | } | ||
890 | |||
891 | /** | ||
892 | * Create key-value caches of limited size | ||
893 | * @returns {Function(string, Object)} Returns the Object data after storing it on itself with | ||
894 | * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) | ||
895 | * deleting the oldest entry | ||
896 | */ | ||
897 | function createCache() { | ||
898 | var keys = []; | ||
899 | |||
900 | function cache( key, value ) { | ||
901 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) | ||
902 | if ( keys.push( key + " " ) > Expr.cacheLength ) { | ||
903 | // Only keep the most recent entries | ||
904 | delete cache[ keys.shift() ]; | ||
905 | } | ||
906 | return (cache[ key + " " ] = value); | ||
907 | } | ||
908 | return cache; | ||
909 | } | ||
910 | |||
911 | /** | ||
912 | * Mark a function for special use by Sizzle | ||
913 | * @param {Function} fn The function to mark | ||
914 | */ | ||
915 | function markFunction( fn ) { | ||
916 | fn[ expando ] = true; | ||
917 | return fn; | ||
918 | } | ||
919 | |||
920 | /** | ||
921 | * Support testing using an element | ||
922 | * @param {Function} fn Passed the created div and expects a boolean result | ||
923 | */ | ||
924 | function assert( fn ) { | ||
925 | var div = document.createElement("div"); | ||
926 | |||
927 | try { | ||
928 | return !!fn( div ); | ||
929 | } catch (e) { | ||
930 | return false; | ||
931 | } finally { | ||
932 | // Remove from its parent by default | ||
933 | if ( div.parentNode ) { | ||
934 | div.parentNode.removeChild( div ); | ||
935 | } | ||
936 | // release memory in IE | ||
937 | div = null; | ||
938 | } | ||
939 | } | ||
940 | |||
941 | /** | ||
942 | * Adds the same handler for all of the specified attrs | ||
943 | * @param {String} attrs Pipe-separated list of attributes | ||
944 | * @param {Function} handler The method that will be applied | ||
945 | */ | ||
946 | function addHandle( attrs, handler ) { | ||
947 | var arr = attrs.split("|"), | ||
948 | i = attrs.length; | ||
949 | |||
950 | while ( i-- ) { | ||
951 | Expr.attrHandle[ arr[i] ] = handler; | ||
952 | } | ||
953 | } | ||
954 | |||
955 | /** | ||
956 | * Checks document order of two siblings | ||
957 | * @param {Element} a | ||
958 | * @param {Element} b | ||
959 | * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | ||
960 | */ | ||
961 | function siblingCheck( a, b ) { | ||
962 | var cur = b && a, | ||
963 | diff = cur && a.nodeType === 1 && b.nodeType === 1 && | ||
964 | ( ~b.sourceIndex || MAX_NEGATIVE ) - | ||
965 | ( ~a.sourceIndex || MAX_NEGATIVE ); | ||
966 | |||
967 | // Use IE sourceIndex if available on both nodes | ||
968 | if ( diff ) { | ||
969 | return diff; | ||
970 | } | ||
971 | |||
972 | // Check if b follows a | ||
973 | if ( cur ) { | ||
974 | while ( (cur = cur.nextSibling) ) { | ||
975 | if ( cur === b ) { | ||
976 | return -1; | ||
977 | } | ||
978 | } | ||
979 | } | ||
980 | |||
981 | return a ? 1 : -1; | ||
982 | } | ||
983 | |||
984 | /** | ||
985 | * Returns a function to use in pseudos for input types | ||
986 | * @param {String} type | ||
987 | */ | ||
988 | function createInputPseudo( type ) { | ||
989 | return function( elem ) { | ||
990 | var name = elem.nodeName.toLowerCase(); | ||
991 | return name === "input" && elem.type === type; | ||
992 | }; | ||
993 | } | ||
994 | |||
995 | /** | ||
996 | * Returns a function to use in pseudos for buttons | ||
997 | * @param {String} type | ||
998 | */ | ||
999 | function createButtonPseudo( type ) { | ||
1000 | return function( elem ) { | ||
1001 | var name = elem.nodeName.toLowerCase(); | ||
1002 | return (name === "input" || name === "button") && elem.type === type; | ||
1003 | }; | ||
1004 | } | ||
1005 | |||
1006 | /** | ||
1007 | * Returns a function to use in pseudos for positionals | ||
1008 | * @param {Function} fn | ||
1009 | */ | ||
1010 | function createPositionalPseudo( fn ) { | ||
1011 | return markFunction(function( argument ) { | ||
1012 | argument = +argument; | ||
1013 | return markFunction(function( seed, matches ) { | ||
1014 | var j, | ||
1015 | matchIndexes = fn( [], seed.length, argument ), | ||
1016 | i = matchIndexes.length; | ||
1017 | |||
1018 | // Match elements found at the specified indexes | ||
1019 | while ( i-- ) { | ||
1020 | if ( seed[ (j = matchIndexes[i]) ] ) { | ||
1021 | seed[j] = !(matches[j] = seed[j]); | ||
1022 | } | ||
1023 | } | ||
1024 | }); | ||
1025 | }); | ||
1026 | } | ||
1027 | |||
1028 | /** | ||
1029 | * Checks a node for validity as a Sizzle context | ||
1030 | * @param {Element|Object=} context | ||
1031 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | ||
1032 | */ | ||
1033 | function testContext( context ) { | ||
1034 | return context && typeof context.getElementsByTagName !== "undefined" && context; | ||
1035 | } | ||
1036 | |||
1037 | // Expose support vars for convenience | ||
1038 | support = Sizzle.support = {}; | ||
1039 | |||
1040 | /** | ||
1041 | * Detects XML nodes | ||
1042 | * @param {Element|Object} elem An element or a document | ||
1043 | * @returns {Boolean} True iff elem is a non-HTML XML node | ||
1044 | */ | ||
1045 | isXML = Sizzle.isXML = function( elem ) { | ||
1046 | // documentElement is verified for cases where it doesn't yet exist | ||
1047 | // (such as loading iframes in IE - #4833) | ||
1048 | var documentElement = elem && (elem.ownerDocument || elem).documentElement; | ||
1049 | return documentElement ? documentElement.nodeName !== "HTML" : false; | ||
1050 | }; | ||
1051 | |||
1052 | /** | ||
1053 | * Sets document-related variables once based on the current document | ||
1054 | * @param {Element|Object} [doc] An element or document object to use to set the document | ||
1055 | * @returns {Object} Returns the current document | ||
1056 | */ | ||
1057 | setDocument = Sizzle.setDocument = function( node ) { | ||
1058 | var hasCompare, parent, | ||
1059 | doc = node ? node.ownerDocument || node : preferredDoc; | ||
1060 | |||
1061 | // If no document and documentElement is available, return | ||
1062 | if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { | ||
1063 | return document; | ||
1064 | } | ||
1065 | |||
1066 | // Set our document | ||
1067 | document = doc; | ||
1068 | docElem = doc.documentElement; | ||
1069 | parent = doc.defaultView; | ||
1070 | |||
1071 | // Support: IE>8 | ||
1072 | // If iframe document is assigned to "document" variable and if iframe has been reloaded, | ||
1073 | // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 | ||
1074 | // IE6-8 do not support the defaultView property so parent will be undefined | ||
1075 | if ( parent && parent !== parent.top ) { | ||
1076 | // IE11 does not have attachEvent, so all must suffer | ||
1077 | if ( parent.addEventListener ) { | ||
1078 | parent.addEventListener( "unload", unloadHandler, false ); | ||
1079 | } else if ( parent.attachEvent ) { | ||
1080 | parent.attachEvent( "onunload", unloadHandler ); | ||
1081 | } | ||
1082 | } | ||
1083 | |||
1084 | /* Support tests | ||
1085 | ---------------------------------------------------------------------- */ | ||
1086 | documentIsHTML = !isXML( doc ); | ||
1087 | |||
1088 | /* Attributes | ||
1089 | ---------------------------------------------------------------------- */ | ||
1090 | |||
1091 | // Support: IE<8 | ||
1092 | // Verify that getAttribute really returns attributes and not properties | ||
1093 | // (excepting IE8 booleans) | ||
1094 | support.attributes = assert(function( div ) { | ||
1095 | div.className = "i"; | ||
1096 | return !div.getAttribute("className"); | ||
1097 | }); | ||
1098 | |||
1099 | /* getElement(s)By* | ||
1100 | ---------------------------------------------------------------------- */ | ||
1101 | |||
1102 | // Check if getElementsByTagName("*") returns only elements | ||
1103 | support.getElementsByTagName = assert(function( div ) { | ||
1104 | div.appendChild( doc.createComment("") ); | ||
1105 | return !div.getElementsByTagName("*").length; | ||
1106 | }); | ||
1107 | |||
1108 | // Support: IE<9 | ||
1109 | support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); | ||
1110 | |||
1111 | // Support: IE<10 | ||
1112 | // Check if getElementById returns elements by name | ||
1113 | // The broken getElementById methods don't pick up programatically-set names, | ||
1114 | // so use a roundabout getElementsByName test | ||
1115 | support.getById = assert(function( div ) { | ||
1116 | docElem.appendChild( div ).id = expando; | ||
1117 | return !doc.getElementsByName || !doc.getElementsByName( expando ).length; | ||
1118 | }); | ||
1119 | |||
1120 | // ID find and filter | ||
1121 | if ( support.getById ) { | ||
1122 | Expr.find["ID"] = function( id, context ) { | ||
1123 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { | ||
1124 | var m = context.getElementById( id ); | ||
1125 | // Check parentNode to catch when Blackberry 4.6 returns | ||
1126 | // nodes that are no longer in the document #6963 | ||
1127 | return m && m.parentNode ? [ m ] : []; | ||
1128 | } | ||
1129 | }; | ||
1130 | Expr.filter["ID"] = function( id ) { | ||
1131 | var attrId = id.replace( runescape, funescape ); | ||
1132 | return function( elem ) { | ||
1133 | return elem.getAttribute("id") === attrId; | ||
1134 | }; | ||
1135 | }; | ||
1136 | } else { | ||
1137 | // Support: IE6/7 | ||
1138 | // getElementById is not reliable as a find shortcut | ||
1139 | delete Expr.find["ID"]; | ||
1140 | |||
1141 | Expr.filter["ID"] = function( id ) { | ||
1142 | var attrId = id.replace( runescape, funescape ); | ||
1143 | return function( elem ) { | ||
1144 | var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); | ||
1145 | return node && node.value === attrId; | ||
1146 | }; | ||
1147 | }; | ||
1148 | } | ||
1149 | |||
1150 | // Tag | ||
1151 | Expr.find["TAG"] = support.getElementsByTagName ? | ||
1152 | function( tag, context ) { | ||
1153 | if ( typeof context.getElementsByTagName !== "undefined" ) { | ||
1154 | return context.getElementsByTagName( tag ); | ||
1155 | |||
1156 | // DocumentFragment nodes don't have gEBTN | ||
1157 | } else if ( support.qsa ) { | ||
1158 | return context.querySelectorAll( tag ); | ||
1159 | } | ||
1160 | } : | ||
1161 | |||
1162 | function( tag, context ) { | ||
1163 | var elem, | ||
1164 | tmp = [], | ||
1165 | i = 0, | ||
1166 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too | ||
1167 | results = context.getElementsByTagName( tag ); | ||
1168 | |||
1169 | // Filter out possible comments | ||
1170 | if ( tag === "*" ) { | ||
1171 | while ( (elem = results[i++]) ) { | ||
1172 | if ( elem.nodeType === 1 ) { | ||
1173 | tmp.push( elem ); | ||
1174 | } | ||
1175 | } | ||
1176 | |||
1177 | return tmp; | ||
1178 | } | ||
1179 | return results; | ||
1180 | }; | ||
1181 | |||
1182 | // Class | ||
1183 | Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { | ||
1184 | if ( documentIsHTML ) { | ||
1185 | return context.getElementsByClassName( className ); | ||
1186 | } | ||
1187 | }; | ||
1188 | |||
1189 | /* QSA/matchesSelector | ||
1190 | ---------------------------------------------------------------------- */ | ||
1191 | |||
1192 | // QSA and matchesSelector support | ||
1193 | |||
1194 | // matchesSelector(:active) reports false when true (IE9/Opera 11.5) | ||
1195 | rbuggyMatches = []; | ||
1196 | |||
1197 | // qSa(:focus) reports false when true (Chrome 21) | ||
1198 | // We allow this because of a bug in IE8/9 that throws an error | ||
1199 | // whenever `document.activeElement` is accessed on an iframe | ||
1200 | // So, we allow :focus to pass through QSA all the time to avoid the IE error | ||
1201 | // See http://bugs.jquery.com/ticket/13378 | ||
1202 | rbuggyQSA = []; | ||
1203 | |||
1204 | if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { | ||
1205 | // Build QSA regex | ||
1206 | // Regex strategy adopted from Diego Perini | ||
1207 | assert(function( div ) { | ||
1208 | // Select is set to empty string on purpose | ||
1209 | // This is to test IE's treatment of not explicitly | ||
1210 | // setting a boolean content attribute, | ||
1211 | // since its presence should be enough | ||
1212 | // http://bugs.jquery.com/ticket/12359 | ||
1213 | docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + | ||
1214 | "<select id='" + expando + "-\f]' msallowcapture=''>" + | ||
1215 | "<option selected=''></option></select>"; | ||
1216 | |||
1217 | // Support: IE8, Opera 11-12.16 | ||
1218 | // Nothing should be selected when empty strings follow ^= or $= or *= | ||
1219 | // The test attribute must be unknown in Opera but "safe" for WinRT | ||
1220 | // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section | ||
1221 | if ( div.querySelectorAll("[msallowcapture^='']").length ) { | ||
1222 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | ||
1223 | } | ||
1224 | |||
1225 | // Support: IE8 | ||
1226 | // Boolean attributes and "value" are not treated correctly | ||
1227 | if ( !div.querySelectorAll("[selected]").length ) { | ||
1228 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | ||
1229 | } | ||
1230 | |||
1231 | // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ | ||
1232 | if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { | ||
1233 | rbuggyQSA.push("~="); | ||
1234 | } | ||
1235 | |||
1236 | // Webkit/Opera - :checked should return selected option elements | ||
1237 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
1238 | // IE8 throws error here and will not see later tests | ||
1239 | if ( !div.querySelectorAll(":checked").length ) { | ||
1240 | rbuggyQSA.push(":checked"); | ||
1241 | } | ||
1242 | |||
1243 | // Support: Safari 8+, iOS 8+ | ||
1244 | // https://bugs.webkit.org/show_bug.cgi?id=136851 | ||
1245 | // In-page `selector#id sibing-combinator selector` fails | ||
1246 | if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { | ||
1247 | rbuggyQSA.push(".#.+[+~]"); | ||
1248 | } | ||
1249 | }); | ||
1250 | |||
1251 | assert(function( div ) { | ||
1252 | // Support: Windows 8 Native Apps | ||
1253 | // The type and name attributes are restricted during .innerHTML assignment | ||
1254 | var input = doc.createElement("input"); | ||
1255 | input.setAttribute( "type", "hidden" ); | ||
1256 | div.appendChild( input ).setAttribute( "name", "D" ); | ||
1257 | |||
1258 | // Support: IE8 | ||
1259 | // Enforce case-sensitivity of name attribute | ||
1260 | if ( div.querySelectorAll("[name=d]").length ) { | ||
1261 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); | ||
1262 | } | ||
1263 | |||
1264 | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) | ||
1265 | // IE8 throws error here and will not see later tests | ||
1266 | if ( !div.querySelectorAll(":enabled").length ) { | ||
1267 | rbuggyQSA.push( ":enabled", ":disabled" ); | ||
1268 | } | ||
1269 | |||
1270 | // Opera 10-11 does not throw on post-comma invalid pseudos | ||
1271 | div.querySelectorAll("*,:x"); | ||
1272 | rbuggyQSA.push(",.*:"); | ||
1273 | }); | ||
1274 | } | ||
1275 | |||
1276 | if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || | ||
1277 | docElem.webkitMatchesSelector || | ||
1278 | docElem.mozMatchesSelector || | ||
1279 | docElem.oMatchesSelector || | ||
1280 | docElem.msMatchesSelector) )) ) { | ||
1281 | |||
1282 | assert(function( div ) { | ||
1283 | // Check to see if it's possible to do matchesSelector | ||
1284 | // on a disconnected node (IE 9) | ||
1285 | support.disconnectedMatch = matches.call( div, "div" ); | ||
1286 | |||
1287 | // This should fail with an exception | ||
1288 | // Gecko does not error, returns false instead | ||
1289 | matches.call( div, "[s!='']:x" ); | ||
1290 | rbuggyMatches.push( "!=", pseudos ); | ||
1291 | }); | ||
1292 | } | ||
1293 | |||
1294 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); | ||
1295 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); | ||
1296 | |||
1297 | /* Contains | ||
1298 | ---------------------------------------------------------------------- */ | ||
1299 | hasCompare = rnative.test( docElem.compareDocumentPosition ); | ||
1300 | |||
1301 | // Element contains another | ||
1302 | // Purposefully does not implement inclusive descendent | ||
1303 | // As in, an element does not contain itself | ||
1304 | contains = hasCompare || rnative.test( docElem.contains ) ? | ||
1305 | function( a, b ) { | ||
1306 | var adown = a.nodeType === 9 ? a.documentElement : a, | ||
1307 | bup = b && b.parentNode; | ||
1308 | return a === bup || !!( bup && bup.nodeType === 1 && ( | ||
1309 | adown.contains ? | ||
1310 | adown.contains( bup ) : | ||
1311 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 | ||
1312 | )); | ||
1313 | } : | ||
1314 | function( a, b ) { | ||
1315 | if ( b ) { | ||
1316 | while ( (b = b.parentNode) ) { | ||
1317 | if ( b === a ) { | ||
1318 | return true; | ||
1319 | } | ||
1320 | } | ||
1321 | } | ||
1322 | return false; | ||
1323 | }; | ||
1324 | |||
1325 | /* Sorting | ||
1326 | ---------------------------------------------------------------------- */ | ||
1327 | |||
1328 | // Document order sorting | ||
1329 | sortOrder = hasCompare ? | ||
1330 | function( a, b ) { | ||
1331 | |||
1332 | // Flag for duplicate removal | ||
1333 | if ( a === b ) { | ||
1334 | hasDuplicate = true; | ||
1335 | return 0; | ||
1336 | } | ||
1337 | |||
1338 | // Sort on method existence if only one input has compareDocumentPosition | ||
1339 | var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; | ||
1340 | if ( compare ) { | ||
1341 | return compare; | ||
1342 | } | ||
1343 | |||
1344 | // Calculate position if both inputs belong to the same document | ||
1345 | compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? | ||
1346 | a.compareDocumentPosition( b ) : | ||
1347 | |||
1348 | // Otherwise we know they are disconnected | ||
1349 | 1; | ||
1350 | |||
1351 | // Disconnected nodes | ||
1352 | if ( compare & 1 || | ||
1353 | (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { | ||
1354 | |||
1355 | // Choose the first element that is related to our preferred document | ||
1356 | if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { | ||
1357 | return -1; | ||
1358 | } | ||
1359 | if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { | ||
1360 | return 1; | ||
1361 | } | ||
1362 | |||
1363 | // Maintain original order | ||
1364 | return sortInput ? | ||
1365 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : | ||
1366 | 0; | ||
1367 | } | ||
1368 | |||
1369 | return compare & 4 ? -1 : 1; | ||
1370 | } : | ||
1371 | function( a, b ) { | ||
1372 | // Exit early if the nodes are identical | ||
1373 | if ( a === b ) { | ||
1374 | hasDuplicate = true; | ||
1375 | return 0; | ||
1376 | } | ||
1377 | |||
1378 | var cur, | ||
1379 | i = 0, | ||
1380 | aup = a.parentNode, | ||
1381 | bup = b.parentNode, | ||
1382 | ap = [ a ], | ||
1383 | bp = [ b ]; | ||
1384 | |||
1385 | // Parentless nodes are either documents or disconnected | ||
1386 | if ( !aup || !bup ) { | ||
1387 | return a === doc ? -1 : | ||
1388 | b === doc ? 1 : | ||
1389 | aup ? -1 : | ||
1390 | bup ? 1 : | ||
1391 | sortInput ? | ||
1392 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : | ||
1393 | 0; | ||
1394 | |||
1395 | // If the nodes are siblings, we can do a quick check | ||
1396 | } else if ( aup === bup ) { | ||
1397 | return siblingCheck( a, b ); | ||
1398 | } | ||
1399 | |||
1400 | // Otherwise we need full lists of their ancestors for comparison | ||
1401 | cur = a; | ||
1402 | while ( (cur = cur.parentNode) ) { | ||
1403 | ap.unshift( cur ); | ||
1404 | } | ||
1405 | cur = b; | ||
1406 | while ( (cur = cur.parentNode) ) { | ||
1407 | bp.unshift( cur ); | ||
1408 | } | ||
1409 | |||
1410 | // Walk down the tree looking for a discrepancy | ||
1411 | while ( ap[i] === bp[i] ) { | ||
1412 | i++; | ||
1413 | } | ||
1414 | |||
1415 | return i ? | ||
1416 | // Do a sibling check if the nodes have a common ancestor | ||
1417 | siblingCheck( ap[i], bp[i] ) : | ||
1418 | |||
1419 | // Otherwise nodes in our document sort first | ||
1420 | ap[i] === preferredDoc ? -1 : | ||
1421 | bp[i] === preferredDoc ? 1 : | ||
1422 | 0; | ||
1423 | }; | ||
1424 | |||
1425 | return doc; | ||
1426 | }; | ||
1427 | |||
1428 | Sizzle.matches = function( expr, elements ) { | ||
1429 | return Sizzle( expr, null, null, elements ); | ||
1430 | }; | ||
1431 | |||
1432 | Sizzle.matchesSelector = function( elem, expr ) { | ||
1433 | // Set document vars if needed | ||
1434 | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
1435 | setDocument( elem ); | ||
1436 | } | ||
1437 | |||
1438 | // Make sure that attribute selectors are quoted | ||
1439 | expr = expr.replace( rattributeQuotes, "='$1']" ); | ||
1440 | |||
1441 | if ( support.matchesSelector && documentIsHTML && | ||
1442 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && | ||
1443 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { | ||
1444 | |||
1445 | try { | ||
1446 | var ret = matches.call( elem, expr ); | ||
1447 | |||
1448 | // IE 9's matchesSelector returns false on disconnected nodes | ||
1449 | if ( ret || support.disconnectedMatch || | ||
1450 | // As well, disconnected nodes are said to be in a document | ||
1451 | // fragment in IE 9 | ||
1452 | elem.document && elem.document.nodeType !== 11 ) { | ||
1453 | return ret; | ||
1454 | } | ||
1455 | } catch (e) {} | ||
1456 | } | ||
1457 | |||
1458 | return Sizzle( expr, document, null, [ elem ] ).length > 0; | ||
1459 | }; | ||
1460 | |||
1461 | Sizzle.contains = function( context, elem ) { | ||
1462 | // Set document vars if needed | ||
1463 | if ( ( context.ownerDocument || context ) !== document ) { | ||
1464 | setDocument( context ); | ||
1465 | } | ||
1466 | return contains( context, elem ); | ||
1467 | }; | ||
1468 | |||
1469 | Sizzle.attr = function( elem, name ) { | ||
1470 | // Set document vars if needed | ||
1471 | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
1472 | setDocument( elem ); | ||
1473 | } | ||
1474 | |||
1475 | var fn = Expr.attrHandle[ name.toLowerCase() ], | ||
1476 | // Don't get fooled by Object.prototype properties (jQuery #13807) | ||
1477 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? | ||
1478 | fn( elem, name, !documentIsHTML ) : | ||
1479 | undefined; | ||
1480 | |||
1481 | return val !== undefined ? | ||
1482 | val : | ||
1483 | support.attributes || !documentIsHTML ? | ||
1484 | elem.getAttribute( name ) : | ||
1485 | (val = elem.getAttributeNode(name)) && val.specified ? | ||
1486 | val.value : | ||
1487 | null; | ||
1488 | }; | ||
1489 | |||
1490 | Sizzle.error = function( msg ) { | ||
1491 | throw new Error( "Syntax error, unrecognized expression: " + msg ); | ||
1492 | }; | ||
1493 | |||
1494 | /** | ||
1495 | * Document sorting and removing duplicates | ||
1496 | * @param {ArrayLike} results | ||
1497 | */ | ||
1498 | Sizzle.uniqueSort = function( results ) { | ||
1499 | var elem, | ||
1500 | duplicates = [], | ||
1501 | j = 0, | ||
1502 | i = 0; | ||
1503 | |||
1504 | // Unless we *know* we can detect duplicates, assume their presence | ||
1505 | hasDuplicate = !support.detectDuplicates; | ||
1506 | sortInput = !support.sortStable && results.slice( 0 ); | ||
1507 | results.sort( sortOrder ); | ||
1508 | |||
1509 | if ( hasDuplicate ) { | ||
1510 | while ( (elem = results[i++]) ) { | ||
1511 | if ( elem === results[ i ] ) { | ||
1512 | j = duplicates.push( i ); | ||
1513 | } | ||
1514 | } | ||
1515 | while ( j-- ) { | ||
1516 | results.splice( duplicates[ j ], 1 ); | ||
1517 | } | ||
1518 | } | ||
1519 | |||
1520 | // Clear input after sorting to release objects | ||
1521 | // See https://github.com/jquery/sizzle/pull/225 | ||
1522 | sortInput = null; | ||
1523 | |||
1524 | return results; | ||
1525 | }; | ||
1526 | |||
1527 | /** | ||
1528 | * Utility function for retrieving the text value of an array of DOM nodes | ||
1529 | * @param {Array|Element} elem | ||
1530 | */ | ||
1531 | getText = Sizzle.getText = function( elem ) { | ||
1532 | var node, | ||
1533 | ret = "", | ||
1534 | i = 0, | ||
1535 | nodeType = elem.nodeType; | ||
1536 | |||
1537 | if ( !nodeType ) { | ||
1538 | // If no nodeType, this is expected to be an array | ||
1539 | while ( (node = elem[i++]) ) { | ||
1540 | // Do not traverse comment nodes | ||
1541 | ret += getText( node ); | ||
1542 | } | ||
1543 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { | ||
1544 | // Use textContent for elements | ||
1545 | // innerText usage removed for consistency of new lines (jQuery #11153) | ||
1546 | if ( typeof elem.textContent === "string" ) { | ||
1547 | return elem.textContent; | ||
1548 | } else { | ||
1549 | // Traverse its children | ||
1550 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
1551 | ret += getText( elem ); | ||
1552 | } | ||
1553 | } | ||
1554 | } else if ( nodeType === 3 || nodeType === 4 ) { | ||
1555 | return elem.nodeValue; | ||
1556 | } | ||
1557 | // Do not include comment or processing instruction nodes | ||
1558 | |||
1559 | return ret; | ||
1560 | }; | ||
1561 | |||
1562 | Expr = Sizzle.selectors = { | ||
1563 | |||
1564 | // Can be adjusted by the user | ||
1565 | cacheLength: 50, | ||
1566 | |||
1567 | createPseudo: markFunction, | ||
1568 | |||
1569 | match: matchExpr, | ||
1570 | |||
1571 | attrHandle: {}, | ||
1572 | |||
1573 | find: {}, | ||
1574 | |||
1575 | relative: { | ||
1576 | ">": { dir: "parentNode", first: true }, | ||
1577 | " ": { dir: "parentNode" }, | ||
1578 | "+": { dir: "previousSibling", first: true }, | ||
1579 | "~": { dir: "previousSibling" } | ||
1580 | }, | ||
1581 | |||
1582 | preFilter: { | ||
1583 | "ATTR": function( match ) { | ||
1584 | match[1] = match[1].replace( runescape, funescape ); | ||
1585 | |||
1586 | // Move the given value to match[3] whether quoted or unquoted | ||
1587 | match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); | ||
1588 | |||
1589 | if ( match[2] === "~=" ) { | ||
1590 | match[3] = " " + match[3] + " "; | ||
1591 | } | ||
1592 | |||
1593 | return match.slice( 0, 4 ); | ||
1594 | }, | ||
1595 | |||
1596 | "CHILD": function( match ) { | ||
1597 | /* matches from matchExpr["CHILD"] | ||
1598 | 1 type (only|nth|...) | ||
1599 | 2 what (child|of-type) | ||
1600 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) | ||
1601 | 4 xn-component of xn+y argument ([+-]?\d*n|) | ||
1602 | 5 sign of xn-component | ||
1603 | 6 x of xn-component | ||
1604 | 7 sign of y-component | ||
1605 | 8 y of y-component | ||
1606 | */ | ||
1607 | match[1] = match[1].toLowerCase(); | ||
1608 | |||
1609 | if ( match[1].slice( 0, 3 ) === "nth" ) { | ||
1610 | // nth-* requires argument | ||
1611 | if ( !match[3] ) { | ||
1612 | Sizzle.error( match[0] ); | ||
1613 | } | ||
1614 | |||
1615 | // numeric x and y parameters for Expr.filter.CHILD | ||
1616 | // remember that false/true cast respectively to 0/1 | ||
1617 | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); | ||
1618 | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); | ||
1619 | |||
1620 | // other types prohibit arguments | ||
1621 | } else if ( match[3] ) { | ||
1622 | Sizzle.error( match[0] ); | ||
1623 | } | ||
1624 | |||
1625 | return match; | ||
1626 | }, | ||
1627 | |||
1628 | "PSEUDO": function( match ) { | ||
1629 | var excess, | ||
1630 | unquoted = !match[6] && match[2]; | ||
1631 | |||
1632 | if ( matchExpr["CHILD"].test( match[0] ) ) { | ||
1633 | return null; | ||
1634 | } | ||
1635 | |||
1636 | // Accept quoted arguments as-is | ||
1637 | if ( match[3] ) { | ||
1638 | match[2] = match[4] || match[5] || ""; | ||
1639 | |||
1640 | // Strip excess characters from unquoted arguments | ||
1641 | } else if ( unquoted && rpseudo.test( unquoted ) && | ||
1642 | // Get excess from tokenize (recursively) | ||
1643 | (excess = tokenize( unquoted, true )) && | ||
1644 | // advance to the next closing parenthesis | ||
1645 | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { | ||
1646 | |||
1647 | // excess is a negative index | ||
1648 | match[0] = match[0].slice( 0, excess ); | ||
1649 | match[2] = unquoted.slice( 0, excess ); | ||
1650 | } | ||
1651 | |||
1652 | // Return only captures needed by the pseudo filter method (type and argument) | ||
1653 | return match.slice( 0, 3 ); | ||
1654 | } | ||
1655 | }, | ||
1656 | |||
1657 | filter: { | ||
1658 | |||
1659 | "TAG": function( nodeNameSelector ) { | ||
1660 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); | ||
1661 | return nodeNameSelector === "*" ? | ||
1662 | function() { return true; } : | ||
1663 | function( elem ) { | ||
1664 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | ||
1665 | }; | ||
1666 | }, | ||
1667 | |||
1668 | "CLASS": function( className ) { | ||
1669 | var pattern = classCache[ className + " " ]; | ||
1670 | |||
1671 | return pattern || | ||
1672 | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && | ||
1673 | classCache( className, function( elem ) { | ||
1674 | return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); | ||
1675 | }); | ||
1676 | }, | ||
1677 | |||
1678 | "ATTR": function( name, operator, check ) { | ||
1679 | return function( elem ) { | ||
1680 | var result = Sizzle.attr( elem, name ); | ||
1681 | |||
1682 | if ( result == null ) { | ||
1683 | return operator === "!="; | ||
1684 | } | ||
1685 | if ( !operator ) { | ||
1686 | return true; | ||
1687 | } | ||
1688 | |||
1689 | result += ""; | ||
1690 | |||
1691 | return operator === "=" ? result === check : | ||
1692 | operator === "!=" ? result !== check : | ||
1693 | operator === "^=" ? check && result.indexOf( check ) === 0 : | ||
1694 | operator === "*=" ? check && result.indexOf( check ) > -1 : | ||
1695 | operator === "$=" ? check && result.slice( -check.length ) === check : | ||
1696 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : | ||
1697 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : | ||
1698 | false; | ||
1699 | }; | ||
1700 | }, | ||
1701 | |||
1702 | "CHILD": function( type, what, argument, first, last ) { | ||
1703 | var simple = type.slice( 0, 3 ) !== "nth", | ||
1704 | forward = type.slice( -4 ) !== "last", | ||
1705 | ofType = what === "of-type"; | ||
1706 | |||
1707 | return first === 1 && last === 0 ? | ||
1708 | |||
1709 | // Shortcut for :nth-*(n) | ||
1710 | function( elem ) { | ||
1711 | return !!elem.parentNode; | ||
1712 | } : | ||
1713 | |||
1714 | function( elem, context, xml ) { | ||
1715 | var cache, outerCache, node, diff, nodeIndex, start, | ||
1716 | dir = simple !== forward ? "nextSibling" : "previousSibling", | ||
1717 | parent = elem.parentNode, | ||
1718 | name = ofType && elem.nodeName.toLowerCase(), | ||
1719 | useCache = !xml && !ofType; | ||
1720 | |||
1721 | if ( parent ) { | ||
1722 | |||
1723 | // :(first|last|only)-(child|of-type) | ||
1724 | if ( simple ) { | ||
1725 | while ( dir ) { | ||
1726 | node = elem; | ||
1727 | while ( (node = node[ dir ]) ) { | ||
1728 | if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { | ||
1729 | return false; | ||
1730 | } | ||
1731 | } | ||
1732 | // Reverse direction for :only-* (if we haven't yet done so) | ||
1733 | start = dir = type === "only" && !start && "nextSibling"; | ||
1734 | } | ||
1735 | return true; | ||
1736 | } | ||
1737 | |||
1738 | start = [ forward ? parent.firstChild : parent.lastChild ]; | ||
1739 | |||
1740 | // non-xml :nth-child(...) stores cache data on `parent` | ||
1741 | if ( forward && useCache ) { | ||
1742 | // Seek `elem` from a previously-cached index | ||
1743 | outerCache = parent[ expando ] || (parent[ expando ] = {}); | ||
1744 | cache = outerCache[ type ] || []; | ||
1745 | nodeIndex = cache[0] === dirruns && cache[1]; | ||
1746 | diff = cache[0] === dirruns && cache[2]; | ||
1747 | node = nodeIndex && parent.childNodes[ nodeIndex ]; | ||
1748 | |||
1749 | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
1750 | |||
1751 | // Fallback to seeking `elem` from the start | ||
1752 | (diff = nodeIndex = 0) || start.pop()) ) { | ||
1753 | |||
1754 | // When found, cache indexes on `parent` and break | ||
1755 | if ( node.nodeType === 1 && ++diff && node === elem ) { | ||
1756 | outerCache[ type ] = [ dirruns, nodeIndex, diff ]; | ||
1757 | break; | ||
1758 | } | ||
1759 | } | ||
1760 | |||
1761 | // Use previously-cached element index if available | ||
1762 | } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { | ||
1763 | diff = cache[1]; | ||
1764 | |||
1765 | // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) | ||
1766 | } else { | ||
1767 | // Use the same loop as above to seek `elem` from the start | ||
1768 | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
1769 | (diff = nodeIndex = 0) || start.pop()) ) { | ||
1770 | |||
1771 | if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { | ||
1772 | // Cache the index of each encountered element | ||
1773 | if ( useCache ) { | ||
1774 | (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; | ||
1775 | } | ||
1776 | |||
1777 | if ( node === elem ) { | ||
1778 | break; | ||
1779 | } | ||
1780 | } | ||
1781 | } | ||
1782 | } | ||
1783 | |||
1784 | // Incorporate the offset, then check against cycle size | ||
1785 | diff -= last; | ||
1786 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); | ||
1787 | } | ||
1788 | }; | ||
1789 | }, | ||
1790 | |||
1791 | "PSEUDO": function( pseudo, argument ) { | ||
1792 | // pseudo-class names are case-insensitive | ||
1793 | // http://www.w3.org/TR/selectors/#pseudo-classes | ||
1794 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | ||
1795 | // Remember that setFilters inherits from pseudos | ||
1796 | var args, | ||
1797 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || | ||
1798 | Sizzle.error( "unsupported pseudo: " + pseudo ); | ||
1799 | |||
1800 | // The user may use createPseudo to indicate that | ||
1801 | // arguments are needed to create the filter function | ||
1802 | // just as Sizzle does | ||
1803 | if ( fn[ expando ] ) { | ||
1804 | return fn( argument ); | ||
1805 | } | ||
1806 | |||
1807 | // But maintain support for old signatures | ||
1808 | if ( fn.length > 1 ) { | ||
1809 | args = [ pseudo, pseudo, "", argument ]; | ||
1810 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? | ||
1811 | markFunction(function( seed, matches ) { | ||
1812 | var idx, | ||
1813 | matched = fn( seed, argument ), | ||
1814 | i = matched.length; | ||
1815 | while ( i-- ) { | ||
1816 | idx = indexOf( seed, matched[i] ); | ||
1817 | seed[ idx ] = !( matches[ idx ] = matched[i] ); | ||
1818 | } | ||
1819 | }) : | ||
1820 | function( elem ) { | ||
1821 | return fn( elem, 0, args ); | ||
1822 | }; | ||
1823 | } | ||
1824 | |||
1825 | return fn; | ||
1826 | } | ||
1827 | }, | ||
1828 | |||
1829 | pseudos: { | ||
1830 | // Potentially complex pseudos | ||
1831 | "not": markFunction(function( selector ) { | ||
1832 | // Trim the selector passed to compile | ||
1833 | // to avoid treating leading and trailing | ||
1834 | // spaces as combinators | ||
1835 | var input = [], | ||
1836 | results = [], | ||
1837 | matcher = compile( selector.replace( rtrim, "$1" ) ); | ||
1838 | |||
1839 | return matcher[ expando ] ? | ||
1840 | markFunction(function( seed, matches, context, xml ) { | ||
1841 | var elem, | ||
1842 | unmatched = matcher( seed, null, xml, [] ), | ||
1843 | i = seed.length; | ||
1844 | |||
1845 | // Match elements unmatched by `matcher` | ||
1846 | while ( i-- ) { | ||
1847 | if ( (elem = unmatched[i]) ) { | ||
1848 | seed[i] = !(matches[i] = elem); | ||
1849 | } | ||
1850 | } | ||
1851 | }) : | ||
1852 | function( elem, context, xml ) { | ||
1853 | input[0] = elem; | ||
1854 | matcher( input, null, xml, results ); | ||
1855 | // Don't keep the element (issue #299) | ||
1856 | input[0] = null; | ||
1857 | return !results.pop(); | ||
1858 | }; | ||
1859 | }), | ||
1860 | |||
1861 | "has": markFunction(function( selector ) { | ||
1862 | return function( elem ) { | ||
1863 | return Sizzle( selector, elem ).length > 0; | ||
1864 | }; | ||
1865 | }), | ||
1866 | |||
1867 | "contains": markFunction(function( text ) { | ||
1868 | text = text.replace( runescape, funescape ); | ||
1869 | return function( elem ) { | ||
1870 | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; | ||
1871 | }; | ||
1872 | }), | ||
1873 | |||
1874 | // "Whether an element is represented by a :lang() selector | ||
1875 | // is based solely on the element's language value | ||
1876 | // being equal to the identifier C, | ||
1877 | // or beginning with the identifier C immediately followed by "-". | ||
1878 | // The matching of C against the element's language value is performed case-insensitively. | ||
1879 | // The identifier C does not have to be a valid language name." | ||
1880 | // http://www.w3.org/TR/selectors/#lang-pseudo | ||
1881 | "lang": markFunction( function( lang ) { | ||
1882 | // lang value must be a valid identifier | ||
1883 | if ( !ridentifier.test(lang || "") ) { | ||
1884 | Sizzle.error( "unsupported lang: " + lang ); | ||
1885 | } | ||
1886 | lang = lang.replace( runescape, funescape ).toLowerCase(); | ||
1887 | return function( elem ) { | ||
1888 | var elemLang; | ||
1889 | do { | ||
1890 | if ( (elemLang = documentIsHTML ? | ||
1891 | elem.lang : | ||
1892 | elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { | ||
1893 | |||
1894 | elemLang = elemLang.toLowerCase(); | ||
1895 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; | ||
1896 | } | ||
1897 | } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); | ||
1898 | return false; | ||
1899 | }; | ||
1900 | }), | ||
1901 | |||
1902 | // Miscellaneous | ||
1903 | "target": function( elem ) { | ||
1904 | var hash = window.location && window.location.hash; | ||
1905 | return hash && hash.slice( 1 ) === elem.id; | ||
1906 | }, | ||
1907 | |||
1908 | "root": function( elem ) { | ||
1909 | return elem === docElem; | ||
1910 | }, | ||
1911 | |||
1912 | "focus": function( elem ) { | ||
1913 | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | ||
1914 | }, | ||
1915 | |||
1916 | // Boolean properties | ||
1917 | "enabled": function( elem ) { | ||
1918 | return elem.disabled === false; | ||
1919 | }, | ||
1920 | |||
1921 | "disabled": function( elem ) { | ||
1922 | return elem.disabled === true; | ||
1923 | }, | ||
1924 | |||
1925 | "checked": function( elem ) { | ||
1926 | // In CSS3, :checked should return both checked and selected elements | ||
1927 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
1928 | var nodeName = elem.nodeName.toLowerCase(); | ||
1929 | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | ||
1930 | }, | ||
1931 | |||
1932 | "selected": function( elem ) { | ||
1933 | // Accessing this property makes selected-by-default | ||
1934 | // options in Safari work properly | ||
1935 | if ( elem.parentNode ) { | ||
1936 | elem.parentNode.selectedIndex; | ||
1937 | } | ||
1938 | |||
1939 | return elem.selected === true; | ||
1940 | }, | ||
1941 | |||
1942 | // Contents | ||
1943 | "empty": function( elem ) { | ||
1944 | // http://www.w3.org/TR/selectors/#empty-pseudo | ||
1945 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), | ||
1946 | // but not by others (comment: 8; processing instruction: 7; etc.) | ||
1947 | // nodeType < 6 works because attributes (2) do not appear as children | ||
1948 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
1949 | if ( elem.nodeType < 6 ) { | ||
1950 | return false; | ||
1951 | } | ||
1952 | } | ||
1953 | return true; | ||
1954 | }, | ||
1955 | |||
1956 | "parent": function( elem ) { | ||
1957 | return !Expr.pseudos["empty"]( elem ); | ||
1958 | }, | ||
1959 | |||
1960 | // Element/input types | ||
1961 | "header": function( elem ) { | ||
1962 | return rheader.test( elem.nodeName ); | ||
1963 | }, | ||
1964 | |||
1965 | "input": function( elem ) { | ||
1966 | return rinputs.test( elem.nodeName ); | ||
1967 | }, | ||
1968 | |||
1969 | "button": function( elem ) { | ||
1970 | var name = elem.nodeName.toLowerCase(); | ||
1971 | return name === "input" && elem.type === "button" || name === "button"; | ||
1972 | }, | ||
1973 | |||
1974 | "text": function( elem ) { | ||
1975 | var attr; | ||
1976 | return elem.nodeName.toLowerCase() === "input" && | ||
1977 | elem.type === "text" && | ||
1978 | |||
1979 | // Support: IE<8 | ||
1980 | // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" | ||
1981 | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); | ||
1982 | }, | ||
1983 | |||
1984 | // Position-in-collection | ||
1985 | "first": createPositionalPseudo(function() { | ||
1986 | return [ 0 ]; | ||
1987 | }), | ||
1988 | |||
1989 | "last": createPositionalPseudo(function( matchIndexes, length ) { | ||
1990 | return [ length - 1 ]; | ||
1991 | }), | ||
1992 | |||
1993 | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
1994 | return [ argument < 0 ? argument + length : argument ]; | ||
1995 | }), | ||
1996 | |||
1997 | "even": createPositionalPseudo(function( matchIndexes, length ) { | ||
1998 | var i = 0; | ||
1999 | for ( ; i < length; i += 2 ) { | ||
2000 | matchIndexes.push( i ); | ||
2001 | } | ||
2002 | return matchIndexes; | ||
2003 | }), | ||
2004 | |||
2005 | "odd": createPositionalPseudo(function( matchIndexes, length ) { | ||
2006 | var i = 1; | ||
2007 | for ( ; i < length; i += 2 ) { | ||
2008 | matchIndexes.push( i ); | ||
2009 | } | ||
2010 | return matchIndexes; | ||
2011 | }), | ||
2012 | |||
2013 | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
2014 | var i = argument < 0 ? argument + length : argument; | ||
2015 | for ( ; --i >= 0; ) { | ||
2016 | matchIndexes.push( i ); | ||
2017 | } | ||
2018 | return matchIndexes; | ||
2019 | }), | ||
2020 | |||
2021 | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
2022 | var i = argument < 0 ? argument + length : argument; | ||
2023 | for ( ; ++i < length; ) { | ||
2024 | matchIndexes.push( i ); | ||
2025 | } | ||
2026 | return matchIndexes; | ||
2027 | }) | ||
2028 | } | ||
2029 | }; | ||
2030 | |||
2031 | Expr.pseudos["nth"] = Expr.pseudos["eq"]; | ||
2032 | |||
2033 | // Add button/input type pseudos | ||
2034 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { | ||
2035 | Expr.pseudos[ i ] = createInputPseudo( i ); | ||
2036 | } | ||
2037 | for ( i in { submit: true, reset: true } ) { | ||
2038 | Expr.pseudos[ i ] = createButtonPseudo( i ); | ||
2039 | } | ||
2040 | |||
2041 | // Easy API for creating new setFilters | ||
2042 | function setFilters() {} | ||
2043 | setFilters.prototype = Expr.filters = Expr.pseudos; | ||
2044 | Expr.setFilters = new setFilters(); | ||
2045 | |||
2046 | tokenize = Sizzle.tokenize = function( selector, parseOnly ) { | ||
2047 | var matched, match, tokens, type, | ||
2048 | soFar, groups, preFilters, | ||
2049 | cached = tokenCache[ selector + " " ]; | ||
2050 | |||
2051 | if ( cached ) { | ||
2052 | return parseOnly ? 0 : cached.slice( 0 ); | ||
2053 | } | ||
2054 | |||
2055 | soFar = selector; | ||
2056 | groups = []; | ||
2057 | preFilters = Expr.preFilter; | ||
2058 | |||
2059 | while ( soFar ) { | ||
2060 | |||
2061 | // Comma and first run | ||
2062 | if ( !matched || (match = rcomma.exec( soFar )) ) { | ||
2063 | if ( match ) { | ||
2064 | // Don't consume trailing commas as valid | ||
2065 | soFar = soFar.slice( match[0].length ) || soFar; | ||
2066 | } | ||
2067 | groups.push( (tokens = []) ); | ||
2068 | } | ||
2069 | |||
2070 | matched = false; | ||
2071 | |||
2072 | // Combinators | ||
2073 | if ( (match = rcombinators.exec( soFar )) ) { | ||
2074 | matched = match.shift(); | ||
2075 | tokens.push({ | ||
2076 | value: matched, | ||
2077 | // Cast descendant combinators to space | ||
2078 | type: match[0].replace( rtrim, " " ) | ||
2079 | }); | ||
2080 | soFar = soFar.slice( matched.length ); | ||
2081 | } | ||
2082 | |||
2083 | // Filters | ||
2084 | for ( type in Expr.filter ) { | ||
2085 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || | ||
2086 | (match = preFilters[ type ]( match ))) ) { | ||
2087 | matched = match.shift(); | ||
2088 | tokens.push({ | ||
2089 | value: matched, | ||
2090 | type: type, | ||
2091 | matches: match | ||
2092 | }); | ||
2093 | soFar = soFar.slice( matched.length ); | ||
2094 | } | ||
2095 | } | ||
2096 | |||
2097 | if ( !matched ) { | ||
2098 | break; | ||
2099 | } | ||
2100 | } | ||
2101 | |||
2102 | // Return the length of the invalid excess | ||
2103 | // if we're just parsing | ||
2104 | // Otherwise, throw an error or return tokens | ||
2105 | return parseOnly ? | ||
2106 | soFar.length : | ||
2107 | soFar ? | ||
2108 | Sizzle.error( selector ) : | ||
2109 | // Cache the tokens | ||
2110 | tokenCache( selector, groups ).slice( 0 ); | ||
2111 | }; | ||
2112 | |||
2113 | function toSelector( tokens ) { | ||
2114 | var i = 0, | ||
2115 | len = tokens.length, | ||
2116 | selector = ""; | ||
2117 | for ( ; i < len; i++ ) { | ||
2118 | selector += tokens[i].value; | ||
2119 | } | ||
2120 | return selector; | ||
2121 | } | ||
2122 | |||
2123 | function addCombinator( matcher, combinator, base ) { | ||
2124 | var dir = combinator.dir, | ||
2125 | checkNonElements = base && dir === "parentNode", | ||
2126 | doneName = done++; | ||
2127 | |||
2128 | return combinator.first ? | ||
2129 | // Check against closest ancestor/preceding element | ||
2130 | function( elem, context, xml ) { | ||
2131 | while ( (elem = elem[ dir ]) ) { | ||
2132 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2133 | return matcher( elem, context, xml ); | ||
2134 | } | ||
2135 | } | ||
2136 | } : | ||
2137 | |||
2138 | // Check against all ancestor/preceding elements | ||
2139 | function( elem, context, xml ) { | ||
2140 | var oldCache, outerCache, | ||
2141 | newCache = [ dirruns, doneName ]; | ||
2142 | |||
2143 | // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching | ||
2144 | if ( xml ) { | ||
2145 | while ( (elem = elem[ dir ]) ) { | ||
2146 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2147 | if ( matcher( elem, context, xml ) ) { | ||
2148 | return true; | ||
2149 | } | ||
2150 | } | ||
2151 | } | ||
2152 | } else { | ||
2153 | while ( (elem = elem[ dir ]) ) { | ||
2154 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2155 | outerCache = elem[ expando ] || (elem[ expando ] = {}); | ||
2156 | if ( (oldCache = outerCache[ dir ]) && | ||
2157 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { | ||
2158 | |||
2159 | // Assign to newCache so results back-propagate to previous elements | ||
2160 | return (newCache[ 2 ] = oldCache[ 2 ]); | ||
2161 | } else { | ||
2162 | // Reuse newcache so results back-propagate to previous elements | ||
2163 | outerCache[ dir ] = newCache; | ||
2164 | |||
2165 | // A match means we're done; a fail means we have to keep checking | ||
2166 | if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { | ||
2167 | return true; | ||
2168 | } | ||
2169 | } | ||
2170 | } | ||
2171 | } | ||
2172 | } | ||
2173 | }; | ||
2174 | } | ||
2175 | |||
2176 | function elementMatcher( matchers ) { | ||
2177 | return matchers.length > 1 ? | ||
2178 | function( elem, context, xml ) { | ||
2179 | var i = matchers.length; | ||
2180 | while ( i-- ) { | ||
2181 | if ( !matchers[i]( elem, context, xml ) ) { | ||
2182 | return false; | ||
2183 | } | ||
2184 | } | ||
2185 | return true; | ||
2186 | } : | ||
2187 | matchers[0]; | ||
2188 | } | ||
2189 | |||
2190 | function multipleContexts( selector, contexts, results ) { | ||
2191 | var i = 0, | ||
2192 | len = contexts.length; | ||
2193 | for ( ; i < len; i++ ) { | ||
2194 | Sizzle( selector, contexts[i], results ); | ||
2195 | } | ||
2196 | return results; | ||
2197 | } | ||
2198 | |||
2199 | function condense( unmatched, map, filter, context, xml ) { | ||
2200 | var elem, | ||
2201 | newUnmatched = [], | ||
2202 | i = 0, | ||
2203 | len = unmatched.length, | ||
2204 | mapped = map != null; | ||
2205 | |||
2206 | for ( ; i < len; i++ ) { | ||
2207 | if ( (elem = unmatched[i]) ) { | ||
2208 | if ( !filter || filter( elem, context, xml ) ) { | ||
2209 | newUnmatched.push( elem ); | ||
2210 | if ( mapped ) { | ||
2211 | map.push( i ); | ||
2212 | } | ||
2213 | } | ||
2214 | } | ||
2215 | } | ||
2216 | |||
2217 | return newUnmatched; | ||
2218 | } | ||
2219 | |||
2220 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { | ||
2221 | if ( postFilter && !postFilter[ expando ] ) { | ||
2222 | postFilter = setMatcher( postFilter ); | ||
2223 | } | ||
2224 | if ( postFinder && !postFinder[ expando ] ) { | ||
2225 | postFinder = setMatcher( postFinder, postSelector ); | ||
2226 | } | ||
2227 | return markFunction(function( seed, results, context, xml ) { | ||
2228 | var temp, i, elem, | ||
2229 | preMap = [], | ||
2230 | postMap = [], | ||
2231 | preexisting = results.length, | ||
2232 | |||
2233 | // Get initial elements from seed or context | ||
2234 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), | ||
2235 | |||
2236 | // Prefilter to get matcher input, preserving a map for seed-results synchronization | ||
2237 | matcherIn = preFilter && ( seed || !selector ) ? | ||
2238 | condense( elems, preMap, preFilter, context, xml ) : | ||
2239 | elems, | ||
2240 | |||
2241 | matcherOut = matcher ? | ||
2242 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, | ||
2243 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? | ||
2244 | |||
2245 | // ...intermediate processing is necessary | ||
2246 | [] : | ||
2247 | |||
2248 | // ...otherwise use results directly | ||
2249 | results : | ||
2250 | matcherIn; | ||
2251 | |||
2252 | // Find primary matches | ||
2253 | if ( matcher ) { | ||
2254 | matcher( matcherIn, matcherOut, context, xml ); | ||
2255 | } | ||
2256 | |||
2257 | // Apply postFilter | ||
2258 | if ( postFilter ) { | ||
2259 | temp = condense( matcherOut, postMap ); | ||
2260 | postFilter( temp, [], context, xml ); | ||
2261 | |||
2262 | // Un-match failing elements by moving them back to matcherIn | ||
2263 | i = temp.length; | ||
2264 | while ( i-- ) { | ||
2265 | if ( (elem = temp[i]) ) { | ||
2266 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); | ||
2267 | } | ||
2268 | } | ||
2269 | } | ||
2270 | |||
2271 | if ( seed ) { | ||
2272 | if ( postFinder || preFilter ) { | ||
2273 | if ( postFinder ) { | ||
2274 | // Get the final matcherOut by condensing this intermediate into postFinder contexts | ||
2275 | temp = []; | ||
2276 | i = matcherOut.length; | ||
2277 | while ( i-- ) { | ||
2278 | if ( (elem = matcherOut[i]) ) { | ||
2279 | // Restore matcherIn since elem is not yet a final match | ||
2280 | temp.push( (matcherIn[i] = elem) ); | ||
2281 | } | ||
2282 | } | ||
2283 | postFinder( null, (matcherOut = []), temp, xml ); | ||
2284 | } | ||
2285 | |||
2286 | // Move matched elements from seed to results to keep them synchronized | ||
2287 | i = matcherOut.length; | ||
2288 | while ( i-- ) { | ||
2289 | if ( (elem = matcherOut[i]) && | ||
2290 | (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { | ||
2291 | |||
2292 | seed[temp] = !(results[temp] = elem); | ||
2293 | } | ||
2294 | } | ||
2295 | } | ||
2296 | |||
2297 | // Add elements to results, through postFinder if defined | ||
2298 | } else { | ||
2299 | matcherOut = condense( | ||
2300 | matcherOut === results ? | ||
2301 | matcherOut.splice( preexisting, matcherOut.length ) : | ||
2302 | matcherOut | ||
2303 | ); | ||
2304 | if ( postFinder ) { | ||
2305 | postFinder( null, results, matcherOut, xml ); | ||
2306 | } else { | ||
2307 | push.apply( results, matcherOut ); | ||
2308 | } | ||
2309 | } | ||
2310 | }); | ||
2311 | } | ||
2312 | |||
2313 | function matcherFromTokens( tokens ) { | ||
2314 | var checkContext, matcher, j, | ||
2315 | len = tokens.length, | ||
2316 | leadingRelative = Expr.relative[ tokens[0].type ], | ||
2317 | implicitRelative = leadingRelative || Expr.relative[" "], | ||
2318 | i = leadingRelative ? 1 : 0, | ||
2319 | |||
2320 | // The foundational matcher ensures that elements are reachable from top-level context(s) | ||
2321 | matchContext = addCombinator( function( elem ) { | ||
2322 | return elem === checkContext; | ||
2323 | }, implicitRelative, true ), | ||
2324 | matchAnyContext = addCombinator( function( elem ) { | ||
2325 | return indexOf( checkContext, elem ) > -1; | ||
2326 | }, implicitRelative, true ), | ||
2327 | matchers = [ function( elem, context, xml ) { | ||
2328 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( | ||
2329 | (checkContext = context).nodeType ? | ||
2330 | matchContext( elem, context, xml ) : | ||
2331 | matchAnyContext( elem, context, xml ) ); | ||
2332 | // Avoid hanging onto element (issue #299) | ||
2333 | checkContext = null; | ||
2334 | return ret; | ||
2335 | } ]; | ||
2336 | |||
2337 | for ( ; i < len; i++ ) { | ||
2338 | if ( (matcher = Expr.relative[ tokens[i].type ]) ) { | ||
2339 | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; | ||
2340 | } else { | ||
2341 | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); | ||
2342 | |||
2343 | // Return special upon seeing a positional matcher | ||
2344 | if ( matcher[ expando ] ) { | ||
2345 | // Find the next relative operator (if any) for proper handling | ||
2346 | j = ++i; | ||
2347 | for ( ; j < len; j++ ) { | ||
2348 | if ( Expr.relative[ tokens[j].type ] ) { | ||
2349 | break; | ||
2350 | } | ||
2351 | } | ||
2352 | return setMatcher( | ||
2353 | i > 1 && elementMatcher( matchers ), | ||
2354 | i > 1 && toSelector( | ||
2355 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` | ||
2356 | tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) | ||
2357 | ).replace( rtrim, "$1" ), | ||
2358 | matcher, | ||
2359 | i < j && matcherFromTokens( tokens.slice( i, j ) ), | ||
2360 | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), | ||
2361 | j < len && toSelector( tokens ) | ||
2362 | ); | ||
2363 | } | ||
2364 | matchers.push( matcher ); | ||
2365 | } | ||
2366 | } | ||
2367 | |||
2368 | return elementMatcher( matchers ); | ||
2369 | } | ||
2370 | |||
2371 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | ||
2372 | var bySet = setMatchers.length > 0, | ||
2373 | byElement = elementMatchers.length > 0, | ||
2374 | superMatcher = function( seed, context, xml, results, outermost ) { | ||
2375 | var elem, j, matcher, | ||
2376 | matchedCount = 0, | ||
2377 | i = "0", | ||
2378 | unmatched = seed && [], | ||
2379 | setMatched = [], | ||
2380 | contextBackup = outermostContext, | ||
2381 | // We must always have either seed elements or outermost context | ||
2382 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), | ||
2383 | // Use integer dirruns iff this is the outermost matcher | ||
2384 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), | ||
2385 | len = elems.length; | ||
2386 | |||
2387 | if ( outermost ) { | ||
2388 | outermostContext = context !== document && context; | ||
2389 | } | ||
2390 | |||
2391 | // Add elements passing elementMatchers directly to results | ||
2392 | // Keep `i` a string if there are no elements so `matchedCount` will be "00" below | ||
2393 | // Support: IE<9, Safari | ||
2394 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | ||
2395 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) { | ||
2396 | if ( byElement && elem ) { | ||
2397 | j = 0; | ||
2398 | while ( (matcher = elementMatchers[j++]) ) { | ||
2399 | if ( matcher( elem, context, xml ) ) { | ||
2400 | results.push( elem ); | ||
2401 | break; | ||
2402 | } | ||
2403 | } | ||
2404 | if ( outermost ) { | ||
2405 | dirruns = dirrunsUnique; | ||
2406 | } | ||
2407 | } | ||
2408 | |||
2409 | // Track unmatched elements for set filters | ||
2410 | if ( bySet ) { | ||
2411 | // They will have gone through all possible matchers | ||
2412 | if ( (elem = !matcher && elem) ) { | ||
2413 | matchedCount--; | ||
2414 | } | ||
2415 | |||
2416 | // Lengthen the array for every element, matched or not | ||
2417 | if ( seed ) { | ||
2418 | unmatched.push( elem ); | ||
2419 | } | ||
2420 | } | ||
2421 | } | ||
2422 | |||
2423 | // Apply set filters to unmatched elements | ||
2424 | matchedCount += i; | ||
2425 | if ( bySet && i !== matchedCount ) { | ||
2426 | j = 0; | ||
2427 | while ( (matcher = setMatchers[j++]) ) { | ||
2428 | matcher( unmatched, setMatched, context, xml ); | ||
2429 | } | ||
2430 | |||
2431 | if ( seed ) { | ||
2432 | // Reintegrate element matches to eliminate the need for sorting | ||
2433 | if ( matchedCount > 0 ) { | ||
2434 | while ( i-- ) { | ||
2435 | if ( !(unmatched[i] || setMatched[i]) ) { | ||
2436 | setMatched[i] = pop.call( results ); | ||
2437 | } | ||
2438 | } | ||
2439 | } | ||
2440 | |||
2441 | // Discard index placeholder values to get only actual matches | ||
2442 | setMatched = condense( setMatched ); | ||
2443 | } | ||
2444 | |||
2445 | // Add matches to results | ||
2446 | push.apply( results, setMatched ); | ||
2447 | |||
2448 | // Seedless set matches succeeding multiple successful matchers stipulate sorting | ||
2449 | if ( outermost && !seed && setMatched.length > 0 && | ||
2450 | ( matchedCount + setMatchers.length ) > 1 ) { | ||
2451 | |||
2452 | Sizzle.uniqueSort( results ); | ||
2453 | } | ||
2454 | } | ||
2455 | |||
2456 | // Override manipulation of globals by nested matchers | ||
2457 | if ( outermost ) { | ||
2458 | dirruns = dirrunsUnique; | ||
2459 | outermostContext = contextBackup; | ||
2460 | } | ||
2461 | |||
2462 | return unmatched; | ||
2463 | }; | ||
2464 | |||
2465 | return bySet ? | ||
2466 | markFunction( superMatcher ) : | ||
2467 | superMatcher; | ||
2468 | } | ||
2469 | |||
2470 | compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { | ||
2471 | var i, | ||
2472 | setMatchers = [], | ||
2473 | elementMatchers = [], | ||
2474 | cached = compilerCache[ selector + " " ]; | ||
2475 | |||
2476 | if ( !cached ) { | ||
2477 | // Generate a function of recursive functions that can be used to check each element | ||
2478 | if ( !match ) { | ||
2479 | match = tokenize( selector ); | ||
2480 | } | ||
2481 | i = match.length; | ||
2482 | while ( i-- ) { | ||
2483 | cached = matcherFromTokens( match[i] ); | ||
2484 | if ( cached[ expando ] ) { | ||
2485 | setMatchers.push( cached ); | ||
2486 | } else { | ||
2487 | elementMatchers.push( cached ); | ||
2488 | } | ||
2489 | } | ||
2490 | |||
2491 | // Cache the compiled function | ||
2492 | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); | ||
2493 | |||
2494 | // Save selector and tokenization | ||
2495 | cached.selector = selector; | ||
2496 | } | ||
2497 | return cached; | ||
2498 | }; | ||
2499 | |||
2500 | /** | ||
2501 | * A low-level selection function that works with Sizzle's compiled | ||
2502 | * selector functions | ||
2503 | * @param {String|Function} selector A selector or a pre-compiled | ||
2504 | * selector function built with Sizzle.compile | ||
2505 | * @param {Element} context | ||
2506 | * @param {Array} [results] | ||
2507 | * @param {Array} [seed] A set of elements to match against | ||
2508 | */ | ||
2509 | select = Sizzle.select = function( selector, context, results, seed ) { | ||
2510 | var i, tokens, token, type, find, | ||
2511 | compiled = typeof selector === "function" && selector, | ||
2512 | match = !seed && tokenize( (selector = compiled.selector || selector) ); | ||
2513 | |||
2514 | results = results || []; | ||
2515 | |||
2516 | // Try to minimize operations if there is no seed and only one group | ||
2517 | if ( match.length === 1 ) { | ||
2518 | |||
2519 | // Take a shortcut and set the context if the root selector is an ID | ||
2520 | tokens = match[0] = match[0].slice( 0 ); | ||
2521 | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && | ||
2522 | support.getById && context.nodeType === 9 && documentIsHTML && | ||
2523 | Expr.relative[ tokens[1].type ] ) { | ||
2524 | |||
2525 | context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; | ||
2526 | if ( !context ) { | ||
2527 | return results; | ||
2528 | |||
2529 | // Precompiled matchers will still verify ancestry, so step up a level | ||
2530 | } else if ( compiled ) { | ||
2531 | context = context.parentNode; | ||
2532 | } | ||
2533 | |||
2534 | selector = selector.slice( tokens.shift().value.length ); | ||
2535 | } | ||
2536 | |||
2537 | // Fetch a seed set for right-to-left matching | ||
2538 | i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; | ||
2539 | while ( i-- ) { | ||
2540 | token = tokens[i]; | ||
2541 | |||
2542 | // Abort if we hit a combinator | ||
2543 | if ( Expr.relative[ (type = token.type) ] ) { | ||
2544 | break; | ||
2545 | } | ||
2546 | if ( (find = Expr.find[ type ]) ) { | ||
2547 | // Search, expanding context for leading sibling combinators | ||
2548 | if ( (seed = find( | ||
2549 | token.matches[0].replace( runescape, funescape ), | ||
2550 | rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context | ||
2551 | )) ) { | ||
2552 | |||
2553 | // If seed is empty or no tokens remain, we can return early | ||
2554 | tokens.splice( i, 1 ); | ||
2555 | selector = seed.length && toSelector( tokens ); | ||
2556 | if ( !selector ) { | ||
2557 | push.apply( results, seed ); | ||
2558 | return results; | ||
2559 | } | ||
2560 | |||
2561 | break; | ||
2562 | } | ||
2563 | } | ||
2564 | } | ||
2565 | } | ||
2566 | |||
2567 | // Compile and execute a filtering function if one is not provided | ||
2568 | // Provide `match` to avoid retokenization if we modified the selector above | ||
2569 | ( compiled || compile( selector, match ) )( | ||
2570 | seed, | ||
2571 | context, | ||
2572 | !documentIsHTML, | ||
2573 | results, | ||
2574 | rsibling.test( selector ) && testContext( context.parentNode ) || context | ||
2575 | ); | ||
2576 | return results; | ||
2577 | }; | ||
2578 | |||
2579 | // One-time assignments | ||
2580 | |||
2581 | // Sort stability | ||
2582 | support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; | ||
2583 | |||
2584 | // Support: Chrome 14-35+ | ||
2585 | // Always assume duplicates if they aren't passed to the comparison function | ||
2586 | support.detectDuplicates = !!hasDuplicate; | ||
2587 | |||
2588 | // Initialize against the default document | ||
2589 | setDocument(); | ||
2590 | |||
2591 | // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | ||
2592 | // Detached nodes confoundingly follow *each other* | ||
2593 | support.sortDetached = assert(function( div1 ) { | ||
2594 | // Should return 1, but returns 4 (following) | ||
2595 | return div1.compareDocumentPosition( document.createElement("div") ) & 1; | ||
2596 | }); | ||
2597 | |||
2598 | // Support: IE<8 | ||
2599 | // Prevent attribute/property "interpolation" | ||
2600 | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | ||
2601 | if ( !assert(function( div ) { | ||
2602 | div.innerHTML = "<a href='#'></a>"; | ||
2603 | return div.firstChild.getAttribute("href") === "#" ; | ||
2604 | }) ) { | ||
2605 | addHandle( "type|href|height|width", function( elem, name, isXML ) { | ||
2606 | if ( !isXML ) { | ||
2607 | return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); | ||
2608 | } | ||
2609 | }); | ||
2610 | } | ||
2611 | |||
2612 | // Support: IE<9 | ||
2613 | // Use defaultValue in place of getAttribute("value") | ||
2614 | if ( !support.attributes || !assert(function( div ) { | ||
2615 | div.innerHTML = "<input/>"; | ||
2616 | div.firstChild.setAttribute( "value", "" ); | ||
2617 | return div.firstChild.getAttribute( "value" ) === ""; | ||
2618 | }) ) { | ||
2619 | addHandle( "value", function( elem, name, isXML ) { | ||
2620 | if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { | ||
2621 | return elem.defaultValue; | ||
2622 | } | ||
2623 | }); | ||
2624 | } | ||
2625 | |||
2626 | // Support: IE<9 | ||
2627 | // Use getAttributeNode to fetch booleans when getAttribute lies | ||
2628 | if ( !assert(function( div ) { | ||
2629 | return div.getAttribute("disabled") == null; | ||
2630 | }) ) { | ||
2631 | addHandle( booleans, function( elem, name, isXML ) { | ||
2632 | var val; | ||
2633 | if ( !isXML ) { | ||
2634 | return elem[ name ] === true ? name.toLowerCase() : | ||
2635 | (val = elem.getAttributeNode( name )) && val.specified ? | ||
2636 | val.value : | ||
2637 | null; | ||
2638 | } | ||
2639 | }); | ||
2640 | } | ||
2641 | |||
2642 | return Sizzle; | ||
2643 | |||
2644 | })( window ); | ||
2645 | |||
2646 | |||
2647 | |||
2648 | jQuery.find = Sizzle; | ||
2649 | jQuery.expr = Sizzle.selectors; | ||
2650 | jQuery.expr[":"] = jQuery.expr.pseudos; | ||
2651 | jQuery.unique = Sizzle.uniqueSort; | ||
2652 | jQuery.text = Sizzle.getText; | ||
2653 | jQuery.isXMLDoc = Sizzle.isXML; | ||
2654 | jQuery.contains = Sizzle.contains; | ||
2655 | |||
2656 | |||
2657 | |||
2658 | var rneedsContext = jQuery.expr.match.needsContext; | ||
2659 | |||
2660 | var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); | ||
2661 | |||
2662 | |||
2663 | |||
2664 | var risSimple = /^.[^:#\[\.,]*$/; | ||
2665 | |||
2666 | // Implement the identical functionality for filter and not | ||
2667 | function winnow( elements, qualifier, not ) { | ||
2668 | if ( jQuery.isFunction( qualifier ) ) { | ||
2669 | return jQuery.grep( elements, function( elem, i ) { | ||
2670 | /* jshint -W018 */ | ||
2671 | return !!qualifier.call( elem, i, elem ) !== not; | ||
2672 | }); | ||
2673 | |||
2674 | } | ||
2675 | |||
2676 | if ( qualifier.nodeType ) { | ||
2677 | return jQuery.grep( elements, function( elem ) { | ||
2678 | return ( elem === qualifier ) !== not; | ||
2679 | }); | ||
2680 | |||
2681 | } | ||
2682 | |||
2683 | if ( typeof qualifier === "string" ) { | ||
2684 | if ( risSimple.test( qualifier ) ) { | ||
2685 | return jQuery.filter( qualifier, elements, not ); | ||
2686 | } | ||
2687 | |||
2688 | qualifier = jQuery.filter( qualifier, elements ); | ||
2689 | } | ||
2690 | |||
2691 | return jQuery.grep( elements, function( elem ) { | ||
2692 | return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; | ||
2693 | }); | ||
2694 | } | ||
2695 | |||
2696 | jQuery.filter = function( expr, elems, not ) { | ||
2697 | var elem = elems[ 0 ]; | ||
2698 | |||
2699 | if ( not ) { | ||
2700 | expr = ":not(" + expr + ")"; | ||
2701 | } | ||
2702 | |||
2703 | return elems.length === 1 && elem.nodeType === 1 ? | ||
2704 | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : | ||
2705 | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { | ||
2706 | return elem.nodeType === 1; | ||
2707 | })); | ||
2708 | }; | ||
2709 | |||
2710 | jQuery.fn.extend({ | ||
2711 | find: function( selector ) { | ||
2712 | var i, | ||
2713 | ret = [], | ||
2714 | self = this, | ||
2715 | len = self.length; | ||
2716 | |||
2717 | if ( typeof selector !== "string" ) { | ||
2718 | return this.pushStack( jQuery( selector ).filter(function() { | ||
2719 | for ( i = 0; i < len; i++ ) { | ||
2720 | if ( jQuery.contains( self[ i ], this ) ) { | ||
2721 | return true; | ||
2722 | } | ||
2723 | } | ||
2724 | }) ); | ||
2725 | } | ||
2726 | |||
2727 | for ( i = 0; i < len; i++ ) { | ||
2728 | jQuery.find( selector, self[ i ], ret ); | ||
2729 | } | ||
2730 | |||
2731 | // Needed because $( selector, context ) becomes $( context ).find( selector ) | ||
2732 | ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); | ||
2733 | ret.selector = this.selector ? this.selector + " " + selector : selector; | ||
2734 | return ret; | ||
2735 | }, | ||
2736 | filter: function( selector ) { | ||
2737 | return this.pushStack( winnow(this, selector || [], false) ); | ||
2738 | }, | ||
2739 | not: function( selector ) { | ||
2740 | return this.pushStack( winnow(this, selector || [], true) ); | ||
2741 | }, | ||
2742 | is: function( selector ) { | ||
2743 | return !!winnow( | ||
2744 | this, | ||
2745 | |||
2746 | // If this is a positional/relative selector, check membership in the returned set | ||
2747 | // so $("p:first").is("p:last") won't return true for a doc with two "p". | ||
2748 | typeof selector === "string" && rneedsContext.test( selector ) ? | ||
2749 | jQuery( selector ) : | ||
2750 | selector || [], | ||
2751 | false | ||
2752 | ).length; | ||
2753 | } | ||
2754 | }); | ||
2755 | |||
2756 | |||
2757 | // Initialize a jQuery object | ||
2758 | |||
2759 | |||
2760 | // A central reference to the root jQuery(document) | ||
2761 | var rootjQuery, | ||
2762 | |||
2763 | // Use the correct document accordingly with window argument (sandbox) | ||
2764 | document = window.document, | ||
2765 | |||
2766 | // A simple way to check for HTML strings | ||
2767 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | ||
2768 | // Strict HTML recognition (#11290: must start with <) | ||
2769 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | ||
2770 | |||
2771 | init = jQuery.fn.init = function( selector, context ) { | ||
2772 | var match, elem; | ||
2773 | |||
2774 | // HANDLE: $(""), $(null), $(undefined), $(false) | ||
2775 | if ( !selector ) { | ||
2776 | return this; | ||
2777 | } | ||
2778 | |||
2779 | // Handle HTML strings | ||
2780 | if ( typeof selector === "string" ) { | ||
2781 | if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { | ||
2782 | // Assume that strings that start and end with <> are HTML and skip the regex check | ||
2783 | match = [ null, selector, null ]; | ||
2784 | |||
2785 | } else { | ||
2786 | match = rquickExpr.exec( selector ); | ||
2787 | } | ||
2788 | |||
2789 | // Match html or make sure no context is specified for #id | ||
2790 | if ( match && (match[1] || !context) ) { | ||
2791 | |||
2792 | // HANDLE: $(html) -> $(array) | ||
2793 | if ( match[1] ) { | ||
2794 | context = context instanceof jQuery ? context[0] : context; | ||
2795 | |||
2796 | // scripts is true for back-compat | ||
2797 | // Intentionally let the error be thrown if parseHTML is not present | ||
2798 | jQuery.merge( this, jQuery.parseHTML( | ||
2799 | match[1], | ||
2800 | context && context.nodeType ? context.ownerDocument || context : document, | ||
2801 | true | ||
2802 | ) ); | ||
2803 | |||
2804 | // HANDLE: $(html, props) | ||
2805 | if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { | ||
2806 | for ( match in context ) { | ||
2807 | // Properties of context are called as methods if possible | ||
2808 | if ( jQuery.isFunction( this[ match ] ) ) { | ||
2809 | this[ match ]( context[ match ] ); | ||
2810 | |||
2811 | // ...and otherwise set as attributes | ||
2812 | } else { | ||
2813 | this.attr( match, context[ match ] ); | ||
2814 | } | ||
2815 | } | ||
2816 | } | ||
2817 | |||
2818 | return this; | ||
2819 | |||
2820 | // HANDLE: $(#id) | ||
2821 | } else { | ||
2822 | elem = document.getElementById( match[2] ); | ||
2823 | |||
2824 | // Check parentNode to catch when Blackberry 4.6 returns | ||
2825 | // nodes that are no longer in the document #6963 | ||
2826 | if ( elem && elem.parentNode ) { | ||
2827 | // Handle the case where IE and Opera return items | ||
2828 | // by name instead of ID | ||
2829 | if ( elem.id !== match[2] ) { | ||
2830 | return rootjQuery.find( selector ); | ||
2831 | } | ||
2832 | |||
2833 | // Otherwise, we inject the element directly into the jQuery object | ||
2834 | this.length = 1; | ||
2835 | this[0] = elem; | ||
2836 | } | ||
2837 | |||
2838 | this.context = document; | ||
2839 | this.selector = selector; | ||
2840 | return this; | ||
2841 | } | ||
2842 | |||
2843 | // HANDLE: $(expr, $(...)) | ||
2844 | } else if ( !context || context.jquery ) { | ||
2845 | return ( context || rootjQuery ).find( selector ); | ||
2846 | |||
2847 | // HANDLE: $(expr, context) | ||
2848 | // (which is just equivalent to: $(context).find(expr) | ||
2849 | } else { | ||
2850 | return this.constructor( context ).find( selector ); | ||
2851 | } | ||
2852 | |||
2853 | // HANDLE: $(DOMElement) | ||
2854 | } else if ( selector.nodeType ) { | ||
2855 | this.context = this[0] = selector; | ||
2856 | this.length = 1; | ||
2857 | return this; | ||
2858 | |||
2859 | // HANDLE: $(function) | ||
2860 | // Shortcut for document ready | ||
2861 | } else if ( jQuery.isFunction( selector ) ) { | ||
2862 | return typeof rootjQuery.ready !== "undefined" ? | ||
2863 | rootjQuery.ready( selector ) : | ||
2864 | // Execute immediately if ready is not present | ||
2865 | selector( jQuery ); | ||
2866 | } | ||
2867 | |||
2868 | if ( selector.selector !== undefined ) { | ||
2869 | this.selector = selector.selector; | ||
2870 | this.context = selector.context; | ||
2871 | } | ||
2872 | |||
2873 | return jQuery.makeArray( selector, this ); | ||
2874 | }; | ||
2875 | |||
2876 | // Give the init function the jQuery prototype for later instantiation | ||
2877 | init.prototype = jQuery.fn; | ||
2878 | |||
2879 | // Initialize central reference | ||
2880 | rootjQuery = jQuery( document ); | ||
2881 | |||
2882 | |||
2883 | var rparentsprev = /^(?:parents|prev(?:Until|All))/, | ||
2884 | // methods guaranteed to produce a unique set when starting from a unique set | ||
2885 | guaranteedUnique = { | ||
2886 | children: true, | ||
2887 | contents: true, | ||
2888 | next: true, | ||
2889 | prev: true | ||
2890 | }; | ||
2891 | |||
2892 | jQuery.extend({ | ||
2893 | dir: function( elem, dir, until ) { | ||
2894 | var matched = [], | ||
2895 | cur = elem[ dir ]; | ||
2896 | |||
2897 | while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { | ||
2898 | if ( cur.nodeType === 1 ) { | ||
2899 | matched.push( cur ); | ||
2900 | } | ||
2901 | cur = cur[dir]; | ||
2902 | } | ||
2903 | return matched; | ||
2904 | }, | ||
2905 | |||
2906 | sibling: function( n, elem ) { | ||
2907 | var r = []; | ||
2908 | |||
2909 | for ( ; n; n = n.nextSibling ) { | ||
2910 | if ( n.nodeType === 1 && n !== elem ) { | ||
2911 | r.push( n ); | ||
2912 | } | ||
2913 | } | ||
2914 | |||
2915 | return r; | ||
2916 | } | ||
2917 | }); | ||
2918 | |||
2919 | jQuery.fn.extend({ | ||
2920 | has: function( target ) { | ||
2921 | var i, | ||
2922 | targets = jQuery( target, this ), | ||
2923 | len = targets.length; | ||
2924 | |||
2925 | return this.filter(function() { | ||
2926 | for ( i = 0; i < len; i++ ) { | ||
2927 | if ( jQuery.contains( this, targets[i] ) ) { | ||
2928 | return true; | ||
2929 | } | ||
2930 | } | ||
2931 | }); | ||
2932 | }, | ||
2933 | |||
2934 | closest: function( selectors, context ) { | ||
2935 | var cur, | ||
2936 | i = 0, | ||
2937 | l = this.length, | ||
2938 | matched = [], | ||
2939 | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? | ||
2940 | jQuery( selectors, context || this.context ) : | ||
2941 | 0; | ||
2942 | |||
2943 | for ( ; i < l; i++ ) { | ||
2944 | for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { | ||
2945 | // Always skip document fragments | ||
2946 | if ( cur.nodeType < 11 && (pos ? | ||
2947 | pos.index(cur) > -1 : | ||
2948 | |||
2949 | // Don't pass non-elements to Sizzle | ||
2950 | cur.nodeType === 1 && | ||
2951 | jQuery.find.matchesSelector(cur, selectors)) ) { | ||
2952 | |||
2953 | matched.push( cur ); | ||
2954 | break; | ||
2955 | } | ||
2956 | } | ||
2957 | } | ||
2958 | |||
2959 | return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); | ||
2960 | }, | ||
2961 | |||
2962 | // Determine the position of an element within | ||
2963 | // the matched set of elements | ||
2964 | index: function( elem ) { | ||
2965 | |||
2966 | // No argument, return index in parent | ||
2967 | if ( !elem ) { | ||
2968 | return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; | ||
2969 | } | ||
2970 | |||
2971 | // index in selector | ||
2972 | if ( typeof elem === "string" ) { | ||
2973 | return jQuery.inArray( this[0], jQuery( elem ) ); | ||
2974 | } | ||
2975 | |||
2976 | // Locate the position of the desired element | ||
2977 | return jQuery.inArray( | ||
2978 | // If it receives a jQuery object, the first element is used | ||
2979 | elem.jquery ? elem[0] : elem, this ); | ||
2980 | }, | ||
2981 | |||
2982 | add: function( selector, context ) { | ||
2983 | return this.pushStack( | ||
2984 | jQuery.unique( | ||
2985 | jQuery.merge( this.get(), jQuery( selector, context ) ) | ||
2986 | ) | ||
2987 | ); | ||
2988 | }, | ||
2989 | |||
2990 | addBack: function( selector ) { | ||
2991 | return this.add( selector == null ? | ||
2992 | this.prevObject : this.prevObject.filter(selector) | ||
2993 | ); | ||
2994 | } | ||
2995 | }); | ||
2996 | |||
2997 | function sibling( cur, dir ) { | ||
2998 | do { | ||
2999 | cur = cur[ dir ]; | ||
3000 | } while ( cur && cur.nodeType !== 1 ); | ||
3001 | |||
3002 | return cur; | ||
3003 | } | ||
3004 | |||
3005 | jQuery.each({ | ||
3006 | parent: function( elem ) { | ||
3007 | var parent = elem.parentNode; | ||
3008 | return parent && parent.nodeType !== 11 ? parent : null; | ||
3009 | }, | ||
3010 | parents: function( elem ) { | ||
3011 | return jQuery.dir( elem, "parentNode" ); | ||
3012 | }, | ||
3013 | parentsUntil: function( elem, i, until ) { | ||
3014 | return jQuery.dir( elem, "parentNode", until ); | ||
3015 | }, | ||
3016 | next: function( elem ) { | ||
3017 | return sibling( elem, "nextSibling" ); | ||
3018 | }, | ||
3019 | prev: function( elem ) { | ||
3020 | return sibling( elem, "previousSibling" ); | ||
3021 | }, | ||
3022 | nextAll: function( elem ) { | ||
3023 | return jQuery.dir( elem, "nextSibling" ); | ||
3024 | }, | ||
3025 | prevAll: function( elem ) { | ||
3026 | return jQuery.dir( elem, "previousSibling" ); | ||
3027 | }, | ||
3028 | nextUntil: function( elem, i, until ) { | ||
3029 | return jQuery.dir( elem, "nextSibling", until ); | ||
3030 | }, | ||
3031 | prevUntil: function( elem, i, until ) { | ||
3032 | return jQuery.dir( elem, "previousSibling", until ); | ||
3033 | }, | ||
3034 | siblings: function( elem ) { | ||
3035 | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); | ||
3036 | }, | ||
3037 | children: function( elem ) { | ||
3038 | return jQuery.sibling( elem.firstChild ); | ||
3039 | }, | ||
3040 | contents: function( elem ) { | ||
3041 | return jQuery.nodeName( elem, "iframe" ) ? | ||
3042 | elem.contentDocument || elem.contentWindow.document : | ||
3043 | jQuery.merge( [], elem.childNodes ); | ||
3044 | } | ||
3045 | }, function( name, fn ) { | ||
3046 | jQuery.fn[ name ] = function( until, selector ) { | ||
3047 | var ret = jQuery.map( this, fn, until ); | ||
3048 | |||
3049 | if ( name.slice( -5 ) !== "Until" ) { | ||
3050 | selector = until; | ||
3051 | } | ||
3052 | |||
3053 | if ( selector && typeof selector === "string" ) { | ||
3054 | ret = jQuery.filter( selector, ret ); | ||
3055 | } | ||
3056 | |||
3057 | if ( this.length > 1 ) { | ||
3058 | // Remove duplicates | ||
3059 | if ( !guaranteedUnique[ name ] ) { | ||
3060 | ret = jQuery.unique( ret ); | ||
3061 | } | ||
3062 | |||
3063 | // Reverse order for parents* and prev-derivatives | ||
3064 | if ( rparentsprev.test( name ) ) { | ||
3065 | ret = ret.reverse(); | ||
3066 | } | ||
3067 | } | ||
3068 | |||
3069 | return this.pushStack( ret ); | ||
3070 | }; | ||
3071 | }); | ||
3072 | var rnotwhite = (/\S+/g); | ||
3073 | |||
3074 | |||
3075 | |||
3076 | // String to Object options format cache | ||
3077 | var optionsCache = {}; | ||
3078 | |||
3079 | // Convert String-formatted options into Object-formatted ones and store in cache | ||
3080 | function createOptions( options ) { | ||
3081 | var object = optionsCache[ options ] = {}; | ||
3082 | jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { | ||
3083 | object[ flag ] = true; | ||
3084 | }); | ||
3085 | return object; | ||
3086 | } | ||
3087 | |||
3088 | /* | ||
3089 | * Create a callback list using the following parameters: | ||
3090 | * | ||
3091 | * options: an optional list of space-separated options that will change how | ||
3092 | * the callback list behaves or a more traditional option object | ||
3093 | * | ||
3094 | * By default a callback list will act like an event callback list and can be | ||
3095 | * "fired" multiple times. | ||
3096 | * | ||
3097 | * Possible options: | ||
3098 | * | ||
3099 | * once: will ensure the callback list can only be fired once (like a Deferred) | ||
3100 | * | ||
3101 | * memory: will keep track of previous values and will call any callback added | ||
3102 | * after the list has been fired right away with the latest "memorized" | ||
3103 | * values (like a Deferred) | ||
3104 | * | ||
3105 | * unique: will ensure a callback can only be added once (no duplicate in the list) | ||
3106 | * | ||
3107 | * stopOnFalse: interrupt callings when a callback returns false | ||
3108 | * | ||
3109 | */ | ||
3110 | jQuery.Callbacks = function( options ) { | ||
3111 | |||
3112 | // Convert options from String-formatted to Object-formatted if needed | ||
3113 | // (we check in cache first) | ||
3114 | options = typeof options === "string" ? | ||
3115 | ( optionsCache[ options ] || createOptions( options ) ) : | ||
3116 | jQuery.extend( {}, options ); | ||
3117 | |||
3118 | var // Flag to know if list is currently firing | ||
3119 | firing, | ||
3120 | // Last fire value (for non-forgettable lists) | ||
3121 | memory, | ||
3122 | // Flag to know if list was already fired | ||
3123 | fired, | ||
3124 | // End of the loop when firing | ||
3125 | firingLength, | ||
3126 | // Index of currently firing callback (modified by remove if needed) | ||
3127 | firingIndex, | ||
3128 | // First callback to fire (used internally by add and fireWith) | ||
3129 | firingStart, | ||
3130 | // Actual callback list | ||
3131 | list = [], | ||
3132 | // Stack of fire calls for repeatable lists | ||
3133 | stack = !options.once && [], | ||
3134 | // Fire callbacks | ||
3135 | fire = function( data ) { | ||
3136 | memory = options.memory && data; | ||
3137 | fired = true; | ||
3138 | firingIndex = firingStart || 0; | ||
3139 | firingStart = 0; | ||
3140 | firingLength = list.length; | ||
3141 | firing = true; | ||
3142 | for ( ; list && firingIndex < firingLength; firingIndex++ ) { | ||
3143 | if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { | ||
3144 | memory = false; // To prevent further calls using add | ||
3145 | break; | ||
3146 | } | ||
3147 | } | ||
3148 | firing = false; | ||
3149 | if ( list ) { | ||
3150 | if ( stack ) { | ||
3151 | if ( stack.length ) { | ||
3152 | fire( stack.shift() ); | ||
3153 | } | ||
3154 | } else if ( memory ) { | ||
3155 | list = []; | ||
3156 | } else { | ||
3157 | self.disable(); | ||
3158 | } | ||
3159 | } | ||
3160 | }, | ||
3161 | // Actual Callbacks object | ||
3162 | self = { | ||
3163 | // Add a callback or a collection of callbacks to the list | ||
3164 | add: function() { | ||
3165 | if ( list ) { | ||
3166 | // First, we save the current length | ||
3167 | var start = list.length; | ||
3168 | (function add( args ) { | ||
3169 | jQuery.each( args, function( _, arg ) { | ||
3170 | var type = jQuery.type( arg ); | ||
3171 | if ( type === "function" ) { | ||
3172 | if ( !options.unique || !self.has( arg ) ) { | ||
3173 | list.push( arg ); | ||
3174 | } | ||
3175 | } else if ( arg && arg.length && type !== "string" ) { | ||
3176 | // Inspect recursively | ||
3177 | add( arg ); | ||
3178 | } | ||
3179 | }); | ||
3180 | })( arguments ); | ||
3181 | // Do we need to add the callbacks to the | ||
3182 | // current firing batch? | ||
3183 | if ( firing ) { | ||
3184 | firingLength = list.length; | ||
3185 | // With memory, if we're not firing then | ||
3186 | // we should call right away | ||
3187 | } else if ( memory ) { | ||
3188 | firingStart = start; | ||
3189 | fire( memory ); | ||
3190 | } | ||
3191 | } | ||
3192 | return this; | ||
3193 | }, | ||
3194 | // Remove a callback from the list | ||
3195 | remove: function() { | ||
3196 | if ( list ) { | ||
3197 | jQuery.each( arguments, function( _, arg ) { | ||
3198 | var index; | ||
3199 | while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { | ||
3200 | list.splice( index, 1 ); | ||
3201 | // Handle firing indexes | ||
3202 | if ( firing ) { | ||
3203 | if ( index <= firingLength ) { | ||
3204 | firingLength--; | ||
3205 | } | ||
3206 | if ( index <= firingIndex ) { | ||
3207 | firingIndex--; | ||
3208 | } | ||
3209 | } | ||
3210 | } | ||
3211 | }); | ||
3212 | } | ||
3213 | return this; | ||
3214 | }, | ||
3215 | // Check if a given callback is in the list. | ||
3216 | // If no argument is given, return whether or not list has callbacks attached. | ||
3217 | has: function( fn ) { | ||
3218 | return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); | ||
3219 | }, | ||
3220 | // Remove all callbacks from the list | ||
3221 | empty: function() { | ||
3222 | list = []; | ||
3223 | firingLength = 0; | ||
3224 | return this; | ||
3225 | }, | ||
3226 | // Have the list do nothing anymore | ||
3227 | disable: function() { | ||
3228 | list = stack = memory = undefined; | ||
3229 | return this; | ||
3230 | }, | ||
3231 | // Is it disabled? | ||
3232 | disabled: function() { | ||
3233 | return !list; | ||
3234 | }, | ||
3235 | // Lock the list in its current state | ||
3236 | lock: function() { | ||
3237 | stack = undefined; | ||
3238 | if ( !memory ) { | ||
3239 | self.disable(); | ||
3240 | } | ||
3241 | return this; | ||
3242 | }, | ||
3243 | // Is it locked? | ||
3244 | locked: function() { | ||
3245 | return !stack; | ||
3246 | }, | ||
3247 | // Call all callbacks with the given context and arguments | ||
3248 | fireWith: function( context, args ) { | ||
3249 | if ( list && ( !fired || stack ) ) { | ||
3250 | args = args || []; | ||
3251 | args = [ context, args.slice ? args.slice() : args ]; | ||
3252 | if ( firing ) { | ||
3253 | stack.push( args ); | ||
3254 | } else { | ||
3255 | fire( args ); | ||
3256 | } | ||
3257 | } | ||
3258 | return this; | ||
3259 | }, | ||
3260 | // Call all the callbacks with the given arguments | ||
3261 | fire: function() { | ||
3262 | self.fireWith( this, arguments ); | ||
3263 | return this; | ||
3264 | }, | ||
3265 | // To know if the callbacks have already been called at least once | ||
3266 | fired: function() { | ||
3267 | return !!fired; | ||
3268 | } | ||
3269 | }; | ||
3270 | |||
3271 | return self; | ||
3272 | }; | ||
3273 | |||
3274 | |||
3275 | jQuery.extend({ | ||
3276 | |||
3277 | Deferred: function( func ) { | ||
3278 | var tuples = [ | ||
3279 | // action, add listener, listener list, final state | ||
3280 | [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], | ||
3281 | [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], | ||
3282 | [ "notify", "progress", jQuery.Callbacks("memory") ] | ||
3283 | ], | ||
3284 | state = "pending", | ||
3285 | promise = { | ||
3286 | state: function() { | ||
3287 | return state; | ||
3288 | }, | ||
3289 | always: function() { | ||
3290 | deferred.done( arguments ).fail( arguments ); | ||
3291 | return this; | ||
3292 | }, | ||
3293 | then: function( /* fnDone, fnFail, fnProgress */ ) { | ||
3294 | var fns = arguments; | ||
3295 | return jQuery.Deferred(function( newDefer ) { | ||
3296 | jQuery.each( tuples, function( i, tuple ) { | ||
3297 | var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; | ||
3298 | // deferred[ done | fail | progress ] for forwarding actions to newDefer | ||
3299 | deferred[ tuple[1] ](function() { | ||
3300 | var returned = fn && fn.apply( this, arguments ); | ||
3301 | if ( returned && jQuery.isFunction( returned.promise ) ) { | ||
3302 | returned.promise() | ||
3303 | .done( newDefer.resolve ) | ||
3304 | .fail( newDefer.reject ) | ||
3305 | .progress( newDefer.notify ); | ||
3306 | } else { | ||
3307 | newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); | ||
3308 | } | ||
3309 | }); | ||
3310 | }); | ||
3311 | fns = null; | ||
3312 | }).promise(); | ||
3313 | }, | ||
3314 | // Get a promise for this deferred | ||
3315 | // If obj is provided, the promise aspect is added to the object | ||
3316 | promise: function( obj ) { | ||
3317 | return obj != null ? jQuery.extend( obj, promise ) : promise; | ||
3318 | } | ||
3319 | }, | ||
3320 | deferred = {}; | ||
3321 | |||
3322 | // Keep pipe for back-compat | ||
3323 | promise.pipe = promise.then; | ||
3324 | |||
3325 | // Add list-specific methods | ||
3326 | jQuery.each( tuples, function( i, tuple ) { | ||
3327 | var list = tuple[ 2 ], | ||
3328 | stateString = tuple[ 3 ]; | ||
3329 | |||
3330 | // promise[ done | fail | progress ] = list.add | ||
3331 | promise[ tuple[1] ] = list.add; | ||
3332 | |||
3333 | // Handle state | ||
3334 | if ( stateString ) { | ||
3335 | list.add(function() { | ||
3336 | // state = [ resolved | rejected ] | ||
3337 | state = stateString; | ||
3338 | |||
3339 | // [ reject_list | resolve_list ].disable; progress_list.lock | ||
3340 | }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); | ||
3341 | } | ||
3342 | |||
3343 | // deferred[ resolve | reject | notify ] | ||
3344 | deferred[ tuple[0] ] = function() { | ||
3345 | deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); | ||
3346 | return this; | ||
3347 | }; | ||
3348 | deferred[ tuple[0] + "With" ] = list.fireWith; | ||
3349 | }); | ||
3350 | |||
3351 | // Make the deferred a promise | ||
3352 | promise.promise( deferred ); | ||
3353 | |||
3354 | // Call given func if any | ||
3355 | if ( func ) { | ||
3356 | func.call( deferred, deferred ); | ||
3357 | } | ||
3358 | |||
3359 | // All done! | ||
3360 | return deferred; | ||
3361 | }, | ||
3362 | |||
3363 | // Deferred helper | ||
3364 | when: function( subordinate /* , ..., subordinateN */ ) { | ||
3365 | var i = 0, | ||
3366 | resolveValues = slice.call( arguments ), | ||
3367 | length = resolveValues.length, | ||
3368 | |||
3369 | // the count of uncompleted subordinates | ||
3370 | remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, | ||
3371 | |||
3372 | // the master Deferred. If resolveValues consist of only a single Deferred, just use that. | ||
3373 | deferred = remaining === 1 ? subordinate : jQuery.Deferred(), | ||
3374 | |||
3375 | // Update function for both resolve and progress values | ||
3376 | updateFunc = function( i, contexts, values ) { | ||
3377 | return function( value ) { | ||
3378 | contexts[ i ] = this; | ||
3379 | values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; | ||
3380 | if ( values === progressValues ) { | ||
3381 | deferred.notifyWith( contexts, values ); | ||
3382 | |||
3383 | } else if ( !(--remaining) ) { | ||
3384 | deferred.resolveWith( contexts, values ); | ||
3385 | } | ||
3386 | }; | ||
3387 | }, | ||
3388 | |||
3389 | progressValues, progressContexts, resolveContexts; | ||
3390 | |||
3391 | // add listeners to Deferred subordinates; treat others as resolved | ||
3392 | if ( length > 1 ) { | ||
3393 | progressValues = new Array( length ); | ||
3394 | progressContexts = new Array( length ); | ||
3395 | resolveContexts = new Array( length ); | ||
3396 | for ( ; i < length; i++ ) { | ||
3397 | if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { | ||
3398 | resolveValues[ i ].promise() | ||
3399 | .done( updateFunc( i, resolveContexts, resolveValues ) ) | ||
3400 | .fail( deferred.reject ) | ||
3401 | .progress( updateFunc( i, progressContexts, progressValues ) ); | ||
3402 | } else { | ||
3403 | --remaining; | ||
3404 | } | ||
3405 | } | ||
3406 | } | ||
3407 | |||
3408 | // if we're not waiting on anything, resolve the master | ||
3409 | if ( !remaining ) { | ||
3410 | deferred.resolveWith( resolveContexts, resolveValues ); | ||
3411 | } | ||
3412 | |||
3413 | return deferred.promise(); | ||
3414 | } | ||
3415 | }); | ||
3416 | |||
3417 | |||
3418 | // The deferred used on DOM ready | ||
3419 | var readyList; | ||
3420 | |||
3421 | jQuery.fn.ready = function( fn ) { | ||
3422 | // Add the callback | ||
3423 | jQuery.ready.promise().done( fn ); | ||
3424 | |||
3425 | return this; | ||
3426 | }; | ||
3427 | |||
3428 | jQuery.extend({ | ||
3429 | // Is the DOM ready to be used? Set to true once it occurs. | ||
3430 | isReady: false, | ||
3431 | |||
3432 | // A counter to track how many items to wait for before | ||
3433 | // the ready event fires. See #6781 | ||
3434 | readyWait: 1, | ||
3435 | |||
3436 | // Hold (or release) the ready event | ||
3437 | holdReady: function( hold ) { | ||
3438 | if ( hold ) { | ||
3439 | jQuery.readyWait++; | ||
3440 | } else { | ||
3441 | jQuery.ready( true ); | ||
3442 | } | ||
3443 | }, | ||
3444 | |||
3445 | // Handle when the DOM is ready | ||
3446 | ready: function( wait ) { | ||
3447 | |||
3448 | // Abort if there are pending holds or we're already ready | ||
3449 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { | ||
3450 | return; | ||
3451 | } | ||
3452 | |||
3453 | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | ||
3454 | if ( !document.body ) { | ||
3455 | return setTimeout( jQuery.ready ); | ||
3456 | } | ||
3457 | |||
3458 | // Remember that the DOM is ready | ||
3459 | jQuery.isReady = true; | ||
3460 | |||
3461 | // If a normal DOM Ready event fired, decrement, and wait if need be | ||
3462 | if ( wait !== true && --jQuery.readyWait > 0 ) { | ||
3463 | return; | ||
3464 | } | ||
3465 | |||
3466 | // If there are functions bound, to execute | ||
3467 | readyList.resolveWith( document, [ jQuery ] ); | ||
3468 | |||
3469 | // Trigger any bound ready events | ||
3470 | if ( jQuery.fn.triggerHandler ) { | ||
3471 | jQuery( document ).triggerHandler( "ready" ); | ||
3472 | jQuery( document ).off( "ready" ); | ||
3473 | } | ||
3474 | } | ||
3475 | }); | ||
3476 | |||
3477 | /** | ||
3478 | * Clean-up method for dom ready events | ||
3479 | */ | ||
3480 | function detach() { | ||
3481 | if ( document.addEventListener ) { | ||
3482 | document.removeEventListener( "DOMContentLoaded", completed, false ); | ||
3483 | window.removeEventListener( "load", completed, false ); | ||
3484 | |||
3485 | } else { | ||
3486 | document.detachEvent( "onreadystatechange", completed ); | ||
3487 | window.detachEvent( "onload", completed ); | ||
3488 | } | ||
3489 | } | ||
3490 | |||
3491 | /** | ||
3492 | * The ready event handler and self cleanup method | ||
3493 | */ | ||
3494 | function completed() { | ||
3495 | // readyState === "complete" is good enough for us to call the dom ready in oldIE | ||
3496 | if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { | ||
3497 | detach(); | ||
3498 | jQuery.ready(); | ||
3499 | } | ||
3500 | } | ||
3501 | |||
3502 | jQuery.ready.promise = function( obj ) { | ||
3503 | if ( !readyList ) { | ||
3504 | |||
3505 | readyList = jQuery.Deferred(); | ||
3506 | |||
3507 | // Catch cases where $(document).ready() is called after the browser event has already occurred. | ||
3508 | // we once tried to use readyState "interactive" here, but it caused issues like the one | ||
3509 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 | ||
3510 | if ( document.readyState === "complete" ) { | ||
3511 | // Handle it asynchronously to allow scripts the opportunity to delay ready | ||
3512 | setTimeout( jQuery.ready ); | ||
3513 | |||
3514 | // Standards-based browsers support DOMContentLoaded | ||
3515 | } else if ( document.addEventListener ) { | ||
3516 | // Use the handy event callback | ||
3517 | document.addEventListener( "DOMContentLoaded", completed, false ); | ||
3518 | |||
3519 | // A fallback to window.onload, that will always work | ||
3520 | window.addEventListener( "load", completed, false ); | ||
3521 | |||
3522 | // If IE event model is used | ||
3523 | } else { | ||
3524 | // Ensure firing before onload, maybe late but safe also for iframes | ||
3525 | document.attachEvent( "onreadystatechange", completed ); | ||
3526 | |||
3527 | // A fallback to window.onload, that will always work | ||
3528 | window.attachEvent( "onload", completed ); | ||
3529 | |||
3530 | // If IE and not a frame | ||
3531 | // continually check to see if the document is ready | ||
3532 | var top = false; | ||
3533 | |||
3534 | try { | ||
3535 | top = window.frameElement == null && document.documentElement; | ||
3536 | } catch(e) {} | ||
3537 | |||
3538 | if ( top && top.doScroll ) { | ||
3539 | (function doScrollCheck() { | ||
3540 | if ( !jQuery.isReady ) { | ||
3541 | |||
3542 | try { | ||
3543 | // Use the trick by Diego Perini | ||
3544 | // http://javascript.nwbox.com/IEContentLoaded/ | ||
3545 | top.doScroll("left"); | ||
3546 | } catch(e) { | ||
3547 | return setTimeout( doScrollCheck, 50 ); | ||
3548 | } | ||
3549 | |||
3550 | // detach all dom ready events | ||
3551 | detach(); | ||
3552 | |||
3553 | // and execute any waiting functions | ||
3554 | jQuery.ready(); | ||
3555 | } | ||
3556 | })(); | ||
3557 | } | ||
3558 | } | ||
3559 | } | ||
3560 | return readyList.promise( obj ); | ||
3561 | }; | ||
3562 | |||
3563 | |||
3564 | var strundefined = typeof undefined; | ||
3565 | |||
3566 | |||
3567 | |||
3568 | // Support: IE<9 | ||
3569 | // Iteration over object's inherited properties before its own | ||
3570 | var i; | ||
3571 | for ( i in jQuery( support ) ) { | ||
3572 | break; | ||
3573 | } | ||
3574 | support.ownLast = i !== "0"; | ||
3575 | |||
3576 | // Note: most support tests are defined in their respective modules. | ||
3577 | // false until the test is run | ||
3578 | support.inlineBlockNeedsLayout = false; | ||
3579 | |||
3580 | // Execute ASAP in case we need to set body.style.zoom | ||
3581 | jQuery(function() { | ||
3582 | // Minified: var a,b,c,d | ||
3583 | var val, div, body, container; | ||
3584 | |||
3585 | body = document.getElementsByTagName( "body" )[ 0 ]; | ||
3586 | if ( !body || !body.style ) { | ||
3587 | // Return for frameset docs that don't have a body | ||
3588 | return; | ||
3589 | } | ||
3590 | |||
3591 | // Setup | ||
3592 | div = document.createElement( "div" ); | ||
3593 | container = document.createElement( "div" ); | ||
3594 | container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; | ||
3595 | body.appendChild( container ).appendChild( div ); | ||
3596 | |||
3597 | if ( typeof div.style.zoom !== strundefined ) { | ||
3598 | // Support: IE<8 | ||
3599 | // Check if natively block-level elements act like inline-block | ||
3600 | // elements when setting their display to 'inline' and giving | ||
3601 | // them layout | ||
3602 | div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; | ||
3603 | |||
3604 | support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; | ||
3605 | if ( val ) { | ||
3606 | // Prevent IE 6 from affecting layout for positioned elements #11048 | ||
3607 | // Prevent IE from shrinking the body in IE 7 mode #12869 | ||
3608 | // Support: IE<8 | ||
3609 | body.style.zoom = 1; | ||
3610 | } | ||
3611 | } | ||
3612 | |||
3613 | body.removeChild( container ); | ||
3614 | }); | ||
3615 | |||
3616 | |||
3617 | |||
3618 | |||
3619 | (function() { | ||
3620 | var div = document.createElement( "div" ); | ||
3621 | |||
3622 | // Execute the test only if not already executed in another module. | ||
3623 | if (support.deleteExpando == null) { | ||
3624 | // Support: IE<9 | ||
3625 | support.deleteExpando = true; | ||
3626 | try { | ||
3627 | delete div.test; | ||
3628 | } catch( e ) { | ||
3629 | support.deleteExpando = false; | ||
3630 | } | ||
3631 | } | ||
3632 | |||
3633 | // Null elements to avoid leaks in IE. | ||
3634 | div = null; | ||
3635 | })(); | ||
3636 | |||
3637 | |||
3638 | /** | ||
3639 | * Determines whether an object can have data | ||
3640 | */ | ||
3641 | jQuery.acceptData = function( elem ) { | ||
3642 | var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], | ||
3643 | nodeType = +elem.nodeType || 1; | ||
3644 | |||
3645 | // Do not set data on non-element DOM nodes because it will not be cleared (#8335). | ||
3646 | return nodeType !== 1 && nodeType !== 9 ? | ||
3647 | false : | ||
3648 | |||
3649 | // Nodes accept data unless otherwise specified; rejection can be conditional | ||
3650 | !noData || noData !== true && elem.getAttribute("classid") === noData; | ||
3651 | }; | ||
3652 | |||
3653 | |||
3654 | var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | ||
3655 | rmultiDash = /([A-Z])/g; | ||
3656 | |||
3657 | function dataAttr( elem, key, data ) { | ||
3658 | // If nothing was found internally, try to fetch any | ||
3659 | // data from the HTML5 data-* attribute | ||
3660 | if ( data === undefined && elem.nodeType === 1 ) { | ||
3661 | |||
3662 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); | ||
3663 | |||
3664 | data = elem.getAttribute( name ); | ||
3665 | |||
3666 | if ( typeof data === "string" ) { | ||
3667 | try { | ||
3668 | data = data === "true" ? true : | ||
3669 | data === "false" ? false : | ||
3670 | data === "null" ? null : | ||
3671 | // Only convert to a number if it doesn't change the string | ||
3672 | +data + "" === data ? +data : | ||
3673 | rbrace.test( data ) ? jQuery.parseJSON( data ) : | ||
3674 | data; | ||
3675 | } catch( e ) {} | ||
3676 | |||
3677 | // Make sure we set the data so it isn't changed later | ||
3678 | jQuery.data( elem, key, data ); | ||
3679 | |||
3680 | } else { | ||
3681 | data = undefined; | ||
3682 | } | ||
3683 | } | ||
3684 | |||
3685 | return data; | ||
3686 | } | ||
3687 | |||
3688 | // checks a cache object for emptiness | ||
3689 | function isEmptyDataObject( obj ) { | ||
3690 | var name; | ||
3691 | for ( name in obj ) { | ||
3692 | |||
3693 | // if the public data object is empty, the private is still empty | ||
3694 | if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { | ||
3695 | continue; | ||
3696 | } | ||
3697 | if ( name !== "toJSON" ) { | ||
3698 | return false; | ||
3699 | } | ||
3700 | } | ||
3701 | |||
3702 | return true; | ||
3703 | } | ||
3704 | |||
3705 | function internalData( elem, name, data, pvt /* Internal Use Only */ ) { | ||
3706 | if ( !jQuery.acceptData( elem ) ) { | ||
3707 | return; | ||
3708 | } | ||
3709 | |||
3710 | var ret, thisCache, | ||
3711 | internalKey = jQuery.expando, | ||
3712 | |||
3713 | // We have to handle DOM nodes and JS objects differently because IE6-7 | ||
3714 | // can't GC object references properly across the DOM-JS boundary | ||
3715 | isNode = elem.nodeType, | ||
3716 | |||
3717 | // Only DOM nodes need the global jQuery cache; JS object data is | ||
3718 | // attached directly to the object so GC can occur automatically | ||
3719 | cache = isNode ? jQuery.cache : elem, | ||
3720 | |||
3721 | // Only defining an ID for JS objects if its cache already exists allows | ||
3722 | // the code to shortcut on the same path as a DOM node with no cache | ||
3723 | id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; | ||
3724 | |||
3725 | // Avoid doing any more work than we need to when trying to get data on an | ||
3726 | // object that has no data at all | ||
3727 | if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { | ||
3728 | return; | ||
3729 | } | ||
3730 | |||
3731 | if ( !id ) { | ||
3732 | // Only DOM nodes need a new unique ID for each element since their data | ||
3733 | // ends up in the global cache | ||
3734 | if ( isNode ) { | ||
3735 | id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; | ||
3736 | } else { | ||
3737 | id = internalKey; | ||
3738 | } | ||
3739 | } | ||
3740 | |||
3741 | if ( !cache[ id ] ) { | ||
3742 | // Avoid exposing jQuery metadata on plain JS objects when the object | ||
3743 | // is serialized using JSON.stringify | ||
3744 | cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; | ||
3745 | } | ||
3746 | |||
3747 | // An object can be passed to jQuery.data instead of a key/value pair; this gets | ||
3748 | // shallow copied over onto the existing cache | ||
3749 | if ( typeof name === "object" || typeof name === "function" ) { | ||
3750 | if ( pvt ) { | ||
3751 | cache[ id ] = jQuery.extend( cache[ id ], name ); | ||
3752 | } else { | ||
3753 | cache[ id ].data = jQuery.extend( cache[ id ].data, name ); | ||
3754 | } | ||
3755 | } | ||
3756 | |||
3757 | thisCache = cache[ id ]; | ||
3758 | |||
3759 | // jQuery data() is stored in a separate object inside the object's internal data | ||
3760 | // cache in order to avoid key collisions between internal data and user-defined | ||
3761 | // data. | ||
3762 | if ( !pvt ) { | ||
3763 | if ( !thisCache.data ) { | ||
3764 | thisCache.data = {}; | ||
3765 | } | ||
3766 | |||
3767 | thisCache = thisCache.data; | ||
3768 | } | ||
3769 | |||
3770 | if ( data !== undefined ) { | ||
3771 | thisCache[ jQuery.camelCase( name ) ] = data; | ||
3772 | } | ||
3773 | |||
3774 | // Check for both converted-to-camel and non-converted data property names | ||
3775 | // If a data property was specified | ||
3776 | if ( typeof name === "string" ) { | ||
3777 | |||
3778 | // First Try to find as-is property data | ||
3779 | ret = thisCache[ name ]; | ||
3780 | |||
3781 | // Test for null|undefined property data | ||
3782 | if ( ret == null ) { | ||
3783 | |||
3784 | // Try to find the camelCased property | ||
3785 | ret = thisCache[ jQuery.camelCase( name ) ]; | ||
3786 | } | ||
3787 | } else { | ||
3788 | ret = thisCache; | ||
3789 | } | ||
3790 | |||
3791 | return ret; | ||
3792 | } | ||
3793 | |||
3794 | function internalRemoveData( elem, name, pvt ) { | ||
3795 | if ( !jQuery.acceptData( elem ) ) { | ||
3796 | return; | ||
3797 | } | ||
3798 | |||
3799 | var thisCache, i, | ||
3800 | isNode = elem.nodeType, | ||
3801 | |||
3802 | // See jQuery.data for more information | ||
3803 | cache = isNode ? jQuery.cache : elem, | ||
3804 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; | ||
3805 | |||
3806 | // If there is already no cache entry for this object, there is no | ||
3807 | // purpose in continuing | ||
3808 | if ( !cache[ id ] ) { | ||
3809 | return; | ||
3810 | } | ||
3811 | |||
3812 | if ( name ) { | ||
3813 | |||
3814 | thisCache = pvt ? cache[ id ] : cache[ id ].data; | ||
3815 | |||
3816 | if ( thisCache ) { | ||
3817 | |||
3818 | // Support array or space separated string names for data keys | ||
3819 | if ( !jQuery.isArray( name ) ) { | ||
3820 | |||
3821 | // try the string as a key before any manipulation | ||
3822 | if ( name in thisCache ) { | ||
3823 | name = [ name ]; | ||
3824 | } else { | ||
3825 | |||
3826 | // split the camel cased version by spaces unless a key with the spaces exists | ||
3827 | name = jQuery.camelCase( name ); | ||
3828 | if ( name in thisCache ) { | ||
3829 | name = [ name ]; | ||
3830 | } else { | ||
3831 | name = name.split(" "); | ||
3832 | } | ||
3833 | } | ||
3834 | } else { | ||
3835 | // If "name" is an array of keys... | ||
3836 | // When data is initially created, via ("key", "val") signature, | ||
3837 | // keys will be converted to camelCase. | ||
3838 | // Since there is no way to tell _how_ a key was added, remove | ||
3839 | // both plain key and camelCase key. #12786 | ||
3840 | // This will only penalize the array argument path. | ||
3841 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); | ||
3842 | } | ||
3843 | |||
3844 | i = name.length; | ||
3845 | while ( i-- ) { | ||
3846 | delete thisCache[ name[i] ]; | ||
3847 | } | ||
3848 | |||
3849 | // If there is no data left in the cache, we want to continue | ||
3850 | // and let the cache object itself get destroyed | ||
3851 | if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { | ||
3852 | return; | ||
3853 | } | ||
3854 | } | ||
3855 | } | ||
3856 | |||
3857 | // See jQuery.data for more information | ||
3858 | if ( !pvt ) { | ||
3859 | delete cache[ id ].data; | ||
3860 | |||
3861 | // Don't destroy the parent cache unless the internal data object | ||
3862 | // had been the only thing left in it | ||
3863 | if ( !isEmptyDataObject( cache[ id ] ) ) { | ||
3864 | return; | ||
3865 | } | ||
3866 | } | ||
3867 | |||
3868 | // Destroy the cache | ||
3869 | if ( isNode ) { | ||
3870 | jQuery.cleanData( [ elem ], true ); | ||
3871 | |||
3872 | // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) | ||
3873 | /* jshint eqeqeq: false */ | ||
3874 | } else if ( support.deleteExpando || cache != cache.window ) { | ||
3875 | /* jshint eqeqeq: true */ | ||
3876 | delete cache[ id ]; | ||
3877 | |||
3878 | // When all else fails, null | ||
3879 | } else { | ||
3880 | cache[ id ] = null; | ||
3881 | } | ||
3882 | } | ||
3883 | |||
3884 | jQuery.extend({ | ||
3885 | cache: {}, | ||
3886 | |||
3887 | // The following elements (space-suffixed to avoid Object.prototype collisions) | ||
3888 | // throw uncatchable exceptions if you attempt to set expando properties | ||
3889 | noData: { | ||
3890 | "applet ": true, | ||
3891 | "embed ": true, | ||
3892 | // ...but Flash objects (which have this classid) *can* handle expandos | ||
3893 | "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" | ||
3894 | }, | ||
3895 | |||
3896 | hasData: function( elem ) { | ||
3897 | elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; | ||
3898 | return !!elem && !isEmptyDataObject( elem ); | ||
3899 | }, | ||
3900 | |||
3901 | data: function( elem, name, data ) { | ||
3902 | return internalData( elem, name, data ); | ||
3903 | }, | ||
3904 | |||
3905 | removeData: function( elem, name ) { | ||
3906 | return internalRemoveData( elem, name ); | ||
3907 | }, | ||
3908 | |||
3909 | // For internal use only. | ||
3910 | _data: function( elem, name, data ) { | ||
3911 | return internalData( elem, name, data, true ); | ||
3912 | }, | ||
3913 | |||
3914 | _removeData: function( elem, name ) { | ||
3915 | return internalRemoveData( elem, name, true ); | ||
3916 | } | ||
3917 | }); | ||
3918 | |||
3919 | jQuery.fn.extend({ | ||
3920 | data: function( key, value ) { | ||
3921 | var i, name, data, | ||
3922 | elem = this[0], | ||
3923 | attrs = elem && elem.attributes; | ||
3924 | |||
3925 | // Special expections of .data basically thwart jQuery.access, | ||
3926 | // so implement the relevant behavior ourselves | ||
3927 | |||
3928 | // Gets all values | ||
3929 | if ( key === undefined ) { | ||
3930 | if ( this.length ) { | ||
3931 | data = jQuery.data( elem ); | ||
3932 | |||
3933 | if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { | ||
3934 | i = attrs.length; | ||
3935 | while ( i-- ) { | ||
3936 | |||
3937 | // Support: IE11+ | ||
3938 | // The attrs elements can be null (#14894) | ||
3939 | if ( attrs[ i ] ) { | ||
3940 | name = attrs[ i ].name; | ||
3941 | if ( name.indexOf( "data-" ) === 0 ) { | ||
3942 | name = jQuery.camelCase( name.slice(5) ); | ||
3943 | dataAttr( elem, name, data[ name ] ); | ||
3944 | } | ||
3945 | } | ||
3946 | } | ||
3947 | jQuery._data( elem, "parsedAttrs", true ); | ||
3948 | } | ||
3949 | } | ||
3950 | |||
3951 | return data; | ||
3952 | } | ||
3953 | |||
3954 | // Sets multiple values | ||
3955 | if ( typeof key === "object" ) { | ||
3956 | return this.each(function() { | ||
3957 | jQuery.data( this, key ); | ||
3958 | }); | ||
3959 | } | ||
3960 | |||
3961 | return arguments.length > 1 ? | ||
3962 | |||
3963 | // Sets one value | ||
3964 | this.each(function() { | ||
3965 | jQuery.data( this, key, value ); | ||
3966 | }) : | ||
3967 | |||
3968 | // Gets one value | ||
3969 | // Try to fetch any internally stored data first | ||
3970 | elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; | ||
3971 | }, | ||
3972 | |||
3973 | removeData: function( key ) { | ||
3974 | return this.each(function() { | ||
3975 | jQuery.removeData( this, key ); | ||
3976 | }); | ||
3977 | } | ||
3978 | }); | ||
3979 | |||
3980 | |||
3981 | jQuery.extend({ | ||
3982 | queue: function( elem, type, data ) { | ||
3983 | var queue; | ||
3984 | |||
3985 | if ( elem ) { | ||
3986 | type = ( type || "fx" ) + "queue"; | ||
3987 | queue = jQuery._data( elem, type ); | ||
3988 | |||
3989 | // Speed up dequeue by getting out quickly if this is just a lookup | ||
3990 | if ( data ) { | ||
3991 | if ( !queue || jQuery.isArray(data) ) { | ||
3992 | queue = jQuery._data( elem, type, jQuery.makeArray(data) ); | ||
3993 | } else { | ||
3994 | queue.push( data ); | ||
3995 | } | ||
3996 | } | ||
3997 | return queue || []; | ||
3998 | } | ||
3999 | }, | ||
4000 | |||
4001 | dequeue: function( elem, type ) { | ||
4002 | type = type || "fx"; | ||
4003 | |||
4004 | var queue = jQuery.queue( elem, type ), | ||
4005 | startLength = queue.length, | ||
4006 | fn = queue.shift(), | ||
4007 | hooks = jQuery._queueHooks( elem, type ), | ||
4008 | next = function() { | ||
4009 | jQuery.dequeue( elem, type ); | ||
4010 | }; | ||
4011 | |||
4012 | // If the fx queue is dequeued, always remove the progress sentinel | ||
4013 | if ( fn === "inprogress" ) { | ||
4014 | fn = queue.shift(); | ||
4015 | startLength--; | ||
4016 | } | ||
4017 | |||
4018 | if ( fn ) { | ||
4019 | |||
4020 | // Add a progress sentinel to prevent the fx queue from being | ||
4021 | // automatically dequeued | ||
4022 | if ( type === "fx" ) { | ||
4023 | queue.unshift( "inprogress" ); | ||
4024 | } | ||
4025 | |||
4026 | // clear up the last queue stop function | ||
4027 | delete hooks.stop; | ||
4028 | fn.call( elem, next, hooks ); | ||
4029 | } | ||
4030 | |||
4031 | if ( !startLength && hooks ) { | ||
4032 | hooks.empty.fire(); | ||
4033 | } | ||
4034 | }, | ||
4035 | |||
4036 | // not intended for public consumption - generates a queueHooks object, or returns the current one | ||
4037 | _queueHooks: function( elem, type ) { | ||
4038 | var key = type + "queueHooks"; | ||
4039 | return jQuery._data( elem, key ) || jQuery._data( elem, key, { | ||
4040 | empty: jQuery.Callbacks("once memory").add(function() { | ||
4041 | jQuery._removeData( elem, type + "queue" ); | ||
4042 | jQuery._removeData( elem, key ); | ||
4043 | }) | ||
4044 | }); | ||
4045 | } | ||
4046 | }); | ||
4047 | |||
4048 | jQuery.fn.extend({ | ||
4049 | queue: function( type, data ) { | ||
4050 | var setter = 2; | ||
4051 | |||
4052 | if ( typeof type !== "string" ) { | ||
4053 | data = type; | ||
4054 | type = "fx"; | ||
4055 | setter--; | ||
4056 | } | ||
4057 | |||
4058 | if ( arguments.length < setter ) { | ||
4059 | return jQuery.queue( this[0], type ); | ||
4060 | } | ||
4061 | |||
4062 | return data === undefined ? | ||
4063 | this : | ||
4064 | this.each(function() { | ||
4065 | var queue = jQuery.queue( this, type, data ); | ||
4066 | |||
4067 | // ensure a hooks for this queue | ||
4068 | jQuery._queueHooks( this, type ); | ||
4069 | |||
4070 | if ( type === "fx" && queue[0] !== "inprogress" ) { | ||
4071 | jQuery.dequeue( this, type ); | ||
4072 | } | ||
4073 | }); | ||
4074 | }, | ||
4075 | dequeue: function( type ) { | ||
4076 | return this.each(function() { | ||
4077 | jQuery.dequeue( this, type ); | ||
4078 | }); | ||
4079 | }, | ||
4080 | clearQueue: function( type ) { | ||
4081 | return this.queue( type || "fx", [] ); | ||
4082 | }, | ||
4083 | // Get a promise resolved when queues of a certain type | ||
4084 | // are emptied (fx is the type by default) | ||
4085 | promise: function( type, obj ) { | ||
4086 | var tmp, | ||
4087 | count = 1, | ||
4088 | defer = jQuery.Deferred(), | ||
4089 | elements = this, | ||
4090 | i = this.length, | ||
4091 | resolve = function() { | ||
4092 | if ( !( --count ) ) { | ||
4093 | defer.resolveWith( elements, [ elements ] ); | ||
4094 | } | ||
4095 | }; | ||
4096 | |||
4097 | if ( typeof type !== "string" ) { | ||
4098 | obj = type; | ||
4099 | type = undefined; | ||
4100 | } | ||
4101 | type = type || "fx"; | ||
4102 | |||
4103 | while ( i-- ) { | ||
4104 | tmp = jQuery._data( elements[ i ], type + "queueHooks" ); | ||
4105 | if ( tmp && tmp.empty ) { | ||
4106 | count++; | ||
4107 | tmp.empty.add( resolve ); | ||
4108 | } | ||
4109 | } | ||
4110 | resolve(); | ||
4111 | return defer.promise( obj ); | ||
4112 | } | ||
4113 | }); | ||
4114 | var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; | ||
4115 | |||
4116 | var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; | ||
4117 | |||
4118 | var isHidden = function( elem, el ) { | ||
4119 | // isHidden might be called from jQuery#filter function; | ||
4120 | // in that case, element will be second argument | ||
4121 | elem = el || elem; | ||
4122 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); | ||
4123 | }; | ||
4124 | |||
4125 | |||
4126 | |||
4127 | // Multifunctional method to get and set values of a collection | ||
4128 | // The value/s can optionally be executed if it's a function | ||
4129 | var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { | ||
4130 | var i = 0, | ||
4131 | length = elems.length, | ||
4132 | bulk = key == null; | ||
4133 | |||
4134 | // Sets many values | ||
4135 | if ( jQuery.type( key ) === "object" ) { | ||
4136 | chainable = true; | ||
4137 | for ( i in key ) { | ||
4138 | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); | ||
4139 | } | ||
4140 | |||
4141 | // Sets one value | ||
4142 | } else if ( value !== undefined ) { | ||
4143 | chainable = true; | ||
4144 | |||
4145 | if ( !jQuery.isFunction( value ) ) { | ||
4146 | raw = true; | ||
4147 | } | ||
4148 | |||
4149 | if ( bulk ) { | ||
4150 | // Bulk operations run against the entire set | ||
4151 | if ( raw ) { | ||
4152 | fn.call( elems, value ); | ||
4153 | fn = null; | ||
4154 | |||
4155 | // ...except when executing function values | ||
4156 | } else { | ||
4157 | bulk = fn; | ||
4158 | fn = function( elem, key, value ) { | ||
4159 | return bulk.call( jQuery( elem ), value ); | ||
4160 | }; | ||
4161 | } | ||
4162 | } | ||
4163 | |||
4164 | if ( fn ) { | ||
4165 | for ( ; i < length; i++ ) { | ||
4166 | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); | ||
4167 | } | ||
4168 | } | ||
4169 | } | ||
4170 | |||
4171 | return chainable ? | ||
4172 | elems : | ||
4173 | |||
4174 | // Gets | ||
4175 | bulk ? | ||
4176 | fn.call( elems ) : | ||
4177 | length ? fn( elems[0], key ) : emptyGet; | ||
4178 | }; | ||
4179 | var rcheckableType = (/^(?:checkbox|radio)$/i); | ||
4180 | |||
4181 | |||
4182 | |||
4183 | (function() { | ||
4184 | // Minified: var a,b,c | ||
4185 | var input = document.createElement( "input" ), | ||
4186 | div = document.createElement( "div" ), | ||
4187 | fragment = document.createDocumentFragment(); | ||
4188 | |||
4189 | // Setup | ||
4190 | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; | ||
4191 | |||
4192 | // IE strips leading whitespace when .innerHTML is used | ||
4193 | support.leadingWhitespace = div.firstChild.nodeType === 3; | ||
4194 | |||
4195 | // Make sure that tbody elements aren't automatically inserted | ||
4196 | // IE will insert them into empty tables | ||
4197 | support.tbody = !div.getElementsByTagName( "tbody" ).length; | ||
4198 | |||
4199 | // Make sure that link elements get serialized correctly by innerHTML | ||
4200 | // This requires a wrapper element in IE | ||
4201 | support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; | ||
4202 | |||
4203 | // Makes sure cloning an html5 element does not cause problems | ||
4204 | // Where outerHTML is undefined, this still works | ||
4205 | support.html5Clone = | ||
4206 | document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; | ||
4207 | |||
4208 | // Check if a disconnected checkbox will retain its checked | ||
4209 | // value of true after appended to the DOM (IE6/7) | ||
4210 | input.type = "checkbox"; | ||
4211 | input.checked = true; | ||
4212 | fragment.appendChild( input ); | ||
4213 | support.appendChecked = input.checked; | ||
4214 | |||
4215 | // Make sure textarea (and checkbox) defaultValue is properly cloned | ||
4216 | // Support: IE6-IE11+ | ||
4217 | div.innerHTML = "<textarea>x</textarea>"; | ||
4218 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; | ||
4219 | |||
4220 | // #11217 - WebKit loses check when the name is after the checked attribute | ||
4221 | fragment.appendChild( div ); | ||
4222 | div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; | ||
4223 | |||
4224 | // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 | ||
4225 | // old WebKit doesn't clone checked state correctly in fragments | ||
4226 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; | ||
4227 | |||
4228 | // Support: IE<9 | ||
4229 | // Opera does not clone events (and typeof div.attachEvent === undefined). | ||
4230 | // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() | ||
4231 | support.noCloneEvent = true; | ||
4232 | if ( div.attachEvent ) { | ||
4233 | div.attachEvent( "onclick", function() { | ||
4234 | support.noCloneEvent = false; | ||
4235 | }); | ||
4236 | |||
4237 | div.cloneNode( true ).click(); | ||
4238 | } | ||
4239 | |||
4240 | // Execute the test only if not already executed in another module. | ||
4241 | if (support.deleteExpando == null) { | ||
4242 | // Support: IE<9 | ||
4243 | support.deleteExpando = true; | ||
4244 | try { | ||
4245 | delete div.test; | ||
4246 | } catch( e ) { | ||
4247 | support.deleteExpando = false; | ||
4248 | } | ||
4249 | } | ||
4250 | })(); | ||
4251 | |||
4252 | |||
4253 | (function() { | ||
4254 | var i, eventName, | ||
4255 | div = document.createElement( "div" ); | ||
4256 | |||
4257 | // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) | ||
4258 | for ( i in { submit: true, change: true, focusin: true }) { | ||
4259 | eventName = "on" + i; | ||
4260 | |||
4261 | if ( !(support[ i + "Bubbles" ] = eventName in window) ) { | ||
4262 | // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) | ||
4263 | div.setAttribute( eventName, "t" ); | ||
4264 | support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; | ||
4265 | } | ||
4266 | } | ||
4267 | |||
4268 | // Null elements to avoid leaks in IE. | ||
4269 | div = null; | ||
4270 | })(); | ||
4271 | |||
4272 | |||
4273 | var rformElems = /^(?:input|select|textarea)$/i, | ||
4274 | rkeyEvent = /^key/, | ||
4275 | rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, | ||
4276 | rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, | ||
4277 | rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; | ||
4278 | |||
4279 | function returnTrue() { | ||
4280 | return true; | ||
4281 | } | ||
4282 | |||
4283 | function returnFalse() { | ||
4284 | return false; | ||
4285 | } | ||
4286 | |||
4287 | function safeActiveElement() { | ||
4288 | try { | ||
4289 | return document.activeElement; | ||
4290 | } catch ( err ) { } | ||
4291 | } | ||
4292 | |||
4293 | /* | ||
4294 | * Helper functions for managing events -- not part of the public interface. | ||
4295 | * Props to Dean Edwards' addEvent library for many of the ideas. | ||
4296 | */ | ||
4297 | jQuery.event = { | ||
4298 | |||
4299 | global: {}, | ||
4300 | |||
4301 | add: function( elem, types, handler, data, selector ) { | ||
4302 | var tmp, events, t, handleObjIn, | ||
4303 | special, eventHandle, handleObj, | ||
4304 | handlers, type, namespaces, origType, | ||
4305 | elemData = jQuery._data( elem ); | ||
4306 | |||
4307 | // Don't attach events to noData or text/comment nodes (but allow plain objects) | ||
4308 | if ( !elemData ) { | ||
4309 | return; | ||
4310 | } | ||
4311 | |||
4312 | // Caller can pass in an object of custom data in lieu of the handler | ||
4313 | if ( handler.handler ) { | ||
4314 | handleObjIn = handler; | ||
4315 | handler = handleObjIn.handler; | ||
4316 | selector = handleObjIn.selector; | ||
4317 | } | ||
4318 | |||
4319 | // Make sure that the handler has a unique ID, used to find/remove it later | ||
4320 | if ( !handler.guid ) { | ||
4321 | handler.guid = jQuery.guid++; | ||
4322 | } | ||
4323 | |||
4324 | // Init the element's event structure and main handler, if this is the first | ||
4325 | if ( !(events = elemData.events) ) { | ||
4326 | events = elemData.events = {}; | ||
4327 | } | ||
4328 | if ( !(eventHandle = elemData.handle) ) { | ||
4329 | eventHandle = elemData.handle = function( e ) { | ||
4330 | // Discard the second event of a jQuery.event.trigger() and | ||
4331 | // when an event is called after a page has unloaded | ||
4332 | return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? | ||
4333 | jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : | ||
4334 | undefined; | ||
4335 | }; | ||
4336 | // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events | ||
4337 | eventHandle.elem = elem; | ||
4338 | } | ||
4339 | |||
4340 | // Handle multiple events separated by a space | ||
4341 | types = ( types || "" ).match( rnotwhite ) || [ "" ]; | ||
4342 | t = types.length; | ||
4343 | while ( t-- ) { | ||
4344 | tmp = rtypenamespace.exec( types[t] ) || []; | ||
4345 | type = origType = tmp[1]; | ||
4346 | namespaces = ( tmp[2] || "" ).split( "." ).sort(); | ||
4347 | |||
4348 | // There *must* be a type, no attaching namespace-only handlers | ||
4349 | if ( !type ) { | ||
4350 | continue; | ||
4351 | } | ||
4352 | |||
4353 | // If event changes its type, use the special event handlers for the changed type | ||
4354 | special = jQuery.event.special[ type ] || {}; | ||
4355 | |||
4356 | // If selector defined, determine special event api type, otherwise given type | ||
4357 | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
4358 | |||
4359 | // Update special based on newly reset type | ||
4360 | special = jQuery.event.special[ type ] || {}; | ||
4361 | |||
4362 | // handleObj is passed to all event handlers | ||
4363 | handleObj = jQuery.extend({ | ||
4364 | type: type, | ||
4365 | origType: origType, | ||
4366 | data: data, | ||
4367 | handler: handler, | ||
4368 | guid: handler.guid, | ||
4369 | selector: selector, | ||
4370 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ), | ||
4371 | namespace: namespaces.join(".") | ||
4372 | }, handleObjIn ); | ||
4373 | |||
4374 | // Init the event handler queue if we're the first | ||
4375 | if ( !(handlers = events[ type ]) ) { | ||
4376 | handlers = events[ type ] = []; | ||
4377 | handlers.delegateCount = 0; | ||
4378 | |||
4379 | // Only use addEventListener/attachEvent if the special events handler returns false | ||
4380 | if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { | ||
4381 | // Bind the global event handler to the element | ||
4382 | if ( elem.addEventListener ) { | ||
4383 | elem.addEventListener( type, eventHandle, false ); | ||
4384 | |||
4385 | } else if ( elem.attachEvent ) { | ||
4386 | elem.attachEvent( "on" + type, eventHandle ); | ||
4387 | } | ||
4388 | } | ||
4389 | } | ||
4390 | |||
4391 | if ( special.add ) { | ||
4392 | special.add.call( elem, handleObj ); | ||
4393 | |||
4394 | if ( !handleObj.handler.guid ) { | ||
4395 | handleObj.handler.guid = handler.guid; | ||
4396 | } | ||
4397 | } | ||
4398 | |||
4399 | // Add to the element's handler list, delegates in front | ||
4400 | if ( selector ) { | ||
4401 | handlers.splice( handlers.delegateCount++, 0, handleObj ); | ||
4402 | } else { | ||
4403 | handlers.push( handleObj ); | ||
4404 | } | ||
4405 | |||
4406 | // Keep track of which events have ever been used, for event optimization | ||
4407 | jQuery.event.global[ type ] = true; | ||
4408 | } | ||
4409 | |||
4410 | // Nullify elem to prevent memory leaks in IE | ||
4411 | elem = null; | ||
4412 | }, | ||
4413 | |||
4414 | // Detach an event or set of events from an element | ||
4415 | remove: function( elem, types, handler, selector, mappedTypes ) { | ||
4416 | var j, handleObj, tmp, | ||
4417 | origCount, t, events, | ||
4418 | special, handlers, type, | ||
4419 | namespaces, origType, | ||
4420 | elemData = jQuery.hasData( elem ) && jQuery._data( elem ); | ||
4421 | |||
4422 | if ( !elemData || !(events = elemData.events) ) { | ||
4423 | return; | ||
4424 | } | ||
4425 | |||
4426 | // Once for each type.namespace in types; type may be omitted | ||
4427 | types = ( types || "" ).match( rnotwhite ) || [ "" ]; | ||
4428 | t = types.length; | ||
4429 | while ( t-- ) { | ||
4430 | tmp = rtypenamespace.exec( types[t] ) || []; | ||
4431 | type = origType = tmp[1]; | ||
4432 | namespaces = ( tmp[2] || "" ).split( "." ).sort(); | ||
4433 | |||
4434 | // Unbind all events (on this namespace, if provided) for the element | ||
4435 | if ( !type ) { | ||
4436 | for ( type in events ) { | ||
4437 | jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); | ||
4438 | } | ||
4439 | continue; | ||
4440 | } | ||
4441 | |||
4442 | special = jQuery.event.special[ type ] || {}; | ||
4443 | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
4444 | handlers = events[ type ] || []; | ||
4445 | tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); | ||
4446 | |||
4447 | // Remove matching events | ||
4448 | origCount = j = handlers.length; | ||
4449 | while ( j-- ) { | ||
4450 | handleObj = handlers[ j ]; | ||
4451 | |||
4452 | if ( ( mappedTypes || origType === handleObj.origType ) && | ||
4453 | ( !handler || handler.guid === handleObj.guid ) && | ||
4454 | ( !tmp || tmp.test( handleObj.namespace ) ) && | ||
4455 | ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { | ||
4456 | handlers.splice( j, 1 ); | ||
4457 | |||
4458 | if ( handleObj.selector ) { | ||
4459 | handlers.delegateCount--; | ||
4460 | } | ||
4461 | if ( special.remove ) { | ||
4462 | special.remove.call( elem, handleObj ); | ||
4463 | } | ||
4464 | } | ||
4465 | } | ||
4466 | |||
4467 | // Remove generic event handler if we removed something and no more handlers exist | ||
4468 | // (avoids potential for endless recursion during removal of special event handlers) | ||
4469 | if ( origCount && !handlers.length ) { | ||
4470 | if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { | ||
4471 | jQuery.removeEvent( elem, type, elemData.handle ); | ||
4472 | } | ||
4473 | |||
4474 | delete events[ type ]; | ||
4475 | } | ||
4476 | } | ||
4477 | |||
4478 | // Remove the expando if it's no longer used | ||
4479 | if ( jQuery.isEmptyObject( events ) ) { | ||
4480 | delete elemData.handle; | ||
4481 | |||
4482 | // removeData also checks for emptiness and clears the expando if empty | ||
4483 | // so use it instead of delete | ||
4484 | jQuery._removeData( elem, "events" ); | ||
4485 | } | ||
4486 | }, | ||
4487 | |||
4488 | trigger: function( event, data, elem, onlyHandlers ) { | ||
4489 | var handle, ontype, cur, | ||
4490 | bubbleType, special, tmp, i, | ||
4491 | eventPath = [ elem || document ], | ||
4492 | type = hasOwn.call( event, "type" ) ? event.type : event, | ||
4493 | namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; | ||
4494 | |||
4495 | cur = tmp = elem = elem || document; | ||
4496 | |||
4497 | // Don't do events on text and comment nodes | ||
4498 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
4499 | return; | ||
4500 | } | ||
4501 | |||
4502 | // focus/blur morphs to focusin/out; ensure we're not firing them right now | ||
4503 | if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { | ||
4504 | return; | ||
4505 | } | ||
4506 | |||
4507 | if ( type.indexOf(".") >= 0 ) { | ||
4508 | // Namespaced trigger; create a regexp to match event type in handle() | ||
4509 | namespaces = type.split("."); | ||
4510 | type = namespaces.shift(); | ||
4511 | namespaces.sort(); | ||
4512 | } | ||
4513 | ontype = type.indexOf(":") < 0 && "on" + type; | ||
4514 | |||
4515 | // Caller can pass in a jQuery.Event object, Object, or just an event type string | ||
4516 | event = event[ jQuery.expando ] ? | ||
4517 | event : | ||
4518 | new jQuery.Event( type, typeof event === "object" && event ); | ||
4519 | |||
4520 | // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) | ||
4521 | event.isTrigger = onlyHandlers ? 2 : 3; | ||
4522 | event.namespace = namespaces.join("."); | ||
4523 | event.namespace_re = event.namespace ? | ||
4524 | new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : | ||
4525 | null; | ||
4526 | |||
4527 | // Clean up the event in case it is being reused | ||
4528 | event.result = undefined; | ||
4529 | if ( !event.target ) { | ||
4530 | event.target = elem; | ||
4531 | } | ||
4532 | |||
4533 | // Clone any incoming data and prepend the event, creating the handler arg list | ||
4534 | data = data == null ? | ||
4535 | [ event ] : | ||
4536 | jQuery.makeArray( data, [ event ] ); | ||
4537 | |||
4538 | // Allow special events to draw outside the lines | ||
4539 | special = jQuery.event.special[ type ] || {}; | ||
4540 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { | ||
4541 | return; | ||
4542 | } | ||
4543 | |||
4544 | // Determine event propagation path in advance, per W3C events spec (#9951) | ||
4545 | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) | ||
4546 | if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { | ||
4547 | |||
4548 | bubbleType = special.delegateType || type; | ||
4549 | if ( !rfocusMorph.test( bubbleType + type ) ) { | ||
4550 | cur = cur.parentNode; | ||
4551 | } | ||
4552 | for ( ; cur; cur = cur.parentNode ) { | ||
4553 | eventPath.push( cur ); | ||
4554 | tmp = cur; | ||
4555 | } | ||
4556 | |||
4557 | // Only add window if we got to document (e.g., not plain obj or detached DOM) | ||
4558 | if ( tmp === (elem.ownerDocument || document) ) { | ||
4559 | eventPath.push( tmp.defaultView || tmp.parentWindow || window ); | ||
4560 | } | ||
4561 | } | ||
4562 | |||
4563 | // Fire handlers on the event path | ||
4564 | i = 0; | ||
4565 | while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { | ||
4566 | |||
4567 | event.type = i > 1 ? | ||
4568 | bubbleType : | ||
4569 | special.bindType || type; | ||
4570 | |||
4571 | // jQuery handler | ||
4572 | handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); | ||
4573 | if ( handle ) { | ||
4574 | handle.apply( cur, data ); | ||
4575 | } | ||
4576 | |||
4577 | // Native handler | ||
4578 | handle = ontype && cur[ ontype ]; | ||
4579 | if ( handle && handle.apply && jQuery.acceptData( cur ) ) { | ||
4580 | event.result = handle.apply( cur, data ); | ||
4581 | if ( event.result === false ) { | ||
4582 | event.preventDefault(); | ||
4583 | } | ||
4584 | } | ||
4585 | } | ||
4586 | event.type = type; | ||
4587 | |||
4588 | // If nobody prevented the default action, do it now | ||
4589 | if ( !onlyHandlers && !event.isDefaultPrevented() ) { | ||
4590 | |||
4591 | if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && | ||
4592 | jQuery.acceptData( elem ) ) { | ||
4593 | |||
4594 | // Call a native DOM method on the target with the same name name as the event. | ||
4595 | // Can't use an .isFunction() check here because IE6/7 fails that test. | ||
4596 | // Don't do default actions on window, that's where global variables be (#6170) | ||
4597 | if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { | ||
4598 | |||
4599 | // Don't re-trigger an onFOO event when we call its FOO() method | ||
4600 | tmp = elem[ ontype ]; | ||
4601 | |||
4602 | if ( tmp ) { | ||
4603 | elem[ ontype ] = null; | ||
4604 | } | ||
4605 | |||
4606 | // Prevent re-triggering of the same event, since we already bubbled it above | ||
4607 | jQuery.event.triggered = type; | ||
4608 | try { | ||
4609 | elem[ type ](); | ||
4610 | } catch ( e ) { | ||
4611 | // IE<9 dies on focus/blur to hidden element (#1486,#12518) | ||
4612 | // only reproducible on winXP IE8 native, not IE9 in IE8 mode | ||
4613 | } | ||
4614 | jQuery.event.triggered = undefined; | ||
4615 | |||
4616 | if ( tmp ) { | ||
4617 | elem[ ontype ] = tmp; | ||
4618 | } | ||
4619 | } | ||
4620 | } | ||
4621 | } | ||
4622 | |||
4623 | return event.result; | ||
4624 | }, | ||
4625 | |||
4626 | dispatch: function( event ) { | ||
4627 | |||
4628 | // Make a writable jQuery.Event from the native event object | ||
4629 | event = jQuery.event.fix( event ); | ||
4630 | |||
4631 | var i, ret, handleObj, matched, j, | ||
4632 | handlerQueue = [], | ||
4633 | args = slice.call( arguments ), | ||
4634 | handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], | ||
4635 | special = jQuery.event.special[ event.type ] || {}; | ||
4636 | |||
4637 | // Use the fix-ed jQuery.Event rather than the (read-only) native event | ||
4638 | args[0] = event; | ||
4639 | event.delegateTarget = this; | ||
4640 | |||
4641 | // Call the preDispatch hook for the mapped type, and let it bail if desired | ||
4642 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { | ||
4643 | return; | ||
4644 | } | ||
4645 | |||
4646 | // Determine handlers | ||
4647 | handlerQueue = jQuery.event.handlers.call( this, event, handlers ); | ||
4648 | |||
4649 | // Run delegates first; they may want to stop propagation beneath us | ||
4650 | i = 0; | ||
4651 | while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { | ||
4652 | event.currentTarget = matched.elem; | ||
4653 | |||
4654 | j = 0; | ||
4655 | while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { | ||
4656 | |||
4657 | // Triggered event must either 1) have no namespace, or | ||
4658 | // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). | ||
4659 | if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { | ||
4660 | |||
4661 | event.handleObj = handleObj; | ||
4662 | event.data = handleObj.data; | ||
4663 | |||
4664 | ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) | ||
4665 | .apply( matched.elem, args ); | ||
4666 | |||
4667 | if ( ret !== undefined ) { | ||
4668 | if ( (event.result = ret) === false ) { | ||
4669 | event.preventDefault(); | ||
4670 | event.stopPropagation(); | ||
4671 | } | ||
4672 | } | ||
4673 | } | ||
4674 | } | ||
4675 | } | ||
4676 | |||
4677 | // Call the postDispatch hook for the mapped type | ||
4678 | if ( special.postDispatch ) { | ||
4679 | special.postDispatch.call( this, event ); | ||
4680 | } | ||
4681 | |||
4682 | return event.result; | ||
4683 | }, | ||
4684 | |||
4685 | handlers: function( event, handlers ) { | ||
4686 | var sel, handleObj, matches, i, | ||
4687 | handlerQueue = [], | ||
4688 | delegateCount = handlers.delegateCount, | ||
4689 | cur = event.target; | ||
4690 | |||
4691 | // Find delegate handlers | ||
4692 | // Black-hole SVG <use> instance trees (#13180) | ||
4693 | // Avoid non-left-click bubbling in Firefox (#3861) | ||
4694 | if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { | ||
4695 | |||
4696 | /* jshint eqeqeq: false */ | ||
4697 | for ( ; cur != this; cur = cur.parentNode || this ) { | ||
4698 | /* jshint eqeqeq: true */ | ||
4699 | |||
4700 | // Don't check non-elements (#13208) | ||
4701 | // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) | ||
4702 | if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { | ||
4703 | matches = []; | ||
4704 | for ( i = 0; i < delegateCount; i++ ) { | ||
4705 | handleObj = handlers[ i ]; | ||
4706 | |||
4707 | // Don't conflict with Object.prototype properties (#13203) | ||
4708 | sel = handleObj.selector + " "; | ||
4709 | |||
4710 | if ( matches[ sel ] === undefined ) { | ||
4711 | matches[ sel ] = handleObj.needsContext ? | ||
4712 | jQuery( sel, this ).index( cur ) >= 0 : | ||
4713 | jQuery.find( sel, this, null, [ cur ] ).length; | ||
4714 | } | ||
4715 | if ( matches[ sel ] ) { | ||
4716 | matches.push( handleObj ); | ||
4717 | } | ||
4718 | } | ||
4719 | if ( matches.length ) { | ||
4720 | handlerQueue.push({ elem: cur, handlers: matches }); | ||
4721 | } | ||
4722 | } | ||
4723 | } | ||
4724 | } | ||
4725 | |||
4726 | // Add the remaining (directly-bound) handlers | ||
4727 | if ( delegateCount < handlers.length ) { | ||
4728 | handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); | ||
4729 | } | ||
4730 | |||
4731 | return handlerQueue; | ||
4732 | }, | ||
4733 | |||
4734 | fix: function( event ) { | ||
4735 | if ( event[ jQuery.expando ] ) { | ||
4736 | return event; | ||
4737 | } | ||
4738 | |||
4739 | // Create a writable copy of the event object and normalize some properties | ||
4740 | var i, prop, copy, | ||
4741 | type = event.type, | ||
4742 | originalEvent = event, | ||
4743 | fixHook = this.fixHooks[ type ]; | ||
4744 | |||
4745 | if ( !fixHook ) { | ||
4746 | this.fixHooks[ type ] = fixHook = | ||
4747 | rmouseEvent.test( type ) ? this.mouseHooks : | ||
4748 | rkeyEvent.test( type ) ? this.keyHooks : | ||
4749 | {}; | ||
4750 | } | ||
4751 | copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; | ||
4752 | |||
4753 | event = new jQuery.Event( originalEvent ); | ||
4754 | |||
4755 | i = copy.length; | ||
4756 | while ( i-- ) { | ||
4757 | prop = copy[ i ]; | ||
4758 | event[ prop ] = originalEvent[ prop ]; | ||
4759 | } | ||
4760 | |||
4761 | // Support: IE<9 | ||
4762 | // Fix target property (#1925) | ||
4763 | if ( !event.target ) { | ||
4764 | event.target = originalEvent.srcElement || document; | ||
4765 | } | ||
4766 | |||
4767 | // Support: Chrome 23+, Safari? | ||
4768 | // Target should not be a text node (#504, #13143) | ||
4769 | if ( event.target.nodeType === 3 ) { | ||
4770 | event.target = event.target.parentNode; | ||
4771 | } | ||
4772 | |||
4773 | // Support: IE<9 | ||
4774 | // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) | ||
4775 | event.metaKey = !!event.metaKey; | ||
4776 | |||
4777 | return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; | ||
4778 | }, | ||
4779 | |||
4780 | // Includes some event props shared by KeyEvent and MouseEvent | ||
4781 | props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | ||
4782 | |||
4783 | fixHooks: {}, | ||
4784 | |||
4785 | keyHooks: { | ||
4786 | props: "char charCode key keyCode".split(" "), | ||
4787 | filter: function( event, original ) { | ||
4788 | |||
4789 | // Add which for key events | ||
4790 | if ( event.which == null ) { | ||
4791 | event.which = original.charCode != null ? original.charCode : original.keyCode; | ||
4792 | } | ||
4793 | |||
4794 | return event; | ||
4795 | } | ||
4796 | }, | ||
4797 | |||
4798 | mouseHooks: { | ||
4799 | props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | ||
4800 | filter: function( event, original ) { | ||
4801 | var body, eventDoc, doc, | ||
4802 | button = original.button, | ||
4803 | fromElement = original.fromElement; | ||
4804 | |||
4805 | // Calculate pageX/Y if missing and clientX/Y available | ||
4806 | if ( event.pageX == null && original.clientX != null ) { | ||
4807 | eventDoc = event.target.ownerDocument || document; | ||
4808 | doc = eventDoc.documentElement; | ||
4809 | body = eventDoc.body; | ||
4810 | |||
4811 | event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); | ||
4812 | event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); | ||
4813 | } | ||
4814 | |||
4815 | // Add relatedTarget, if necessary | ||
4816 | if ( !event.relatedTarget && fromElement ) { | ||
4817 | event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; | ||
4818 | } | ||
4819 | |||
4820 | // Add which for click: 1 === left; 2 === middle; 3 === right | ||
4821 | // Note: button is not normalized, so don't use it | ||
4822 | if ( !event.which && button !== undefined ) { | ||
4823 | event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); | ||
4824 | } | ||
4825 | |||
4826 | return event; | ||
4827 | } | ||
4828 | }, | ||
4829 | |||
4830 | special: { | ||
4831 | load: { | ||
4832 | // Prevent triggered image.load events from bubbling to window.load | ||
4833 | noBubble: true | ||
4834 | }, | ||
4835 | focus: { | ||
4836 | // Fire native event if possible so blur/focus sequence is correct | ||
4837 | trigger: function() { | ||
4838 | if ( this !== safeActiveElement() && this.focus ) { | ||
4839 | try { | ||
4840 | this.focus(); | ||
4841 | return false; | ||
4842 | } catch ( e ) { | ||
4843 | // Support: IE<9 | ||
4844 | // If we error on focus to hidden element (#1486, #12518), | ||
4845 | // let .trigger() run the handlers | ||
4846 | } | ||
4847 | } | ||
4848 | }, | ||
4849 | delegateType: "focusin" | ||
4850 | }, | ||
4851 | blur: { | ||
4852 | trigger: function() { | ||
4853 | if ( this === safeActiveElement() && this.blur ) { | ||
4854 | this.blur(); | ||
4855 | return false; | ||
4856 | } | ||
4857 | }, | ||
4858 | delegateType: "focusout" | ||
4859 | }, | ||
4860 | click: { | ||
4861 | // For checkbox, fire native event so checked state will be right | ||
4862 | trigger: function() { | ||
4863 | if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { | ||
4864 | this.click(); | ||
4865 | return false; | ||
4866 | } | ||
4867 | }, | ||
4868 | |||
4869 | // For cross-browser consistency, don't fire native .click() on links | ||
4870 | _default: function( event ) { | ||
4871 | return jQuery.nodeName( event.target, "a" ); | ||
4872 | } | ||
4873 | }, | ||
4874 | |||
4875 | beforeunload: { | ||
4876 | postDispatch: function( event ) { | ||
4877 | |||
4878 | // Support: Firefox 20+ | ||
4879 | // Firefox doesn't alert if the returnValue field is not set. | ||
4880 | if ( event.result !== undefined && event.originalEvent ) { | ||
4881 | event.originalEvent.returnValue = event.result; | ||
4882 | } | ||
4883 | } | ||
4884 | } | ||
4885 | }, | ||
4886 | |||
4887 | simulate: function( type, elem, event, bubble ) { | ||
4888 | // Piggyback on a donor event to simulate a different one. | ||
4889 | // Fake originalEvent to avoid donor's stopPropagation, but if the | ||
4890 | // simulated event prevents default then we do the same on the donor. | ||
4891 | var e = jQuery.extend( | ||
4892 | new jQuery.Event(), | ||
4893 | event, | ||
4894 | { | ||
4895 | type: type, | ||
4896 | isSimulated: true, | ||
4897 | originalEvent: {} | ||
4898 | } | ||
4899 | ); | ||
4900 | if ( bubble ) { | ||
4901 | jQuery.event.trigger( e, null, elem ); | ||
4902 | } else { | ||
4903 | jQuery.event.dispatch.call( elem, e ); | ||
4904 | } | ||
4905 | if ( e.isDefaultPrevented() ) { | ||
4906 | event.preventDefault(); | ||
4907 | } | ||
4908 | } | ||
4909 | }; | ||
4910 | |||
4911 | jQuery.removeEvent = document.removeEventListener ? | ||
4912 | function( elem, type, handle ) { | ||
4913 | if ( elem.removeEventListener ) { | ||
4914 | elem.removeEventListener( type, handle, false ); | ||
4915 | } | ||
4916 | } : | ||
4917 | function( elem, type, handle ) { | ||
4918 | var name = "on" + type; | ||
4919 | |||
4920 | if ( elem.detachEvent ) { | ||
4921 | |||
4922 | // #8545, #7054, preventing memory leaks for custom events in IE6-8 | ||
4923 | // detachEvent needed property on element, by name of that event, to properly expose it to GC | ||
4924 | if ( typeof elem[ name ] === strundefined ) { | ||
4925 | elem[ name ] = null; | ||
4926 | } | ||
4927 | |||
4928 | elem.detachEvent( name, handle ); | ||
4929 | } | ||
4930 | }; | ||
4931 | |||
4932 | jQuery.Event = function( src, props ) { | ||
4933 | // Allow instantiation without the 'new' keyword | ||
4934 | if ( !(this instanceof jQuery.Event) ) { | ||
4935 | return new jQuery.Event( src, props ); | ||
4936 | } | ||
4937 | |||
4938 | // Event object | ||
4939 | if ( src && src.type ) { | ||
4940 | this.originalEvent = src; | ||
4941 | this.type = src.type; | ||
4942 | |||
4943 | // Events bubbling up the document may have been marked as prevented | ||
4944 | // by a handler lower down the tree; reflect the correct value. | ||
4945 | this.isDefaultPrevented = src.defaultPrevented || | ||
4946 | src.defaultPrevented === undefined && | ||
4947 | // Support: IE < 9, Android < 4.0 | ||
4948 | src.returnValue === false ? | ||
4949 | returnTrue : | ||
4950 | returnFalse; | ||
4951 | |||
4952 | // Event type | ||
4953 | } else { | ||
4954 | this.type = src; | ||
4955 | } | ||
4956 | |||
4957 | // Put explicitly provided properties onto the event object | ||
4958 | if ( props ) { | ||
4959 | jQuery.extend( this, props ); | ||
4960 | } | ||
4961 | |||
4962 | // Create a timestamp if incoming event doesn't have one | ||
4963 | this.timeStamp = src && src.timeStamp || jQuery.now(); | ||
4964 | |||
4965 | // Mark it as fixed | ||
4966 | this[ jQuery.expando ] = true; | ||
4967 | }; | ||
4968 | |||
4969 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | ||
4970 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | ||
4971 | jQuery.Event.prototype = { | ||
4972 | isDefaultPrevented: returnFalse, | ||
4973 | isPropagationStopped: returnFalse, | ||
4974 | isImmediatePropagationStopped: returnFalse, | ||
4975 | |||
4976 | preventDefault: function() { | ||
4977 | var e = this.originalEvent; | ||
4978 | |||
4979 | this.isDefaultPrevented = returnTrue; | ||
4980 | if ( !e ) { | ||
4981 | return; | ||
4982 | } | ||
4983 | |||
4984 | // If preventDefault exists, run it on the original event | ||
4985 | if ( e.preventDefault ) { | ||
4986 | e.preventDefault(); | ||
4987 | |||
4988 | // Support: IE | ||
4989 | // Otherwise set the returnValue property of the original event to false | ||
4990 | } else { | ||
4991 | e.returnValue = false; | ||
4992 | } | ||
4993 | }, | ||
4994 | stopPropagation: function() { | ||
4995 | var e = this.originalEvent; | ||
4996 | |||
4997 | this.isPropagationStopped = returnTrue; | ||
4998 | if ( !e ) { | ||
4999 | return; | ||
5000 | } | ||
5001 | // If stopPropagation exists, run it on the original event | ||
5002 | if ( e.stopPropagation ) { | ||
5003 | e.stopPropagation(); | ||
5004 | } | ||
5005 | |||
5006 | // Support: IE | ||
5007 | // Set the cancelBubble property of the original event to true | ||
5008 | e.cancelBubble = true; | ||
5009 | }, | ||
5010 | stopImmediatePropagation: function() { | ||
5011 | var e = this.originalEvent; | ||
5012 | |||
5013 | this.isImmediatePropagationStopped = returnTrue; | ||
5014 | |||
5015 | if ( e && e.stopImmediatePropagation ) { | ||
5016 | e.stopImmediatePropagation(); | ||
5017 | } | ||
5018 | |||
5019 | this.stopPropagation(); | ||
5020 | } | ||
5021 | }; | ||
5022 | |||
5023 | // Create mouseenter/leave events using mouseover/out and event-time checks | ||
5024 | jQuery.each({ | ||
5025 | mouseenter: "mouseover", | ||
5026 | mouseleave: "mouseout", | ||
5027 | pointerenter: "pointerover", | ||
5028 | pointerleave: "pointerout" | ||
5029 | }, function( orig, fix ) { | ||
5030 | jQuery.event.special[ orig ] = { | ||
5031 | delegateType: fix, | ||
5032 | bindType: fix, | ||
5033 | |||
5034 | handle: function( event ) { | ||
5035 | var ret, | ||
5036 | target = this, | ||
5037 | related = event.relatedTarget, | ||
5038 | handleObj = event.handleObj; | ||
5039 | |||
5040 | // For mousenter/leave call the handler if related is outside the target. | ||
5041 | // NB: No relatedTarget if the mouse left/entered the browser window | ||
5042 | if ( !related || (related !== target && !jQuery.contains( target, related )) ) { | ||
5043 | event.type = handleObj.origType; | ||
5044 | ret = handleObj.handler.apply( this, arguments ); | ||
5045 | event.type = fix; | ||
5046 | } | ||
5047 | return ret; | ||
5048 | } | ||
5049 | }; | ||
5050 | }); | ||
5051 | |||
5052 | // IE submit delegation | ||
5053 | if ( !support.submitBubbles ) { | ||
5054 | |||
5055 | jQuery.event.special.submit = { | ||
5056 | setup: function() { | ||
5057 | // Only need this for delegated form submit events | ||
5058 | if ( jQuery.nodeName( this, "form" ) ) { | ||
5059 | return false; | ||
5060 | } | ||
5061 | |||
5062 | // Lazy-add a submit handler when a descendant form may potentially be submitted | ||
5063 | jQuery.event.add( this, "click._submit keypress._submit", function( e ) { | ||
5064 | // Node name check avoids a VML-related crash in IE (#9807) | ||
5065 | var elem = e.target, | ||
5066 | form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; | ||
5067 | if ( form && !jQuery._data( form, "submitBubbles" ) ) { | ||
5068 | jQuery.event.add( form, "submit._submit", function( event ) { | ||
5069 | event._submit_bubble = true; | ||
5070 | }); | ||
5071 | jQuery._data( form, "submitBubbles", true ); | ||
5072 | } | ||
5073 | }); | ||
5074 | // return undefined since we don't need an event listener | ||
5075 | }, | ||
5076 | |||
5077 | postDispatch: function( event ) { | ||
5078 | // If form was submitted by the user, bubble the event up the tree | ||
5079 | if ( event._submit_bubble ) { | ||
5080 | delete event._submit_bubble; | ||
5081 | if ( this.parentNode && !event.isTrigger ) { | ||
5082 | jQuery.event.simulate( "submit", this.parentNode, event, true ); | ||
5083 | } | ||
5084 | } | ||
5085 | }, | ||
5086 | |||
5087 | teardown: function() { | ||
5088 | // Only need this for delegated form submit events | ||
5089 | if ( jQuery.nodeName( this, "form" ) ) { | ||
5090 | return false; | ||
5091 | } | ||
5092 | |||
5093 | // Remove delegated handlers; cleanData eventually reaps submit handlers attached above | ||
5094 | jQuery.event.remove( this, "._submit" ); | ||
5095 | } | ||
5096 | }; | ||
5097 | } | ||
5098 | |||
5099 | // IE change delegation and checkbox/radio fix | ||
5100 | if ( !support.changeBubbles ) { | ||
5101 | |||
5102 | jQuery.event.special.change = { | ||
5103 | |||
5104 | setup: function() { | ||
5105 | |||
5106 | if ( rformElems.test( this.nodeName ) ) { | ||
5107 | // IE doesn't fire change on a check/radio until blur; trigger it on click | ||
5108 | // after a propertychange. Eat the blur-change in special.change.handle. | ||
5109 | // This still fires onchange a second time for check/radio after blur. | ||
5110 | if ( this.type === "checkbox" || this.type === "radio" ) { | ||
5111 | jQuery.event.add( this, "propertychange._change", function( event ) { | ||
5112 | if ( event.originalEvent.propertyName === "checked" ) { | ||
5113 | this._just_changed = true; | ||
5114 | } | ||
5115 | }); | ||
5116 | jQuery.event.add( this, "click._change", function( event ) { | ||
5117 | if ( this._just_changed && !event.isTrigger ) { | ||
5118 | this._just_changed = false; | ||
5119 | } | ||
5120 | // Allow triggered, simulated change events (#11500) | ||
5121 | jQuery.event.simulate( "change", this, event, true ); | ||
5122 | }); | ||
5123 | } | ||
5124 | return false; | ||
5125 | } | ||
5126 | // Delegated event; lazy-add a change handler on descendant inputs | ||
5127 | jQuery.event.add( this, "beforeactivate._change", function( e ) { | ||
5128 | var elem = e.target; | ||
5129 | |||
5130 | if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { | ||
5131 | jQuery.event.add( elem, "change._change", function( event ) { | ||
5132 | if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { | ||
5133 | jQuery.event.simulate( "change", this.parentNode, event, true ); | ||
5134 | } | ||
5135 | }); | ||
5136 | jQuery._data( elem, "changeBubbles", true ); | ||
5137 | } | ||
5138 | }); | ||
5139 | }, | ||
5140 | |||
5141 | handle: function( event ) { | ||
5142 | var elem = event.target; | ||
5143 | |||
5144 | // Swallow native change events from checkbox/radio, we already triggered them above | ||
5145 | if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { | ||
5146 | return event.handleObj.handler.apply( this, arguments ); | ||
5147 | } | ||
5148 | }, | ||
5149 | |||
5150 | teardown: function() { | ||
5151 | jQuery.event.remove( this, "._change" ); | ||
5152 | |||
5153 | return !rformElems.test( this.nodeName ); | ||
5154 | } | ||
5155 | }; | ||
5156 | } | ||
5157 | |||
5158 | // Create "bubbling" focus and blur events | ||
5159 | if ( !support.focusinBubbles ) { | ||
5160 | jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { | ||
5161 | |||
5162 | // Attach a single capturing handler on the document while someone wants focusin/focusout | ||
5163 | var handler = function( event ) { | ||
5164 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); | ||
5165 | }; | ||
5166 | |||
5167 | jQuery.event.special[ fix ] = { | ||
5168 | setup: function() { | ||
5169 | var doc = this.ownerDocument || this, | ||
5170 | attaches = jQuery._data( doc, fix ); | ||
5171 | |||
5172 | if ( !attaches ) { | ||
5173 | doc.addEventListener( orig, handler, true ); | ||
5174 | } | ||
5175 | jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); | ||
5176 | }, | ||
5177 | teardown: function() { | ||
5178 | var doc = this.ownerDocument || this, | ||
5179 | attaches = jQuery._data( doc, fix ) - 1; | ||
5180 | |||
5181 | if ( !attaches ) { | ||
5182 | doc.removeEventListener( orig, handler, true ); | ||
5183 | jQuery._removeData( doc, fix ); | ||
5184 | } else { | ||
5185 | jQuery._data( doc, fix, attaches ); | ||
5186 | } | ||
5187 | } | ||
5188 | }; | ||
5189 | }); | ||
5190 | } | ||
5191 | |||
5192 | jQuery.fn.extend({ | ||
5193 | |||
5194 | on: function( types, selector, data, fn, /*INTERNAL*/ one ) { | ||
5195 | var type, origFn; | ||
5196 | |||
5197 | // Types can be a map of types/handlers | ||
5198 | if ( typeof types === "object" ) { | ||
5199 | // ( types-Object, selector, data ) | ||
5200 | if ( typeof selector !== "string" ) { | ||
5201 | // ( types-Object, data ) | ||
5202 | data = data || selector; | ||
5203 | selector = undefined; | ||
5204 | } | ||
5205 | for ( type in types ) { | ||
5206 | this.on( type, selector, data, types[ type ], one ); | ||
5207 | } | ||
5208 | return this; | ||
5209 | } | ||
5210 | |||
5211 | if ( data == null && fn == null ) { | ||
5212 | // ( types, fn ) | ||
5213 | fn = selector; | ||
5214 | data = selector = undefined; | ||
5215 | } else if ( fn == null ) { | ||
5216 | if ( typeof selector === "string" ) { | ||
5217 | // ( types, selector, fn ) | ||
5218 | fn = data; | ||
5219 | data = undefined; | ||
5220 | } else { | ||
5221 | // ( types, data, fn ) | ||
5222 | fn = data; | ||
5223 | data = selector; | ||
5224 | selector = undefined; | ||
5225 | } | ||
5226 | } | ||
5227 | if ( fn === false ) { | ||
5228 | fn = returnFalse; | ||
5229 | } else if ( !fn ) { | ||
5230 | return this; | ||
5231 | } | ||
5232 | |||
5233 | if ( one === 1 ) { | ||
5234 | origFn = fn; | ||
5235 | fn = function( event ) { | ||
5236 | // Can use an empty set, since event contains the info | ||
5237 | jQuery().off( event ); | ||
5238 | return origFn.apply( this, arguments ); | ||
5239 | }; | ||
5240 | // Use same guid so caller can remove using origFn | ||
5241 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); | ||
5242 | } | ||
5243 | return this.each( function() { | ||
5244 | jQuery.event.add( this, types, fn, data, selector ); | ||
5245 | }); | ||
5246 | }, | ||
5247 | one: function( types, selector, data, fn ) { | ||
5248 | return this.on( types, selector, data, fn, 1 ); | ||
5249 | }, | ||
5250 | off: function( types, selector, fn ) { | ||
5251 | var handleObj, type; | ||
5252 | if ( types && types.preventDefault && types.handleObj ) { | ||
5253 | // ( event ) dispatched jQuery.Event | ||
5254 | handleObj = types.handleObj; | ||
5255 | jQuery( types.delegateTarget ).off( | ||
5256 | handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, | ||
5257 | handleObj.selector, | ||
5258 | handleObj.handler | ||
5259 | ); | ||
5260 | return this; | ||
5261 | } | ||
5262 | if ( typeof types === "object" ) { | ||
5263 | // ( types-object [, selector] ) | ||
5264 | for ( type in types ) { | ||
5265 | this.off( type, selector, types[ type ] ); | ||
5266 | } | ||
5267 | return this; | ||
5268 | } | ||
5269 | if ( selector === false || typeof selector === "function" ) { | ||
5270 | // ( types [, fn] ) | ||
5271 | fn = selector; | ||
5272 | selector = undefined; | ||
5273 | } | ||
5274 | if ( fn === false ) { | ||
5275 | fn = returnFalse; | ||
5276 | } | ||
5277 | return this.each(function() { | ||
5278 | jQuery.event.remove( this, types, fn, selector ); | ||
5279 | }); | ||
5280 | }, | ||
5281 | |||
5282 | trigger: function( type, data ) { | ||
5283 | return this.each(function() { | ||
5284 | jQuery.event.trigger( type, data, this ); | ||
5285 | }); | ||
5286 | }, | ||
5287 | triggerHandler: function( type, data ) { | ||
5288 | var elem = this[0]; | ||
5289 | if ( elem ) { | ||
5290 | return jQuery.event.trigger( type, data, elem, true ); | ||
5291 | } | ||
5292 | } | ||
5293 | }); | ||
5294 | |||
5295 | |||
5296 | function createSafeFragment( document ) { | ||
5297 | var list = nodeNames.split( "|" ), | ||
5298 | safeFrag = document.createDocumentFragment(); | ||
5299 | |||
5300 | if ( safeFrag.createElement ) { | ||
5301 | while ( list.length ) { | ||
5302 | safeFrag.createElement( | ||
5303 | list.pop() | ||
5304 | ); | ||
5305 | } | ||
5306 | } | ||
5307 | return safeFrag; | ||
5308 | } | ||
5309 | |||
5310 | var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + | ||
5311 | "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", | ||
5312 | rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, | ||
5313 | rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), | ||
5314 | rleadingWhitespace = /^\s+/, | ||
5315 | rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | ||
5316 | rtagName = /<([\w:]+)/, | ||
5317 | rtbody = /<tbody/i, | ||
5318 | rhtml = /<|&#?\w+;/, | ||
5319 | rnoInnerhtml = /<(?:script|style|link)/i, | ||
5320 | // checked="checked" or checked | ||
5321 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | ||
5322 | rscriptType = /^$|\/(?:java|ecma)script/i, | ||
5323 | rscriptTypeMasked = /^true\/(.*)/, | ||
5324 | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | ||
5325 | |||
5326 | // We have to close these tags to support XHTML (#13200) | ||
5327 | wrapMap = { | ||
5328 | option: [ 1, "<select multiple='multiple'>", "</select>" ], | ||
5329 | legend: [ 1, "<fieldset>", "</fieldset>" ], | ||
5330 | area: [ 1, "<map>", "</map>" ], | ||
5331 | param: [ 1, "<object>", "</object>" ], | ||
5332 | thead: [ 1, "<table>", "</table>" ], | ||
5333 | tr: [ 2, "<table><tbody>", "</tbody></table>" ], | ||
5334 | col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], | ||
5335 | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], | ||
5336 | |||
5337 | // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, | ||
5338 | // unless wrapped in a div with non-breaking characters in front of it. | ||
5339 | _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] | ||
5340 | }, | ||
5341 | safeFragment = createSafeFragment( document ), | ||
5342 | fragmentDiv = safeFragment.appendChild( document.createElement("div") ); | ||
5343 | |||
5344 | wrapMap.optgroup = wrapMap.option; | ||
5345 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | ||
5346 | wrapMap.th = wrapMap.td; | ||
5347 | |||
5348 | function getAll( context, tag ) { | ||
5349 | var elems, elem, | ||
5350 | i = 0, | ||
5351 | found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : | ||
5352 | typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : | ||
5353 | undefined; | ||
5354 | |||
5355 | if ( !found ) { | ||
5356 | for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { | ||
5357 | if ( !tag || jQuery.nodeName( elem, tag ) ) { | ||
5358 | found.push( elem ); | ||
5359 | } else { | ||
5360 | jQuery.merge( found, getAll( elem, tag ) ); | ||
5361 | } | ||
5362 | } | ||
5363 | } | ||
5364 | |||
5365 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? | ||
5366 | jQuery.merge( [ context ], found ) : | ||
5367 | found; | ||
5368 | } | ||
5369 | |||
5370 | // Used in buildFragment, fixes the defaultChecked property | ||
5371 | function fixDefaultChecked( elem ) { | ||
5372 | if ( rcheckableType.test( elem.type ) ) { | ||
5373 | elem.defaultChecked = elem.checked; | ||
5374 | } | ||
5375 | } | ||
5376 | |||
5377 | // Support: IE<8 | ||
5378 | // Manipulating tables requires a tbody | ||
5379 | function manipulationTarget( elem, content ) { | ||
5380 | return jQuery.nodeName( elem, "table" ) && | ||
5381 | jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? | ||
5382 | |||
5383 | elem.getElementsByTagName("tbody")[0] || | ||
5384 | elem.appendChild( elem.ownerDocument.createElement("tbody") ) : | ||
5385 | elem; | ||
5386 | } | ||
5387 | |||
5388 | // Replace/restore the type attribute of script elements for safe DOM manipulation | ||
5389 | function disableScript( elem ) { | ||
5390 | elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; | ||
5391 | return elem; | ||
5392 | } | ||
5393 | function restoreScript( elem ) { | ||
5394 | var match = rscriptTypeMasked.exec( elem.type ); | ||
5395 | if ( match ) { | ||
5396 | elem.type = match[1]; | ||
5397 | } else { | ||
5398 | elem.removeAttribute("type"); | ||
5399 | } | ||
5400 | return elem; | ||
5401 | } | ||
5402 | |||
5403 | // Mark scripts as having already been evaluated | ||
5404 | function setGlobalEval( elems, refElements ) { | ||
5405 | var elem, | ||
5406 | i = 0; | ||
5407 | for ( ; (elem = elems[i]) != null; i++ ) { | ||
5408 | jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); | ||
5409 | } | ||
5410 | } | ||
5411 | |||
5412 | function cloneCopyEvent( src, dest ) { | ||
5413 | |||
5414 | if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { | ||
5415 | return; | ||
5416 | } | ||
5417 | |||
5418 | var type, i, l, | ||
5419 | oldData = jQuery._data( src ), | ||
5420 | curData = jQuery._data( dest, oldData ), | ||
5421 | events = oldData.events; | ||
5422 | |||
5423 | if ( events ) { | ||
5424 | delete curData.handle; | ||
5425 | curData.events = {}; | ||
5426 | |||
5427 | for ( type in events ) { | ||
5428 | for ( i = 0, l = events[ type ].length; i < l; i++ ) { | ||
5429 | jQuery.event.add( dest, type, events[ type ][ i ] ); | ||
5430 | } | ||
5431 | } | ||
5432 | } | ||
5433 | |||
5434 | // make the cloned public data object a copy from the original | ||
5435 | if ( curData.data ) { | ||
5436 | curData.data = jQuery.extend( {}, curData.data ); | ||
5437 | } | ||
5438 | } | ||
5439 | |||
5440 | function fixCloneNodeIssues( src, dest ) { | ||
5441 | var nodeName, e, data; | ||
5442 | |||
5443 | // We do not need to do anything for non-Elements | ||
5444 | if ( dest.nodeType !== 1 ) { | ||
5445 | return; | ||
5446 | } | ||
5447 | |||
5448 | nodeName = dest.nodeName.toLowerCase(); | ||
5449 | |||
5450 | // IE6-8 copies events bound via attachEvent when using cloneNode. | ||
5451 | if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { | ||
5452 | data = jQuery._data( dest ); | ||
5453 | |||
5454 | for ( e in data.events ) { | ||
5455 | jQuery.removeEvent( dest, e, data.handle ); | ||
5456 | } | ||
5457 | |||
5458 | // Event data gets referenced instead of copied if the expando gets copied too | ||
5459 | dest.removeAttribute( jQuery.expando ); | ||
5460 | } | ||
5461 | |||
5462 | // IE blanks contents when cloning scripts, and tries to evaluate newly-set text | ||
5463 | if ( nodeName === "script" && dest.text !== src.text ) { | ||
5464 | disableScript( dest ).text = src.text; | ||
5465 | restoreScript( dest ); | ||
5466 | |||
5467 | // IE6-10 improperly clones children of object elements using classid. | ||
5468 | // IE10 throws NoModificationAllowedError if parent is null, #12132. | ||
5469 | } else if ( nodeName === "object" ) { | ||
5470 | if ( dest.parentNode ) { | ||
5471 | dest.outerHTML = src.outerHTML; | ||
5472 | } | ||
5473 | |||
5474 | // This path appears unavoidable for IE9. When cloning an object | ||
5475 | // element in IE9, the outerHTML strategy above is not sufficient. | ||
5476 | // If the src has innerHTML and the destination does not, | ||
5477 | // copy the src.innerHTML into the dest.innerHTML. #10324 | ||
5478 | if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { | ||
5479 | dest.innerHTML = src.innerHTML; | ||
5480 | } | ||
5481 | |||
5482 | } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { | ||
5483 | // IE6-8 fails to persist the checked state of a cloned checkbox | ||
5484 | // or radio button. Worse, IE6-7 fail to give the cloned element | ||
5485 | // a checked appearance if the defaultChecked value isn't also set | ||
5486 | |||
5487 | dest.defaultChecked = dest.checked = src.checked; | ||
5488 | |||
5489 | // IE6-7 get confused and end up setting the value of a cloned | ||
5490 | // checkbox/radio button to an empty string instead of "on" | ||
5491 | if ( dest.value !== src.value ) { | ||
5492 | dest.value = src.value; | ||
5493 | } | ||
5494 | |||
5495 | // IE6-8 fails to return the selected option to the default selected | ||
5496 | // state when cloning options | ||
5497 | } else if ( nodeName === "option" ) { | ||
5498 | dest.defaultSelected = dest.selected = src.defaultSelected; | ||
5499 | |||
5500 | // IE6-8 fails to set the defaultValue to the correct value when | ||
5501 | // cloning other types of input fields | ||
5502 | } else if ( nodeName === "input" || nodeName === "textarea" ) { | ||
5503 | dest.defaultValue = src.defaultValue; | ||
5504 | } | ||
5505 | } | ||
5506 | |||
5507 | jQuery.extend({ | ||
5508 | clone: function( elem, dataAndEvents, deepDataAndEvents ) { | ||
5509 | var destElements, node, clone, i, srcElements, | ||
5510 | inPage = jQuery.contains( elem.ownerDocument, elem ); | ||
5511 | |||
5512 | if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { | ||
5513 | clone = elem.cloneNode( true ); | ||
5514 | |||
5515 | // IE<=8 does not properly clone detached, unknown element nodes | ||
5516 | } else { | ||
5517 | fragmentDiv.innerHTML = elem.outerHTML; | ||
5518 | fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); | ||
5519 | } | ||
5520 | |||
5521 | if ( (!support.noCloneEvent || !support.noCloneChecked) && | ||
5522 | (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { | ||
5523 | |||
5524 | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 | ||
5525 | destElements = getAll( clone ); | ||
5526 | srcElements = getAll( elem ); | ||
5527 | |||
5528 | // Fix all IE cloning issues | ||
5529 | for ( i = 0; (node = srcElements[i]) != null; ++i ) { | ||
5530 | // Ensure that the destination node is not null; Fixes #9587 | ||
5531 | if ( destElements[i] ) { | ||
5532 | fixCloneNodeIssues( node, destElements[i] ); | ||
5533 | } | ||
5534 | } | ||
5535 | } | ||
5536 | |||
5537 | // Copy the events from the original to the clone | ||
5538 | if ( dataAndEvents ) { | ||
5539 | if ( deepDataAndEvents ) { | ||
5540 | srcElements = srcElements || getAll( elem ); | ||
5541 | destElements = destElements || getAll( clone ); | ||
5542 | |||
5543 | for ( i = 0; (node = srcElements[i]) != null; i++ ) { | ||
5544 | cloneCopyEvent( node, destElements[i] ); | ||
5545 | } | ||
5546 | } else { | ||
5547 | cloneCopyEvent( elem, clone ); | ||
5548 | } | ||
5549 | } | ||
5550 | |||
5551 | // Preserve script evaluation history | ||
5552 | destElements = getAll( clone, "script" ); | ||
5553 | if ( destElements.length > 0 ) { | ||
5554 | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); | ||
5555 | } | ||
5556 | |||
5557 | destElements = srcElements = node = null; | ||
5558 | |||
5559 | // Return the cloned set | ||
5560 | return clone; | ||
5561 | }, | ||
5562 | |||
5563 | buildFragment: function( elems, context, scripts, selection ) { | ||
5564 | var j, elem, contains, | ||
5565 | tmp, tag, tbody, wrap, | ||
5566 | l = elems.length, | ||
5567 | |||
5568 | // Ensure a safe fragment | ||
5569 | safe = createSafeFragment( context ), | ||
5570 | |||
5571 | nodes = [], | ||
5572 | i = 0; | ||
5573 | |||
5574 | for ( ; i < l; i++ ) { | ||
5575 | elem = elems[ i ]; | ||
5576 | |||
5577 | if ( elem || elem === 0 ) { | ||
5578 | |||
5579 | // Add nodes directly | ||
5580 | if ( jQuery.type( elem ) === "object" ) { | ||
5581 | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); | ||
5582 | |||
5583 | // Convert non-html into a text node | ||
5584 | } else if ( !rhtml.test( elem ) ) { | ||
5585 | nodes.push( context.createTextNode( elem ) ); | ||
5586 | |||
5587 | // Convert html into DOM nodes | ||
5588 | } else { | ||
5589 | tmp = tmp || safe.appendChild( context.createElement("div") ); | ||
5590 | |||
5591 | // Deserialize a standard representation | ||
5592 | tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); | ||
5593 | wrap = wrapMap[ tag ] || wrapMap._default; | ||
5594 | |||
5595 | tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; | ||
5596 | |||
5597 | // Descend through wrappers to the right content | ||
5598 | j = wrap[0]; | ||
5599 | while ( j-- ) { | ||
5600 | tmp = tmp.lastChild; | ||
5601 | } | ||
5602 | |||
5603 | // Manually add leading whitespace removed by IE | ||
5604 | if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { | ||
5605 | nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); | ||
5606 | } | ||
5607 | |||
5608 | // Remove IE's autoinserted <tbody> from table fragments | ||
5609 | if ( !support.tbody ) { | ||
5610 | |||
5611 | // String was a <table>, *may* have spurious <tbody> | ||
5612 | elem = tag === "table" && !rtbody.test( elem ) ? | ||
5613 | tmp.firstChild : | ||
5614 | |||
5615 | // String was a bare <thead> or <tfoot> | ||
5616 | wrap[1] === "<table>" && !rtbody.test( elem ) ? | ||
5617 | tmp : | ||
5618 | 0; | ||
5619 | |||
5620 | j = elem && elem.childNodes.length; | ||
5621 | while ( j-- ) { | ||
5622 | if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { | ||
5623 | elem.removeChild( tbody ); | ||
5624 | } | ||
5625 | } | ||
5626 | } | ||
5627 | |||
5628 | jQuery.merge( nodes, tmp.childNodes ); | ||
5629 | |||
5630 | // Fix #12392 for WebKit and IE > 9 | ||
5631 | tmp.textContent = ""; | ||
5632 | |||
5633 | // Fix #12392 for oldIE | ||
5634 | while ( tmp.firstChild ) { | ||
5635 | tmp.removeChild( tmp.firstChild ); | ||
5636 | } | ||
5637 | |||
5638 | // Remember the top-level container for proper cleanup | ||
5639 | tmp = safe.lastChild; | ||
5640 | } | ||
5641 | } | ||
5642 | } | ||
5643 | |||
5644 | // Fix #11356: Clear elements from fragment | ||
5645 | if ( tmp ) { | ||
5646 | safe.removeChild( tmp ); | ||
5647 | } | ||
5648 | |||
5649 | // Reset defaultChecked for any radios and checkboxes | ||
5650 | // about to be appended to the DOM in IE 6/7 (#8060) | ||
5651 | if ( !support.appendChecked ) { | ||
5652 | jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); | ||
5653 | } | ||
5654 | |||
5655 | i = 0; | ||
5656 | while ( (elem = nodes[ i++ ]) ) { | ||
5657 | |||
5658 | // #4087 - If origin and destination elements are the same, and this is | ||
5659 | // that element, do not do anything | ||
5660 | if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { | ||
5661 | continue; | ||
5662 | } | ||
5663 | |||
5664 | contains = jQuery.contains( elem.ownerDocument, elem ); | ||
5665 | |||
5666 | // Append to fragment | ||
5667 | tmp = getAll( safe.appendChild( elem ), "script" ); | ||
5668 | |||
5669 | // Preserve script evaluation history | ||
5670 | if ( contains ) { | ||
5671 | setGlobalEval( tmp ); | ||
5672 | } | ||
5673 | |||
5674 | // Capture executables | ||
5675 | if ( scripts ) { | ||
5676 | j = 0; | ||
5677 | while ( (elem = tmp[ j++ ]) ) { | ||
5678 | if ( rscriptType.test( elem.type || "" ) ) { | ||
5679 | scripts.push( elem ); | ||
5680 | } | ||
5681 | } | ||
5682 | } | ||
5683 | } | ||
5684 | |||
5685 | tmp = null; | ||
5686 | |||
5687 | return safe; | ||
5688 | }, | ||
5689 | |||
5690 | cleanData: function( elems, /* internal */ acceptData ) { | ||
5691 | var elem, type, id, data, | ||
5692 | i = 0, | ||
5693 | internalKey = jQuery.expando, | ||
5694 | cache = jQuery.cache, | ||
5695 | deleteExpando = support.deleteExpando, | ||
5696 | special = jQuery.event.special; | ||
5697 | |||
5698 | for ( ; (elem = elems[i]) != null; i++ ) { | ||
5699 | if ( acceptData || jQuery.acceptData( elem ) ) { | ||
5700 | |||
5701 | id = elem[ internalKey ]; | ||
5702 | data = id && cache[ id ]; | ||
5703 | |||
5704 | if ( data ) { | ||
5705 | if ( data.events ) { | ||
5706 | for ( type in data.events ) { | ||
5707 | if ( special[ type ] ) { | ||
5708 | jQuery.event.remove( elem, type ); | ||
5709 | |||
5710 | // This is a shortcut to avoid jQuery.event.remove's overhead | ||
5711 | } else { | ||
5712 | jQuery.removeEvent( elem, type, data.handle ); | ||
5713 | } | ||
5714 | } | ||
5715 | } | ||
5716 | |||
5717 | // Remove cache only if it was not already removed by jQuery.event.remove | ||
5718 | if ( cache[ id ] ) { | ||
5719 | |||
5720 | delete cache[ id ]; | ||
5721 | |||
5722 | // IE does not allow us to delete expando properties from nodes, | ||
5723 | // nor does it have a removeAttribute function on Document nodes; | ||
5724 | // we must handle all of these cases | ||
5725 | if ( deleteExpando ) { | ||
5726 | delete elem[ internalKey ]; | ||
5727 | |||
5728 | } else if ( typeof elem.removeAttribute !== strundefined ) { | ||
5729 | elem.removeAttribute( internalKey ); | ||
5730 | |||
5731 | } else { | ||
5732 | elem[ internalKey ] = null; | ||
5733 | } | ||
5734 | |||
5735 | deletedIds.push( id ); | ||
5736 | } | ||
5737 | } | ||
5738 | } | ||
5739 | } | ||
5740 | } | ||
5741 | }); | ||
5742 | |||
5743 | jQuery.fn.extend({ | ||
5744 | text: function( value ) { | ||
5745 | return access( this, function( value ) { | ||
5746 | return value === undefined ? | ||
5747 | jQuery.text( this ) : | ||
5748 | this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); | ||
5749 | }, null, value, arguments.length ); | ||
5750 | }, | ||
5751 | |||
5752 | append: function() { | ||
5753 | return this.domManip( arguments, function( elem ) { | ||
5754 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
5755 | var target = manipulationTarget( this, elem ); | ||
5756 | target.appendChild( elem ); | ||
5757 | } | ||
5758 | }); | ||
5759 | }, | ||
5760 | |||
5761 | prepend: function() { | ||
5762 | return this.domManip( arguments, function( elem ) { | ||
5763 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
5764 | var target = manipulationTarget( this, elem ); | ||
5765 | target.insertBefore( elem, target.firstChild ); | ||
5766 | } | ||
5767 | }); | ||
5768 | }, | ||
5769 | |||
5770 | before: function() { | ||
5771 | return this.domManip( arguments, function( elem ) { | ||
5772 | if ( this.parentNode ) { | ||
5773 | this.parentNode.insertBefore( elem, this ); | ||
5774 | } | ||
5775 | }); | ||
5776 | }, | ||
5777 | |||
5778 | after: function() { | ||
5779 | return this.domManip( arguments, function( elem ) { | ||
5780 | if ( this.parentNode ) { | ||
5781 | this.parentNode.insertBefore( elem, this.nextSibling ); | ||
5782 | } | ||
5783 | }); | ||
5784 | }, | ||
5785 | |||
5786 | remove: function( selector, keepData /* Internal Use Only */ ) { | ||
5787 | var elem, | ||
5788 | elems = selector ? jQuery.filter( selector, this ) : this, | ||
5789 | i = 0; | ||
5790 | |||
5791 | for ( ; (elem = elems[i]) != null; i++ ) { | ||
5792 | |||
5793 | if ( !keepData && elem.nodeType === 1 ) { | ||
5794 | jQuery.cleanData( getAll( elem ) ); | ||
5795 | } | ||
5796 | |||
5797 | if ( elem.parentNode ) { | ||
5798 | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { | ||
5799 | setGlobalEval( getAll( elem, "script" ) ); | ||
5800 | } | ||
5801 | elem.parentNode.removeChild( elem ); | ||
5802 | } | ||
5803 | } | ||
5804 | |||
5805 | return this; | ||
5806 | }, | ||
5807 | |||
5808 | empty: function() { | ||
5809 | var elem, | ||
5810 | i = 0; | ||
5811 | |||
5812 | for ( ; (elem = this[i]) != null; i++ ) { | ||
5813 | // Remove element nodes and prevent memory leaks | ||
5814 | if ( elem.nodeType === 1 ) { | ||
5815 | jQuery.cleanData( getAll( elem, false ) ); | ||
5816 | } | ||
5817 | |||
5818 | // Remove any remaining nodes | ||
5819 | while ( elem.firstChild ) { | ||
5820 | elem.removeChild( elem.firstChild ); | ||
5821 | } | ||
5822 | |||
5823 | // If this is a select, ensure that it displays empty (#12336) | ||
5824 | // Support: IE<9 | ||
5825 | if ( elem.options && jQuery.nodeName( elem, "select" ) ) { | ||
5826 | elem.options.length = 0; | ||
5827 | } | ||
5828 | } | ||
5829 | |||
5830 | return this; | ||
5831 | }, | ||
5832 | |||
5833 | clone: function( dataAndEvents, deepDataAndEvents ) { | ||
5834 | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; | ||
5835 | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; | ||
5836 | |||
5837 | return this.map(function() { | ||
5838 | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); | ||
5839 | }); | ||
5840 | }, | ||
5841 | |||
5842 | html: function( value ) { | ||
5843 | return access( this, function( value ) { | ||
5844 | var elem = this[ 0 ] || {}, | ||
5845 | i = 0, | ||
5846 | l = this.length; | ||
5847 | |||
5848 | if ( value === undefined ) { | ||
5849 | return elem.nodeType === 1 ? | ||
5850 | elem.innerHTML.replace( rinlinejQuery, "" ) : | ||
5851 | undefined; | ||
5852 | } | ||
5853 | |||
5854 | // See if we can take a shortcut and just use innerHTML | ||
5855 | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && | ||
5856 | ( support.htmlSerialize || !rnoshimcache.test( value ) ) && | ||
5857 | ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && | ||
5858 | !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { | ||
5859 | |||
5860 | value = value.replace( rxhtmlTag, "<$1></$2>" ); | ||
5861 | |||
5862 | try { | ||
5863 | for (; i < l; i++ ) { | ||
5864 | // Remove element nodes and prevent memory leaks | ||
5865 | elem = this[i] || {}; | ||
5866 | if ( elem.nodeType === 1 ) { | ||
5867 | jQuery.cleanData( getAll( elem, false ) ); | ||
5868 | elem.innerHTML = value; | ||
5869 | } | ||
5870 | } | ||
5871 | |||
5872 | elem = 0; | ||
5873 | |||
5874 | // If using innerHTML throws an exception, use the fallback method | ||
5875 | } catch(e) {} | ||
5876 | } | ||
5877 | |||
5878 | if ( elem ) { | ||
5879 | this.empty().append( value ); | ||
5880 | } | ||
5881 | }, null, value, arguments.length ); | ||
5882 | }, | ||
5883 | |||
5884 | replaceWith: function() { | ||
5885 | var arg = arguments[ 0 ]; | ||
5886 | |||
5887 | // Make the changes, replacing each context element with the new content | ||
5888 | this.domManip( arguments, function( elem ) { | ||
5889 | arg = this.parentNode; | ||
5890 | |||
5891 | jQuery.cleanData( getAll( this ) ); | ||
5892 | |||
5893 | if ( arg ) { | ||
5894 | arg.replaceChild( elem, this ); | ||
5895 | } | ||
5896 | }); | ||
5897 | |||
5898 | // Force removal if there was no new content (e.g., from empty arguments) | ||
5899 | return arg && (arg.length || arg.nodeType) ? this : this.remove(); | ||
5900 | }, | ||
5901 | |||
5902 | detach: function( selector ) { | ||
5903 | return this.remove( selector, true ); | ||
5904 | }, | ||
5905 | |||
5906 | domManip: function( args, callback ) { | ||
5907 | |||
5908 | // Flatten any nested arrays | ||
5909 | args = concat.apply( [], args ); | ||
5910 | |||
5911 | var first, node, hasScripts, | ||
5912 | scripts, doc, fragment, | ||
5913 | i = 0, | ||
5914 | l = this.length, | ||
5915 | set = this, | ||
5916 | iNoClone = l - 1, | ||
5917 | value = args[0], | ||
5918 | isFunction = jQuery.isFunction( value ); | ||
5919 | |||
5920 | // We can't cloneNode fragments that contain checked, in WebKit | ||
5921 | if ( isFunction || | ||
5922 | ( l > 1 && typeof value === "string" && | ||
5923 | !support.checkClone && rchecked.test( value ) ) ) { | ||
5924 | return this.each(function( index ) { | ||
5925 | var self = set.eq( index ); | ||
5926 | if ( isFunction ) { | ||
5927 | args[0] = value.call( this, index, self.html() ); | ||
5928 | } | ||
5929 | self.domManip( args, callback ); | ||
5930 | }); | ||
5931 | } | ||
5932 | |||
5933 | if ( l ) { | ||
5934 | fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); | ||
5935 | first = fragment.firstChild; | ||
5936 | |||
5937 | if ( fragment.childNodes.length === 1 ) { | ||
5938 | fragment = first; | ||
5939 | } | ||
5940 | |||
5941 | if ( first ) { | ||
5942 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); | ||
5943 | hasScripts = scripts.length; | ||
5944 | |||
5945 | // Use the original fragment for the last item instead of the first because it can end up | ||
5946 | // being emptied incorrectly in certain situations (#8070). | ||
5947 | for ( ; i < l; i++ ) { | ||
5948 | node = fragment; | ||
5949 | |||
5950 | if ( i !== iNoClone ) { | ||
5951 | node = jQuery.clone( node, true, true ); | ||
5952 | |||
5953 | // Keep references to cloned scripts for later restoration | ||
5954 | if ( hasScripts ) { | ||
5955 | jQuery.merge( scripts, getAll( node, "script" ) ); | ||
5956 | } | ||
5957 | } | ||
5958 | |||
5959 | callback.call( this[i], node, i ); | ||
5960 | } | ||
5961 | |||
5962 | if ( hasScripts ) { | ||
5963 | doc = scripts[ scripts.length - 1 ].ownerDocument; | ||
5964 | |||
5965 | // Reenable scripts | ||
5966 | jQuery.map( scripts, restoreScript ); | ||
5967 | |||
5968 | // Evaluate executable scripts on first document insertion | ||
5969 | for ( i = 0; i < hasScripts; i++ ) { | ||
5970 | node = scripts[ i ]; | ||
5971 | if ( rscriptType.test( node.type || "" ) && | ||
5972 | !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { | ||
5973 | |||
5974 | if ( node.src ) { | ||
5975 | // Optional AJAX dependency, but won't run scripts if not present | ||
5976 | if ( jQuery._evalUrl ) { | ||
5977 | jQuery._evalUrl( node.src ); | ||
5978 | } | ||
5979 | } else { | ||
5980 | jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); | ||
5981 | } | ||
5982 | } | ||
5983 | } | ||
5984 | } | ||
5985 | |||
5986 | // Fix #11809: Avoid leaking memory | ||
5987 | fragment = first = null; | ||
5988 | } | ||
5989 | } | ||
5990 | |||
5991 | return this; | ||
5992 | } | ||
5993 | }); | ||
5994 | |||
5995 | jQuery.each({ | ||
5996 | appendTo: "append", | ||
5997 | prependTo: "prepend", | ||
5998 | insertBefore: "before", | ||
5999 | insertAfter: "after", | ||
6000 | replaceAll: "replaceWith" | ||
6001 | }, function( name, original ) { | ||
6002 | jQuery.fn[ name ] = function( selector ) { | ||
6003 | var elems, | ||
6004 | i = 0, | ||
6005 | ret = [], | ||
6006 | insert = jQuery( selector ), | ||
6007 | last = insert.length - 1; | ||
6008 | |||
6009 | for ( ; i <= last; i++ ) { | ||
6010 | elems = i === last ? this : this.clone(true); | ||
6011 | jQuery( insert[i] )[ original ]( elems ); | ||
6012 | |||
6013 | // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() | ||
6014 | push.apply( ret, elems.get() ); | ||
6015 | } | ||
6016 | |||
6017 | return this.pushStack( ret ); | ||
6018 | }; | ||
6019 | }); | ||
6020 | |||
6021 | |||
6022 | var iframe, | ||
6023 | elemdisplay = {}; | ||
6024 | |||
6025 | /** | ||
6026 | * Retrieve the actual display of a element | ||
6027 | * @param {String} name nodeName of the element | ||
6028 | * @param {Object} doc Document object | ||
6029 | */ | ||
6030 | // Called only from within defaultDisplay | ||
6031 | function actualDisplay( name, doc ) { | ||
6032 | var style, | ||
6033 | elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), | ||
6034 | |||
6035 | // getDefaultComputedStyle might be reliably used only on attached element | ||
6036 | display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? | ||
6037 | |||
6038 | // Use of this method is a temporary fix (more like optmization) until something better comes along, | ||
6039 | // since it was removed from specification and supported only in FF | ||
6040 | style.display : jQuery.css( elem[ 0 ], "display" ); | ||
6041 | |||
6042 | // We don't have any data stored on the element, | ||
6043 | // so use "detach" method as fast way to get rid of the element | ||
6044 | elem.detach(); | ||
6045 | |||
6046 | return display; | ||
6047 | } | ||
6048 | |||
6049 | /** | ||
6050 | * Try to determine the default display value of an element | ||
6051 | * @param {String} nodeName | ||
6052 | */ | ||
6053 | function defaultDisplay( nodeName ) { | ||
6054 | var doc = document, | ||
6055 | display = elemdisplay[ nodeName ]; | ||
6056 | |||
6057 | if ( !display ) { | ||
6058 | display = actualDisplay( nodeName, doc ); | ||
6059 | |||
6060 | // If the simple way fails, read from inside an iframe | ||
6061 | if ( display === "none" || !display ) { | ||
6062 | |||
6063 | // Use the already-created iframe if possible | ||
6064 | iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); | ||
6065 | |||
6066 | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse | ||
6067 | doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; | ||
6068 | |||
6069 | // Support: IE | ||
6070 | doc.write(); | ||
6071 | doc.close(); | ||
6072 | |||
6073 | display = actualDisplay( nodeName, doc ); | ||
6074 | iframe.detach(); | ||
6075 | } | ||
6076 | |||
6077 | // Store the correct default display | ||
6078 | elemdisplay[ nodeName ] = display; | ||
6079 | } | ||
6080 | |||
6081 | return display; | ||
6082 | } | ||
6083 | |||
6084 | |||
6085 | (function() { | ||
6086 | var shrinkWrapBlocksVal; | ||
6087 | |||
6088 | support.shrinkWrapBlocks = function() { | ||
6089 | if ( shrinkWrapBlocksVal != null ) { | ||
6090 | return shrinkWrapBlocksVal; | ||
6091 | } | ||
6092 | |||
6093 | // Will be changed later if needed. | ||
6094 | shrinkWrapBlocksVal = false; | ||
6095 | |||
6096 | // Minified: var b,c,d | ||
6097 | var div, body, container; | ||
6098 | |||
6099 | body = document.getElementsByTagName( "body" )[ 0 ]; | ||
6100 | if ( !body || !body.style ) { | ||
6101 | // Test fired too early or in an unsupported environment, exit. | ||
6102 | return; | ||
6103 | } | ||
6104 | |||
6105 | // Setup | ||
6106 | div = document.createElement( "div" ); | ||
6107 | container = document.createElement( "div" ); | ||
6108 | container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; | ||
6109 | body.appendChild( container ).appendChild( div ); | ||
6110 | |||
6111 | // Support: IE6 | ||
6112 | // Check if elements with layout shrink-wrap their children | ||
6113 | if ( typeof div.style.zoom !== strundefined ) { | ||
6114 | // Reset CSS: box-sizing; display; margin; border | ||
6115 | div.style.cssText = | ||
6116 | // Support: Firefox<29, Android 2.3 | ||
6117 | // Vendor-prefix box-sizing | ||
6118 | "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + | ||
6119 | "box-sizing:content-box;display:block;margin:0;border:0;" + | ||
6120 | "padding:1px;width:1px;zoom:1"; | ||
6121 | div.appendChild( document.createElement( "div" ) ).style.width = "5px"; | ||
6122 | shrinkWrapBlocksVal = div.offsetWidth !== 3; | ||
6123 | } | ||
6124 | |||
6125 | body.removeChild( container ); | ||
6126 | |||
6127 | return shrinkWrapBlocksVal; | ||
6128 | }; | ||
6129 | |||
6130 | })(); | ||
6131 | var rmargin = (/^margin/); | ||
6132 | |||
6133 | var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); | ||
6134 | |||
6135 | |||
6136 | |||
6137 | var getStyles, curCSS, | ||
6138 | rposition = /^(top|right|bottom|left)$/; | ||
6139 | |||
6140 | if ( window.getComputedStyle ) { | ||
6141 | getStyles = function( elem ) { | ||
6142 | // Support: IE<=11+, Firefox<=30+ (#15098, #14150) | ||
6143 | // IE throws on elements created in popups | ||
6144 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" | ||
6145 | if ( elem.ownerDocument.defaultView.opener ) { | ||
6146 | return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); | ||
6147 | } | ||
6148 | |||
6149 | return window.getComputedStyle( elem, null ); | ||
6150 | }; | ||
6151 | |||
6152 | curCSS = function( elem, name, computed ) { | ||
6153 | var width, minWidth, maxWidth, ret, | ||
6154 | style = elem.style; | ||
6155 | |||
6156 | computed = computed || getStyles( elem ); | ||
6157 | |||
6158 | // getPropertyValue is only needed for .css('filter') in IE9, see #12537 | ||
6159 | ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; | ||
6160 | |||
6161 | if ( computed ) { | ||
6162 | |||
6163 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { | ||
6164 | ret = jQuery.style( elem, name ); | ||
6165 | } | ||
6166 | |||
6167 | // A tribute to the "awesome hack by Dean Edwards" | ||
6168 | // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right | ||
6169 | // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels | ||
6170 | // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values | ||
6171 | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { | ||
6172 | |||
6173 | // Remember the original values | ||
6174 | width = style.width; | ||
6175 | minWidth = style.minWidth; | ||
6176 | maxWidth = style.maxWidth; | ||
6177 | |||
6178 | // Put in the new values to get a computed value out | ||
6179 | style.minWidth = style.maxWidth = style.width = ret; | ||
6180 | ret = computed.width; | ||
6181 | |||
6182 | // Revert the changed values | ||
6183 | style.width = width; | ||
6184 | style.minWidth = minWidth; | ||
6185 | style.maxWidth = maxWidth; | ||
6186 | } | ||
6187 | } | ||
6188 | |||
6189 | // Support: IE | ||
6190 | // IE returns zIndex value as an integer. | ||
6191 | return ret === undefined ? | ||
6192 | ret : | ||
6193 | ret + ""; | ||
6194 | }; | ||
6195 | } else if ( document.documentElement.currentStyle ) { | ||
6196 | getStyles = function( elem ) { | ||
6197 | return elem.currentStyle; | ||
6198 | }; | ||
6199 | |||
6200 | curCSS = function( elem, name, computed ) { | ||
6201 | var left, rs, rsLeft, ret, | ||
6202 | style = elem.style; | ||
6203 | |||
6204 | computed = computed || getStyles( elem ); | ||
6205 | ret = computed ? computed[ name ] : undefined; | ||
6206 | |||
6207 | // Avoid setting ret to empty string here | ||
6208 | // so we don't default to auto | ||
6209 | if ( ret == null && style && style[ name ] ) { | ||
6210 | ret = style[ name ]; | ||
6211 | } | ||
6212 | |||
6213 | // From the awesome hack by Dean Edwards | ||
6214 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||
6215 | |||
6216 | // If we're not dealing with a regular pixel number | ||
6217 | // but a number that has a weird ending, we need to convert it to pixels | ||
6218 | // but not position css attributes, as those are proportional to the parent element instead | ||
6219 | // and we can't measure the parent instead because it might trigger a "stacking dolls" problem | ||
6220 | if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { | ||
6221 | |||
6222 | // Remember the original values | ||
6223 | left = style.left; | ||
6224 | rs = elem.runtimeStyle; | ||
6225 | rsLeft = rs && rs.left; | ||
6226 | |||
6227 | // Put in the new values to get a computed value out | ||
6228 | if ( rsLeft ) { | ||
6229 | rs.left = elem.currentStyle.left; | ||
6230 | } | ||
6231 | style.left = name === "fontSize" ? "1em" : ret; | ||
6232 | ret = style.pixelLeft + "px"; | ||
6233 | |||
6234 | // Revert the changed values | ||
6235 | style.left = left; | ||
6236 | if ( rsLeft ) { | ||
6237 | rs.left = rsLeft; | ||
6238 | } | ||
6239 | } | ||
6240 | |||
6241 | // Support: IE | ||
6242 | // IE returns zIndex value as an integer. | ||
6243 | return ret === undefined ? | ||
6244 | ret : | ||
6245 | ret + "" || "auto"; | ||
6246 | }; | ||
6247 | } | ||
6248 | |||
6249 | |||
6250 | |||
6251 | |||
6252 | function addGetHookIf( conditionFn, hookFn ) { | ||
6253 | // Define the hook, we'll check on the first run if it's really needed. | ||
6254 | return { | ||
6255 | get: function() { | ||
6256 | var condition = conditionFn(); | ||
6257 | |||
6258 | if ( condition == null ) { | ||
6259 | // The test was not ready at this point; screw the hook this time | ||
6260 | // but check again when needed next time. | ||
6261 | return; | ||
6262 | } | ||
6263 | |||
6264 | if ( condition ) { | ||
6265 | // Hook not needed (or it's not possible to use it due to missing dependency), | ||
6266 | // remove it. | ||
6267 | // Since there are no other hooks for marginRight, remove the whole object. | ||
6268 | delete this.get; | ||
6269 | return; | ||
6270 | } | ||
6271 | |||
6272 | // Hook needed; redefine it so that the support test is not executed again. | ||
6273 | |||
6274 | return (this.get = hookFn).apply( this, arguments ); | ||
6275 | } | ||
6276 | }; | ||
6277 | } | ||
6278 | |||
6279 | |||
6280 | (function() { | ||
6281 | // Minified: var b,c,d,e,f,g, h,i | ||
6282 | var div, style, a, pixelPositionVal, boxSizingReliableVal, | ||
6283 | reliableHiddenOffsetsVal, reliableMarginRightVal; | ||
6284 | |||
6285 | // Setup | ||
6286 | div = document.createElement( "div" ); | ||
6287 | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; | ||
6288 | a = div.getElementsByTagName( "a" )[ 0 ]; | ||
6289 | style = a && a.style; | ||
6290 | |||
6291 | // Finish early in limited (non-browser) environments | ||
6292 | if ( !style ) { | ||
6293 | return; | ||
6294 | } | ||
6295 | |||
6296 | style.cssText = "float:left;opacity:.5"; | ||
6297 | |||
6298 | // Support: IE<9 | ||
6299 | // Make sure that element opacity exists (as opposed to filter) | ||
6300 | support.opacity = style.opacity === "0.5"; | ||
6301 | |||
6302 | // Verify style float existence | ||
6303 | // (IE uses styleFloat instead of cssFloat) | ||
6304 | support.cssFloat = !!style.cssFloat; | ||
6305 | |||
6306 | div.style.backgroundClip = "content-box"; | ||
6307 | div.cloneNode( true ).style.backgroundClip = ""; | ||
6308 | support.clearCloneStyle = div.style.backgroundClip === "content-box"; | ||
6309 | |||
6310 | // Support: Firefox<29, Android 2.3 | ||
6311 | // Vendor-prefix box-sizing | ||
6312 | support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || | ||
6313 | style.WebkitBoxSizing === ""; | ||
6314 | |||
6315 | jQuery.extend(support, { | ||
6316 | reliableHiddenOffsets: function() { | ||
6317 | if ( reliableHiddenOffsetsVal == null ) { | ||
6318 | computeStyleTests(); | ||
6319 | } | ||
6320 | return reliableHiddenOffsetsVal; | ||
6321 | }, | ||
6322 | |||
6323 | boxSizingReliable: function() { | ||
6324 | if ( boxSizingReliableVal == null ) { | ||
6325 | computeStyleTests(); | ||
6326 | } | ||
6327 | return boxSizingReliableVal; | ||
6328 | }, | ||
6329 | |||
6330 | pixelPosition: function() { | ||
6331 | if ( pixelPositionVal == null ) { | ||
6332 | computeStyleTests(); | ||
6333 | } | ||
6334 | return pixelPositionVal; | ||
6335 | }, | ||
6336 | |||
6337 | // Support: Android 2.3 | ||
6338 | reliableMarginRight: function() { | ||
6339 | if ( reliableMarginRightVal == null ) { | ||
6340 | computeStyleTests(); | ||
6341 | } | ||
6342 | return reliableMarginRightVal; | ||
6343 | } | ||
6344 | }); | ||
6345 | |||
6346 | function computeStyleTests() { | ||
6347 | // Minified: var b,c,d,j | ||
6348 | var div, body, container, contents; | ||
6349 | |||
6350 | body = document.getElementsByTagName( "body" )[ 0 ]; | ||
6351 | if ( !body || !body.style ) { | ||
6352 | // Test fired too early or in an unsupported environment, exit. | ||
6353 | return; | ||
6354 | } | ||
6355 | |||
6356 | // Setup | ||
6357 | div = document.createElement( "div" ); | ||
6358 | container = document.createElement( "div" ); | ||
6359 | container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; | ||
6360 | body.appendChild( container ).appendChild( div ); | ||
6361 | |||
6362 | div.style.cssText = | ||
6363 | // Support: Firefox<29, Android 2.3 | ||
6364 | // Vendor-prefix box-sizing | ||
6365 | "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + | ||
6366 | "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + | ||
6367 | "border:1px;padding:1px;width:4px;position:absolute"; | ||
6368 | |||
6369 | // Support: IE<9 | ||
6370 | // Assume reasonable values in the absence of getComputedStyle | ||
6371 | pixelPositionVal = boxSizingReliableVal = false; | ||
6372 | reliableMarginRightVal = true; | ||
6373 | |||
6374 | // Check for getComputedStyle so that this code is not run in IE<9. | ||
6375 | if ( window.getComputedStyle ) { | ||
6376 | pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; | ||
6377 | boxSizingReliableVal = | ||
6378 | ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; | ||
6379 | |||
6380 | // Support: Android 2.3 | ||
6381 | // Div with explicit width and no margin-right incorrectly | ||
6382 | // gets computed margin-right based on width of container (#3333) | ||
6383 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
6384 | contents = div.appendChild( document.createElement( "div" ) ); | ||
6385 | |||
6386 | // Reset CSS: box-sizing; display; margin; border; padding | ||
6387 | contents.style.cssText = div.style.cssText = | ||
6388 | // Support: Firefox<29, Android 2.3 | ||
6389 | // Vendor-prefix box-sizing | ||
6390 | "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + | ||
6391 | "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; | ||
6392 | contents.style.marginRight = contents.style.width = "0"; | ||
6393 | div.style.width = "1px"; | ||
6394 | |||
6395 | reliableMarginRightVal = | ||
6396 | !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); | ||
6397 | |||
6398 | div.removeChild( contents ); | ||
6399 | } | ||
6400 | |||
6401 | // Support: IE8 | ||
6402 | // Check if table cells still have offsetWidth/Height when they are set | ||
6403 | // to display:none and there are still other visible table cells in a | ||
6404 | // table row; if so, offsetWidth/Height are not reliable for use when | ||
6405 | // determining if an element has been hidden directly using | ||
6406 | // display:none (it is still safe to use offsets if a parent element is | ||
6407 | // hidden; don safety goggles and see bug #4512 for more information). | ||
6408 | div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; | ||
6409 | contents = div.getElementsByTagName( "td" ); | ||
6410 | contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; | ||
6411 | reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; | ||
6412 | if ( reliableHiddenOffsetsVal ) { | ||
6413 | contents[ 0 ].style.display = ""; | ||
6414 | contents[ 1 ].style.display = "none"; | ||
6415 | reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; | ||
6416 | } | ||
6417 | |||
6418 | body.removeChild( container ); | ||
6419 | } | ||
6420 | |||
6421 | })(); | ||
6422 | |||
6423 | |||
6424 | // A method for quickly swapping in/out CSS properties to get correct calculations. | ||
6425 | jQuery.swap = function( elem, options, callback, args ) { | ||
6426 | var ret, name, | ||
6427 | old = {}; | ||
6428 | |||
6429 | // Remember the old values, and insert the new ones | ||
6430 | for ( name in options ) { | ||
6431 | old[ name ] = elem.style[ name ]; | ||
6432 | elem.style[ name ] = options[ name ]; | ||
6433 | } | ||
6434 | |||
6435 | ret = callback.apply( elem, args || [] ); | ||
6436 | |||
6437 | // Revert the old values | ||
6438 | for ( name in options ) { | ||
6439 | elem.style[ name ] = old[ name ]; | ||
6440 | } | ||
6441 | |||
6442 | return ret; | ||
6443 | }; | ||
6444 | |||
6445 | |||
6446 | var | ||
6447 | ralpha = /alpha\([^)]*\)/i, | ||
6448 | ropacity = /opacity\s*=\s*([^)]*)/, | ||
6449 | |||
6450 | // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" | ||
6451 | // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display | ||
6452 | rdisplayswap = /^(none|table(?!-c[ea]).+)/, | ||
6453 | rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), | ||
6454 | rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), | ||
6455 | |||
6456 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, | ||
6457 | cssNormalTransform = { | ||
6458 | letterSpacing: "0", | ||
6459 | fontWeight: "400" | ||
6460 | }, | ||
6461 | |||
6462 | cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; | ||
6463 | |||
6464 | |||
6465 | // return a css property mapped to a potentially vendor prefixed property | ||
6466 | function vendorPropName( style, name ) { | ||
6467 | |||
6468 | // shortcut for names that are not vendor prefixed | ||
6469 | if ( name in style ) { | ||
6470 | return name; | ||
6471 | } | ||
6472 | |||
6473 | // check for vendor prefixed names | ||
6474 | var capName = name.charAt(0).toUpperCase() + name.slice(1), | ||
6475 | origName = name, | ||
6476 | i = cssPrefixes.length; | ||
6477 | |||
6478 | while ( i-- ) { | ||
6479 | name = cssPrefixes[ i ] + capName; | ||
6480 | if ( name in style ) { | ||
6481 | return name; | ||
6482 | } | ||
6483 | } | ||
6484 | |||
6485 | return origName; | ||
6486 | } | ||
6487 | |||
6488 | function showHide( elements, show ) { | ||
6489 | var display, elem, hidden, | ||
6490 | values = [], | ||
6491 | index = 0, | ||
6492 | length = elements.length; | ||
6493 | |||
6494 | for ( ; index < length; index++ ) { | ||
6495 | elem = elements[ index ]; | ||
6496 | if ( !elem.style ) { | ||
6497 | continue; | ||
6498 | } | ||
6499 | |||
6500 | values[ index ] = jQuery._data( elem, "olddisplay" ); | ||
6501 | display = elem.style.display; | ||
6502 | if ( show ) { | ||
6503 | // Reset the inline display of this element to learn if it is | ||
6504 | // being hidden by cascaded rules or not | ||
6505 | if ( !values[ index ] && display === "none" ) { | ||
6506 | elem.style.display = ""; | ||
6507 | } | ||
6508 | |||
6509 | // Set elements which have been overridden with display: none | ||
6510 | // in a stylesheet to whatever the default browser style is | ||
6511 | // for such an element | ||
6512 | if ( elem.style.display === "" && isHidden( elem ) ) { | ||
6513 | values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); | ||
6514 | } | ||
6515 | } else { | ||
6516 | hidden = isHidden( elem ); | ||
6517 | |||
6518 | if ( display && display !== "none" || !hidden ) { | ||
6519 | jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); | ||
6520 | } | ||
6521 | } | ||
6522 | } | ||
6523 | |||
6524 | // Set the display of most of the elements in a second loop | ||
6525 | // to avoid the constant reflow | ||
6526 | for ( index = 0; index < length; index++ ) { | ||
6527 | elem = elements[ index ]; | ||
6528 | if ( !elem.style ) { | ||
6529 | continue; | ||
6530 | } | ||
6531 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { | ||
6532 | elem.style.display = show ? values[ index ] || "" : "none"; | ||
6533 | } | ||
6534 | } | ||
6535 | |||
6536 | return elements; | ||
6537 | } | ||
6538 | |||
6539 | function setPositiveNumber( elem, value, subtract ) { | ||
6540 | var matches = rnumsplit.exec( value ); | ||
6541 | return matches ? | ||
6542 | // Guard against undefined "subtract", e.g., when used as in cssHooks | ||
6543 | Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : | ||
6544 | value; | ||
6545 | } | ||
6546 | |||
6547 | function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { | ||
6548 | var i = extra === ( isBorderBox ? "border" : "content" ) ? | ||
6549 | // If we already have the right measurement, avoid augmentation | ||
6550 | 4 : | ||
6551 | // Otherwise initialize for horizontal or vertical properties | ||
6552 | name === "width" ? 1 : 0, | ||
6553 | |||
6554 | val = 0; | ||
6555 | |||
6556 | for ( ; i < 4; i += 2 ) { | ||
6557 | // both box models exclude margin, so add it if we want it | ||
6558 | if ( extra === "margin" ) { | ||
6559 | val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); | ||
6560 | } | ||
6561 | |||
6562 | if ( isBorderBox ) { | ||
6563 | // border-box includes padding, so remove it if we want content | ||
6564 | if ( extra === "content" ) { | ||
6565 | val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
6566 | } | ||
6567 | |||
6568 | // at this point, extra isn't border nor margin, so remove border | ||
6569 | if ( extra !== "margin" ) { | ||
6570 | val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
6571 | } | ||
6572 | } else { | ||
6573 | // at this point, extra isn't content, so add padding | ||
6574 | val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
6575 | |||
6576 | // at this point, extra isn't content nor padding, so add border | ||
6577 | if ( extra !== "padding" ) { | ||
6578 | val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
6579 | } | ||
6580 | } | ||
6581 | } | ||
6582 | |||
6583 | return val; | ||
6584 | } | ||
6585 | |||
6586 | function getWidthOrHeight( elem, name, extra ) { | ||
6587 | |||
6588 | // Start with offset property, which is equivalent to the border-box value | ||
6589 | var valueIsBorderBox = true, | ||
6590 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, | ||
6591 | styles = getStyles( elem ), | ||
6592 | isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; | ||
6593 | |||
6594 | // some non-html elements return undefined for offsetWidth, so check for null/undefined | ||
6595 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 | ||
6596 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 | ||
6597 | if ( val <= 0 || val == null ) { | ||
6598 | // Fall back to computed then uncomputed css if necessary | ||
6599 | val = curCSS( elem, name, styles ); | ||
6600 | if ( val < 0 || val == null ) { | ||
6601 | val = elem.style[ name ]; | ||
6602 | } | ||
6603 | |||
6604 | // Computed unit is not pixels. Stop here and return. | ||
6605 | if ( rnumnonpx.test(val) ) { | ||
6606 | return val; | ||
6607 | } | ||
6608 | |||
6609 | // we need the check for style in case a browser which returns unreliable values | ||
6610 | // for getComputedStyle silently falls back to the reliable elem.style | ||
6611 | valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); | ||
6612 | |||
6613 | // Normalize "", auto, and prepare for extra | ||
6614 | val = parseFloat( val ) || 0; | ||
6615 | } | ||
6616 | |||
6617 | // use the active box-sizing model to add/subtract irrelevant styles | ||
6618 | return ( val + | ||
6619 | augmentWidthOrHeight( | ||
6620 | elem, | ||
6621 | name, | ||
6622 | extra || ( isBorderBox ? "border" : "content" ), | ||
6623 | valueIsBorderBox, | ||
6624 | styles | ||
6625 | ) | ||
6626 | ) + "px"; | ||
6627 | } | ||
6628 | |||
6629 | jQuery.extend({ | ||
6630 | // Add in style property hooks for overriding the default | ||
6631 | // behavior of getting and setting a style property | ||
6632 | cssHooks: { | ||
6633 | opacity: { | ||
6634 | get: function( elem, computed ) { | ||
6635 | if ( computed ) { | ||
6636 | // We should always get a number back from opacity | ||
6637 | var ret = curCSS( elem, "opacity" ); | ||
6638 | return ret === "" ? "1" : ret; | ||
6639 | } | ||
6640 | } | ||
6641 | } | ||
6642 | }, | ||
6643 | |||
6644 | // Don't automatically add "px" to these possibly-unitless properties | ||
6645 | cssNumber: { | ||
6646 | "columnCount": true, | ||
6647 | "fillOpacity": true, | ||
6648 | "flexGrow": true, | ||
6649 | "flexShrink": true, | ||
6650 | "fontWeight": true, | ||
6651 | "lineHeight": true, | ||
6652 | "opacity": true, | ||
6653 | "order": true, | ||
6654 | "orphans": true, | ||
6655 | "widows": true, | ||
6656 | "zIndex": true, | ||
6657 | "zoom": true | ||
6658 | }, | ||
6659 | |||
6660 | // Add in properties whose names you wish to fix before | ||
6661 | // setting or getting the value | ||
6662 | cssProps: { | ||
6663 | // normalize float css property | ||
6664 | "float": support.cssFloat ? "cssFloat" : "styleFloat" | ||
6665 | }, | ||
6666 | |||
6667 | // Get and set the style property on a DOM Node | ||
6668 | style: function( elem, name, value, extra ) { | ||
6669 | // Don't set styles on text and comment nodes | ||
6670 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { | ||
6671 | return; | ||
6672 | } | ||
6673 | |||
6674 | // Make sure that we're working with the right name | ||
6675 | var ret, type, hooks, | ||
6676 | origName = jQuery.camelCase( name ), | ||
6677 | style = elem.style; | ||
6678 | |||
6679 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); | ||
6680 | |||
6681 | // gets hook for the prefixed version | ||
6682 | // followed by the unprefixed version | ||
6683 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
6684 | |||
6685 | // Check if we're setting a value | ||
6686 | if ( value !== undefined ) { | ||
6687 | type = typeof value; | ||
6688 | |||
6689 | // convert relative number strings (+= or -=) to relative numbers. #7345 | ||
6690 | if ( type === "string" && (ret = rrelNum.exec( value )) ) { | ||
6691 | value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); | ||
6692 | // Fixes bug #9237 | ||
6693 | type = "number"; | ||
6694 | } | ||
6695 | |||
6696 | // Make sure that null and NaN values aren't set. See: #7116 | ||
6697 | if ( value == null || value !== value ) { | ||
6698 | return; | ||
6699 | } | ||
6700 | |||
6701 | // If a number was passed in, add 'px' to the (except for certain CSS properties) | ||
6702 | if ( type === "number" && !jQuery.cssNumber[ origName ] ) { | ||
6703 | value += "px"; | ||
6704 | } | ||
6705 | |||
6706 | // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, | ||
6707 | // but it would mean to define eight (for every problematic property) identical functions | ||
6708 | if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { | ||
6709 | style[ name ] = "inherit"; | ||
6710 | } | ||
6711 | |||
6712 | // If a hook was provided, use that value, otherwise just set the specified value | ||
6713 | if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { | ||
6714 | |||
6715 | // Support: IE | ||
6716 | // Swallow errors from 'invalid' CSS values (#5509) | ||
6717 | try { | ||
6718 | style[ name ] = value; | ||
6719 | } catch(e) {} | ||
6720 | } | ||
6721 | |||
6722 | } else { | ||
6723 | // If a hook was provided get the non-computed value from there | ||
6724 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { | ||
6725 | return ret; | ||
6726 | } | ||
6727 | |||
6728 | // Otherwise just get the value from the style object | ||
6729 | return style[ name ]; | ||
6730 | } | ||
6731 | }, | ||
6732 | |||
6733 | css: function( elem, name, extra, styles ) { | ||
6734 | var num, val, hooks, | ||
6735 | origName = jQuery.camelCase( name ); | ||
6736 | |||
6737 | // Make sure that we're working with the right name | ||
6738 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); | ||
6739 | |||
6740 | // gets hook for the prefixed version | ||
6741 | // followed by the unprefixed version | ||
6742 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
6743 | |||
6744 | // If a hook was provided get the computed value from there | ||
6745 | if ( hooks && "get" in hooks ) { | ||
6746 | val = hooks.get( elem, true, extra ); | ||
6747 | } | ||
6748 | |||
6749 | // Otherwise, if a way to get the computed value exists, use that | ||
6750 | if ( val === undefined ) { | ||
6751 | val = curCSS( elem, name, styles ); | ||
6752 | } | ||
6753 | |||
6754 | //convert "normal" to computed value | ||
6755 | if ( val === "normal" && name in cssNormalTransform ) { | ||
6756 | val = cssNormalTransform[ name ]; | ||
6757 | } | ||
6758 | |||
6759 | // Return, converting to number if forced or a qualifier was provided and val looks numeric | ||
6760 | if ( extra === "" || extra ) { | ||
6761 | num = parseFloat( val ); | ||
6762 | return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; | ||
6763 | } | ||
6764 | return val; | ||
6765 | } | ||
6766 | }); | ||
6767 | |||
6768 | jQuery.each([ "height", "width" ], function( i, name ) { | ||
6769 | jQuery.cssHooks[ name ] = { | ||
6770 | get: function( elem, computed, extra ) { | ||
6771 | if ( computed ) { | ||
6772 | // certain elements can have dimension info if we invisibly show them | ||
6773 | // however, it must have a current display style that would benefit from this | ||
6774 | return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? | ||
6775 | jQuery.swap( elem, cssShow, function() { | ||
6776 | return getWidthOrHeight( elem, name, extra ); | ||
6777 | }) : | ||
6778 | getWidthOrHeight( elem, name, extra ); | ||
6779 | } | ||
6780 | }, | ||
6781 | |||
6782 | set: function( elem, value, extra ) { | ||
6783 | var styles = extra && getStyles( elem ); | ||
6784 | return setPositiveNumber( elem, value, extra ? | ||
6785 | augmentWidthOrHeight( | ||
6786 | elem, | ||
6787 | name, | ||
6788 | extra, | ||
6789 | support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", | ||
6790 | styles | ||
6791 | ) : 0 | ||
6792 | ); | ||
6793 | } | ||
6794 | }; | ||
6795 | }); | ||
6796 | |||
6797 | if ( !support.opacity ) { | ||
6798 | jQuery.cssHooks.opacity = { | ||
6799 | get: function( elem, computed ) { | ||
6800 | // IE uses filters for opacity | ||
6801 | return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? | ||
6802 | ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : | ||
6803 | computed ? "1" : ""; | ||
6804 | }, | ||
6805 | |||
6806 | set: function( elem, value ) { | ||
6807 | var style = elem.style, | ||
6808 | currentStyle = elem.currentStyle, | ||
6809 | opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", | ||
6810 | filter = currentStyle && currentStyle.filter || style.filter || ""; | ||
6811 | |||
6812 | // IE has trouble with opacity if it does not have layout | ||
6813 | // Force it by setting the zoom level | ||
6814 | style.zoom = 1; | ||
6815 | |||
6816 | // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 | ||
6817 | // if value === "", then remove inline opacity #12685 | ||
6818 | if ( ( value >= 1 || value === "" ) && | ||
6819 | jQuery.trim( filter.replace( ralpha, "" ) ) === "" && | ||
6820 | style.removeAttribute ) { | ||
6821 | |||
6822 | // Setting style.filter to null, "" & " " still leave "filter:" in the cssText | ||
6823 | // if "filter:" is present at all, clearType is disabled, we want to avoid this | ||
6824 | // style.removeAttribute is IE Only, but so apparently is this code path... | ||
6825 | style.removeAttribute( "filter" ); | ||
6826 | |||
6827 | // if there is no filter style applied in a css rule or unset inline opacity, we are done | ||
6828 | if ( value === "" || currentStyle && !currentStyle.filter ) { | ||
6829 | return; | ||
6830 | } | ||
6831 | } | ||
6832 | |||
6833 | // otherwise, set new filter values | ||
6834 | style.filter = ralpha.test( filter ) ? | ||
6835 | filter.replace( ralpha, opacity ) : | ||
6836 | filter + " " + opacity; | ||
6837 | } | ||
6838 | }; | ||
6839 | } | ||
6840 | |||
6841 | jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, | ||
6842 | function( elem, computed ) { | ||
6843 | if ( computed ) { | ||
6844 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
6845 | // Work around by temporarily setting element display to inline-block | ||
6846 | return jQuery.swap( elem, { "display": "inline-block" }, | ||
6847 | curCSS, [ elem, "marginRight" ] ); | ||
6848 | } | ||
6849 | } | ||
6850 | ); | ||
6851 | |||
6852 | // These hooks are used by animate to expand properties | ||
6853 | jQuery.each({ | ||
6854 | margin: "", | ||
6855 | padding: "", | ||
6856 | border: "Width" | ||
6857 | }, function( prefix, suffix ) { | ||
6858 | jQuery.cssHooks[ prefix + suffix ] = { | ||
6859 | expand: function( value ) { | ||
6860 | var i = 0, | ||
6861 | expanded = {}, | ||
6862 | |||
6863 | // assumes a single number if not a string | ||
6864 | parts = typeof value === "string" ? value.split(" ") : [ value ]; | ||
6865 | |||
6866 | for ( ; i < 4; i++ ) { | ||
6867 | expanded[ prefix + cssExpand[ i ] + suffix ] = | ||
6868 | parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; | ||
6869 | } | ||
6870 | |||
6871 | return expanded; | ||
6872 | } | ||
6873 | }; | ||
6874 | |||
6875 | if ( !rmargin.test( prefix ) ) { | ||
6876 | jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; | ||
6877 | } | ||
6878 | }); | ||
6879 | |||
6880 | jQuery.fn.extend({ | ||
6881 | css: function( name, value ) { | ||
6882 | return access( this, function( elem, name, value ) { | ||
6883 | var styles, len, | ||
6884 | map = {}, | ||
6885 | i = 0; | ||
6886 | |||
6887 | if ( jQuery.isArray( name ) ) { | ||
6888 | styles = getStyles( elem ); | ||
6889 | len = name.length; | ||
6890 | |||
6891 | for ( ; i < len; i++ ) { | ||
6892 | map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); | ||
6893 | } | ||
6894 | |||
6895 | return map; | ||
6896 | } | ||
6897 | |||
6898 | return value !== undefined ? | ||
6899 | jQuery.style( elem, name, value ) : | ||
6900 | jQuery.css( elem, name ); | ||
6901 | }, name, value, arguments.length > 1 ); | ||
6902 | }, | ||
6903 | show: function() { | ||
6904 | return showHide( this, true ); | ||
6905 | }, | ||
6906 | hide: function() { | ||
6907 | return showHide( this ); | ||
6908 | }, | ||
6909 | toggle: function( state ) { | ||
6910 | if ( typeof state === "boolean" ) { | ||
6911 | return state ? this.show() : this.hide(); | ||
6912 | } | ||
6913 | |||
6914 | return this.each(function() { | ||
6915 | if ( isHidden( this ) ) { | ||
6916 | jQuery( this ).show(); | ||
6917 | } else { | ||
6918 | jQuery( this ).hide(); | ||
6919 | } | ||
6920 | }); | ||
6921 | } | ||
6922 | }); | ||
6923 | |||
6924 | |||
6925 | function Tween( elem, options, prop, end, easing ) { | ||
6926 | return new Tween.prototype.init( elem, options, prop, end, easing ); | ||
6927 | } | ||
6928 | jQuery.Tween = Tween; | ||
6929 | |||
6930 | Tween.prototype = { | ||
6931 | constructor: Tween, | ||
6932 | init: function( elem, options, prop, end, easing, unit ) { | ||
6933 | this.elem = elem; | ||
6934 | this.prop = prop; | ||
6935 | this.easing = easing || "swing"; | ||
6936 | this.options = options; | ||
6937 | this.start = this.now = this.cur(); | ||
6938 | this.end = end; | ||
6939 | this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); | ||
6940 | }, | ||
6941 | cur: function() { | ||
6942 | var hooks = Tween.propHooks[ this.prop ]; | ||
6943 | |||
6944 | return hooks && hooks.get ? | ||
6945 | hooks.get( this ) : | ||
6946 | Tween.propHooks._default.get( this ); | ||
6947 | }, | ||
6948 | run: function( percent ) { | ||
6949 | var eased, | ||
6950 | hooks = Tween.propHooks[ this.prop ]; | ||
6951 | |||
6952 | if ( this.options.duration ) { | ||
6953 | this.pos = eased = jQuery.easing[ this.easing ]( | ||
6954 | percent, this.options.duration * percent, 0, 1, this.options.duration | ||
6955 | ); | ||
6956 | } else { | ||
6957 | this.pos = eased = percent; | ||
6958 | } | ||
6959 | this.now = ( this.end - this.start ) * eased + this.start; | ||
6960 | |||
6961 | if ( this.options.step ) { | ||
6962 | this.options.step.call( this.elem, this.now, this ); | ||
6963 | } | ||
6964 | |||
6965 | if ( hooks && hooks.set ) { | ||
6966 | hooks.set( this ); | ||
6967 | } else { | ||
6968 | Tween.propHooks._default.set( this ); | ||
6969 | } | ||
6970 | return this; | ||
6971 | } | ||
6972 | }; | ||
6973 | |||
6974 | Tween.prototype.init.prototype = Tween.prototype; | ||
6975 | |||
6976 | Tween.propHooks = { | ||
6977 | _default: { | ||
6978 | get: function( tween ) { | ||
6979 | var result; | ||
6980 | |||
6981 | if ( tween.elem[ tween.prop ] != null && | ||
6982 | (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { | ||
6983 | return tween.elem[ tween.prop ]; | ||
6984 | } | ||
6985 | |||
6986 | // passing an empty string as a 3rd parameter to .css will automatically | ||
6987 | // attempt a parseFloat and fallback to a string if the parse fails | ||
6988 | // so, simple values such as "10px" are parsed to Float. | ||
6989 | // complex values such as "rotate(1rad)" are returned as is. | ||
6990 | result = jQuery.css( tween.elem, tween.prop, "" ); | ||
6991 | // Empty strings, null, undefined and "auto" are converted to 0. | ||
6992 | return !result || result === "auto" ? 0 : result; | ||
6993 | }, | ||
6994 | set: function( tween ) { | ||
6995 | // use step hook for back compat - use cssHook if its there - use .style if its | ||
6996 | // available and use plain properties where available | ||
6997 | if ( jQuery.fx.step[ tween.prop ] ) { | ||
6998 | jQuery.fx.step[ tween.prop ]( tween ); | ||
6999 | } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { | ||
7000 | jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); | ||
7001 | } else { | ||
7002 | tween.elem[ tween.prop ] = tween.now; | ||
7003 | } | ||
7004 | } | ||
7005 | } | ||
7006 | }; | ||
7007 | |||
7008 | // Support: IE <=9 | ||
7009 | // Panic based approach to setting things on disconnected nodes | ||
7010 | |||
7011 | Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | ||
7012 | set: function( tween ) { | ||
7013 | if ( tween.elem.nodeType && tween.elem.parentNode ) { | ||
7014 | tween.elem[ tween.prop ] = tween.now; | ||
7015 | } | ||
7016 | } | ||
7017 | }; | ||
7018 | |||
7019 | jQuery.easing = { | ||
7020 | linear: function( p ) { | ||
7021 | return p; | ||
7022 | }, | ||
7023 | swing: function( p ) { | ||
7024 | return 0.5 - Math.cos( p * Math.PI ) / 2; | ||
7025 | } | ||
7026 | }; | ||
7027 | |||
7028 | jQuery.fx = Tween.prototype.init; | ||
7029 | |||
7030 | // Back Compat <1.8 extension point | ||
7031 | jQuery.fx.step = {}; | ||
7032 | |||
7033 | |||
7034 | |||
7035 | |||
7036 | var | ||
7037 | fxNow, timerId, | ||
7038 | rfxtypes = /^(?:toggle|show|hide)$/, | ||
7039 | rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), | ||
7040 | rrun = /queueHooks$/, | ||
7041 | animationPrefilters = [ defaultPrefilter ], | ||
7042 | tweeners = { | ||
7043 | "*": [ function( prop, value ) { | ||
7044 | var tween = this.createTween( prop, value ), | ||
7045 | target = tween.cur(), | ||
7046 | parts = rfxnum.exec( value ), | ||
7047 | unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), | ||
7048 | |||
7049 | // Starting value computation is required for potential unit mismatches | ||
7050 | start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && | ||
7051 | rfxnum.exec( jQuery.css( tween.elem, prop ) ), | ||
7052 | scale = 1, | ||
7053 | maxIterations = 20; | ||
7054 | |||
7055 | if ( start && start[ 3 ] !== unit ) { | ||
7056 | // Trust units reported by jQuery.css | ||
7057 | unit = unit || start[ 3 ]; | ||
7058 | |||
7059 | // Make sure we update the tween properties later on | ||
7060 | parts = parts || []; | ||
7061 | |||
7062 | // Iteratively approximate from a nonzero starting point | ||
7063 | start = +target || 1; | ||
7064 | |||
7065 | do { | ||
7066 | // If previous iteration zeroed out, double until we get *something* | ||
7067 | // Use a string for doubling factor so we don't accidentally see scale as unchanged below | ||
7068 | scale = scale || ".5"; | ||
7069 | |||
7070 | // Adjust and apply | ||
7071 | start = start / scale; | ||
7072 | jQuery.style( tween.elem, prop, start + unit ); | ||
7073 | |||
7074 | // Update scale, tolerating zero or NaN from tween.cur() | ||
7075 | // And breaking the loop if scale is unchanged or perfect, or if we've just had enough | ||
7076 | } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); | ||
7077 | } | ||
7078 | |||
7079 | // Update tween properties | ||
7080 | if ( parts ) { | ||
7081 | start = tween.start = +start || +target || 0; | ||
7082 | tween.unit = unit; | ||
7083 | // If a +=/-= token was provided, we're doing a relative animation | ||
7084 | tween.end = parts[ 1 ] ? | ||
7085 | start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : | ||
7086 | +parts[ 2 ]; | ||
7087 | } | ||
7088 | |||
7089 | return tween; | ||
7090 | } ] | ||
7091 | }; | ||
7092 | |||
7093 | // Animations created synchronously will run synchronously | ||
7094 | function createFxNow() { | ||
7095 | setTimeout(function() { | ||
7096 | fxNow = undefined; | ||
7097 | }); | ||
7098 | return ( fxNow = jQuery.now() ); | ||
7099 | } | ||
7100 | |||
7101 | // Generate parameters to create a standard animation | ||
7102 | function genFx( type, includeWidth ) { | ||
7103 | var which, | ||
7104 | attrs = { height: type }, | ||
7105 | i = 0; | ||
7106 | |||
7107 | // if we include width, step value is 1 to do all cssExpand values, | ||
7108 | // if we don't include width, step value is 2 to skip over Left and Right | ||
7109 | includeWidth = includeWidth ? 1 : 0; | ||
7110 | for ( ; i < 4 ; i += 2 - includeWidth ) { | ||
7111 | which = cssExpand[ i ]; | ||
7112 | attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; | ||
7113 | } | ||
7114 | |||
7115 | if ( includeWidth ) { | ||
7116 | attrs.opacity = attrs.width = type; | ||
7117 | } | ||
7118 | |||
7119 | return attrs; | ||
7120 | } | ||
7121 | |||
7122 | function createTween( value, prop, animation ) { | ||
7123 | var tween, | ||
7124 | collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), | ||
7125 | index = 0, | ||
7126 | length = collection.length; | ||
7127 | for ( ; index < length; index++ ) { | ||
7128 | if ( (tween = collection[ index ].call( animation, prop, value )) ) { | ||
7129 | |||
7130 | // we're done with this property | ||
7131 | return tween; | ||
7132 | } | ||
7133 | } | ||
7134 | } | ||
7135 | |||
7136 | function defaultPrefilter( elem, props, opts ) { | ||
7137 | /* jshint validthis: true */ | ||
7138 | var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, | ||
7139 | anim = this, | ||
7140 | orig = {}, | ||
7141 | style = elem.style, | ||
7142 | hidden = elem.nodeType && isHidden( elem ), | ||
7143 | dataShow = jQuery._data( elem, "fxshow" ); | ||
7144 | |||
7145 | // handle queue: false promises | ||
7146 | if ( !opts.queue ) { | ||
7147 | hooks = jQuery._queueHooks( elem, "fx" ); | ||
7148 | if ( hooks.unqueued == null ) { | ||
7149 | hooks.unqueued = 0; | ||
7150 | oldfire = hooks.empty.fire; | ||
7151 | hooks.empty.fire = function() { | ||
7152 | if ( !hooks.unqueued ) { | ||
7153 | oldfire(); | ||
7154 | } | ||
7155 | }; | ||
7156 | } | ||
7157 | hooks.unqueued++; | ||
7158 | |||
7159 | anim.always(function() { | ||
7160 | // doing this makes sure that the complete handler will be called | ||
7161 | // before this completes | ||
7162 | anim.always(function() { | ||
7163 | hooks.unqueued--; | ||
7164 | if ( !jQuery.queue( elem, "fx" ).length ) { | ||
7165 | hooks.empty.fire(); | ||
7166 | } | ||
7167 | }); | ||
7168 | }); | ||
7169 | } | ||
7170 | |||
7171 | // height/width overflow pass | ||
7172 | if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { | ||
7173 | // Make sure that nothing sneaks out | ||
7174 | // Record all 3 overflow attributes because IE does not | ||
7175 | // change the overflow attribute when overflowX and | ||
7176 | // overflowY are set to the same value | ||
7177 | opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; | ||
7178 | |||
7179 | // Set display property to inline-block for height/width | ||
7180 | // animations on inline elements that are having width/height animated | ||
7181 | display = jQuery.css( elem, "display" ); | ||
7182 | |||
7183 | // Test default display if display is currently "none" | ||
7184 | checkDisplay = display === "none" ? | ||
7185 | jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; | ||
7186 | |||
7187 | if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { | ||
7188 | |||
7189 | // inline-level elements accept inline-block; | ||
7190 | // block-level elements need to be inline with layout | ||
7191 | if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { | ||
7192 | style.display = "inline-block"; | ||
7193 | } else { | ||
7194 | style.zoom = 1; | ||
7195 | } | ||
7196 | } | ||
7197 | } | ||
7198 | |||
7199 | if ( opts.overflow ) { | ||
7200 | style.overflow = "hidden"; | ||
7201 | if ( !support.shrinkWrapBlocks() ) { | ||
7202 | anim.always(function() { | ||
7203 | style.overflow = opts.overflow[ 0 ]; | ||
7204 | style.overflowX = opts.overflow[ 1 ]; | ||
7205 | style.overflowY = opts.overflow[ 2 ]; | ||
7206 | }); | ||
7207 | } | ||
7208 | } | ||
7209 | |||
7210 | // show/hide pass | ||
7211 | for ( prop in props ) { | ||
7212 | value = props[ prop ]; | ||
7213 | if ( rfxtypes.exec( value ) ) { | ||
7214 | delete props[ prop ]; | ||
7215 | toggle = toggle || value === "toggle"; | ||
7216 | if ( value === ( hidden ? "hide" : "show" ) ) { | ||
7217 | |||
7218 | // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden | ||
7219 | if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { | ||
7220 | hidden = true; | ||
7221 | } else { | ||
7222 | continue; | ||
7223 | } | ||
7224 | } | ||
7225 | orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); | ||
7226 | |||
7227 | // Any non-fx value stops us from restoring the original display value | ||
7228 | } else { | ||
7229 | display = undefined; | ||
7230 | } | ||
7231 | } | ||
7232 | |||
7233 | if ( !jQuery.isEmptyObject( orig ) ) { | ||
7234 | if ( dataShow ) { | ||
7235 | if ( "hidden" in dataShow ) { | ||
7236 | hidden = dataShow.hidden; | ||
7237 | } | ||
7238 | } else { | ||
7239 | dataShow = jQuery._data( elem, "fxshow", {} ); | ||
7240 | } | ||
7241 | |||
7242 | // store state if its toggle - enables .stop().toggle() to "reverse" | ||
7243 | if ( toggle ) { | ||
7244 | dataShow.hidden = !hidden; | ||
7245 | } | ||
7246 | if ( hidden ) { | ||
7247 | jQuery( elem ).show(); | ||
7248 | } else { | ||
7249 | anim.done(function() { | ||
7250 | jQuery( elem ).hide(); | ||
7251 | }); | ||
7252 | } | ||
7253 | anim.done(function() { | ||
7254 | var prop; | ||
7255 | jQuery._removeData( elem, "fxshow" ); | ||
7256 | for ( prop in orig ) { | ||
7257 | jQuery.style( elem, prop, orig[ prop ] ); | ||
7258 | } | ||
7259 | }); | ||
7260 | for ( prop in orig ) { | ||
7261 | tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); | ||
7262 | |||
7263 | if ( !( prop in dataShow ) ) { | ||
7264 | dataShow[ prop ] = tween.start; | ||
7265 | if ( hidden ) { | ||
7266 | tween.end = tween.start; | ||
7267 | tween.start = prop === "width" || prop === "height" ? 1 : 0; | ||
7268 | } | ||
7269 | } | ||
7270 | } | ||
7271 | |||
7272 | // If this is a noop like .hide().hide(), restore an overwritten display value | ||
7273 | } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { | ||
7274 | style.display = display; | ||
7275 | } | ||
7276 | } | ||
7277 | |||
7278 | function propFilter( props, specialEasing ) { | ||
7279 | var index, name, easing, value, hooks; | ||
7280 | |||
7281 | // camelCase, specialEasing and expand cssHook pass | ||
7282 | for ( index in props ) { | ||
7283 | name = jQuery.camelCase( index ); | ||
7284 | easing = specialEasing[ name ]; | ||
7285 | value = props[ index ]; | ||
7286 | if ( jQuery.isArray( value ) ) { | ||
7287 | easing = value[ 1 ]; | ||
7288 | value = props[ index ] = value[ 0 ]; | ||
7289 | } | ||
7290 | |||
7291 | if ( index !== name ) { | ||
7292 | props[ name ] = value; | ||
7293 | delete props[ index ]; | ||
7294 | } | ||
7295 | |||
7296 | hooks = jQuery.cssHooks[ name ]; | ||
7297 | if ( hooks && "expand" in hooks ) { | ||
7298 | value = hooks.expand( value ); | ||
7299 | delete props[ name ]; | ||
7300 | |||
7301 | // not quite $.extend, this wont overwrite keys already present. | ||
7302 | // also - reusing 'index' from above because we have the correct "name" | ||
7303 | for ( index in value ) { | ||
7304 | if ( !( index in props ) ) { | ||
7305 | props[ index ] = value[ index ]; | ||
7306 | specialEasing[ index ] = easing; | ||
7307 | } | ||
7308 | } | ||
7309 | } else { | ||
7310 | specialEasing[ name ] = easing; | ||
7311 | } | ||
7312 | } | ||
7313 | } | ||
7314 | |||
7315 | function Animation( elem, properties, options ) { | ||
7316 | var result, | ||
7317 | stopped, | ||
7318 | index = 0, | ||
7319 | length = animationPrefilters.length, | ||
7320 | deferred = jQuery.Deferred().always( function() { | ||
7321 | // don't match elem in the :animated selector | ||
7322 | delete tick.elem; | ||
7323 | }), | ||
7324 | tick = function() { | ||
7325 | if ( stopped ) { | ||
7326 | return false; | ||
7327 | } | ||
7328 | var currentTime = fxNow || createFxNow(), | ||
7329 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), | ||
7330 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) | ||
7331 | temp = remaining / animation.duration || 0, | ||
7332 | percent = 1 - temp, | ||
7333 | index = 0, | ||
7334 | length = animation.tweens.length; | ||
7335 | |||
7336 | for ( ; index < length ; index++ ) { | ||
7337 | animation.tweens[ index ].run( percent ); | ||
7338 | } | ||
7339 | |||
7340 | deferred.notifyWith( elem, [ animation, percent, remaining ]); | ||
7341 | |||
7342 | if ( percent < 1 && length ) { | ||
7343 | return remaining; | ||
7344 | } else { | ||
7345 | deferred.resolveWith( elem, [ animation ] ); | ||
7346 | return false; | ||
7347 | } | ||
7348 | }, | ||
7349 | animation = deferred.promise({ | ||
7350 | elem: elem, | ||
7351 | props: jQuery.extend( {}, properties ), | ||
7352 | opts: jQuery.extend( true, { specialEasing: {} }, options ), | ||
7353 | originalProperties: properties, | ||
7354 | originalOptions: options, | ||
7355 | startTime: fxNow || createFxNow(), | ||
7356 | duration: options.duration, | ||
7357 | tweens: [], | ||
7358 | createTween: function( prop, end ) { | ||
7359 | var tween = jQuery.Tween( elem, animation.opts, prop, end, | ||
7360 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); | ||
7361 | animation.tweens.push( tween ); | ||
7362 | return tween; | ||
7363 | }, | ||
7364 | stop: function( gotoEnd ) { | ||
7365 | var index = 0, | ||
7366 | // if we are going to the end, we want to run all the tweens | ||
7367 | // otherwise we skip this part | ||
7368 | length = gotoEnd ? animation.tweens.length : 0; | ||
7369 | if ( stopped ) { | ||
7370 | return this; | ||
7371 | } | ||
7372 | stopped = true; | ||
7373 | for ( ; index < length ; index++ ) { | ||
7374 | animation.tweens[ index ].run( 1 ); | ||
7375 | } | ||
7376 | |||
7377 | // resolve when we played the last frame | ||
7378 | // otherwise, reject | ||
7379 | if ( gotoEnd ) { | ||
7380 | deferred.resolveWith( elem, [ animation, gotoEnd ] ); | ||
7381 | } else { | ||
7382 | deferred.rejectWith( elem, [ animation, gotoEnd ] ); | ||
7383 | } | ||
7384 | return this; | ||
7385 | } | ||
7386 | }), | ||
7387 | props = animation.props; | ||
7388 | |||
7389 | propFilter( props, animation.opts.specialEasing ); | ||
7390 | |||
7391 | for ( ; index < length ; index++ ) { | ||
7392 | result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); | ||
7393 | if ( result ) { | ||
7394 | return result; | ||
7395 | } | ||
7396 | } | ||
7397 | |||
7398 | jQuery.map( props, createTween, animation ); | ||
7399 | |||
7400 | if ( jQuery.isFunction( animation.opts.start ) ) { | ||
7401 | animation.opts.start.call( elem, animation ); | ||
7402 | } | ||
7403 | |||
7404 | jQuery.fx.timer( | ||
7405 | jQuery.extend( tick, { | ||
7406 | elem: elem, | ||
7407 | anim: animation, | ||
7408 | queue: animation.opts.queue | ||
7409 | }) | ||
7410 | ); | ||
7411 | |||
7412 | // attach callbacks from options | ||
7413 | return animation.progress( animation.opts.progress ) | ||
7414 | .done( animation.opts.done, animation.opts.complete ) | ||
7415 | .fail( animation.opts.fail ) | ||
7416 | .always( animation.opts.always ); | ||
7417 | } | ||
7418 | |||
7419 | jQuery.Animation = jQuery.extend( Animation, { | ||
7420 | tweener: function( props, callback ) { | ||
7421 | if ( jQuery.isFunction( props ) ) { | ||
7422 | callback = props; | ||
7423 | props = [ "*" ]; | ||
7424 | } else { | ||
7425 | props = props.split(" "); | ||
7426 | } | ||
7427 | |||
7428 | var prop, | ||
7429 | index = 0, | ||
7430 | length = props.length; | ||
7431 | |||
7432 | for ( ; index < length ; index++ ) { | ||
7433 | prop = props[ index ]; | ||
7434 | tweeners[ prop ] = tweeners[ prop ] || []; | ||
7435 | tweeners[ prop ].unshift( callback ); | ||
7436 | } | ||
7437 | }, | ||
7438 | |||
7439 | prefilter: function( callback, prepend ) { | ||
7440 | if ( prepend ) { | ||
7441 | animationPrefilters.unshift( callback ); | ||
7442 | } else { | ||
7443 | animationPrefilters.push( callback ); | ||
7444 | } | ||
7445 | } | ||
7446 | }); | ||
7447 | |||
7448 | jQuery.speed = function( speed, easing, fn ) { | ||
7449 | var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { | ||
7450 | complete: fn || !fn && easing || | ||
7451 | jQuery.isFunction( speed ) && speed, | ||
7452 | duration: speed, | ||
7453 | easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing | ||
7454 | }; | ||
7455 | |||
7456 | opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : | ||
7457 | opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; | ||
7458 | |||
7459 | // normalize opt.queue - true/undefined/null -> "fx" | ||
7460 | if ( opt.queue == null || opt.queue === true ) { | ||
7461 | opt.queue = "fx"; | ||
7462 | } | ||
7463 | |||
7464 | // Queueing | ||
7465 | opt.old = opt.complete; | ||
7466 | |||
7467 | opt.complete = function() { | ||
7468 | if ( jQuery.isFunction( opt.old ) ) { | ||
7469 | opt.old.call( this ); | ||
7470 | } | ||
7471 | |||
7472 | if ( opt.queue ) { | ||
7473 | jQuery.dequeue( this, opt.queue ); | ||
7474 | } | ||
7475 | }; | ||
7476 | |||
7477 | return opt; | ||
7478 | }; | ||
7479 | |||
7480 | jQuery.fn.extend({ | ||
7481 | fadeTo: function( speed, to, easing, callback ) { | ||
7482 | |||
7483 | // show any hidden elements after setting opacity to 0 | ||
7484 | return this.filter( isHidden ).css( "opacity", 0 ).show() | ||
7485 | |||
7486 | // animate to the value specified | ||
7487 | .end().animate({ opacity: to }, speed, easing, callback ); | ||
7488 | }, | ||
7489 | animate: function( prop, speed, easing, callback ) { | ||
7490 | var empty = jQuery.isEmptyObject( prop ), | ||
7491 | optall = jQuery.speed( speed, easing, callback ), | ||
7492 | doAnimation = function() { | ||
7493 | // Operate on a copy of prop so per-property easing won't be lost | ||
7494 | var anim = Animation( this, jQuery.extend( {}, prop ), optall ); | ||
7495 | |||
7496 | // Empty animations, or finishing resolves immediately | ||
7497 | if ( empty || jQuery._data( this, "finish" ) ) { | ||
7498 | anim.stop( true ); | ||
7499 | } | ||
7500 | }; | ||
7501 | doAnimation.finish = doAnimation; | ||
7502 | |||
7503 | return empty || optall.queue === false ? | ||
7504 | this.each( doAnimation ) : | ||
7505 | this.queue( optall.queue, doAnimation ); | ||
7506 | }, | ||
7507 | stop: function( type, clearQueue, gotoEnd ) { | ||
7508 | var stopQueue = function( hooks ) { | ||
7509 | var stop = hooks.stop; | ||
7510 | delete hooks.stop; | ||
7511 | stop( gotoEnd ); | ||
7512 | }; | ||
7513 | |||
7514 | if ( typeof type !== "string" ) { | ||
7515 | gotoEnd = clearQueue; | ||
7516 | clearQueue = type; | ||
7517 | type = undefined; | ||
7518 | } | ||
7519 | if ( clearQueue && type !== false ) { | ||
7520 | this.queue( type || "fx", [] ); | ||
7521 | } | ||
7522 | |||
7523 | return this.each(function() { | ||
7524 | var dequeue = true, | ||
7525 | index = type != null && type + "queueHooks", | ||
7526 | timers = jQuery.timers, | ||
7527 | data = jQuery._data( this ); | ||
7528 | |||
7529 | if ( index ) { | ||
7530 | if ( data[ index ] && data[ index ].stop ) { | ||
7531 | stopQueue( data[ index ] ); | ||
7532 | } | ||
7533 | } else { | ||
7534 | for ( index in data ) { | ||
7535 | if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { | ||
7536 | stopQueue( data[ index ] ); | ||
7537 | } | ||
7538 | } | ||
7539 | } | ||
7540 | |||
7541 | for ( index = timers.length; index--; ) { | ||
7542 | if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { | ||
7543 | timers[ index ].anim.stop( gotoEnd ); | ||
7544 | dequeue = false; | ||
7545 | timers.splice( index, 1 ); | ||
7546 | } | ||
7547 | } | ||
7548 | |||
7549 | // start the next in the queue if the last step wasn't forced | ||
7550 | // timers currently will call their complete callbacks, which will dequeue | ||
7551 | // but only if they were gotoEnd | ||
7552 | if ( dequeue || !gotoEnd ) { | ||
7553 | jQuery.dequeue( this, type ); | ||
7554 | } | ||
7555 | }); | ||
7556 | }, | ||
7557 | finish: function( type ) { | ||
7558 | if ( type !== false ) { | ||
7559 | type = type || "fx"; | ||
7560 | } | ||
7561 | return this.each(function() { | ||
7562 | var index, | ||
7563 | data = jQuery._data( this ), | ||
7564 | queue = data[ type + "queue" ], | ||
7565 | hooks = data[ type + "queueHooks" ], | ||
7566 | timers = jQuery.timers, | ||
7567 | length = queue ? queue.length : 0; | ||
7568 | |||
7569 | // enable finishing flag on private data | ||
7570 | data.finish = true; | ||
7571 | |||
7572 | // empty the queue first | ||
7573 | jQuery.queue( this, type, [] ); | ||
7574 | |||
7575 | if ( hooks && hooks.stop ) { | ||
7576 | hooks.stop.call( this, true ); | ||
7577 | } | ||
7578 | |||
7579 | // look for any active animations, and finish them | ||
7580 | for ( index = timers.length; index--; ) { | ||
7581 | if ( timers[ index ].elem === this && timers[ index ].queue === type ) { | ||
7582 | timers[ index ].anim.stop( true ); | ||
7583 | timers.splice( index, 1 ); | ||
7584 | } | ||
7585 | } | ||
7586 | |||
7587 | // look for any animations in the old queue and finish them | ||
7588 | for ( index = 0; index < length; index++ ) { | ||
7589 | if ( queue[ index ] && queue[ index ].finish ) { | ||
7590 | queue[ index ].finish.call( this ); | ||
7591 | } | ||
7592 | } | ||
7593 | |||
7594 | // turn off finishing flag | ||
7595 | delete data.finish; | ||
7596 | }); | ||
7597 | } | ||
7598 | }); | ||
7599 | |||
7600 | jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { | ||
7601 | var cssFn = jQuery.fn[ name ]; | ||
7602 | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
7603 | return speed == null || typeof speed === "boolean" ? | ||
7604 | cssFn.apply( this, arguments ) : | ||
7605 | this.animate( genFx( name, true ), speed, easing, callback ); | ||
7606 | }; | ||
7607 | }); | ||
7608 | |||
7609 | // Generate shortcuts for custom animations | ||
7610 | jQuery.each({ | ||
7611 | slideDown: genFx("show"), | ||
7612 | slideUp: genFx("hide"), | ||
7613 | slideToggle: genFx("toggle"), | ||
7614 | fadeIn: { opacity: "show" }, | ||
7615 | fadeOut: { opacity: "hide" }, | ||
7616 | fadeToggle: { opacity: "toggle" } | ||
7617 | }, function( name, props ) { | ||
7618 | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
7619 | return this.animate( props, speed, easing, callback ); | ||
7620 | }; | ||
7621 | }); | ||
7622 | |||
7623 | jQuery.timers = []; | ||
7624 | jQuery.fx.tick = function() { | ||
7625 | var timer, | ||
7626 | timers = jQuery.timers, | ||
7627 | i = 0; | ||
7628 | |||
7629 | fxNow = jQuery.now(); | ||
7630 | |||
7631 | for ( ; i < timers.length; i++ ) { | ||
7632 | timer = timers[ i ]; | ||
7633 | // Checks the timer has not already been removed | ||
7634 | if ( !timer() && timers[ i ] === timer ) { | ||
7635 | timers.splice( i--, 1 ); | ||
7636 | } | ||
7637 | } | ||
7638 | |||
7639 | if ( !timers.length ) { | ||
7640 | jQuery.fx.stop(); | ||
7641 | } | ||
7642 | fxNow = undefined; | ||
7643 | }; | ||
7644 | |||
7645 | jQuery.fx.timer = function( timer ) { | ||
7646 | jQuery.timers.push( timer ); | ||
7647 | if ( timer() ) { | ||
7648 | jQuery.fx.start(); | ||
7649 | } else { | ||
7650 | jQuery.timers.pop(); | ||
7651 | } | ||
7652 | }; | ||
7653 | |||
7654 | jQuery.fx.interval = 13; | ||
7655 | |||
7656 | jQuery.fx.start = function() { | ||
7657 | if ( !timerId ) { | ||
7658 | timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); | ||
7659 | } | ||
7660 | }; | ||
7661 | |||
7662 | jQuery.fx.stop = function() { | ||
7663 | clearInterval( timerId ); | ||
7664 | timerId = null; | ||
7665 | }; | ||
7666 | |||
7667 | jQuery.fx.speeds = { | ||
7668 | slow: 600, | ||
7669 | fast: 200, | ||
7670 | // Default speed | ||
7671 | _default: 400 | ||
7672 | }; | ||
7673 | |||
7674 | |||
7675 | // Based off of the plugin by Clint Helfers, with permission. | ||
7676 | // http://blindsignals.com/index.php/2009/07/jquery-delay/ | ||
7677 | jQuery.fn.delay = function( time, type ) { | ||
7678 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; | ||
7679 | type = type || "fx"; | ||
7680 | |||
7681 | return this.queue( type, function( next, hooks ) { | ||
7682 | var timeout = setTimeout( next, time ); | ||
7683 | hooks.stop = function() { | ||
7684 | clearTimeout( timeout ); | ||
7685 | }; | ||
7686 | }); | ||
7687 | }; | ||
7688 | |||
7689 | |||
7690 | (function() { | ||
7691 | // Minified: var a,b,c,d,e | ||
7692 | var input, div, select, a, opt; | ||
7693 | |||
7694 | // Setup | ||
7695 | div = document.createElement( "div" ); | ||
7696 | div.setAttribute( "className", "t" ); | ||
7697 | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; | ||
7698 | a = div.getElementsByTagName("a")[ 0 ]; | ||
7699 | |||
7700 | // First batch of tests. | ||
7701 | select = document.createElement("select"); | ||
7702 | opt = select.appendChild( document.createElement("option") ); | ||
7703 | input = div.getElementsByTagName("input")[ 0 ]; | ||
7704 | |||
7705 | a.style.cssText = "top:1px"; | ||
7706 | |||
7707 | // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) | ||
7708 | support.getSetAttribute = div.className !== "t"; | ||
7709 | |||
7710 | // Get the style information from getAttribute | ||
7711 | // (IE uses .cssText instead) | ||
7712 | support.style = /top/.test( a.getAttribute("style") ); | ||
7713 | |||
7714 | // Make sure that URLs aren't manipulated | ||
7715 | // (IE normalizes it by default) | ||
7716 | support.hrefNormalized = a.getAttribute("href") === "/a"; | ||
7717 | |||
7718 | // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) | ||
7719 | support.checkOn = !!input.value; | ||
7720 | |||
7721 | // Make sure that a selected-by-default option has a working selected property. | ||
7722 | // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) | ||
7723 | support.optSelected = opt.selected; | ||
7724 | |||
7725 | // Tests for enctype support on a form (#6743) | ||
7726 | support.enctype = !!document.createElement("form").enctype; | ||
7727 | |||
7728 | // Make sure that the options inside disabled selects aren't marked as disabled | ||
7729 | // (WebKit marks them as disabled) | ||
7730 | select.disabled = true; | ||
7731 | support.optDisabled = !opt.disabled; | ||
7732 | |||
7733 | // Support: IE8 only | ||
7734 | // Check if we can trust getAttribute("value") | ||
7735 | input = document.createElement( "input" ); | ||
7736 | input.setAttribute( "value", "" ); | ||
7737 | support.input = input.getAttribute( "value" ) === ""; | ||
7738 | |||
7739 | // Check if an input maintains its value after becoming a radio | ||
7740 | input.value = "t"; | ||
7741 | input.setAttribute( "type", "radio" ); | ||
7742 | support.radioValue = input.value === "t"; | ||
7743 | })(); | ||
7744 | |||
7745 | |||
7746 | var rreturn = /\r/g; | ||
7747 | |||
7748 | jQuery.fn.extend({ | ||
7749 | val: function( value ) { | ||
7750 | var hooks, ret, isFunction, | ||
7751 | elem = this[0]; | ||
7752 | |||
7753 | if ( !arguments.length ) { | ||
7754 | if ( elem ) { | ||
7755 | hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; | ||
7756 | |||
7757 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { | ||
7758 | return ret; | ||
7759 | } | ||
7760 | |||
7761 | ret = elem.value; | ||
7762 | |||
7763 | return typeof ret === "string" ? | ||
7764 | // handle most common string cases | ||
7765 | ret.replace(rreturn, "") : | ||
7766 | // handle cases where value is null/undef or number | ||
7767 | ret == null ? "" : ret; | ||
7768 | } | ||
7769 | |||
7770 | return; | ||
7771 | } | ||
7772 | |||
7773 | isFunction = jQuery.isFunction( value ); | ||
7774 | |||
7775 | return this.each(function( i ) { | ||
7776 | var val; | ||
7777 | |||
7778 | if ( this.nodeType !== 1 ) { | ||
7779 | return; | ||
7780 | } | ||
7781 | |||
7782 | if ( isFunction ) { | ||
7783 | val = value.call( this, i, jQuery( this ).val() ); | ||
7784 | } else { | ||
7785 | val = value; | ||
7786 | } | ||
7787 | |||
7788 | // Treat null/undefined as ""; convert numbers to string | ||
7789 | if ( val == null ) { | ||
7790 | val = ""; | ||
7791 | } else if ( typeof val === "number" ) { | ||
7792 | val += ""; | ||
7793 | } else if ( jQuery.isArray( val ) ) { | ||
7794 | val = jQuery.map( val, function( value ) { | ||
7795 | return value == null ? "" : value + ""; | ||
7796 | }); | ||
7797 | } | ||
7798 | |||
7799 | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; | ||
7800 | |||
7801 | // If set returns undefined, fall back to normal setting | ||
7802 | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { | ||
7803 | this.value = val; | ||
7804 | } | ||
7805 | }); | ||
7806 | } | ||
7807 | }); | ||
7808 | |||
7809 | jQuery.extend({ | ||
7810 | valHooks: { | ||
7811 | option: { | ||
7812 | get: function( elem ) { | ||
7813 | var val = jQuery.find.attr( elem, "value" ); | ||
7814 | return val != null ? | ||
7815 | val : | ||
7816 | // Support: IE10-11+ | ||
7817 | // option.text throws exceptions (#14686, #14858) | ||
7818 | jQuery.trim( jQuery.text( elem ) ); | ||
7819 | } | ||
7820 | }, | ||
7821 | select: { | ||
7822 | get: function( elem ) { | ||
7823 | var value, option, | ||
7824 | options = elem.options, | ||
7825 | index = elem.selectedIndex, | ||
7826 | one = elem.type === "select-one" || index < 0, | ||
7827 | values = one ? null : [], | ||
7828 | max = one ? index + 1 : options.length, | ||
7829 | i = index < 0 ? | ||
7830 | max : | ||
7831 | one ? index : 0; | ||
7832 | |||
7833 | // Loop through all the selected options | ||
7834 | for ( ; i < max; i++ ) { | ||
7835 | option = options[ i ]; | ||
7836 | |||
7837 | // oldIE doesn't update selected after form reset (#2551) | ||
7838 | if ( ( option.selected || i === index ) && | ||
7839 | // Don't return options that are disabled or in a disabled optgroup | ||
7840 | ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && | ||
7841 | ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { | ||
7842 | |||
7843 | // Get the specific value for the option | ||
7844 | value = jQuery( option ).val(); | ||
7845 | |||
7846 | // We don't need an array for one selects | ||
7847 | if ( one ) { | ||
7848 | return value; | ||
7849 | } | ||
7850 | |||
7851 | // Multi-Selects return an array | ||
7852 | values.push( value ); | ||
7853 | } | ||
7854 | } | ||
7855 | |||
7856 | return values; | ||
7857 | }, | ||
7858 | |||
7859 | set: function( elem, value ) { | ||
7860 | var optionSet, option, | ||
7861 | options = elem.options, | ||
7862 | values = jQuery.makeArray( value ), | ||
7863 | i = options.length; | ||
7864 | |||
7865 | while ( i-- ) { | ||
7866 | option = options[ i ]; | ||
7867 | |||
7868 | if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { | ||
7869 | |||
7870 | // Support: IE6 | ||
7871 | // When new option element is added to select box we need to | ||
7872 | // force reflow of newly added node in order to workaround delay | ||
7873 | // of initialization properties | ||
7874 | try { | ||
7875 | option.selected = optionSet = true; | ||
7876 | |||
7877 | } catch ( _ ) { | ||
7878 | |||
7879 | // Will be executed only in IE6 | ||
7880 | option.scrollHeight; | ||
7881 | } | ||
7882 | |||
7883 | } else { | ||
7884 | option.selected = false; | ||
7885 | } | ||
7886 | } | ||
7887 | |||
7888 | // Force browsers to behave consistently when non-matching value is set | ||
7889 | if ( !optionSet ) { | ||
7890 | elem.selectedIndex = -1; | ||
7891 | } | ||
7892 | |||
7893 | return options; | ||
7894 | } | ||
7895 | } | ||
7896 | } | ||
7897 | }); | ||
7898 | |||
7899 | // Radios and checkboxes getter/setter | ||
7900 | jQuery.each([ "radio", "checkbox" ], function() { | ||
7901 | jQuery.valHooks[ this ] = { | ||
7902 | set: function( elem, value ) { | ||
7903 | if ( jQuery.isArray( value ) ) { | ||
7904 | return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); | ||
7905 | } | ||
7906 | } | ||
7907 | }; | ||
7908 | if ( !support.checkOn ) { | ||
7909 | jQuery.valHooks[ this ].get = function( elem ) { | ||
7910 | // Support: Webkit | ||
7911 | // "" is returned instead of "on" if a value isn't specified | ||
7912 | return elem.getAttribute("value") === null ? "on" : elem.value; | ||
7913 | }; | ||
7914 | } | ||
7915 | }); | ||
7916 | |||
7917 | |||
7918 | |||
7919 | |||
7920 | var nodeHook, boolHook, | ||
7921 | attrHandle = jQuery.expr.attrHandle, | ||
7922 | ruseDefault = /^(?:checked|selected)$/i, | ||
7923 | getSetAttribute = support.getSetAttribute, | ||
7924 | getSetInput = support.input; | ||
7925 | |||
7926 | jQuery.fn.extend({ | ||
7927 | attr: function( name, value ) { | ||
7928 | return access( this, jQuery.attr, name, value, arguments.length > 1 ); | ||
7929 | }, | ||
7930 | |||
7931 | removeAttr: function( name ) { | ||
7932 | return this.each(function() { | ||
7933 | jQuery.removeAttr( this, name ); | ||
7934 | }); | ||
7935 | } | ||
7936 | }); | ||
7937 | |||
7938 | jQuery.extend({ | ||
7939 | attr: function( elem, name, value ) { | ||
7940 | var hooks, ret, | ||
7941 | nType = elem.nodeType; | ||
7942 | |||
7943 | // don't get/set attributes on text, comment and attribute nodes | ||
7944 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
7945 | return; | ||
7946 | } | ||
7947 | |||
7948 | // Fallback to prop when attributes are not supported | ||
7949 | if ( typeof elem.getAttribute === strundefined ) { | ||
7950 | return jQuery.prop( elem, name, value ); | ||
7951 | } | ||
7952 | |||
7953 | // All attributes are lowercase | ||
7954 | // Grab necessary hook if one is defined | ||
7955 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { | ||
7956 | name = name.toLowerCase(); | ||
7957 | hooks = jQuery.attrHooks[ name ] || | ||
7958 | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); | ||
7959 | } | ||
7960 | |||
7961 | if ( value !== undefined ) { | ||
7962 | |||
7963 | if ( value === null ) { | ||
7964 | jQuery.removeAttr( elem, name ); | ||
7965 | |||
7966 | } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { | ||
7967 | return ret; | ||
7968 | |||
7969 | } else { | ||
7970 | elem.setAttribute( name, value + "" ); | ||
7971 | return value; | ||
7972 | } | ||
7973 | |||
7974 | } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { | ||
7975 | return ret; | ||
7976 | |||
7977 | } else { | ||
7978 | ret = jQuery.find.attr( elem, name ); | ||
7979 | |||
7980 | // Non-existent attributes return null, we normalize to undefined | ||
7981 | return ret == null ? | ||
7982 | undefined : | ||
7983 | ret; | ||
7984 | } | ||
7985 | }, | ||
7986 | |||
7987 | removeAttr: function( elem, value ) { | ||
7988 | var name, propName, | ||
7989 | i = 0, | ||
7990 | attrNames = value && value.match( rnotwhite ); | ||
7991 | |||
7992 | if ( attrNames && elem.nodeType === 1 ) { | ||
7993 | while ( (name = attrNames[i++]) ) { | ||
7994 | propName = jQuery.propFix[ name ] || name; | ||
7995 | |||
7996 | // Boolean attributes get special treatment (#10870) | ||
7997 | if ( jQuery.expr.match.bool.test( name ) ) { | ||
7998 | // Set corresponding property to false | ||
7999 | if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { | ||
8000 | elem[ propName ] = false; | ||
8001 | // Support: IE<9 | ||
8002 | // Also clear defaultChecked/defaultSelected (if appropriate) | ||
8003 | } else { | ||
8004 | elem[ jQuery.camelCase( "default-" + name ) ] = | ||
8005 | elem[ propName ] = false; | ||
8006 | } | ||
8007 | |||
8008 | // See #9699 for explanation of this approach (setting first, then removal) | ||
8009 | } else { | ||
8010 | jQuery.attr( elem, name, "" ); | ||
8011 | } | ||
8012 | |||
8013 | elem.removeAttribute( getSetAttribute ? name : propName ); | ||
8014 | } | ||
8015 | } | ||
8016 | }, | ||
8017 | |||
8018 | attrHooks: { | ||
8019 | type: { | ||
8020 | set: function( elem, value ) { | ||
8021 | if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { | ||
8022 | // Setting the type on a radio button after the value resets the value in IE6-9 | ||
8023 | // Reset value to default in case type is set after value during creation | ||
8024 | var val = elem.value; | ||
8025 | elem.setAttribute( "type", value ); | ||
8026 | if ( val ) { | ||
8027 | elem.value = val; | ||
8028 | } | ||
8029 | return value; | ||
8030 | } | ||
8031 | } | ||
8032 | } | ||
8033 | } | ||
8034 | }); | ||
8035 | |||
8036 | // Hook for boolean attributes | ||
8037 | boolHook = { | ||
8038 | set: function( elem, value, name ) { | ||
8039 | if ( value === false ) { | ||
8040 | // Remove boolean attributes when set to false | ||
8041 | jQuery.removeAttr( elem, name ); | ||
8042 | } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { | ||
8043 | // IE<8 needs the *property* name | ||
8044 | elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); | ||
8045 | |||
8046 | // Use defaultChecked and defaultSelected for oldIE | ||
8047 | } else { | ||
8048 | elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; | ||
8049 | } | ||
8050 | |||
8051 | return name; | ||
8052 | } | ||
8053 | }; | ||
8054 | |||
8055 | // Retrieve booleans specially | ||
8056 | jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { | ||
8057 | |||
8058 | var getter = attrHandle[ name ] || jQuery.find.attr; | ||
8059 | |||
8060 | attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? | ||
8061 | function( elem, name, isXML ) { | ||
8062 | var ret, handle; | ||
8063 | if ( !isXML ) { | ||
8064 | // Avoid an infinite loop by temporarily removing this function from the getter | ||
8065 | handle = attrHandle[ name ]; | ||
8066 | attrHandle[ name ] = ret; | ||
8067 | ret = getter( elem, name, isXML ) != null ? | ||
8068 | name.toLowerCase() : | ||
8069 | null; | ||
8070 | attrHandle[ name ] = handle; | ||
8071 | } | ||
8072 | return ret; | ||
8073 | } : | ||
8074 | function( elem, name, isXML ) { | ||
8075 | if ( !isXML ) { | ||
8076 | return elem[ jQuery.camelCase( "default-" + name ) ] ? | ||
8077 | name.toLowerCase() : | ||
8078 | null; | ||
8079 | } | ||
8080 | }; | ||
8081 | }); | ||
8082 | |||
8083 | // fix oldIE attroperties | ||
8084 | if ( !getSetInput || !getSetAttribute ) { | ||
8085 | jQuery.attrHooks.value = { | ||
8086 | set: function( elem, value, name ) { | ||
8087 | if ( jQuery.nodeName( elem, "input" ) ) { | ||
8088 | // Does not return so that setAttribute is also used | ||
8089 | elem.defaultValue = value; | ||
8090 | } else { | ||
8091 | // Use nodeHook if defined (#1954); otherwise setAttribute is fine | ||
8092 | return nodeHook && nodeHook.set( elem, value, name ); | ||
8093 | } | ||
8094 | } | ||
8095 | }; | ||
8096 | } | ||
8097 | |||
8098 | // IE6/7 do not support getting/setting some attributes with get/setAttribute | ||
8099 | if ( !getSetAttribute ) { | ||
8100 | |||
8101 | // Use this for any attribute in IE6/7 | ||
8102 | // This fixes almost every IE6/7 issue | ||
8103 | nodeHook = { | ||
8104 | set: function( elem, value, name ) { | ||
8105 | // Set the existing or create a new attribute node | ||
8106 | var ret = elem.getAttributeNode( name ); | ||
8107 | if ( !ret ) { | ||
8108 | elem.setAttributeNode( | ||
8109 | (ret = elem.ownerDocument.createAttribute( name )) | ||
8110 | ); | ||
8111 | } | ||
8112 | |||
8113 | ret.value = value += ""; | ||
8114 | |||
8115 | // Break association with cloned elements by also using setAttribute (#9646) | ||
8116 | if ( name === "value" || value === elem.getAttribute( name ) ) { | ||
8117 | return value; | ||
8118 | } | ||
8119 | } | ||
8120 | }; | ||
8121 | |||
8122 | // Some attributes are constructed with empty-string values when not defined | ||
8123 | attrHandle.id = attrHandle.name = attrHandle.coords = | ||
8124 | function( elem, name, isXML ) { | ||
8125 | var ret; | ||
8126 | if ( !isXML ) { | ||
8127 | return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? | ||
8128 | ret.value : | ||
8129 | null; | ||
8130 | } | ||
8131 | }; | ||
8132 | |||
8133 | // Fixing value retrieval on a button requires this module | ||
8134 | jQuery.valHooks.button = { | ||
8135 | get: function( elem, name ) { | ||
8136 | var ret = elem.getAttributeNode( name ); | ||
8137 | if ( ret && ret.specified ) { | ||
8138 | return ret.value; | ||
8139 | } | ||
8140 | }, | ||
8141 | set: nodeHook.set | ||
8142 | }; | ||
8143 | |||
8144 | // Set contenteditable to false on removals(#10429) | ||
8145 | // Setting to empty string throws an error as an invalid value | ||
8146 | jQuery.attrHooks.contenteditable = { | ||
8147 | set: function( elem, value, name ) { | ||
8148 | nodeHook.set( elem, value === "" ? false : value, name ); | ||
8149 | } | ||
8150 | }; | ||
8151 | |||
8152 | // Set width and height to auto instead of 0 on empty string( Bug #8150 ) | ||
8153 | // This is for removals | ||
8154 | jQuery.each([ "width", "height" ], function( i, name ) { | ||
8155 | jQuery.attrHooks[ name ] = { | ||
8156 | set: function( elem, value ) { | ||
8157 | if ( value === "" ) { | ||
8158 | elem.setAttribute( name, "auto" ); | ||
8159 | return value; | ||
8160 | } | ||
8161 | } | ||
8162 | }; | ||
8163 | }); | ||
8164 | } | ||
8165 | |||
8166 | if ( !support.style ) { | ||
8167 | jQuery.attrHooks.style = { | ||
8168 | get: function( elem ) { | ||
8169 | // Return undefined in the case of empty string | ||
8170 | // Note: IE uppercases css property names, but if we were to .toLowerCase() | ||
8171 | // .cssText, that would destroy case senstitivity in URL's, like in "background" | ||
8172 | return elem.style.cssText || undefined; | ||
8173 | }, | ||
8174 | set: function( elem, value ) { | ||
8175 | return ( elem.style.cssText = value + "" ); | ||
8176 | } | ||
8177 | }; | ||
8178 | } | ||
8179 | |||
8180 | |||
8181 | |||
8182 | |||
8183 | var rfocusable = /^(?:input|select|textarea|button|object)$/i, | ||
8184 | rclickable = /^(?:a|area)$/i; | ||
8185 | |||
8186 | jQuery.fn.extend({ | ||
8187 | prop: function( name, value ) { | ||
8188 | return access( this, jQuery.prop, name, value, arguments.length > 1 ); | ||
8189 | }, | ||
8190 | |||
8191 | removeProp: function( name ) { | ||
8192 | name = jQuery.propFix[ name ] || name; | ||
8193 | return this.each(function() { | ||
8194 | // try/catch handles cases where IE balks (such as removing a property on window) | ||
8195 | try { | ||
8196 | this[ name ] = undefined; | ||
8197 | delete this[ name ]; | ||
8198 | } catch( e ) {} | ||
8199 | }); | ||
8200 | } | ||
8201 | }); | ||
8202 | |||
8203 | jQuery.extend({ | ||
8204 | propFix: { | ||
8205 | "for": "htmlFor", | ||
8206 | "class": "className" | ||
8207 | }, | ||
8208 | |||
8209 | prop: function( elem, name, value ) { | ||
8210 | var ret, hooks, notxml, | ||
8211 | nType = elem.nodeType; | ||
8212 | |||
8213 | // don't get/set properties on text, comment and attribute nodes | ||
8214 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
8215 | return; | ||
8216 | } | ||
8217 | |||
8218 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); | ||
8219 | |||
8220 | if ( notxml ) { | ||
8221 | // Fix name and attach hooks | ||
8222 | name = jQuery.propFix[ name ] || name; | ||
8223 | hooks = jQuery.propHooks[ name ]; | ||
8224 | } | ||
8225 | |||
8226 | if ( value !== undefined ) { | ||
8227 | return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? | ||
8228 | ret : | ||
8229 | ( elem[ name ] = value ); | ||
8230 | |||
8231 | } else { | ||
8232 | return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? | ||
8233 | ret : | ||
8234 | elem[ name ]; | ||
8235 | } | ||
8236 | }, | ||
8237 | |||
8238 | propHooks: { | ||
8239 | tabIndex: { | ||
8240 | get: function( elem ) { | ||
8241 | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set | ||
8242 | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ | ||
8243 | // Use proper attribute retrieval(#12072) | ||
8244 | var tabindex = jQuery.find.attr( elem, "tabindex" ); | ||
8245 | |||
8246 | return tabindex ? | ||
8247 | parseInt( tabindex, 10 ) : | ||
8248 | rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? | ||
8249 | 0 : | ||
8250 | -1; | ||
8251 | } | ||
8252 | } | ||
8253 | } | ||
8254 | }); | ||
8255 | |||
8256 | // Some attributes require a special call on IE | ||
8257 | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | ||
8258 | if ( !support.hrefNormalized ) { | ||
8259 | // href/src property should get the full normalized URL (#10299/#12915) | ||
8260 | jQuery.each([ "href", "src" ], function( i, name ) { | ||
8261 | jQuery.propHooks[ name ] = { | ||
8262 | get: function( elem ) { | ||
8263 | return elem.getAttribute( name, 4 ); | ||
8264 | } | ||
8265 | }; | ||
8266 | }); | ||
8267 | } | ||
8268 | |||
8269 | // Support: Safari, IE9+ | ||
8270 | // mis-reports the default selected property of an option | ||
8271 | // Accessing the parent's selectedIndex property fixes it | ||
8272 | if ( !support.optSelected ) { | ||
8273 | jQuery.propHooks.selected = { | ||
8274 | get: function( elem ) { | ||
8275 | var parent = elem.parentNode; | ||
8276 | |||
8277 | if ( parent ) { | ||
8278 | parent.selectedIndex; | ||
8279 | |||
8280 | // Make sure that it also works with optgroups, see #5701 | ||
8281 | if ( parent.parentNode ) { | ||
8282 | parent.parentNode.selectedIndex; | ||
8283 | } | ||
8284 | } | ||
8285 | return null; | ||
8286 | } | ||
8287 | }; | ||
8288 | } | ||
8289 | |||
8290 | jQuery.each([ | ||
8291 | "tabIndex", | ||
8292 | "readOnly", | ||
8293 | "maxLength", | ||
8294 | "cellSpacing", | ||
8295 | "cellPadding", | ||
8296 | "rowSpan", | ||
8297 | "colSpan", | ||
8298 | "useMap", | ||
8299 | "frameBorder", | ||
8300 | "contentEditable" | ||
8301 | ], function() { | ||
8302 | jQuery.propFix[ this.toLowerCase() ] = this; | ||
8303 | }); | ||
8304 | |||
8305 | // IE6/7 call enctype encoding | ||
8306 | if ( !support.enctype ) { | ||
8307 | jQuery.propFix.enctype = "encoding"; | ||
8308 | } | ||
8309 | |||
8310 | |||
8311 | |||
8312 | |||
8313 | var rclass = /[\t\r\n\f]/g; | ||
8314 | |||
8315 | jQuery.fn.extend({ | ||
8316 | addClass: function( value ) { | ||
8317 | var classes, elem, cur, clazz, j, finalValue, | ||
8318 | i = 0, | ||
8319 | len = this.length, | ||
8320 | proceed = typeof value === "string" && value; | ||
8321 | |||
8322 | if ( jQuery.isFunction( value ) ) { | ||
8323 | return this.each(function( j ) { | ||
8324 | jQuery( this ).addClass( value.call( this, j, this.className ) ); | ||
8325 | }); | ||
8326 | } | ||
8327 | |||
8328 | if ( proceed ) { | ||
8329 | // The disjunction here is for better compressibility (see removeClass) | ||
8330 | classes = ( value || "" ).match( rnotwhite ) || []; | ||
8331 | |||
8332 | for ( ; i < len; i++ ) { | ||
8333 | elem = this[ i ]; | ||
8334 | cur = elem.nodeType === 1 && ( elem.className ? | ||
8335 | ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
8336 | " " | ||
8337 | ); | ||
8338 | |||
8339 | if ( cur ) { | ||
8340 | j = 0; | ||
8341 | while ( (clazz = classes[j++]) ) { | ||
8342 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { | ||
8343 | cur += clazz + " "; | ||
8344 | } | ||
8345 | } | ||
8346 | |||
8347 | // only assign if different to avoid unneeded rendering. | ||
8348 | finalValue = jQuery.trim( cur ); | ||
8349 | if ( elem.className !== finalValue ) { | ||
8350 | elem.className = finalValue; | ||
8351 | } | ||
8352 | } | ||
8353 | } | ||
8354 | } | ||
8355 | |||
8356 | return this; | ||
8357 | }, | ||
8358 | |||
8359 | removeClass: function( value ) { | ||
8360 | var classes, elem, cur, clazz, j, finalValue, | ||
8361 | i = 0, | ||
8362 | len = this.length, | ||
8363 | proceed = arguments.length === 0 || typeof value === "string" && value; | ||
8364 | |||
8365 | if ( jQuery.isFunction( value ) ) { | ||
8366 | return this.each(function( j ) { | ||
8367 | jQuery( this ).removeClass( value.call( this, j, this.className ) ); | ||
8368 | }); | ||
8369 | } | ||
8370 | if ( proceed ) { | ||
8371 | classes = ( value || "" ).match( rnotwhite ) || []; | ||
8372 | |||
8373 | for ( ; i < len; i++ ) { | ||
8374 | elem = this[ i ]; | ||
8375 | // This expression is here for better compressibility (see addClass) | ||
8376 | cur = elem.nodeType === 1 && ( elem.className ? | ||
8377 | ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
8378 | "" | ||
8379 | ); | ||
8380 | |||
8381 | if ( cur ) { | ||
8382 | j = 0; | ||
8383 | while ( (clazz = classes[j++]) ) { | ||
8384 | // Remove *all* instances | ||
8385 | while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { | ||
8386 | cur = cur.replace( " " + clazz + " ", " " ); | ||
8387 | } | ||
8388 | } | ||
8389 | |||
8390 | // only assign if different to avoid unneeded rendering. | ||
8391 | finalValue = value ? jQuery.trim( cur ) : ""; | ||
8392 | if ( elem.className !== finalValue ) { | ||
8393 | elem.className = finalValue; | ||
8394 | } | ||
8395 | } | ||
8396 | } | ||
8397 | } | ||
8398 | |||
8399 | return this; | ||
8400 | }, | ||
8401 | |||
8402 | toggleClass: function( value, stateVal ) { | ||
8403 | var type = typeof value; | ||
8404 | |||
8405 | if ( typeof stateVal === "boolean" && type === "string" ) { | ||
8406 | return stateVal ? this.addClass( value ) : this.removeClass( value ); | ||
8407 | } | ||
8408 | |||
8409 | if ( jQuery.isFunction( value ) ) { | ||
8410 | return this.each(function( i ) { | ||
8411 | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); | ||
8412 | }); | ||
8413 | } | ||
8414 | |||
8415 | return this.each(function() { | ||
8416 | if ( type === "string" ) { | ||
8417 | // toggle individual class names | ||
8418 | var className, | ||
8419 | i = 0, | ||
8420 | self = jQuery( this ), | ||
8421 | classNames = value.match( rnotwhite ) || []; | ||
8422 | |||
8423 | while ( (className = classNames[ i++ ]) ) { | ||
8424 | // check each className given, space separated list | ||
8425 | if ( self.hasClass( className ) ) { | ||
8426 | self.removeClass( className ); | ||
8427 | } else { | ||
8428 | self.addClass( className ); | ||
8429 | } | ||
8430 | } | ||
8431 | |||
8432 | // Toggle whole class name | ||
8433 | } else if ( type === strundefined || type === "boolean" ) { | ||
8434 | if ( this.className ) { | ||
8435 | // store className if set | ||
8436 | jQuery._data( this, "__className__", this.className ); | ||
8437 | } | ||
8438 | |||
8439 | // If the element has a class name or if we're passed "false", | ||
8440 | // then remove the whole classname (if there was one, the above saved it). | ||
8441 | // Otherwise bring back whatever was previously saved (if anything), | ||
8442 | // falling back to the empty string if nothing was stored. | ||
8443 | this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; | ||
8444 | } | ||
8445 | }); | ||
8446 | }, | ||
8447 | |||
8448 | hasClass: function( selector ) { | ||
8449 | var className = " " + selector + " ", | ||
8450 | i = 0, | ||
8451 | l = this.length; | ||
8452 | for ( ; i < l; i++ ) { | ||
8453 | if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { | ||
8454 | return true; | ||
8455 | } | ||
8456 | } | ||
8457 | |||
8458 | return false; | ||
8459 | } | ||
8460 | }); | ||
8461 | |||
8462 | |||
8463 | |||
8464 | |||
8465 | // Return jQuery for attributes-only inclusion | ||
8466 | |||
8467 | |||
8468 | jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + | ||
8469 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + | ||
8470 | "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { | ||
8471 | |||
8472 | // Handle event binding | ||
8473 | jQuery.fn[ name ] = function( data, fn ) { | ||
8474 | return arguments.length > 0 ? | ||
8475 | this.on( name, null, data, fn ) : | ||
8476 | this.trigger( name ); | ||
8477 | }; | ||
8478 | }); | ||
8479 | |||
8480 | jQuery.fn.extend({ | ||
8481 | hover: function( fnOver, fnOut ) { | ||
8482 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); | ||
8483 | }, | ||
8484 | |||
8485 | bind: function( types, data, fn ) { | ||
8486 | return this.on( types, null, data, fn ); | ||
8487 | }, | ||
8488 | unbind: function( types, fn ) { | ||
8489 | return this.off( types, null, fn ); | ||
8490 | }, | ||
8491 | |||
8492 | delegate: function( selector, types, data, fn ) { | ||
8493 | return this.on( types, selector, data, fn ); | ||
8494 | }, | ||
8495 | undelegate: function( selector, types, fn ) { | ||
8496 | // ( namespace ) or ( selector, types [, fn] ) | ||
8497 | return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); | ||
8498 | } | ||
8499 | }); | ||
8500 | |||
8501 | |||
8502 | var nonce = jQuery.now(); | ||
8503 | |||
8504 | var rquery = (/\?/); | ||
8505 | |||
8506 | |||
8507 | |||
8508 | var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; | ||
8509 | |||
8510 | jQuery.parseJSON = function( data ) { | ||
8511 | // Attempt to parse using the native JSON parser first | ||
8512 | if ( window.JSON && window.JSON.parse ) { | ||
8513 | // Support: Android 2.3 | ||
8514 | // Workaround failure to string-cast null input | ||
8515 | return window.JSON.parse( data + "" ); | ||
8516 | } | ||
8517 | |||
8518 | var requireNonComma, | ||
8519 | depth = null, | ||
8520 | str = jQuery.trim( data + "" ); | ||
8521 | |||
8522 | // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains | ||
8523 | // after removing valid tokens | ||
8524 | return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { | ||
8525 | |||
8526 | // Force termination if we see a misplaced comma | ||
8527 | if ( requireNonComma && comma ) { | ||
8528 | depth = 0; | ||
8529 | } | ||
8530 | |||
8531 | // Perform no more replacements after returning to outermost depth | ||
8532 | if ( depth === 0 ) { | ||
8533 | return token; | ||
8534 | } | ||
8535 | |||
8536 | // Commas must not follow "[", "{", or "," | ||
8537 | requireNonComma = open || comma; | ||
8538 | |||
8539 | // Determine new depth | ||
8540 | // array/object open ("[" or "{"): depth += true - false (increment) | ||
8541 | // array/object close ("]" or "}"): depth += false - true (decrement) | ||
8542 | // other cases ("," or primitive): depth += true - true (numeric cast) | ||
8543 | depth += !close - !open; | ||
8544 | |||
8545 | // Remove this token | ||
8546 | return ""; | ||
8547 | }) ) ? | ||
8548 | ( Function( "return " + str ) )() : | ||
8549 | jQuery.error( "Invalid JSON: " + data ); | ||
8550 | }; | ||
8551 | |||
8552 | |||
8553 | // Cross-browser xml parsing | ||
8554 | jQuery.parseXML = function( data ) { | ||
8555 | var xml, tmp; | ||
8556 | if ( !data || typeof data !== "string" ) { | ||
8557 | return null; | ||
8558 | } | ||
8559 | try { | ||
8560 | if ( window.DOMParser ) { // Standard | ||
8561 | tmp = new DOMParser(); | ||
8562 | xml = tmp.parseFromString( data, "text/xml" ); | ||
8563 | } else { // IE | ||
8564 | xml = new ActiveXObject( "Microsoft.XMLDOM" ); | ||
8565 | xml.async = "false"; | ||
8566 | xml.loadXML( data ); | ||
8567 | } | ||
8568 | } catch( e ) { | ||
8569 | xml = undefined; | ||
8570 | } | ||
8571 | if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { | ||
8572 | jQuery.error( "Invalid XML: " + data ); | ||
8573 | } | ||
8574 | return xml; | ||
8575 | }; | ||
8576 | |||
8577 | |||
8578 | var | ||
8579 | // Document location | ||
8580 | ajaxLocParts, | ||
8581 | ajaxLocation, | ||
8582 | |||
8583 | rhash = /#.*$/, | ||
8584 | rts = /([?&])_=[^&]*/, | ||
8585 | rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL | ||
8586 | // #7653, #8125, #8152: local protocol detection | ||
8587 | rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | ||
8588 | rnoContent = /^(?:GET|HEAD)$/, | ||
8589 | rprotocol = /^\/\//, | ||
8590 | rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, | ||
8591 | |||
8592 | /* Prefilters | ||
8593 | * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) | ||
8594 | * 2) These are called: | ||
8595 | * - BEFORE asking for a transport | ||
8596 | * - AFTER param serialization (s.data is a string if s.processData is true) | ||
8597 | * 3) key is the dataType | ||
8598 | * 4) the catchall symbol "*" can be used | ||
8599 | * 5) execution will start with transport dataType and THEN continue down to "*" if needed | ||
8600 | */ | ||
8601 | prefilters = {}, | ||
8602 | |||
8603 | /* Transports bindings | ||
8604 | * 1) key is the dataType | ||
8605 | * 2) the catchall symbol "*" can be used | ||
8606 | * 3) selection will start with transport dataType and THEN go to "*" if needed | ||
8607 | */ | ||
8608 | transports = {}, | ||
8609 | |||
8610 | // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression | ||
8611 | allTypes = "*/".concat("*"); | ||
8612 | |||
8613 | // #8138, IE may throw an exception when accessing | ||
8614 | // a field from window.location if document.domain has been set | ||
8615 | try { | ||
8616 | ajaxLocation = location.href; | ||
8617 | } catch( e ) { | ||
8618 | // Use the href attribute of an A element | ||
8619 | // since IE will modify it given document.location | ||
8620 | ajaxLocation = document.createElement( "a" ); | ||
8621 | ajaxLocation.href = ""; | ||
8622 | ajaxLocation = ajaxLocation.href; | ||
8623 | } | ||
8624 | |||
8625 | // Segment location into parts | ||
8626 | ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; | ||
8627 | |||
8628 | // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport | ||
8629 | function addToPrefiltersOrTransports( structure ) { | ||
8630 | |||
8631 | // dataTypeExpression is optional and defaults to "*" | ||
8632 | return function( dataTypeExpression, func ) { | ||
8633 | |||
8634 | if ( typeof dataTypeExpression !== "string" ) { | ||
8635 | func = dataTypeExpression; | ||
8636 | dataTypeExpression = "*"; | ||
8637 | } | ||
8638 | |||
8639 | var dataType, | ||
8640 | i = 0, | ||
8641 | dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; | ||
8642 | |||
8643 | if ( jQuery.isFunction( func ) ) { | ||
8644 | // For each dataType in the dataTypeExpression | ||
8645 | while ( (dataType = dataTypes[i++]) ) { | ||
8646 | // Prepend if requested | ||
8647 | if ( dataType.charAt( 0 ) === "+" ) { | ||
8648 | dataType = dataType.slice( 1 ) || "*"; | ||
8649 | (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); | ||
8650 | |||
8651 | // Otherwise append | ||
8652 | } else { | ||
8653 | (structure[ dataType ] = structure[ dataType ] || []).push( func ); | ||
8654 | } | ||
8655 | } | ||
8656 | } | ||
8657 | }; | ||
8658 | } | ||
8659 | |||
8660 | // Base inspection function for prefilters and transports | ||
8661 | function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { | ||
8662 | |||
8663 | var inspected = {}, | ||
8664 | seekingTransport = ( structure === transports ); | ||
8665 | |||
8666 | function inspect( dataType ) { | ||
8667 | var selected; | ||
8668 | inspected[ dataType ] = true; | ||
8669 | jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { | ||
8670 | var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); | ||
8671 | if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { | ||
8672 | options.dataTypes.unshift( dataTypeOrTransport ); | ||
8673 | inspect( dataTypeOrTransport ); | ||
8674 | return false; | ||
8675 | } else if ( seekingTransport ) { | ||
8676 | return !( selected = dataTypeOrTransport ); | ||
8677 | } | ||
8678 | }); | ||
8679 | return selected; | ||
8680 | } | ||
8681 | |||
8682 | return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); | ||
8683 | } | ||
8684 | |||
8685 | // A special extend for ajax options | ||
8686 | // that takes "flat" options (not to be deep extended) | ||
8687 | // Fixes #9887 | ||
8688 | function ajaxExtend( target, src ) { | ||
8689 | var deep, key, | ||
8690 | flatOptions = jQuery.ajaxSettings.flatOptions || {}; | ||
8691 | |||
8692 | for ( key in src ) { | ||
8693 | if ( src[ key ] !== undefined ) { | ||
8694 | ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; | ||
8695 | } | ||
8696 | } | ||
8697 | if ( deep ) { | ||
8698 | jQuery.extend( true, target, deep ); | ||
8699 | } | ||
8700 | |||
8701 | return target; | ||
8702 | } | ||
8703 | |||
8704 | /* Handles responses to an ajax request: | ||
8705 | * - finds the right dataType (mediates between content-type and expected dataType) | ||
8706 | * - returns the corresponding response | ||
8707 | */ | ||
8708 | function ajaxHandleResponses( s, jqXHR, responses ) { | ||
8709 | var firstDataType, ct, finalDataType, type, | ||
8710 | contents = s.contents, | ||
8711 | dataTypes = s.dataTypes; | ||
8712 | |||
8713 | // Remove auto dataType and get content-type in the process | ||
8714 | while ( dataTypes[ 0 ] === "*" ) { | ||
8715 | dataTypes.shift(); | ||
8716 | if ( ct === undefined ) { | ||
8717 | ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); | ||
8718 | } | ||
8719 | } | ||
8720 | |||
8721 | // Check if we're dealing with a known content-type | ||
8722 | if ( ct ) { | ||
8723 | for ( type in contents ) { | ||
8724 | if ( contents[ type ] && contents[ type ].test( ct ) ) { | ||
8725 | dataTypes.unshift( type ); | ||
8726 | break; | ||
8727 | } | ||
8728 | } | ||
8729 | } | ||
8730 | |||
8731 | // Check to see if we have a response for the expected dataType | ||
8732 | if ( dataTypes[ 0 ] in responses ) { | ||
8733 | finalDataType = dataTypes[ 0 ]; | ||
8734 | } else { | ||
8735 | // Try convertible dataTypes | ||
8736 | for ( type in responses ) { | ||
8737 | if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { | ||
8738 | finalDataType = type; | ||
8739 | break; | ||
8740 | } | ||
8741 | if ( !firstDataType ) { | ||
8742 | firstDataType = type; | ||
8743 | } | ||
8744 | } | ||
8745 | // Or just use first one | ||
8746 | finalDataType = finalDataType || firstDataType; | ||
8747 | } | ||
8748 | |||
8749 | // If we found a dataType | ||
8750 | // We add the dataType to the list if needed | ||
8751 | // and return the corresponding response | ||
8752 | if ( finalDataType ) { | ||
8753 | if ( finalDataType !== dataTypes[ 0 ] ) { | ||
8754 | dataTypes.unshift( finalDataType ); | ||
8755 | } | ||
8756 | return responses[ finalDataType ]; | ||
8757 | } | ||
8758 | } | ||
8759 | |||
8760 | /* Chain conversions given the request and the original response | ||
8761 | * Also sets the responseXXX fields on the jqXHR instance | ||
8762 | */ | ||
8763 | function ajaxConvert( s, response, jqXHR, isSuccess ) { | ||
8764 | var conv2, current, conv, tmp, prev, | ||
8765 | converters = {}, | ||
8766 | // Work with a copy of dataTypes in case we need to modify it for conversion | ||
8767 | dataTypes = s.dataTypes.slice(); | ||
8768 | |||
8769 | // Create converters map with lowercased keys | ||
8770 | if ( dataTypes[ 1 ] ) { | ||
8771 | for ( conv in s.converters ) { | ||
8772 | converters[ conv.toLowerCase() ] = s.converters[ conv ]; | ||
8773 | } | ||
8774 | } | ||
8775 | |||
8776 | current = dataTypes.shift(); | ||
8777 | |||
8778 | // Convert to each sequential dataType | ||
8779 | while ( current ) { | ||
8780 | |||
8781 | if ( s.responseFields[ current ] ) { | ||
8782 | jqXHR[ s.responseFields[ current ] ] = response; | ||
8783 | } | ||
8784 | |||
8785 | // Apply the dataFilter if provided | ||
8786 | if ( !prev && isSuccess && s.dataFilter ) { | ||
8787 | response = s.dataFilter( response, s.dataType ); | ||
8788 | } | ||
8789 | |||
8790 | prev = current; | ||
8791 | current = dataTypes.shift(); | ||
8792 | |||
8793 | if ( current ) { | ||
8794 | |||
8795 | // There's only work to do if current dataType is non-auto | ||
8796 | if ( current === "*" ) { | ||
8797 | |||
8798 | current = prev; | ||
8799 | |||
8800 | // Convert response if prev dataType is non-auto and differs from current | ||
8801 | } else if ( prev !== "*" && prev !== current ) { | ||
8802 | |||
8803 | // Seek a direct converter | ||
8804 | conv = converters[ prev + " " + current ] || converters[ "* " + current ]; | ||
8805 | |||
8806 | // If none found, seek a pair | ||
8807 | if ( !conv ) { | ||
8808 | for ( conv2 in converters ) { | ||
8809 | |||
8810 | // If conv2 outputs current | ||
8811 | tmp = conv2.split( " " ); | ||
8812 | if ( tmp[ 1 ] === current ) { | ||
8813 | |||
8814 | // If prev can be converted to accepted input | ||
8815 | conv = converters[ prev + " " + tmp[ 0 ] ] || | ||
8816 | converters[ "* " + tmp[ 0 ] ]; | ||
8817 | if ( conv ) { | ||
8818 | // Condense equivalence converters | ||
8819 | if ( conv === true ) { | ||
8820 | conv = converters[ conv2 ]; | ||
8821 | |||
8822 | // Otherwise, insert the intermediate dataType | ||
8823 | } else if ( converters[ conv2 ] !== true ) { | ||
8824 | current = tmp[ 0 ]; | ||
8825 | dataTypes.unshift( tmp[ 1 ] ); | ||
8826 | } | ||
8827 | break; | ||
8828 | } | ||
8829 | } | ||
8830 | } | ||
8831 | } | ||
8832 | |||
8833 | // Apply converter (if not an equivalence) | ||
8834 | if ( conv !== true ) { | ||
8835 | |||
8836 | // Unless errors are allowed to bubble, catch and return them | ||
8837 | if ( conv && s[ "throws" ] ) { | ||
8838 | response = conv( response ); | ||
8839 | } else { | ||
8840 | try { | ||
8841 | response = conv( response ); | ||
8842 | } catch ( e ) { | ||
8843 | return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; | ||
8844 | } | ||
8845 | } | ||
8846 | } | ||
8847 | } | ||
8848 | } | ||
8849 | } | ||
8850 | |||
8851 | return { state: "success", data: response }; | ||
8852 | } | ||
8853 | |||
8854 | jQuery.extend({ | ||
8855 | |||
8856 | // Counter for holding the number of active queries | ||
8857 | active: 0, | ||
8858 | |||
8859 | // Last-Modified header cache for next request | ||
8860 | lastModified: {}, | ||
8861 | etag: {}, | ||
8862 | |||
8863 | ajaxSettings: { | ||
8864 | url: ajaxLocation, | ||
8865 | type: "GET", | ||
8866 | isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), | ||
8867 | global: true, | ||
8868 | processData: true, | ||
8869 | async: true, | ||
8870 | contentType: "application/x-www-form-urlencoded; charset=UTF-8", | ||
8871 | /* | ||
8872 | timeout: 0, | ||
8873 | data: null, | ||
8874 | dataType: null, | ||
8875 | username: null, | ||
8876 | password: null, | ||
8877 | cache: null, | ||
8878 | throws: false, | ||
8879 | traditional: false, | ||
8880 | headers: {}, | ||
8881 | */ | ||
8882 | |||
8883 | accepts: { | ||
8884 | "*": allTypes, | ||
8885 | text: "text/plain", | ||
8886 | html: "text/html", | ||
8887 | xml: "application/xml, text/xml", | ||
8888 | json: "application/json, text/javascript" | ||
8889 | }, | ||
8890 | |||
8891 | contents: { | ||
8892 | xml: /xml/, | ||
8893 | html: /html/, | ||
8894 | json: /json/ | ||
8895 | }, | ||
8896 | |||
8897 | responseFields: { | ||
8898 | xml: "responseXML", | ||
8899 | text: "responseText", | ||
8900 | json: "responseJSON" | ||
8901 | }, | ||
8902 | |||
8903 | // Data converters | ||
8904 | // Keys separate source (or catchall "*") and destination types with a single space | ||
8905 | converters: { | ||
8906 | |||
8907 | // Convert anything to text | ||
8908 | "* text": String, | ||
8909 | |||
8910 | // Text to html (true = no transformation) | ||
8911 | "text html": true, | ||
8912 | |||
8913 | // Evaluate text as a json expression | ||
8914 | "text json": jQuery.parseJSON, | ||
8915 | |||
8916 | // Parse text as xml | ||
8917 | "text xml": jQuery.parseXML | ||
8918 | }, | ||
8919 | |||
8920 | // For options that shouldn't be deep extended: | ||
8921 | // you can add your own custom options here if | ||
8922 | // and when you create one that shouldn't be | ||
8923 | // deep extended (see ajaxExtend) | ||
8924 | flatOptions: { | ||
8925 | url: true, | ||
8926 | context: true | ||
8927 | } | ||
8928 | }, | ||
8929 | |||
8930 | // Creates a full fledged settings object into target | ||
8931 | // with both ajaxSettings and settings fields. | ||
8932 | // If target is omitted, writes into ajaxSettings. | ||
8933 | ajaxSetup: function( target, settings ) { | ||
8934 | return settings ? | ||
8935 | |||
8936 | // Building a settings object | ||
8937 | ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : | ||
8938 | |||
8939 | // Extending ajaxSettings | ||
8940 | ajaxExtend( jQuery.ajaxSettings, target ); | ||
8941 | }, | ||
8942 | |||
8943 | ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), | ||
8944 | ajaxTransport: addToPrefiltersOrTransports( transports ), | ||
8945 | |||
8946 | // Main method | ||
8947 | ajax: function( url, options ) { | ||
8948 | |||
8949 | // If url is an object, simulate pre-1.5 signature | ||
8950 | if ( typeof url === "object" ) { | ||
8951 | options = url; | ||
8952 | url = undefined; | ||
8953 | } | ||
8954 | |||
8955 | // Force options to be an object | ||
8956 | options = options || {}; | ||
8957 | |||
8958 | var // Cross-domain detection vars | ||
8959 | parts, | ||
8960 | // Loop variable | ||
8961 | i, | ||
8962 | // URL without anti-cache param | ||
8963 | cacheURL, | ||
8964 | // Response headers as string | ||
8965 | responseHeadersString, | ||
8966 | // timeout handle | ||
8967 | timeoutTimer, | ||
8968 | |||
8969 | // To know if global events are to be dispatched | ||
8970 | fireGlobals, | ||
8971 | |||
8972 | transport, | ||
8973 | // Response headers | ||
8974 | responseHeaders, | ||
8975 | // Create the final options object | ||
8976 | s = jQuery.ajaxSetup( {}, options ), | ||
8977 | // Callbacks context | ||
8978 | callbackContext = s.context || s, | ||
8979 | // Context for global events is callbackContext if it is a DOM node or jQuery collection | ||
8980 | globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? | ||
8981 | jQuery( callbackContext ) : | ||
8982 | jQuery.event, | ||
8983 | // Deferreds | ||
8984 | deferred = jQuery.Deferred(), | ||
8985 | completeDeferred = jQuery.Callbacks("once memory"), | ||
8986 | // Status-dependent callbacks | ||
8987 | statusCode = s.statusCode || {}, | ||
8988 | // Headers (they are sent all at once) | ||
8989 | requestHeaders = {}, | ||
8990 | requestHeadersNames = {}, | ||
8991 | // The jqXHR state | ||
8992 | state = 0, | ||
8993 | // Default abort message | ||
8994 | strAbort = "canceled", | ||
8995 | // Fake xhr | ||
8996 | jqXHR = { | ||
8997 | readyState: 0, | ||
8998 | |||
8999 | // Builds headers hashtable if needed | ||
9000 | getResponseHeader: function( key ) { | ||
9001 | var match; | ||
9002 | if ( state === 2 ) { | ||
9003 | if ( !responseHeaders ) { | ||
9004 | responseHeaders = {}; | ||
9005 | while ( (match = rheaders.exec( responseHeadersString )) ) { | ||
9006 | responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; | ||
9007 | } | ||
9008 | } | ||
9009 | match = responseHeaders[ key.toLowerCase() ]; | ||
9010 | } | ||
9011 | return match == null ? null : match; | ||
9012 | }, | ||
9013 | |||
9014 | // Raw string | ||
9015 | getAllResponseHeaders: function() { | ||
9016 | return state === 2 ? responseHeadersString : null; | ||
9017 | }, | ||
9018 | |||
9019 | // Caches the header | ||
9020 | setRequestHeader: function( name, value ) { | ||
9021 | var lname = name.toLowerCase(); | ||
9022 | if ( !state ) { | ||
9023 | name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; | ||
9024 | requestHeaders[ name ] = value; | ||
9025 | } | ||
9026 | return this; | ||
9027 | }, | ||
9028 | |||
9029 | // Overrides response content-type header | ||
9030 | overrideMimeType: function( type ) { | ||
9031 | if ( !state ) { | ||
9032 | s.mimeType = type; | ||
9033 | } | ||
9034 | return this; | ||
9035 | }, | ||
9036 | |||
9037 | // Status-dependent callbacks | ||
9038 | statusCode: function( map ) { | ||
9039 | var code; | ||
9040 | if ( map ) { | ||
9041 | if ( state < 2 ) { | ||
9042 | for ( code in map ) { | ||
9043 | // Lazy-add the new callback in a way that preserves old ones | ||
9044 | statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; | ||
9045 | } | ||
9046 | } else { | ||
9047 | // Execute the appropriate callbacks | ||
9048 | jqXHR.always( map[ jqXHR.status ] ); | ||
9049 | } | ||
9050 | } | ||
9051 | return this; | ||
9052 | }, | ||
9053 | |||
9054 | // Cancel the request | ||
9055 | abort: function( statusText ) { | ||
9056 | var finalText = statusText || strAbort; | ||
9057 | if ( transport ) { | ||
9058 | transport.abort( finalText ); | ||
9059 | } | ||
9060 | done( 0, finalText ); | ||
9061 | return this; | ||
9062 | } | ||
9063 | }; | ||
9064 | |||
9065 | // Attach deferreds | ||
9066 | deferred.promise( jqXHR ).complete = completeDeferred.add; | ||
9067 | jqXHR.success = jqXHR.done; | ||
9068 | jqXHR.error = jqXHR.fail; | ||
9069 | |||
9070 | // Remove hash character (#7531: and string promotion) | ||
9071 | // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) | ||
9072 | // Handle falsy url in the settings object (#10093: consistency with old signature) | ||
9073 | // We also use the url parameter if available | ||
9074 | s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); | ||
9075 | |||
9076 | // Alias method option to type as per ticket #12004 | ||
9077 | s.type = options.method || options.type || s.method || s.type; | ||
9078 | |||
9079 | // Extract dataTypes list | ||
9080 | s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; | ||
9081 | |||
9082 | // A cross-domain request is in order when we have a protocol:host:port mismatch | ||
9083 | if ( s.crossDomain == null ) { | ||
9084 | parts = rurl.exec( s.url.toLowerCase() ); | ||
9085 | s.crossDomain = !!( parts && | ||
9086 | ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || | ||
9087 | ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== | ||
9088 | ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) | ||
9089 | ); | ||
9090 | } | ||
9091 | |||
9092 | // Convert data if not already a string | ||
9093 | if ( s.data && s.processData && typeof s.data !== "string" ) { | ||
9094 | s.data = jQuery.param( s.data, s.traditional ); | ||
9095 | } | ||
9096 | |||
9097 | // Apply prefilters | ||
9098 | inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); | ||
9099 | |||
9100 | // If request was aborted inside a prefilter, stop there | ||
9101 | if ( state === 2 ) { | ||
9102 | return jqXHR; | ||
9103 | } | ||
9104 | |||
9105 | // We can fire global events as of now if asked to | ||
9106 | // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) | ||
9107 | fireGlobals = jQuery.event && s.global; | ||
9108 | |||
9109 | // Watch for a new set of requests | ||
9110 | if ( fireGlobals && jQuery.active++ === 0 ) { | ||
9111 | jQuery.event.trigger("ajaxStart"); | ||
9112 | } | ||
9113 | |||
9114 | // Uppercase the type | ||
9115 | s.type = s.type.toUpperCase(); | ||
9116 | |||
9117 | // Determine if request has content | ||
9118 | s.hasContent = !rnoContent.test( s.type ); | ||
9119 | |||
9120 | // Save the URL in case we're toying with the If-Modified-Since | ||
9121 | // and/or If-None-Match header later on | ||
9122 | cacheURL = s.url; | ||
9123 | |||
9124 | // More options handling for requests with no content | ||
9125 | if ( !s.hasContent ) { | ||
9126 | |||
9127 | // If data is available, append data to url | ||
9128 | if ( s.data ) { | ||
9129 | cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); | ||
9130 | // #9682: remove data so that it's not used in an eventual retry | ||
9131 | delete s.data; | ||
9132 | } | ||
9133 | |||
9134 | // Add anti-cache in url if needed | ||
9135 | if ( s.cache === false ) { | ||
9136 | s.url = rts.test( cacheURL ) ? | ||
9137 | |||
9138 | // If there is already a '_' parameter, set its value | ||
9139 | cacheURL.replace( rts, "$1_=" + nonce++ ) : | ||
9140 | |||
9141 | // Otherwise add one to the end | ||
9142 | cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; | ||
9143 | } | ||
9144 | } | ||
9145 | |||
9146 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
9147 | if ( s.ifModified ) { | ||
9148 | if ( jQuery.lastModified[ cacheURL ] ) { | ||
9149 | jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); | ||
9150 | } | ||
9151 | if ( jQuery.etag[ cacheURL ] ) { | ||
9152 | jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); | ||
9153 | } | ||
9154 | } | ||
9155 | |||
9156 | // Set the correct header, if data is being sent | ||
9157 | if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { | ||
9158 | jqXHR.setRequestHeader( "Content-Type", s.contentType ); | ||
9159 | } | ||
9160 | |||
9161 | // Set the Accepts header for the server, depending on the dataType | ||
9162 | jqXHR.setRequestHeader( | ||
9163 | "Accept", | ||
9164 | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? | ||
9165 | s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : | ||
9166 | s.accepts[ "*" ] | ||
9167 | ); | ||
9168 | |||
9169 | // Check for headers option | ||
9170 | for ( i in s.headers ) { | ||
9171 | jqXHR.setRequestHeader( i, s.headers[ i ] ); | ||
9172 | } | ||
9173 | |||
9174 | // Allow custom headers/mimetypes and early abort | ||
9175 | if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { | ||
9176 | // Abort if not done already and return | ||
9177 | return jqXHR.abort(); | ||
9178 | } | ||
9179 | |||
9180 | // aborting is no longer a cancellation | ||
9181 | strAbort = "abort"; | ||
9182 | |||
9183 | // Install callbacks on deferreds | ||
9184 | for ( i in { success: 1, error: 1, complete: 1 } ) { | ||
9185 | jqXHR[ i ]( s[ i ] ); | ||
9186 | } | ||
9187 | |||
9188 | // Get transport | ||
9189 | transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); | ||
9190 | |||
9191 | // If no transport, we auto-abort | ||
9192 | if ( !transport ) { | ||
9193 | done( -1, "No Transport" ); | ||
9194 | } else { | ||
9195 | jqXHR.readyState = 1; | ||
9196 | |||
9197 | // Send global event | ||
9198 | if ( fireGlobals ) { | ||
9199 | globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); | ||
9200 | } | ||
9201 | // Timeout | ||
9202 | if ( s.async && s.timeout > 0 ) { | ||
9203 | timeoutTimer = setTimeout(function() { | ||
9204 | jqXHR.abort("timeout"); | ||
9205 | }, s.timeout ); | ||
9206 | } | ||
9207 | |||
9208 | try { | ||
9209 | state = 1; | ||
9210 | transport.send( requestHeaders, done ); | ||
9211 | } catch ( e ) { | ||
9212 | // Propagate exception as error if not done | ||
9213 | if ( state < 2 ) { | ||
9214 | done( -1, e ); | ||
9215 | // Simply rethrow otherwise | ||
9216 | } else { | ||
9217 | throw e; | ||
9218 | } | ||
9219 | } | ||
9220 | } | ||
9221 | |||
9222 | // Callback for when everything is done | ||
9223 | function done( status, nativeStatusText, responses, headers ) { | ||
9224 | var isSuccess, success, error, response, modified, | ||
9225 | statusText = nativeStatusText; | ||
9226 | |||
9227 | // Called once | ||
9228 | if ( state === 2 ) { | ||
9229 | return; | ||
9230 | } | ||
9231 | |||
9232 | // State is "done" now | ||
9233 | state = 2; | ||
9234 | |||
9235 | // Clear timeout if it exists | ||
9236 | if ( timeoutTimer ) { | ||
9237 | clearTimeout( timeoutTimer ); | ||
9238 | } | ||
9239 | |||
9240 | // Dereference transport for early garbage collection | ||
9241 | // (no matter how long the jqXHR object will be used) | ||
9242 | transport = undefined; | ||
9243 | |||
9244 | // Cache response headers | ||
9245 | responseHeadersString = headers || ""; | ||
9246 | |||
9247 | // Set readyState | ||
9248 | jqXHR.readyState = status > 0 ? 4 : 0; | ||
9249 | |||
9250 | // Determine if successful | ||
9251 | isSuccess = status >= 200 && status < 300 || status === 304; | ||
9252 | |||
9253 | // Get response data | ||
9254 | if ( responses ) { | ||
9255 | response = ajaxHandleResponses( s, jqXHR, responses ); | ||
9256 | } | ||
9257 | |||
9258 | // Convert no matter what (that way responseXXX fields are always set) | ||
9259 | response = ajaxConvert( s, response, jqXHR, isSuccess ); | ||
9260 | |||
9261 | // If successful, handle type chaining | ||
9262 | if ( isSuccess ) { | ||
9263 | |||
9264 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
9265 | if ( s.ifModified ) { | ||
9266 | modified = jqXHR.getResponseHeader("Last-Modified"); | ||
9267 | if ( modified ) { | ||
9268 | jQuery.lastModified[ cacheURL ] = modified; | ||
9269 | } | ||
9270 | modified = jqXHR.getResponseHeader("etag"); | ||
9271 | if ( modified ) { | ||
9272 | jQuery.etag[ cacheURL ] = modified; | ||
9273 | } | ||
9274 | } | ||
9275 | |||
9276 | // if no content | ||
9277 | if ( status === 204 || s.type === "HEAD" ) { | ||
9278 | statusText = "nocontent"; | ||
9279 | |||
9280 | // if not modified | ||
9281 | } else if ( status === 304 ) { | ||
9282 | statusText = "notmodified"; | ||
9283 | |||
9284 | // If we have data, let's convert it | ||
9285 | } else { | ||
9286 | statusText = response.state; | ||
9287 | success = response.data; | ||
9288 | error = response.error; | ||
9289 | isSuccess = !error; | ||
9290 | } | ||
9291 | } else { | ||
9292 | // We extract error from statusText | ||
9293 | // then normalize statusText and status for non-aborts | ||
9294 | error = statusText; | ||
9295 | if ( status || !statusText ) { | ||
9296 | statusText = "error"; | ||
9297 | if ( status < 0 ) { | ||
9298 | status = 0; | ||
9299 | } | ||
9300 | } | ||
9301 | } | ||
9302 | |||
9303 | // Set data for the fake xhr object | ||
9304 | jqXHR.status = status; | ||
9305 | jqXHR.statusText = ( nativeStatusText || statusText ) + ""; | ||
9306 | |||
9307 | // Success/Error | ||
9308 | if ( isSuccess ) { | ||
9309 | deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); | ||
9310 | } else { | ||
9311 | deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); | ||
9312 | } | ||
9313 | |||
9314 | // Status-dependent callbacks | ||
9315 | jqXHR.statusCode( statusCode ); | ||
9316 | statusCode = undefined; | ||
9317 | |||
9318 | if ( fireGlobals ) { | ||
9319 | globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", | ||
9320 | [ jqXHR, s, isSuccess ? success : error ] ); | ||
9321 | } | ||
9322 | |||
9323 | // Complete | ||
9324 | completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); | ||
9325 | |||
9326 | if ( fireGlobals ) { | ||
9327 | globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); | ||
9328 | // Handle the global AJAX counter | ||
9329 | if ( !( --jQuery.active ) ) { | ||
9330 | jQuery.event.trigger("ajaxStop"); | ||
9331 | } | ||
9332 | } | ||
9333 | } | ||
9334 | |||
9335 | return jqXHR; | ||
9336 | }, | ||
9337 | |||
9338 | getJSON: function( url, data, callback ) { | ||
9339 | return jQuery.get( url, data, callback, "json" ); | ||
9340 | }, | ||
9341 | |||
9342 | getScript: function( url, callback ) { | ||
9343 | return jQuery.get( url, undefined, callback, "script" ); | ||
9344 | } | ||
9345 | }); | ||
9346 | |||
9347 | jQuery.each( [ "get", "post" ], function( i, method ) { | ||
9348 | jQuery[ method ] = function( url, data, callback, type ) { | ||
9349 | // shift arguments if data argument was omitted | ||
9350 | if ( jQuery.isFunction( data ) ) { | ||
9351 | type = type || callback; | ||
9352 | callback = data; | ||
9353 | data = undefined; | ||
9354 | } | ||
9355 | |||
9356 | return jQuery.ajax({ | ||
9357 | url: url, | ||
9358 | type: method, | ||
9359 | dataType: type, | ||
9360 | data: data, | ||
9361 | success: callback | ||
9362 | }); | ||
9363 | }; | ||
9364 | }); | ||
9365 | |||
9366 | |||
9367 | jQuery._evalUrl = function( url ) { | ||
9368 | return jQuery.ajax({ | ||
9369 | url: url, | ||
9370 | type: "GET", | ||
9371 | dataType: "script", | ||
9372 | async: false, | ||
9373 | global: false, | ||
9374 | "throws": true | ||
9375 | }); | ||
9376 | }; | ||
9377 | |||
9378 | |||
9379 | jQuery.fn.extend({ | ||
9380 | wrapAll: function( html ) { | ||
9381 | if ( jQuery.isFunction( html ) ) { | ||
9382 | return this.each(function(i) { | ||
9383 | jQuery(this).wrapAll( html.call(this, i) ); | ||
9384 | }); | ||
9385 | } | ||
9386 | |||
9387 | if ( this[0] ) { | ||
9388 | // The elements to wrap the target around | ||
9389 | var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); | ||
9390 | |||
9391 | if ( this[0].parentNode ) { | ||
9392 | wrap.insertBefore( this[0] ); | ||
9393 | } | ||
9394 | |||
9395 | wrap.map(function() { | ||
9396 | var elem = this; | ||
9397 | |||
9398 | while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { | ||
9399 | elem = elem.firstChild; | ||
9400 | } | ||
9401 | |||
9402 | return elem; | ||
9403 | }).append( this ); | ||
9404 | } | ||
9405 | |||
9406 | return this; | ||
9407 | }, | ||
9408 | |||
9409 | wrapInner: function( html ) { | ||
9410 | if ( jQuery.isFunction( html ) ) { | ||
9411 | return this.each(function(i) { | ||
9412 | jQuery(this).wrapInner( html.call(this, i) ); | ||
9413 | }); | ||
9414 | } | ||
9415 | |||
9416 | return this.each(function() { | ||
9417 | var self = jQuery( this ), | ||
9418 | contents = self.contents(); | ||
9419 | |||
9420 | if ( contents.length ) { | ||
9421 | contents.wrapAll( html ); | ||
9422 | |||
9423 | } else { | ||
9424 | self.append( html ); | ||
9425 | } | ||
9426 | }); | ||
9427 | }, | ||
9428 | |||
9429 | wrap: function( html ) { | ||
9430 | var isFunction = jQuery.isFunction( html ); | ||
9431 | |||
9432 | return this.each(function(i) { | ||
9433 | jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); | ||
9434 | }); | ||
9435 | }, | ||
9436 | |||
9437 | unwrap: function() { | ||
9438 | return this.parent().each(function() { | ||
9439 | if ( !jQuery.nodeName( this, "body" ) ) { | ||
9440 | jQuery( this ).replaceWith( this.childNodes ); | ||
9441 | } | ||
9442 | }).end(); | ||
9443 | } | ||
9444 | }); | ||
9445 | |||
9446 | |||
9447 | jQuery.expr.filters.hidden = function( elem ) { | ||
9448 | // Support: Opera <= 12.12 | ||
9449 | // Opera reports offsetWidths and offsetHeights less than zero on some elements | ||
9450 | return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || | ||
9451 | (!support.reliableHiddenOffsets() && | ||
9452 | ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); | ||
9453 | }; | ||
9454 | |||
9455 | jQuery.expr.filters.visible = function( elem ) { | ||
9456 | return !jQuery.expr.filters.hidden( elem ); | ||
9457 | }; | ||
9458 | |||
9459 | |||
9460 | |||
9461 | |||
9462 | var r20 = /%20/g, | ||
9463 | rbracket = /\[\]$/, | ||
9464 | rCRLF = /\r?\n/g, | ||
9465 | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, | ||
9466 | rsubmittable = /^(?:input|select|textarea|keygen)/i; | ||
9467 | |||
9468 | function buildParams( prefix, obj, traditional, add ) { | ||
9469 | var name; | ||
9470 | |||
9471 | if ( jQuery.isArray( obj ) ) { | ||
9472 | // Serialize array item. | ||
9473 | jQuery.each( obj, function( i, v ) { | ||
9474 | if ( traditional || rbracket.test( prefix ) ) { | ||
9475 | // Treat each array item as a scalar. | ||
9476 | add( prefix, v ); | ||
9477 | |||
9478 | } else { | ||
9479 | // Item is non-scalar (array or object), encode its numeric index. | ||
9480 | buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); | ||
9481 | } | ||
9482 | }); | ||
9483 | |||
9484 | } else if ( !traditional && jQuery.type( obj ) === "object" ) { | ||
9485 | // Serialize object item. | ||
9486 | for ( name in obj ) { | ||
9487 | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); | ||
9488 | } | ||
9489 | |||
9490 | } else { | ||
9491 | // Serialize scalar item. | ||
9492 | add( prefix, obj ); | ||
9493 | } | ||
9494 | } | ||
9495 | |||
9496 | // Serialize an array of form elements or a set of | ||
9497 | // key/values into a query string | ||
9498 | jQuery.param = function( a, traditional ) { | ||
9499 | var prefix, | ||
9500 | s = [], | ||
9501 | add = function( key, value ) { | ||
9502 | // If value is a function, invoke it and return its value | ||
9503 | value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); | ||
9504 | s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); | ||
9505 | }; | ||
9506 | |||
9507 | // Set traditional to true for jQuery <= 1.3.2 behavior. | ||
9508 | if ( traditional === undefined ) { | ||
9509 | traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; | ||
9510 | } | ||
9511 | |||
9512 | // If an array was passed in, assume that it is an array of form elements. | ||
9513 | if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { | ||
9514 | // Serialize the form elements | ||
9515 | jQuery.each( a, function() { | ||
9516 | add( this.name, this.value ); | ||
9517 | }); | ||
9518 | |||
9519 | } else { | ||
9520 | // If traditional, encode the "old" way (the way 1.3.2 or older | ||
9521 | // did it), otherwise encode params recursively. | ||
9522 | for ( prefix in a ) { | ||
9523 | buildParams( prefix, a[ prefix ], traditional, add ); | ||
9524 | } | ||
9525 | } | ||
9526 | |||
9527 | // Return the resulting serialization | ||
9528 | return s.join( "&" ).replace( r20, "+" ); | ||
9529 | }; | ||
9530 | |||
9531 | jQuery.fn.extend({ | ||
9532 | serialize: function() { | ||
9533 | return jQuery.param( this.serializeArray() ); | ||
9534 | }, | ||
9535 | serializeArray: function() { | ||
9536 | return this.map(function() { | ||
9537 | // Can add propHook for "elements" to filter or add form elements | ||
9538 | var elements = jQuery.prop( this, "elements" ); | ||
9539 | return elements ? jQuery.makeArray( elements ) : this; | ||
9540 | }) | ||
9541 | .filter(function() { | ||
9542 | var type = this.type; | ||
9543 | // Use .is(":disabled") so that fieldset[disabled] works | ||
9544 | return this.name && !jQuery( this ).is( ":disabled" ) && | ||
9545 | rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && | ||
9546 | ( this.checked || !rcheckableType.test( type ) ); | ||
9547 | }) | ||
9548 | .map(function( i, elem ) { | ||
9549 | var val = jQuery( this ).val(); | ||
9550 | |||
9551 | return val == null ? | ||
9552 | null : | ||
9553 | jQuery.isArray( val ) ? | ||
9554 | jQuery.map( val, function( val ) { | ||
9555 | return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
9556 | }) : | ||
9557 | { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
9558 | }).get(); | ||
9559 | } | ||
9560 | }); | ||
9561 | |||
9562 | |||
9563 | // Create the request object | ||
9564 | // (This is still attached to ajaxSettings for backward compatibility) | ||
9565 | jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? | ||
9566 | // Support: IE6+ | ||
9567 | function() { | ||
9568 | |||
9569 | // XHR cannot access local files, always use ActiveX for that case | ||
9570 | return !this.isLocal && | ||
9571 | |||
9572 | // Support: IE7-8 | ||
9573 | // oldIE XHR does not support non-RFC2616 methods (#13240) | ||
9574 | // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx | ||
9575 | // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 | ||
9576 | // Although this check for six methods instead of eight | ||
9577 | // since IE also does not support "trace" and "connect" | ||
9578 | /^(get|post|head|put|delete|options)$/i.test( this.type ) && | ||
9579 | |||
9580 | createStandardXHR() || createActiveXHR(); | ||
9581 | } : | ||
9582 | // For all other browsers, use the standard XMLHttpRequest object | ||
9583 | createStandardXHR; | ||
9584 | |||
9585 | var xhrId = 0, | ||
9586 | xhrCallbacks = {}, | ||
9587 | xhrSupported = jQuery.ajaxSettings.xhr(); | ||
9588 | |||
9589 | // Support: IE<10 | ||
9590 | // Open requests must be manually aborted on unload (#5280) | ||
9591 | // See https://support.microsoft.com/kb/2856746 for more info | ||
9592 | if ( window.attachEvent ) { | ||
9593 | window.attachEvent( "onunload", function() { | ||
9594 | for ( var key in xhrCallbacks ) { | ||
9595 | xhrCallbacks[ key ]( undefined, true ); | ||
9596 | } | ||
9597 | }); | ||
9598 | } | ||
9599 | |||
9600 | // Determine support properties | ||
9601 | support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); | ||
9602 | xhrSupported = support.ajax = !!xhrSupported; | ||
9603 | |||
9604 | // Create transport if the browser can provide an xhr | ||
9605 | if ( xhrSupported ) { | ||
9606 | |||
9607 | jQuery.ajaxTransport(function( options ) { | ||
9608 | // Cross domain only allowed if supported through XMLHttpRequest | ||
9609 | if ( !options.crossDomain || support.cors ) { | ||
9610 | |||
9611 | var callback; | ||
9612 | |||
9613 | return { | ||
9614 | send: function( headers, complete ) { | ||
9615 | var i, | ||
9616 | xhr = options.xhr(), | ||
9617 | id = ++xhrId; | ||
9618 | |||
9619 | // Open the socket | ||
9620 | xhr.open( options.type, options.url, options.async, options.username, options.password ); | ||
9621 | |||
9622 | // Apply custom fields if provided | ||
9623 | if ( options.xhrFields ) { | ||
9624 | for ( i in options.xhrFields ) { | ||
9625 | xhr[ i ] = options.xhrFields[ i ]; | ||
9626 | } | ||
9627 | } | ||
9628 | |||
9629 | // Override mime type if needed | ||
9630 | if ( options.mimeType && xhr.overrideMimeType ) { | ||
9631 | xhr.overrideMimeType( options.mimeType ); | ||
9632 | } | ||
9633 | |||
9634 | // X-Requested-With header | ||
9635 | // For cross-domain requests, seeing as conditions for a preflight are | ||
9636 | // akin to a jigsaw puzzle, we simply never set it to be sure. | ||
9637 | // (it can always be set on a per-request basis or even using ajaxSetup) | ||
9638 | // For same-domain requests, won't change header if already provided. | ||
9639 | if ( !options.crossDomain && !headers["X-Requested-With"] ) { | ||
9640 | headers["X-Requested-With"] = "XMLHttpRequest"; | ||
9641 | } | ||
9642 | |||
9643 | // Set headers | ||
9644 | for ( i in headers ) { | ||
9645 | // Support: IE<9 | ||
9646 | // IE's ActiveXObject throws a 'Type Mismatch' exception when setting | ||
9647 | // request header to a null-value. | ||
9648 | // | ||
9649 | // To keep consistent with other XHR implementations, cast the value | ||
9650 | // to string and ignore `undefined`. | ||
9651 | if ( headers[ i ] !== undefined ) { | ||
9652 | xhr.setRequestHeader( i, headers[ i ] + "" ); | ||
9653 | } | ||
9654 | } | ||
9655 | |||
9656 | // Do send the request | ||
9657 | // This may raise an exception which is actually | ||
9658 | // handled in jQuery.ajax (so no try/catch here) | ||
9659 | xhr.send( ( options.hasContent && options.data ) || null ); | ||
9660 | |||
9661 | // Listener | ||
9662 | callback = function( _, isAbort ) { | ||
9663 | var status, statusText, responses; | ||
9664 | |||
9665 | // Was never called and is aborted or complete | ||
9666 | if ( callback && ( isAbort || xhr.readyState === 4 ) ) { | ||
9667 | // Clean up | ||
9668 | delete xhrCallbacks[ id ]; | ||
9669 | callback = undefined; | ||
9670 | xhr.onreadystatechange = jQuery.noop; | ||
9671 | |||
9672 | // Abort manually if needed | ||
9673 | if ( isAbort ) { | ||
9674 | if ( xhr.readyState !== 4 ) { | ||
9675 | xhr.abort(); | ||
9676 | } | ||
9677 | } else { | ||
9678 | responses = {}; | ||
9679 | status = xhr.status; | ||
9680 | |||
9681 | // Support: IE<10 | ||
9682 | // Accessing binary-data responseText throws an exception | ||
9683 | // (#11426) | ||
9684 | if ( typeof xhr.responseText === "string" ) { | ||
9685 | responses.text = xhr.responseText; | ||
9686 | } | ||
9687 | |||
9688 | // Firefox throws an exception when accessing | ||
9689 | // statusText for faulty cross-domain requests | ||
9690 | try { | ||
9691 | statusText = xhr.statusText; | ||
9692 | } catch( e ) { | ||
9693 | // We normalize with Webkit giving an empty statusText | ||
9694 | statusText = ""; | ||
9695 | } | ||
9696 | |||
9697 | // Filter status for non standard behaviors | ||
9698 | |||
9699 | // If the request is local and we have data: assume a success | ||
9700 | // (success with no data won't get notified, that's the best we | ||
9701 | // can do given current implementations) | ||
9702 | if ( !status && options.isLocal && !options.crossDomain ) { | ||
9703 | status = responses.text ? 200 : 404; | ||
9704 | // IE - #1450: sometimes returns 1223 when it should be 204 | ||
9705 | } else if ( status === 1223 ) { | ||
9706 | status = 204; | ||
9707 | } | ||
9708 | } | ||
9709 | } | ||
9710 | |||
9711 | // Call complete if needed | ||
9712 | if ( responses ) { | ||
9713 | complete( status, statusText, responses, xhr.getAllResponseHeaders() ); | ||
9714 | } | ||
9715 | }; | ||
9716 | |||
9717 | if ( !options.async ) { | ||
9718 | // if we're in sync mode we fire the callback | ||
9719 | callback(); | ||
9720 | } else if ( xhr.readyState === 4 ) { | ||
9721 | // (IE6 & IE7) if it's in cache and has been | ||
9722 | // retrieved directly we need to fire the callback | ||
9723 | setTimeout( callback ); | ||
9724 | } else { | ||
9725 | // Add to the list of active xhr callbacks | ||
9726 | xhr.onreadystatechange = xhrCallbacks[ id ] = callback; | ||
9727 | } | ||
9728 | }, | ||
9729 | |||
9730 | abort: function() { | ||
9731 | if ( callback ) { | ||
9732 | callback( undefined, true ); | ||
9733 | } | ||
9734 | } | ||
9735 | }; | ||
9736 | } | ||
9737 | }); | ||
9738 | } | ||
9739 | |||
9740 | // Functions to create xhrs | ||
9741 | function createStandardXHR() { | ||
9742 | try { | ||
9743 | return new window.XMLHttpRequest(); | ||
9744 | } catch( e ) {} | ||
9745 | } | ||
9746 | |||
9747 | function createActiveXHR() { | ||
9748 | try { | ||
9749 | return new window.ActiveXObject( "Microsoft.XMLHTTP" ); | ||
9750 | } catch( e ) {} | ||
9751 | } | ||
9752 | |||
9753 | |||
9754 | |||
9755 | |||
9756 | // Install script dataType | ||
9757 | jQuery.ajaxSetup({ | ||
9758 | accepts: { | ||
9759 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | ||
9760 | }, | ||
9761 | contents: { | ||
9762 | script: /(?:java|ecma)script/ | ||
9763 | }, | ||
9764 | converters: { | ||
9765 | "text script": function( text ) { | ||
9766 | jQuery.globalEval( text ); | ||
9767 | return text; | ||
9768 | } | ||
9769 | } | ||
9770 | }); | ||
9771 | |||
9772 | // Handle cache's special case and global | ||
9773 | jQuery.ajaxPrefilter( "script", function( s ) { | ||
9774 | if ( s.cache === undefined ) { | ||
9775 | s.cache = false; | ||
9776 | } | ||
9777 | if ( s.crossDomain ) { | ||
9778 | s.type = "GET"; | ||
9779 | s.global = false; | ||
9780 | } | ||
9781 | }); | ||
9782 | |||
9783 | // Bind script tag hack transport | ||
9784 | jQuery.ajaxTransport( "script", function(s) { | ||
9785 | |||
9786 | // This transport only deals with cross domain requests | ||
9787 | if ( s.crossDomain ) { | ||
9788 | |||
9789 | var script, | ||
9790 | head = document.head || jQuery("head")[0] || document.documentElement; | ||
9791 | |||
9792 | return { | ||
9793 | |||
9794 | send: function( _, callback ) { | ||
9795 | |||
9796 | script = document.createElement("script"); | ||
9797 | |||
9798 | script.async = true; | ||
9799 | |||
9800 | if ( s.scriptCharset ) { | ||
9801 | script.charset = s.scriptCharset; | ||
9802 | } | ||
9803 | |||
9804 | script.src = s.url; | ||
9805 | |||
9806 | // Attach handlers for all browsers | ||
9807 | script.onload = script.onreadystatechange = function( _, isAbort ) { | ||
9808 | |||
9809 | if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { | ||
9810 | |||
9811 | // Handle memory leak in IE | ||
9812 | script.onload = script.onreadystatechange = null; | ||
9813 | |||
9814 | // Remove the script | ||
9815 | if ( script.parentNode ) { | ||
9816 | script.parentNode.removeChild( script ); | ||
9817 | } | ||
9818 | |||
9819 | // Dereference the script | ||
9820 | script = null; | ||
9821 | |||
9822 | // Callback if not abort | ||
9823 | if ( !isAbort ) { | ||
9824 | callback( 200, "success" ); | ||
9825 | } | ||
9826 | } | ||
9827 | }; | ||
9828 | |||
9829 | // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending | ||
9830 | // Use native DOM manipulation to avoid our domManip AJAX trickery | ||
9831 | head.insertBefore( script, head.firstChild ); | ||
9832 | }, | ||
9833 | |||
9834 | abort: function() { | ||
9835 | if ( script ) { | ||
9836 | script.onload( undefined, true ); | ||
9837 | } | ||
9838 | } | ||
9839 | }; | ||
9840 | } | ||
9841 | }); | ||
9842 | |||
9843 | |||
9844 | |||
9845 | |||
9846 | var oldCallbacks = [], | ||
9847 | rjsonp = /(=)\?(?=&|$)|\?\?/; | ||
9848 | |||
9849 | // Default jsonp settings | ||
9850 | jQuery.ajaxSetup({ | ||
9851 | jsonp: "callback", | ||
9852 | jsonpCallback: function() { | ||
9853 | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); | ||
9854 | this[ callback ] = true; | ||
9855 | return callback; | ||
9856 | } | ||
9857 | }); | ||
9858 | |||
9859 | // Detect, normalize options and install callbacks for jsonp requests | ||
9860 | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { | ||
9861 | |||
9862 | var callbackName, overwritten, responseContainer, | ||
9863 | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? | ||
9864 | "url" : | ||
9865 | typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" | ||
9866 | ); | ||
9867 | |||
9868 | // Handle iff the expected data type is "jsonp" or we have a parameter to set | ||
9869 | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { | ||
9870 | |||
9871 | // Get callback name, remembering preexisting value associated with it | ||
9872 | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? | ||
9873 | s.jsonpCallback() : | ||
9874 | s.jsonpCallback; | ||
9875 | |||
9876 | // Insert callback into url or form data | ||
9877 | if ( jsonProp ) { | ||
9878 | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); | ||
9879 | } else if ( s.jsonp !== false ) { | ||
9880 | s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; | ||
9881 | } | ||
9882 | |||
9883 | // Use data converter to retrieve json after script execution | ||
9884 | s.converters["script json"] = function() { | ||
9885 | if ( !responseContainer ) { | ||
9886 | jQuery.error( callbackName + " was not called" ); | ||
9887 | } | ||
9888 | return responseContainer[ 0 ]; | ||
9889 | }; | ||
9890 | |||
9891 | // force json dataType | ||
9892 | s.dataTypes[ 0 ] = "json"; | ||
9893 | |||
9894 | // Install callback | ||
9895 | overwritten = window[ callbackName ]; | ||
9896 | window[ callbackName ] = function() { | ||
9897 | responseContainer = arguments; | ||
9898 | }; | ||
9899 | |||
9900 | // Clean-up function (fires after converters) | ||
9901 | jqXHR.always(function() { | ||
9902 | // Restore preexisting value | ||
9903 | window[ callbackName ] = overwritten; | ||
9904 | |||
9905 | // Save back as free | ||
9906 | if ( s[ callbackName ] ) { | ||
9907 | // make sure that re-using the options doesn't screw things around | ||
9908 | s.jsonpCallback = originalSettings.jsonpCallback; | ||
9909 | |||
9910 | // save the callback name for future use | ||
9911 | oldCallbacks.push( callbackName ); | ||
9912 | } | ||
9913 | |||
9914 | // Call if it was a function and we have a response | ||
9915 | if ( responseContainer && jQuery.isFunction( overwritten ) ) { | ||
9916 | overwritten( responseContainer[ 0 ] ); | ||
9917 | } | ||
9918 | |||
9919 | responseContainer = overwritten = undefined; | ||
9920 | }); | ||
9921 | |||
9922 | // Delegate to script | ||
9923 | return "script"; | ||
9924 | } | ||
9925 | }); | ||
9926 | |||
9927 | |||
9928 | |||
9929 | |||
9930 | // data: string of html | ||
9931 | // context (optional): If specified, the fragment will be created in this context, defaults to document | ||
9932 | // keepScripts (optional): If true, will include scripts passed in the html string | ||
9933 | jQuery.parseHTML = function( data, context, keepScripts ) { | ||
9934 | if ( !data || typeof data !== "string" ) { | ||
9935 | return null; | ||
9936 | } | ||
9937 | if ( typeof context === "boolean" ) { | ||
9938 | keepScripts = context; | ||
9939 | context = false; | ||
9940 | } | ||
9941 | context = context || document; | ||
9942 | |||
9943 | var parsed = rsingleTag.exec( data ), | ||
9944 | scripts = !keepScripts && []; | ||
9945 | |||
9946 | // Single tag | ||
9947 | if ( parsed ) { | ||
9948 | return [ context.createElement( parsed[1] ) ]; | ||
9949 | } | ||
9950 | |||
9951 | parsed = jQuery.buildFragment( [ data ], context, scripts ); | ||
9952 | |||
9953 | if ( scripts && scripts.length ) { | ||
9954 | jQuery( scripts ).remove(); | ||
9955 | } | ||
9956 | |||
9957 | return jQuery.merge( [], parsed.childNodes ); | ||
9958 | }; | ||
9959 | |||
9960 | |||
9961 | // Keep a copy of the old load method | ||
9962 | var _load = jQuery.fn.load; | ||
9963 | |||
9964 | /** | ||
9965 | * Load a url into a page | ||
9966 | */ | ||
9967 | jQuery.fn.load = function( url, params, callback ) { | ||
9968 | if ( typeof url !== "string" && _load ) { | ||
9969 | return _load.apply( this, arguments ); | ||
9970 | } | ||
9971 | |||
9972 | var selector, response, type, | ||
9973 | self = this, | ||
9974 | off = url.indexOf(" "); | ||
9975 | |||
9976 | if ( off >= 0 ) { | ||
9977 | selector = jQuery.trim( url.slice( off, url.length ) ); | ||
9978 | url = url.slice( 0, off ); | ||
9979 | } | ||
9980 | |||
9981 | // If it's a function | ||
9982 | if ( jQuery.isFunction( params ) ) { | ||
9983 | |||
9984 | // We assume that it's the callback | ||
9985 | callback = params; | ||
9986 | params = undefined; | ||
9987 | |||
9988 | // Otherwise, build a param string | ||
9989 | } else if ( params && typeof params === "object" ) { | ||
9990 | type = "POST"; | ||
9991 | } | ||
9992 | |||
9993 | // If we have elements to modify, make the request | ||
9994 | if ( self.length > 0 ) { | ||
9995 | jQuery.ajax({ | ||
9996 | url: url, | ||
9997 | |||
9998 | // if "type" variable is undefined, then "GET" method will be used | ||
9999 | type: type, | ||
10000 | dataType: "html", | ||
10001 | data: params | ||
10002 | }).done(function( responseText ) { | ||
10003 | |||
10004 | // Save response for use in complete callback | ||
10005 | response = arguments; | ||
10006 | |||
10007 | self.html( selector ? | ||
10008 | |||
10009 | // If a selector was specified, locate the right elements in a dummy div | ||
10010 | // Exclude scripts to avoid IE 'Permission Denied' errors | ||
10011 | jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : | ||
10012 | |||
10013 | // Otherwise use the full result | ||
10014 | responseText ); | ||
10015 | |||
10016 | }).complete( callback && function( jqXHR, status ) { | ||
10017 | self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); | ||
10018 | }); | ||
10019 | } | ||
10020 | |||
10021 | return this; | ||
10022 | }; | ||
10023 | |||
10024 | |||
10025 | |||
10026 | |||
10027 | // Attach a bunch of functions for handling common AJAX events | ||
10028 | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { | ||
10029 | jQuery.fn[ type ] = function( fn ) { | ||
10030 | return this.on( type, fn ); | ||
10031 | }; | ||
10032 | }); | ||
10033 | |||
10034 | |||
10035 | |||
10036 | |||
10037 | jQuery.expr.filters.animated = function( elem ) { | ||
10038 | return jQuery.grep(jQuery.timers, function( fn ) { | ||
10039 | return elem === fn.elem; | ||
10040 | }).length; | ||
10041 | }; | ||
10042 | |||
10043 | |||
10044 | |||
10045 | |||
10046 | |||
10047 | var docElem = window.document.documentElement; | ||
10048 | |||
10049 | /** | ||
10050 | * Gets a window from an element | ||
10051 | */ | ||
10052 | function getWindow( elem ) { | ||
10053 | return jQuery.isWindow( elem ) ? | ||
10054 | elem : | ||
10055 | elem.nodeType === 9 ? | ||
10056 | elem.defaultView || elem.parentWindow : | ||
10057 | false; | ||
10058 | } | ||
10059 | |||
10060 | jQuery.offset = { | ||
10061 | setOffset: function( elem, options, i ) { | ||
10062 | var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, | ||
10063 | position = jQuery.css( elem, "position" ), | ||
10064 | curElem = jQuery( elem ), | ||
10065 | props = {}; | ||
10066 | |||
10067 | // set position first, in-case top/left are set even on static elem | ||
10068 | if ( position === "static" ) { | ||
10069 | elem.style.position = "relative"; | ||
10070 | } | ||
10071 | |||
10072 | curOffset = curElem.offset(); | ||
10073 | curCSSTop = jQuery.css( elem, "top" ); | ||
10074 | curCSSLeft = jQuery.css( elem, "left" ); | ||
10075 | calculatePosition = ( position === "absolute" || position === "fixed" ) && | ||
10076 | jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; | ||
10077 | |||
10078 | // need to be able to calculate position if either top or left is auto and position is either absolute or fixed | ||
10079 | if ( calculatePosition ) { | ||
10080 | curPosition = curElem.position(); | ||
10081 | curTop = curPosition.top; | ||
10082 | curLeft = curPosition.left; | ||
10083 | } else { | ||
10084 | curTop = parseFloat( curCSSTop ) || 0; | ||
10085 | curLeft = parseFloat( curCSSLeft ) || 0; | ||
10086 | } | ||
10087 | |||
10088 | if ( jQuery.isFunction( options ) ) { | ||
10089 | options = options.call( elem, i, curOffset ); | ||
10090 | } | ||
10091 | |||
10092 | if ( options.top != null ) { | ||
10093 | props.top = ( options.top - curOffset.top ) + curTop; | ||
10094 | } | ||
10095 | if ( options.left != null ) { | ||
10096 | props.left = ( options.left - curOffset.left ) + curLeft; | ||
10097 | } | ||
10098 | |||
10099 | if ( "using" in options ) { | ||
10100 | options.using.call( elem, props ); | ||
10101 | } else { | ||
10102 | curElem.css( props ); | ||
10103 | } | ||
10104 | } | ||
10105 | }; | ||
10106 | |||
10107 | jQuery.fn.extend({ | ||
10108 | offset: function( options ) { | ||
10109 | if ( arguments.length ) { | ||
10110 | return options === undefined ? | ||
10111 | this : | ||
10112 | this.each(function( i ) { | ||
10113 | jQuery.offset.setOffset( this, options, i ); | ||
10114 | }); | ||
10115 | } | ||
10116 | |||
10117 | var docElem, win, | ||
10118 | box = { top: 0, left: 0 }, | ||
10119 | elem = this[ 0 ], | ||
10120 | doc = elem && elem.ownerDocument; | ||
10121 | |||
10122 | if ( !doc ) { | ||
10123 | return; | ||
10124 | } | ||
10125 | |||
10126 | docElem = doc.documentElement; | ||
10127 | |||
10128 | // Make sure it's not a disconnected DOM node | ||
10129 | if ( !jQuery.contains( docElem, elem ) ) { | ||
10130 | return box; | ||
10131 | } | ||
10132 | |||
10133 | // If we don't have gBCR, just use 0,0 rather than error | ||
10134 | // BlackBerry 5, iOS 3 (original iPhone) | ||
10135 | if ( typeof elem.getBoundingClientRect !== strundefined ) { | ||
10136 | box = elem.getBoundingClientRect(); | ||
10137 | } | ||
10138 | win = getWindow( doc ); | ||
10139 | return { | ||
10140 | top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), | ||
10141 | left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) | ||
10142 | }; | ||
10143 | }, | ||
10144 | |||
10145 | position: function() { | ||
10146 | if ( !this[ 0 ] ) { | ||
10147 | return; | ||
10148 | } | ||
10149 | |||
10150 | var offsetParent, offset, | ||
10151 | parentOffset = { top: 0, left: 0 }, | ||
10152 | elem = this[ 0 ]; | ||
10153 | |||
10154 | // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent | ||
10155 | if ( jQuery.css( elem, "position" ) === "fixed" ) { | ||
10156 | // we assume that getBoundingClientRect is available when computed position is fixed | ||
10157 | offset = elem.getBoundingClientRect(); | ||
10158 | } else { | ||
10159 | // Get *real* offsetParent | ||
10160 | offsetParent = this.offsetParent(); | ||
10161 | |||
10162 | // Get correct offsets | ||
10163 | offset = this.offset(); | ||
10164 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { | ||
10165 | parentOffset = offsetParent.offset(); | ||
10166 | } | ||
10167 | |||
10168 | // Add offsetParent borders | ||
10169 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); | ||
10170 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); | ||
10171 | } | ||
10172 | |||
10173 | // Subtract parent offsets and element margins | ||
10174 | // note: when an element has margin: auto the offsetLeft and marginLeft | ||
10175 | // are the same in Safari causing offset.left to incorrectly be 0 | ||
10176 | return { | ||
10177 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), | ||
10178 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) | ||
10179 | }; | ||
10180 | }, | ||
10181 | |||
10182 | offsetParent: function() { | ||
10183 | return this.map(function() { | ||
10184 | var offsetParent = this.offsetParent || docElem; | ||
10185 | |||
10186 | while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { | ||
10187 | offsetParent = offsetParent.offsetParent; | ||
10188 | } | ||
10189 | return offsetParent || docElem; | ||
10190 | }); | ||
10191 | } | ||
10192 | }); | ||
10193 | |||
10194 | // Create scrollLeft and scrollTop methods | ||
10195 | jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { | ||
10196 | var top = /Y/.test( prop ); | ||
10197 | |||
10198 | jQuery.fn[ method ] = function( val ) { | ||
10199 | return access( this, function( elem, method, val ) { | ||
10200 | var win = getWindow( elem ); | ||
10201 | |||
10202 | if ( val === undefined ) { | ||
10203 | return win ? (prop in win) ? win[ prop ] : | ||
10204 | win.document.documentElement[ method ] : | ||
10205 | elem[ method ]; | ||
10206 | } | ||
10207 | |||
10208 | if ( win ) { | ||
10209 | win.scrollTo( | ||
10210 | !top ? val : jQuery( win ).scrollLeft(), | ||
10211 | top ? val : jQuery( win ).scrollTop() | ||
10212 | ); | ||
10213 | |||
10214 | } else { | ||
10215 | elem[ method ] = val; | ||
10216 | } | ||
10217 | }, method, val, arguments.length, null ); | ||
10218 | }; | ||
10219 | }); | ||
10220 | |||
10221 | // Add the top/left cssHooks using jQuery.fn.position | ||
10222 | // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 | ||
10223 | // getComputedStyle returns percent when specified for top/left/bottom/right | ||
10224 | // rather than make the css module depend on the offset module, we just check for it here | ||
10225 | jQuery.each( [ "top", "left" ], function( i, prop ) { | ||
10226 | jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, | ||
10227 | function( elem, computed ) { | ||
10228 | if ( computed ) { | ||
10229 | computed = curCSS( elem, prop ); | ||
10230 | // if curCSS returns percentage, fallback to offset | ||
10231 | return rnumnonpx.test( computed ) ? | ||
10232 | jQuery( elem ).position()[ prop ] + "px" : | ||
10233 | computed; | ||
10234 | } | ||
10235 | } | ||
10236 | ); | ||
10237 | }); | ||
10238 | |||
10239 | |||
10240 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods | ||
10241 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { | ||
10242 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { | ||
10243 | // margin is only for outerHeight, outerWidth | ||
10244 | jQuery.fn[ funcName ] = function( margin, value ) { | ||
10245 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), | ||
10246 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); | ||
10247 | |||
10248 | return access( this, function( elem, type, value ) { | ||
10249 | var doc; | ||
10250 | |||
10251 | if ( jQuery.isWindow( elem ) ) { | ||
10252 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there | ||
10253 | // isn't a whole lot we can do. See pull request at this URL for discussion: | ||
10254 | // https://github.com/jquery/jquery/pull/764 | ||
10255 | return elem.document.documentElement[ "client" + name ]; | ||
10256 | } | ||
10257 | |||
10258 | // Get document width or height | ||
10259 | if ( elem.nodeType === 9 ) { | ||
10260 | doc = elem.documentElement; | ||
10261 | |||
10262 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest | ||
10263 | // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. | ||
10264 | return Math.max( | ||
10265 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], | ||
10266 | elem.body[ "offset" + name ], doc[ "offset" + name ], | ||
10267 | doc[ "client" + name ] | ||
10268 | ); | ||
10269 | } | ||
10270 | |||
10271 | return value === undefined ? | ||
10272 | // Get width or height on the element, requesting but not forcing parseFloat | ||
10273 | jQuery.css( elem, type, extra ) : | ||
10274 | |||
10275 | // Set width or height on the element | ||
10276 | jQuery.style( elem, type, value, extra ); | ||
10277 | }, type, chainable ? margin : undefined, chainable, null ); | ||
10278 | }; | ||
10279 | }); | ||
10280 | }); | ||
10281 | |||
10282 | |||
10283 | // The number of elements contained in the matched element set | ||
10284 | jQuery.fn.size = function() { | ||
10285 | return this.length; | ||
10286 | }; | ||
10287 | |||
10288 | jQuery.fn.andSelf = jQuery.fn.addBack; | ||
10289 | |||
10290 | |||
10291 | |||
10292 | |||
10293 | // Register as a named AMD module, since jQuery can be concatenated with other | ||
10294 | // files that may use define, but not via a proper concatenation script that | ||
10295 | // understands anonymous AMD modules. A named AMD is safest and most robust | ||
10296 | // way to register. Lowercase jquery is used because AMD module names are | ||
10297 | // derived from file names, and jQuery is normally delivered in a lowercase | ||
10298 | // file name. Do this after creating the global so that if an AMD module wants | ||
10299 | // to call noConflict to hide this version of jQuery, it will work. | ||
10300 | |||
10301 | // Note that for maximum portability, libraries that are not jQuery should | ||
10302 | // declare themselves as anonymous modules, and avoid setting a global if an | ||
10303 | // AMD loader is present. jQuery is a special case. For more information, see | ||
10304 | // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon | ||
10305 | |||
10306 | if ( typeof define === "function" && define.amd ) { | ||
10307 | define( "jquery", [], function() { | ||
10308 | return jQuery; | ||
10309 | }); | ||
10310 | } | ||
10311 | |||
10312 | |||
10313 | |||
10314 | |||
10315 | var | ||
10316 | // Map over jQuery in case of overwrite | ||
10317 | _jQuery = window.jQuery, | ||
10318 | |||
10319 | // Map over the $ in case of overwrite | ||
10320 | _$ = window.$; | ||
10321 | |||
10322 | jQuery.noConflict = function( deep ) { | ||
10323 | if ( window.$ === jQuery ) { | ||
10324 | window.$ = _$; | ||
10325 | } | ||
10326 | |||
10327 | if ( deep && window.jQuery === jQuery ) { | ||
10328 | window.jQuery = _jQuery; | ||
10329 | } | ||
10330 | |||
10331 | return jQuery; | ||
10332 | }; | ||
10333 | |||
10334 | // Expose jQuery and $ identifiers, even in | ||
10335 | // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) | ||
10336 | // and CommonJS for browser emulators (#13566) | ||
10337 | if ( typeof noGlobal === strundefined ) { | ||
10338 | window.jQuery = window.$ = jQuery; | ||
10339 | } | ||
10340 | |||
10341 | |||
10342 | |||
10343 | |||
10344 | return jQuery; | ||
10345 | |||
10346 | })); | ||
diff --git a/inc/jquery-1.11.2.min.js b/inc/jquery-1.11.2.min.js deleted file mode 100644 index e6a051d0..00000000 --- a/inc/jquery-1.11.2.min.js +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | /*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ | ||
2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; | ||
3 | return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e) | ||
4 | }m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m}); | ||
diff --git a/inc/jquery-ui-1.11.2.js b/inc/jquery-ui-1.11.2.js deleted file mode 100644 index ce8731b0..00000000 --- a/inc/jquery-ui-1.11.2.js +++ /dev/null | |||
@@ -1,16582 +0,0 @@ | |||
1 | /*! jQuery UI - v1.11.2 - 2014-10-16 | ||
2 | * http://jqueryui.com | ||
3 | * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js | ||
4 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ | ||
5 | |||
6 | (function( factory ) { | ||
7 | if ( typeof define === "function" && define.amd ) { | ||
8 | |||
9 | // AMD. Register as an anonymous module. | ||
10 | define([ "jquery" ], factory ); | ||
11 | } else { | ||
12 | |||
13 | // Browser globals | ||
14 | factory( jQuery ); | ||
15 | } | ||
16 | }(function( $ ) { | ||
17 | /*! | ||
18 | * jQuery UI Core 1.11.2 | ||
19 | * http://jqueryui.com | ||
20 | * | ||
21 | * Copyright 2014 jQuery Foundation and other contributors | ||
22 | * Released under the MIT license. | ||
23 | * http://jquery.org/license | ||
24 | * | ||
25 | * http://api.jqueryui.com/category/ui-core/ | ||
26 | */ | ||
27 | |||
28 | |||
29 | // $.ui might exist from components with no dependencies, e.g., $.ui.position | ||
30 | $.ui = $.ui || {}; | ||
31 | |||
32 | $.extend( $.ui, { | ||
33 | version: "1.11.2", | ||
34 | |||
35 | keyCode: { | ||
36 | BACKSPACE: 8, | ||
37 | COMMA: 188, | ||
38 | DELETE: 46, | ||
39 | DOWN: 40, | ||
40 | END: 35, | ||
41 | ENTER: 13, | ||
42 | ESCAPE: 27, | ||
43 | HOME: 36, | ||
44 | LEFT: 37, | ||
45 | PAGE_DOWN: 34, | ||
46 | PAGE_UP: 33, | ||
47 | PERIOD: 190, | ||
48 | RIGHT: 39, | ||
49 | SPACE: 32, | ||
50 | TAB: 9, | ||
51 | UP: 38 | ||
52 | } | ||
53 | }); | ||
54 | |||
55 | // plugins | ||
56 | $.fn.extend({ | ||
57 | scrollParent: function( includeHidden ) { | ||
58 | var position = this.css( "position" ), | ||
59 | excludeStaticParent = position === "absolute", | ||
60 | overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, | ||
61 | scrollParent = this.parents().filter( function() { | ||
62 | var parent = $( this ); | ||
63 | if ( excludeStaticParent && parent.css( "position" ) === "static" ) { | ||
64 | return false; | ||
65 | } | ||
66 | return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); | ||
67 | }).eq( 0 ); | ||
68 | |||
69 | return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; | ||
70 | }, | ||
71 | |||
72 | uniqueId: (function() { | ||
73 | var uuid = 0; | ||
74 | |||
75 | return function() { | ||
76 | return this.each(function() { | ||
77 | if ( !this.id ) { | ||
78 | this.id = "ui-id-" + ( ++uuid ); | ||
79 | } | ||
80 | }); | ||
81 | }; | ||
82 | })(), | ||
83 | |||
84 | removeUniqueId: function() { | ||
85 | return this.each(function() { | ||
86 | if ( /^ui-id-\d+$/.test( this.id ) ) { | ||
87 | $( this ).removeAttr( "id" ); | ||
88 | } | ||
89 | }); | ||
90 | } | ||
91 | }); | ||
92 | |||
93 | // selectors | ||
94 | function focusable( element, isTabIndexNotNaN ) { | ||
95 | var map, mapName, img, | ||
96 | nodeName = element.nodeName.toLowerCase(); | ||
97 | if ( "area" === nodeName ) { | ||
98 | map = element.parentNode; | ||
99 | mapName = map.name; | ||
100 | if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { | ||
101 | return false; | ||
102 | } | ||
103 | img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; | ||
104 | return !!img && visible( img ); | ||
105 | } | ||
106 | return ( /input|select|textarea|button|object/.test( nodeName ) ? | ||
107 | !element.disabled : | ||
108 | "a" === nodeName ? | ||
109 | element.href || isTabIndexNotNaN : | ||
110 | isTabIndexNotNaN) && | ||
111 | // the element and all of its ancestors must be visible | ||
112 | visible( element ); | ||
113 | } | ||
114 | |||
115 | function visible( element ) { | ||
116 | return $.expr.filters.visible( element ) && | ||
117 | !$( element ).parents().addBack().filter(function() { | ||
118 | return $.css( this, "visibility" ) === "hidden"; | ||
119 | }).length; | ||
120 | } | ||
121 | |||
122 | $.extend( $.expr[ ":" ], { | ||
123 | data: $.expr.createPseudo ? | ||
124 | $.expr.createPseudo(function( dataName ) { | ||
125 | return function( elem ) { | ||
126 | return !!$.data( elem, dataName ); | ||
127 | }; | ||
128 | }) : | ||
129 | // support: jQuery <1.8 | ||
130 | function( elem, i, match ) { | ||
131 | return !!$.data( elem, match[ 3 ] ); | ||
132 | }, | ||
133 | |||
134 | focusable: function( element ) { | ||
135 | return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); | ||
136 | }, | ||
137 | |||
138 | tabbable: function( element ) { | ||
139 | var tabIndex = $.attr( element, "tabindex" ), | ||
140 | isTabIndexNaN = isNaN( tabIndex ); | ||
141 | return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); | ||
142 | } | ||
143 | }); | ||
144 | |||
145 | // support: jQuery <1.8 | ||
146 | if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { | ||
147 | $.each( [ "Width", "Height" ], function( i, name ) { | ||
148 | var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], | ||
149 | type = name.toLowerCase(), | ||
150 | orig = { | ||
151 | innerWidth: $.fn.innerWidth, | ||
152 | innerHeight: $.fn.innerHeight, | ||
153 | outerWidth: $.fn.outerWidth, | ||
154 | outerHeight: $.fn.outerHeight | ||
155 | }; | ||
156 | |||
157 | function reduce( elem, size, border, margin ) { | ||
158 | $.each( side, function() { | ||
159 | size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; | ||
160 | if ( border ) { | ||
161 | size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; | ||
162 | } | ||
163 | if ( margin ) { | ||
164 | size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; | ||
165 | } | ||
166 | }); | ||
167 | return size; | ||
168 | } | ||
169 | |||
170 | $.fn[ "inner" + name ] = function( size ) { | ||
171 | if ( size === undefined ) { | ||
172 | return orig[ "inner" + name ].call( this ); | ||
173 | } | ||
174 | |||
175 | return this.each(function() { | ||
176 | $( this ).css( type, reduce( this, size ) + "px" ); | ||
177 | }); | ||
178 | }; | ||
179 | |||
180 | $.fn[ "outer" + name] = function( size, margin ) { | ||
181 | if ( typeof size !== "number" ) { | ||
182 | return orig[ "outer" + name ].call( this, size ); | ||
183 | } | ||
184 | |||
185 | return this.each(function() { | ||
186 | $( this).css( type, reduce( this, size, true, margin ) + "px" ); | ||
187 | }); | ||
188 | }; | ||
189 | }); | ||
190 | } | ||
191 | |||
192 | // support: jQuery <1.8 | ||
193 | if ( !$.fn.addBack ) { | ||
194 | $.fn.addBack = function( selector ) { | ||
195 | return this.add( selector == null ? | ||
196 | this.prevObject : this.prevObject.filter( selector ) | ||
197 | ); | ||
198 | }; | ||
199 | } | ||
200 | |||
201 | // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) | ||
202 | if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { | ||
203 | $.fn.removeData = (function( removeData ) { | ||
204 | return function( key ) { | ||
205 | if ( arguments.length ) { | ||
206 | return removeData.call( this, $.camelCase( key ) ); | ||
207 | } else { | ||
208 | return removeData.call( this ); | ||
209 | } | ||
210 | }; | ||
211 | })( $.fn.removeData ); | ||
212 | } | ||
213 | |||
214 | // deprecated | ||
215 | $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); | ||
216 | |||
217 | $.fn.extend({ | ||
218 | focus: (function( orig ) { | ||
219 | return function( delay, fn ) { | ||
220 | return typeof delay === "number" ? | ||
221 | this.each(function() { | ||
222 | var elem = this; | ||
223 | setTimeout(function() { | ||
224 | $( elem ).focus(); | ||
225 | if ( fn ) { | ||
226 | fn.call( elem ); | ||
227 | } | ||
228 | }, delay ); | ||
229 | }) : | ||
230 | orig.apply( this, arguments ); | ||
231 | }; | ||
232 | })( $.fn.focus ), | ||
233 | |||
234 | disableSelection: (function() { | ||
235 | var eventType = "onselectstart" in document.createElement( "div" ) ? | ||
236 | "selectstart" : | ||
237 | "mousedown"; | ||
238 | |||
239 | return function() { | ||
240 | return this.bind( eventType + ".ui-disableSelection", function( event ) { | ||
241 | event.preventDefault(); | ||
242 | }); | ||
243 | }; | ||
244 | })(), | ||
245 | |||
246 | enableSelection: function() { | ||
247 | return this.unbind( ".ui-disableSelection" ); | ||
248 | }, | ||
249 | |||
250 | zIndex: function( zIndex ) { | ||
251 | if ( zIndex !== undefined ) { | ||
252 | return this.css( "zIndex", zIndex ); | ||
253 | } | ||
254 | |||
255 | if ( this.length ) { | ||
256 | var elem = $( this[ 0 ] ), position, value; | ||
257 | while ( elem.length && elem[ 0 ] !== document ) { | ||
258 | // Ignore z-index if position is set to a value where z-index is ignored by the browser | ||
259 | // This makes behavior of this function consistent across browsers | ||
260 | // WebKit always returns auto if the element is positioned | ||
261 | position = elem.css( "position" ); | ||
262 | if ( position === "absolute" || position === "relative" || position === "fixed" ) { | ||
263 | // IE returns 0 when zIndex is not specified | ||
264 | // other browsers return a string | ||
265 | // we ignore the case of nested elements with an explicit value of 0 | ||
266 | // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> | ||
267 | value = parseInt( elem.css( "zIndex" ), 10 ); | ||
268 | if ( !isNaN( value ) && value !== 0 ) { | ||
269 | return value; | ||
270 | } | ||
271 | } | ||
272 | elem = elem.parent(); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | }); | ||
279 | |||
280 | // $.ui.plugin is deprecated. Use $.widget() extensions instead. | ||
281 | $.ui.plugin = { | ||
282 | add: function( module, option, set ) { | ||
283 | var i, | ||
284 | proto = $.ui[ module ].prototype; | ||
285 | for ( i in set ) { | ||
286 | proto.plugins[ i ] = proto.plugins[ i ] || []; | ||
287 | proto.plugins[ i ].push( [ option, set[ i ] ] ); | ||
288 | } | ||
289 | }, | ||
290 | call: function( instance, name, args, allowDisconnected ) { | ||
291 | var i, | ||
292 | set = instance.plugins[ name ]; | ||
293 | |||
294 | if ( !set ) { | ||
295 | return; | ||
296 | } | ||
297 | |||
298 | if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { | ||
299 | return; | ||
300 | } | ||
301 | |||
302 | for ( i = 0; i < set.length; i++ ) { | ||
303 | if ( instance.options[ set[ i ][ 0 ] ] ) { | ||
304 | set[ i ][ 1 ].apply( instance.element, args ); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | }; | ||
309 | |||
310 | |||
311 | /*! | ||
312 | * jQuery UI Widget 1.11.2 | ||
313 | * http://jqueryui.com | ||
314 | * | ||
315 | * Copyright 2014 jQuery Foundation and other contributors | ||
316 | * Released under the MIT license. | ||
317 | * http://jquery.org/license | ||
318 | * | ||
319 | * http://api.jqueryui.com/jQuery.widget/ | ||
320 | */ | ||
321 | |||
322 | |||
323 | var widget_uuid = 0, | ||
324 | widget_slice = Array.prototype.slice; | ||
325 | |||
326 | $.cleanData = (function( orig ) { | ||
327 | return function( elems ) { | ||
328 | var events, elem, i; | ||
329 | for ( i = 0; (elem = elems[i]) != null; i++ ) { | ||
330 | try { | ||
331 | |||
332 | // Only trigger remove when necessary to save time | ||
333 | events = $._data( elem, "events" ); | ||
334 | if ( events && events.remove ) { | ||
335 | $( elem ).triggerHandler( "remove" ); | ||
336 | } | ||
337 | |||
338 | // http://bugs.jquery.com/ticket/8235 | ||
339 | } catch ( e ) {} | ||
340 | } | ||
341 | orig( elems ); | ||
342 | }; | ||
343 | })( $.cleanData ); | ||
344 | |||
345 | $.widget = function( name, base, prototype ) { | ||
346 | var fullName, existingConstructor, constructor, basePrototype, | ||
347 | // proxiedPrototype allows the provided prototype to remain unmodified | ||
348 | // so that it can be used as a mixin for multiple widgets (#8876) | ||
349 | proxiedPrototype = {}, | ||
350 | namespace = name.split( "." )[ 0 ]; | ||
351 | |||
352 | name = name.split( "." )[ 1 ]; | ||
353 | fullName = namespace + "-" + name; | ||
354 | |||
355 | if ( !prototype ) { | ||
356 | prototype = base; | ||
357 | base = $.Widget; | ||
358 | } | ||
359 | |||
360 | // create selector for plugin | ||
361 | $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { | ||
362 | return !!$.data( elem, fullName ); | ||
363 | }; | ||
364 | |||
365 | $[ namespace ] = $[ namespace ] || {}; | ||
366 | existingConstructor = $[ namespace ][ name ]; | ||
367 | constructor = $[ namespace ][ name ] = function( options, element ) { | ||
368 | // allow instantiation without "new" keyword | ||
369 | if ( !this._createWidget ) { | ||
370 | return new constructor( options, element ); | ||
371 | } | ||
372 | |||
373 | // allow instantiation without initializing for simple inheritance | ||
374 | // must use "new" keyword (the code above always passes args) | ||
375 | if ( arguments.length ) { | ||
376 | this._createWidget( options, element ); | ||
377 | } | ||
378 | }; | ||
379 | // extend with the existing constructor to carry over any static properties | ||
380 | $.extend( constructor, existingConstructor, { | ||
381 | version: prototype.version, | ||
382 | // copy the object used to create the prototype in case we need to | ||
383 | // redefine the widget later | ||
384 | _proto: $.extend( {}, prototype ), | ||
385 | // track widgets that inherit from this widget in case this widget is | ||
386 | // redefined after a widget inherits from it | ||
387 | _childConstructors: [] | ||
388 | }); | ||
389 | |||
390 | basePrototype = new base(); | ||
391 | // we need to make the options hash a property directly on the new instance | ||
392 | // otherwise we'll modify the options hash on the prototype that we're | ||
393 | // inheriting from | ||
394 | basePrototype.options = $.widget.extend( {}, basePrototype.options ); | ||
395 | $.each( prototype, function( prop, value ) { | ||
396 | if ( !$.isFunction( value ) ) { | ||
397 | proxiedPrototype[ prop ] = value; | ||
398 | return; | ||
399 | } | ||
400 | proxiedPrototype[ prop ] = (function() { | ||
401 | var _super = function() { | ||
402 | return base.prototype[ prop ].apply( this, arguments ); | ||
403 | }, | ||
404 | _superApply = function( args ) { | ||
405 | return base.prototype[ prop ].apply( this, args ); | ||
406 | }; | ||
407 | return function() { | ||
408 | var __super = this._super, | ||
409 | __superApply = this._superApply, | ||
410 | returnValue; | ||
411 | |||
412 | this._super = _super; | ||
413 | this._superApply = _superApply; | ||
414 | |||
415 | returnValue = value.apply( this, arguments ); | ||
416 | |||
417 | this._super = __super; | ||
418 | this._superApply = __superApply; | ||
419 | |||
420 | return returnValue; | ||
421 | }; | ||
422 | })(); | ||
423 | }); | ||
424 | constructor.prototype = $.widget.extend( basePrototype, { | ||
425 | // TODO: remove support for widgetEventPrefix | ||
426 | // always use the name + a colon as the prefix, e.g., draggable:start | ||
427 | // don't prefix for widgets that aren't DOM-based | ||
428 | widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name | ||
429 | }, proxiedPrototype, { | ||
430 | constructor: constructor, | ||
431 | namespace: namespace, | ||
432 | widgetName: name, | ||
433 | widgetFullName: fullName | ||
434 | }); | ||
435 | |||
436 | // If this widget is being redefined then we need to find all widgets that | ||
437 | // are inheriting from it and redefine all of them so that they inherit from | ||
438 | // the new version of this widget. We're essentially trying to replace one | ||
439 | // level in the prototype chain. | ||
440 | if ( existingConstructor ) { | ||
441 | $.each( existingConstructor._childConstructors, function( i, child ) { | ||
442 | var childPrototype = child.prototype; | ||
443 | |||
444 | // redefine the child widget using the same prototype that was | ||
445 | // originally used, but inherit from the new version of the base | ||
446 | $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); | ||
447 | }); | ||
448 | // remove the list of existing child constructors from the old constructor | ||
449 | // so the old child constructors can be garbage collected | ||
450 | delete existingConstructor._childConstructors; | ||
451 | } else { | ||
452 | base._childConstructors.push( constructor ); | ||
453 | } | ||
454 | |||
455 | $.widget.bridge( name, constructor ); | ||
456 | |||
457 | return constructor; | ||
458 | }; | ||
459 | |||
460 | $.widget.extend = function( target ) { | ||
461 | var input = widget_slice.call( arguments, 1 ), | ||
462 | inputIndex = 0, | ||
463 | inputLength = input.length, | ||
464 | key, | ||
465 | value; | ||
466 | for ( ; inputIndex < inputLength; inputIndex++ ) { | ||
467 | for ( key in input[ inputIndex ] ) { | ||
468 | value = input[ inputIndex ][ key ]; | ||
469 | if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { | ||
470 | // Clone objects | ||
471 | if ( $.isPlainObject( value ) ) { | ||
472 | target[ key ] = $.isPlainObject( target[ key ] ) ? | ||
473 | $.widget.extend( {}, target[ key ], value ) : | ||
474 | // Don't extend strings, arrays, etc. with objects | ||
475 | $.widget.extend( {}, value ); | ||
476 | // Copy everything else by reference | ||
477 | } else { | ||
478 | target[ key ] = value; | ||
479 | } | ||
480 | } | ||
481 | } | ||
482 | } | ||
483 | return target; | ||
484 | }; | ||
485 | |||
486 | $.widget.bridge = function( name, object ) { | ||
487 | var fullName = object.prototype.widgetFullName || name; | ||
488 | $.fn[ name ] = function( options ) { | ||
489 | var isMethodCall = typeof options === "string", | ||
490 | args = widget_slice.call( arguments, 1 ), | ||
491 | returnValue = this; | ||
492 | |||
493 | // allow multiple hashes to be passed on init | ||
494 | options = !isMethodCall && args.length ? | ||
495 | $.widget.extend.apply( null, [ options ].concat(args) ) : | ||
496 | options; | ||
497 | |||
498 | if ( isMethodCall ) { | ||
499 | this.each(function() { | ||
500 | var methodValue, | ||
501 | instance = $.data( this, fullName ); | ||
502 | if ( options === "instance" ) { | ||
503 | returnValue = instance; | ||
504 | return false; | ||
505 | } | ||
506 | if ( !instance ) { | ||
507 | return $.error( "cannot call methods on " + name + " prior to initialization; " + | ||
508 | "attempted to call method '" + options + "'" ); | ||
509 | } | ||
510 | if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { | ||
511 | return $.error( "no such method '" + options + "' for " + name + " widget instance" ); | ||
512 | } | ||
513 | methodValue = instance[ options ].apply( instance, args ); | ||
514 | if ( methodValue !== instance && methodValue !== undefined ) { | ||
515 | returnValue = methodValue && methodValue.jquery ? | ||
516 | returnValue.pushStack( methodValue.get() ) : | ||
517 | methodValue; | ||
518 | return false; | ||
519 | } | ||
520 | }); | ||
521 | } else { | ||
522 | this.each(function() { | ||
523 | var instance = $.data( this, fullName ); | ||
524 | if ( instance ) { | ||
525 | instance.option( options || {} ); | ||
526 | if ( instance._init ) { | ||
527 | instance._init(); | ||
528 | } | ||
529 | } else { | ||
530 | $.data( this, fullName, new object( options, this ) ); | ||
531 | } | ||
532 | }); | ||
533 | } | ||
534 | |||
535 | return returnValue; | ||
536 | }; | ||
537 | }; | ||
538 | |||
539 | $.Widget = function( /* options, element */ ) {}; | ||
540 | $.Widget._childConstructors = []; | ||
541 | |||
542 | $.Widget.prototype = { | ||
543 | widgetName: "widget", | ||
544 | widgetEventPrefix: "", | ||
545 | defaultElement: "<div>", | ||
546 | options: { | ||
547 | disabled: false, | ||
548 | |||
549 | // callbacks | ||
550 | create: null | ||
551 | }, | ||
552 | _createWidget: function( options, element ) { | ||
553 | element = $( element || this.defaultElement || this )[ 0 ]; | ||
554 | this.element = $( element ); | ||
555 | this.uuid = widget_uuid++; | ||
556 | this.eventNamespace = "." + this.widgetName + this.uuid; | ||
557 | |||
558 | this.bindings = $(); | ||
559 | this.hoverable = $(); | ||
560 | this.focusable = $(); | ||
561 | |||
562 | if ( element !== this ) { | ||
563 | $.data( element, this.widgetFullName, this ); | ||
564 | this._on( true, this.element, { | ||
565 | remove: function( event ) { | ||
566 | if ( event.target === element ) { | ||
567 | this.destroy(); | ||
568 | } | ||
569 | } | ||
570 | }); | ||
571 | this.document = $( element.style ? | ||
572 | // element within the document | ||
573 | element.ownerDocument : | ||
574 | // element is window or document | ||
575 | element.document || element ); | ||
576 | this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); | ||
577 | } | ||
578 | |||
579 | this.options = $.widget.extend( {}, | ||
580 | this.options, | ||
581 | this._getCreateOptions(), | ||
582 | options ); | ||
583 | |||
584 | this._create(); | ||
585 | this._trigger( "create", null, this._getCreateEventData() ); | ||
586 | this._init(); | ||
587 | }, | ||
588 | _getCreateOptions: $.noop, | ||
589 | _getCreateEventData: $.noop, | ||
590 | _create: $.noop, | ||
591 | _init: $.noop, | ||
592 | |||
593 | destroy: function() { | ||
594 | this._destroy(); | ||
595 | // we can probably remove the unbind calls in 2.0 | ||
596 | // all event bindings should go through this._on() | ||
597 | this.element | ||
598 | .unbind( this.eventNamespace ) | ||
599 | .removeData( this.widgetFullName ) | ||
600 | // support: jquery <1.6.3 | ||
601 | // http://bugs.jquery.com/ticket/9413 | ||
602 | .removeData( $.camelCase( this.widgetFullName ) ); | ||
603 | this.widget() | ||
604 | .unbind( this.eventNamespace ) | ||
605 | .removeAttr( "aria-disabled" ) | ||
606 | .removeClass( | ||
607 | this.widgetFullName + "-disabled " + | ||
608 | "ui-state-disabled" ); | ||
609 | |||
610 | // clean up events and states | ||
611 | this.bindings.unbind( this.eventNamespace ); | ||
612 | this.hoverable.removeClass( "ui-state-hover" ); | ||
613 | this.focusable.removeClass( "ui-state-focus" ); | ||
614 | }, | ||
615 | _destroy: $.noop, | ||
616 | |||
617 | widget: function() { | ||
618 | return this.element; | ||
619 | }, | ||
620 | |||
621 | option: function( key, value ) { | ||
622 | var options = key, | ||
623 | parts, | ||
624 | curOption, | ||
625 | i; | ||
626 | |||
627 | if ( arguments.length === 0 ) { | ||
628 | // don't return a reference to the internal hash | ||
629 | return $.widget.extend( {}, this.options ); | ||
630 | } | ||
631 | |||
632 | if ( typeof key === "string" ) { | ||
633 | // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } | ||
634 | options = {}; | ||
635 | parts = key.split( "." ); | ||
636 | key = parts.shift(); | ||
637 | if ( parts.length ) { | ||
638 | curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); | ||
639 | for ( i = 0; i < parts.length - 1; i++ ) { | ||
640 | curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; | ||
641 | curOption = curOption[ parts[ i ] ]; | ||
642 | } | ||
643 | key = parts.pop(); | ||
644 | if ( arguments.length === 1 ) { | ||
645 | return curOption[ key ] === undefined ? null : curOption[ key ]; | ||
646 | } | ||
647 | curOption[ key ] = value; | ||
648 | } else { | ||
649 | if ( arguments.length === 1 ) { | ||
650 | return this.options[ key ] === undefined ? null : this.options[ key ]; | ||
651 | } | ||
652 | options[ key ] = value; | ||
653 | } | ||
654 | } | ||
655 | |||
656 | this._setOptions( options ); | ||
657 | |||
658 | return this; | ||
659 | }, | ||
660 | _setOptions: function( options ) { | ||
661 | var key; | ||
662 | |||
663 | for ( key in options ) { | ||
664 | this._setOption( key, options[ key ] ); | ||
665 | } | ||
666 | |||
667 | return this; | ||
668 | }, | ||
669 | _setOption: function( key, value ) { | ||
670 | this.options[ key ] = value; | ||
671 | |||
672 | if ( key === "disabled" ) { | ||
673 | this.widget() | ||
674 | .toggleClass( this.widgetFullName + "-disabled", !!value ); | ||
675 | |||
676 | // If the widget is becoming disabled, then nothing is interactive | ||
677 | if ( value ) { | ||
678 | this.hoverable.removeClass( "ui-state-hover" ); | ||
679 | this.focusable.removeClass( "ui-state-focus" ); | ||
680 | } | ||
681 | } | ||
682 | |||
683 | return this; | ||
684 | }, | ||
685 | |||
686 | enable: function() { | ||
687 | return this._setOptions({ disabled: false }); | ||
688 | }, | ||
689 | disable: function() { | ||
690 | return this._setOptions({ disabled: true }); | ||
691 | }, | ||
692 | |||
693 | _on: function( suppressDisabledCheck, element, handlers ) { | ||
694 | var delegateElement, | ||
695 | instance = this; | ||
696 | |||
697 | // no suppressDisabledCheck flag, shuffle arguments | ||
698 | if ( typeof suppressDisabledCheck !== "boolean" ) { | ||
699 | handlers = element; | ||
700 | element = suppressDisabledCheck; | ||
701 | suppressDisabledCheck = false; | ||
702 | } | ||
703 | |||
704 | // no element argument, shuffle and use this.element | ||
705 | if ( !handlers ) { | ||
706 | handlers = element; | ||
707 | element = this.element; | ||
708 | delegateElement = this.widget(); | ||
709 | } else { | ||
710 | element = delegateElement = $( element ); | ||
711 | this.bindings = this.bindings.add( element ); | ||
712 | } | ||
713 | |||
714 | $.each( handlers, function( event, handler ) { | ||
715 | function handlerProxy() { | ||
716 | // allow widgets to customize the disabled handling | ||
717 | // - disabled as an array instead of boolean | ||
718 | // - disabled class as method for disabling individual parts | ||
719 | if ( !suppressDisabledCheck && | ||
720 | ( instance.options.disabled === true || | ||
721 | $( this ).hasClass( "ui-state-disabled" ) ) ) { | ||
722 | return; | ||
723 | } | ||
724 | return ( typeof handler === "string" ? instance[ handler ] : handler ) | ||
725 | .apply( instance, arguments ); | ||
726 | } | ||
727 | |||
728 | // copy the guid so direct unbinding works | ||
729 | if ( typeof handler !== "string" ) { | ||
730 | handlerProxy.guid = handler.guid = | ||
731 | handler.guid || handlerProxy.guid || $.guid++; | ||
732 | } | ||
733 | |||
734 | var match = event.match( /^([\w:-]*)\s*(.*)$/ ), | ||
735 | eventName = match[1] + instance.eventNamespace, | ||
736 | selector = match[2]; | ||
737 | if ( selector ) { | ||
738 | delegateElement.delegate( selector, eventName, handlerProxy ); | ||
739 | } else { | ||
740 | element.bind( eventName, handlerProxy ); | ||
741 | } | ||
742 | }); | ||
743 | }, | ||
744 | |||
745 | _off: function( element, eventName ) { | ||
746 | eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + | ||
747 | this.eventNamespace; | ||
748 | element.unbind( eventName ).undelegate( eventName ); | ||
749 | |||
750 | // Clear the stack to avoid memory leaks (#10056) | ||
751 | this.bindings = $( this.bindings.not( element ).get() ); | ||
752 | this.focusable = $( this.focusable.not( element ).get() ); | ||
753 | this.hoverable = $( this.hoverable.not( element ).get() ); | ||
754 | }, | ||
755 | |||
756 | _delay: function( handler, delay ) { | ||
757 | function handlerProxy() { | ||
758 | return ( typeof handler === "string" ? instance[ handler ] : handler ) | ||
759 | .apply( instance, arguments ); | ||
760 | } | ||
761 | var instance = this; | ||
762 | return setTimeout( handlerProxy, delay || 0 ); | ||
763 | }, | ||
764 | |||
765 | _hoverable: function( element ) { | ||
766 | this.hoverable = this.hoverable.add( element ); | ||
767 | this._on( element, { | ||
768 | mouseenter: function( event ) { | ||
769 | $( event.currentTarget ).addClass( "ui-state-hover" ); | ||
770 | }, | ||
771 | mouseleave: function( event ) { | ||
772 | $( event.currentTarget ).removeClass( "ui-state-hover" ); | ||
773 | } | ||
774 | }); | ||
775 | }, | ||
776 | |||
777 | _focusable: function( element ) { | ||
778 | this.focusable = this.focusable.add( element ); | ||
779 | this._on( element, { | ||
780 | focusin: function( event ) { | ||
781 | $( event.currentTarget ).addClass( "ui-state-focus" ); | ||
782 | }, | ||
783 | focusout: function( event ) { | ||
784 | $( event.currentTarget ).removeClass( "ui-state-focus" ); | ||
785 | } | ||
786 | }); | ||
787 | }, | ||
788 | |||
789 | _trigger: function( type, event, data ) { | ||
790 | var prop, orig, | ||
791 | callback = this.options[ type ]; | ||
792 | |||
793 | data = data || {}; | ||
794 | event = $.Event( event ); | ||
795 | event.type = ( type === this.widgetEventPrefix ? | ||
796 | type : | ||
797 | this.widgetEventPrefix + type ).toLowerCase(); | ||
798 | // the original event may come from any element | ||
799 | // so we need to reset the target on the new event | ||
800 | event.target = this.element[ 0 ]; | ||
801 | |||
802 | // copy original event properties over to the new event | ||
803 | orig = event.originalEvent; | ||
804 | if ( orig ) { | ||
805 | for ( prop in orig ) { | ||
806 | if ( !( prop in event ) ) { | ||
807 | event[ prop ] = orig[ prop ]; | ||
808 | } | ||
809 | } | ||
810 | } | ||
811 | |||
812 | this.element.trigger( event, data ); | ||
813 | return !( $.isFunction( callback ) && | ||
814 | callback.apply( this.element[0], [ event ].concat( data ) ) === false || | ||
815 | event.isDefaultPrevented() ); | ||
816 | } | ||
817 | }; | ||
818 | |||
819 | $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { | ||
820 | $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { | ||
821 | if ( typeof options === "string" ) { | ||
822 | options = { effect: options }; | ||
823 | } | ||
824 | var hasOptions, | ||
825 | effectName = !options ? | ||
826 | method : | ||
827 | options === true || typeof options === "number" ? | ||
828 | defaultEffect : | ||
829 | options.effect || defaultEffect; | ||
830 | options = options || {}; | ||
831 | if ( typeof options === "number" ) { | ||
832 | options = { duration: options }; | ||
833 | } | ||
834 | hasOptions = !$.isEmptyObject( options ); | ||
835 | options.complete = callback; | ||
836 | if ( options.delay ) { | ||
837 | element.delay( options.delay ); | ||
838 | } | ||
839 | if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { | ||
840 | element[ method ]( options ); | ||
841 | } else if ( effectName !== method && element[ effectName ] ) { | ||
842 | element[ effectName ]( options.duration, options.easing, callback ); | ||
843 | } else { | ||
844 | element.queue(function( next ) { | ||
845 | $( this )[ method ](); | ||
846 | if ( callback ) { | ||
847 | callback.call( element[ 0 ] ); | ||
848 | } | ||
849 | next(); | ||
850 | }); | ||
851 | } | ||
852 | }; | ||
853 | }); | ||
854 | |||
855 | var widget = $.widget; | ||
856 | |||
857 | |||
858 | /*! | ||
859 | * jQuery UI Mouse 1.11.2 | ||
860 | * http://jqueryui.com | ||
861 | * | ||
862 | * Copyright 2014 jQuery Foundation and other contributors | ||
863 | * Released under the MIT license. | ||
864 | * http://jquery.org/license | ||
865 | * | ||
866 | * http://api.jqueryui.com/mouse/ | ||
867 | */ | ||
868 | |||
869 | |||
870 | var mouseHandled = false; | ||
871 | $( document ).mouseup( function() { | ||
872 | mouseHandled = false; | ||
873 | }); | ||
874 | |||
875 | var mouse = $.widget("ui.mouse", { | ||
876 | version: "1.11.2", | ||
877 | options: { | ||
878 | cancel: "input,textarea,button,select,option", | ||
879 | distance: 1, | ||
880 | delay: 0 | ||
881 | }, | ||
882 | _mouseInit: function() { | ||
883 | var that = this; | ||
884 | |||
885 | this.element | ||
886 | .bind("mousedown." + this.widgetName, function(event) { | ||
887 | return that._mouseDown(event); | ||
888 | }) | ||
889 | .bind("click." + this.widgetName, function(event) { | ||
890 | if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { | ||
891 | $.removeData(event.target, that.widgetName + ".preventClickEvent"); | ||
892 | event.stopImmediatePropagation(); | ||
893 | return false; | ||
894 | } | ||
895 | }); | ||
896 | |||
897 | this.started = false; | ||
898 | }, | ||
899 | |||
900 | // TODO: make sure destroying one instance of mouse doesn't mess with | ||
901 | // other instances of mouse | ||
902 | _mouseDestroy: function() { | ||
903 | this.element.unbind("." + this.widgetName); | ||
904 | if ( this._mouseMoveDelegate ) { | ||
905 | this.document | ||
906 | .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) | ||
907 | .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); | ||
908 | } | ||
909 | }, | ||
910 | |||
911 | _mouseDown: function(event) { | ||
912 | // don't let more than one widget handle mouseStart | ||
913 | if ( mouseHandled ) { | ||
914 | return; | ||
915 | } | ||
916 | |||
917 | this._mouseMoved = false; | ||
918 | |||
919 | // we may have missed mouseup (out of window) | ||
920 | (this._mouseStarted && this._mouseUp(event)); | ||
921 | |||
922 | this._mouseDownEvent = event; | ||
923 | |||
924 | var that = this, | ||
925 | btnIsLeft = (event.which === 1), | ||
926 | // event.target.nodeName works around a bug in IE 8 with | ||
927 | // disabled inputs (#7620) | ||
928 | elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); | ||
929 | if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { | ||
930 | return true; | ||
931 | } | ||
932 | |||
933 | this.mouseDelayMet = !this.options.delay; | ||
934 | if (!this.mouseDelayMet) { | ||
935 | this._mouseDelayTimer = setTimeout(function() { | ||
936 | that.mouseDelayMet = true; | ||
937 | }, this.options.delay); | ||
938 | } | ||
939 | |||
940 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { | ||
941 | this._mouseStarted = (this._mouseStart(event) !== false); | ||
942 | if (!this._mouseStarted) { | ||
943 | event.preventDefault(); | ||
944 | return true; | ||
945 | } | ||
946 | } | ||
947 | |||
948 | // Click event may never have fired (Gecko & Opera) | ||
949 | if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { | ||
950 | $.removeData(event.target, this.widgetName + ".preventClickEvent"); | ||
951 | } | ||
952 | |||
953 | // these delegates are required to keep context | ||
954 | this._mouseMoveDelegate = function(event) { | ||
955 | return that._mouseMove(event); | ||
956 | }; | ||
957 | this._mouseUpDelegate = function(event) { | ||
958 | return that._mouseUp(event); | ||
959 | }; | ||
960 | |||
961 | this.document | ||
962 | .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) | ||
963 | .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); | ||
964 | |||
965 | event.preventDefault(); | ||
966 | |||
967 | mouseHandled = true; | ||
968 | return true; | ||
969 | }, | ||
970 | |||
971 | _mouseMove: function(event) { | ||
972 | // Only check for mouseups outside the document if you've moved inside the document | ||
973 | // at least once. This prevents the firing of mouseup in the case of IE<9, which will | ||
974 | // fire a mousemove event if content is placed under the cursor. See #7778 | ||
975 | // Support: IE <9 | ||
976 | if ( this._mouseMoved ) { | ||
977 | // IE mouseup check - mouseup happened when mouse was out of window | ||
978 | if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { | ||
979 | return this._mouseUp(event); | ||
980 | |||
981 | // Iframe mouseup check - mouseup occurred in another document | ||
982 | } else if ( !event.which ) { | ||
983 | return this._mouseUp( event ); | ||
984 | } | ||
985 | } | ||
986 | |||
987 | if ( event.which || event.button ) { | ||
988 | this._mouseMoved = true; | ||
989 | } | ||
990 | |||
991 | if (this._mouseStarted) { | ||
992 | this._mouseDrag(event); | ||
993 | return event.preventDefault(); | ||
994 | } | ||
995 | |||
996 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { | ||
997 | this._mouseStarted = | ||
998 | (this._mouseStart(this._mouseDownEvent, event) !== false); | ||
999 | (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); | ||
1000 | } | ||
1001 | |||
1002 | return !this._mouseStarted; | ||
1003 | }, | ||
1004 | |||
1005 | _mouseUp: function(event) { | ||
1006 | this.document | ||
1007 | .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) | ||
1008 | .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); | ||
1009 | |||
1010 | if (this._mouseStarted) { | ||
1011 | this._mouseStarted = false; | ||
1012 | |||
1013 | if (event.target === this._mouseDownEvent.target) { | ||
1014 | $.data(event.target, this.widgetName + ".preventClickEvent", true); | ||
1015 | } | ||
1016 | |||
1017 | this._mouseStop(event); | ||
1018 | } | ||
1019 | |||
1020 | mouseHandled = false; | ||
1021 | return false; | ||
1022 | }, | ||
1023 | |||
1024 | _mouseDistanceMet: function(event) { | ||
1025 | return (Math.max( | ||
1026 | Math.abs(this._mouseDownEvent.pageX - event.pageX), | ||
1027 | Math.abs(this._mouseDownEvent.pageY - event.pageY) | ||
1028 | ) >= this.options.distance | ||
1029 | ); | ||
1030 | }, | ||
1031 | |||
1032 | _mouseDelayMet: function(/* event */) { | ||
1033 | return this.mouseDelayMet; | ||
1034 | }, | ||
1035 | |||
1036 | // These are placeholder methods, to be overriden by extending plugin | ||
1037 | _mouseStart: function(/* event */) {}, | ||
1038 | _mouseDrag: function(/* event */) {}, | ||
1039 | _mouseStop: function(/* event */) {}, | ||
1040 | _mouseCapture: function(/* event */) { return true; } | ||
1041 | }); | ||
1042 | |||
1043 | |||
1044 | /*! | ||
1045 | * jQuery UI Position 1.11.2 | ||
1046 | * http://jqueryui.com | ||
1047 | * | ||
1048 | * Copyright 2014 jQuery Foundation and other contributors | ||
1049 | * Released under the MIT license. | ||
1050 | * http://jquery.org/license | ||
1051 | * | ||
1052 | * http://api.jqueryui.com/position/ | ||
1053 | */ | ||
1054 | |||
1055 | (function() { | ||
1056 | |||
1057 | $.ui = $.ui || {}; | ||
1058 | |||
1059 | var cachedScrollbarWidth, supportsOffsetFractions, | ||
1060 | max = Math.max, | ||
1061 | abs = Math.abs, | ||
1062 | round = Math.round, | ||
1063 | rhorizontal = /left|center|right/, | ||
1064 | rvertical = /top|center|bottom/, | ||
1065 | roffset = /[\+\-]\d+(\.[\d]+)?%?/, | ||
1066 | rposition = /^\w+/, | ||
1067 | rpercent = /%$/, | ||
1068 | _position = $.fn.position; | ||
1069 | |||
1070 | function getOffsets( offsets, width, height ) { | ||
1071 | return [ | ||
1072 | parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), | ||
1073 | parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) | ||
1074 | ]; | ||
1075 | } | ||
1076 | |||
1077 | function parseCss( element, property ) { | ||
1078 | return parseInt( $.css( element, property ), 10 ) || 0; | ||
1079 | } | ||
1080 | |||
1081 | function getDimensions( elem ) { | ||
1082 | var raw = elem[0]; | ||
1083 | if ( raw.nodeType === 9 ) { | ||
1084 | return { | ||
1085 | width: elem.width(), | ||
1086 | height: elem.height(), | ||
1087 | offset: { top: 0, left: 0 } | ||
1088 | }; | ||
1089 | } | ||
1090 | if ( $.isWindow( raw ) ) { | ||
1091 | return { | ||
1092 | width: elem.width(), | ||
1093 | height: elem.height(), | ||
1094 | offset: { top: elem.scrollTop(), left: elem.scrollLeft() } | ||
1095 | }; | ||
1096 | } | ||
1097 | if ( raw.preventDefault ) { | ||
1098 | return { | ||
1099 | width: 0, | ||
1100 | height: 0, | ||
1101 | offset: { top: raw.pageY, left: raw.pageX } | ||
1102 | }; | ||
1103 | } | ||
1104 | return { | ||
1105 | width: elem.outerWidth(), | ||
1106 | height: elem.outerHeight(), | ||
1107 | offset: elem.offset() | ||
1108 | }; | ||
1109 | } | ||
1110 | |||
1111 | $.position = { | ||
1112 | scrollbarWidth: function() { | ||
1113 | if ( cachedScrollbarWidth !== undefined ) { | ||
1114 | return cachedScrollbarWidth; | ||
1115 | } | ||
1116 | var w1, w2, | ||
1117 | div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), | ||
1118 | innerDiv = div.children()[0]; | ||
1119 | |||
1120 | $( "body" ).append( div ); | ||
1121 | w1 = innerDiv.offsetWidth; | ||
1122 | div.css( "overflow", "scroll" ); | ||
1123 | |||
1124 | w2 = innerDiv.offsetWidth; | ||
1125 | |||
1126 | if ( w1 === w2 ) { | ||
1127 | w2 = div[0].clientWidth; | ||
1128 | } | ||
1129 | |||
1130 | div.remove(); | ||
1131 | |||
1132 | return (cachedScrollbarWidth = w1 - w2); | ||
1133 | }, | ||
1134 | getScrollInfo: function( within ) { | ||
1135 | var overflowX = within.isWindow || within.isDocument ? "" : | ||
1136 | within.element.css( "overflow-x" ), | ||
1137 | overflowY = within.isWindow || within.isDocument ? "" : | ||
1138 | within.element.css( "overflow-y" ), | ||
1139 | hasOverflowX = overflowX === "scroll" || | ||
1140 | ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), | ||
1141 | hasOverflowY = overflowY === "scroll" || | ||
1142 | ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); | ||
1143 | return { | ||
1144 | width: hasOverflowY ? $.position.scrollbarWidth() : 0, | ||
1145 | height: hasOverflowX ? $.position.scrollbarWidth() : 0 | ||
1146 | }; | ||
1147 | }, | ||
1148 | getWithinInfo: function( element ) { | ||
1149 | var withinElement = $( element || window ), | ||
1150 | isWindow = $.isWindow( withinElement[0] ), | ||
1151 | isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; | ||
1152 | return { | ||
1153 | element: withinElement, | ||
1154 | isWindow: isWindow, | ||
1155 | isDocument: isDocument, | ||
1156 | offset: withinElement.offset() || { left: 0, top: 0 }, | ||
1157 | scrollLeft: withinElement.scrollLeft(), | ||
1158 | scrollTop: withinElement.scrollTop(), | ||
1159 | |||
1160 | // support: jQuery 1.6.x | ||
1161 | // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows | ||
1162 | width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), | ||
1163 | height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() | ||
1164 | }; | ||
1165 | } | ||
1166 | }; | ||
1167 | |||
1168 | $.fn.position = function( options ) { | ||
1169 | if ( !options || !options.of ) { | ||
1170 | return _position.apply( this, arguments ); | ||
1171 | } | ||
1172 | |||
1173 | // make a copy, we don't want to modify arguments | ||
1174 | options = $.extend( {}, options ); | ||
1175 | |||
1176 | var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, | ||
1177 | target = $( options.of ), | ||
1178 | within = $.position.getWithinInfo( options.within ), | ||
1179 | scrollInfo = $.position.getScrollInfo( within ), | ||
1180 | collision = ( options.collision || "flip" ).split( " " ), | ||
1181 | offsets = {}; | ||
1182 | |||
1183 | dimensions = getDimensions( target ); | ||
1184 | if ( target[0].preventDefault ) { | ||
1185 | // force left top to allow flipping | ||
1186 | options.at = "left top"; | ||
1187 | } | ||
1188 | targetWidth = dimensions.width; | ||
1189 | targetHeight = dimensions.height; | ||
1190 | targetOffset = dimensions.offset; | ||
1191 | // clone to reuse original targetOffset later | ||
1192 | basePosition = $.extend( {}, targetOffset ); | ||
1193 | |||
1194 | // force my and at to have valid horizontal and vertical positions | ||
1195 | // if a value is missing or invalid, it will be converted to center | ||
1196 | $.each( [ "my", "at" ], function() { | ||
1197 | var pos = ( options[ this ] || "" ).split( " " ), | ||
1198 | horizontalOffset, | ||
1199 | verticalOffset; | ||
1200 | |||
1201 | if ( pos.length === 1) { | ||
1202 | pos = rhorizontal.test( pos[ 0 ] ) ? | ||
1203 | pos.concat( [ "center" ] ) : | ||
1204 | rvertical.test( pos[ 0 ] ) ? | ||
1205 | [ "center" ].concat( pos ) : | ||
1206 | [ "center", "center" ]; | ||
1207 | } | ||
1208 | pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; | ||
1209 | pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; | ||
1210 | |||
1211 | // calculate offsets | ||
1212 | horizontalOffset = roffset.exec( pos[ 0 ] ); | ||
1213 | verticalOffset = roffset.exec( pos[ 1 ] ); | ||
1214 | offsets[ this ] = [ | ||
1215 | horizontalOffset ? horizontalOffset[ 0 ] : 0, | ||
1216 | verticalOffset ? verticalOffset[ 0 ] : 0 | ||
1217 | ]; | ||
1218 | |||
1219 | // reduce to just the positions without the offsets | ||
1220 | options[ this ] = [ | ||
1221 | rposition.exec( pos[ 0 ] )[ 0 ], | ||
1222 | rposition.exec( pos[ 1 ] )[ 0 ] | ||
1223 | ]; | ||
1224 | }); | ||
1225 | |||
1226 | // normalize collision option | ||
1227 | if ( collision.length === 1 ) { | ||
1228 | collision[ 1 ] = collision[ 0 ]; | ||
1229 | } | ||
1230 | |||
1231 | if ( options.at[ 0 ] === "right" ) { | ||
1232 | basePosition.left += targetWidth; | ||
1233 | } else if ( options.at[ 0 ] === "center" ) { | ||
1234 | basePosition.left += targetWidth / 2; | ||
1235 | } | ||
1236 | |||
1237 | if ( options.at[ 1 ] === "bottom" ) { | ||
1238 | basePosition.top += targetHeight; | ||
1239 | } else if ( options.at[ 1 ] === "center" ) { | ||
1240 | basePosition.top += targetHeight / 2; | ||
1241 | } | ||
1242 | |||
1243 | atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); | ||
1244 | basePosition.left += atOffset[ 0 ]; | ||
1245 | basePosition.top += atOffset[ 1 ]; | ||
1246 | |||
1247 | return this.each(function() { | ||
1248 | var collisionPosition, using, | ||
1249 | elem = $( this ), | ||
1250 | elemWidth = elem.outerWidth(), | ||
1251 | elemHeight = elem.outerHeight(), | ||
1252 | marginLeft = parseCss( this, "marginLeft" ), | ||
1253 | marginTop = parseCss( this, "marginTop" ), | ||
1254 | collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, | ||
1255 | collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, | ||
1256 | position = $.extend( {}, basePosition ), | ||
1257 | myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); | ||
1258 | |||
1259 | if ( options.my[ 0 ] === "right" ) { | ||
1260 | position.left -= elemWidth; | ||
1261 | } else if ( options.my[ 0 ] === "center" ) { | ||
1262 | position.left -= elemWidth / 2; | ||
1263 | } | ||
1264 | |||
1265 | if ( options.my[ 1 ] === "bottom" ) { | ||
1266 | position.top -= elemHeight; | ||
1267 | } else if ( options.my[ 1 ] === "center" ) { | ||
1268 | position.top -= elemHeight / 2; | ||
1269 | } | ||
1270 | |||
1271 | position.left += myOffset[ 0 ]; | ||
1272 | position.top += myOffset[ 1 ]; | ||
1273 | |||
1274 | // if the browser doesn't support fractions, then round for consistent results | ||
1275 | if ( !supportsOffsetFractions ) { | ||
1276 | position.left = round( position.left ); | ||
1277 | position.top = round( position.top ); | ||
1278 | } | ||
1279 | |||
1280 | collisionPosition = { | ||
1281 | marginLeft: marginLeft, | ||
1282 | marginTop: marginTop | ||
1283 | }; | ||
1284 | |||
1285 | $.each( [ "left", "top" ], function( i, dir ) { | ||
1286 | if ( $.ui.position[ collision[ i ] ] ) { | ||
1287 | $.ui.position[ collision[ i ] ][ dir ]( position, { | ||
1288 | targetWidth: targetWidth, | ||
1289 | targetHeight: targetHeight, | ||
1290 | elemWidth: elemWidth, | ||
1291 | elemHeight: elemHeight, | ||
1292 | collisionPosition: collisionPosition, | ||
1293 | collisionWidth: collisionWidth, | ||
1294 | collisionHeight: collisionHeight, | ||
1295 | offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], | ||
1296 | my: options.my, | ||
1297 | at: options.at, | ||
1298 | within: within, | ||
1299 | elem: elem | ||
1300 | }); | ||
1301 | } | ||
1302 | }); | ||
1303 | |||
1304 | if ( options.using ) { | ||
1305 | // adds feedback as second argument to using callback, if present | ||
1306 | using = function( props ) { | ||
1307 | var left = targetOffset.left - position.left, | ||
1308 | right = left + targetWidth - elemWidth, | ||
1309 | top = targetOffset.top - position.top, | ||
1310 | bottom = top + targetHeight - elemHeight, | ||
1311 | feedback = { | ||
1312 | target: { | ||
1313 | element: target, | ||
1314 | left: targetOffset.left, | ||
1315 | top: targetOffset.top, | ||
1316 | width: targetWidth, | ||
1317 | height: targetHeight | ||
1318 | }, | ||
1319 | element: { | ||
1320 | element: elem, | ||
1321 | left: position.left, | ||
1322 | top: position.top, | ||
1323 | width: elemWidth, | ||
1324 | height: elemHeight | ||
1325 | }, | ||
1326 | horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", | ||
1327 | vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" | ||
1328 | }; | ||
1329 | if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { | ||
1330 | feedback.horizontal = "center"; | ||
1331 | } | ||
1332 | if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { | ||
1333 | feedback.vertical = "middle"; | ||
1334 | } | ||
1335 | if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { | ||
1336 | feedback.important = "horizontal"; | ||
1337 | } else { | ||
1338 | feedback.important = "vertical"; | ||
1339 | } | ||
1340 | options.using.call( this, props, feedback ); | ||
1341 | }; | ||
1342 | } | ||
1343 | |||
1344 | elem.offset( $.extend( position, { using: using } ) ); | ||
1345 | }); | ||
1346 | }; | ||
1347 | |||
1348 | $.ui.position = { | ||
1349 | fit: { | ||
1350 | left: function( position, data ) { | ||
1351 | var within = data.within, | ||
1352 | withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, | ||
1353 | outerWidth = within.width, | ||
1354 | collisionPosLeft = position.left - data.collisionPosition.marginLeft, | ||
1355 | overLeft = withinOffset - collisionPosLeft, | ||
1356 | overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, | ||
1357 | newOverRight; | ||
1358 | |||
1359 | // element is wider than within | ||
1360 | if ( data.collisionWidth > outerWidth ) { | ||
1361 | // element is initially over the left side of within | ||
1362 | if ( overLeft > 0 && overRight <= 0 ) { | ||
1363 | newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; | ||
1364 | position.left += overLeft - newOverRight; | ||
1365 | // element is initially over right side of within | ||
1366 | } else if ( overRight > 0 && overLeft <= 0 ) { | ||
1367 | position.left = withinOffset; | ||
1368 | // element is initially over both left and right sides of within | ||
1369 | } else { | ||
1370 | if ( overLeft > overRight ) { | ||
1371 | position.left = withinOffset + outerWidth - data.collisionWidth; | ||
1372 | } else { | ||
1373 | position.left = withinOffset; | ||
1374 | } | ||
1375 | } | ||
1376 | // too far left -> align with left edge | ||
1377 | } else if ( overLeft > 0 ) { | ||
1378 | position.left += overLeft; | ||
1379 | // too far right -> align with right edge | ||
1380 | } else if ( overRight > 0 ) { | ||
1381 | position.left -= overRight; | ||
1382 | // adjust based on position and margin | ||
1383 | } else { | ||
1384 | position.left = max( position.left - collisionPosLeft, position.left ); | ||
1385 | } | ||
1386 | }, | ||
1387 | top: function( position, data ) { | ||
1388 | var within = data.within, | ||
1389 | withinOffset = within.isWindow ? within.scrollTop : within.offset.top, | ||
1390 | outerHeight = data.within.height, | ||
1391 | collisionPosTop = position.top - data.collisionPosition.marginTop, | ||
1392 | overTop = withinOffset - collisionPosTop, | ||
1393 | overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, | ||
1394 | newOverBottom; | ||
1395 | |||
1396 | // element is taller than within | ||
1397 | if ( data.collisionHeight > outerHeight ) { | ||
1398 | // element is initially over the top of within | ||
1399 | if ( overTop > 0 && overBottom <= 0 ) { | ||
1400 | newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; | ||
1401 | position.top += overTop - newOverBottom; | ||
1402 | // element is initially over bottom of within | ||
1403 | } else if ( overBottom > 0 && overTop <= 0 ) { | ||
1404 | position.top = withinOffset; | ||
1405 | // element is initially over both top and bottom of within | ||
1406 | } else { | ||
1407 | if ( overTop > overBottom ) { | ||
1408 | position.top = withinOffset + outerHeight - data.collisionHeight; | ||
1409 | } else { | ||
1410 | position.top = withinOffset; | ||
1411 | } | ||
1412 | } | ||
1413 | // too far up -> align with top | ||
1414 | } else if ( overTop > 0 ) { | ||
1415 | position.top += overTop; | ||
1416 | // too far down -> align with bottom edge | ||
1417 | } else if ( overBottom > 0 ) { | ||
1418 | position.top -= overBottom; | ||
1419 | // adjust based on position and margin | ||
1420 | } else { | ||
1421 | position.top = max( position.top - collisionPosTop, position.top ); | ||
1422 | } | ||
1423 | } | ||
1424 | }, | ||
1425 | flip: { | ||
1426 | left: function( position, data ) { | ||
1427 | var within = data.within, | ||
1428 | withinOffset = within.offset.left + within.scrollLeft, | ||
1429 | outerWidth = within.width, | ||
1430 | offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, | ||
1431 | collisionPosLeft = position.left - data.collisionPosition.marginLeft, | ||
1432 | overLeft = collisionPosLeft - offsetLeft, | ||
1433 | overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, | ||
1434 | myOffset = data.my[ 0 ] === "left" ? | ||
1435 | -data.elemWidth : | ||
1436 | data.my[ 0 ] === "right" ? | ||
1437 | data.elemWidth : | ||
1438 | 0, | ||
1439 | atOffset = data.at[ 0 ] === "left" ? | ||
1440 | data.targetWidth : | ||
1441 | data.at[ 0 ] === "right" ? | ||
1442 | -data.targetWidth : | ||
1443 | 0, | ||
1444 | offset = -2 * data.offset[ 0 ], | ||
1445 | newOverRight, | ||
1446 | newOverLeft; | ||
1447 | |||
1448 | if ( overLeft < 0 ) { | ||
1449 | newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; | ||
1450 | if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { | ||
1451 | position.left += myOffset + atOffset + offset; | ||
1452 | } | ||
1453 | } else if ( overRight > 0 ) { | ||
1454 | newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; | ||
1455 | if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { | ||
1456 | position.left += myOffset + atOffset + offset; | ||
1457 | } | ||
1458 | } | ||
1459 | }, | ||
1460 | top: function( position, data ) { | ||
1461 | var within = data.within, | ||
1462 | withinOffset = within.offset.top + within.scrollTop, | ||
1463 | outerHeight = within.height, | ||
1464 | offsetTop = within.isWindow ? within.scrollTop : within.offset.top, | ||
1465 | collisionPosTop = position.top - data.collisionPosition.marginTop, | ||
1466 | overTop = collisionPosTop - offsetTop, | ||
1467 | overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, | ||
1468 | top = data.my[ 1 ] === "top", | ||
1469 | myOffset = top ? | ||
1470 | -data.elemHeight : | ||
1471 | data.my[ 1 ] === "bottom" ? | ||
1472 | data.elemHeight : | ||
1473 | 0, | ||
1474 | atOffset = data.at[ 1 ] === "top" ? | ||
1475 | data.targetHeight : | ||
1476 | data.at[ 1 ] === "bottom" ? | ||
1477 | -data.targetHeight : | ||
1478 | 0, | ||
1479 | offset = -2 * data.offset[ 1 ], | ||
1480 | newOverTop, | ||
1481 | newOverBottom; | ||
1482 | if ( overTop < 0 ) { | ||
1483 | newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; | ||
1484 | if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { | ||
1485 | position.top += myOffset + atOffset + offset; | ||
1486 | } | ||
1487 | } else if ( overBottom > 0 ) { | ||
1488 | newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; | ||
1489 | if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { | ||
1490 | position.top += myOffset + atOffset + offset; | ||
1491 | } | ||
1492 | } | ||
1493 | } | ||
1494 | }, | ||
1495 | flipfit: { | ||
1496 | left: function() { | ||
1497 | $.ui.position.flip.left.apply( this, arguments ); | ||
1498 | $.ui.position.fit.left.apply( this, arguments ); | ||
1499 | }, | ||
1500 | top: function() { | ||
1501 | $.ui.position.flip.top.apply( this, arguments ); | ||
1502 | $.ui.position.fit.top.apply( this, arguments ); | ||
1503 | } | ||
1504 | } | ||
1505 | }; | ||
1506 | |||
1507 | // fraction support test | ||
1508 | (function() { | ||
1509 | var testElement, testElementParent, testElementStyle, offsetLeft, i, | ||
1510 | body = document.getElementsByTagName( "body" )[ 0 ], | ||
1511 | div = document.createElement( "div" ); | ||
1512 | |||
1513 | //Create a "fake body" for testing based on method used in jQuery.support | ||
1514 | testElement = document.createElement( body ? "div" : "body" ); | ||
1515 | testElementStyle = { | ||
1516 | visibility: "hidden", | ||
1517 | width: 0, | ||
1518 | height: 0, | ||
1519 | border: 0, | ||
1520 | margin: 0, | ||
1521 | background: "none" | ||
1522 | }; | ||
1523 | if ( body ) { | ||
1524 | $.extend( testElementStyle, { | ||
1525 | position: "absolute", | ||
1526 | left: "-1000px", | ||
1527 | top: "-1000px" | ||
1528 | }); | ||
1529 | } | ||
1530 | for ( i in testElementStyle ) { | ||
1531 | testElement.style[ i ] = testElementStyle[ i ]; | ||
1532 | } | ||
1533 | testElement.appendChild( div ); | ||
1534 | testElementParent = body || document.documentElement; | ||
1535 | testElementParent.insertBefore( testElement, testElementParent.firstChild ); | ||
1536 | |||
1537 | div.style.cssText = "position: absolute; left: 10.7432222px;"; | ||
1538 | |||
1539 | offsetLeft = $( div ).offset().left; | ||
1540 | supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; | ||
1541 | |||
1542 | testElement.innerHTML = ""; | ||
1543 | testElementParent.removeChild( testElement ); | ||
1544 | })(); | ||
1545 | |||
1546 | })(); | ||
1547 | |||
1548 | var position = $.ui.position; | ||
1549 | |||
1550 | |||
1551 | /*! | ||
1552 | * jQuery UI Accordion 1.11.2 | ||
1553 | * http://jqueryui.com | ||
1554 | * | ||
1555 | * Copyright 2014 jQuery Foundation and other contributors | ||
1556 | * Released under the MIT license. | ||
1557 | * http://jquery.org/license | ||
1558 | * | ||
1559 | * http://api.jqueryui.com/accordion/ | ||
1560 | */ | ||
1561 | |||
1562 | |||
1563 | var accordion = $.widget( "ui.accordion", { | ||
1564 | version: "1.11.2", | ||
1565 | options: { | ||
1566 | active: 0, | ||
1567 | animate: {}, | ||
1568 | collapsible: false, | ||
1569 | event: "click", | ||
1570 | header: "> li > :first-child,> :not(li):even", | ||
1571 | heightStyle: "auto", | ||
1572 | icons: { | ||
1573 | activeHeader: "ui-icon-triangle-1-s", | ||
1574 | header: "ui-icon-triangle-1-e" | ||
1575 | }, | ||
1576 | |||
1577 | // callbacks | ||
1578 | activate: null, | ||
1579 | beforeActivate: null | ||
1580 | }, | ||
1581 | |||
1582 | hideProps: { | ||
1583 | borderTopWidth: "hide", | ||
1584 | borderBottomWidth: "hide", | ||
1585 | paddingTop: "hide", | ||
1586 | paddingBottom: "hide", | ||
1587 | height: "hide" | ||
1588 | }, | ||
1589 | |||
1590 | showProps: { | ||
1591 | borderTopWidth: "show", | ||
1592 | borderBottomWidth: "show", | ||
1593 | paddingTop: "show", | ||
1594 | paddingBottom: "show", | ||
1595 | height: "show" | ||
1596 | }, | ||
1597 | |||
1598 | _create: function() { | ||
1599 | var options = this.options; | ||
1600 | this.prevShow = this.prevHide = $(); | ||
1601 | this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) | ||
1602 | // ARIA | ||
1603 | .attr( "role", "tablist" ); | ||
1604 | |||
1605 | // don't allow collapsible: false and active: false / null | ||
1606 | if ( !options.collapsible && (options.active === false || options.active == null) ) { | ||
1607 | options.active = 0; | ||
1608 | } | ||
1609 | |||
1610 | this._processPanels(); | ||
1611 | // handle negative values | ||
1612 | if ( options.active < 0 ) { | ||
1613 | options.active += this.headers.length; | ||
1614 | } | ||
1615 | this._refresh(); | ||
1616 | }, | ||
1617 | |||
1618 | _getCreateEventData: function() { | ||
1619 | return { | ||
1620 | header: this.active, | ||
1621 | panel: !this.active.length ? $() : this.active.next() | ||
1622 | }; | ||
1623 | }, | ||
1624 | |||
1625 | _createIcons: function() { | ||
1626 | var icons = this.options.icons; | ||
1627 | if ( icons ) { | ||
1628 | $( "<span>" ) | ||
1629 | .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) | ||
1630 | .prependTo( this.headers ); | ||
1631 | this.active.children( ".ui-accordion-header-icon" ) | ||
1632 | .removeClass( icons.header ) | ||
1633 | .addClass( icons.activeHeader ); | ||
1634 | this.headers.addClass( "ui-accordion-icons" ); | ||
1635 | } | ||
1636 | }, | ||
1637 | |||
1638 | _destroyIcons: function() { | ||
1639 | this.headers | ||
1640 | .removeClass( "ui-accordion-icons" ) | ||
1641 | .children( ".ui-accordion-header-icon" ) | ||
1642 | .remove(); | ||
1643 | }, | ||
1644 | |||
1645 | _destroy: function() { | ||
1646 | var contents; | ||
1647 | |||
1648 | // clean up main element | ||
1649 | this.element | ||
1650 | .removeClass( "ui-accordion ui-widget ui-helper-reset" ) | ||
1651 | .removeAttr( "role" ); | ||
1652 | |||
1653 | // clean up headers | ||
1654 | this.headers | ||
1655 | .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + | ||
1656 | "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) | ||
1657 | .removeAttr( "role" ) | ||
1658 | .removeAttr( "aria-expanded" ) | ||
1659 | .removeAttr( "aria-selected" ) | ||
1660 | .removeAttr( "aria-controls" ) | ||
1661 | .removeAttr( "tabIndex" ) | ||
1662 | .removeUniqueId(); | ||
1663 | |||
1664 | this._destroyIcons(); | ||
1665 | |||
1666 | // clean up content panels | ||
1667 | contents = this.headers.next() | ||
1668 | .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + | ||
1669 | "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) | ||
1670 | .css( "display", "" ) | ||
1671 | .removeAttr( "role" ) | ||
1672 | .removeAttr( "aria-hidden" ) | ||
1673 | .removeAttr( "aria-labelledby" ) | ||
1674 | .removeUniqueId(); | ||
1675 | |||
1676 | if ( this.options.heightStyle !== "content" ) { | ||
1677 | contents.css( "height", "" ); | ||
1678 | } | ||
1679 | }, | ||
1680 | |||
1681 | _setOption: function( key, value ) { | ||
1682 | if ( key === "active" ) { | ||
1683 | // _activate() will handle invalid values and update this.options | ||
1684 | this._activate( value ); | ||
1685 | return; | ||
1686 | } | ||
1687 | |||
1688 | if ( key === "event" ) { | ||
1689 | if ( this.options.event ) { | ||
1690 | this._off( this.headers, this.options.event ); | ||
1691 | } | ||
1692 | this._setupEvents( value ); | ||
1693 | } | ||
1694 | |||
1695 | this._super( key, value ); | ||
1696 | |||
1697 | // setting collapsible: false while collapsed; open first panel | ||
1698 | if ( key === "collapsible" && !value && this.options.active === false ) { | ||
1699 | this._activate( 0 ); | ||
1700 | } | ||
1701 | |||
1702 | if ( key === "icons" ) { | ||
1703 | this._destroyIcons(); | ||
1704 | if ( value ) { | ||
1705 | this._createIcons(); | ||
1706 | } | ||
1707 | } | ||
1708 | |||
1709 | // #5332 - opacity doesn't cascade to positioned elements in IE | ||
1710 | // so we need to add the disabled class to the headers and panels | ||
1711 | if ( key === "disabled" ) { | ||
1712 | this.element | ||
1713 | .toggleClass( "ui-state-disabled", !!value ) | ||
1714 | .attr( "aria-disabled", value ); | ||
1715 | this.headers.add( this.headers.next() ) | ||
1716 | .toggleClass( "ui-state-disabled", !!value ); | ||
1717 | } | ||
1718 | }, | ||
1719 | |||
1720 | _keydown: function( event ) { | ||
1721 | if ( event.altKey || event.ctrlKey ) { | ||
1722 | return; | ||
1723 | } | ||
1724 | |||
1725 | var keyCode = $.ui.keyCode, | ||
1726 | length = this.headers.length, | ||
1727 | currentIndex = this.headers.index( event.target ), | ||
1728 | toFocus = false; | ||
1729 | |||
1730 | switch ( event.keyCode ) { | ||
1731 | case keyCode.RIGHT: | ||
1732 | case keyCode.DOWN: | ||
1733 | toFocus = this.headers[ ( currentIndex + 1 ) % length ]; | ||
1734 | break; | ||
1735 | case keyCode.LEFT: | ||
1736 | case keyCode.UP: | ||
1737 | toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; | ||
1738 | break; | ||
1739 | case keyCode.SPACE: | ||
1740 | case keyCode.ENTER: | ||
1741 | this._eventHandler( event ); | ||
1742 | break; | ||
1743 | case keyCode.HOME: | ||
1744 | toFocus = this.headers[ 0 ]; | ||
1745 | break; | ||
1746 | case keyCode.END: | ||
1747 | toFocus = this.headers[ length - 1 ]; | ||
1748 | break; | ||
1749 | } | ||
1750 | |||
1751 | if ( toFocus ) { | ||
1752 | $( event.target ).attr( "tabIndex", -1 ); | ||
1753 | $( toFocus ).attr( "tabIndex", 0 ); | ||
1754 | toFocus.focus(); | ||
1755 | event.preventDefault(); | ||
1756 | } | ||
1757 | }, | ||
1758 | |||
1759 | _panelKeyDown: function( event ) { | ||
1760 | if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { | ||
1761 | $( event.currentTarget ).prev().focus(); | ||
1762 | } | ||
1763 | }, | ||
1764 | |||
1765 | refresh: function() { | ||
1766 | var options = this.options; | ||
1767 | this._processPanels(); | ||
1768 | |||
1769 | // was collapsed or no panel | ||
1770 | if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { | ||
1771 | options.active = false; | ||
1772 | this.active = $(); | ||
1773 | // active false only when collapsible is true | ||
1774 | } else if ( options.active === false ) { | ||
1775 | this._activate( 0 ); | ||
1776 | // was active, but active panel is gone | ||
1777 | } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { | ||
1778 | // all remaining panel are disabled | ||
1779 | if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { | ||
1780 | options.active = false; | ||
1781 | this.active = $(); | ||
1782 | // activate previous panel | ||
1783 | } else { | ||
1784 | this._activate( Math.max( 0, options.active - 1 ) ); | ||
1785 | } | ||
1786 | // was active, active panel still exists | ||
1787 | } else { | ||
1788 | // make sure active index is correct | ||
1789 | options.active = this.headers.index( this.active ); | ||
1790 | } | ||
1791 | |||
1792 | this._destroyIcons(); | ||
1793 | |||
1794 | this._refresh(); | ||
1795 | }, | ||
1796 | |||
1797 | _processPanels: function() { | ||
1798 | var prevHeaders = this.headers, | ||
1799 | prevPanels = this.panels; | ||
1800 | |||
1801 | this.headers = this.element.find( this.options.header ) | ||
1802 | .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); | ||
1803 | |||
1804 | this.panels = this.headers.next() | ||
1805 | .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) | ||
1806 | .filter( ":not(.ui-accordion-content-active)" ) | ||
1807 | .hide(); | ||
1808 | |||
1809 | // Avoid memory leaks (#10056) | ||
1810 | if ( prevPanels ) { | ||
1811 | this._off( prevHeaders.not( this.headers ) ); | ||
1812 | this._off( prevPanels.not( this.panels ) ); | ||
1813 | } | ||
1814 | }, | ||
1815 | |||
1816 | _refresh: function() { | ||
1817 | var maxHeight, | ||
1818 | options = this.options, | ||
1819 | heightStyle = options.heightStyle, | ||
1820 | parent = this.element.parent(); | ||
1821 | |||
1822 | this.active = this._findActive( options.active ) | ||
1823 | .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) | ||
1824 | .removeClass( "ui-corner-all" ); | ||
1825 | this.active.next() | ||
1826 | .addClass( "ui-accordion-content-active" ) | ||
1827 | .show(); | ||
1828 | |||
1829 | this.headers | ||
1830 | .attr( "role", "tab" ) | ||
1831 | .each(function() { | ||
1832 | var header = $( this ), | ||
1833 | headerId = header.uniqueId().attr( "id" ), | ||
1834 | panel = header.next(), | ||
1835 | panelId = panel.uniqueId().attr( "id" ); | ||
1836 | header.attr( "aria-controls", panelId ); | ||
1837 | panel.attr( "aria-labelledby", headerId ); | ||
1838 | }) | ||
1839 | .next() | ||
1840 | .attr( "role", "tabpanel" ); | ||
1841 | |||
1842 | this.headers | ||
1843 | .not( this.active ) | ||
1844 | .attr({ | ||
1845 | "aria-selected": "false", | ||
1846 | "aria-expanded": "false", | ||
1847 | tabIndex: -1 | ||
1848 | }) | ||
1849 | .next() | ||
1850 | .attr({ | ||
1851 | "aria-hidden": "true" | ||
1852 | }) | ||
1853 | .hide(); | ||
1854 | |||
1855 | // make sure at least one header is in the tab order | ||
1856 | if ( !this.active.length ) { | ||
1857 | this.headers.eq( 0 ).attr( "tabIndex", 0 ); | ||
1858 | } else { | ||
1859 | this.active.attr({ | ||
1860 | "aria-selected": "true", | ||
1861 | "aria-expanded": "true", | ||
1862 | tabIndex: 0 | ||
1863 | }) | ||
1864 | .next() | ||
1865 | .attr({ | ||
1866 | "aria-hidden": "false" | ||
1867 | }); | ||
1868 | } | ||
1869 | |||
1870 | this._createIcons(); | ||
1871 | |||
1872 | this._setupEvents( options.event ); | ||
1873 | |||
1874 | if ( heightStyle === "fill" ) { | ||
1875 | maxHeight = parent.height(); | ||
1876 | this.element.siblings( ":visible" ).each(function() { | ||
1877 | var elem = $( this ), | ||
1878 | position = elem.css( "position" ); | ||
1879 | |||
1880 | if ( position === "absolute" || position === "fixed" ) { | ||
1881 | return; | ||
1882 | } | ||
1883 | maxHeight -= elem.outerHeight( true ); | ||
1884 | }); | ||
1885 | |||
1886 | this.headers.each(function() { | ||
1887 | maxHeight -= $( this ).outerHeight( true ); | ||
1888 | }); | ||
1889 | |||
1890 | this.headers.next() | ||
1891 | .each(function() { | ||
1892 | $( this ).height( Math.max( 0, maxHeight - | ||
1893 | $( this ).innerHeight() + $( this ).height() ) ); | ||
1894 | }) | ||
1895 | .css( "overflow", "auto" ); | ||
1896 | } else if ( heightStyle === "auto" ) { | ||
1897 | maxHeight = 0; | ||
1898 | this.headers.next() | ||
1899 | .each(function() { | ||
1900 | maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); | ||
1901 | }) | ||
1902 | .height( maxHeight ); | ||
1903 | } | ||
1904 | }, | ||
1905 | |||
1906 | _activate: function( index ) { | ||
1907 | var active = this._findActive( index )[ 0 ]; | ||
1908 | |||
1909 | // trying to activate the already active panel | ||
1910 | if ( active === this.active[ 0 ] ) { | ||
1911 | return; | ||
1912 | } | ||
1913 | |||
1914 | // trying to collapse, simulate a click on the currently active header | ||
1915 | active = active || this.active[ 0 ]; | ||
1916 | |||
1917 | this._eventHandler({ | ||
1918 | target: active, | ||
1919 | currentTarget: active, | ||
1920 | preventDefault: $.noop | ||
1921 | }); | ||
1922 | }, | ||
1923 | |||
1924 | _findActive: function( selector ) { | ||
1925 | return typeof selector === "number" ? this.headers.eq( selector ) : $(); | ||
1926 | }, | ||
1927 | |||
1928 | _setupEvents: function( event ) { | ||
1929 | var events = { | ||
1930 | keydown: "_keydown" | ||
1931 | }; | ||
1932 | if ( event ) { | ||
1933 | $.each( event.split( " " ), function( index, eventName ) { | ||
1934 | events[ eventName ] = "_eventHandler"; | ||
1935 | }); | ||
1936 | } | ||
1937 | |||
1938 | this._off( this.headers.add( this.headers.next() ) ); | ||
1939 | this._on( this.headers, events ); | ||
1940 | this._on( this.headers.next(), { keydown: "_panelKeyDown" }); | ||
1941 | this._hoverable( this.headers ); | ||
1942 | this._focusable( this.headers ); | ||
1943 | }, | ||
1944 | |||
1945 | _eventHandler: function( event ) { | ||
1946 | var options = this.options, | ||
1947 | active = this.active, | ||
1948 | clicked = $( event.currentTarget ), | ||
1949 | clickedIsActive = clicked[ 0 ] === active[ 0 ], | ||
1950 | collapsing = clickedIsActive && options.collapsible, | ||
1951 | toShow = collapsing ? $() : clicked.next(), | ||
1952 | toHide = active.next(), | ||
1953 | eventData = { | ||
1954 | oldHeader: active, | ||
1955 | oldPanel: toHide, | ||
1956 | newHeader: collapsing ? $() : clicked, | ||
1957 | newPanel: toShow | ||
1958 | }; | ||
1959 | |||
1960 | event.preventDefault(); | ||
1961 | |||
1962 | if ( | ||
1963 | // click on active header, but not collapsible | ||
1964 | ( clickedIsActive && !options.collapsible ) || | ||
1965 | // allow canceling activation | ||
1966 | ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { | ||
1967 | return; | ||
1968 | } | ||
1969 | |||
1970 | options.active = collapsing ? false : this.headers.index( clicked ); | ||
1971 | |||
1972 | // when the call to ._toggle() comes after the class changes | ||
1973 | // it causes a very odd bug in IE 8 (see #6720) | ||
1974 | this.active = clickedIsActive ? $() : clicked; | ||
1975 | this._toggle( eventData ); | ||
1976 | |||
1977 | // switch classes | ||
1978 | // corner classes on the previously active header stay after the animation | ||
1979 | active.removeClass( "ui-accordion-header-active ui-state-active" ); | ||
1980 | if ( options.icons ) { | ||
1981 | active.children( ".ui-accordion-header-icon" ) | ||
1982 | .removeClass( options.icons.activeHeader ) | ||
1983 | .addClass( options.icons.header ); | ||
1984 | } | ||
1985 | |||
1986 | if ( !clickedIsActive ) { | ||
1987 | clicked | ||
1988 | .removeClass( "ui-corner-all" ) | ||
1989 | .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); | ||
1990 | if ( options.icons ) { | ||
1991 | clicked.children( ".ui-accordion-header-icon" ) | ||
1992 | .removeClass( options.icons.header ) | ||
1993 | .addClass( options.icons.activeHeader ); | ||
1994 | } | ||
1995 | |||
1996 | clicked | ||
1997 | .next() | ||
1998 | .addClass( "ui-accordion-content-active" ); | ||
1999 | } | ||
2000 | }, | ||
2001 | |||
2002 | _toggle: function( data ) { | ||
2003 | var toShow = data.newPanel, | ||
2004 | toHide = this.prevShow.length ? this.prevShow : data.oldPanel; | ||
2005 | |||
2006 | // handle activating a panel during the animation for another activation | ||
2007 | this.prevShow.add( this.prevHide ).stop( true, true ); | ||
2008 | this.prevShow = toShow; | ||
2009 | this.prevHide = toHide; | ||
2010 | |||
2011 | if ( this.options.animate ) { | ||
2012 | this._animate( toShow, toHide, data ); | ||
2013 | } else { | ||
2014 | toHide.hide(); | ||
2015 | toShow.show(); | ||
2016 | this._toggleComplete( data ); | ||
2017 | } | ||
2018 | |||
2019 | toHide.attr({ | ||
2020 | "aria-hidden": "true" | ||
2021 | }); | ||
2022 | toHide.prev().attr( "aria-selected", "false" ); | ||
2023 | // if we're switching panels, remove the old header from the tab order | ||
2024 | // if we're opening from collapsed state, remove the previous header from the tab order | ||
2025 | // if we're collapsing, then keep the collapsing header in the tab order | ||
2026 | if ( toShow.length && toHide.length ) { | ||
2027 | toHide.prev().attr({ | ||
2028 | "tabIndex": -1, | ||
2029 | "aria-expanded": "false" | ||
2030 | }); | ||
2031 | } else if ( toShow.length ) { | ||
2032 | this.headers.filter(function() { | ||
2033 | return $( this ).attr( "tabIndex" ) === 0; | ||
2034 | }) | ||
2035 | .attr( "tabIndex", -1 ); | ||
2036 | } | ||
2037 | |||
2038 | toShow | ||
2039 | .attr( "aria-hidden", "false" ) | ||
2040 | .prev() | ||
2041 | .attr({ | ||
2042 | "aria-selected": "true", | ||
2043 | tabIndex: 0, | ||
2044 | "aria-expanded": "true" | ||
2045 | }); | ||
2046 | }, | ||
2047 | |||
2048 | _animate: function( toShow, toHide, data ) { | ||
2049 | var total, easing, duration, | ||
2050 | that = this, | ||
2051 | adjust = 0, | ||
2052 | down = toShow.length && | ||
2053 | ( !toHide.length || ( toShow.index() < toHide.index() ) ), | ||
2054 | animate = this.options.animate || {}, | ||
2055 | options = down && animate.down || animate, | ||
2056 | complete = function() { | ||
2057 | that._toggleComplete( data ); | ||
2058 | }; | ||
2059 | |||
2060 | if ( typeof options === "number" ) { | ||
2061 | duration = options; | ||
2062 | } | ||
2063 | if ( typeof options === "string" ) { | ||
2064 | easing = options; | ||
2065 | } | ||
2066 | // fall back from options to animation in case of partial down settings | ||
2067 | easing = easing || options.easing || animate.easing; | ||
2068 | duration = duration || options.duration || animate.duration; | ||
2069 | |||
2070 | if ( !toHide.length ) { | ||
2071 | return toShow.animate( this.showProps, duration, easing, complete ); | ||
2072 | } | ||
2073 | if ( !toShow.length ) { | ||
2074 | return toHide.animate( this.hideProps, duration, easing, complete ); | ||
2075 | } | ||
2076 | |||
2077 | total = toShow.show().outerHeight(); | ||
2078 | toHide.animate( this.hideProps, { | ||
2079 | duration: duration, | ||
2080 | easing: easing, | ||
2081 | step: function( now, fx ) { | ||
2082 | fx.now = Math.round( now ); | ||
2083 | } | ||
2084 | }); | ||
2085 | toShow | ||
2086 | .hide() | ||
2087 | .animate( this.showProps, { | ||
2088 | duration: duration, | ||
2089 | easing: easing, | ||
2090 | complete: complete, | ||
2091 | step: function( now, fx ) { | ||
2092 | fx.now = Math.round( now ); | ||
2093 | if ( fx.prop !== "height" ) { | ||
2094 | adjust += fx.now; | ||
2095 | } else if ( that.options.heightStyle !== "content" ) { | ||
2096 | fx.now = Math.round( total - toHide.outerHeight() - adjust ); | ||
2097 | adjust = 0; | ||
2098 | } | ||
2099 | } | ||
2100 | }); | ||
2101 | }, | ||
2102 | |||
2103 | _toggleComplete: function( data ) { | ||
2104 | var toHide = data.oldPanel; | ||
2105 | |||
2106 | toHide | ||
2107 | .removeClass( "ui-accordion-content-active" ) | ||
2108 | .prev() | ||
2109 | .removeClass( "ui-corner-top" ) | ||
2110 | .addClass( "ui-corner-all" ); | ||
2111 | |||
2112 | // Work around for rendering bug in IE (#5421) | ||
2113 | if ( toHide.length ) { | ||
2114 | toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; | ||
2115 | } | ||
2116 | this._trigger( "activate", null, data ); | ||
2117 | } | ||
2118 | }); | ||
2119 | |||
2120 | |||
2121 | /*! | ||
2122 | * jQuery UI Menu 1.11.2 | ||
2123 | * http://jqueryui.com | ||
2124 | * | ||
2125 | * Copyright 2014 jQuery Foundation and other contributors | ||
2126 | * Released under the MIT license. | ||
2127 | * http://jquery.org/license | ||
2128 | * | ||
2129 | * http://api.jqueryui.com/menu/ | ||
2130 | */ | ||
2131 | |||
2132 | |||
2133 | var menu = $.widget( "ui.menu", { | ||
2134 | version: "1.11.2", | ||
2135 | defaultElement: "<ul>", | ||
2136 | delay: 300, | ||
2137 | options: { | ||
2138 | icons: { | ||
2139 | submenu: "ui-icon-carat-1-e" | ||
2140 | }, | ||
2141 | items: "> *", | ||
2142 | menus: "ul", | ||
2143 | position: { | ||
2144 | my: "left-1 top", | ||
2145 | at: "right top" | ||
2146 | }, | ||
2147 | role: "menu", | ||
2148 | |||
2149 | // callbacks | ||
2150 | blur: null, | ||
2151 | focus: null, | ||
2152 | select: null | ||
2153 | }, | ||
2154 | |||
2155 | _create: function() { | ||
2156 | this.activeMenu = this.element; | ||
2157 | |||
2158 | // Flag used to prevent firing of the click handler | ||
2159 | // as the event bubbles up through nested menus | ||
2160 | this.mouseHandled = false; | ||
2161 | this.element | ||
2162 | .uniqueId() | ||
2163 | .addClass( "ui-menu ui-widget ui-widget-content" ) | ||
2164 | .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) | ||
2165 | .attr({ | ||
2166 | role: this.options.role, | ||
2167 | tabIndex: 0 | ||
2168 | }); | ||
2169 | |||
2170 | if ( this.options.disabled ) { | ||
2171 | this.element | ||
2172 | .addClass( "ui-state-disabled" ) | ||
2173 | .attr( "aria-disabled", "true" ); | ||
2174 | } | ||
2175 | |||
2176 | this._on({ | ||
2177 | // Prevent focus from sticking to links inside menu after clicking | ||
2178 | // them (focus should always stay on UL during navigation). | ||
2179 | "mousedown .ui-menu-item": function( event ) { | ||
2180 | event.preventDefault(); | ||
2181 | }, | ||
2182 | "click .ui-menu-item": function( event ) { | ||
2183 | var target = $( event.target ); | ||
2184 | if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { | ||
2185 | this.select( event ); | ||
2186 | |||
2187 | // Only set the mouseHandled flag if the event will bubble, see #9469. | ||
2188 | if ( !event.isPropagationStopped() ) { | ||
2189 | this.mouseHandled = true; | ||
2190 | } | ||
2191 | |||
2192 | // Open submenu on click | ||
2193 | if ( target.has( ".ui-menu" ).length ) { | ||
2194 | this.expand( event ); | ||
2195 | } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { | ||
2196 | |||
2197 | // Redirect focus to the menu | ||
2198 | this.element.trigger( "focus", [ true ] ); | ||
2199 | |||
2200 | // If the active item is on the top level, let it stay active. | ||
2201 | // Otherwise, blur the active item since it is no longer visible. | ||
2202 | if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { | ||
2203 | clearTimeout( this.timer ); | ||
2204 | } | ||
2205 | } | ||
2206 | } | ||
2207 | }, | ||
2208 | "mouseenter .ui-menu-item": function( event ) { | ||
2209 | // Ignore mouse events while typeahead is active, see #10458. | ||
2210 | // Prevents focusing the wrong item when typeahead causes a scroll while the mouse | ||
2211 | // is over an item in the menu | ||
2212 | if ( this.previousFilter ) { | ||
2213 | return; | ||
2214 | } | ||
2215 | var target = $( event.currentTarget ); | ||
2216 | // Remove ui-state-active class from siblings of the newly focused menu item | ||
2217 | // to avoid a jump caused by adjacent elements both having a class with a border | ||
2218 | target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" ); | ||
2219 | this.focus( event, target ); | ||
2220 | }, | ||
2221 | mouseleave: "collapseAll", | ||
2222 | "mouseleave .ui-menu": "collapseAll", | ||
2223 | focus: function( event, keepActiveItem ) { | ||
2224 | // If there's already an active item, keep it active | ||
2225 | // If not, activate the first item | ||
2226 | var item = this.active || this.element.find( this.options.items ).eq( 0 ); | ||
2227 | |||
2228 | if ( !keepActiveItem ) { | ||
2229 | this.focus( event, item ); | ||
2230 | } | ||
2231 | }, | ||
2232 | blur: function( event ) { | ||
2233 | this._delay(function() { | ||
2234 | if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { | ||
2235 | this.collapseAll( event ); | ||
2236 | } | ||
2237 | }); | ||
2238 | }, | ||
2239 | keydown: "_keydown" | ||
2240 | }); | ||
2241 | |||
2242 | this.refresh(); | ||
2243 | |||
2244 | // Clicks outside of a menu collapse any open menus | ||
2245 | this._on( this.document, { | ||
2246 | click: function( event ) { | ||
2247 | if ( this._closeOnDocumentClick( event ) ) { | ||
2248 | this.collapseAll( event ); | ||
2249 | } | ||
2250 | |||
2251 | // Reset the mouseHandled flag | ||
2252 | this.mouseHandled = false; | ||
2253 | } | ||
2254 | }); | ||
2255 | }, | ||
2256 | |||
2257 | _destroy: function() { | ||
2258 | // Destroy (sub)menus | ||
2259 | this.element | ||
2260 | .removeAttr( "aria-activedescendant" ) | ||
2261 | .find( ".ui-menu" ).addBack() | ||
2262 | .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" ) | ||
2263 | .removeAttr( "role" ) | ||
2264 | .removeAttr( "tabIndex" ) | ||
2265 | .removeAttr( "aria-labelledby" ) | ||
2266 | .removeAttr( "aria-expanded" ) | ||
2267 | .removeAttr( "aria-hidden" ) | ||
2268 | .removeAttr( "aria-disabled" ) | ||
2269 | .removeUniqueId() | ||
2270 | .show(); | ||
2271 | |||
2272 | // Destroy menu items | ||
2273 | this.element.find( ".ui-menu-item" ) | ||
2274 | .removeClass( "ui-menu-item" ) | ||
2275 | .removeAttr( "role" ) | ||
2276 | .removeAttr( "aria-disabled" ) | ||
2277 | .removeUniqueId() | ||
2278 | .removeClass( "ui-state-hover" ) | ||
2279 | .removeAttr( "tabIndex" ) | ||
2280 | .removeAttr( "role" ) | ||
2281 | .removeAttr( "aria-haspopup" ) | ||
2282 | .children().each( function() { | ||
2283 | var elem = $( this ); | ||
2284 | if ( elem.data( "ui-menu-submenu-carat" ) ) { | ||
2285 | elem.remove(); | ||
2286 | } | ||
2287 | }); | ||
2288 | |||
2289 | // Destroy menu dividers | ||
2290 | this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); | ||
2291 | }, | ||
2292 | |||
2293 | _keydown: function( event ) { | ||
2294 | var match, prev, character, skip, | ||
2295 | preventDefault = true; | ||
2296 | |||
2297 | switch ( event.keyCode ) { | ||
2298 | case $.ui.keyCode.PAGE_UP: | ||
2299 | this.previousPage( event ); | ||
2300 | break; | ||
2301 | case $.ui.keyCode.PAGE_DOWN: | ||
2302 | this.nextPage( event ); | ||
2303 | break; | ||
2304 | case $.ui.keyCode.HOME: | ||
2305 | this._move( "first", "first", event ); | ||
2306 | break; | ||
2307 | case $.ui.keyCode.END: | ||
2308 | this._move( "last", "last", event ); | ||
2309 | break; | ||
2310 | case $.ui.keyCode.UP: | ||
2311 | this.previous( event ); | ||
2312 | break; | ||
2313 | case $.ui.keyCode.DOWN: | ||
2314 | this.next( event ); | ||
2315 | break; | ||
2316 | case $.ui.keyCode.LEFT: | ||
2317 | this.collapse( event ); | ||
2318 | break; | ||
2319 | case $.ui.keyCode.RIGHT: | ||
2320 | if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { | ||
2321 | this.expand( event ); | ||
2322 | } | ||
2323 | break; | ||
2324 | case $.ui.keyCode.ENTER: | ||
2325 | case $.ui.keyCode.SPACE: | ||
2326 | this._activate( event ); | ||
2327 | break; | ||
2328 | case $.ui.keyCode.ESCAPE: | ||
2329 | this.collapse( event ); | ||
2330 | break; | ||
2331 | default: | ||
2332 | preventDefault = false; | ||
2333 | prev = this.previousFilter || ""; | ||
2334 | character = String.fromCharCode( event.keyCode ); | ||
2335 | skip = false; | ||
2336 | |||
2337 | clearTimeout( this.filterTimer ); | ||
2338 | |||
2339 | if ( character === prev ) { | ||
2340 | skip = true; | ||
2341 | } else { | ||
2342 | character = prev + character; | ||
2343 | } | ||
2344 | |||
2345 | match = this._filterMenuItems( character ); | ||
2346 | match = skip && match.index( this.active.next() ) !== -1 ? | ||
2347 | this.active.nextAll( ".ui-menu-item" ) : | ||
2348 | match; | ||
2349 | |||
2350 | // If no matches on the current filter, reset to the last character pressed | ||
2351 | // to move down the menu to the first item that starts with that character | ||
2352 | if ( !match.length ) { | ||
2353 | character = String.fromCharCode( event.keyCode ); | ||
2354 | match = this._filterMenuItems( character ); | ||
2355 | } | ||
2356 | |||
2357 | if ( match.length ) { | ||
2358 | this.focus( event, match ); | ||
2359 | this.previousFilter = character; | ||
2360 | this.filterTimer = this._delay(function() { | ||
2361 | delete this.previousFilter; | ||
2362 | }, 1000 ); | ||
2363 | } else { | ||
2364 | delete this.previousFilter; | ||
2365 | } | ||
2366 | } | ||
2367 | |||
2368 | if ( preventDefault ) { | ||
2369 | event.preventDefault(); | ||
2370 | } | ||
2371 | }, | ||
2372 | |||
2373 | _activate: function( event ) { | ||
2374 | if ( !this.active.is( ".ui-state-disabled" ) ) { | ||
2375 | if ( this.active.is( "[aria-haspopup='true']" ) ) { | ||
2376 | this.expand( event ); | ||
2377 | } else { | ||
2378 | this.select( event ); | ||
2379 | } | ||
2380 | } | ||
2381 | }, | ||
2382 | |||
2383 | refresh: function() { | ||
2384 | var menus, items, | ||
2385 | that = this, | ||
2386 | icon = this.options.icons.submenu, | ||
2387 | submenus = this.element.find( this.options.menus ); | ||
2388 | |||
2389 | this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); | ||
2390 | |||
2391 | // Initialize nested menus | ||
2392 | submenus.filter( ":not(.ui-menu)" ) | ||
2393 | .addClass( "ui-menu ui-widget ui-widget-content ui-front" ) | ||
2394 | .hide() | ||
2395 | .attr({ | ||
2396 | role: this.options.role, | ||
2397 | "aria-hidden": "true", | ||
2398 | "aria-expanded": "false" | ||
2399 | }) | ||
2400 | .each(function() { | ||
2401 | var menu = $( this ), | ||
2402 | item = menu.parent(), | ||
2403 | submenuCarat = $( "<span>" ) | ||
2404 | .addClass( "ui-menu-icon ui-icon " + icon ) | ||
2405 | .data( "ui-menu-submenu-carat", true ); | ||
2406 | |||
2407 | item | ||
2408 | .attr( "aria-haspopup", "true" ) | ||
2409 | .prepend( submenuCarat ); | ||
2410 | menu.attr( "aria-labelledby", item.attr( "id" ) ); | ||
2411 | }); | ||
2412 | |||
2413 | menus = submenus.add( this.element ); | ||
2414 | items = menus.find( this.options.items ); | ||
2415 | |||
2416 | // Initialize menu-items containing spaces and/or dashes only as dividers | ||
2417 | items.not( ".ui-menu-item" ).each(function() { | ||
2418 | var item = $( this ); | ||
2419 | if ( that._isDivider( item ) ) { | ||
2420 | item.addClass( "ui-widget-content ui-menu-divider" ); | ||
2421 | } | ||
2422 | }); | ||
2423 | |||
2424 | // Don't refresh list items that are already adapted | ||
2425 | items.not( ".ui-menu-item, .ui-menu-divider" ) | ||
2426 | .addClass( "ui-menu-item" ) | ||
2427 | .uniqueId() | ||
2428 | .attr({ | ||
2429 | tabIndex: -1, | ||
2430 | role: this._itemRole() | ||
2431 | }); | ||
2432 | |||
2433 | // Add aria-disabled attribute to any disabled menu item | ||
2434 | items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); | ||
2435 | |||
2436 | // If the active item has been removed, blur the menu | ||
2437 | if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { | ||
2438 | this.blur(); | ||
2439 | } | ||
2440 | }, | ||
2441 | |||
2442 | _itemRole: function() { | ||
2443 | return { | ||
2444 | menu: "menuitem", | ||
2445 | listbox: "option" | ||
2446 | }[ this.options.role ]; | ||
2447 | }, | ||
2448 | |||
2449 | _setOption: function( key, value ) { | ||
2450 | if ( key === "icons" ) { | ||
2451 | this.element.find( ".ui-menu-icon" ) | ||
2452 | .removeClass( this.options.icons.submenu ) | ||
2453 | .addClass( value.submenu ); | ||
2454 | } | ||
2455 | if ( key === "disabled" ) { | ||
2456 | this.element | ||
2457 | .toggleClass( "ui-state-disabled", !!value ) | ||
2458 | .attr( "aria-disabled", value ); | ||
2459 | } | ||
2460 | this._super( key, value ); | ||
2461 | }, | ||
2462 | |||
2463 | focus: function( event, item ) { | ||
2464 | var nested, focused; | ||
2465 | this.blur( event, event && event.type === "focus" ); | ||
2466 | |||
2467 | this._scrollIntoView( item ); | ||
2468 | |||
2469 | this.active = item.first(); | ||
2470 | focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" ); | ||
2471 | // Only update aria-activedescendant if there's a role | ||
2472 | // otherwise we assume focus is managed elsewhere | ||
2473 | if ( this.options.role ) { | ||
2474 | this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); | ||
2475 | } | ||
2476 | |||
2477 | // Highlight active parent menu item, if any | ||
2478 | this.active | ||
2479 | .parent() | ||
2480 | .closest( ".ui-menu-item" ) | ||
2481 | .addClass( "ui-state-active" ); | ||
2482 | |||
2483 | if ( event && event.type === "keydown" ) { | ||
2484 | this._close(); | ||
2485 | } else { | ||
2486 | this.timer = this._delay(function() { | ||
2487 | this._close(); | ||
2488 | }, this.delay ); | ||
2489 | } | ||
2490 | |||
2491 | nested = item.children( ".ui-menu" ); | ||
2492 | if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { | ||
2493 | this._startOpening(nested); | ||
2494 | } | ||
2495 | this.activeMenu = item.parent(); | ||
2496 | |||
2497 | this._trigger( "focus", event, { item: item } ); | ||
2498 | }, | ||
2499 | |||
2500 | _scrollIntoView: function( item ) { | ||
2501 | var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; | ||
2502 | if ( this._hasScroll() ) { | ||
2503 | borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; | ||
2504 | paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; | ||
2505 | offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; | ||
2506 | scroll = this.activeMenu.scrollTop(); | ||
2507 | elementHeight = this.activeMenu.height(); | ||
2508 | itemHeight = item.outerHeight(); | ||
2509 | |||
2510 | if ( offset < 0 ) { | ||
2511 | this.activeMenu.scrollTop( scroll + offset ); | ||
2512 | } else if ( offset + itemHeight > elementHeight ) { | ||
2513 | this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); | ||
2514 | } | ||
2515 | } | ||
2516 | }, | ||
2517 | |||
2518 | blur: function( event, fromFocus ) { | ||
2519 | if ( !fromFocus ) { | ||
2520 | clearTimeout( this.timer ); | ||
2521 | } | ||
2522 | |||
2523 | if ( !this.active ) { | ||
2524 | return; | ||
2525 | } | ||
2526 | |||
2527 | this.active.removeClass( "ui-state-focus" ); | ||
2528 | this.active = null; | ||
2529 | |||
2530 | this._trigger( "blur", event, { item: this.active } ); | ||
2531 | }, | ||
2532 | |||
2533 | _startOpening: function( submenu ) { | ||
2534 | clearTimeout( this.timer ); | ||
2535 | |||
2536 | // Don't open if already open fixes a Firefox bug that caused a .5 pixel | ||
2537 | // shift in the submenu position when mousing over the carat icon | ||
2538 | if ( submenu.attr( "aria-hidden" ) !== "true" ) { | ||
2539 | return; | ||
2540 | } | ||
2541 | |||
2542 | this.timer = this._delay(function() { | ||
2543 | this._close(); | ||
2544 | this._open( submenu ); | ||
2545 | }, this.delay ); | ||
2546 | }, | ||
2547 | |||
2548 | _open: function( submenu ) { | ||
2549 | var position = $.extend({ | ||
2550 | of: this.active | ||
2551 | }, this.options.position ); | ||
2552 | |||
2553 | clearTimeout( this.timer ); | ||
2554 | this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) | ||
2555 | .hide() | ||
2556 | .attr( "aria-hidden", "true" ); | ||
2557 | |||
2558 | submenu | ||
2559 | .show() | ||
2560 | .removeAttr( "aria-hidden" ) | ||
2561 | .attr( "aria-expanded", "true" ) | ||
2562 | .position( position ); | ||
2563 | }, | ||
2564 | |||
2565 | collapseAll: function( event, all ) { | ||
2566 | clearTimeout( this.timer ); | ||
2567 | this.timer = this._delay(function() { | ||
2568 | // If we were passed an event, look for the submenu that contains the event | ||
2569 | var currentMenu = all ? this.element : | ||
2570 | $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); | ||
2571 | |||
2572 | // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway | ||
2573 | if ( !currentMenu.length ) { | ||
2574 | currentMenu = this.element; | ||
2575 | } | ||
2576 | |||
2577 | this._close( currentMenu ); | ||
2578 | |||
2579 | this.blur( event ); | ||
2580 | this.activeMenu = currentMenu; | ||
2581 | }, this.delay ); | ||
2582 | }, | ||
2583 | |||
2584 | // With no arguments, closes the currently active menu - if nothing is active | ||
2585 | // it closes all menus. If passed an argument, it will search for menus BELOW | ||
2586 | _close: function( startMenu ) { | ||
2587 | if ( !startMenu ) { | ||
2588 | startMenu = this.active ? this.active.parent() : this.element; | ||
2589 | } | ||
2590 | |||
2591 | startMenu | ||
2592 | .find( ".ui-menu" ) | ||
2593 | .hide() | ||
2594 | .attr( "aria-hidden", "true" ) | ||
2595 | .attr( "aria-expanded", "false" ) | ||
2596 | .end() | ||
2597 | .find( ".ui-state-active" ).not( ".ui-state-focus" ) | ||
2598 | .removeClass( "ui-state-active" ); | ||
2599 | }, | ||
2600 | |||
2601 | _closeOnDocumentClick: function( event ) { | ||
2602 | return !$( event.target ).closest( ".ui-menu" ).length; | ||
2603 | }, | ||
2604 | |||
2605 | _isDivider: function( item ) { | ||
2606 | |||
2607 | // Match hyphen, em dash, en dash | ||
2608 | return !/[^\-\u2014\u2013\s]/.test( item.text() ); | ||
2609 | }, | ||
2610 | |||
2611 | collapse: function( event ) { | ||
2612 | var newItem = this.active && | ||
2613 | this.active.parent().closest( ".ui-menu-item", this.element ); | ||
2614 | if ( newItem && newItem.length ) { | ||
2615 | this._close(); | ||
2616 | this.focus( event, newItem ); | ||
2617 | } | ||
2618 | }, | ||
2619 | |||
2620 | expand: function( event ) { | ||
2621 | var newItem = this.active && | ||
2622 | this.active | ||
2623 | .children( ".ui-menu " ) | ||
2624 | .find( this.options.items ) | ||
2625 | .first(); | ||
2626 | |||
2627 | if ( newItem && newItem.length ) { | ||
2628 | this._open( newItem.parent() ); | ||
2629 | |||
2630 | // Delay so Firefox will not hide activedescendant change in expanding submenu from AT | ||
2631 | this._delay(function() { | ||
2632 | this.focus( event, newItem ); | ||
2633 | }); | ||
2634 | } | ||
2635 | }, | ||
2636 | |||
2637 | next: function( event ) { | ||
2638 | this._move( "next", "first", event ); | ||
2639 | }, | ||
2640 | |||
2641 | previous: function( event ) { | ||
2642 | this._move( "prev", "last", event ); | ||
2643 | }, | ||
2644 | |||
2645 | isFirstItem: function() { | ||
2646 | return this.active && !this.active.prevAll( ".ui-menu-item" ).length; | ||
2647 | }, | ||
2648 | |||
2649 | isLastItem: function() { | ||
2650 | return this.active && !this.active.nextAll( ".ui-menu-item" ).length; | ||
2651 | }, | ||
2652 | |||
2653 | _move: function( direction, filter, event ) { | ||
2654 | var next; | ||
2655 | if ( this.active ) { | ||
2656 | if ( direction === "first" || direction === "last" ) { | ||
2657 | next = this.active | ||
2658 | [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) | ||
2659 | .eq( -1 ); | ||
2660 | } else { | ||
2661 | next = this.active | ||
2662 | [ direction + "All" ]( ".ui-menu-item" ) | ||
2663 | .eq( 0 ); | ||
2664 | } | ||
2665 | } | ||
2666 | if ( !next || !next.length || !this.active ) { | ||
2667 | next = this.activeMenu.find( this.options.items )[ filter ](); | ||
2668 | } | ||
2669 | |||
2670 | this.focus( event, next ); | ||
2671 | }, | ||
2672 | |||
2673 | nextPage: function( event ) { | ||
2674 | var item, base, height; | ||
2675 | |||
2676 | if ( !this.active ) { | ||
2677 | this.next( event ); | ||
2678 | return; | ||
2679 | } | ||
2680 | if ( this.isLastItem() ) { | ||
2681 | return; | ||
2682 | } | ||
2683 | if ( this._hasScroll() ) { | ||
2684 | base = this.active.offset().top; | ||
2685 | height = this.element.height(); | ||
2686 | this.active.nextAll( ".ui-menu-item" ).each(function() { | ||
2687 | item = $( this ); | ||
2688 | return item.offset().top - base - height < 0; | ||
2689 | }); | ||
2690 | |||
2691 | this.focus( event, item ); | ||
2692 | } else { | ||
2693 | this.focus( event, this.activeMenu.find( this.options.items ) | ||
2694 | [ !this.active ? "first" : "last" ]() ); | ||
2695 | } | ||
2696 | }, | ||
2697 | |||
2698 | previousPage: function( event ) { | ||
2699 | var item, base, height; | ||
2700 | if ( !this.active ) { | ||
2701 | this.next( event ); | ||
2702 | return; | ||
2703 | } | ||
2704 | if ( this.isFirstItem() ) { | ||
2705 | return; | ||
2706 | } | ||
2707 | if ( this._hasScroll() ) { | ||
2708 | base = this.active.offset().top; | ||
2709 | height = this.element.height(); | ||
2710 | this.active.prevAll( ".ui-menu-item" ).each(function() { | ||
2711 | item = $( this ); | ||
2712 | return item.offset().top - base + height > 0; | ||
2713 | }); | ||
2714 | |||
2715 | this.focus( event, item ); | ||
2716 | } else { | ||
2717 | this.focus( event, this.activeMenu.find( this.options.items ).first() ); | ||
2718 | } | ||
2719 | }, | ||
2720 | |||
2721 | _hasScroll: function() { | ||
2722 | return this.element.outerHeight() < this.element.prop( "scrollHeight" ); | ||
2723 | }, | ||
2724 | |||
2725 | select: function( event ) { | ||
2726 | // TODO: It should never be possible to not have an active item at this | ||
2727 | // point, but the tests don't trigger mouseenter before click. | ||
2728 | this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); | ||
2729 | var ui = { item: this.active }; | ||
2730 | if ( !this.active.has( ".ui-menu" ).length ) { | ||
2731 | this.collapseAll( event, true ); | ||
2732 | } | ||
2733 | this._trigger( "select", event, ui ); | ||
2734 | }, | ||
2735 | |||
2736 | _filterMenuItems: function(character) { | ||
2737 | var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), | ||
2738 | regex = new RegExp( "^" + escapedCharacter, "i" ); | ||
2739 | |||
2740 | return this.activeMenu | ||
2741 | .find( this.options.items ) | ||
2742 | |||
2743 | // Only match on items, not dividers or other content (#10571) | ||
2744 | .filter( ".ui-menu-item" ) | ||
2745 | .filter(function() { | ||
2746 | return regex.test( $.trim( $( this ).text() ) ); | ||
2747 | }); | ||
2748 | } | ||
2749 | }); | ||
2750 | |||
2751 | |||
2752 | /*! | ||
2753 | * jQuery UI Autocomplete 1.11.2 | ||
2754 | * http://jqueryui.com | ||
2755 | * | ||
2756 | * Copyright 2014 jQuery Foundation and other contributors | ||
2757 | * Released under the MIT license. | ||
2758 | * http://jquery.org/license | ||
2759 | * | ||
2760 | * http://api.jqueryui.com/autocomplete/ | ||
2761 | */ | ||
2762 | |||
2763 | |||
2764 | $.widget( "ui.autocomplete", { | ||
2765 | version: "1.11.2", | ||
2766 | defaultElement: "<input>", | ||
2767 | options: { | ||
2768 | appendTo: null, | ||
2769 | autoFocus: false, | ||
2770 | delay: 300, | ||
2771 | minLength: 1, | ||
2772 | position: { | ||
2773 | my: "left top", | ||
2774 | at: "left bottom", | ||
2775 | collision: "none" | ||
2776 | }, | ||
2777 | source: null, | ||
2778 | |||
2779 | // callbacks | ||
2780 | change: null, | ||
2781 | close: null, | ||
2782 | focus: null, | ||
2783 | open: null, | ||
2784 | response: null, | ||
2785 | search: null, | ||
2786 | select: null | ||
2787 | }, | ||
2788 | |||
2789 | requestIndex: 0, | ||
2790 | pending: 0, | ||
2791 | |||
2792 | _create: function() { | ||
2793 | // Some browsers only repeat keydown events, not keypress events, | ||
2794 | // so we use the suppressKeyPress flag to determine if we've already | ||
2795 | // handled the keydown event. #7269 | ||
2796 | // Unfortunately the code for & in keypress is the same as the up arrow, | ||
2797 | // so we use the suppressKeyPressRepeat flag to avoid handling keypress | ||
2798 | // events when we know the keydown event was used to modify the | ||
2799 | // search term. #7799 | ||
2800 | var suppressKeyPress, suppressKeyPressRepeat, suppressInput, | ||
2801 | nodeName = this.element[ 0 ].nodeName.toLowerCase(), | ||
2802 | isTextarea = nodeName === "textarea", | ||
2803 | isInput = nodeName === "input"; | ||
2804 | |||
2805 | this.isMultiLine = | ||
2806 | // Textareas are always multi-line | ||
2807 | isTextarea ? true : | ||
2808 | // Inputs are always single-line, even if inside a contentEditable element | ||
2809 | // IE also treats inputs as contentEditable | ||
2810 | isInput ? false : | ||
2811 | // All other element types are determined by whether or not they're contentEditable | ||
2812 | this.element.prop( "isContentEditable" ); | ||
2813 | |||
2814 | this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; | ||
2815 | this.isNewMenu = true; | ||
2816 | |||
2817 | this.element | ||
2818 | .addClass( "ui-autocomplete-input" ) | ||
2819 | .attr( "autocomplete", "off" ); | ||
2820 | |||
2821 | this._on( this.element, { | ||
2822 | keydown: function( event ) { | ||
2823 | if ( this.element.prop( "readOnly" ) ) { | ||
2824 | suppressKeyPress = true; | ||
2825 | suppressInput = true; | ||
2826 | suppressKeyPressRepeat = true; | ||
2827 | return; | ||
2828 | } | ||
2829 | |||
2830 | suppressKeyPress = false; | ||
2831 | suppressInput = false; | ||
2832 | suppressKeyPressRepeat = false; | ||
2833 | var keyCode = $.ui.keyCode; | ||
2834 | switch ( event.keyCode ) { | ||
2835 | case keyCode.PAGE_UP: | ||
2836 | suppressKeyPress = true; | ||
2837 | this._move( "previousPage", event ); | ||
2838 | break; | ||
2839 | case keyCode.PAGE_DOWN: | ||
2840 | suppressKeyPress = true; | ||
2841 | this._move( "nextPage", event ); | ||
2842 | break; | ||
2843 | case keyCode.UP: | ||
2844 | suppressKeyPress = true; | ||
2845 | this._keyEvent( "previous", event ); | ||
2846 | break; | ||
2847 | case keyCode.DOWN: | ||
2848 | suppressKeyPress = true; | ||
2849 | this._keyEvent( "next", event ); | ||
2850 | break; | ||
2851 | case keyCode.ENTER: | ||
2852 | // when menu is open and has focus | ||
2853 | if ( this.menu.active ) { | ||
2854 | // #6055 - Opera still allows the keypress to occur | ||
2855 | // which causes forms to submit | ||
2856 | suppressKeyPress = true; | ||
2857 | event.preventDefault(); | ||
2858 | this.menu.select( event ); | ||
2859 | } | ||
2860 | break; | ||
2861 | case keyCode.TAB: | ||
2862 | if ( this.menu.active ) { | ||
2863 | this.menu.select( event ); | ||
2864 | } | ||
2865 | break; | ||
2866 | case keyCode.ESCAPE: | ||
2867 | if ( this.menu.element.is( ":visible" ) ) { | ||
2868 | if ( !this.isMultiLine ) { | ||
2869 | this._value( this.term ); | ||
2870 | } | ||
2871 | this.close( event ); | ||
2872 | // Different browsers have different default behavior for escape | ||
2873 | // Single press can mean undo or clear | ||
2874 | // Double press in IE means clear the whole form | ||
2875 | event.preventDefault(); | ||
2876 | } | ||
2877 | break; | ||
2878 | default: | ||
2879 | suppressKeyPressRepeat = true; | ||
2880 | // search timeout should be triggered before the input value is changed | ||
2881 | this._searchTimeout( event ); | ||
2882 | break; | ||
2883 | } | ||
2884 | }, | ||
2885 | keypress: function( event ) { | ||
2886 | if ( suppressKeyPress ) { | ||
2887 | suppressKeyPress = false; | ||
2888 | if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { | ||
2889 | event.preventDefault(); | ||
2890 | } | ||
2891 | return; | ||
2892 | } | ||
2893 | if ( suppressKeyPressRepeat ) { | ||
2894 | return; | ||
2895 | } | ||
2896 | |||
2897 | // replicate some key handlers to allow them to repeat in Firefox and Opera | ||
2898 | var keyCode = $.ui.keyCode; | ||
2899 | switch ( event.keyCode ) { | ||
2900 | case keyCode.PAGE_UP: | ||
2901 | this._move( "previousPage", event ); | ||
2902 | break; | ||
2903 | case keyCode.PAGE_DOWN: | ||
2904 | this._move( "nextPage", event ); | ||
2905 | break; | ||
2906 | case keyCode.UP: | ||
2907 | this._keyEvent( "previous", event ); | ||
2908 | break; | ||
2909 | case keyCode.DOWN: | ||
2910 | this._keyEvent( "next", event ); | ||
2911 | break; | ||
2912 | } | ||
2913 | }, | ||
2914 | input: function( event ) { | ||
2915 | if ( suppressInput ) { | ||
2916 | suppressInput = false; | ||
2917 | event.preventDefault(); | ||
2918 | return; | ||
2919 | } | ||
2920 | this._searchTimeout( event ); | ||
2921 | }, | ||
2922 | focus: function() { | ||
2923 | this.selectedItem = null; | ||
2924 | this.previous = this._value(); | ||
2925 | }, | ||
2926 | blur: function( event ) { | ||
2927 | if ( this.cancelBlur ) { | ||
2928 | delete this.cancelBlur; | ||
2929 | return; | ||
2930 | } | ||
2931 | |||
2932 | clearTimeout( this.searching ); | ||
2933 | this.close( event ); | ||
2934 | this._change( event ); | ||
2935 | } | ||
2936 | }); | ||
2937 | |||
2938 | this._initSource(); | ||
2939 | this.menu = $( "<ul>" ) | ||
2940 | .addClass( "ui-autocomplete ui-front" ) | ||
2941 | .appendTo( this._appendTo() ) | ||
2942 | .menu({ | ||
2943 | // disable ARIA support, the live region takes care of that | ||
2944 | role: null | ||
2945 | }) | ||
2946 | .hide() | ||
2947 | .menu( "instance" ); | ||
2948 | |||
2949 | this._on( this.menu.element, { | ||
2950 | mousedown: function( event ) { | ||
2951 | // prevent moving focus out of the text field | ||
2952 | event.preventDefault(); | ||
2953 | |||
2954 | // IE doesn't prevent moving focus even with event.preventDefault() | ||
2955 | // so we set a flag to know when we should ignore the blur event | ||
2956 | this.cancelBlur = true; | ||
2957 | this._delay(function() { | ||
2958 | delete this.cancelBlur; | ||
2959 | }); | ||
2960 | |||
2961 | // clicking on the scrollbar causes focus to shift to the body | ||
2962 | // but we can't detect a mouseup or a click immediately afterward | ||
2963 | // so we have to track the next mousedown and close the menu if | ||
2964 | // the user clicks somewhere outside of the autocomplete | ||
2965 | var menuElement = this.menu.element[ 0 ]; | ||
2966 | if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { | ||
2967 | this._delay(function() { | ||
2968 | var that = this; | ||
2969 | this.document.one( "mousedown", function( event ) { | ||
2970 | if ( event.target !== that.element[ 0 ] && | ||
2971 | event.target !== menuElement && | ||
2972 | !$.contains( menuElement, event.target ) ) { | ||
2973 | that.close(); | ||
2974 | } | ||
2975 | }); | ||
2976 | }); | ||
2977 | } | ||
2978 | }, | ||
2979 | menufocus: function( event, ui ) { | ||
2980 | var label, item; | ||
2981 | // support: Firefox | ||
2982 | // Prevent accidental activation of menu items in Firefox (#7024 #9118) | ||
2983 | if ( this.isNewMenu ) { | ||
2984 | this.isNewMenu = false; | ||
2985 | if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { | ||
2986 | this.menu.blur(); | ||
2987 | |||
2988 | this.document.one( "mousemove", function() { | ||
2989 | $( event.target ).trigger( event.originalEvent ); | ||
2990 | }); | ||
2991 | |||
2992 | return; | ||
2993 | } | ||
2994 | } | ||
2995 | |||
2996 | item = ui.item.data( "ui-autocomplete-item" ); | ||
2997 | if ( false !== this._trigger( "focus", event, { item: item } ) ) { | ||
2998 | // use value to match what will end up in the input, if it was a key event | ||
2999 | if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { | ||
3000 | this._value( item.value ); | ||
3001 | } | ||
3002 | } | ||
3003 | |||
3004 | // Announce the value in the liveRegion | ||
3005 | label = ui.item.attr( "aria-label" ) || item.value; | ||
3006 | if ( label && $.trim( label ).length ) { | ||
3007 | this.liveRegion.children().hide(); | ||
3008 | $( "<div>" ).text( label ).appendTo( this.liveRegion ); | ||
3009 | } | ||
3010 | }, | ||
3011 | menuselect: function( event, ui ) { | ||
3012 | var item = ui.item.data( "ui-autocomplete-item" ), | ||
3013 | previous = this.previous; | ||
3014 | |||
3015 | // only trigger when focus was lost (click on menu) | ||
3016 | if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { | ||
3017 | this.element.focus(); | ||
3018 | this.previous = previous; | ||
3019 | // #6109 - IE triggers two focus events and the second | ||
3020 | // is asynchronous, so we need to reset the previous | ||
3021 | // term synchronously and asynchronously :-( | ||
3022 | this._delay(function() { | ||
3023 | this.previous = previous; | ||
3024 | this.selectedItem = item; | ||
3025 | }); | ||
3026 | } | ||
3027 | |||
3028 | if ( false !== this._trigger( "select", event, { item: item } ) ) { | ||
3029 | this._value( item.value ); | ||
3030 | } | ||
3031 | // reset the term after the select event | ||
3032 | // this allows custom select handling to work properly | ||
3033 | this.term = this._value(); | ||
3034 | |||
3035 | this.close( event ); | ||
3036 | this.selectedItem = item; | ||
3037 | } | ||
3038 | }); | ||
3039 | |||
3040 | this.liveRegion = $( "<span>", { | ||
3041 | role: "status", | ||
3042 | "aria-live": "assertive", | ||
3043 | "aria-relevant": "additions" | ||
3044 | }) | ||
3045 | .addClass( "ui-helper-hidden-accessible" ) | ||
3046 | .appendTo( this.document[ 0 ].body ); | ||
3047 | |||
3048 | // turning off autocomplete prevents the browser from remembering the | ||
3049 | // value when navigating through history, so we re-enable autocomplete | ||
3050 | // if the page is unloaded before the widget is destroyed. #7790 | ||
3051 | this._on( this.window, { | ||
3052 | beforeunload: function() { | ||
3053 | this.element.removeAttr( "autocomplete" ); | ||
3054 | } | ||
3055 | }); | ||
3056 | }, | ||
3057 | |||
3058 | _destroy: function() { | ||
3059 | clearTimeout( this.searching ); | ||
3060 | this.element | ||
3061 | .removeClass( "ui-autocomplete-input" ) | ||
3062 | .removeAttr( "autocomplete" ); | ||
3063 | this.menu.element.remove(); | ||
3064 | this.liveRegion.remove(); | ||
3065 | }, | ||
3066 | |||
3067 | _setOption: function( key, value ) { | ||
3068 | this._super( key, value ); | ||
3069 | if ( key === "source" ) { | ||
3070 | this._initSource(); | ||
3071 | } | ||
3072 | if ( key === "appendTo" ) { | ||
3073 | this.menu.element.appendTo( this._appendTo() ); | ||
3074 | } | ||
3075 | if ( key === "disabled" && value && this.xhr ) { | ||
3076 | this.xhr.abort(); | ||
3077 | } | ||
3078 | }, | ||
3079 | |||
3080 | _appendTo: function() { | ||
3081 | var element = this.options.appendTo; | ||
3082 | |||
3083 | if ( element ) { | ||
3084 | element = element.jquery || element.nodeType ? | ||
3085 | $( element ) : | ||
3086 | this.document.find( element ).eq( 0 ); | ||
3087 | } | ||
3088 | |||
3089 | if ( !element || !element[ 0 ] ) { | ||
3090 | element = this.element.closest( ".ui-front" ); | ||
3091 | } | ||
3092 | |||
3093 | if ( !element.length ) { | ||
3094 | element = this.document[ 0 ].body; | ||
3095 | } | ||
3096 | |||
3097 | return element; | ||
3098 | }, | ||
3099 | |||
3100 | _initSource: function() { | ||
3101 | var array, url, | ||
3102 | that = this; | ||
3103 | if ( $.isArray( this.options.source ) ) { | ||
3104 | array = this.options.source; | ||
3105 | this.source = function( request, response ) { | ||
3106 | response( $.ui.autocomplete.filter( array, request.term ) ); | ||
3107 | }; | ||
3108 | } else if ( typeof this.options.source === "string" ) { | ||
3109 | url = this.options.source; | ||
3110 | this.source = function( request, response ) { | ||
3111 | if ( that.xhr ) { | ||
3112 | that.xhr.abort(); | ||
3113 | } | ||
3114 | that.xhr = $.ajax({ | ||
3115 | url: url, | ||
3116 | data: request, | ||
3117 | dataType: "json", | ||
3118 | success: function( data ) { | ||
3119 | response( data ); | ||
3120 | }, | ||
3121 | error: function() { | ||
3122 | response([]); | ||
3123 | } | ||
3124 | }); | ||
3125 | }; | ||
3126 | } else { | ||
3127 | this.source = this.options.source; | ||
3128 | } | ||
3129 | }, | ||
3130 | |||
3131 | _searchTimeout: function( event ) { | ||
3132 | clearTimeout( this.searching ); | ||
3133 | this.searching = this._delay(function() { | ||
3134 | |||
3135 | // Search if the value has changed, or if the user retypes the same value (see #7434) | ||
3136 | var equalValues = this.term === this._value(), | ||
3137 | menuVisible = this.menu.element.is( ":visible" ), | ||
3138 | modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; | ||
3139 | |||
3140 | if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { | ||
3141 | this.selectedItem = null; | ||
3142 | this.search( null, event ); | ||
3143 | } | ||
3144 | }, this.options.delay ); | ||
3145 | }, | ||
3146 | |||
3147 | search: function( value, event ) { | ||
3148 | value = value != null ? value : this._value(); | ||
3149 | |||
3150 | // always save the actual value, not the one passed as an argument | ||
3151 | this.term = this._value(); | ||
3152 | |||
3153 | if ( value.length < this.options.minLength ) { | ||
3154 | return this.close( event ); | ||
3155 | } | ||
3156 | |||
3157 | if ( this._trigger( "search", event ) === false ) { | ||
3158 | return; | ||
3159 | } | ||
3160 | |||
3161 | return this._search( value ); | ||
3162 | }, | ||
3163 | |||
3164 | _search: function( value ) { | ||
3165 | this.pending++; | ||
3166 | this.element.addClass( "ui-autocomplete-loading" ); | ||
3167 | this.cancelSearch = false; | ||
3168 | |||
3169 | this.source( { term: value }, this._response() ); | ||
3170 | }, | ||
3171 | |||
3172 | _response: function() { | ||
3173 | var index = ++this.requestIndex; | ||
3174 | |||
3175 | return $.proxy(function( content ) { | ||
3176 | if ( index === this.requestIndex ) { | ||
3177 | this.__response( content ); | ||
3178 | } | ||
3179 | |||
3180 | this.pending--; | ||
3181 | if ( !this.pending ) { | ||
3182 | this.element.removeClass( "ui-autocomplete-loading" ); | ||
3183 | } | ||
3184 | }, this ); | ||
3185 | }, | ||
3186 | |||
3187 | __response: function( content ) { | ||
3188 | if ( content ) { | ||
3189 | content = this._normalize( content ); | ||
3190 | } | ||
3191 | this._trigger( "response", null, { content: content } ); | ||
3192 | if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { | ||
3193 | this._suggest( content ); | ||
3194 | this._trigger( "open" ); | ||
3195 | } else { | ||
3196 | // use ._close() instead of .close() so we don't cancel future searches | ||
3197 | this._close(); | ||
3198 | } | ||
3199 | }, | ||
3200 | |||
3201 | close: function( event ) { | ||
3202 | this.cancelSearch = true; | ||
3203 | this._close( event ); | ||
3204 | }, | ||
3205 | |||
3206 | _close: function( event ) { | ||
3207 | if ( this.menu.element.is( ":visible" ) ) { | ||
3208 | this.menu.element.hide(); | ||
3209 | this.menu.blur(); | ||
3210 | this.isNewMenu = true; | ||
3211 | this._trigger( "close", event ); | ||
3212 | } | ||
3213 | }, | ||
3214 | |||
3215 | _change: function( event ) { | ||
3216 | if ( this.previous !== this._value() ) { | ||
3217 | this._trigger( "change", event, { item: this.selectedItem } ); | ||
3218 | } | ||
3219 | }, | ||
3220 | |||
3221 | _normalize: function( items ) { | ||
3222 | // assume all items have the right format when the first item is complete | ||
3223 | if ( items.length && items[ 0 ].label && items[ 0 ].value ) { | ||
3224 | return items; | ||
3225 | } | ||
3226 | return $.map( items, function( item ) { | ||
3227 | if ( typeof item === "string" ) { | ||
3228 | return { | ||
3229 | label: item, | ||
3230 | value: item | ||
3231 | }; | ||
3232 | } | ||
3233 | return $.extend( {}, item, { | ||
3234 | label: item.label || item.value, | ||
3235 | value: item.value || item.label | ||
3236 | }); | ||
3237 | }); | ||
3238 | }, | ||
3239 | |||
3240 | _suggest: function( items ) { | ||
3241 | var ul = this.menu.element.empty(); | ||
3242 | this._renderMenu( ul, items ); | ||
3243 | this.isNewMenu = true; | ||
3244 | this.menu.refresh(); | ||
3245 | |||
3246 | // size and position menu | ||
3247 | ul.show(); | ||
3248 | this._resizeMenu(); | ||
3249 | ul.position( $.extend({ | ||
3250 | of: this.element | ||
3251 | }, this.options.position ) ); | ||
3252 | |||
3253 | if ( this.options.autoFocus ) { | ||
3254 | this.menu.next(); | ||
3255 | } | ||
3256 | }, | ||
3257 | |||
3258 | _resizeMenu: function() { | ||
3259 | var ul = this.menu.element; | ||
3260 | ul.outerWidth( Math.max( | ||
3261 | // Firefox wraps long text (possibly a rounding bug) | ||
3262 | // so we add 1px to avoid the wrapping (#7513) | ||
3263 | ul.width( "" ).outerWidth() + 1, | ||
3264 | this.element.outerWidth() | ||
3265 | ) ); | ||
3266 | }, | ||
3267 | |||
3268 | _renderMenu: function( ul, items ) { | ||
3269 | var that = this; | ||
3270 | $.each( items, function( index, item ) { | ||
3271 | that._renderItemData( ul, item ); | ||
3272 | }); | ||
3273 | }, | ||
3274 | |||
3275 | _renderItemData: function( ul, item ) { | ||
3276 | return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); | ||
3277 | }, | ||
3278 | |||
3279 | _renderItem: function( ul, item ) { | ||
3280 | return $( "<li>" ).text( item.label ).appendTo( ul ); | ||
3281 | }, | ||
3282 | |||
3283 | _move: function( direction, event ) { | ||
3284 | if ( !this.menu.element.is( ":visible" ) ) { | ||
3285 | this.search( null, event ); | ||
3286 | return; | ||
3287 | } | ||
3288 | if ( this.menu.isFirstItem() && /^previous/.test( direction ) || | ||
3289 | this.menu.isLastItem() && /^next/.test( direction ) ) { | ||
3290 | |||
3291 | if ( !this.isMultiLine ) { | ||
3292 | this._value( this.term ); | ||
3293 | } | ||
3294 | |||
3295 | this.menu.blur(); | ||
3296 | return; | ||
3297 | } | ||
3298 | this.menu[ direction ]( event ); | ||
3299 | }, | ||
3300 | |||
3301 | widget: function() { | ||
3302 | return this.menu.element; | ||
3303 | }, | ||
3304 | |||
3305 | _value: function() { | ||
3306 | return this.valueMethod.apply( this.element, arguments ); | ||
3307 | }, | ||
3308 | |||
3309 | _keyEvent: function( keyEvent, event ) { | ||
3310 | if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { | ||
3311 | this._move( keyEvent, event ); | ||
3312 | |||
3313 | // prevents moving cursor to beginning/end of the text field in some browsers | ||
3314 | event.preventDefault(); | ||
3315 | } | ||
3316 | } | ||
3317 | }); | ||
3318 | |||
3319 | $.extend( $.ui.autocomplete, { | ||
3320 | escapeRegex: function( value ) { | ||
3321 | return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); | ||
3322 | }, | ||
3323 | filter: function( array, term ) { | ||
3324 | var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); | ||
3325 | return $.grep( array, function( value ) { | ||
3326 | return matcher.test( value.label || value.value || value ); | ||
3327 | }); | ||
3328 | } | ||
3329 | }); | ||
3330 | |||
3331 | // live region extension, adding a `messages` option | ||
3332 | // NOTE: This is an experimental API. We are still investigating | ||
3333 | // a full solution for string manipulation and internationalization. | ||
3334 | $.widget( "ui.autocomplete", $.ui.autocomplete, { | ||
3335 | options: { | ||
3336 | messages: { | ||
3337 | noResults: "No search results.", | ||
3338 | results: function( amount ) { | ||
3339 | return amount + ( amount > 1 ? " results are" : " result is" ) + | ||
3340 | " available, use up and down arrow keys to navigate."; | ||
3341 | } | ||
3342 | } | ||
3343 | }, | ||
3344 | |||
3345 | __response: function( content ) { | ||
3346 | var message; | ||
3347 | this._superApply( arguments ); | ||
3348 | if ( this.options.disabled || this.cancelSearch ) { | ||
3349 | return; | ||
3350 | } | ||
3351 | if ( content && content.length ) { | ||
3352 | message = this.options.messages.results( content.length ); | ||
3353 | } else { | ||
3354 | message = this.options.messages.noResults; | ||
3355 | } | ||
3356 | this.liveRegion.children().hide(); | ||
3357 | $( "<div>" ).text( message ).appendTo( this.liveRegion ); | ||
3358 | } | ||
3359 | }); | ||
3360 | |||
3361 | var autocomplete = $.ui.autocomplete; | ||
3362 | |||
3363 | |||
3364 | /*! | ||
3365 | * jQuery UI Button 1.11.2 | ||
3366 | * http://jqueryui.com | ||
3367 | * | ||
3368 | * Copyright 2014 jQuery Foundation and other contributors | ||
3369 | * Released under the MIT license. | ||
3370 | * http://jquery.org/license | ||
3371 | * | ||
3372 | * http://api.jqueryui.com/button/ | ||
3373 | */ | ||
3374 | |||
3375 | |||
3376 | var lastActive, | ||
3377 | baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", | ||
3378 | typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", | ||
3379 | formResetHandler = function() { | ||
3380 | var form = $( this ); | ||
3381 | setTimeout(function() { | ||
3382 | form.find( ":ui-button" ).button( "refresh" ); | ||
3383 | }, 1 ); | ||
3384 | }, | ||
3385 | radioGroup = function( radio ) { | ||
3386 | var name = radio.name, | ||
3387 | form = radio.form, | ||
3388 | radios = $( [] ); | ||
3389 | if ( name ) { | ||
3390 | name = name.replace( /'/g, "\\'" ); | ||
3391 | if ( form ) { | ||
3392 | radios = $( form ).find( "[name='" + name + "'][type=radio]" ); | ||
3393 | } else { | ||
3394 | radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument ) | ||
3395 | .filter(function() { | ||
3396 | return !this.form; | ||
3397 | }); | ||
3398 | } | ||
3399 | } | ||
3400 | return radios; | ||
3401 | }; | ||
3402 | |||
3403 | $.widget( "ui.button", { | ||
3404 | version: "1.11.2", | ||
3405 | defaultElement: "<button>", | ||
3406 | options: { | ||
3407 | disabled: null, | ||
3408 | text: true, | ||
3409 | label: null, | ||
3410 | icons: { | ||
3411 | primary: null, | ||
3412 | secondary: null | ||
3413 | } | ||
3414 | }, | ||
3415 | _create: function() { | ||
3416 | this.element.closest( "form" ) | ||
3417 | .unbind( "reset" + this.eventNamespace ) | ||
3418 | .bind( "reset" + this.eventNamespace, formResetHandler ); | ||
3419 | |||
3420 | if ( typeof this.options.disabled !== "boolean" ) { | ||
3421 | this.options.disabled = !!this.element.prop( "disabled" ); | ||
3422 | } else { | ||
3423 | this.element.prop( "disabled", this.options.disabled ); | ||
3424 | } | ||
3425 | |||
3426 | this._determineButtonType(); | ||
3427 | this.hasTitle = !!this.buttonElement.attr( "title" ); | ||
3428 | |||
3429 | var that = this, | ||
3430 | options = this.options, | ||
3431 | toggleButton = this.type === "checkbox" || this.type === "radio", | ||
3432 | activeClass = !toggleButton ? "ui-state-active" : ""; | ||
3433 | |||
3434 | if ( options.label === null ) { | ||
3435 | options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); | ||
3436 | } | ||
3437 | |||
3438 | this._hoverable( this.buttonElement ); | ||
3439 | |||
3440 | this.buttonElement | ||
3441 | .addClass( baseClasses ) | ||
3442 | .attr( "role", "button" ) | ||
3443 | .bind( "mouseenter" + this.eventNamespace, function() { | ||
3444 | if ( options.disabled ) { | ||
3445 | return; | ||
3446 | } | ||
3447 | if ( this === lastActive ) { | ||
3448 | $( this ).addClass( "ui-state-active" ); | ||
3449 | } | ||
3450 | }) | ||
3451 | .bind( "mouseleave" + this.eventNamespace, function() { | ||
3452 | if ( options.disabled ) { | ||
3453 | return; | ||
3454 | } | ||
3455 | $( this ).removeClass( activeClass ); | ||
3456 | }) | ||
3457 | .bind( "click" + this.eventNamespace, function( event ) { | ||
3458 | if ( options.disabled ) { | ||
3459 | event.preventDefault(); | ||
3460 | event.stopImmediatePropagation(); | ||
3461 | } | ||
3462 | }); | ||
3463 | |||
3464 | // Can't use _focusable() because the element that receives focus | ||
3465 | // and the element that gets the ui-state-focus class are different | ||
3466 | this._on({ | ||
3467 | focus: function() { | ||
3468 | this.buttonElement.addClass( "ui-state-focus" ); | ||
3469 | }, | ||
3470 | blur: function() { | ||
3471 | this.buttonElement.removeClass( "ui-state-focus" ); | ||
3472 | } | ||
3473 | }); | ||
3474 | |||
3475 | if ( toggleButton ) { | ||
3476 | this.element.bind( "change" + this.eventNamespace, function() { | ||
3477 | that.refresh(); | ||
3478 | }); | ||
3479 | } | ||
3480 | |||
3481 | if ( this.type === "checkbox" ) { | ||
3482 | this.buttonElement.bind( "click" + this.eventNamespace, function() { | ||
3483 | if ( options.disabled ) { | ||
3484 | return false; | ||
3485 | } | ||
3486 | }); | ||
3487 | } else if ( this.type === "radio" ) { | ||
3488 | this.buttonElement.bind( "click" + this.eventNamespace, function() { | ||
3489 | if ( options.disabled ) { | ||
3490 | return false; | ||
3491 | } | ||
3492 | $( this ).addClass( "ui-state-active" ); | ||
3493 | that.buttonElement.attr( "aria-pressed", "true" ); | ||
3494 | |||
3495 | var radio = that.element[ 0 ]; | ||
3496 | radioGroup( radio ) | ||
3497 | .not( radio ) | ||
3498 | .map(function() { | ||
3499 | return $( this ).button( "widget" )[ 0 ]; | ||
3500 | }) | ||
3501 | .removeClass( "ui-state-active" ) | ||
3502 | .attr( "aria-pressed", "false" ); | ||
3503 | }); | ||
3504 | } else { | ||
3505 | this.buttonElement | ||
3506 | .bind( "mousedown" + this.eventNamespace, function() { | ||
3507 | if ( options.disabled ) { | ||
3508 | return false; | ||
3509 | } | ||
3510 | $( this ).addClass( "ui-state-active" ); | ||
3511 | lastActive = this; | ||
3512 | that.document.one( "mouseup", function() { | ||
3513 | lastActive = null; | ||
3514 | }); | ||
3515 | }) | ||
3516 | .bind( "mouseup" + this.eventNamespace, function() { | ||
3517 | if ( options.disabled ) { | ||
3518 | return false; | ||
3519 | } | ||
3520 | $( this ).removeClass( "ui-state-active" ); | ||
3521 | }) | ||
3522 | .bind( "keydown" + this.eventNamespace, function(event) { | ||
3523 | if ( options.disabled ) { | ||
3524 | return false; | ||
3525 | } | ||
3526 | if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) { | ||
3527 | $( this ).addClass( "ui-state-active" ); | ||
3528 | } | ||
3529 | }) | ||
3530 | // see #8559, we bind to blur here in case the button element loses | ||
3531 | // focus between keydown and keyup, it would be left in an "active" state | ||
3532 | .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() { | ||
3533 | $( this ).removeClass( "ui-state-active" ); | ||
3534 | }); | ||
3535 | |||
3536 | if ( this.buttonElement.is("a") ) { | ||
3537 | this.buttonElement.keyup(function(event) { | ||
3538 | if ( event.keyCode === $.ui.keyCode.SPACE ) { | ||
3539 | // TODO pass through original event correctly (just as 2nd argument doesn't work) | ||
3540 | $( this ).click(); | ||
3541 | } | ||
3542 | }); | ||
3543 | } | ||
3544 | } | ||
3545 | |||
3546 | this._setOption( "disabled", options.disabled ); | ||
3547 | this._resetButton(); | ||
3548 | }, | ||
3549 | |||
3550 | _determineButtonType: function() { | ||
3551 | var ancestor, labelSelector, checked; | ||
3552 | |||
3553 | if ( this.element.is("[type=checkbox]") ) { | ||
3554 | this.type = "checkbox"; | ||
3555 | } else if ( this.element.is("[type=radio]") ) { | ||
3556 | this.type = "radio"; | ||
3557 | } else if ( this.element.is("input") ) { | ||
3558 | this.type = "input"; | ||
3559 | } else { | ||
3560 | this.type = "button"; | ||
3561 | } | ||
3562 | |||
3563 | if ( this.type === "checkbox" || this.type === "radio" ) { | ||
3564 | // we don't search against the document in case the element | ||
3565 | // is disconnected from the DOM | ||
3566 | ancestor = this.element.parents().last(); | ||
3567 | labelSelector = "label[for='" + this.element.attr("id") + "']"; | ||
3568 | this.buttonElement = ancestor.find( labelSelector ); | ||
3569 | if ( !this.buttonElement.length ) { | ||
3570 | ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); | ||
3571 | this.buttonElement = ancestor.filter( labelSelector ); | ||
3572 | if ( !this.buttonElement.length ) { | ||
3573 | this.buttonElement = ancestor.find( labelSelector ); | ||
3574 | } | ||
3575 | } | ||
3576 | this.element.addClass( "ui-helper-hidden-accessible" ); | ||
3577 | |||
3578 | checked = this.element.is( ":checked" ); | ||
3579 | if ( checked ) { | ||
3580 | this.buttonElement.addClass( "ui-state-active" ); | ||
3581 | } | ||
3582 | this.buttonElement.prop( "aria-pressed", checked ); | ||
3583 | } else { | ||
3584 | this.buttonElement = this.element; | ||
3585 | } | ||
3586 | }, | ||
3587 | |||
3588 | widget: function() { | ||
3589 | return this.buttonElement; | ||
3590 | }, | ||
3591 | |||
3592 | _destroy: function() { | ||
3593 | this.element | ||
3594 | .removeClass( "ui-helper-hidden-accessible" ); | ||
3595 | this.buttonElement | ||
3596 | .removeClass( baseClasses + " ui-state-active " + typeClasses ) | ||
3597 | .removeAttr( "role" ) | ||
3598 | .removeAttr( "aria-pressed" ) | ||
3599 | .html( this.buttonElement.find(".ui-button-text").html() ); | ||
3600 | |||
3601 | if ( !this.hasTitle ) { | ||
3602 | this.buttonElement.removeAttr( "title" ); | ||
3603 | } | ||
3604 | }, | ||
3605 | |||
3606 | _setOption: function( key, value ) { | ||
3607 | this._super( key, value ); | ||
3608 | if ( key === "disabled" ) { | ||
3609 | this.widget().toggleClass( "ui-state-disabled", !!value ); | ||
3610 | this.element.prop( "disabled", !!value ); | ||
3611 | if ( value ) { | ||
3612 | if ( this.type === "checkbox" || this.type === "radio" ) { | ||
3613 | this.buttonElement.removeClass( "ui-state-focus" ); | ||
3614 | } else { | ||
3615 | this.buttonElement.removeClass( "ui-state-focus ui-state-active" ); | ||
3616 | } | ||
3617 | } | ||
3618 | return; | ||
3619 | } | ||
3620 | this._resetButton(); | ||
3621 | }, | ||
3622 | |||
3623 | refresh: function() { | ||
3624 | //See #8237 & #8828 | ||
3625 | var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" ); | ||
3626 | |||
3627 | if ( isDisabled !== this.options.disabled ) { | ||
3628 | this._setOption( "disabled", isDisabled ); | ||
3629 | } | ||
3630 | if ( this.type === "radio" ) { | ||
3631 | radioGroup( this.element[0] ).each(function() { | ||
3632 | if ( $( this ).is( ":checked" ) ) { | ||
3633 | $( this ).button( "widget" ) | ||
3634 | .addClass( "ui-state-active" ) | ||
3635 | .attr( "aria-pressed", "true" ); | ||
3636 | } else { | ||
3637 | $( this ).button( "widget" ) | ||
3638 | .removeClass( "ui-state-active" ) | ||
3639 | .attr( "aria-pressed", "false" ); | ||
3640 | } | ||
3641 | }); | ||
3642 | } else if ( this.type === "checkbox" ) { | ||
3643 | if ( this.element.is( ":checked" ) ) { | ||
3644 | this.buttonElement | ||
3645 | .addClass( "ui-state-active" ) | ||
3646 | .attr( "aria-pressed", "true" ); | ||
3647 | } else { | ||
3648 | this.buttonElement | ||
3649 | .removeClass( "ui-state-active" ) | ||
3650 | .attr( "aria-pressed", "false" ); | ||
3651 | } | ||
3652 | } | ||
3653 | }, | ||
3654 | |||
3655 | _resetButton: function() { | ||
3656 | if ( this.type === "input" ) { | ||
3657 | if ( this.options.label ) { | ||
3658 | this.element.val( this.options.label ); | ||
3659 | } | ||
3660 | return; | ||
3661 | } | ||
3662 | var buttonElement = this.buttonElement.removeClass( typeClasses ), | ||
3663 | buttonText = $( "<span></span>", this.document[0] ) | ||
3664 | .addClass( "ui-button-text" ) | ||
3665 | .html( this.options.label ) | ||
3666 | .appendTo( buttonElement.empty() ) | ||
3667 | .text(), | ||
3668 | icons = this.options.icons, | ||
3669 | multipleIcons = icons.primary && icons.secondary, | ||
3670 | buttonClasses = []; | ||
3671 | |||
3672 | if ( icons.primary || icons.secondary ) { | ||
3673 | if ( this.options.text ) { | ||
3674 | buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); | ||
3675 | } | ||
3676 | |||
3677 | if ( icons.primary ) { | ||
3678 | buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); | ||
3679 | } | ||
3680 | |||
3681 | if ( icons.secondary ) { | ||
3682 | buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); | ||
3683 | } | ||
3684 | |||
3685 | if ( !this.options.text ) { | ||
3686 | buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); | ||
3687 | |||
3688 | if ( !this.hasTitle ) { | ||
3689 | buttonElement.attr( "title", $.trim( buttonText ) ); | ||
3690 | } | ||
3691 | } | ||
3692 | } else { | ||
3693 | buttonClasses.push( "ui-button-text-only" ); | ||
3694 | } | ||
3695 | buttonElement.addClass( buttonClasses.join( " " ) ); | ||
3696 | } | ||
3697 | }); | ||
3698 | |||
3699 | $.widget( "ui.buttonset", { | ||
3700 | version: "1.11.2", | ||
3701 | options: { | ||
3702 | items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" | ||
3703 | }, | ||
3704 | |||
3705 | _create: function() { | ||
3706 | this.element.addClass( "ui-buttonset" ); | ||
3707 | }, | ||
3708 | |||
3709 | _init: function() { | ||
3710 | this.refresh(); | ||
3711 | }, | ||
3712 | |||
3713 | _setOption: function( key, value ) { | ||
3714 | if ( key === "disabled" ) { | ||
3715 | this.buttons.button( "option", key, value ); | ||
3716 | } | ||
3717 | |||
3718 | this._super( key, value ); | ||
3719 | }, | ||
3720 | |||
3721 | refresh: function() { | ||
3722 | var rtl = this.element.css( "direction" ) === "rtl", | ||
3723 | allButtons = this.element.find( this.options.items ), | ||
3724 | existingButtons = allButtons.filter( ":ui-button" ); | ||
3725 | |||
3726 | // Initialize new buttons | ||
3727 | allButtons.not( ":ui-button" ).button(); | ||
3728 | |||
3729 | // Refresh existing buttons | ||
3730 | existingButtons.button( "refresh" ); | ||
3731 | |||
3732 | this.buttons = allButtons | ||
3733 | .map(function() { | ||
3734 | return $( this ).button( "widget" )[ 0 ]; | ||
3735 | }) | ||
3736 | .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) | ||
3737 | .filter( ":first" ) | ||
3738 | .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) | ||
3739 | .end() | ||
3740 | .filter( ":last" ) | ||
3741 | .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) | ||
3742 | .end() | ||
3743 | .end(); | ||
3744 | }, | ||
3745 | |||
3746 | _destroy: function() { | ||
3747 | this.element.removeClass( "ui-buttonset" ); | ||
3748 | this.buttons | ||
3749 | .map(function() { | ||
3750 | return $( this ).button( "widget" )[ 0 ]; | ||
3751 | }) | ||
3752 | .removeClass( "ui-corner-left ui-corner-right" ) | ||
3753 | .end() | ||
3754 | .button( "destroy" ); | ||
3755 | } | ||
3756 | }); | ||
3757 | |||
3758 | var button = $.ui.button; | ||
3759 | |||
3760 | |||
3761 | /*! | ||
3762 | * jQuery UI Datepicker 1.11.2 | ||
3763 | * http://jqueryui.com | ||
3764 | * | ||
3765 | * Copyright 2014 jQuery Foundation and other contributors | ||
3766 | * Released under the MIT license. | ||
3767 | * http://jquery.org/license | ||
3768 | * | ||
3769 | * http://api.jqueryui.com/datepicker/ | ||
3770 | */ | ||
3771 | |||
3772 | |||
3773 | $.extend($.ui, { datepicker: { version: "1.11.2" } }); | ||
3774 | |||
3775 | var datepicker_instActive; | ||
3776 | |||
3777 | function datepicker_getZindex( elem ) { | ||
3778 | var position, value; | ||
3779 | while ( elem.length && elem[ 0 ] !== document ) { | ||
3780 | // Ignore z-index if position is set to a value where z-index is ignored by the browser | ||
3781 | // This makes behavior of this function consistent across browsers | ||
3782 | // WebKit always returns auto if the element is positioned | ||
3783 | position = elem.css( "position" ); | ||
3784 | if ( position === "absolute" || position === "relative" || position === "fixed" ) { | ||
3785 | // IE returns 0 when zIndex is not specified | ||
3786 | // other browsers return a string | ||
3787 | // we ignore the case of nested elements with an explicit value of 0 | ||
3788 | // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> | ||
3789 | value = parseInt( elem.css( "zIndex" ), 10 ); | ||
3790 | if ( !isNaN( value ) && value !== 0 ) { | ||
3791 | return value; | ||
3792 | } | ||
3793 | } | ||
3794 | elem = elem.parent(); | ||
3795 | } | ||
3796 | |||
3797 | return 0; | ||
3798 | } | ||
3799 | /* Date picker manager. | ||
3800 | Use the singleton instance of this class, $.datepicker, to interact with the date picker. | ||
3801 | Settings for (groups of) date pickers are maintained in an instance object, | ||
3802 | allowing multiple different settings on the same page. */ | ||
3803 | |||
3804 | function Datepicker() { | ||
3805 | this._curInst = null; // The current instance in use | ||
3806 | this._keyEvent = false; // If the last event was a key event | ||
3807 | this._disabledInputs = []; // List of date picker inputs that have been disabled | ||
3808 | this._datepickerShowing = false; // True if the popup picker is showing , false if not | ||
3809 | this._inDialog = false; // True if showing within a "dialog", false if not | ||
3810 | this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division | ||
3811 | this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class | ||
3812 | this._appendClass = "ui-datepicker-append"; // The name of the append marker class | ||
3813 | this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class | ||
3814 | this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class | ||
3815 | this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class | ||
3816 | this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class | ||
3817 | this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class | ||
3818 | this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class | ||
3819 | this.regional = []; // Available regional settings, indexed by language code | ||
3820 | this.regional[""] = { // Default regional settings | ||
3821 | closeText: "Done", // Display text for close link | ||
3822 | prevText: "Prev", // Display text for previous month link | ||
3823 | nextText: "Next", // Display text for next month link | ||
3824 | currentText: "Today", // Display text for current month link | ||
3825 | monthNames: ["January","February","March","April","May","June", | ||
3826 | "July","August","September","October","November","December"], // Names of months for drop-down and formatting | ||
3827 | monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting | ||
3828 | dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting | ||
3829 | dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting | ||
3830 | dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday | ||
3831 | weekHeader: "Wk", // Column header for week of the year | ||
3832 | dateFormat: "mm/dd/yy", // See format options on parseDate | ||
3833 | firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... | ||
3834 | isRTL: false, // True if right-to-left language, false if left-to-right | ||
3835 | showMonthAfterYear: false, // True if the year select precedes month, false for month then year | ||
3836 | yearSuffix: "" // Additional text to append to the year in the month headers | ||
3837 | }; | ||
3838 | this._defaults = { // Global defaults for all the date picker instances | ||
3839 | showOn: "focus", // "focus" for popup on focus, | ||
3840 | // "button" for trigger button, or "both" for either | ||
3841 | showAnim: "fadeIn", // Name of jQuery animation for popup | ||
3842 | showOptions: {}, // Options for enhanced animations | ||
3843 | defaultDate: null, // Used when field is blank: actual date, | ||
3844 | // +/-number for offset from today, null for today | ||
3845 | appendText: "", // Display text following the input box, e.g. showing the format | ||
3846 | buttonText: "...", // Text for trigger button | ||
3847 | buttonImage: "", // URL for trigger button image | ||
3848 | buttonImageOnly: false, // True if the image appears alone, false if it appears on a button | ||
3849 | hideIfNoPrevNext: false, // True to hide next/previous month links | ||
3850 | // if not applicable, false to just disable them | ||
3851 | navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links | ||
3852 | gotoCurrent: false, // True if today link goes back to current selection instead | ||
3853 | changeMonth: false, // True if month can be selected directly, false if only prev/next | ||
3854 | changeYear: false, // True if year can be selected directly, false if only prev/next | ||
3855 | yearRange: "c-10:c+10", // Range of years to display in drop-down, | ||
3856 | // either relative to today's year (-nn:+nn), relative to currently displayed year | ||
3857 | // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) | ||
3858 | showOtherMonths: false, // True to show dates in other months, false to leave blank | ||
3859 | selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable | ||
3860 | showWeek: false, // True to show week of the year, false to not show it | ||
3861 | calculateWeek: this.iso8601Week, // How to calculate the week of the year, | ||
3862 | // takes a Date and returns the number of the week for it | ||
3863 | shortYearCutoff: "+10", // Short year values < this are in the current century, | ||
3864 | // > this are in the previous century, | ||
3865 | // string value starting with "+" for current year + value | ||
3866 | minDate: null, // The earliest selectable date, or null for no limit | ||
3867 | maxDate: null, // The latest selectable date, or null for no limit | ||
3868 | duration: "fast", // Duration of display/closure | ||
3869 | beforeShowDay: null, // Function that takes a date and returns an array with | ||
3870 | // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", | ||
3871 | // [2] = cell title (optional), e.g. $.datepicker.noWeekends | ||
3872 | beforeShow: null, // Function that takes an input field and | ||
3873 | // returns a set of custom settings for the date picker | ||
3874 | onSelect: null, // Define a callback function when a date is selected | ||
3875 | onChangeMonthYear: null, // Define a callback function when the month or year is changed | ||
3876 | onClose: null, // Define a callback function when the datepicker is closed | ||
3877 | numberOfMonths: 1, // Number of months to show at a time | ||
3878 | showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) | ||
3879 | stepMonths: 1, // Number of months to step back/forward | ||
3880 | stepBigMonths: 12, // Number of months to step back/forward for the big links | ||
3881 | altField: "", // Selector for an alternate field to store selected dates into | ||
3882 | altFormat: "", // The date format to use for the alternate field | ||
3883 | constrainInput: true, // The input is constrained by the current date format | ||
3884 | showButtonPanel: false, // True to show button panel, false to not show it | ||
3885 | autoSize: false, // True to size the input for the date format, false to leave as is | ||
3886 | disabled: false // The initial disabled state | ||
3887 | }; | ||
3888 | $.extend(this._defaults, this.regional[""]); | ||
3889 | this.regional.en = $.extend( true, {}, this.regional[ "" ]); | ||
3890 | this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); | ||
3891 | this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); | ||
3892 | } | ||
3893 | |||
3894 | $.extend(Datepicker.prototype, { | ||
3895 | /* Class name added to elements to indicate already configured with a date picker. */ | ||
3896 | markerClassName: "hasDatepicker", | ||
3897 | |||
3898 | //Keep track of the maximum number of rows displayed (see #7043) | ||
3899 | maxRows: 4, | ||
3900 | |||
3901 | // TODO rename to "widget" when switching to widget factory | ||
3902 | _widgetDatepicker: function() { | ||
3903 | return this.dpDiv; | ||
3904 | }, | ||
3905 | |||
3906 | /* Override the default settings for all instances of the date picker. | ||
3907 | * @param settings object - the new settings to use as defaults (anonymous object) | ||
3908 | * @return the manager object | ||
3909 | */ | ||
3910 | setDefaults: function(settings) { | ||
3911 | datepicker_extendRemove(this._defaults, settings || {}); | ||
3912 | return this; | ||
3913 | }, | ||
3914 | |||
3915 | /* Attach the date picker to a jQuery selection. | ||
3916 | * @param target element - the target input field or division or span | ||
3917 | * @param settings object - the new settings to use for this date picker instance (anonymous) | ||
3918 | */ | ||
3919 | _attachDatepicker: function(target, settings) { | ||
3920 | var nodeName, inline, inst; | ||
3921 | nodeName = target.nodeName.toLowerCase(); | ||
3922 | inline = (nodeName === "div" || nodeName === "span"); | ||
3923 | if (!target.id) { | ||
3924 | this.uuid += 1; | ||
3925 | target.id = "dp" + this.uuid; | ||
3926 | } | ||
3927 | inst = this._newInst($(target), inline); | ||
3928 | inst.settings = $.extend({}, settings || {}); | ||
3929 | if (nodeName === "input") { | ||
3930 | this._connectDatepicker(target, inst); | ||
3931 | } else if (inline) { | ||
3932 | this._inlineDatepicker(target, inst); | ||
3933 | } | ||
3934 | }, | ||
3935 | |||
3936 | /* Create a new instance object. */ | ||
3937 | _newInst: function(target, inline) { | ||
3938 | var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars | ||
3939 | return {id: id, input: target, // associated target | ||
3940 | selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection | ||
3941 | drawMonth: 0, drawYear: 0, // month being drawn | ||
3942 | inline: inline, // is datepicker inline or not | ||
3943 | dpDiv: (!inline ? this.dpDiv : // presentation div | ||
3944 | datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))}; | ||
3945 | }, | ||
3946 | |||
3947 | /* Attach the date picker to an input field. */ | ||
3948 | _connectDatepicker: function(target, inst) { | ||
3949 | var input = $(target); | ||
3950 | inst.append = $([]); | ||
3951 | inst.trigger = $([]); | ||
3952 | if (input.hasClass(this.markerClassName)) { | ||
3953 | return; | ||
3954 | } | ||
3955 | this._attachments(input, inst); | ||
3956 | input.addClass(this.markerClassName).keydown(this._doKeyDown). | ||
3957 | keypress(this._doKeyPress).keyup(this._doKeyUp); | ||
3958 | this._autoSize(inst); | ||
3959 | $.data(target, "datepicker", inst); | ||
3960 | //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) | ||
3961 | if( inst.settings.disabled ) { | ||
3962 | this._disableDatepicker( target ); | ||
3963 | } | ||
3964 | }, | ||
3965 | |||
3966 | /* Make attachments based on settings. */ | ||
3967 | _attachments: function(input, inst) { | ||
3968 | var showOn, buttonText, buttonImage, | ||
3969 | appendText = this._get(inst, "appendText"), | ||
3970 | isRTL = this._get(inst, "isRTL"); | ||
3971 | |||
3972 | if (inst.append) { | ||
3973 | inst.append.remove(); | ||
3974 | } | ||
3975 | if (appendText) { | ||
3976 | inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); | ||
3977 | input[isRTL ? "before" : "after"](inst.append); | ||
3978 | } | ||
3979 | |||
3980 | input.unbind("focus", this._showDatepicker); | ||
3981 | |||
3982 | if (inst.trigger) { | ||
3983 | inst.trigger.remove(); | ||
3984 | } | ||
3985 | |||
3986 | showOn = this._get(inst, "showOn"); | ||
3987 | if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field | ||
3988 | input.focus(this._showDatepicker); | ||
3989 | } | ||
3990 | if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked | ||
3991 | buttonText = this._get(inst, "buttonText"); | ||
3992 | buttonImage = this._get(inst, "buttonImage"); | ||
3993 | inst.trigger = $(this._get(inst, "buttonImageOnly") ? | ||
3994 | $("<img/>").addClass(this._triggerClass). | ||
3995 | attr({ src: buttonImage, alt: buttonText, title: buttonText }) : | ||
3996 | $("<button type='button'></button>").addClass(this._triggerClass). | ||
3997 | html(!buttonImage ? buttonText : $("<img/>").attr( | ||
3998 | { src:buttonImage, alt:buttonText, title:buttonText }))); | ||
3999 | input[isRTL ? "before" : "after"](inst.trigger); | ||
4000 | inst.trigger.click(function() { | ||
4001 | if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { | ||
4002 | $.datepicker._hideDatepicker(); | ||
4003 | } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { | ||
4004 | $.datepicker._hideDatepicker(); | ||
4005 | $.datepicker._showDatepicker(input[0]); | ||
4006 | } else { | ||
4007 | $.datepicker._showDatepicker(input[0]); | ||
4008 | } | ||
4009 | return false; | ||
4010 | }); | ||
4011 | } | ||
4012 | }, | ||
4013 | |||
4014 | /* Apply the maximum length for the date format. */ | ||
4015 | _autoSize: function(inst) { | ||
4016 | if (this._get(inst, "autoSize") && !inst.inline) { | ||
4017 | var findMax, max, maxI, i, | ||
4018 | date = new Date(2009, 12 - 1, 20), // Ensure double digits | ||
4019 | dateFormat = this._get(inst, "dateFormat"); | ||
4020 | |||
4021 | if (dateFormat.match(/[DM]/)) { | ||
4022 | findMax = function(names) { | ||
4023 | max = 0; | ||
4024 | maxI = 0; | ||
4025 | for (i = 0; i < names.length; i++) { | ||
4026 | if (names[i].length > max) { | ||
4027 | max = names[i].length; | ||
4028 | maxI = i; | ||
4029 | } | ||
4030 | } | ||
4031 | return maxI; | ||
4032 | }; | ||
4033 | date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? | ||
4034 | "monthNames" : "monthNamesShort")))); | ||
4035 | date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? | ||
4036 | "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); | ||
4037 | } | ||
4038 | inst.input.attr("size", this._formatDate(inst, date).length); | ||
4039 | } | ||
4040 | }, | ||
4041 | |||
4042 | /* Attach an inline date picker to a div. */ | ||
4043 | _inlineDatepicker: function(target, inst) { | ||
4044 | var divSpan = $(target); | ||
4045 | if (divSpan.hasClass(this.markerClassName)) { | ||
4046 | return; | ||
4047 | } | ||
4048 | divSpan.addClass(this.markerClassName).append(inst.dpDiv); | ||
4049 | $.data(target, "datepicker", inst); | ||
4050 | this._setDate(inst, this._getDefaultDate(inst), true); | ||
4051 | this._updateDatepicker(inst); | ||
4052 | this._updateAlternate(inst); | ||
4053 | //If disabled option is true, disable the datepicker before showing it (see ticket #5665) | ||
4054 | if( inst.settings.disabled ) { | ||
4055 | this._disableDatepicker( target ); | ||
4056 | } | ||
4057 | // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements | ||
4058 | // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height | ||
4059 | inst.dpDiv.css( "display", "block" ); | ||
4060 | }, | ||
4061 | |||
4062 | /* Pop-up the date picker in a "dialog" box. | ||
4063 | * @param input element - ignored | ||
4064 | * @param date string or Date - the initial date to display | ||
4065 | * @param onSelect function - the function to call when a date is selected | ||
4066 | * @param settings object - update the dialog date picker instance's settings (anonymous object) | ||
4067 | * @param pos int[2] - coordinates for the dialog's position within the screen or | ||
4068 | * event - with x/y coordinates or | ||
4069 | * leave empty for default (screen centre) | ||
4070 | * @return the manager object | ||
4071 | */ | ||
4072 | _dialogDatepicker: function(input, date, onSelect, settings, pos) { | ||
4073 | var id, browserWidth, browserHeight, scrollX, scrollY, | ||
4074 | inst = this._dialogInst; // internal instance | ||
4075 | |||
4076 | if (!inst) { | ||
4077 | this.uuid += 1; | ||
4078 | id = "dp" + this.uuid; | ||
4079 | this._dialogInput = $("<input type='text' id='" + id + | ||
4080 | "' style='position: absolute; top: -100px; width: 0px;'/>"); | ||
4081 | this._dialogInput.keydown(this._doKeyDown); | ||
4082 | $("body").append(this._dialogInput); | ||
4083 | inst = this._dialogInst = this._newInst(this._dialogInput, false); | ||
4084 | inst.settings = {}; | ||
4085 | $.data(this._dialogInput[0], "datepicker", inst); | ||
4086 | } | ||
4087 | datepicker_extendRemove(inst.settings, settings || {}); | ||
4088 | date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); | ||
4089 | this._dialogInput.val(date); | ||
4090 | |||
4091 | this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); | ||
4092 | if (!this._pos) { | ||
4093 | browserWidth = document.documentElement.clientWidth; | ||
4094 | browserHeight = document.documentElement.clientHeight; | ||
4095 | scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; | ||
4096 | scrollY = document.documentElement.scrollTop || document.body.scrollTop; | ||
4097 | this._pos = // should use actual width/height below | ||
4098 | [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; | ||
4099 | } | ||
4100 | |||
4101 | // move input on screen for focus, but hidden behind dialog | ||
4102 | this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); | ||
4103 | inst.settings.onSelect = onSelect; | ||
4104 | this._inDialog = true; | ||
4105 | this.dpDiv.addClass(this._dialogClass); | ||
4106 | this._showDatepicker(this._dialogInput[0]); | ||
4107 | if ($.blockUI) { | ||
4108 | $.blockUI(this.dpDiv); | ||
4109 | } | ||
4110 | $.data(this._dialogInput[0], "datepicker", inst); | ||
4111 | return this; | ||
4112 | }, | ||
4113 | |||
4114 | /* Detach a datepicker from its control. | ||
4115 | * @param target element - the target input field or division or span | ||
4116 | */ | ||
4117 | _destroyDatepicker: function(target) { | ||
4118 | var nodeName, | ||
4119 | $target = $(target), | ||
4120 | inst = $.data(target, "datepicker"); | ||
4121 | |||
4122 | if (!$target.hasClass(this.markerClassName)) { | ||
4123 | return; | ||
4124 | } | ||
4125 | |||
4126 | nodeName = target.nodeName.toLowerCase(); | ||
4127 | $.removeData(target, "datepicker"); | ||
4128 | if (nodeName === "input") { | ||
4129 | inst.append.remove(); | ||
4130 | inst.trigger.remove(); | ||
4131 | $target.removeClass(this.markerClassName). | ||
4132 | unbind("focus", this._showDatepicker). | ||
4133 | unbind("keydown", this._doKeyDown). | ||
4134 | unbind("keypress", this._doKeyPress). | ||
4135 | unbind("keyup", this._doKeyUp); | ||
4136 | } else if (nodeName === "div" || nodeName === "span") { | ||
4137 | $target.removeClass(this.markerClassName).empty(); | ||
4138 | } | ||
4139 | }, | ||
4140 | |||
4141 | /* Enable the date picker to a jQuery selection. | ||
4142 | * @param target element - the target input field or division or span | ||
4143 | */ | ||
4144 | _enableDatepicker: function(target) { | ||
4145 | var nodeName, inline, | ||
4146 | $target = $(target), | ||
4147 | inst = $.data(target, "datepicker"); | ||
4148 | |||
4149 | if (!$target.hasClass(this.markerClassName)) { | ||
4150 | return; | ||
4151 | } | ||
4152 | |||
4153 | nodeName = target.nodeName.toLowerCase(); | ||
4154 | if (nodeName === "input") { | ||
4155 | target.disabled = false; | ||
4156 | inst.trigger.filter("button"). | ||
4157 | each(function() { this.disabled = false; }).end(). | ||
4158 | filter("img").css({opacity: "1.0", cursor: ""}); | ||
4159 | } else if (nodeName === "div" || nodeName === "span") { | ||
4160 | inline = $target.children("." + this._inlineClass); | ||
4161 | inline.children().removeClass("ui-state-disabled"); | ||
4162 | inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). | ||
4163 | prop("disabled", false); | ||
4164 | } | ||
4165 | this._disabledInputs = $.map(this._disabledInputs, | ||
4166 | function(value) { return (value === target ? null : value); }); // delete entry | ||
4167 | }, | ||
4168 | |||
4169 | /* Disable the date picker to a jQuery selection. | ||
4170 | * @param target element - the target input field or division or span | ||
4171 | */ | ||
4172 | _disableDatepicker: function(target) { | ||
4173 | var nodeName, inline, | ||
4174 | $target = $(target), | ||
4175 | inst = $.data(target, "datepicker"); | ||
4176 | |||
4177 | if (!$target.hasClass(this.markerClassName)) { | ||
4178 | return; | ||
4179 | } | ||
4180 | |||
4181 | nodeName = target.nodeName.toLowerCase(); | ||
4182 | if (nodeName === "input") { | ||
4183 | target.disabled = true; | ||
4184 | inst.trigger.filter("button"). | ||
4185 | each(function() { this.disabled = true; }).end(). | ||
4186 | filter("img").css({opacity: "0.5", cursor: "default"}); | ||
4187 | } else if (nodeName === "div" || nodeName === "span") { | ||
4188 | inline = $target.children("." + this._inlineClass); | ||
4189 | inline.children().addClass("ui-state-disabled"); | ||
4190 | inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). | ||
4191 | prop("disabled", true); | ||
4192 | } | ||
4193 | this._disabledInputs = $.map(this._disabledInputs, | ||
4194 | function(value) { return (value === target ? null : value); }); // delete entry | ||
4195 | this._disabledInputs[this._disabledInputs.length] = target; | ||
4196 | }, | ||
4197 | |||
4198 | /* Is the first field in a jQuery collection disabled as a datepicker? | ||
4199 | * @param target element - the target input field or division or span | ||
4200 | * @return boolean - true if disabled, false if enabled | ||
4201 | */ | ||
4202 | _isDisabledDatepicker: function(target) { | ||
4203 | if (!target) { | ||
4204 | return false; | ||
4205 | } | ||
4206 | for (var i = 0; i < this._disabledInputs.length; i++) { | ||
4207 | if (this._disabledInputs[i] === target) { | ||
4208 | return true; | ||
4209 | } | ||
4210 | } | ||
4211 | return false; | ||
4212 | }, | ||
4213 | |||
4214 | /* Retrieve the instance data for the target control. | ||
4215 | * @param target element - the target input field or division or span | ||
4216 | * @return object - the associated instance data | ||
4217 | * @throws error if a jQuery problem getting data | ||
4218 | */ | ||
4219 | _getInst: function(target) { | ||
4220 | try { | ||
4221 | return $.data(target, "datepicker"); | ||
4222 | } | ||
4223 | catch (err) { | ||
4224 | throw "Missing instance data for this datepicker"; | ||
4225 | } | ||
4226 | }, | ||
4227 | |||
4228 | /* Update or retrieve the settings for a date picker attached to an input field or division. | ||
4229 | * @param target element - the target input field or division or span | ||
4230 | * @param name object - the new settings to update or | ||
4231 | * string - the name of the setting to change or retrieve, | ||
4232 | * when retrieving also "all" for all instance settings or | ||
4233 | * "defaults" for all global defaults | ||
4234 | * @param value any - the new value for the setting | ||
4235 | * (omit if above is an object or to retrieve a value) | ||
4236 | */ | ||
4237 | _optionDatepicker: function(target, name, value) { | ||
4238 | var settings, date, minDate, maxDate, | ||
4239 | inst = this._getInst(target); | ||
4240 | |||
4241 | if (arguments.length === 2 && typeof name === "string") { | ||
4242 | return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : | ||
4243 | (inst ? (name === "all" ? $.extend({}, inst.settings) : | ||
4244 | this._get(inst, name)) : null)); | ||
4245 | } | ||
4246 | |||
4247 | settings = name || {}; | ||
4248 | if (typeof name === "string") { | ||
4249 | settings = {}; | ||
4250 | settings[name] = value; | ||
4251 | } | ||
4252 | |||
4253 | if (inst) { | ||
4254 | if (this._curInst === inst) { | ||
4255 | this._hideDatepicker(); | ||
4256 | } | ||
4257 | |||
4258 | date = this._getDateDatepicker(target, true); | ||
4259 | minDate = this._getMinMaxDate(inst, "min"); | ||
4260 | maxDate = this._getMinMaxDate(inst, "max"); | ||
4261 | datepicker_extendRemove(inst.settings, settings); | ||
4262 | // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided | ||
4263 | if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { | ||
4264 | inst.settings.minDate = this._formatDate(inst, minDate); | ||
4265 | } | ||
4266 | if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { | ||
4267 | inst.settings.maxDate = this._formatDate(inst, maxDate); | ||
4268 | } | ||
4269 | if ( "disabled" in settings ) { | ||
4270 | if ( settings.disabled ) { | ||
4271 | this._disableDatepicker(target); | ||
4272 | } else { | ||
4273 | this._enableDatepicker(target); | ||
4274 | } | ||
4275 | } | ||
4276 | this._attachments($(target), inst); | ||
4277 | this._autoSize(inst); | ||
4278 | this._setDate(inst, date); | ||
4279 | this._updateAlternate(inst); | ||
4280 | this._updateDatepicker(inst); | ||
4281 | } | ||
4282 | }, | ||
4283 | |||
4284 | // change method deprecated | ||
4285 | _changeDatepicker: function(target, name, value) { | ||
4286 | this._optionDatepicker(target, name, value); | ||
4287 | }, | ||
4288 | |||
4289 | /* Redraw the date picker attached to an input field or division. | ||
4290 | * @param target element - the target input field or division or span | ||
4291 | */ | ||
4292 | _refreshDatepicker: function(target) { | ||
4293 | var inst = this._getInst(target); | ||
4294 | if (inst) { | ||
4295 | this._updateDatepicker(inst); | ||
4296 | } | ||
4297 | }, | ||
4298 | |||
4299 | /* Set the dates for a jQuery selection. | ||
4300 | * @param target element - the target input field or division or span | ||
4301 | * @param date Date - the new date | ||
4302 | */ | ||
4303 | _setDateDatepicker: function(target, date) { | ||
4304 | var inst = this._getInst(target); | ||
4305 | if (inst) { | ||
4306 | this._setDate(inst, date); | ||
4307 | this._updateDatepicker(inst); | ||
4308 | this._updateAlternate(inst); | ||
4309 | } | ||
4310 | }, | ||
4311 | |||
4312 | /* Get the date(s) for the first entry in a jQuery selection. | ||
4313 | * @param target element - the target input field or division or span | ||
4314 | * @param noDefault boolean - true if no default date is to be used | ||
4315 | * @return Date - the current date | ||
4316 | */ | ||
4317 | _getDateDatepicker: function(target, noDefault) { | ||
4318 | var inst = this._getInst(target); | ||
4319 | if (inst && !inst.inline) { | ||
4320 | this._setDateFromField(inst, noDefault); | ||
4321 | } | ||
4322 | return (inst ? this._getDate(inst) : null); | ||
4323 | }, | ||
4324 | |||
4325 | /* Handle keystrokes. */ | ||
4326 | _doKeyDown: function(event) { | ||
4327 | var onSelect, dateStr, sel, | ||
4328 | inst = $.datepicker._getInst(event.target), | ||
4329 | handled = true, | ||
4330 | isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); | ||
4331 | |||
4332 | inst._keyEvent = true; | ||
4333 | if ($.datepicker._datepickerShowing) { | ||
4334 | switch (event.keyCode) { | ||
4335 | case 9: $.datepicker._hideDatepicker(); | ||
4336 | handled = false; | ||
4337 | break; // hide on tab out | ||
4338 | case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + | ||
4339 | $.datepicker._currentClass + ")", inst.dpDiv); | ||
4340 | if (sel[0]) { | ||
4341 | $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); | ||
4342 | } | ||
4343 | |||
4344 | onSelect = $.datepicker._get(inst, "onSelect"); | ||
4345 | if (onSelect) { | ||
4346 | dateStr = $.datepicker._formatDate(inst); | ||
4347 | |||
4348 | // trigger custom callback | ||
4349 | onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); | ||
4350 | } else { | ||
4351 | $.datepicker._hideDatepicker(); | ||
4352 | } | ||
4353 | |||
4354 | return false; // don't submit the form | ||
4355 | case 27: $.datepicker._hideDatepicker(); | ||
4356 | break; // hide on escape | ||
4357 | case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? | ||
4358 | -$.datepicker._get(inst, "stepBigMonths") : | ||
4359 | -$.datepicker._get(inst, "stepMonths")), "M"); | ||
4360 | break; // previous month/year on page up/+ ctrl | ||
4361 | case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? | ||
4362 | +$.datepicker._get(inst, "stepBigMonths") : | ||
4363 | +$.datepicker._get(inst, "stepMonths")), "M"); | ||
4364 | break; // next month/year on page down/+ ctrl | ||
4365 | case 35: if (event.ctrlKey || event.metaKey) { | ||
4366 | $.datepicker._clearDate(event.target); | ||
4367 | } | ||
4368 | handled = event.ctrlKey || event.metaKey; | ||
4369 | break; // clear on ctrl or command +end | ||
4370 | case 36: if (event.ctrlKey || event.metaKey) { | ||
4371 | $.datepicker._gotoToday(event.target); | ||
4372 | } | ||
4373 | handled = event.ctrlKey || event.metaKey; | ||
4374 | break; // current on ctrl or command +home | ||
4375 | case 37: if (event.ctrlKey || event.metaKey) { | ||
4376 | $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); | ||
4377 | } | ||
4378 | handled = event.ctrlKey || event.metaKey; | ||
4379 | // -1 day on ctrl or command +left | ||
4380 | if (event.originalEvent.altKey) { | ||
4381 | $.datepicker._adjustDate(event.target, (event.ctrlKey ? | ||
4382 | -$.datepicker._get(inst, "stepBigMonths") : | ||
4383 | -$.datepicker._get(inst, "stepMonths")), "M"); | ||
4384 | } | ||
4385 | // next month/year on alt +left on Mac | ||
4386 | break; | ||
4387 | case 38: if (event.ctrlKey || event.metaKey) { | ||
4388 | $.datepicker._adjustDate(event.target, -7, "D"); | ||
4389 | } | ||
4390 | handled = event.ctrlKey || event.metaKey; | ||
4391 | break; // -1 week on ctrl or command +up | ||
4392 | case 39: if (event.ctrlKey || event.metaKey) { | ||
4393 | $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); | ||
4394 | } | ||
4395 | handled = event.ctrlKey || event.metaKey; | ||
4396 | // +1 day on ctrl or command +right | ||
4397 | if (event.originalEvent.altKey) { | ||
4398 | $.datepicker._adjustDate(event.target, (event.ctrlKey ? | ||
4399 | +$.datepicker._get(inst, "stepBigMonths") : | ||
4400 | +$.datepicker._get(inst, "stepMonths")), "M"); | ||
4401 | } | ||
4402 | // next month/year on alt +right | ||
4403 | break; | ||
4404 | case 40: if (event.ctrlKey || event.metaKey) { | ||
4405 | $.datepicker._adjustDate(event.target, +7, "D"); | ||
4406 | } | ||
4407 | handled = event.ctrlKey || event.metaKey; | ||
4408 | break; // +1 week on ctrl or command +down | ||
4409 | default: handled = false; | ||
4410 | } | ||
4411 | } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home | ||
4412 | $.datepicker._showDatepicker(this); | ||
4413 | } else { | ||
4414 | handled = false; | ||
4415 | } | ||
4416 | |||
4417 | if (handled) { | ||
4418 | event.preventDefault(); | ||
4419 | event.stopPropagation(); | ||
4420 | } | ||
4421 | }, | ||
4422 | |||
4423 | /* Filter entered characters - based on date format. */ | ||
4424 | _doKeyPress: function(event) { | ||
4425 | var chars, chr, | ||
4426 | inst = $.datepicker._getInst(event.target); | ||
4427 | |||
4428 | if ($.datepicker._get(inst, "constrainInput")) { | ||
4429 | chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); | ||
4430 | chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); | ||
4431 | return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); | ||
4432 | } | ||
4433 | }, | ||
4434 | |||
4435 | /* Synchronise manual entry and field/alternate field. */ | ||
4436 | _doKeyUp: function(event) { | ||
4437 | var date, | ||
4438 | inst = $.datepicker._getInst(event.target); | ||
4439 | |||
4440 | if (inst.input.val() !== inst.lastVal) { | ||
4441 | try { | ||
4442 | date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), | ||
4443 | (inst.input ? inst.input.val() : null), | ||
4444 | $.datepicker._getFormatConfig(inst)); | ||
4445 | |||
4446 | if (date) { // only if valid | ||
4447 | $.datepicker._setDateFromField(inst); | ||
4448 | $.datepicker._updateAlternate(inst); | ||
4449 | $.datepicker._updateDatepicker(inst); | ||
4450 | } | ||
4451 | } | ||
4452 | catch (err) { | ||
4453 | } | ||
4454 | } | ||
4455 | return true; | ||
4456 | }, | ||
4457 | |||
4458 | /* Pop-up the date picker for a given input field. | ||
4459 | * If false returned from beforeShow event handler do not show. | ||
4460 | * @param input element - the input field attached to the date picker or | ||
4461 | * event - if triggered by focus | ||
4462 | */ | ||
4463 | _showDatepicker: function(input) { | ||
4464 | input = input.target || input; | ||
4465 | if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger | ||
4466 | input = $("input", input.parentNode)[0]; | ||
4467 | } | ||
4468 | |||
4469 | if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here | ||
4470 | return; | ||
4471 | } | ||
4472 | |||
4473 | var inst, beforeShow, beforeShowSettings, isFixed, | ||
4474 | offset, showAnim, duration; | ||
4475 | |||
4476 | inst = $.datepicker._getInst(input); | ||
4477 | if ($.datepicker._curInst && $.datepicker._curInst !== inst) { | ||
4478 | $.datepicker._curInst.dpDiv.stop(true, true); | ||
4479 | if ( inst && $.datepicker._datepickerShowing ) { | ||
4480 | $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); | ||
4481 | } | ||
4482 | } | ||
4483 | |||
4484 | beforeShow = $.datepicker._get(inst, "beforeShow"); | ||
4485 | beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; | ||
4486 | if(beforeShowSettings === false){ | ||
4487 | return; | ||
4488 | } | ||
4489 | datepicker_extendRemove(inst.settings, beforeShowSettings); | ||
4490 | |||
4491 | inst.lastVal = null; | ||
4492 | $.datepicker._lastInput = input; | ||
4493 | $.datepicker._setDateFromField(inst); | ||
4494 | |||
4495 | if ($.datepicker._inDialog) { // hide cursor | ||
4496 | input.value = ""; | ||
4497 | } | ||
4498 | if (!$.datepicker._pos) { // position below input | ||
4499 | $.datepicker._pos = $.datepicker._findPos(input); | ||
4500 | $.datepicker._pos[1] += input.offsetHeight; // add the height | ||
4501 | } | ||
4502 | |||
4503 | isFixed = false; | ||
4504 | $(input).parents().each(function() { | ||
4505 | isFixed |= $(this).css("position") === "fixed"; | ||
4506 | return !isFixed; | ||
4507 | }); | ||
4508 | |||
4509 | offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; | ||
4510 | $.datepicker._pos = null; | ||
4511 | //to avoid flashes on Firefox | ||
4512 | inst.dpDiv.empty(); | ||
4513 | // determine sizing offscreen | ||
4514 | inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"}); | ||
4515 | $.datepicker._updateDatepicker(inst); | ||
4516 | // fix width for dynamic number of date pickers | ||
4517 | // and adjust position before showing | ||
4518 | offset = $.datepicker._checkOffset(inst, offset, isFixed); | ||
4519 | inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? | ||
4520 | "static" : (isFixed ? "fixed" : "absolute")), display: "none", | ||
4521 | left: offset.left + "px", top: offset.top + "px"}); | ||
4522 | |||
4523 | if (!inst.inline) { | ||
4524 | showAnim = $.datepicker._get(inst, "showAnim"); | ||
4525 | duration = $.datepicker._get(inst, "duration"); | ||
4526 | inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); | ||
4527 | $.datepicker._datepickerShowing = true; | ||
4528 | |||
4529 | if ( $.effects && $.effects.effect[ showAnim ] ) { | ||
4530 | inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); | ||
4531 | } else { | ||
4532 | inst.dpDiv[showAnim || "show"](showAnim ? duration : null); | ||
4533 | } | ||
4534 | |||
4535 | if ( $.datepicker._shouldFocusInput( inst ) ) { | ||
4536 | inst.input.focus(); | ||
4537 | } | ||
4538 | |||
4539 | $.datepicker._curInst = inst; | ||
4540 | } | ||
4541 | }, | ||
4542 | |||
4543 | /* Generate the date picker content. */ | ||
4544 | _updateDatepicker: function(inst) { | ||
4545 | this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) | ||
4546 | datepicker_instActive = inst; // for delegate hover events | ||
4547 | inst.dpDiv.empty().append(this._generateHTML(inst)); | ||
4548 | this._attachHandlers(inst); | ||
4549 | |||
4550 | var origyearshtml, | ||
4551 | numMonths = this._getNumberOfMonths(inst), | ||
4552 | cols = numMonths[1], | ||
4553 | width = 17, | ||
4554 | activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); | ||
4555 | |||
4556 | if ( activeCell.length > 0 ) { | ||
4557 | datepicker_handleMouseover.apply( activeCell.get( 0 ) ); | ||
4558 | } | ||
4559 | |||
4560 | inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); | ||
4561 | if (cols > 1) { | ||
4562 | inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); | ||
4563 | } | ||
4564 | inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + | ||
4565 | "Class"]("ui-datepicker-multi"); | ||
4566 | inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + | ||
4567 | "Class"]("ui-datepicker-rtl"); | ||
4568 | |||
4569 | if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { | ||
4570 | inst.input.focus(); | ||
4571 | } | ||
4572 | |||
4573 | // deffered render of the years select (to avoid flashes on Firefox) | ||
4574 | if( inst.yearshtml ){ | ||
4575 | origyearshtml = inst.yearshtml; | ||
4576 | setTimeout(function(){ | ||
4577 | //assure that inst.yearshtml didn't change. | ||
4578 | if( origyearshtml === inst.yearshtml && inst.yearshtml ){ | ||
4579 | inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); | ||
4580 | } | ||
4581 | origyearshtml = inst.yearshtml = null; | ||
4582 | }, 0); | ||
4583 | } | ||
4584 | }, | ||
4585 | |||
4586 | // #6694 - don't focus the input if it's already focused | ||
4587 | // this breaks the change event in IE | ||
4588 | // Support: IE and jQuery <1.9 | ||
4589 | _shouldFocusInput: function( inst ) { | ||
4590 | return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); | ||
4591 | }, | ||
4592 | |||
4593 | /* Check positioning to remain on screen. */ | ||
4594 | _checkOffset: function(inst, offset, isFixed) { | ||
4595 | var dpWidth = inst.dpDiv.outerWidth(), | ||
4596 | dpHeight = inst.dpDiv.outerHeight(), | ||
4597 | inputWidth = inst.input ? inst.input.outerWidth() : 0, | ||
4598 | inputHeight = inst.input ? inst.input.outerHeight() : 0, | ||
4599 | viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), | ||
4600 | viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); | ||
4601 | |||
4602 | offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); | ||
4603 | offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; | ||
4604 | offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; | ||
4605 | |||
4606 | // now check if datepicker is showing outside window viewport - move to a better place if so. | ||
4607 | offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? | ||
4608 | Math.abs(offset.left + dpWidth - viewWidth) : 0); | ||
4609 | offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? | ||
4610 | Math.abs(dpHeight + inputHeight) : 0); | ||
4611 | |||
4612 | return offset; | ||
4613 | }, | ||
4614 | |||
4615 | /* Find an object's position on the screen. */ | ||
4616 | _findPos: function(obj) { | ||
4617 | var position, | ||
4618 | inst = this._getInst(obj), | ||
4619 | isRTL = this._get(inst, "isRTL"); | ||
4620 | |||
4621 | while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { | ||
4622 | obj = obj[isRTL ? "previousSibling" : "nextSibling"]; | ||
4623 | } | ||
4624 | |||
4625 | position = $(obj).offset(); | ||
4626 | return [position.left, position.top]; | ||
4627 | }, | ||
4628 | |||
4629 | /* Hide the date picker from view. | ||
4630 | * @param input element - the input field attached to the date picker | ||
4631 | */ | ||
4632 | _hideDatepicker: function(input) { | ||
4633 | var showAnim, duration, postProcess, onClose, | ||
4634 | inst = this._curInst; | ||
4635 | |||
4636 | if (!inst || (input && inst !== $.data(input, "datepicker"))) { | ||
4637 | return; | ||
4638 | } | ||
4639 | |||
4640 | if (this._datepickerShowing) { | ||
4641 | showAnim = this._get(inst, "showAnim"); | ||
4642 | duration = this._get(inst, "duration"); | ||
4643 | postProcess = function() { | ||
4644 | $.datepicker._tidyDialog(inst); | ||
4645 | }; | ||
4646 | |||
4647 | // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed | ||
4648 | if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { | ||
4649 | inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); | ||
4650 | } else { | ||
4651 | inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : | ||
4652 | (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); | ||
4653 | } | ||
4654 | |||
4655 | if (!showAnim) { | ||
4656 | postProcess(); | ||
4657 | } | ||
4658 | this._datepickerShowing = false; | ||
4659 | |||
4660 | onClose = this._get(inst, "onClose"); | ||
4661 | if (onClose) { | ||
4662 | onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); | ||
4663 | } | ||
4664 | |||
4665 | this._lastInput = null; | ||
4666 | if (this._inDialog) { | ||
4667 | this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); | ||
4668 | if ($.blockUI) { | ||
4669 | $.unblockUI(); | ||
4670 | $("body").append(this.dpDiv); | ||
4671 | } | ||
4672 | } | ||
4673 | this._inDialog = false; | ||
4674 | } | ||
4675 | }, | ||
4676 | |||
4677 | /* Tidy up after a dialog display. */ | ||
4678 | _tidyDialog: function(inst) { | ||
4679 | inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); | ||
4680 | }, | ||
4681 | |||
4682 | /* Close date picker if clicked elsewhere. */ | ||
4683 | _checkExternalClick: function(event) { | ||
4684 | if (!$.datepicker._curInst) { | ||
4685 | return; | ||
4686 | } | ||
4687 | |||
4688 | var $target = $(event.target), | ||
4689 | inst = $.datepicker._getInst($target[0]); | ||
4690 | |||
4691 | if ( ( ( $target[0].id !== $.datepicker._mainDivId && | ||
4692 | $target.parents("#" + $.datepicker._mainDivId).length === 0 && | ||
4693 | !$target.hasClass($.datepicker.markerClassName) && | ||
4694 | !$target.closest("." + $.datepicker._triggerClass).length && | ||
4695 | $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || | ||
4696 | ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) { | ||
4697 | $.datepicker._hideDatepicker(); | ||
4698 | } | ||
4699 | }, | ||
4700 | |||
4701 | /* Adjust one of the date sub-fields. */ | ||
4702 | _adjustDate: function(id, offset, period) { | ||
4703 | var target = $(id), | ||
4704 | inst = this._getInst(target[0]); | ||
4705 | |||
4706 | if (this._isDisabledDatepicker(target[0])) { | ||
4707 | return; | ||
4708 | } | ||
4709 | this._adjustInstDate(inst, offset + | ||
4710 | (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning | ||
4711 | period); | ||
4712 | this._updateDatepicker(inst); | ||
4713 | }, | ||
4714 | |||
4715 | /* Action for current link. */ | ||
4716 | _gotoToday: function(id) { | ||
4717 | var date, | ||
4718 | target = $(id), | ||
4719 | inst = this._getInst(target[0]); | ||
4720 | |||
4721 | if (this._get(inst, "gotoCurrent") && inst.currentDay) { | ||
4722 | inst.selectedDay = inst.currentDay; | ||
4723 | inst.drawMonth = inst.selectedMonth = inst.currentMonth; | ||
4724 | inst.drawYear = inst.selectedYear = inst.currentYear; | ||
4725 | } else { | ||
4726 | date = new Date(); | ||
4727 | inst.selectedDay = date.getDate(); | ||
4728 | inst.drawMonth = inst.selectedMonth = date.getMonth(); | ||
4729 | inst.drawYear = inst.selectedYear = date.getFullYear(); | ||
4730 | } | ||
4731 | this._notifyChange(inst); | ||
4732 | this._adjustDate(target); | ||
4733 | }, | ||
4734 | |||
4735 | /* Action for selecting a new month/year. */ | ||
4736 | _selectMonthYear: function(id, select, period) { | ||
4737 | var target = $(id), | ||
4738 | inst = this._getInst(target[0]); | ||
4739 | |||
4740 | inst["selected" + (period === "M" ? "Month" : "Year")] = | ||
4741 | inst["draw" + (period === "M" ? "Month" : "Year")] = | ||
4742 | parseInt(select.options[select.selectedIndex].value,10); | ||
4743 | |||
4744 | this._notifyChange(inst); | ||
4745 | this._adjustDate(target); | ||
4746 | }, | ||
4747 | |||
4748 | /* Action for selecting a day. */ | ||
4749 | _selectDay: function(id, month, year, td) { | ||
4750 | var inst, | ||
4751 | target = $(id); | ||
4752 | |||
4753 | if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { | ||
4754 | return; | ||
4755 | } | ||
4756 | |||
4757 | inst = this._getInst(target[0]); | ||
4758 | inst.selectedDay = inst.currentDay = $("a", td).html(); | ||
4759 | inst.selectedMonth = inst.currentMonth = month; | ||
4760 | inst.selectedYear = inst.currentYear = year; | ||
4761 | this._selectDate(id, this._formatDate(inst, | ||
4762 | inst.currentDay, inst.currentMonth, inst.currentYear)); | ||
4763 | }, | ||
4764 | |||
4765 | /* Erase the input field and hide the date picker. */ | ||
4766 | _clearDate: function(id) { | ||
4767 | var target = $(id); | ||
4768 | this._selectDate(target, ""); | ||
4769 | }, | ||
4770 | |||
4771 | /* Update the input field with the selected date. */ | ||
4772 | _selectDate: function(id, dateStr) { | ||
4773 | var onSelect, | ||
4774 | target = $(id), | ||
4775 | inst = this._getInst(target[0]); | ||
4776 | |||
4777 | dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); | ||
4778 | if (inst.input) { | ||
4779 | inst.input.val(dateStr); | ||
4780 | } | ||
4781 | this._updateAlternate(inst); | ||
4782 | |||
4783 | onSelect = this._get(inst, "onSelect"); | ||
4784 | if (onSelect) { | ||
4785 | onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback | ||
4786 | } else if (inst.input) { | ||
4787 | inst.input.trigger("change"); // fire the change event | ||
4788 | } | ||
4789 | |||
4790 | if (inst.inline){ | ||
4791 | this._updateDatepicker(inst); | ||
4792 | } else { | ||
4793 | this._hideDatepicker(); | ||
4794 | this._lastInput = inst.input[0]; | ||
4795 | if (typeof(inst.input[0]) !== "object") { | ||
4796 | inst.input.focus(); // restore focus | ||
4797 | } | ||
4798 | this._lastInput = null; | ||
4799 | } | ||
4800 | }, | ||
4801 | |||
4802 | /* Update any alternate field to synchronise with the main field. */ | ||
4803 | _updateAlternate: function(inst) { | ||
4804 | var altFormat, date, dateStr, | ||
4805 | altField = this._get(inst, "altField"); | ||
4806 | |||
4807 | if (altField) { // update alternate field too | ||
4808 | altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); | ||
4809 | date = this._getDate(inst); | ||
4810 | dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); | ||
4811 | $(altField).each(function() { $(this).val(dateStr); }); | ||
4812 | } | ||
4813 | }, | ||
4814 | |||
4815 | /* Set as beforeShowDay function to prevent selection of weekends. | ||
4816 | * @param date Date - the date to customise | ||
4817 | * @return [boolean, string] - is this date selectable?, what is its CSS class? | ||
4818 | */ | ||
4819 | noWeekends: function(date) { | ||
4820 | var day = date.getDay(); | ||
4821 | return [(day > 0 && day < 6), ""]; | ||
4822 | }, | ||
4823 | |||
4824 | /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. | ||
4825 | * @param date Date - the date to get the week for | ||
4826 | * @return number - the number of the week within the year that contains this date | ||
4827 | */ | ||
4828 | iso8601Week: function(date) { | ||
4829 | var time, | ||
4830 | checkDate = new Date(date.getTime()); | ||
4831 | |||
4832 | // Find Thursday of this week starting on Monday | ||
4833 | checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); | ||
4834 | |||
4835 | time = checkDate.getTime(); | ||
4836 | checkDate.setMonth(0); // Compare with Jan 1 | ||
4837 | checkDate.setDate(1); | ||
4838 | return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; | ||
4839 | }, | ||
4840 | |||
4841 | /* Parse a string value into a date object. | ||
4842 | * See formatDate below for the possible formats. | ||
4843 | * | ||
4844 | * @param format string - the expected format of the date | ||
4845 | * @param value string - the date in the above format | ||
4846 | * @param settings Object - attributes include: | ||
4847 | * shortYearCutoff number - the cutoff year for determining the century (optional) | ||
4848 | * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) | ||
4849 | * dayNames string[7] - names of the days from Sunday (optional) | ||
4850 | * monthNamesShort string[12] - abbreviated names of the months (optional) | ||
4851 | * monthNames string[12] - names of the months (optional) | ||
4852 | * @return Date - the extracted date value or null if value is blank | ||
4853 | */ | ||
4854 | parseDate: function (format, value, settings) { | ||
4855 | if (format == null || value == null) { | ||
4856 | throw "Invalid arguments"; | ||
4857 | } | ||
4858 | |||
4859 | value = (typeof value === "object" ? value.toString() : value + ""); | ||
4860 | if (value === "") { | ||
4861 | return null; | ||
4862 | } | ||
4863 | |||
4864 | var iFormat, dim, extra, | ||
4865 | iValue = 0, | ||
4866 | shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, | ||
4867 | shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : | ||
4868 | new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), | ||
4869 | dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, | ||
4870 | dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, | ||
4871 | monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, | ||
4872 | monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, | ||
4873 | year = -1, | ||
4874 | month = -1, | ||
4875 | day = -1, | ||
4876 | doy = -1, | ||
4877 | literal = false, | ||
4878 | date, | ||
4879 | // Check whether a format character is doubled | ||
4880 | lookAhead = function(match) { | ||
4881 | var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); | ||
4882 | if (matches) { | ||
4883 | iFormat++; | ||
4884 | } | ||
4885 | return matches; | ||
4886 | }, | ||
4887 | // Extract a number from the string value | ||
4888 | getNumber = function(match) { | ||
4889 | var isDoubled = lookAhead(match), | ||
4890 | size = (match === "@" ? 14 : (match === "!" ? 20 : | ||
4891 | (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), | ||
4892 | minSize = (match === "y" ? size : 1), | ||
4893 | digits = new RegExp("^\\d{" + minSize + "," + size + "}"), | ||
4894 | num = value.substring(iValue).match(digits); | ||
4895 | if (!num) { | ||
4896 | throw "Missing number at position " + iValue; | ||
4897 | } | ||
4898 | iValue += num[0].length; | ||
4899 | return parseInt(num[0], 10); | ||
4900 | }, | ||
4901 | // Extract a name from the string value and convert to an index | ||
4902 | getName = function(match, shortNames, longNames) { | ||
4903 | var index = -1, | ||
4904 | names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { | ||
4905 | return [ [k, v] ]; | ||
4906 | }).sort(function (a, b) { | ||
4907 | return -(a[1].length - b[1].length); | ||
4908 | }); | ||
4909 | |||
4910 | $.each(names, function (i, pair) { | ||
4911 | var name = pair[1]; | ||
4912 | if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { | ||
4913 | index = pair[0]; | ||
4914 | iValue += name.length; | ||
4915 | return false; | ||
4916 | } | ||
4917 | }); | ||
4918 | if (index !== -1) { | ||
4919 | return index + 1; | ||
4920 | } else { | ||
4921 | throw "Unknown name at position " + iValue; | ||
4922 | } | ||
4923 | }, | ||
4924 | // Confirm that a literal character matches the string value | ||
4925 | checkLiteral = function() { | ||
4926 | if (value.charAt(iValue) !== format.charAt(iFormat)) { | ||
4927 | throw "Unexpected literal at position " + iValue; | ||
4928 | } | ||
4929 | iValue++; | ||
4930 | }; | ||
4931 | |||
4932 | for (iFormat = 0; iFormat < format.length; iFormat++) { | ||
4933 | if (literal) { | ||
4934 | if (format.charAt(iFormat) === "'" && !lookAhead("'")) { | ||
4935 | literal = false; | ||
4936 | } else { | ||
4937 | checkLiteral(); | ||
4938 | } | ||
4939 | } else { | ||
4940 | switch (format.charAt(iFormat)) { | ||
4941 | case "d": | ||
4942 | day = getNumber("d"); | ||
4943 | break; | ||
4944 | case "D": | ||
4945 | getName("D", dayNamesShort, dayNames); | ||
4946 | break; | ||
4947 | case "o": | ||
4948 | doy = getNumber("o"); | ||
4949 | break; | ||
4950 | case "m": | ||
4951 | month = getNumber("m"); | ||
4952 | break; | ||
4953 | case "M": | ||
4954 | month = getName("M", monthNamesShort, monthNames); | ||
4955 | break; | ||
4956 | case "y": | ||
4957 | year = getNumber("y"); | ||
4958 | break; | ||
4959 | case "@": | ||
4960 | date = new Date(getNumber("@")); | ||
4961 | year = date.getFullYear(); | ||
4962 | month = date.getMonth() + 1; | ||
4963 | day = date.getDate(); | ||
4964 | break; | ||
4965 | case "!": | ||
4966 | date = new Date((getNumber("!") - this._ticksTo1970) / 10000); | ||
4967 | year = date.getFullYear(); | ||
4968 | month = date.getMonth() + 1; | ||
4969 | day = date.getDate(); | ||
4970 | break; | ||
4971 | case "'": | ||
4972 | if (lookAhead("'")){ | ||
4973 | checkLiteral(); | ||
4974 | } else { | ||
4975 | literal = true; | ||
4976 | } | ||
4977 | break; | ||
4978 | default: | ||
4979 | checkLiteral(); | ||
4980 | } | ||
4981 | } | ||
4982 | } | ||
4983 | |||
4984 | if (iValue < value.length){ | ||
4985 | extra = value.substr(iValue); | ||
4986 | if (!/^\s+/.test(extra)) { | ||
4987 | throw "Extra/unparsed characters found in date: " + extra; | ||
4988 | } | ||
4989 | } | ||
4990 | |||
4991 | if (year === -1) { | ||
4992 | year = new Date().getFullYear(); | ||
4993 | } else if (year < 100) { | ||
4994 | year += new Date().getFullYear() - new Date().getFullYear() % 100 + | ||
4995 | (year <= shortYearCutoff ? 0 : -100); | ||
4996 | } | ||
4997 | |||
4998 | if (doy > -1) { | ||
4999 | month = 1; | ||
5000 | day = doy; | ||
5001 | do { | ||
5002 | dim = this._getDaysInMonth(year, month - 1); | ||
5003 | if (day <= dim) { | ||
5004 | break; | ||
5005 | } | ||
5006 | month++; | ||
5007 | day -= dim; | ||
5008 | } while (true); | ||
5009 | } | ||
5010 | |||
5011 | date = this._daylightSavingAdjust(new Date(year, month - 1, day)); | ||
5012 | if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { | ||
5013 | throw "Invalid date"; // E.g. 31/02/00 | ||
5014 | } | ||
5015 | return date; | ||
5016 | }, | ||
5017 | |||
5018 | /* Standard date formats. */ | ||
5019 | ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) | ||
5020 | COOKIE: "D, dd M yy", | ||
5021 | ISO_8601: "yy-mm-dd", | ||
5022 | RFC_822: "D, d M y", | ||
5023 | RFC_850: "DD, dd-M-y", | ||
5024 | RFC_1036: "D, d M y", | ||
5025 | RFC_1123: "D, d M yy", | ||
5026 | RFC_2822: "D, d M yy", | ||
5027 | RSS: "D, d M y", // RFC 822 | ||
5028 | TICKS: "!", | ||
5029 | TIMESTAMP: "@", | ||
5030 | W3C: "yy-mm-dd", // ISO 8601 | ||
5031 | |||
5032 | _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + | ||
5033 | Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), | ||
5034 | |||
5035 | /* Format a date object into a string value. | ||
5036 | * The format can be combinations of the following: | ||
5037 | * d - day of month (no leading zero) | ||
5038 | * dd - day of month (two digit) | ||
5039 | * o - day of year (no leading zeros) | ||
5040 | * oo - day of year (three digit) | ||
5041 | * D - day name short | ||
5042 | * DD - day name long | ||
5043 | * m - month of year (no leading zero) | ||
5044 | * mm - month of year (two digit) | ||
5045 | * M - month name short | ||
5046 | * MM - month name long | ||
5047 | * y - year (two digit) | ||
5048 | * yy - year (four digit) | ||
5049 | * @ - Unix timestamp (ms since 01/01/1970) | ||
5050 | * ! - Windows ticks (100ns since 01/01/0001) | ||
5051 | * "..." - literal text | ||
5052 | * '' - single quote | ||
5053 | * | ||
5054 | * @param format string - the desired format of the date | ||
5055 | * @param date Date - the date value to format | ||
5056 | * @param settings Object - attributes include: | ||
5057 | * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) | ||
5058 | * dayNames string[7] - names of the days from Sunday (optional) | ||
5059 | * monthNamesShort string[12] - abbreviated names of the months (optional) | ||
5060 | * monthNames string[12] - names of the months (optional) | ||
5061 | * @return string - the date in the above format | ||
5062 | */ | ||
5063 | formatDate: function (format, date, settings) { | ||
5064 | if (!date) { | ||
5065 | return ""; | ||
5066 | } | ||
5067 | |||
5068 | var iFormat, | ||
5069 | dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, | ||
5070 | dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, | ||
5071 | monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, | ||
5072 | monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, | ||
5073 | // Check whether a format character is doubled | ||
5074 | lookAhead = function(match) { | ||
5075 | var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); | ||
5076 | if (matches) { | ||
5077 | iFormat++; | ||
5078 | } | ||
5079 | return matches; | ||
5080 | }, | ||
5081 | // Format a number, with leading zero if necessary | ||
5082 | formatNumber = function(match, value, len) { | ||
5083 | var num = "" + value; | ||
5084 | if (lookAhead(match)) { | ||
5085 | while (num.length < len) { | ||
5086 | num = "0" + num; | ||
5087 | } | ||
5088 | } | ||
5089 | return num; | ||
5090 | }, | ||
5091 | // Format a name, short or long as requested | ||
5092 | formatName = function(match, value, shortNames, longNames) { | ||
5093 | return (lookAhead(match) ? longNames[value] : shortNames[value]); | ||
5094 | }, | ||
5095 | output = "", | ||
5096 | literal = false; | ||
5097 | |||
5098 | if (date) { | ||
5099 | for (iFormat = 0; iFormat < format.length; iFormat++) { | ||
5100 | if (literal) { | ||
5101 | if (format.charAt(iFormat) === "'" && !lookAhead("'")) { | ||
5102 | literal = false; | ||
5103 | } else { | ||
5104 | output += format.charAt(iFormat); | ||
5105 | } | ||
5106 | } else { | ||
5107 | switch (format.charAt(iFormat)) { | ||
5108 | case "d": | ||
5109 | output += formatNumber("d", date.getDate(), 2); | ||
5110 | break; | ||
5111 | case "D": | ||
5112 | output += formatName("D", date.getDay(), dayNamesShort, dayNames); | ||
5113 | break; | ||
5114 | case "o": | ||
5115 | output += formatNumber("o", | ||
5116 | Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); | ||
5117 | break; | ||
5118 | case "m": | ||
5119 | output += formatNumber("m", date.getMonth() + 1, 2); | ||
5120 | break; | ||
5121 | case "M": | ||
5122 | output += formatName("M", date.getMonth(), monthNamesShort, monthNames); | ||
5123 | break; | ||
5124 | case "y": | ||
5125 | output += (lookAhead("y") ? date.getFullYear() : | ||
5126 | (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); | ||
5127 | break; | ||
5128 | case "@": | ||
5129 | output += date.getTime(); | ||
5130 | break; | ||
5131 | case "!": | ||
5132 | output += date.getTime() * 10000 + this._ticksTo1970; | ||
5133 | break; | ||
5134 | case "'": | ||
5135 | if (lookAhead("'")) { | ||
5136 | output += "'"; | ||
5137 | } else { | ||
5138 | literal = true; | ||
5139 | } | ||
5140 | break; | ||
5141 | default: | ||
5142 | output += format.charAt(iFormat); | ||
5143 | } | ||
5144 | } | ||
5145 | } | ||
5146 | } | ||
5147 | return output; | ||
5148 | }, | ||
5149 | |||
5150 | /* Extract all possible characters from the date format. */ | ||
5151 | _possibleChars: function (format) { | ||
5152 | var iFormat, | ||
5153 | chars = "", | ||
5154 | literal = false, | ||
5155 | // Check whether a format character is doubled | ||
5156 | lookAhead = function(match) { | ||
5157 | var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); | ||
5158 | if (matches) { | ||
5159 | iFormat++; | ||
5160 | } | ||
5161 | return matches; | ||
5162 | }; | ||
5163 | |||
5164 | for (iFormat = 0; iFormat < format.length; iFormat++) { | ||
5165 | if (literal) { | ||
5166 | if (format.charAt(iFormat) === "'" && !lookAhead("'")) { | ||
5167 | literal = false; | ||
5168 | } else { | ||
5169 | chars += format.charAt(iFormat); | ||
5170 | } | ||
5171 | } else { | ||
5172 | switch (format.charAt(iFormat)) { | ||
5173 | case "d": case "m": case "y": case "@": | ||
5174 | chars += "0123456789"; | ||
5175 | break; | ||
5176 | case "D": case "M": | ||
5177 | return null; // Accept anything | ||
5178 | case "'": | ||
5179 | if (lookAhead("'")) { | ||
5180 | chars += "'"; | ||
5181 | } else { | ||
5182 | literal = true; | ||
5183 | } | ||
5184 | break; | ||
5185 | default: | ||
5186 | chars += format.charAt(iFormat); | ||
5187 | } | ||
5188 | } | ||
5189 | } | ||
5190 | return chars; | ||
5191 | }, | ||
5192 | |||
5193 | /* Get a setting value, defaulting if necessary. */ | ||
5194 | _get: function(inst, name) { | ||
5195 | return inst.settings[name] !== undefined ? | ||
5196 | inst.settings[name] : this._defaults[name]; | ||
5197 | }, | ||
5198 | |||
5199 | /* Parse existing date and initialise date picker. */ | ||
5200 | _setDateFromField: function(inst, noDefault) { | ||
5201 | if (inst.input.val() === inst.lastVal) { | ||
5202 | return; | ||
5203 | } | ||
5204 | |||
5205 | var dateFormat = this._get(inst, "dateFormat"), | ||
5206 | dates = inst.lastVal = inst.input ? inst.input.val() : null, | ||
5207 | defaultDate = this._getDefaultDate(inst), | ||
5208 | date = defaultDate, | ||
5209 | settings = this._getFormatConfig(inst); | ||
5210 | |||
5211 | try { | ||
5212 | date = this.parseDate(dateFormat, dates, settings) || defaultDate; | ||
5213 | } catch (event) { | ||
5214 | dates = (noDefault ? "" : dates); | ||
5215 | } | ||
5216 | inst.selectedDay = date.getDate(); | ||
5217 | inst.drawMonth = inst.selectedMonth = date.getMonth(); | ||
5218 | inst.drawYear = inst.selectedYear = date.getFullYear(); | ||
5219 | inst.currentDay = (dates ? date.getDate() : 0); | ||
5220 | inst.currentMonth = (dates ? date.getMonth() : 0); | ||
5221 | inst.currentYear = (dates ? date.getFullYear() : 0); | ||
5222 | this._adjustInstDate(inst); | ||
5223 | }, | ||
5224 | |||
5225 | /* Retrieve the default date shown on opening. */ | ||
5226 | _getDefaultDate: function(inst) { | ||
5227 | return this._restrictMinMax(inst, | ||
5228 | this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); | ||
5229 | }, | ||
5230 | |||
5231 | /* A date may be specified as an exact value or a relative one. */ | ||
5232 | _determineDate: function(inst, date, defaultDate) { | ||
5233 | var offsetNumeric = function(offset) { | ||
5234 | var date = new Date(); | ||
5235 | date.setDate(date.getDate() + offset); | ||
5236 | return date; | ||
5237 | }, | ||
5238 | offsetString = function(offset) { | ||
5239 | try { | ||
5240 | return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), | ||
5241 | offset, $.datepicker._getFormatConfig(inst)); | ||
5242 | } | ||
5243 | catch (e) { | ||
5244 | // Ignore | ||
5245 | } | ||
5246 | |||
5247 | var date = (offset.toLowerCase().match(/^c/) ? | ||
5248 | $.datepicker._getDate(inst) : null) || new Date(), | ||
5249 | year = date.getFullYear(), | ||
5250 | month = date.getMonth(), | ||
5251 | day = date.getDate(), | ||
5252 | pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, | ||
5253 | matches = pattern.exec(offset); | ||
5254 | |||
5255 | while (matches) { | ||
5256 | switch (matches[2] || "d") { | ||
5257 | case "d" : case "D" : | ||
5258 | day += parseInt(matches[1],10); break; | ||
5259 | case "w" : case "W" : | ||
5260 | day += parseInt(matches[1],10) * 7; break; | ||
5261 | case "m" : case "M" : | ||
5262 | month += parseInt(matches[1],10); | ||
5263 | day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); | ||
5264 | break; | ||
5265 | case "y": case "Y" : | ||
5266 | year += parseInt(matches[1],10); | ||
5267 | day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); | ||
5268 | break; | ||
5269 | } | ||
5270 | matches = pattern.exec(offset); | ||
5271 | } | ||
5272 | return new Date(year, month, day); | ||
5273 | }, | ||
5274 | newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : | ||
5275 | (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); | ||
5276 | |||
5277 | newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); | ||
5278 | if (newDate) { | ||
5279 | newDate.setHours(0); | ||
5280 | newDate.setMinutes(0); | ||
5281 | newDate.setSeconds(0); | ||
5282 | newDate.setMilliseconds(0); | ||
5283 | } | ||
5284 | return this._daylightSavingAdjust(newDate); | ||
5285 | }, | ||
5286 | |||
5287 | /* Handle switch to/from daylight saving. | ||
5288 | * Hours may be non-zero on daylight saving cut-over: | ||
5289 | * > 12 when midnight changeover, but then cannot generate | ||
5290 | * midnight datetime, so jump to 1AM, otherwise reset. | ||
5291 | * @param date (Date) the date to check | ||
5292 | * @return (Date) the corrected date | ||
5293 | */ | ||
5294 | _daylightSavingAdjust: function(date) { | ||
5295 | if (!date) { | ||
5296 | return null; | ||
5297 | } | ||
5298 | date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); | ||
5299 | return date; | ||
5300 | }, | ||
5301 | |||
5302 | /* Set the date(s) directly. */ | ||
5303 | _setDate: function(inst, date, noChange) { | ||
5304 | var clear = !date, | ||
5305 | origMonth = inst.selectedMonth, | ||
5306 | origYear = inst.selectedYear, | ||
5307 | newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); | ||
5308 | |||
5309 | inst.selectedDay = inst.currentDay = newDate.getDate(); | ||
5310 | inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); | ||
5311 | inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); | ||
5312 | if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { | ||
5313 | this._notifyChange(inst); | ||
5314 | } | ||
5315 | this._adjustInstDate(inst); | ||
5316 | if (inst.input) { | ||
5317 | inst.input.val(clear ? "" : this._formatDate(inst)); | ||
5318 | } | ||
5319 | }, | ||
5320 | |||
5321 | /* Retrieve the date(s) directly. */ | ||
5322 | _getDate: function(inst) { | ||
5323 | var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : | ||
5324 | this._daylightSavingAdjust(new Date( | ||
5325 | inst.currentYear, inst.currentMonth, inst.currentDay))); | ||
5326 | return startDate; | ||
5327 | }, | ||
5328 | |||
5329 | /* Attach the onxxx handlers. These are declared statically so | ||
5330 | * they work with static code transformers like Caja. | ||
5331 | */ | ||
5332 | _attachHandlers: function(inst) { | ||
5333 | var stepMonths = this._get(inst, "stepMonths"), | ||
5334 | id = "#" + inst.id.replace( /\\\\/g, "\\" ); | ||
5335 | inst.dpDiv.find("[data-handler]").map(function () { | ||
5336 | var handler = { | ||
5337 | prev: function () { | ||
5338 | $.datepicker._adjustDate(id, -stepMonths, "M"); | ||
5339 | }, | ||
5340 | next: function () { | ||
5341 | $.datepicker._adjustDate(id, +stepMonths, "M"); | ||
5342 | }, | ||
5343 | hide: function () { | ||
5344 | $.datepicker._hideDatepicker(); | ||
5345 | }, | ||
5346 | today: function () { | ||
5347 | $.datepicker._gotoToday(id); | ||
5348 | }, | ||
5349 | selectDay: function () { | ||
5350 | $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); | ||
5351 | return false; | ||
5352 | }, | ||
5353 | selectMonth: function () { | ||
5354 | $.datepicker._selectMonthYear(id, this, "M"); | ||
5355 | return false; | ||
5356 | }, | ||
5357 | selectYear: function () { | ||
5358 | $.datepicker._selectMonthYear(id, this, "Y"); | ||
5359 | return false; | ||
5360 | } | ||
5361 | }; | ||
5362 | $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); | ||
5363 | }); | ||
5364 | }, | ||
5365 | |||
5366 | /* Generate the HTML for the current state of the date picker. */ | ||
5367 | _generateHTML: function(inst) { | ||
5368 | var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, | ||
5369 | controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, | ||
5370 | monthNames, monthNamesShort, beforeShowDay, showOtherMonths, | ||
5371 | selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, | ||
5372 | cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, | ||
5373 | printDate, dRow, tbody, daySettings, otherMonth, unselectable, | ||
5374 | tempDate = new Date(), | ||
5375 | today = this._daylightSavingAdjust( | ||
5376 | new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time | ||
5377 | isRTL = this._get(inst, "isRTL"), | ||
5378 | showButtonPanel = this._get(inst, "showButtonPanel"), | ||
5379 | hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), | ||
5380 | navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), | ||
5381 | numMonths = this._getNumberOfMonths(inst), | ||
5382 | showCurrentAtPos = this._get(inst, "showCurrentAtPos"), | ||
5383 | stepMonths = this._get(inst, "stepMonths"), | ||
5384 | isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), | ||
5385 | currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : | ||
5386 | new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), | ||
5387 | minDate = this._getMinMaxDate(inst, "min"), | ||
5388 | maxDate = this._getMinMaxDate(inst, "max"), | ||
5389 | drawMonth = inst.drawMonth - showCurrentAtPos, | ||
5390 | drawYear = inst.drawYear; | ||
5391 | |||
5392 | if (drawMonth < 0) { | ||
5393 | drawMonth += 12; | ||
5394 | drawYear--; | ||
5395 | } | ||
5396 | if (maxDate) { | ||
5397 | maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), | ||
5398 | maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); | ||
5399 | maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); | ||
5400 | while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { | ||
5401 | drawMonth--; | ||
5402 | if (drawMonth < 0) { | ||
5403 | drawMonth = 11; | ||
5404 | drawYear--; | ||
5405 | } | ||
5406 | } | ||
5407 | } | ||
5408 | inst.drawMonth = drawMonth; | ||
5409 | inst.drawYear = drawYear; | ||
5410 | |||
5411 | prevText = this._get(inst, "prevText"); | ||
5412 | prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, | ||
5413 | this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), | ||
5414 | this._getFormatConfig(inst))); | ||
5415 | |||
5416 | prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? | ||
5417 | "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + | ||
5418 | " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : | ||
5419 | (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>")); | ||
5420 | |||
5421 | nextText = this._get(inst, "nextText"); | ||
5422 | nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, | ||
5423 | this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), | ||
5424 | this._getFormatConfig(inst))); | ||
5425 | |||
5426 | next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? | ||
5427 | "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + | ||
5428 | " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : | ||
5429 | (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>")); | ||
5430 | |||
5431 | currentText = this._get(inst, "currentText"); | ||
5432 | gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); | ||
5433 | currentText = (!navigationAsDateFormat ? currentText : | ||
5434 | this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); | ||
5435 | |||
5436 | controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + | ||
5437 | this._get(inst, "closeText") + "</button>" : ""); | ||
5438 | |||
5439 | buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + | ||
5440 | (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + | ||
5441 | ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; | ||
5442 | |||
5443 | firstDay = parseInt(this._get(inst, "firstDay"),10); | ||
5444 | firstDay = (isNaN(firstDay) ? 0 : firstDay); | ||
5445 | |||
5446 | showWeek = this._get(inst, "showWeek"); | ||
5447 | dayNames = this._get(inst, "dayNames"); | ||
5448 | dayNamesMin = this._get(inst, "dayNamesMin"); | ||
5449 | monthNames = this._get(inst, "monthNames"); | ||
5450 | monthNamesShort = this._get(inst, "monthNamesShort"); | ||
5451 | beforeShowDay = this._get(inst, "beforeShowDay"); | ||
5452 | showOtherMonths = this._get(inst, "showOtherMonths"); | ||
5453 | selectOtherMonths = this._get(inst, "selectOtherMonths"); | ||
5454 | defaultDate = this._getDefaultDate(inst); | ||
5455 | html = ""; | ||
5456 | dow; | ||
5457 | for (row = 0; row < numMonths[0]; row++) { | ||
5458 | group = ""; | ||
5459 | this.maxRows = 4; | ||
5460 | for (col = 0; col < numMonths[1]; col++) { | ||
5461 | selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); | ||
5462 | cornerClass = " ui-corner-all"; | ||
5463 | calender = ""; | ||
5464 | if (isMultiMonth) { | ||
5465 | calender += "<div class='ui-datepicker-group"; | ||
5466 | if (numMonths[1] > 1) { | ||
5467 | switch (col) { | ||
5468 | case 0: calender += " ui-datepicker-group-first"; | ||
5469 | cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; | ||
5470 | case numMonths[1]-1: calender += " ui-datepicker-group-last"; | ||
5471 | cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; | ||
5472 | default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; | ||
5473 | } | ||
5474 | } | ||
5475 | calender += "'>"; | ||
5476 | } | ||
5477 | calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + | ||
5478 | (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + | ||
5479 | (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + | ||
5480 | this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, | ||
5481 | row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers | ||
5482 | "</div><table class='ui-datepicker-calendar'><thead>" + | ||
5483 | "<tr>"; | ||
5484 | thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); | ||
5485 | for (dow = 0; dow < 7; dow++) { // days of the week | ||
5486 | day = (dow + firstDay) % 7; | ||
5487 | thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + | ||
5488 | "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; | ||
5489 | } | ||
5490 | calender += thead + "</tr></thead><tbody>"; | ||
5491 | daysInMonth = this._getDaysInMonth(drawYear, drawMonth); | ||
5492 | if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { | ||
5493 | inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); | ||
5494 | } | ||
5495 | leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; | ||
5496 | curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate | ||
5497 | numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) | ||
5498 | this.maxRows = numRows; | ||
5499 | printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); | ||
5500 | for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows | ||
5501 | calender += "<tr>"; | ||
5502 | tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + | ||
5503 | this._get(inst, "calculateWeek")(printDate) + "</td>"); | ||
5504 | for (dow = 0; dow < 7; dow++) { // create date picker days | ||
5505 | daySettings = (beforeShowDay ? | ||
5506 | beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); | ||
5507 | otherMonth = (printDate.getMonth() !== drawMonth); | ||
5508 | unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || | ||
5509 | (minDate && printDate < minDate) || (maxDate && printDate > maxDate); | ||
5510 | tbody += "<td class='" + | ||
5511 | ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends | ||
5512 | (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months | ||
5513 | ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key | ||
5514 | (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? | ||
5515 | // or defaultDate is current printedDate and defaultDate is selectedDate | ||
5516 | " " + this._dayOverClass : "") + // highlight selected day | ||
5517 | (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days | ||
5518 | (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates | ||
5519 | (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day | ||
5520 | (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) | ||
5521 | ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title | ||
5522 | (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions | ||
5523 | (otherMonth && !showOtherMonths ? " " : // display for other months | ||
5524 | (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + | ||
5525 | (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + | ||
5526 | (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day | ||
5527 | (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months | ||
5528 | "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date | ||
5529 | printDate.setDate(printDate.getDate() + 1); | ||
5530 | printDate = this._daylightSavingAdjust(printDate); | ||
5531 | } | ||
5532 | calender += tbody + "</tr>"; | ||
5533 | } | ||
5534 | drawMonth++; | ||
5535 | if (drawMonth > 11) { | ||
5536 | drawMonth = 0; | ||
5537 | drawYear++; | ||
5538 | } | ||
5539 | calender += "</tbody></table>" + (isMultiMonth ? "</div>" + | ||
5540 | ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); | ||
5541 | group += calender; | ||
5542 | } | ||
5543 | html += group; | ||
5544 | } | ||
5545 | html += buttonPanel; | ||
5546 | inst._keyEvent = false; | ||
5547 | return html; | ||
5548 | }, | ||
5549 | |||
5550 | /* Generate the month and year header. */ | ||
5551 | _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, | ||
5552 | secondary, monthNames, monthNamesShort) { | ||
5553 | |||
5554 | var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, | ||
5555 | changeMonth = this._get(inst, "changeMonth"), | ||
5556 | changeYear = this._get(inst, "changeYear"), | ||
5557 | showMonthAfterYear = this._get(inst, "showMonthAfterYear"), | ||
5558 | html = "<div class='ui-datepicker-title'>", | ||
5559 | monthHtml = ""; | ||
5560 | |||
5561 | // month selection | ||
5562 | if (secondary || !changeMonth) { | ||
5563 | monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; | ||
5564 | } else { | ||
5565 | inMinYear = (minDate && minDate.getFullYear() === drawYear); | ||
5566 | inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); | ||
5567 | monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; | ||
5568 | for ( month = 0; month < 12; month++) { | ||
5569 | if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { | ||
5570 | monthHtml += "<option value='" + month + "'" + | ||
5571 | (month === drawMonth ? " selected='selected'" : "") + | ||
5572 | ">" + monthNamesShort[month] + "</option>"; | ||
5573 | } | ||
5574 | } | ||
5575 | monthHtml += "</select>"; | ||
5576 | } | ||
5577 | |||
5578 | if (!showMonthAfterYear) { | ||
5579 | html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); | ||
5580 | } | ||
5581 | |||
5582 | // year selection | ||
5583 | if ( !inst.yearshtml ) { | ||
5584 | inst.yearshtml = ""; | ||
5585 | if (secondary || !changeYear) { | ||
5586 | html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; | ||
5587 | } else { | ||
5588 | // determine range of years to display | ||
5589 | years = this._get(inst, "yearRange").split(":"); | ||
5590 | thisYear = new Date().getFullYear(); | ||
5591 | determineYear = function(value) { | ||
5592 | var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : | ||
5593 | (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : | ||
5594 | parseInt(value, 10))); | ||
5595 | return (isNaN(year) ? thisYear : year); | ||
5596 | }; | ||
5597 | year = determineYear(years[0]); | ||
5598 | endYear = Math.max(year, determineYear(years[1] || "")); | ||
5599 | year = (minDate ? Math.max(year, minDate.getFullYear()) : year); | ||
5600 | endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); | ||
5601 | inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; | ||
5602 | for (; year <= endYear; year++) { | ||
5603 | inst.yearshtml += "<option value='" + year + "'" + | ||
5604 | (year === drawYear ? " selected='selected'" : "") + | ||
5605 | ">" + year + "</option>"; | ||
5606 | } | ||
5607 | inst.yearshtml += "</select>"; | ||
5608 | |||
5609 | html += inst.yearshtml; | ||
5610 | inst.yearshtml = null; | ||
5611 | } | ||
5612 | } | ||
5613 | |||
5614 | html += this._get(inst, "yearSuffix"); | ||
5615 | if (showMonthAfterYear) { | ||
5616 | html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; | ||
5617 | } | ||
5618 | html += "</div>"; // Close datepicker_header | ||
5619 | return html; | ||
5620 | }, | ||
5621 | |||
5622 | /* Adjust one of the date sub-fields. */ | ||
5623 | _adjustInstDate: function(inst, offset, period) { | ||
5624 | var year = inst.drawYear + (period === "Y" ? offset : 0), | ||
5625 | month = inst.drawMonth + (period === "M" ? offset : 0), | ||
5626 | day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), | ||
5627 | date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); | ||
5628 | |||
5629 | inst.selectedDay = date.getDate(); | ||
5630 | inst.drawMonth = inst.selectedMonth = date.getMonth(); | ||
5631 | inst.drawYear = inst.selectedYear = date.getFullYear(); | ||
5632 | if (period === "M" || period === "Y") { | ||
5633 | this._notifyChange(inst); | ||
5634 | } | ||
5635 | }, | ||
5636 | |||
5637 | /* Ensure a date is within any min/max bounds. */ | ||
5638 | _restrictMinMax: function(inst, date) { | ||
5639 | var minDate = this._getMinMaxDate(inst, "min"), | ||
5640 | maxDate = this._getMinMaxDate(inst, "max"), | ||
5641 | newDate = (minDate && date < minDate ? minDate : date); | ||
5642 | return (maxDate && newDate > maxDate ? maxDate : newDate); | ||
5643 | }, | ||
5644 | |||
5645 | /* Notify change of month/year. */ | ||
5646 | _notifyChange: function(inst) { | ||
5647 | var onChange = this._get(inst, "onChangeMonthYear"); | ||
5648 | if (onChange) { | ||
5649 | onChange.apply((inst.input ? inst.input[0] : null), | ||
5650 | [inst.selectedYear, inst.selectedMonth + 1, inst]); | ||
5651 | } | ||
5652 | }, | ||
5653 | |||
5654 | /* Determine the number of months to show. */ | ||
5655 | _getNumberOfMonths: function(inst) { | ||
5656 | var numMonths = this._get(inst, "numberOfMonths"); | ||
5657 | return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); | ||
5658 | }, | ||
5659 | |||
5660 | /* Determine the current maximum date - ensure no time components are set. */ | ||
5661 | _getMinMaxDate: function(inst, minMax) { | ||
5662 | return this._determineDate(inst, this._get(inst, minMax + "Date"), null); | ||
5663 | }, | ||
5664 | |||
5665 | /* Find the number of days in a given month. */ | ||
5666 | _getDaysInMonth: function(year, month) { | ||
5667 | return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); | ||
5668 | }, | ||
5669 | |||
5670 | /* Find the day of the week of the first of a month. */ | ||
5671 | _getFirstDayOfMonth: function(year, month) { | ||
5672 | return new Date(year, month, 1).getDay(); | ||
5673 | }, | ||
5674 | |||
5675 | /* Determines if we should allow a "next/prev" month display change. */ | ||
5676 | _canAdjustMonth: function(inst, offset, curYear, curMonth) { | ||
5677 | var numMonths = this._getNumberOfMonths(inst), | ||
5678 | date = this._daylightSavingAdjust(new Date(curYear, | ||
5679 | curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); | ||
5680 | |||
5681 | if (offset < 0) { | ||
5682 | date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); | ||
5683 | } | ||
5684 | return this._isInRange(inst, date); | ||
5685 | }, | ||
5686 | |||
5687 | /* Is the given date in the accepted range? */ | ||
5688 | _isInRange: function(inst, date) { | ||
5689 | var yearSplit, currentYear, | ||
5690 | minDate = this._getMinMaxDate(inst, "min"), | ||
5691 | maxDate = this._getMinMaxDate(inst, "max"), | ||
5692 | minYear = null, | ||
5693 | maxYear = null, | ||
5694 | years = this._get(inst, "yearRange"); | ||
5695 | if (years){ | ||
5696 | yearSplit = years.split(":"); | ||
5697 | currentYear = new Date().getFullYear(); | ||
5698 | minYear = parseInt(yearSplit[0], 10); | ||
5699 | maxYear = parseInt(yearSplit[1], 10); | ||
5700 | if ( yearSplit[0].match(/[+\-].*/) ) { | ||
5701 | minYear += currentYear; | ||
5702 | } | ||
5703 | if ( yearSplit[1].match(/[+\-].*/) ) { | ||
5704 | maxYear += currentYear; | ||
5705 | } | ||
5706 | } | ||
5707 | |||
5708 | return ((!minDate || date.getTime() >= minDate.getTime()) && | ||
5709 | (!maxDate || date.getTime() <= maxDate.getTime()) && | ||
5710 | (!minYear || date.getFullYear() >= minYear) && | ||
5711 | (!maxYear || date.getFullYear() <= maxYear)); | ||
5712 | }, | ||
5713 | |||
5714 | /* Provide the configuration settings for formatting/parsing. */ | ||
5715 | _getFormatConfig: function(inst) { | ||
5716 | var shortYearCutoff = this._get(inst, "shortYearCutoff"); | ||
5717 | shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : | ||
5718 | new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); | ||
5719 | return {shortYearCutoff: shortYearCutoff, | ||
5720 | dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), | ||
5721 | monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; | ||
5722 | }, | ||
5723 | |||
5724 | /* Format the given date for display. */ | ||
5725 | _formatDate: function(inst, day, month, year) { | ||
5726 | if (!day) { | ||
5727 | inst.currentDay = inst.selectedDay; | ||
5728 | inst.currentMonth = inst.selectedMonth; | ||
5729 | inst.currentYear = inst.selectedYear; | ||
5730 | } | ||
5731 | var date = (day ? (typeof day === "object" ? day : | ||
5732 | this._daylightSavingAdjust(new Date(year, month, day))) : | ||
5733 | this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); | ||
5734 | return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); | ||
5735 | } | ||
5736 | }); | ||
5737 | |||
5738 | /* | ||
5739 | * Bind hover events for datepicker elements. | ||
5740 | * Done via delegate so the binding only occurs once in the lifetime of the parent div. | ||
5741 | * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. | ||
5742 | */ | ||
5743 | function datepicker_bindHover(dpDiv) { | ||
5744 | var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; | ||
5745 | return dpDiv.delegate(selector, "mouseout", function() { | ||
5746 | $(this).removeClass("ui-state-hover"); | ||
5747 | if (this.className.indexOf("ui-datepicker-prev") !== -1) { | ||
5748 | $(this).removeClass("ui-datepicker-prev-hover"); | ||
5749 | } | ||
5750 | if (this.className.indexOf("ui-datepicker-next") !== -1) { | ||
5751 | $(this).removeClass("ui-datepicker-next-hover"); | ||
5752 | } | ||
5753 | }) | ||
5754 | .delegate( selector, "mouseover", datepicker_handleMouseover ); | ||
5755 | } | ||
5756 | |||
5757 | function datepicker_handleMouseover() { | ||
5758 | if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { | ||
5759 | $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); | ||
5760 | $(this).addClass("ui-state-hover"); | ||
5761 | if (this.className.indexOf("ui-datepicker-prev") !== -1) { | ||
5762 | $(this).addClass("ui-datepicker-prev-hover"); | ||
5763 | } | ||
5764 | if (this.className.indexOf("ui-datepicker-next") !== -1) { | ||
5765 | $(this).addClass("ui-datepicker-next-hover"); | ||
5766 | } | ||
5767 | } | ||
5768 | } | ||
5769 | |||
5770 | /* jQuery extend now ignores nulls! */ | ||
5771 | function datepicker_extendRemove(target, props) { | ||
5772 | $.extend(target, props); | ||
5773 | for (var name in props) { | ||
5774 | if (props[name] == null) { | ||
5775 | target[name] = props[name]; | ||
5776 | } | ||
5777 | } | ||
5778 | return target; | ||
5779 | } | ||
5780 | |||
5781 | /* Invoke the datepicker functionality. | ||
5782 | @param options string - a command, optionally followed by additional parameters or | ||
5783 | Object - settings for attaching new datepicker functionality | ||
5784 | @return jQuery object */ | ||
5785 | $.fn.datepicker = function(options){ | ||
5786 | |||
5787 | /* Verify an empty collection wasn't passed - Fixes #6976 */ | ||
5788 | if ( !this.length ) { | ||
5789 | return this; | ||
5790 | } | ||
5791 | |||
5792 | /* Initialise the date picker. */ | ||
5793 | if (!$.datepicker.initialized) { | ||
5794 | $(document).mousedown($.datepicker._checkExternalClick); | ||
5795 | $.datepicker.initialized = true; | ||
5796 | } | ||
5797 | |||
5798 | /* Append datepicker main container to body if not exist. */ | ||
5799 | if ($("#"+$.datepicker._mainDivId).length === 0) { | ||
5800 | $("body").append($.datepicker.dpDiv); | ||
5801 | } | ||
5802 | |||
5803 | var otherArgs = Array.prototype.slice.call(arguments, 1); | ||
5804 | if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { | ||
5805 | return $.datepicker["_" + options + "Datepicker"]. | ||
5806 | apply($.datepicker, [this[0]].concat(otherArgs)); | ||
5807 | } | ||
5808 | if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { | ||
5809 | return $.datepicker["_" + options + "Datepicker"]. | ||
5810 | apply($.datepicker, [this[0]].concat(otherArgs)); | ||
5811 | } | ||
5812 | return this.each(function() { | ||
5813 | typeof options === "string" ? | ||
5814 | $.datepicker["_" + options + "Datepicker"]. | ||
5815 | apply($.datepicker, [this].concat(otherArgs)) : | ||
5816 | $.datepicker._attachDatepicker(this, options); | ||
5817 | }); | ||
5818 | }; | ||
5819 | |||
5820 | $.datepicker = new Datepicker(); // singleton instance | ||
5821 | $.datepicker.initialized = false; | ||
5822 | $.datepicker.uuid = new Date().getTime(); | ||
5823 | $.datepicker.version = "1.11.2"; | ||
5824 | |||
5825 | var datepicker = $.datepicker; | ||
5826 | |||
5827 | |||
5828 | /*! | ||
5829 | * jQuery UI Draggable 1.11.2 | ||
5830 | * http://jqueryui.com | ||
5831 | * | ||
5832 | * Copyright 2014 jQuery Foundation and other contributors | ||
5833 | * Released under the MIT license. | ||
5834 | * http://jquery.org/license | ||
5835 | * | ||
5836 | * http://api.jqueryui.com/draggable/ | ||
5837 | */ | ||
5838 | |||
5839 | |||
5840 | $.widget("ui.draggable", $.ui.mouse, { | ||
5841 | version: "1.11.2", | ||
5842 | widgetEventPrefix: "drag", | ||
5843 | options: { | ||
5844 | addClasses: true, | ||
5845 | appendTo: "parent", | ||
5846 | axis: false, | ||
5847 | connectToSortable: false, | ||
5848 | containment: false, | ||
5849 | cursor: "auto", | ||
5850 | cursorAt: false, | ||
5851 | grid: false, | ||
5852 | handle: false, | ||
5853 | helper: "original", | ||
5854 | iframeFix: false, | ||
5855 | opacity: false, | ||
5856 | refreshPositions: false, | ||
5857 | revert: false, | ||
5858 | revertDuration: 500, | ||
5859 | scope: "default", | ||
5860 | scroll: true, | ||
5861 | scrollSensitivity: 20, | ||
5862 | scrollSpeed: 20, | ||
5863 | snap: false, | ||
5864 | snapMode: "both", | ||
5865 | snapTolerance: 20, | ||
5866 | stack: false, | ||
5867 | zIndex: false, | ||
5868 | |||
5869 | // callbacks | ||
5870 | drag: null, | ||
5871 | start: null, | ||
5872 | stop: null | ||
5873 | }, | ||
5874 | _create: function() { | ||
5875 | |||
5876 | if ( this.options.helper === "original" ) { | ||
5877 | this._setPositionRelative(); | ||
5878 | } | ||
5879 | if (this.options.addClasses){ | ||
5880 | this.element.addClass("ui-draggable"); | ||
5881 | } | ||
5882 | if (this.options.disabled){ | ||
5883 | this.element.addClass("ui-draggable-disabled"); | ||
5884 | } | ||
5885 | this._setHandleClassName(); | ||
5886 | |||
5887 | this._mouseInit(); | ||
5888 | }, | ||
5889 | |||
5890 | _setOption: function( key, value ) { | ||
5891 | this._super( key, value ); | ||
5892 | if ( key === "handle" ) { | ||
5893 | this._removeHandleClassName(); | ||
5894 | this._setHandleClassName(); | ||
5895 | } | ||
5896 | }, | ||
5897 | |||
5898 | _destroy: function() { | ||
5899 | if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { | ||
5900 | this.destroyOnClear = true; | ||
5901 | return; | ||
5902 | } | ||
5903 | this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); | ||
5904 | this._removeHandleClassName(); | ||
5905 | this._mouseDestroy(); | ||
5906 | }, | ||
5907 | |||
5908 | _mouseCapture: function(event) { | ||
5909 | var o = this.options; | ||
5910 | |||
5911 | this._blurActiveElement( event ); | ||
5912 | |||
5913 | // among others, prevent a drag on a resizable-handle | ||
5914 | if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { | ||
5915 | return false; | ||
5916 | } | ||
5917 | |||
5918 | //Quit if we're not on a valid handle | ||
5919 | this.handle = this._getHandle(event); | ||
5920 | if (!this.handle) { | ||
5921 | return false; | ||
5922 | } | ||
5923 | |||
5924 | this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); | ||
5925 | |||
5926 | return true; | ||
5927 | |||
5928 | }, | ||
5929 | |||
5930 | _blockFrames: function( selector ) { | ||
5931 | this.iframeBlocks = this.document.find( selector ).map(function() { | ||
5932 | var iframe = $( this ); | ||
5933 | |||
5934 | return $( "<div>" ) | ||
5935 | .css( "position", "absolute" ) | ||
5936 | .appendTo( iframe.parent() ) | ||
5937 | .outerWidth( iframe.outerWidth() ) | ||
5938 | .outerHeight( iframe.outerHeight() ) | ||
5939 | .offset( iframe.offset() )[ 0 ]; | ||
5940 | }); | ||
5941 | }, | ||
5942 | |||
5943 | _unblockFrames: function() { | ||
5944 | if ( this.iframeBlocks ) { | ||
5945 | this.iframeBlocks.remove(); | ||
5946 | delete this.iframeBlocks; | ||
5947 | } | ||
5948 | }, | ||
5949 | |||
5950 | _blurActiveElement: function( event ) { | ||
5951 | var document = this.document[ 0 ]; | ||
5952 | |||
5953 | // Only need to blur if the event occurred on the draggable itself, see #10527 | ||
5954 | if ( !this.handleElement.is( event.target ) ) { | ||
5955 | return; | ||
5956 | } | ||
5957 | |||
5958 | // support: IE9 | ||
5959 | // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> | ||
5960 | try { | ||
5961 | |||
5962 | // Support: IE9, IE10 | ||
5963 | // If the <body> is blurred, IE will switch windows, see #9520 | ||
5964 | if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) { | ||
5965 | |||
5966 | // Blur any element that currently has focus, see #4261 | ||
5967 | $( document.activeElement ).blur(); | ||
5968 | } | ||
5969 | } catch ( error ) {} | ||
5970 | }, | ||
5971 | |||
5972 | _mouseStart: function(event) { | ||
5973 | |||
5974 | var o = this.options; | ||
5975 | |||
5976 | //Create and append the visible helper | ||
5977 | this.helper = this._createHelper(event); | ||
5978 | |||
5979 | this.helper.addClass("ui-draggable-dragging"); | ||
5980 | |||
5981 | //Cache the helper size | ||
5982 | this._cacheHelperProportions(); | ||
5983 | |||
5984 | //If ddmanager is used for droppables, set the global draggable | ||
5985 | if ($.ui.ddmanager) { | ||
5986 | $.ui.ddmanager.current = this; | ||
5987 | } | ||
5988 | |||
5989 | /* | ||
5990 | * - Position generation - | ||
5991 | * This block generates everything position related - it's the core of draggables. | ||
5992 | */ | ||
5993 | |||
5994 | //Cache the margins of the original element | ||
5995 | this._cacheMargins(); | ||
5996 | |||
5997 | //Store the helper's css position | ||
5998 | this.cssPosition = this.helper.css( "position" ); | ||
5999 | this.scrollParent = this.helper.scrollParent( true ); | ||
6000 | this.offsetParent = this.helper.offsetParent(); | ||
6001 | this.hasFixedAncestor = this.helper.parents().filter(function() { | ||
6002 | return $( this ).css( "position" ) === "fixed"; | ||
6003 | }).length > 0; | ||
6004 | |||
6005 | //The element's absolute position on the page minus margins | ||
6006 | this.positionAbs = this.element.offset(); | ||
6007 | this._refreshOffsets( event ); | ||
6008 | |||
6009 | //Generate the original position | ||
6010 | this.originalPosition = this.position = this._generatePosition( event, false ); | ||
6011 | this.originalPageX = event.pageX; | ||
6012 | this.originalPageY = event.pageY; | ||
6013 | |||
6014 | //Adjust the mouse offset relative to the helper if "cursorAt" is supplied | ||
6015 | (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); | ||
6016 | |||
6017 | //Set a containment if given in the options | ||
6018 | this._setContainment(); | ||
6019 | |||
6020 | //Trigger event + callbacks | ||
6021 | if (this._trigger("start", event) === false) { | ||
6022 | this._clear(); | ||
6023 | return false; | ||
6024 | } | ||
6025 | |||
6026 | //Recache the helper size | ||
6027 | this._cacheHelperProportions(); | ||
6028 | |||
6029 | //Prepare the droppable offsets | ||
6030 | if ($.ui.ddmanager && !o.dropBehaviour) { | ||
6031 | $.ui.ddmanager.prepareOffsets(this, event); | ||
6032 | } | ||
6033 | |||
6034 | // Reset helper's right/bottom css if they're set and set explicit width/height instead | ||
6035 | // as this prevents resizing of elements with right/bottom set (see #7772) | ||
6036 | this._normalizeRightBottom(); | ||
6037 | |||
6038 | this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position | ||
6039 | |||
6040 | //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) | ||
6041 | if ( $.ui.ddmanager ) { | ||
6042 | $.ui.ddmanager.dragStart(this, event); | ||
6043 | } | ||
6044 | |||
6045 | return true; | ||
6046 | }, | ||
6047 | |||
6048 | _refreshOffsets: function( event ) { | ||
6049 | this.offset = { | ||
6050 | top: this.positionAbs.top - this.margins.top, | ||
6051 | left: this.positionAbs.left - this.margins.left, | ||
6052 | scroll: false, | ||
6053 | parent: this._getParentOffset(), | ||
6054 | relative: this._getRelativeOffset() | ||
6055 | }; | ||
6056 | |||
6057 | this.offset.click = { | ||
6058 | left: event.pageX - this.offset.left, | ||
6059 | top: event.pageY - this.offset.top | ||
6060 | }; | ||
6061 | }, | ||
6062 | |||
6063 | _mouseDrag: function(event, noPropagation) { | ||
6064 | // reset any necessary cached properties (see #5009) | ||
6065 | if ( this.hasFixedAncestor ) { | ||
6066 | this.offset.parent = this._getParentOffset(); | ||
6067 | } | ||
6068 | |||
6069 | //Compute the helpers position | ||
6070 | this.position = this._generatePosition( event, true ); | ||
6071 | this.positionAbs = this._convertPositionTo("absolute"); | ||
6072 | |||
6073 | //Call plugins and callbacks and use the resulting position if something is returned | ||
6074 | if (!noPropagation) { | ||
6075 | var ui = this._uiHash(); | ||
6076 | if (this._trigger("drag", event, ui) === false) { | ||
6077 | this._mouseUp({}); | ||
6078 | return false; | ||
6079 | } | ||
6080 | this.position = ui.position; | ||
6081 | } | ||
6082 | |||
6083 | this.helper[ 0 ].style.left = this.position.left + "px"; | ||
6084 | this.helper[ 0 ].style.top = this.position.top + "px"; | ||
6085 | |||
6086 | if ($.ui.ddmanager) { | ||
6087 | $.ui.ddmanager.drag(this, event); | ||
6088 | } | ||
6089 | |||
6090 | return false; | ||
6091 | }, | ||
6092 | |||
6093 | _mouseStop: function(event) { | ||
6094 | |||
6095 | //If we are using droppables, inform the manager about the drop | ||
6096 | var that = this, | ||
6097 | dropped = false; | ||
6098 | if ($.ui.ddmanager && !this.options.dropBehaviour) { | ||
6099 | dropped = $.ui.ddmanager.drop(this, event); | ||
6100 | } | ||
6101 | |||
6102 | //if a drop comes from outside (a sortable) | ||
6103 | if (this.dropped) { | ||
6104 | dropped = this.dropped; | ||
6105 | this.dropped = false; | ||
6106 | } | ||
6107 | |||
6108 | if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { | ||
6109 | $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { | ||
6110 | if (that._trigger("stop", event) !== false) { | ||
6111 | that._clear(); | ||
6112 | } | ||
6113 | }); | ||
6114 | } else { | ||
6115 | if (this._trigger("stop", event) !== false) { | ||
6116 | this._clear(); | ||
6117 | } | ||
6118 | } | ||
6119 | |||
6120 | return false; | ||
6121 | }, | ||
6122 | |||
6123 | _mouseUp: function( event ) { | ||
6124 | this._unblockFrames(); | ||
6125 | |||
6126 | //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) | ||
6127 | if ( $.ui.ddmanager ) { | ||
6128 | $.ui.ddmanager.dragStop(this, event); | ||
6129 | } | ||
6130 | |||
6131 | // Only need to focus if the event occurred on the draggable itself, see #10527 | ||
6132 | if ( this.handleElement.is( event.target ) ) { | ||
6133 | // The interaction is over; whether or not the click resulted in a drag, focus the element | ||
6134 | this.element.focus(); | ||
6135 | } | ||
6136 | |||
6137 | return $.ui.mouse.prototype._mouseUp.call(this, event); | ||
6138 | }, | ||
6139 | |||
6140 | cancel: function() { | ||
6141 | |||
6142 | if (this.helper.is(".ui-draggable-dragging")) { | ||
6143 | this._mouseUp({}); | ||
6144 | } else { | ||
6145 | this._clear(); | ||
6146 | } | ||
6147 | |||
6148 | return this; | ||
6149 | |||
6150 | }, | ||
6151 | |||
6152 | _getHandle: function(event) { | ||
6153 | return this.options.handle ? | ||
6154 | !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : | ||
6155 | true; | ||
6156 | }, | ||
6157 | |||
6158 | _setHandleClassName: function() { | ||
6159 | this.handleElement = this.options.handle ? | ||
6160 | this.element.find( this.options.handle ) : this.element; | ||
6161 | this.handleElement.addClass( "ui-draggable-handle" ); | ||
6162 | }, | ||
6163 | |||
6164 | _removeHandleClassName: function() { | ||
6165 | this.handleElement.removeClass( "ui-draggable-handle" ); | ||
6166 | }, | ||
6167 | |||
6168 | _createHelper: function(event) { | ||
6169 | |||
6170 | var o = this.options, | ||
6171 | helperIsFunction = $.isFunction( o.helper ), | ||
6172 | helper = helperIsFunction ? | ||
6173 | $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : | ||
6174 | ( o.helper === "clone" ? | ||
6175 | this.element.clone().removeAttr( "id" ) : | ||
6176 | this.element ); | ||
6177 | |||
6178 | if (!helper.parents("body").length) { | ||
6179 | helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); | ||
6180 | } | ||
6181 | |||
6182 | // http://bugs.jqueryui.com/ticket/9446 | ||
6183 | // a helper function can return the original element | ||
6184 | // which wouldn't have been set to relative in _create | ||
6185 | if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { | ||
6186 | this._setPositionRelative(); | ||
6187 | } | ||
6188 | |||
6189 | if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { | ||
6190 | helper.css("position", "absolute"); | ||
6191 | } | ||
6192 | |||
6193 | return helper; | ||
6194 | |||
6195 | }, | ||
6196 | |||
6197 | _setPositionRelative: function() { | ||
6198 | if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { | ||
6199 | this.element[ 0 ].style.position = "relative"; | ||
6200 | } | ||
6201 | }, | ||
6202 | |||
6203 | _adjustOffsetFromHelper: function(obj) { | ||
6204 | if (typeof obj === "string") { | ||
6205 | obj = obj.split(" "); | ||
6206 | } | ||
6207 | if ($.isArray(obj)) { | ||
6208 | obj = { left: +obj[0], top: +obj[1] || 0 }; | ||
6209 | } | ||
6210 | if ("left" in obj) { | ||
6211 | this.offset.click.left = obj.left + this.margins.left; | ||
6212 | } | ||
6213 | if ("right" in obj) { | ||
6214 | this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; | ||
6215 | } | ||
6216 | if ("top" in obj) { | ||
6217 | this.offset.click.top = obj.top + this.margins.top; | ||
6218 | } | ||
6219 | if ("bottom" in obj) { | ||
6220 | this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; | ||
6221 | } | ||
6222 | }, | ||
6223 | |||
6224 | _isRootNode: function( element ) { | ||
6225 | return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; | ||
6226 | }, | ||
6227 | |||
6228 | _getParentOffset: function() { | ||
6229 | |||
6230 | //Get the offsetParent and cache its position | ||
6231 | var po = this.offsetParent.offset(), | ||
6232 | document = this.document[ 0 ]; | ||
6233 | |||
6234 | // This is a special case where we need to modify a offset calculated on start, since the following happened: | ||
6235 | // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent | ||
6236 | // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that | ||
6237 | // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag | ||
6238 | if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { | ||
6239 | po.left += this.scrollParent.scrollLeft(); | ||
6240 | po.top += this.scrollParent.scrollTop(); | ||
6241 | } | ||
6242 | |||
6243 | if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { | ||
6244 | po = { top: 0, left: 0 }; | ||
6245 | } | ||
6246 | |||
6247 | return { | ||
6248 | top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), | ||
6249 | left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) | ||
6250 | }; | ||
6251 | |||
6252 | }, | ||
6253 | |||
6254 | _getRelativeOffset: function() { | ||
6255 | if ( this.cssPosition !== "relative" ) { | ||
6256 | return { top: 0, left: 0 }; | ||
6257 | } | ||
6258 | |||
6259 | var p = this.element.position(), | ||
6260 | scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); | ||
6261 | |||
6262 | return { | ||
6263 | top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), | ||
6264 | left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) | ||
6265 | }; | ||
6266 | |||
6267 | }, | ||
6268 | |||
6269 | _cacheMargins: function() { | ||
6270 | this.margins = { | ||
6271 | left: (parseInt(this.element.css("marginLeft"), 10) || 0), | ||
6272 | top: (parseInt(this.element.css("marginTop"), 10) || 0), | ||
6273 | right: (parseInt(this.element.css("marginRight"), 10) || 0), | ||
6274 | bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) | ||
6275 | }; | ||
6276 | }, | ||
6277 | |||
6278 | _cacheHelperProportions: function() { | ||
6279 | this.helperProportions = { | ||
6280 | width: this.helper.outerWidth(), | ||
6281 | height: this.helper.outerHeight() | ||
6282 | }; | ||
6283 | }, | ||
6284 | |||
6285 | _setContainment: function() { | ||
6286 | |||
6287 | var isUserScrollable, c, ce, | ||
6288 | o = this.options, | ||
6289 | document = this.document[ 0 ]; | ||
6290 | |||
6291 | this.relativeContainer = null; | ||
6292 | |||
6293 | if ( !o.containment ) { | ||
6294 | this.containment = null; | ||
6295 | return; | ||
6296 | } | ||
6297 | |||
6298 | if ( o.containment === "window" ) { | ||
6299 | this.containment = [ | ||
6300 | $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, | ||
6301 | $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, | ||
6302 | $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left, | ||
6303 | $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top | ||
6304 | ]; | ||
6305 | return; | ||
6306 | } | ||
6307 | |||
6308 | if ( o.containment === "document") { | ||
6309 | this.containment = [ | ||
6310 | 0, | ||
6311 | 0, | ||
6312 | $( document ).width() - this.helperProportions.width - this.margins.left, | ||
6313 | ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top | ||
6314 | ]; | ||
6315 | return; | ||
6316 | } | ||
6317 | |||
6318 | if ( o.containment.constructor === Array ) { | ||
6319 | this.containment = o.containment; | ||
6320 | return; | ||
6321 | } | ||
6322 | |||
6323 | if ( o.containment === "parent" ) { | ||
6324 | o.containment = this.helper[ 0 ].parentNode; | ||
6325 | } | ||
6326 | |||
6327 | c = $( o.containment ); | ||
6328 | ce = c[ 0 ]; | ||
6329 | |||
6330 | if ( !ce ) { | ||
6331 | return; | ||
6332 | } | ||
6333 | |||
6334 | isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); | ||
6335 | |||
6336 | this.containment = [ | ||
6337 | ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), | ||
6338 | ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), | ||
6339 | ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - | ||
6340 | ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - | ||
6341 | ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - | ||
6342 | this.helperProportions.width - | ||
6343 | this.margins.left - | ||
6344 | this.margins.right, | ||
6345 | ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - | ||
6346 | ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - | ||
6347 | ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - | ||
6348 | this.helperProportions.height - | ||
6349 | this.margins.top - | ||
6350 | this.margins.bottom | ||
6351 | ]; | ||
6352 | this.relativeContainer = c; | ||
6353 | }, | ||
6354 | |||
6355 | _convertPositionTo: function(d, pos) { | ||
6356 | |||
6357 | if (!pos) { | ||
6358 | pos = this.position; | ||
6359 | } | ||
6360 | |||
6361 | var mod = d === "absolute" ? 1 : -1, | ||
6362 | scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); | ||
6363 | |||
6364 | return { | ||
6365 | top: ( | ||
6366 | pos.top + // The absolute mouse position | ||
6367 | this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent | ||
6368 | this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) | ||
6369 | ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod) | ||
6370 | ), | ||
6371 | left: ( | ||
6372 | pos.left + // The absolute mouse position | ||
6373 | this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent | ||
6374 | this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) | ||
6375 | ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod) | ||
6376 | ) | ||
6377 | }; | ||
6378 | |||
6379 | }, | ||
6380 | |||
6381 | _generatePosition: function( event, constrainPosition ) { | ||
6382 | |||
6383 | var containment, co, top, left, | ||
6384 | o = this.options, | ||
6385 | scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), | ||
6386 | pageX = event.pageX, | ||
6387 | pageY = event.pageY; | ||
6388 | |||
6389 | // Cache the scroll | ||
6390 | if ( !scrollIsRootNode || !this.offset.scroll ) { | ||
6391 | this.offset.scroll = { | ||
6392 | top: this.scrollParent.scrollTop(), | ||
6393 | left: this.scrollParent.scrollLeft() | ||
6394 | }; | ||
6395 | } | ||
6396 | |||
6397 | /* | ||
6398 | * - Position constraining - | ||
6399 | * Constrain the position to a mix of grid, containment. | ||
6400 | */ | ||
6401 | |||
6402 | // If we are not dragging yet, we won't check for options | ||
6403 | if ( constrainPosition ) { | ||
6404 | if ( this.containment ) { | ||
6405 | if ( this.relativeContainer ){ | ||
6406 | co = this.relativeContainer.offset(); | ||
6407 | containment = [ | ||
6408 | this.containment[ 0 ] + co.left, | ||
6409 | this.containment[ 1 ] + co.top, | ||
6410 | this.containment[ 2 ] + co.left, | ||
6411 | this.containment[ 3 ] + co.top | ||
6412 | ]; | ||
6413 | } else { | ||
6414 | containment = this.containment; | ||
6415 | } | ||
6416 | |||
6417 | if (event.pageX - this.offset.click.left < containment[0]) { | ||
6418 | pageX = containment[0] + this.offset.click.left; | ||
6419 | } | ||
6420 | if (event.pageY - this.offset.click.top < containment[1]) { | ||
6421 | pageY = containment[1] + this.offset.click.top; | ||
6422 | } | ||
6423 | if (event.pageX - this.offset.click.left > containment[2]) { | ||
6424 | pageX = containment[2] + this.offset.click.left; | ||
6425 | } | ||
6426 | if (event.pageY - this.offset.click.top > containment[3]) { | ||
6427 | pageY = containment[3] + this.offset.click.top; | ||
6428 | } | ||
6429 | } | ||
6430 | |||
6431 | if (o.grid) { | ||
6432 | //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) | ||
6433 | top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; | ||
6434 | pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; | ||
6435 | |||
6436 | left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; | ||
6437 | pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; | ||
6438 | } | ||
6439 | |||
6440 | if ( o.axis === "y" ) { | ||
6441 | pageX = this.originalPageX; | ||
6442 | } | ||
6443 | |||
6444 | if ( o.axis === "x" ) { | ||
6445 | pageY = this.originalPageY; | ||
6446 | } | ||
6447 | } | ||
6448 | |||
6449 | return { | ||
6450 | top: ( | ||
6451 | pageY - // The absolute mouse position | ||
6452 | this.offset.click.top - // Click offset (relative to the element) | ||
6453 | this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent | ||
6454 | this.offset.parent.top + // The offsetParent's offset without borders (offset + border) | ||
6455 | ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) | ||
6456 | ), | ||
6457 | left: ( | ||
6458 | pageX - // The absolute mouse position | ||
6459 | this.offset.click.left - // Click offset (relative to the element) | ||
6460 | this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent | ||
6461 | this.offset.parent.left + // The offsetParent's offset without borders (offset + border) | ||
6462 | ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) | ||
6463 | ) | ||
6464 | }; | ||
6465 | |||
6466 | }, | ||
6467 | |||
6468 | _clear: function() { | ||
6469 | this.helper.removeClass("ui-draggable-dragging"); | ||
6470 | if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { | ||
6471 | this.helper.remove(); | ||
6472 | } | ||
6473 | this.helper = null; | ||
6474 | this.cancelHelperRemoval = false; | ||
6475 | if ( this.destroyOnClear ) { | ||
6476 | this.destroy(); | ||
6477 | } | ||
6478 | }, | ||
6479 | |||
6480 | _normalizeRightBottom: function() { | ||
6481 | if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) { | ||
6482 | this.helper.width( this.helper.width() ); | ||
6483 | this.helper.css( "right", "auto" ); | ||
6484 | } | ||
6485 | if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) { | ||
6486 | this.helper.height( this.helper.height() ); | ||
6487 | this.helper.css( "bottom", "auto" ); | ||
6488 | } | ||
6489 | }, | ||
6490 | |||
6491 | // From now on bulk stuff - mainly helpers | ||
6492 | |||
6493 | _trigger: function( type, event, ui ) { | ||
6494 | ui = ui || this._uiHash(); | ||
6495 | $.ui.plugin.call( this, type, [ event, ui, this ], true ); | ||
6496 | |||
6497 | // Absolute position and offset (see #6884 ) have to be recalculated after plugins | ||
6498 | if ( /^(drag|start|stop)/.test( type ) ) { | ||
6499 | this.positionAbs = this._convertPositionTo( "absolute" ); | ||
6500 | ui.offset = this.positionAbs; | ||
6501 | } | ||
6502 | return $.Widget.prototype._trigger.call( this, type, event, ui ); | ||
6503 | }, | ||
6504 | |||
6505 | plugins: {}, | ||
6506 | |||
6507 | _uiHash: function() { | ||
6508 | return { | ||
6509 | helper: this.helper, | ||
6510 | position: this.position, | ||
6511 | originalPosition: this.originalPosition, | ||
6512 | offset: this.positionAbs | ||
6513 | }; | ||
6514 | } | ||
6515 | |||
6516 | }); | ||
6517 | |||
6518 | $.ui.plugin.add( "draggable", "connectToSortable", { | ||
6519 | start: function( event, ui, draggable ) { | ||
6520 | var uiSortable = $.extend( {}, ui, { | ||
6521 | item: draggable.element | ||
6522 | }); | ||
6523 | |||
6524 | draggable.sortables = []; | ||
6525 | $( draggable.options.connectToSortable ).each(function() { | ||
6526 | var sortable = $( this ).sortable( "instance" ); | ||
6527 | |||
6528 | if ( sortable && !sortable.options.disabled ) { | ||
6529 | draggable.sortables.push( sortable ); | ||
6530 | |||
6531 | // refreshPositions is called at drag start to refresh the containerCache | ||
6532 | // which is used in drag. This ensures it's initialized and synchronized | ||
6533 | // with any changes that might have happened on the page since initialization. | ||
6534 | sortable.refreshPositions(); | ||
6535 | sortable._trigger("activate", event, uiSortable); | ||
6536 | } | ||
6537 | }); | ||
6538 | }, | ||
6539 | stop: function( event, ui, draggable ) { | ||
6540 | var uiSortable = $.extend( {}, ui, { | ||
6541 | item: draggable.element | ||
6542 | }); | ||
6543 | |||
6544 | draggable.cancelHelperRemoval = false; | ||
6545 | |||
6546 | $.each( draggable.sortables, function() { | ||
6547 | var sortable = this; | ||
6548 | |||
6549 | if ( sortable.isOver ) { | ||
6550 | sortable.isOver = 0; | ||
6551 | |||
6552 | // Allow this sortable to handle removing the helper | ||
6553 | draggable.cancelHelperRemoval = true; | ||
6554 | sortable.cancelHelperRemoval = false; | ||
6555 | |||
6556 | // Use _storedCSS To restore properties in the sortable, | ||
6557 | // as this also handles revert (#9675) since the draggable | ||
6558 | // may have modified them in unexpected ways (#8809) | ||
6559 | sortable._storedCSS = { | ||
6560 | position: sortable.placeholder.css( "position" ), | ||
6561 | top: sortable.placeholder.css( "top" ), | ||
6562 | left: sortable.placeholder.css( "left" ) | ||
6563 | }; | ||
6564 | |||
6565 | sortable._mouseStop(event); | ||
6566 | |||
6567 | // Once drag has ended, the sortable should return to using | ||
6568 | // its original helper, not the shared helper from draggable | ||
6569 | sortable.options.helper = sortable.options._helper; | ||
6570 | } else { | ||
6571 | // Prevent this Sortable from removing the helper. | ||
6572 | // However, don't set the draggable to remove the helper | ||
6573 | // either as another connected Sortable may yet handle the removal. | ||
6574 | sortable.cancelHelperRemoval = true; | ||
6575 | |||
6576 | sortable._trigger( "deactivate", event, uiSortable ); | ||
6577 | } | ||
6578 | }); | ||
6579 | }, | ||
6580 | drag: function( event, ui, draggable ) { | ||
6581 | $.each( draggable.sortables, function() { | ||
6582 | var innermostIntersecting = false, | ||
6583 | sortable = this; | ||
6584 | |||
6585 | // Copy over variables that sortable's _intersectsWith uses | ||
6586 | sortable.positionAbs = draggable.positionAbs; | ||
6587 | sortable.helperProportions = draggable.helperProportions; | ||
6588 | sortable.offset.click = draggable.offset.click; | ||
6589 | |||
6590 | if ( sortable._intersectsWith( sortable.containerCache ) ) { | ||
6591 | innermostIntersecting = true; | ||
6592 | |||
6593 | $.each( draggable.sortables, function() { | ||
6594 | // Copy over variables that sortable's _intersectsWith uses | ||
6595 | this.positionAbs = draggable.positionAbs; | ||
6596 | this.helperProportions = draggable.helperProportions; | ||
6597 | this.offset.click = draggable.offset.click; | ||
6598 | |||
6599 | if ( this !== sortable && | ||
6600 | this._intersectsWith( this.containerCache ) && | ||
6601 | $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { | ||
6602 | innermostIntersecting = false; | ||
6603 | } | ||
6604 | |||
6605 | return innermostIntersecting; | ||
6606 | }); | ||
6607 | } | ||
6608 | |||
6609 | if ( innermostIntersecting ) { | ||
6610 | // If it intersects, we use a little isOver variable and set it once, | ||
6611 | // so that the move-in stuff gets fired only once. | ||
6612 | if ( !sortable.isOver ) { | ||
6613 | sortable.isOver = 1; | ||
6614 | |||
6615 | sortable.currentItem = ui.helper | ||
6616 | .appendTo( sortable.element ) | ||
6617 | .data( "ui-sortable-item", true ); | ||
6618 | |||
6619 | // Store helper option to later restore it | ||
6620 | sortable.options._helper = sortable.options.helper; | ||
6621 | |||
6622 | sortable.options.helper = function() { | ||
6623 | return ui.helper[ 0 ]; | ||
6624 | }; | ||
6625 | |||
6626 | // Fire the start events of the sortable with our passed browser event, | ||
6627 | // and our own helper (so it doesn't create a new one) | ||
6628 | event.target = sortable.currentItem[ 0 ]; | ||
6629 | sortable._mouseCapture( event, true ); | ||
6630 | sortable._mouseStart( event, true, true ); | ||
6631 | |||
6632 | // Because the browser event is way off the new appended portlet, | ||
6633 | // modify necessary variables to reflect the changes | ||
6634 | sortable.offset.click.top = draggable.offset.click.top; | ||
6635 | sortable.offset.click.left = draggable.offset.click.left; | ||
6636 | sortable.offset.parent.left -= draggable.offset.parent.left - | ||
6637 | sortable.offset.parent.left; | ||
6638 | sortable.offset.parent.top -= draggable.offset.parent.top - | ||
6639 | sortable.offset.parent.top; | ||
6640 | |||
6641 | draggable._trigger( "toSortable", event ); | ||
6642 | |||
6643 | // Inform draggable that the helper is in a valid drop zone, | ||
6644 | // used solely in the revert option to handle "valid/invalid". | ||
6645 | draggable.dropped = sortable.element; | ||
6646 | |||
6647 | // Need to refreshPositions of all sortables in the case that | ||
6648 | // adding to one sortable changes the location of the other sortables (#9675) | ||
6649 | $.each( draggable.sortables, function() { | ||
6650 | this.refreshPositions(); | ||
6651 | }); | ||
6652 | |||
6653 | // hack so receive/update callbacks work (mostly) | ||
6654 | draggable.currentItem = draggable.element; | ||
6655 | sortable.fromOutside = draggable; | ||
6656 | } | ||
6657 | |||
6658 | if ( sortable.currentItem ) { | ||
6659 | sortable._mouseDrag( event ); | ||
6660 | // Copy the sortable's position because the draggable's can potentially reflect | ||
6661 | // a relative position, while sortable is always absolute, which the dragged | ||
6662 | // element has now become. (#8809) | ||
6663 | ui.position = sortable.position; | ||
6664 | } | ||
6665 | } else { | ||
6666 | // If it doesn't intersect with the sortable, and it intersected before, | ||
6667 | // we fake the drag stop of the sortable, but make sure it doesn't remove | ||
6668 | // the helper by using cancelHelperRemoval. | ||
6669 | if ( sortable.isOver ) { | ||
6670 | |||
6671 | sortable.isOver = 0; | ||
6672 | sortable.cancelHelperRemoval = true; | ||
6673 | |||
6674 | // Calling sortable's mouseStop would trigger a revert, | ||
6675 | // so revert must be temporarily false until after mouseStop is called. | ||
6676 | sortable.options._revert = sortable.options.revert; | ||
6677 | sortable.options.revert = false; | ||
6678 | |||
6679 | sortable._trigger( "out", event, sortable._uiHash( sortable ) ); | ||
6680 | sortable._mouseStop( event, true ); | ||
6681 | |||
6682 | // restore sortable behaviors that were modfied | ||
6683 | // when the draggable entered the sortable area (#9481) | ||
6684 | sortable.options.revert = sortable.options._revert; | ||
6685 | sortable.options.helper = sortable.options._helper; | ||
6686 | |||
6687 | if ( sortable.placeholder ) { | ||
6688 | sortable.placeholder.remove(); | ||
6689 | } | ||
6690 | |||
6691 | // Recalculate the draggable's offset considering the sortable | ||
6692 | // may have modified them in unexpected ways (#8809) | ||
6693 | draggable._refreshOffsets( event ); | ||
6694 | ui.position = draggable._generatePosition( event, true ); | ||
6695 | |||
6696 | draggable._trigger( "fromSortable", event ); | ||
6697 | |||
6698 | // Inform draggable that the helper is no longer in a valid drop zone | ||
6699 | draggable.dropped = false; | ||
6700 | |||
6701 | // Need to refreshPositions of all sortables just in case removing | ||
6702 | // from one sortable changes the location of other sortables (#9675) | ||
6703 | $.each( draggable.sortables, function() { | ||
6704 | this.refreshPositions(); | ||
6705 | }); | ||
6706 | } | ||
6707 | } | ||
6708 | }); | ||
6709 | } | ||
6710 | }); | ||
6711 | |||
6712 | $.ui.plugin.add("draggable", "cursor", { | ||
6713 | start: function( event, ui, instance ) { | ||
6714 | var t = $( "body" ), | ||
6715 | o = instance.options; | ||
6716 | |||
6717 | if (t.css("cursor")) { | ||
6718 | o._cursor = t.css("cursor"); | ||
6719 | } | ||
6720 | t.css("cursor", o.cursor); | ||
6721 | }, | ||
6722 | stop: function( event, ui, instance ) { | ||
6723 | var o = instance.options; | ||
6724 | if (o._cursor) { | ||
6725 | $("body").css("cursor", o._cursor); | ||
6726 | } | ||
6727 | } | ||
6728 | }); | ||
6729 | |||
6730 | $.ui.plugin.add("draggable", "opacity", { | ||
6731 | start: function( event, ui, instance ) { | ||
6732 | var t = $( ui.helper ), | ||
6733 | o = instance.options; | ||
6734 | if (t.css("opacity")) { | ||
6735 | o._opacity = t.css("opacity"); | ||
6736 | } | ||
6737 | t.css("opacity", o.opacity); | ||
6738 | }, | ||
6739 | stop: function( event, ui, instance ) { | ||
6740 | var o = instance.options; | ||
6741 | if (o._opacity) { | ||
6742 | $(ui.helper).css("opacity", o._opacity); | ||
6743 | } | ||
6744 | } | ||
6745 | }); | ||
6746 | |||
6747 | $.ui.plugin.add("draggable", "scroll", { | ||
6748 | start: function( event, ui, i ) { | ||
6749 | if ( !i.scrollParentNotHidden ) { | ||
6750 | i.scrollParentNotHidden = i.helper.scrollParent( false ); | ||
6751 | } | ||
6752 | |||
6753 | if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { | ||
6754 | i.overflowOffset = i.scrollParentNotHidden.offset(); | ||
6755 | } | ||
6756 | }, | ||
6757 | drag: function( event, ui, i ) { | ||
6758 | |||
6759 | var o = i.options, | ||
6760 | scrolled = false, | ||
6761 | scrollParent = i.scrollParentNotHidden[ 0 ], | ||
6762 | document = i.document[ 0 ]; | ||
6763 | |||
6764 | if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { | ||
6765 | if ( !o.axis || o.axis !== "x" ) { | ||
6766 | if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) { | ||
6767 | scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; | ||
6768 | } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { | ||
6769 | scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; | ||
6770 | } | ||
6771 | } | ||
6772 | |||
6773 | if ( !o.axis || o.axis !== "y" ) { | ||
6774 | if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) { | ||
6775 | scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; | ||
6776 | } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { | ||
6777 | scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; | ||
6778 | } | ||
6779 | } | ||
6780 | |||
6781 | } else { | ||
6782 | |||
6783 | if (!o.axis || o.axis !== "x") { | ||
6784 | if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { | ||
6785 | scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); | ||
6786 | } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { | ||
6787 | scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); | ||
6788 | } | ||
6789 | } | ||
6790 | |||
6791 | if (!o.axis || o.axis !== "y") { | ||
6792 | if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { | ||
6793 | scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); | ||
6794 | } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { | ||
6795 | scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); | ||
6796 | } | ||
6797 | } | ||
6798 | |||
6799 | } | ||
6800 | |||
6801 | if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { | ||
6802 | $.ui.ddmanager.prepareOffsets(i, event); | ||
6803 | } | ||
6804 | |||
6805 | } | ||
6806 | }); | ||
6807 | |||
6808 | $.ui.plugin.add("draggable", "snap", { | ||
6809 | start: function( event, ui, i ) { | ||
6810 | |||
6811 | var o = i.options; | ||
6812 | |||
6813 | i.snapElements = []; | ||
6814 | |||
6815 | $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { | ||
6816 | var $t = $(this), | ||
6817 | $o = $t.offset(); | ||
6818 | if (this !== i.element[0]) { | ||
6819 | i.snapElements.push({ | ||
6820 | item: this, | ||
6821 | width: $t.outerWidth(), height: $t.outerHeight(), | ||
6822 | top: $o.top, left: $o.left | ||
6823 | }); | ||
6824 | } | ||
6825 | }); | ||
6826 | |||
6827 | }, | ||
6828 | drag: function( event, ui, inst ) { | ||
6829 | |||
6830 | var ts, bs, ls, rs, l, r, t, b, i, first, | ||
6831 | o = inst.options, | ||
6832 | d = o.snapTolerance, | ||
6833 | x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, | ||
6834 | y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; | ||
6835 | |||
6836 | for (i = inst.snapElements.length - 1; i >= 0; i--){ | ||
6837 | |||
6838 | l = inst.snapElements[i].left - inst.margins.left; | ||
6839 | r = l + inst.snapElements[i].width; | ||
6840 | t = inst.snapElements[i].top - inst.margins.top; | ||
6841 | b = t + inst.snapElements[i].height; | ||
6842 | |||
6843 | if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { | ||
6844 | if (inst.snapElements[i].snapping) { | ||
6845 | (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); | ||
6846 | } | ||
6847 | inst.snapElements[i].snapping = false; | ||
6848 | continue; | ||
6849 | } | ||
6850 | |||
6851 | if (o.snapMode !== "inner") { | ||
6852 | ts = Math.abs(t - y2) <= d; | ||
6853 | bs = Math.abs(b - y1) <= d; | ||
6854 | ls = Math.abs(l - x2) <= d; | ||
6855 | rs = Math.abs(r - x1) <= d; | ||
6856 | if (ts) { | ||
6857 | ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top; | ||
6858 | } | ||
6859 | if (bs) { | ||
6860 | ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top; | ||
6861 | } | ||
6862 | if (ls) { | ||
6863 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left; | ||
6864 | } | ||
6865 | if (rs) { | ||
6866 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left; | ||
6867 | } | ||
6868 | } | ||
6869 | |||
6870 | first = (ts || bs || ls || rs); | ||
6871 | |||
6872 | if (o.snapMode !== "outer") { | ||
6873 | ts = Math.abs(t - y1) <= d; | ||
6874 | bs = Math.abs(b - y2) <= d; | ||
6875 | ls = Math.abs(l - x1) <= d; | ||
6876 | rs = Math.abs(r - x2) <= d; | ||
6877 | if (ts) { | ||
6878 | ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top; | ||
6879 | } | ||
6880 | if (bs) { | ||
6881 | ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top; | ||
6882 | } | ||
6883 | if (ls) { | ||
6884 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left; | ||
6885 | } | ||
6886 | if (rs) { | ||
6887 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left; | ||
6888 | } | ||
6889 | } | ||
6890 | |||
6891 | if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { | ||
6892 | (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); | ||
6893 | } | ||
6894 | inst.snapElements[i].snapping = (ts || bs || ls || rs || first); | ||
6895 | |||
6896 | } | ||
6897 | |||
6898 | } | ||
6899 | }); | ||
6900 | |||
6901 | $.ui.plugin.add("draggable", "stack", { | ||
6902 | start: function( event, ui, instance ) { | ||
6903 | var min, | ||
6904 | o = instance.options, | ||
6905 | group = $.makeArray($(o.stack)).sort(function(a, b) { | ||
6906 | return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0); | ||
6907 | }); | ||
6908 | |||
6909 | if (!group.length) { return; } | ||
6910 | |||
6911 | min = parseInt($(group[0]).css("zIndex"), 10) || 0; | ||
6912 | $(group).each(function(i) { | ||
6913 | $(this).css("zIndex", min + i); | ||
6914 | }); | ||
6915 | this.css("zIndex", (min + group.length)); | ||
6916 | } | ||
6917 | }); | ||
6918 | |||
6919 | $.ui.plugin.add("draggable", "zIndex", { | ||
6920 | start: function( event, ui, instance ) { | ||
6921 | var t = $( ui.helper ), | ||
6922 | o = instance.options; | ||
6923 | |||
6924 | if (t.css("zIndex")) { | ||
6925 | o._zIndex = t.css("zIndex"); | ||
6926 | } | ||
6927 | t.css("zIndex", o.zIndex); | ||
6928 | }, | ||
6929 | stop: function( event, ui, instance ) { | ||
6930 | var o = instance.options; | ||
6931 | |||
6932 | if (o._zIndex) { | ||
6933 | $(ui.helper).css("zIndex", o._zIndex); | ||
6934 | } | ||
6935 | } | ||
6936 | }); | ||
6937 | |||
6938 | var draggable = $.ui.draggable; | ||
6939 | |||
6940 | |||
6941 | /*! | ||
6942 | * jQuery UI Resizable 1.11.2 | ||
6943 | * http://jqueryui.com | ||
6944 | * | ||
6945 | * Copyright 2014 jQuery Foundation and other contributors | ||
6946 | * Released under the MIT license. | ||
6947 | * http://jquery.org/license | ||
6948 | * | ||
6949 | * http://api.jqueryui.com/resizable/ | ||
6950 | */ | ||
6951 | |||
6952 | |||
6953 | $.widget("ui.resizable", $.ui.mouse, { | ||
6954 | version: "1.11.2", | ||
6955 | widgetEventPrefix: "resize", | ||
6956 | options: { | ||
6957 | alsoResize: false, | ||
6958 | animate: false, | ||
6959 | animateDuration: "slow", | ||
6960 | animateEasing: "swing", | ||
6961 | aspectRatio: false, | ||
6962 | autoHide: false, | ||
6963 | containment: false, | ||
6964 | ghost: false, | ||
6965 | grid: false, | ||
6966 | handles: "e,s,se", | ||
6967 | helper: false, | ||
6968 | maxHeight: null, | ||
6969 | maxWidth: null, | ||
6970 | minHeight: 10, | ||
6971 | minWidth: 10, | ||
6972 | // See #7960 | ||
6973 | zIndex: 90, | ||
6974 | |||
6975 | // callbacks | ||
6976 | resize: null, | ||
6977 | start: null, | ||
6978 | stop: null | ||
6979 | }, | ||
6980 | |||
6981 | _num: function( value ) { | ||
6982 | return parseInt( value, 10 ) || 0; | ||
6983 | }, | ||
6984 | |||
6985 | _isNumber: function( value ) { | ||
6986 | return !isNaN( parseInt( value, 10 ) ); | ||
6987 | }, | ||
6988 | |||
6989 | _hasScroll: function( el, a ) { | ||
6990 | |||
6991 | if ( $( el ).css( "overflow" ) === "hidden") { | ||
6992 | return false; | ||
6993 | } | ||
6994 | |||
6995 | var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", | ||
6996 | has = false; | ||
6997 | |||
6998 | if ( el[ scroll ] > 0 ) { | ||
6999 | return true; | ||
7000 | } | ||
7001 | |||
7002 | // TODO: determine which cases actually cause this to happen | ||
7003 | // if the element doesn't have the scroll set, see if it's possible to | ||
7004 | // set the scroll | ||
7005 | el[ scroll ] = 1; | ||
7006 | has = ( el[ scroll ] > 0 ); | ||
7007 | el[ scroll ] = 0; | ||
7008 | return has; | ||
7009 | }, | ||
7010 | |||
7011 | _create: function() { | ||
7012 | |||
7013 | var n, i, handle, axis, hname, | ||
7014 | that = this, | ||
7015 | o = this.options; | ||
7016 | this.element.addClass("ui-resizable"); | ||
7017 | |||
7018 | $.extend(this, { | ||
7019 | _aspectRatio: !!(o.aspectRatio), | ||
7020 | aspectRatio: o.aspectRatio, | ||
7021 | originalElement: this.element, | ||
7022 | _proportionallyResizeElements: [], | ||
7023 | _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null | ||
7024 | }); | ||
7025 | |||
7026 | // Wrap the element if it cannot hold child nodes | ||
7027 | if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { | ||
7028 | |||
7029 | this.element.wrap( | ||
7030 | $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ | ||
7031 | position: this.element.css("position"), | ||
7032 | width: this.element.outerWidth(), | ||
7033 | height: this.element.outerHeight(), | ||
7034 | top: this.element.css("top"), | ||
7035 | left: this.element.css("left") | ||
7036 | }) | ||
7037 | ); | ||
7038 | |||
7039 | this.element = this.element.parent().data( | ||
7040 | "ui-resizable", this.element.resizable( "instance" ) | ||
7041 | ); | ||
7042 | |||
7043 | this.elementIsWrapper = true; | ||
7044 | |||
7045 | this.element.css({ | ||
7046 | marginLeft: this.originalElement.css("marginLeft"), | ||
7047 | marginTop: this.originalElement.css("marginTop"), | ||
7048 | marginRight: this.originalElement.css("marginRight"), | ||
7049 | marginBottom: this.originalElement.css("marginBottom") | ||
7050 | }); | ||
7051 | this.originalElement.css({ | ||
7052 | marginLeft: 0, | ||
7053 | marginTop: 0, | ||
7054 | marginRight: 0, | ||
7055 | marginBottom: 0 | ||
7056 | }); | ||
7057 | // support: Safari | ||
7058 | // Prevent Safari textarea resize | ||
7059 | this.originalResizeStyle = this.originalElement.css("resize"); | ||
7060 | this.originalElement.css("resize", "none"); | ||
7061 | |||
7062 | this._proportionallyResizeElements.push( this.originalElement.css({ | ||
7063 | position: "static", | ||
7064 | zoom: 1, | ||
7065 | display: "block" | ||
7066 | }) ); | ||
7067 | |||
7068 | // support: IE9 | ||
7069 | // avoid IE jump (hard set the margin) | ||
7070 | this.originalElement.css({ margin: this.originalElement.css("margin") }); | ||
7071 | |||
7072 | this._proportionallyResize(); | ||
7073 | } | ||
7074 | |||
7075 | this.handles = o.handles || | ||
7076 | ( !$(".ui-resizable-handle", this.element).length ? | ||
7077 | "e,s,se" : { | ||
7078 | n: ".ui-resizable-n", | ||
7079 | e: ".ui-resizable-e", | ||
7080 | s: ".ui-resizable-s", | ||
7081 | w: ".ui-resizable-w", | ||
7082 | se: ".ui-resizable-se", | ||
7083 | sw: ".ui-resizable-sw", | ||
7084 | ne: ".ui-resizable-ne", | ||
7085 | nw: ".ui-resizable-nw" | ||
7086 | } ); | ||
7087 | |||
7088 | if (this.handles.constructor === String) { | ||
7089 | |||
7090 | if ( this.handles === "all") { | ||
7091 | this.handles = "n,e,s,w,se,sw,ne,nw"; | ||
7092 | } | ||
7093 | |||
7094 | n = this.handles.split(","); | ||
7095 | this.handles = {}; | ||
7096 | |||
7097 | for (i = 0; i < n.length; i++) { | ||
7098 | |||
7099 | handle = $.trim(n[i]); | ||
7100 | hname = "ui-resizable-" + handle; | ||
7101 | axis = $("<div class='ui-resizable-handle " + hname + "'></div>"); | ||
7102 | |||
7103 | axis.css({ zIndex: o.zIndex }); | ||
7104 | |||
7105 | // TODO : What's going on here? | ||
7106 | if ("se" === handle) { | ||
7107 | axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se"); | ||
7108 | } | ||
7109 | |||
7110 | this.handles[handle] = ".ui-resizable-" + handle; | ||
7111 | this.element.append(axis); | ||
7112 | } | ||
7113 | |||
7114 | } | ||
7115 | |||
7116 | this._renderAxis = function(target) { | ||
7117 | |||
7118 | var i, axis, padPos, padWrapper; | ||
7119 | |||
7120 | target = target || this.element; | ||
7121 | |||
7122 | for (i in this.handles) { | ||
7123 | |||
7124 | if (this.handles[i].constructor === String) { | ||
7125 | this.handles[i] = this.element.children( this.handles[ i ] ).first().show(); | ||
7126 | } | ||
7127 | |||
7128 | if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { | ||
7129 | |||
7130 | axis = $(this.handles[i], this.element); | ||
7131 | |||
7132 | padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); | ||
7133 | |||
7134 | padPos = [ "padding", | ||
7135 | /ne|nw|n/.test(i) ? "Top" : | ||
7136 | /se|sw|s/.test(i) ? "Bottom" : | ||
7137 | /^e$/.test(i) ? "Right" : "Left" ].join(""); | ||
7138 | |||
7139 | target.css(padPos, padWrapper); | ||
7140 | |||
7141 | this._proportionallyResize(); | ||
7142 | |||
7143 | } | ||
7144 | |||
7145 | // TODO: What's that good for? There's not anything to be executed left | ||
7146 | if (!$(this.handles[i]).length) { | ||
7147 | continue; | ||
7148 | } | ||
7149 | } | ||
7150 | }; | ||
7151 | |||
7152 | // TODO: make renderAxis a prototype function | ||
7153 | this._renderAxis(this.element); | ||
7154 | |||
7155 | this._handles = $(".ui-resizable-handle", this.element) | ||
7156 | .disableSelection(); | ||
7157 | |||
7158 | this._handles.mouseover(function() { | ||
7159 | if (!that.resizing) { | ||
7160 | if (this.className) { | ||
7161 | axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); | ||
7162 | } | ||
7163 | that.axis = axis && axis[1] ? axis[1] : "se"; | ||
7164 | } | ||
7165 | }); | ||
7166 | |||
7167 | if (o.autoHide) { | ||
7168 | this._handles.hide(); | ||
7169 | $(this.element) | ||
7170 | .addClass("ui-resizable-autohide") | ||
7171 | .mouseenter(function() { | ||
7172 | if (o.disabled) { | ||
7173 | return; | ||
7174 | } | ||
7175 | $(this).removeClass("ui-resizable-autohide"); | ||
7176 | that._handles.show(); | ||
7177 | }) | ||
7178 | .mouseleave(function() { | ||
7179 | if (o.disabled) { | ||
7180 | return; | ||
7181 | } | ||
7182 | if (!that.resizing) { | ||
7183 | $(this).addClass("ui-resizable-autohide"); | ||
7184 | that._handles.hide(); | ||
7185 | } | ||
7186 | }); | ||
7187 | } | ||
7188 | |||
7189 | this._mouseInit(); | ||
7190 | |||
7191 | }, | ||
7192 | |||
7193 | _destroy: function() { | ||
7194 | |||
7195 | this._mouseDestroy(); | ||
7196 | |||
7197 | var wrapper, | ||
7198 | _destroy = function(exp) { | ||
7199 | $(exp) | ||
7200 | .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") | ||
7201 | .removeData("resizable") | ||
7202 | .removeData("ui-resizable") | ||
7203 | .unbind(".resizable") | ||
7204 | .find(".ui-resizable-handle") | ||
7205 | .remove(); | ||
7206 | }; | ||
7207 | |||
7208 | // TODO: Unwrap at same DOM position | ||
7209 | if (this.elementIsWrapper) { | ||
7210 | _destroy(this.element); | ||
7211 | wrapper = this.element; | ||
7212 | this.originalElement.css({ | ||
7213 | position: wrapper.css("position"), | ||
7214 | width: wrapper.outerWidth(), | ||
7215 | height: wrapper.outerHeight(), | ||
7216 | top: wrapper.css("top"), | ||
7217 | left: wrapper.css("left") | ||
7218 | }).insertAfter( wrapper ); | ||
7219 | wrapper.remove(); | ||
7220 | } | ||
7221 | |||
7222 | this.originalElement.css("resize", this.originalResizeStyle); | ||
7223 | _destroy(this.originalElement); | ||
7224 | |||
7225 | return this; | ||
7226 | }, | ||
7227 | |||
7228 | _mouseCapture: function(event) { | ||
7229 | var i, handle, | ||
7230 | capture = false; | ||
7231 | |||
7232 | for (i in this.handles) { | ||
7233 | handle = $(this.handles[i])[0]; | ||
7234 | if (handle === event.target || $.contains(handle, event.target)) { | ||
7235 | capture = true; | ||
7236 | } | ||
7237 | } | ||
7238 | |||
7239 | return !this.options.disabled && capture; | ||
7240 | }, | ||
7241 | |||
7242 | _mouseStart: function(event) { | ||
7243 | |||
7244 | var curleft, curtop, cursor, | ||
7245 | o = this.options, | ||
7246 | el = this.element; | ||
7247 | |||
7248 | this.resizing = true; | ||
7249 | |||
7250 | this._renderProxy(); | ||
7251 | |||
7252 | curleft = this._num(this.helper.css("left")); | ||
7253 | curtop = this._num(this.helper.css("top")); | ||
7254 | |||
7255 | if (o.containment) { | ||
7256 | curleft += $(o.containment).scrollLeft() || 0; | ||
7257 | curtop += $(o.containment).scrollTop() || 0; | ||
7258 | } | ||
7259 | |||
7260 | this.offset = this.helper.offset(); | ||
7261 | this.position = { left: curleft, top: curtop }; | ||
7262 | |||
7263 | this.size = this._helper ? { | ||
7264 | width: this.helper.width(), | ||
7265 | height: this.helper.height() | ||
7266 | } : { | ||
7267 | width: el.width(), | ||
7268 | height: el.height() | ||
7269 | }; | ||
7270 | |||
7271 | this.originalSize = this._helper ? { | ||
7272 | width: el.outerWidth(), | ||
7273 | height: el.outerHeight() | ||
7274 | } : { | ||
7275 | width: el.width(), | ||
7276 | height: el.height() | ||
7277 | }; | ||
7278 | |||
7279 | this.sizeDiff = { | ||
7280 | width: el.outerWidth() - el.width(), | ||
7281 | height: el.outerHeight() - el.height() | ||
7282 | }; | ||
7283 | |||
7284 | this.originalPosition = { left: curleft, top: curtop }; | ||
7285 | this.originalMousePosition = { left: event.pageX, top: event.pageY }; | ||
7286 | |||
7287 | this.aspectRatio = (typeof o.aspectRatio === "number") ? | ||
7288 | o.aspectRatio : | ||
7289 | ((this.originalSize.width / this.originalSize.height) || 1); | ||
7290 | |||
7291 | cursor = $(".ui-resizable-" + this.axis).css("cursor"); | ||
7292 | $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); | ||
7293 | |||
7294 | el.addClass("ui-resizable-resizing"); | ||
7295 | this._propagate("start", event); | ||
7296 | return true; | ||
7297 | }, | ||
7298 | |||
7299 | _mouseDrag: function(event) { | ||
7300 | |||
7301 | var data, props, | ||
7302 | smp = this.originalMousePosition, | ||
7303 | a = this.axis, | ||
7304 | dx = (event.pageX - smp.left) || 0, | ||
7305 | dy = (event.pageY - smp.top) || 0, | ||
7306 | trigger = this._change[a]; | ||
7307 | |||
7308 | this._updatePrevProperties(); | ||
7309 | |||
7310 | if (!trigger) { | ||
7311 | return false; | ||
7312 | } | ||
7313 | |||
7314 | data = trigger.apply(this, [ event, dx, dy ]); | ||
7315 | |||
7316 | this._updateVirtualBoundaries(event.shiftKey); | ||
7317 | if (this._aspectRatio || event.shiftKey) { | ||
7318 | data = this._updateRatio(data, event); | ||
7319 | } | ||
7320 | |||
7321 | data = this._respectSize(data, event); | ||
7322 | |||
7323 | this._updateCache(data); | ||
7324 | |||
7325 | this._propagate("resize", event); | ||
7326 | |||
7327 | props = this._applyChanges(); | ||
7328 | |||
7329 | if ( !this._helper && this._proportionallyResizeElements.length ) { | ||
7330 | this._proportionallyResize(); | ||
7331 | } | ||
7332 | |||
7333 | if ( !$.isEmptyObject( props ) ) { | ||
7334 | this._updatePrevProperties(); | ||
7335 | this._trigger( "resize", event, this.ui() ); | ||
7336 | this._applyChanges(); | ||
7337 | } | ||
7338 | |||
7339 | return false; | ||
7340 | }, | ||
7341 | |||
7342 | _mouseStop: function(event) { | ||
7343 | |||
7344 | this.resizing = false; | ||
7345 | var pr, ista, soffseth, soffsetw, s, left, top, | ||
7346 | o = this.options, that = this; | ||
7347 | |||
7348 | if (this._helper) { | ||
7349 | |||
7350 | pr = this._proportionallyResizeElements; | ||
7351 | ista = pr.length && (/textarea/i).test(pr[0].nodeName); | ||
7352 | soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; | ||
7353 | soffsetw = ista ? 0 : that.sizeDiff.width; | ||
7354 | |||
7355 | s = { | ||
7356 | width: (that.helper.width() - soffsetw), | ||
7357 | height: (that.helper.height() - soffseth) | ||
7358 | }; | ||
7359 | left = (parseInt(that.element.css("left"), 10) + | ||
7360 | (that.position.left - that.originalPosition.left)) || null; | ||
7361 | top = (parseInt(that.element.css("top"), 10) + | ||
7362 | (that.position.top - that.originalPosition.top)) || null; | ||
7363 | |||
7364 | if (!o.animate) { | ||
7365 | this.element.css($.extend(s, { top: top, left: left })); | ||
7366 | } | ||
7367 | |||
7368 | that.helper.height(that.size.height); | ||
7369 | that.helper.width(that.size.width); | ||
7370 | |||
7371 | if (this._helper && !o.animate) { | ||
7372 | this._proportionallyResize(); | ||
7373 | } | ||
7374 | } | ||
7375 | |||
7376 | $("body").css("cursor", "auto"); | ||
7377 | |||
7378 | this.element.removeClass("ui-resizable-resizing"); | ||
7379 | |||
7380 | this._propagate("stop", event); | ||
7381 | |||
7382 | if (this._helper) { | ||
7383 | this.helper.remove(); | ||
7384 | } | ||
7385 | |||
7386 | return false; | ||
7387 | |||
7388 | }, | ||
7389 | |||
7390 | _updatePrevProperties: function() { | ||
7391 | this.prevPosition = { | ||
7392 | top: this.position.top, | ||
7393 | left: this.position.left | ||
7394 | }; | ||
7395 | this.prevSize = { | ||
7396 | width: this.size.width, | ||
7397 | height: this.size.height | ||
7398 | }; | ||
7399 | }, | ||
7400 | |||
7401 | _applyChanges: function() { | ||
7402 | var props = {}; | ||
7403 | |||
7404 | if ( this.position.top !== this.prevPosition.top ) { | ||
7405 | props.top = this.position.top + "px"; | ||
7406 | } | ||
7407 | if ( this.position.left !== this.prevPosition.left ) { | ||
7408 | props.left = this.position.left + "px"; | ||
7409 | } | ||
7410 | if ( this.size.width !== this.prevSize.width ) { | ||
7411 | props.width = this.size.width + "px"; | ||
7412 | } | ||
7413 | if ( this.size.height !== this.prevSize.height ) { | ||
7414 | props.height = this.size.height + "px"; | ||
7415 | } | ||
7416 | |||
7417 | this.helper.css( props ); | ||
7418 | |||
7419 | return props; | ||
7420 | }, | ||
7421 | |||
7422 | _updateVirtualBoundaries: function(forceAspectRatio) { | ||
7423 | var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, | ||
7424 | o = this.options; | ||
7425 | |||
7426 | b = { | ||
7427 | minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, | ||
7428 | maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, | ||
7429 | minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, | ||
7430 | maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity | ||
7431 | }; | ||
7432 | |||
7433 | if (this._aspectRatio || forceAspectRatio) { | ||
7434 | pMinWidth = b.minHeight * this.aspectRatio; | ||
7435 | pMinHeight = b.minWidth / this.aspectRatio; | ||
7436 | pMaxWidth = b.maxHeight * this.aspectRatio; | ||
7437 | pMaxHeight = b.maxWidth / this.aspectRatio; | ||
7438 | |||
7439 | if (pMinWidth > b.minWidth) { | ||
7440 | b.minWidth = pMinWidth; | ||
7441 | } | ||
7442 | if (pMinHeight > b.minHeight) { | ||
7443 | b.minHeight = pMinHeight; | ||
7444 | } | ||
7445 | if (pMaxWidth < b.maxWidth) { | ||
7446 | b.maxWidth = pMaxWidth; | ||
7447 | } | ||
7448 | if (pMaxHeight < b.maxHeight) { | ||
7449 | b.maxHeight = pMaxHeight; | ||
7450 | } | ||
7451 | } | ||
7452 | this._vBoundaries = b; | ||
7453 | }, | ||
7454 | |||
7455 | _updateCache: function(data) { | ||
7456 | this.offset = this.helper.offset(); | ||
7457 | if (this._isNumber(data.left)) { | ||
7458 | this.position.left = data.left; | ||
7459 | } | ||
7460 | if (this._isNumber(data.top)) { | ||
7461 | this.position.top = data.top; | ||
7462 | } | ||
7463 | if (this._isNumber(data.height)) { | ||
7464 | this.size.height = data.height; | ||
7465 | } | ||
7466 | if (this._isNumber(data.width)) { | ||
7467 | this.size.width = data.width; | ||
7468 | } | ||
7469 | }, | ||
7470 | |||
7471 | _updateRatio: function( data ) { | ||
7472 | |||
7473 | var cpos = this.position, | ||
7474 | csize = this.size, | ||
7475 | a = this.axis; | ||
7476 | |||
7477 | if (this._isNumber(data.height)) { | ||
7478 | data.width = (data.height * this.aspectRatio); | ||
7479 | } else if (this._isNumber(data.width)) { | ||
7480 | data.height = (data.width / this.aspectRatio); | ||
7481 | } | ||
7482 | |||
7483 | if (a === "sw") { | ||
7484 | data.left = cpos.left + (csize.width - data.width); | ||
7485 | data.top = null; | ||
7486 | } | ||
7487 | if (a === "nw") { | ||
7488 | data.top = cpos.top + (csize.height - data.height); | ||
7489 | data.left = cpos.left + (csize.width - data.width); | ||
7490 | } | ||
7491 | |||
7492 | return data; | ||
7493 | }, | ||
7494 | |||
7495 | _respectSize: function( data ) { | ||
7496 | |||
7497 | var o = this._vBoundaries, | ||
7498 | a = this.axis, | ||
7499 | ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), | ||
7500 | ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), | ||
7501 | isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), | ||
7502 | isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), | ||
7503 | dw = this.originalPosition.left + this.originalSize.width, | ||
7504 | dh = this.position.top + this.size.height, | ||
7505 | cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); | ||
7506 | if (isminw) { | ||
7507 | data.width = o.minWidth; | ||
7508 | } | ||
7509 | if (isminh) { | ||
7510 | data.height = o.minHeight; | ||
7511 | } | ||
7512 | if (ismaxw) { | ||
7513 | data.width = o.maxWidth; | ||
7514 | } | ||
7515 | if (ismaxh) { | ||
7516 | data.height = o.maxHeight; | ||
7517 | } | ||
7518 | |||
7519 | if (isminw && cw) { | ||
7520 | data.left = dw - o.minWidth; | ||
7521 | } | ||
7522 | if (ismaxw && cw) { | ||
7523 | data.left = dw - o.maxWidth; | ||
7524 | } | ||
7525 | if (isminh && ch) { | ||
7526 | data.top = dh - o.minHeight; | ||
7527 | } | ||
7528 | if (ismaxh && ch) { | ||
7529 | data.top = dh - o.maxHeight; | ||
7530 | } | ||
7531 | |||
7532 | // Fixing jump error on top/left - bug #2330 | ||
7533 | if (!data.width && !data.height && !data.left && data.top) { | ||
7534 | data.top = null; | ||
7535 | } else if (!data.width && !data.height && !data.top && data.left) { | ||
7536 | data.left = null; | ||
7537 | } | ||
7538 | |||
7539 | return data; | ||
7540 | }, | ||
7541 | |||
7542 | _getPaddingPlusBorderDimensions: function( element ) { | ||
7543 | var i = 0, | ||
7544 | widths = [], | ||
7545 | borders = [ | ||
7546 | element.css( "borderTopWidth" ), | ||
7547 | element.css( "borderRightWidth" ), | ||
7548 | element.css( "borderBottomWidth" ), | ||
7549 | element.css( "borderLeftWidth" ) | ||
7550 | ], | ||
7551 | paddings = [ | ||
7552 | element.css( "paddingTop" ), | ||
7553 | element.css( "paddingRight" ), | ||
7554 | element.css( "paddingBottom" ), | ||
7555 | element.css( "paddingLeft" ) | ||
7556 | ]; | ||
7557 | |||
7558 | for ( ; i < 4; i++ ) { | ||
7559 | widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 ); | ||
7560 | widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 ); | ||
7561 | } | ||
7562 | |||
7563 | return { | ||
7564 | height: widths[ 0 ] + widths[ 2 ], | ||
7565 | width: widths[ 1 ] + widths[ 3 ] | ||
7566 | }; | ||
7567 | }, | ||
7568 | |||
7569 | _proportionallyResize: function() { | ||
7570 | |||
7571 | if (!this._proportionallyResizeElements.length) { | ||
7572 | return; | ||
7573 | } | ||
7574 | |||
7575 | var prel, | ||
7576 | i = 0, | ||
7577 | element = this.helper || this.element; | ||
7578 | |||
7579 | for ( ; i < this._proportionallyResizeElements.length; i++) { | ||
7580 | |||
7581 | prel = this._proportionallyResizeElements[i]; | ||
7582 | |||
7583 | // TODO: Seems like a bug to cache this.outerDimensions | ||
7584 | // considering that we are in a loop. | ||
7585 | if (!this.outerDimensions) { | ||
7586 | this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); | ||
7587 | } | ||
7588 | |||
7589 | prel.css({ | ||
7590 | height: (element.height() - this.outerDimensions.height) || 0, | ||
7591 | width: (element.width() - this.outerDimensions.width) || 0 | ||
7592 | }); | ||
7593 | |||
7594 | } | ||
7595 | |||
7596 | }, | ||
7597 | |||
7598 | _renderProxy: function() { | ||
7599 | |||
7600 | var el = this.element, o = this.options; | ||
7601 | this.elementOffset = el.offset(); | ||
7602 | |||
7603 | if (this._helper) { | ||
7604 | |||
7605 | this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); | ||
7606 | |||
7607 | this.helper.addClass(this._helper).css({ | ||
7608 | width: this.element.outerWidth() - 1, | ||
7609 | height: this.element.outerHeight() - 1, | ||
7610 | position: "absolute", | ||
7611 | left: this.elementOffset.left + "px", | ||
7612 | top: this.elementOffset.top + "px", | ||
7613 | zIndex: ++o.zIndex //TODO: Don't modify option | ||
7614 | }); | ||
7615 | |||
7616 | this.helper | ||
7617 | .appendTo("body") | ||
7618 | .disableSelection(); | ||
7619 | |||
7620 | } else { | ||
7621 | this.helper = this.element; | ||
7622 | } | ||
7623 | |||
7624 | }, | ||
7625 | |||
7626 | _change: { | ||
7627 | e: function(event, dx) { | ||
7628 | return { width: this.originalSize.width + dx }; | ||
7629 | }, | ||
7630 | w: function(event, dx) { | ||
7631 | var cs = this.originalSize, sp = this.originalPosition; | ||
7632 | return { left: sp.left + dx, width: cs.width - dx }; | ||
7633 | }, | ||
7634 | n: function(event, dx, dy) { | ||
7635 | var cs = this.originalSize, sp = this.originalPosition; | ||
7636 | return { top: sp.top + dy, height: cs.height - dy }; | ||
7637 | }, | ||
7638 | s: function(event, dx, dy) { | ||
7639 | return { height: this.originalSize.height + dy }; | ||
7640 | }, | ||
7641 | se: function(event, dx, dy) { | ||
7642 | return $.extend(this._change.s.apply(this, arguments), | ||
7643 | this._change.e.apply(this, [ event, dx, dy ])); | ||
7644 | }, | ||
7645 | sw: function(event, dx, dy) { | ||
7646 | return $.extend(this._change.s.apply(this, arguments), | ||
7647 | this._change.w.apply(this, [ event, dx, dy ])); | ||
7648 | }, | ||
7649 | ne: function(event, dx, dy) { | ||
7650 | return $.extend(this._change.n.apply(this, arguments), | ||
7651 | this._change.e.apply(this, [ event, dx, dy ])); | ||
7652 | }, | ||
7653 | nw: function(event, dx, dy) { | ||
7654 | return $.extend(this._change.n.apply(this, arguments), | ||
7655 | this._change.w.apply(this, [ event, dx, dy ])); | ||
7656 | } | ||
7657 | }, | ||
7658 | |||
7659 | _propagate: function(n, event) { | ||
7660 | $.ui.plugin.call(this, n, [ event, this.ui() ]); | ||
7661 | (n !== "resize" && this._trigger(n, event, this.ui())); | ||
7662 | }, | ||
7663 | |||
7664 | plugins: {}, | ||
7665 | |||
7666 | ui: function() { | ||
7667 | return { | ||
7668 | originalElement: this.originalElement, | ||
7669 | element: this.element, | ||
7670 | helper: this.helper, | ||
7671 | position: this.position, | ||
7672 | size: this.size, | ||
7673 | originalSize: this.originalSize, | ||
7674 | originalPosition: this.originalPosition | ||
7675 | }; | ||
7676 | } | ||
7677 | |||
7678 | }); | ||
7679 | |||
7680 | /* | ||
7681 | * Resizable Extensions | ||
7682 | */ | ||
7683 | |||
7684 | $.ui.plugin.add("resizable", "animate", { | ||
7685 | |||
7686 | stop: function( event ) { | ||
7687 | var that = $(this).resizable( "instance" ), | ||
7688 | o = that.options, | ||
7689 | pr = that._proportionallyResizeElements, | ||
7690 | ista = pr.length && (/textarea/i).test(pr[0].nodeName), | ||
7691 | soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, | ||
7692 | soffsetw = ista ? 0 : that.sizeDiff.width, | ||
7693 | style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, | ||
7694 | left = (parseInt(that.element.css("left"), 10) + | ||
7695 | (that.position.left - that.originalPosition.left)) || null, | ||
7696 | top = (parseInt(that.element.css("top"), 10) + | ||
7697 | (that.position.top - that.originalPosition.top)) || null; | ||
7698 | |||
7699 | that.element.animate( | ||
7700 | $.extend(style, top && left ? { top: top, left: left } : {}), { | ||
7701 | duration: o.animateDuration, | ||
7702 | easing: o.animateEasing, | ||
7703 | step: function() { | ||
7704 | |||
7705 | var data = { | ||
7706 | width: parseInt(that.element.css("width"), 10), | ||
7707 | height: parseInt(that.element.css("height"), 10), | ||
7708 | top: parseInt(that.element.css("top"), 10), | ||
7709 | left: parseInt(that.element.css("left"), 10) | ||
7710 | }; | ||
7711 | |||
7712 | if (pr && pr.length) { | ||
7713 | $(pr[0]).css({ width: data.width, height: data.height }); | ||
7714 | } | ||
7715 | |||
7716 | // propagating resize, and updating values for each animation step | ||
7717 | that._updateCache(data); | ||
7718 | that._propagate("resize", event); | ||
7719 | |||
7720 | } | ||
7721 | } | ||
7722 | ); | ||
7723 | } | ||
7724 | |||
7725 | }); | ||
7726 | |||
7727 | $.ui.plugin.add( "resizable", "containment", { | ||
7728 | |||
7729 | start: function() { | ||
7730 | var element, p, co, ch, cw, width, height, | ||
7731 | that = $( this ).resizable( "instance" ), | ||
7732 | o = that.options, | ||
7733 | el = that.element, | ||
7734 | oc = o.containment, | ||
7735 | ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; | ||
7736 | |||
7737 | if ( !ce ) { | ||
7738 | return; | ||
7739 | } | ||
7740 | |||
7741 | that.containerElement = $( ce ); | ||
7742 | |||
7743 | if ( /document/.test( oc ) || oc === document ) { | ||
7744 | that.containerOffset = { | ||
7745 | left: 0, | ||
7746 | top: 0 | ||
7747 | }; | ||
7748 | that.containerPosition = { | ||
7749 | left: 0, | ||
7750 | top: 0 | ||
7751 | }; | ||
7752 | |||
7753 | that.parentData = { | ||
7754 | element: $( document ), | ||
7755 | left: 0, | ||
7756 | top: 0, | ||
7757 | width: $( document ).width(), | ||
7758 | height: $( document ).height() || document.body.parentNode.scrollHeight | ||
7759 | }; | ||
7760 | } else { | ||
7761 | element = $( ce ); | ||
7762 | p = []; | ||
7763 | $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) { | ||
7764 | p[ i ] = that._num( element.css( "padding" + name ) ); | ||
7765 | }); | ||
7766 | |||
7767 | that.containerOffset = element.offset(); | ||
7768 | that.containerPosition = element.position(); | ||
7769 | that.containerSize = { | ||
7770 | height: ( element.innerHeight() - p[ 3 ] ), | ||
7771 | width: ( element.innerWidth() - p[ 1 ] ) | ||
7772 | }; | ||
7773 | |||
7774 | co = that.containerOffset; | ||
7775 | ch = that.containerSize.height; | ||
7776 | cw = that.containerSize.width; | ||
7777 | width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw ); | ||
7778 | height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ; | ||
7779 | |||
7780 | that.parentData = { | ||
7781 | element: ce, | ||
7782 | left: co.left, | ||
7783 | top: co.top, | ||
7784 | width: width, | ||
7785 | height: height | ||
7786 | }; | ||
7787 | } | ||
7788 | }, | ||
7789 | |||
7790 | resize: function( event ) { | ||
7791 | var woset, hoset, isParent, isOffsetRelative, | ||
7792 | that = $( this ).resizable( "instance" ), | ||
7793 | o = that.options, | ||
7794 | co = that.containerOffset, | ||
7795 | cp = that.position, | ||
7796 | pRatio = that._aspectRatio || event.shiftKey, | ||
7797 | cop = { | ||
7798 | top: 0, | ||
7799 | left: 0 | ||
7800 | }, | ||
7801 | ce = that.containerElement, | ||
7802 | continueResize = true; | ||
7803 | |||
7804 | if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { | ||
7805 | cop = co; | ||
7806 | } | ||
7807 | |||
7808 | if ( cp.left < ( that._helper ? co.left : 0 ) ) { | ||
7809 | that.size.width = that.size.width + | ||
7810 | ( that._helper ? | ||
7811 | ( that.position.left - co.left ) : | ||
7812 | ( that.position.left - cop.left ) ); | ||
7813 | |||
7814 | if ( pRatio ) { | ||
7815 | that.size.height = that.size.width / that.aspectRatio; | ||
7816 | continueResize = false; | ||
7817 | } | ||
7818 | that.position.left = o.helper ? co.left : 0; | ||
7819 | } | ||
7820 | |||
7821 | if ( cp.top < ( that._helper ? co.top : 0 ) ) { | ||
7822 | that.size.height = that.size.height + | ||
7823 | ( that._helper ? | ||
7824 | ( that.position.top - co.top ) : | ||
7825 | that.position.top ); | ||
7826 | |||
7827 | if ( pRatio ) { | ||
7828 | that.size.width = that.size.height * that.aspectRatio; | ||
7829 | continueResize = false; | ||
7830 | } | ||
7831 | that.position.top = that._helper ? co.top : 0; | ||
7832 | } | ||
7833 | |||
7834 | isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); | ||
7835 | isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); | ||
7836 | |||
7837 | if ( isParent && isOffsetRelative ) { | ||
7838 | that.offset.left = that.parentData.left + that.position.left; | ||
7839 | that.offset.top = that.parentData.top + that.position.top; | ||
7840 | } else { | ||
7841 | that.offset.left = that.element.offset().left; | ||
7842 | that.offset.top = that.element.offset().top; | ||
7843 | } | ||
7844 | |||
7845 | woset = Math.abs( that.sizeDiff.width + | ||
7846 | (that._helper ? | ||
7847 | that.offset.left - cop.left : | ||
7848 | (that.offset.left - co.left)) ); | ||
7849 | |||
7850 | hoset = Math.abs( that.sizeDiff.height + | ||
7851 | (that._helper ? | ||
7852 | that.offset.top - cop.top : | ||
7853 | (that.offset.top - co.top)) ); | ||
7854 | |||
7855 | if ( woset + that.size.width >= that.parentData.width ) { | ||
7856 | that.size.width = that.parentData.width - woset; | ||
7857 | if ( pRatio ) { | ||
7858 | that.size.height = that.size.width / that.aspectRatio; | ||
7859 | continueResize = false; | ||
7860 | } | ||
7861 | } | ||
7862 | |||
7863 | if ( hoset + that.size.height >= that.parentData.height ) { | ||
7864 | that.size.height = that.parentData.height - hoset; | ||
7865 | if ( pRatio ) { | ||
7866 | that.size.width = that.size.height * that.aspectRatio; | ||
7867 | continueResize = false; | ||
7868 | } | ||
7869 | } | ||
7870 | |||
7871 | if ( !continueResize ){ | ||
7872 | that.position.left = that.prevPosition.left; | ||
7873 | that.position.top = that.prevPosition.top; | ||
7874 | that.size.width = that.prevSize.width; | ||
7875 | that.size.height = that.prevSize.height; | ||
7876 | } | ||
7877 | }, | ||
7878 | |||
7879 | stop: function() { | ||
7880 | var that = $( this ).resizable( "instance" ), | ||
7881 | o = that.options, | ||
7882 | co = that.containerOffset, | ||
7883 | cop = that.containerPosition, | ||
7884 | ce = that.containerElement, | ||
7885 | helper = $( that.helper ), | ||
7886 | ho = helper.offset(), | ||
7887 | w = helper.outerWidth() - that.sizeDiff.width, | ||
7888 | h = helper.outerHeight() - that.sizeDiff.height; | ||
7889 | |||
7890 | if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { | ||
7891 | $( this ).css({ | ||
7892 | left: ho.left - cop.left - co.left, | ||
7893 | width: w, | ||
7894 | height: h | ||
7895 | }); | ||
7896 | } | ||
7897 | |||
7898 | if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { | ||
7899 | $( this ).css({ | ||
7900 | left: ho.left - cop.left - co.left, | ||
7901 | width: w, | ||
7902 | height: h | ||
7903 | }); | ||
7904 | } | ||
7905 | } | ||
7906 | }); | ||
7907 | |||
7908 | $.ui.plugin.add("resizable", "alsoResize", { | ||
7909 | |||
7910 | start: function() { | ||
7911 | var that = $(this).resizable( "instance" ), | ||
7912 | o = that.options, | ||
7913 | _store = function(exp) { | ||
7914 | $(exp).each(function() { | ||
7915 | var el = $(this); | ||
7916 | el.data("ui-resizable-alsoresize", { | ||
7917 | width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), | ||
7918 | left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10) | ||
7919 | }); | ||
7920 | }); | ||
7921 | }; | ||
7922 | |||
7923 | if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { | ||
7924 | if (o.alsoResize.length) { | ||
7925 | o.alsoResize = o.alsoResize[0]; | ||
7926 | _store(o.alsoResize); | ||
7927 | } else { | ||
7928 | $.each(o.alsoResize, function(exp) { | ||
7929 | _store(exp); | ||
7930 | }); | ||
7931 | } | ||
7932 | } else { | ||
7933 | _store(o.alsoResize); | ||
7934 | } | ||
7935 | }, | ||
7936 | |||
7937 | resize: function(event, ui) { | ||
7938 | var that = $(this).resizable( "instance" ), | ||
7939 | o = that.options, | ||
7940 | os = that.originalSize, | ||
7941 | op = that.originalPosition, | ||
7942 | delta = { | ||
7943 | height: (that.size.height - os.height) || 0, | ||
7944 | width: (that.size.width - os.width) || 0, | ||
7945 | top: (that.position.top - op.top) || 0, | ||
7946 | left: (that.position.left - op.left) || 0 | ||
7947 | }, | ||
7948 | |||
7949 | _alsoResize = function(exp, c) { | ||
7950 | $(exp).each(function() { | ||
7951 | var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, | ||
7952 | css = c && c.length ? | ||
7953 | c : | ||
7954 | el.parents(ui.originalElement[0]).length ? | ||
7955 | [ "width", "height" ] : | ||
7956 | [ "width", "height", "top", "left" ]; | ||
7957 | |||
7958 | $.each(css, function(i, prop) { | ||
7959 | var sum = (start[prop] || 0) + (delta[prop] || 0); | ||
7960 | if (sum && sum >= 0) { | ||
7961 | style[prop] = sum || null; | ||
7962 | } | ||
7963 | }); | ||
7964 | |||
7965 | el.css(style); | ||
7966 | }); | ||
7967 | }; | ||
7968 | |||
7969 | if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { | ||
7970 | $.each(o.alsoResize, function(exp, c) { | ||
7971 | _alsoResize(exp, c); | ||
7972 | }); | ||
7973 | } else { | ||
7974 | _alsoResize(o.alsoResize); | ||
7975 | } | ||
7976 | }, | ||
7977 | |||
7978 | stop: function() { | ||
7979 | $(this).removeData("resizable-alsoresize"); | ||
7980 | } | ||
7981 | }); | ||
7982 | |||
7983 | $.ui.plugin.add("resizable", "ghost", { | ||
7984 | |||
7985 | start: function() { | ||
7986 | |||
7987 | var that = $(this).resizable( "instance" ), o = that.options, cs = that.size; | ||
7988 | |||
7989 | that.ghost = that.originalElement.clone(); | ||
7990 | that.ghost | ||
7991 | .css({ | ||
7992 | opacity: 0.25, | ||
7993 | display: "block", | ||
7994 | position: "relative", | ||
7995 | height: cs.height, | ||
7996 | width: cs.width, | ||
7997 | margin: 0, | ||
7998 | left: 0, | ||
7999 | top: 0 | ||
8000 | }) | ||
8001 | .addClass("ui-resizable-ghost") | ||
8002 | .addClass(typeof o.ghost === "string" ? o.ghost : ""); | ||
8003 | |||
8004 | that.ghost.appendTo(that.helper); | ||
8005 | |||
8006 | }, | ||
8007 | |||
8008 | resize: function() { | ||
8009 | var that = $(this).resizable( "instance" ); | ||
8010 | if (that.ghost) { | ||
8011 | that.ghost.css({ | ||
8012 | position: "relative", | ||
8013 | height: that.size.height, | ||
8014 | width: that.size.width | ||
8015 | }); | ||
8016 | } | ||
8017 | }, | ||
8018 | |||
8019 | stop: function() { | ||
8020 | var that = $(this).resizable( "instance" ); | ||
8021 | if (that.ghost && that.helper) { | ||
8022 | that.helper.get(0).removeChild(that.ghost.get(0)); | ||
8023 | } | ||
8024 | } | ||
8025 | |||
8026 | }); | ||
8027 | |||
8028 | $.ui.plugin.add("resizable", "grid", { | ||
8029 | |||
8030 | resize: function() { | ||
8031 | var outerDimensions, | ||
8032 | that = $(this).resizable( "instance" ), | ||
8033 | o = that.options, | ||
8034 | cs = that.size, | ||
8035 | os = that.originalSize, | ||
8036 | op = that.originalPosition, | ||
8037 | a = that.axis, | ||
8038 | grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, | ||
8039 | gridX = (grid[0] || 1), | ||
8040 | gridY = (grid[1] || 1), | ||
8041 | ox = Math.round((cs.width - os.width) / gridX) * gridX, | ||
8042 | oy = Math.round((cs.height - os.height) / gridY) * gridY, | ||
8043 | newWidth = os.width + ox, | ||
8044 | newHeight = os.height + oy, | ||
8045 | isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), | ||
8046 | isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), | ||
8047 | isMinWidth = o.minWidth && (o.minWidth > newWidth), | ||
8048 | isMinHeight = o.minHeight && (o.minHeight > newHeight); | ||
8049 | |||
8050 | o.grid = grid; | ||
8051 | |||
8052 | if (isMinWidth) { | ||
8053 | newWidth += gridX; | ||
8054 | } | ||
8055 | if (isMinHeight) { | ||
8056 | newHeight += gridY; | ||
8057 | } | ||
8058 | if (isMaxWidth) { | ||
8059 | newWidth -= gridX; | ||
8060 | } | ||
8061 | if (isMaxHeight) { | ||
8062 | newHeight -= gridY; | ||
8063 | } | ||
8064 | |||
8065 | if (/^(se|s|e)$/.test(a)) { | ||
8066 | that.size.width = newWidth; | ||
8067 | that.size.height = newHeight; | ||
8068 | } else if (/^(ne)$/.test(a)) { | ||
8069 | that.size.width = newWidth; | ||
8070 | that.size.height = newHeight; | ||
8071 | that.position.top = op.top - oy; | ||
8072 | } else if (/^(sw)$/.test(a)) { | ||
8073 | that.size.width = newWidth; | ||
8074 | that.size.height = newHeight; | ||
8075 | that.position.left = op.left - ox; | ||
8076 | } else { | ||
8077 | if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) { | ||
8078 | outerDimensions = that._getPaddingPlusBorderDimensions( this ); | ||
8079 | } | ||
8080 | |||
8081 | if ( newHeight - gridY > 0 ) { | ||
8082 | that.size.height = newHeight; | ||
8083 | that.position.top = op.top - oy; | ||
8084 | } else { | ||
8085 | newHeight = gridY - outerDimensions.height; | ||
8086 | that.size.height = newHeight; | ||
8087 | that.position.top = op.top + os.height - newHeight; | ||
8088 | } | ||
8089 | if ( newWidth - gridX > 0 ) { | ||
8090 | that.size.width = newWidth; | ||
8091 | that.position.left = op.left - ox; | ||
8092 | } else { | ||
8093 | newWidth = gridY - outerDimensions.height; | ||
8094 | that.size.width = newWidth; | ||
8095 | that.position.left = op.left + os.width - newWidth; | ||
8096 | } | ||
8097 | } | ||
8098 | } | ||
8099 | |||
8100 | }); | ||
8101 | |||
8102 | var resizable = $.ui.resizable; | ||
8103 | |||
8104 | |||
8105 | /*! | ||
8106 | * jQuery UI Dialog 1.11.2 | ||
8107 | * http://jqueryui.com | ||
8108 | * | ||
8109 | * Copyright 2014 jQuery Foundation and other contributors | ||
8110 | * Released under the MIT license. | ||
8111 | * http://jquery.org/license | ||
8112 | * | ||
8113 | * http://api.jqueryui.com/dialog/ | ||
8114 | */ | ||
8115 | |||
8116 | |||
8117 | var dialog = $.widget( "ui.dialog", { | ||
8118 | version: "1.11.2", | ||
8119 | options: { | ||
8120 | appendTo: "body", | ||
8121 | autoOpen: true, | ||
8122 | buttons: [], | ||
8123 | closeOnEscape: true, | ||
8124 | closeText: "Close", | ||
8125 | dialogClass: "", | ||
8126 | draggable: true, | ||
8127 | hide: null, | ||
8128 | height: "auto", | ||
8129 | maxHeight: null, | ||
8130 | maxWidth: null, | ||
8131 | minHeight: 150, | ||
8132 | minWidth: 150, | ||
8133 | modal: false, | ||
8134 | position: { | ||
8135 | my: "center", | ||
8136 | at: "center", | ||
8137 | of: window, | ||
8138 | collision: "fit", | ||
8139 | // Ensure the titlebar is always visible | ||
8140 | using: function( pos ) { | ||
8141 | var topOffset = $( this ).css( pos ).offset().top; | ||
8142 | if ( topOffset < 0 ) { | ||
8143 | $( this ).css( "top", pos.top - topOffset ); | ||
8144 | } | ||
8145 | } | ||
8146 | }, | ||
8147 | resizable: true, | ||
8148 | show: null, | ||
8149 | title: null, | ||
8150 | width: 300, | ||
8151 | |||
8152 | // callbacks | ||
8153 | beforeClose: null, | ||
8154 | close: null, | ||
8155 | drag: null, | ||
8156 | dragStart: null, | ||
8157 | dragStop: null, | ||
8158 | focus: null, | ||
8159 | open: null, | ||
8160 | resize: null, | ||
8161 | resizeStart: null, | ||
8162 | resizeStop: null | ||
8163 | }, | ||
8164 | |||
8165 | sizeRelatedOptions: { | ||
8166 | buttons: true, | ||
8167 | height: true, | ||
8168 | maxHeight: true, | ||
8169 | maxWidth: true, | ||
8170 | minHeight: true, | ||
8171 | minWidth: true, | ||
8172 | width: true | ||
8173 | }, | ||
8174 | |||
8175 | resizableRelatedOptions: { | ||
8176 | maxHeight: true, | ||
8177 | maxWidth: true, | ||
8178 | minHeight: true, | ||
8179 | minWidth: true | ||
8180 | }, | ||
8181 | |||
8182 | _create: function() { | ||
8183 | this.originalCss = { | ||
8184 | display: this.element[ 0 ].style.display, | ||
8185 | width: this.element[ 0 ].style.width, | ||
8186 | minHeight: this.element[ 0 ].style.minHeight, | ||
8187 | maxHeight: this.element[ 0 ].style.maxHeight, | ||
8188 | height: this.element[ 0 ].style.height | ||
8189 | }; | ||
8190 | this.originalPosition = { | ||
8191 | parent: this.element.parent(), | ||
8192 | index: this.element.parent().children().index( this.element ) | ||
8193 | }; | ||
8194 | this.originalTitle = this.element.attr( "title" ); | ||
8195 | this.options.title = this.options.title || this.originalTitle; | ||
8196 | |||
8197 | this._createWrapper(); | ||
8198 | |||
8199 | this.element | ||
8200 | .show() | ||
8201 | .removeAttr( "title" ) | ||
8202 | .addClass( "ui-dialog-content ui-widget-content" ) | ||
8203 | .appendTo( this.uiDialog ); | ||
8204 | |||
8205 | this._createTitlebar(); | ||
8206 | this._createButtonPane(); | ||
8207 | |||
8208 | if ( this.options.draggable && $.fn.draggable ) { | ||
8209 | this._makeDraggable(); | ||
8210 | } | ||
8211 | if ( this.options.resizable && $.fn.resizable ) { | ||
8212 | this._makeResizable(); | ||
8213 | } | ||
8214 | |||
8215 | this._isOpen = false; | ||
8216 | |||
8217 | this._trackFocus(); | ||
8218 | }, | ||
8219 | |||
8220 | _init: function() { | ||
8221 | if ( this.options.autoOpen ) { | ||
8222 | this.open(); | ||
8223 | } | ||
8224 | }, | ||
8225 | |||
8226 | _appendTo: function() { | ||
8227 | var element = this.options.appendTo; | ||
8228 | if ( element && (element.jquery || element.nodeType) ) { | ||
8229 | return $( element ); | ||
8230 | } | ||
8231 | return this.document.find( element || "body" ).eq( 0 ); | ||
8232 | }, | ||
8233 | |||
8234 | _destroy: function() { | ||
8235 | var next, | ||
8236 | originalPosition = this.originalPosition; | ||
8237 | |||
8238 | this._destroyOverlay(); | ||
8239 | |||
8240 | this.element | ||
8241 | .removeUniqueId() | ||
8242 | .removeClass( "ui-dialog-content ui-widget-content" ) | ||
8243 | .css( this.originalCss ) | ||
8244 | // Without detaching first, the following becomes really slow | ||
8245 | .detach(); | ||
8246 | |||
8247 | this.uiDialog.stop( true, true ).remove(); | ||
8248 | |||
8249 | if ( this.originalTitle ) { | ||
8250 | this.element.attr( "title", this.originalTitle ); | ||
8251 | } | ||
8252 | |||
8253 | next = originalPosition.parent.children().eq( originalPosition.index ); | ||
8254 | // Don't try to place the dialog next to itself (#8613) | ||
8255 | if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { | ||
8256 | next.before( this.element ); | ||
8257 | } else { | ||
8258 | originalPosition.parent.append( this.element ); | ||
8259 | } | ||
8260 | }, | ||
8261 | |||
8262 | widget: function() { | ||
8263 | return this.uiDialog; | ||
8264 | }, | ||
8265 | |||
8266 | disable: $.noop, | ||
8267 | enable: $.noop, | ||
8268 | |||
8269 | close: function( event ) { | ||
8270 | var activeElement, | ||
8271 | that = this; | ||
8272 | |||
8273 | if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { | ||
8274 | return; | ||
8275 | } | ||
8276 | |||
8277 | this._isOpen = false; | ||
8278 | this._focusedElement = null; | ||
8279 | this._destroyOverlay(); | ||
8280 | this._untrackInstance(); | ||
8281 | |||
8282 | if ( !this.opener.filter( ":focusable" ).focus().length ) { | ||
8283 | |||
8284 | // support: IE9 | ||
8285 | // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> | ||
8286 | try { | ||
8287 | activeElement = this.document[ 0 ].activeElement; | ||
8288 | |||
8289 | // Support: IE9, IE10 | ||
8290 | // If the <body> is blurred, IE will switch windows, see #4520 | ||
8291 | if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) { | ||
8292 | |||
8293 | // Hiding a focused element doesn't trigger blur in WebKit | ||
8294 | // so in case we have nothing to focus on, explicitly blur the active element | ||
8295 | // https://bugs.webkit.org/show_bug.cgi?id=47182 | ||
8296 | $( activeElement ).blur(); | ||
8297 | } | ||
8298 | } catch ( error ) {} | ||
8299 | } | ||
8300 | |||
8301 | this._hide( this.uiDialog, this.options.hide, function() { | ||
8302 | that._trigger( "close", event ); | ||
8303 | }); | ||
8304 | }, | ||
8305 | |||
8306 | isOpen: function() { | ||
8307 | return this._isOpen; | ||
8308 | }, | ||
8309 | |||
8310 | moveToTop: function() { | ||
8311 | this._moveToTop(); | ||
8312 | }, | ||
8313 | |||
8314 | _moveToTop: function( event, silent ) { | ||
8315 | var moved = false, | ||
8316 | zIndicies = this.uiDialog.siblings( ".ui-front:visible" ).map(function() { | ||
8317 | return +$( this ).css( "z-index" ); | ||
8318 | }).get(), | ||
8319 | zIndexMax = Math.max.apply( null, zIndicies ); | ||
8320 | |||
8321 | if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { | ||
8322 | this.uiDialog.css( "z-index", zIndexMax + 1 ); | ||
8323 | moved = true; | ||
8324 | } | ||
8325 | |||
8326 | if ( moved && !silent ) { | ||
8327 | this._trigger( "focus", event ); | ||
8328 | } | ||
8329 | return moved; | ||
8330 | }, | ||
8331 | |||
8332 | open: function() { | ||
8333 | var that = this; | ||
8334 | if ( this._isOpen ) { | ||
8335 | if ( this._moveToTop() ) { | ||
8336 | this._focusTabbable(); | ||
8337 | } | ||
8338 | return; | ||
8339 | } | ||
8340 | |||
8341 | this._isOpen = true; | ||
8342 | this.opener = $( this.document[ 0 ].activeElement ); | ||
8343 | |||
8344 | this._size(); | ||
8345 | this._position(); | ||
8346 | this._createOverlay(); | ||
8347 | this._moveToTop( null, true ); | ||
8348 | |||
8349 | // Ensure the overlay is moved to the top with the dialog, but only when | ||
8350 | // opening. The overlay shouldn't move after the dialog is open so that | ||
8351 | // modeless dialogs opened after the modal dialog stack properly. | ||
8352 | if ( this.overlay ) { | ||
8353 | this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); | ||
8354 | } | ||
8355 | |||
8356 | this._show( this.uiDialog, this.options.show, function() { | ||
8357 | that._focusTabbable(); | ||
8358 | that._trigger( "focus" ); | ||
8359 | }); | ||
8360 | |||
8361 | // Track the dialog immediately upon openening in case a focus event | ||
8362 | // somehow occurs outside of the dialog before an element inside the | ||
8363 | // dialog is focused (#10152) | ||
8364 | this._makeFocusTarget(); | ||
8365 | |||
8366 | this._trigger( "open" ); | ||
8367 | }, | ||
8368 | |||
8369 | _focusTabbable: function() { | ||
8370 | // Set focus to the first match: | ||
8371 | // 1. An element that was focused previously | ||
8372 | // 2. First element inside the dialog matching [autofocus] | ||
8373 | // 3. Tabbable element inside the content element | ||
8374 | // 4. Tabbable element inside the buttonpane | ||
8375 | // 5. The close button | ||
8376 | // 6. The dialog itself | ||
8377 | var hasFocus = this._focusedElement; | ||
8378 | if ( !hasFocus ) { | ||
8379 | hasFocus = this.element.find( "[autofocus]" ); | ||
8380 | } | ||
8381 | if ( !hasFocus.length ) { | ||
8382 | hasFocus = this.element.find( ":tabbable" ); | ||
8383 | } | ||
8384 | if ( !hasFocus.length ) { | ||
8385 | hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); | ||
8386 | } | ||
8387 | if ( !hasFocus.length ) { | ||
8388 | hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); | ||
8389 | } | ||
8390 | if ( !hasFocus.length ) { | ||
8391 | hasFocus = this.uiDialog; | ||
8392 | } | ||
8393 | hasFocus.eq( 0 ).focus(); | ||
8394 | }, | ||
8395 | |||
8396 | _keepFocus: function( event ) { | ||
8397 | function checkFocus() { | ||
8398 | var activeElement = this.document[0].activeElement, | ||
8399 | isActive = this.uiDialog[0] === activeElement || | ||
8400 | $.contains( this.uiDialog[0], activeElement ); | ||
8401 | if ( !isActive ) { | ||
8402 | this._focusTabbable(); | ||
8403 | } | ||
8404 | } | ||
8405 | event.preventDefault(); | ||
8406 | checkFocus.call( this ); | ||
8407 | // support: IE | ||
8408 | // IE <= 8 doesn't prevent moving focus even with event.preventDefault() | ||
8409 | // so we check again later | ||
8410 | this._delay( checkFocus ); | ||
8411 | }, | ||
8412 | |||
8413 | _createWrapper: function() { | ||
8414 | this.uiDialog = $("<div>") | ||
8415 | .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " + | ||
8416 | this.options.dialogClass ) | ||
8417 | .hide() | ||
8418 | .attr({ | ||
8419 | // Setting tabIndex makes the div focusable | ||
8420 | tabIndex: -1, | ||
8421 | role: "dialog" | ||
8422 | }) | ||
8423 | .appendTo( this._appendTo() ); | ||
8424 | |||
8425 | this._on( this.uiDialog, { | ||
8426 | keydown: function( event ) { | ||
8427 | if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && | ||
8428 | event.keyCode === $.ui.keyCode.ESCAPE ) { | ||
8429 | event.preventDefault(); | ||
8430 | this.close( event ); | ||
8431 | return; | ||
8432 | } | ||
8433 | |||
8434 | // prevent tabbing out of dialogs | ||
8435 | if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { | ||
8436 | return; | ||
8437 | } | ||
8438 | var tabbables = this.uiDialog.find( ":tabbable" ), | ||
8439 | first = tabbables.filter( ":first" ), | ||
8440 | last = tabbables.filter( ":last" ); | ||
8441 | |||
8442 | if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) { | ||
8443 | this._delay(function() { | ||
8444 | first.focus(); | ||
8445 | }); | ||
8446 | event.preventDefault(); | ||
8447 | } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) { | ||
8448 | this._delay(function() { | ||
8449 | last.focus(); | ||
8450 | }); | ||
8451 | event.preventDefault(); | ||
8452 | } | ||
8453 | }, | ||
8454 | mousedown: function( event ) { | ||
8455 | if ( this._moveToTop( event ) ) { | ||
8456 | this._focusTabbable(); | ||
8457 | } | ||
8458 | } | ||
8459 | }); | ||
8460 | |||
8461 | // We assume that any existing aria-describedby attribute means | ||
8462 | // that the dialog content is marked up properly | ||
8463 | // otherwise we brute force the content as the description | ||
8464 | if ( !this.element.find( "[aria-describedby]" ).length ) { | ||
8465 | this.uiDialog.attr({ | ||
8466 | "aria-describedby": this.element.uniqueId().attr( "id" ) | ||
8467 | }); | ||
8468 | } | ||
8469 | }, | ||
8470 | |||
8471 | _createTitlebar: function() { | ||
8472 | var uiDialogTitle; | ||
8473 | |||
8474 | this.uiDialogTitlebar = $( "<div>" ) | ||
8475 | .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" ) | ||
8476 | .prependTo( this.uiDialog ); | ||
8477 | this._on( this.uiDialogTitlebar, { | ||
8478 | mousedown: function( event ) { | ||
8479 | // Don't prevent click on close button (#8838) | ||
8480 | // Focusing a dialog that is partially scrolled out of view | ||
8481 | // causes the browser to scroll it into view, preventing the click event | ||
8482 | if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { | ||
8483 | // Dialog isn't getting focus when dragging (#8063) | ||
8484 | this.uiDialog.focus(); | ||
8485 | } | ||
8486 | } | ||
8487 | }); | ||
8488 | |||
8489 | // support: IE | ||
8490 | // Use type="button" to prevent enter keypresses in textboxes from closing the | ||
8491 | // dialog in IE (#9312) | ||
8492 | this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) | ||
8493 | .button({ | ||
8494 | label: this.options.closeText, | ||
8495 | icons: { | ||
8496 | primary: "ui-icon-closethick" | ||
8497 | }, | ||
8498 | text: false | ||
8499 | }) | ||
8500 | .addClass( "ui-dialog-titlebar-close" ) | ||
8501 | .appendTo( this.uiDialogTitlebar ); | ||
8502 | this._on( this.uiDialogTitlebarClose, { | ||
8503 | click: function( event ) { | ||
8504 | event.preventDefault(); | ||
8505 | this.close( event ); | ||
8506 | } | ||
8507 | }); | ||
8508 | |||
8509 | uiDialogTitle = $( "<span>" ) | ||
8510 | .uniqueId() | ||
8511 | .addClass( "ui-dialog-title" ) | ||
8512 | .prependTo( this.uiDialogTitlebar ); | ||
8513 | this._title( uiDialogTitle ); | ||
8514 | |||
8515 | this.uiDialog.attr({ | ||
8516 | "aria-labelledby": uiDialogTitle.attr( "id" ) | ||
8517 | }); | ||
8518 | }, | ||
8519 | |||
8520 | _title: function( title ) { | ||
8521 | if ( !this.options.title ) { | ||
8522 | title.html( " " ); | ||
8523 | } | ||
8524 | title.text( this.options.title ); | ||
8525 | }, | ||
8526 | |||
8527 | _createButtonPane: function() { | ||
8528 | this.uiDialogButtonPane = $( "<div>" ) | ||
8529 | .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); | ||
8530 | |||
8531 | this.uiButtonSet = $( "<div>" ) | ||
8532 | .addClass( "ui-dialog-buttonset" ) | ||
8533 | .appendTo( this.uiDialogButtonPane ); | ||
8534 | |||
8535 | this._createButtons(); | ||
8536 | }, | ||
8537 | |||
8538 | _createButtons: function() { | ||
8539 | var that = this, | ||
8540 | buttons = this.options.buttons; | ||
8541 | |||
8542 | // if we already have a button pane, remove it | ||
8543 | this.uiDialogButtonPane.remove(); | ||
8544 | this.uiButtonSet.empty(); | ||
8545 | |||
8546 | if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) { | ||
8547 | this.uiDialog.removeClass( "ui-dialog-buttons" ); | ||
8548 | return; | ||
8549 | } | ||
8550 | |||
8551 | $.each( buttons, function( name, props ) { | ||
8552 | var click, buttonOptions; | ||
8553 | props = $.isFunction( props ) ? | ||
8554 | { click: props, text: name } : | ||
8555 | props; | ||
8556 | // Default to a non-submitting button | ||
8557 | props = $.extend( { type: "button" }, props ); | ||
8558 | // Change the context for the click callback to be the main element | ||
8559 | click = props.click; | ||
8560 | props.click = function() { | ||
8561 | click.apply( that.element[ 0 ], arguments ); | ||
8562 | }; | ||
8563 | buttonOptions = { | ||
8564 | icons: props.icons, | ||
8565 | text: props.showText | ||
8566 | }; | ||
8567 | delete props.icons; | ||
8568 | delete props.showText; | ||
8569 | $( "<button></button>", props ) | ||
8570 | .button( buttonOptions ) | ||
8571 | .appendTo( that.uiButtonSet ); | ||
8572 | }); | ||
8573 | this.uiDialog.addClass( "ui-dialog-buttons" ); | ||
8574 | this.uiDialogButtonPane.appendTo( this.uiDialog ); | ||
8575 | }, | ||
8576 | |||
8577 | _makeDraggable: function() { | ||
8578 | var that = this, | ||
8579 | options = this.options; | ||
8580 | |||
8581 | function filteredUi( ui ) { | ||
8582 | return { | ||
8583 | position: ui.position, | ||
8584 | offset: ui.offset | ||
8585 | }; | ||
8586 | } | ||
8587 | |||
8588 | this.uiDialog.draggable({ | ||
8589 | cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", | ||
8590 | handle: ".ui-dialog-titlebar", | ||
8591 | containment: "document", | ||
8592 | start: function( event, ui ) { | ||
8593 | $( this ).addClass( "ui-dialog-dragging" ); | ||
8594 | that._blockFrames(); | ||
8595 | that._trigger( "dragStart", event, filteredUi( ui ) ); | ||
8596 | }, | ||
8597 | drag: function( event, ui ) { | ||
8598 | that._trigger( "drag", event, filteredUi( ui ) ); | ||
8599 | }, | ||
8600 | stop: function( event, ui ) { | ||
8601 | var left = ui.offset.left - that.document.scrollLeft(), | ||
8602 | top = ui.offset.top - that.document.scrollTop(); | ||
8603 | |||
8604 | options.position = { | ||
8605 | my: "left top", | ||
8606 | at: "left" + (left >= 0 ? "+" : "") + left + " " + | ||
8607 | "top" + (top >= 0 ? "+" : "") + top, | ||
8608 | of: that.window | ||
8609 | }; | ||
8610 | $( this ).removeClass( "ui-dialog-dragging" ); | ||
8611 | that._unblockFrames(); | ||
8612 | that._trigger( "dragStop", event, filteredUi( ui ) ); | ||
8613 | } | ||
8614 | }); | ||
8615 | }, | ||
8616 | |||
8617 | _makeResizable: function() { | ||
8618 | var that = this, | ||
8619 | options = this.options, | ||
8620 | handles = options.resizable, | ||
8621 | // .ui-resizable has position: relative defined in the stylesheet | ||
8622 | // but dialogs have to use absolute or fixed positioning | ||
8623 | position = this.uiDialog.css("position"), | ||
8624 | resizeHandles = typeof handles === "string" ? | ||
8625 | handles : | ||
8626 | "n,e,s,w,se,sw,ne,nw"; | ||
8627 | |||
8628 | function filteredUi( ui ) { | ||
8629 | return { | ||
8630 | originalPosition: ui.originalPosition, | ||
8631 | originalSize: ui.originalSize, | ||
8632 | position: ui.position, | ||
8633 | size: ui.size | ||
8634 | }; | ||
8635 | } | ||
8636 | |||
8637 | this.uiDialog.resizable({ | ||
8638 | cancel: ".ui-dialog-content", | ||
8639 | containment: "document", | ||
8640 | alsoResize: this.element, | ||
8641 | maxWidth: options.maxWidth, | ||
8642 | maxHeight: options.maxHeight, | ||
8643 | minWidth: options.minWidth, | ||
8644 | minHeight: this._minHeight(), | ||
8645 | handles: resizeHandles, | ||
8646 | start: function( event, ui ) { | ||
8647 | $( this ).addClass( "ui-dialog-resizing" ); | ||
8648 | that._blockFrames(); | ||
8649 | that._trigger( "resizeStart", event, filteredUi( ui ) ); | ||
8650 | }, | ||
8651 | resize: function( event, ui ) { | ||
8652 | that._trigger( "resize", event, filteredUi( ui ) ); | ||
8653 | }, | ||
8654 | stop: function( event, ui ) { | ||
8655 | var offset = that.uiDialog.offset(), | ||
8656 | left = offset.left - that.document.scrollLeft(), | ||
8657 | top = offset.top - that.document.scrollTop(); | ||
8658 | |||
8659 | options.height = that.uiDialog.height(); | ||
8660 | options.width = that.uiDialog.width(); | ||
8661 | options.position = { | ||
8662 | my: "left top", | ||
8663 | at: "left" + (left >= 0 ? "+" : "") + left + " " + | ||
8664 | "top" + (top >= 0 ? "+" : "") + top, | ||
8665 | of: that.window | ||
8666 | }; | ||
8667 | $( this ).removeClass( "ui-dialog-resizing" ); | ||
8668 | that._unblockFrames(); | ||
8669 | that._trigger( "resizeStop", event, filteredUi( ui ) ); | ||
8670 | } | ||
8671 | }) | ||
8672 | .css( "position", position ); | ||
8673 | }, | ||
8674 | |||
8675 | _trackFocus: function() { | ||
8676 | this._on( this.widget(), { | ||
8677 | focusin: function( event ) { | ||
8678 | this._makeFocusTarget(); | ||
8679 | this._focusedElement = $( event.target ); | ||
8680 | } | ||
8681 | }); | ||
8682 | }, | ||
8683 | |||
8684 | _makeFocusTarget: function() { | ||
8685 | this._untrackInstance(); | ||
8686 | this._trackingInstances().unshift( this ); | ||
8687 | }, | ||
8688 | |||
8689 | _untrackInstance: function() { | ||
8690 | var instances = this._trackingInstances(), | ||
8691 | exists = $.inArray( this, instances ); | ||
8692 | if ( exists !== -1 ) { | ||
8693 | instances.splice( exists, 1 ); | ||
8694 | } | ||
8695 | }, | ||
8696 | |||
8697 | _trackingInstances: function() { | ||
8698 | var instances = this.document.data( "ui-dialog-instances" ); | ||
8699 | if ( !instances ) { | ||
8700 | instances = []; | ||
8701 | this.document.data( "ui-dialog-instances", instances ); | ||
8702 | } | ||
8703 | return instances; | ||
8704 | }, | ||
8705 | |||
8706 | _minHeight: function() { | ||
8707 | var options = this.options; | ||
8708 | |||
8709 | return options.height === "auto" ? | ||
8710 | options.minHeight : | ||
8711 | Math.min( options.minHeight, options.height ); | ||
8712 | }, | ||
8713 | |||
8714 | _position: function() { | ||
8715 | // Need to show the dialog to get the actual offset in the position plugin | ||
8716 | var isVisible = this.uiDialog.is( ":visible" ); | ||
8717 | if ( !isVisible ) { | ||
8718 | this.uiDialog.show(); | ||
8719 | } | ||
8720 | this.uiDialog.position( this.options.position ); | ||
8721 | if ( !isVisible ) { | ||
8722 | this.uiDialog.hide(); | ||
8723 | } | ||
8724 | }, | ||
8725 | |||
8726 | _setOptions: function( options ) { | ||
8727 | var that = this, | ||
8728 | resize = false, | ||
8729 | resizableOptions = {}; | ||
8730 | |||
8731 | $.each( options, function( key, value ) { | ||
8732 | that._setOption( key, value ); | ||
8733 | |||
8734 | if ( key in that.sizeRelatedOptions ) { | ||
8735 | resize = true; | ||
8736 | } | ||
8737 | if ( key in that.resizableRelatedOptions ) { | ||
8738 | resizableOptions[ key ] = value; | ||
8739 | } | ||
8740 | }); | ||
8741 | |||
8742 | if ( resize ) { | ||
8743 | this._size(); | ||
8744 | this._position(); | ||
8745 | } | ||
8746 | if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { | ||
8747 | this.uiDialog.resizable( "option", resizableOptions ); | ||
8748 | } | ||
8749 | }, | ||
8750 | |||
8751 | _setOption: function( key, value ) { | ||
8752 | var isDraggable, isResizable, | ||
8753 | uiDialog = this.uiDialog; | ||
8754 | |||
8755 | if ( key === "dialogClass" ) { | ||
8756 | uiDialog | ||
8757 | .removeClass( this.options.dialogClass ) | ||
8758 | .addClass( value ); | ||
8759 | } | ||
8760 | |||
8761 | if ( key === "disabled" ) { | ||
8762 | return; | ||
8763 | } | ||
8764 | |||
8765 | this._super( key, value ); | ||
8766 | |||
8767 | if ( key === "appendTo" ) { | ||
8768 | this.uiDialog.appendTo( this._appendTo() ); | ||
8769 | } | ||
8770 | |||
8771 | if ( key === "buttons" ) { | ||
8772 | this._createButtons(); | ||
8773 | } | ||
8774 | |||
8775 | if ( key === "closeText" ) { | ||
8776 | this.uiDialogTitlebarClose.button({ | ||
8777 | // Ensure that we always pass a string | ||
8778 | label: "" + value | ||
8779 | }); | ||
8780 | } | ||
8781 | |||
8782 | if ( key === "draggable" ) { | ||
8783 | isDraggable = uiDialog.is( ":data(ui-draggable)" ); | ||
8784 | if ( isDraggable && !value ) { | ||
8785 | uiDialog.draggable( "destroy" ); | ||
8786 | } | ||
8787 | |||
8788 | if ( !isDraggable && value ) { | ||
8789 | this._makeDraggable(); | ||
8790 | } | ||
8791 | } | ||
8792 | |||
8793 | if ( key === "position" ) { | ||
8794 | this._position(); | ||
8795 | } | ||
8796 | |||
8797 | if ( key === "resizable" ) { | ||
8798 | // currently resizable, becoming non-resizable | ||
8799 | isResizable = uiDialog.is( ":data(ui-resizable)" ); | ||
8800 | if ( isResizable && !value ) { | ||
8801 | uiDialog.resizable( "destroy" ); | ||
8802 | } | ||
8803 | |||
8804 | // currently resizable, changing handles | ||
8805 | if ( isResizable && typeof value === "string" ) { | ||
8806 | uiDialog.resizable( "option", "handles", value ); | ||
8807 | } | ||
8808 | |||
8809 | // currently non-resizable, becoming resizable | ||
8810 | if ( !isResizable && value !== false ) { | ||
8811 | this._makeResizable(); | ||
8812 | } | ||
8813 | } | ||
8814 | |||
8815 | if ( key === "title" ) { | ||
8816 | this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); | ||
8817 | } | ||
8818 | }, | ||
8819 | |||
8820 | _size: function() { | ||
8821 | // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content | ||
8822 | // divs will both have width and height set, so we need to reset them | ||
8823 | var nonContentHeight, minContentHeight, maxContentHeight, | ||
8824 | options = this.options; | ||
8825 | |||
8826 | // Reset content sizing | ||
8827 | this.element.show().css({ | ||
8828 | width: "auto", | ||
8829 | minHeight: 0, | ||
8830 | maxHeight: "none", | ||
8831 | height: 0 | ||
8832 | }); | ||
8833 | |||
8834 | if ( options.minWidth > options.width ) { | ||
8835 | options.width = options.minWidth; | ||
8836 | } | ||
8837 | |||
8838 | // reset wrapper sizing | ||
8839 | // determine the height of all the non-content elements | ||
8840 | nonContentHeight = this.uiDialog.css({ | ||
8841 | height: "auto", | ||
8842 | width: options.width | ||
8843 | }) | ||
8844 | .outerHeight(); | ||
8845 | minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); | ||
8846 | maxContentHeight = typeof options.maxHeight === "number" ? | ||
8847 | Math.max( 0, options.maxHeight - nonContentHeight ) : | ||
8848 | "none"; | ||
8849 | |||
8850 | if ( options.height === "auto" ) { | ||
8851 | this.element.css({ | ||
8852 | minHeight: minContentHeight, | ||
8853 | maxHeight: maxContentHeight, | ||
8854 | height: "auto" | ||
8855 | }); | ||
8856 | } else { | ||
8857 | this.element.height( Math.max( 0, options.height - nonContentHeight ) ); | ||
8858 | } | ||
8859 | |||
8860 | if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { | ||
8861 | this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); | ||
8862 | } | ||
8863 | }, | ||
8864 | |||
8865 | _blockFrames: function() { | ||
8866 | this.iframeBlocks = this.document.find( "iframe" ).map(function() { | ||
8867 | var iframe = $( this ); | ||
8868 | |||
8869 | return $( "<div>" ) | ||
8870 | .css({ | ||
8871 | position: "absolute", | ||
8872 | width: iframe.outerWidth(), | ||
8873 | height: iframe.outerHeight() | ||
8874 | }) | ||
8875 | .appendTo( iframe.parent() ) | ||
8876 | .offset( iframe.offset() )[0]; | ||
8877 | }); | ||
8878 | }, | ||
8879 | |||
8880 | _unblockFrames: function() { | ||
8881 | if ( this.iframeBlocks ) { | ||
8882 | this.iframeBlocks.remove(); | ||
8883 | delete this.iframeBlocks; | ||
8884 | } | ||
8885 | }, | ||
8886 | |||
8887 | _allowInteraction: function( event ) { | ||
8888 | if ( $( event.target ).closest( ".ui-dialog" ).length ) { | ||
8889 | return true; | ||
8890 | } | ||
8891 | |||
8892 | // TODO: Remove hack when datepicker implements | ||
8893 | // the .ui-front logic (#8989) | ||
8894 | return !!$( event.target ).closest( ".ui-datepicker" ).length; | ||
8895 | }, | ||
8896 | |||
8897 | _createOverlay: function() { | ||
8898 | if ( !this.options.modal ) { | ||
8899 | return; | ||
8900 | } | ||
8901 | |||
8902 | // We use a delay in case the overlay is created from an | ||
8903 | // event that we're going to be cancelling (#2804) | ||
8904 | var isOpening = true; | ||
8905 | this._delay(function() { | ||
8906 | isOpening = false; | ||
8907 | }); | ||
8908 | |||
8909 | if ( !this.document.data( "ui-dialog-overlays" ) ) { | ||
8910 | |||
8911 | // Prevent use of anchors and inputs | ||
8912 | // Using _on() for an event handler shared across many instances is | ||
8913 | // safe because the dialogs stack and must be closed in reverse order | ||
8914 | this._on( this.document, { | ||
8915 | focusin: function( event ) { | ||
8916 | if ( isOpening ) { | ||
8917 | return; | ||
8918 | } | ||
8919 | |||
8920 | if ( !this._allowInteraction( event ) ) { | ||
8921 | event.preventDefault(); | ||
8922 | this._trackingInstances()[ 0 ]._focusTabbable(); | ||
8923 | } | ||
8924 | } | ||
8925 | }); | ||
8926 | } | ||
8927 | |||
8928 | this.overlay = $( "<div>" ) | ||
8929 | .addClass( "ui-widget-overlay ui-front" ) | ||
8930 | .appendTo( this._appendTo() ); | ||
8931 | this._on( this.overlay, { | ||
8932 | mousedown: "_keepFocus" | ||
8933 | }); | ||
8934 | this.document.data( "ui-dialog-overlays", | ||
8935 | (this.document.data( "ui-dialog-overlays" ) || 0) + 1 ); | ||
8936 | }, | ||
8937 | |||
8938 | _destroyOverlay: function() { | ||
8939 | if ( !this.options.modal ) { | ||
8940 | return; | ||
8941 | } | ||
8942 | |||
8943 | if ( this.overlay ) { | ||
8944 | var overlays = this.document.data( "ui-dialog-overlays" ) - 1; | ||
8945 | |||
8946 | if ( !overlays ) { | ||
8947 | this.document | ||
8948 | .unbind( "focusin" ) | ||
8949 | .removeData( "ui-dialog-overlays" ); | ||
8950 | } else { | ||
8951 | this.document.data( "ui-dialog-overlays", overlays ); | ||
8952 | } | ||
8953 | |||
8954 | this.overlay.remove(); | ||
8955 | this.overlay = null; | ||
8956 | } | ||
8957 | } | ||
8958 | }); | ||
8959 | |||
8960 | |||
8961 | /*! | ||
8962 | * jQuery UI Droppable 1.11.2 | ||
8963 | * http://jqueryui.com | ||
8964 | * | ||
8965 | * Copyright 2014 jQuery Foundation and other contributors | ||
8966 | * Released under the MIT license. | ||
8967 | * http://jquery.org/license | ||
8968 | * | ||
8969 | * http://api.jqueryui.com/droppable/ | ||
8970 | */ | ||
8971 | |||
8972 | |||
8973 | $.widget( "ui.droppable", { | ||
8974 | version: "1.11.2", | ||
8975 | widgetEventPrefix: "drop", | ||
8976 | options: { | ||
8977 | accept: "*", | ||
8978 | activeClass: false, | ||
8979 | addClasses: true, | ||
8980 | greedy: false, | ||
8981 | hoverClass: false, | ||
8982 | scope: "default", | ||
8983 | tolerance: "intersect", | ||
8984 | |||
8985 | // callbacks | ||
8986 | activate: null, | ||
8987 | deactivate: null, | ||
8988 | drop: null, | ||
8989 | out: null, | ||
8990 | over: null | ||
8991 | }, | ||
8992 | _create: function() { | ||
8993 | |||
8994 | var proportions, | ||
8995 | o = this.options, | ||
8996 | accept = o.accept; | ||
8997 | |||
8998 | this.isover = false; | ||
8999 | this.isout = true; | ||
9000 | |||
9001 | this.accept = $.isFunction( accept ) ? accept : function( d ) { | ||
9002 | return d.is( accept ); | ||
9003 | }; | ||
9004 | |||
9005 | this.proportions = function( /* valueToWrite */ ) { | ||
9006 | if ( arguments.length ) { | ||
9007 | // Store the droppable's proportions | ||
9008 | proportions = arguments[ 0 ]; | ||
9009 | } else { | ||
9010 | // Retrieve or derive the droppable's proportions | ||
9011 | return proportions ? | ||
9012 | proportions : | ||
9013 | proportions = { | ||
9014 | width: this.element[ 0 ].offsetWidth, | ||
9015 | height: this.element[ 0 ].offsetHeight | ||
9016 | }; | ||
9017 | } | ||
9018 | }; | ||
9019 | |||
9020 | this._addToManager( o.scope ); | ||
9021 | |||
9022 | o.addClasses && this.element.addClass( "ui-droppable" ); | ||
9023 | |||
9024 | }, | ||
9025 | |||
9026 | _addToManager: function( scope ) { | ||
9027 | // Add the reference and positions to the manager | ||
9028 | $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; | ||
9029 | $.ui.ddmanager.droppables[ scope ].push( this ); | ||
9030 | }, | ||
9031 | |||
9032 | _splice: function( drop ) { | ||
9033 | var i = 0; | ||
9034 | for ( ; i < drop.length; i++ ) { | ||
9035 | if ( drop[ i ] === this ) { | ||
9036 | drop.splice( i, 1 ); | ||
9037 | } | ||
9038 | } | ||
9039 | }, | ||
9040 | |||
9041 | _destroy: function() { | ||
9042 | var drop = $.ui.ddmanager.droppables[ this.options.scope ]; | ||
9043 | |||
9044 | this._splice( drop ); | ||
9045 | |||
9046 | this.element.removeClass( "ui-droppable ui-droppable-disabled" ); | ||
9047 | }, | ||
9048 | |||
9049 | _setOption: function( key, value ) { | ||
9050 | |||
9051 | if ( key === "accept" ) { | ||
9052 | this.accept = $.isFunction( value ) ? value : function( d ) { | ||
9053 | return d.is( value ); | ||
9054 | }; | ||
9055 | } else if ( key === "scope" ) { | ||
9056 | var drop = $.ui.ddmanager.droppables[ this.options.scope ]; | ||
9057 | |||
9058 | this._splice( drop ); | ||
9059 | this._addToManager( value ); | ||
9060 | } | ||
9061 | |||
9062 | this._super( key, value ); | ||
9063 | }, | ||
9064 | |||
9065 | _activate: function( event ) { | ||
9066 | var draggable = $.ui.ddmanager.current; | ||
9067 | if ( this.options.activeClass ) { | ||
9068 | this.element.addClass( this.options.activeClass ); | ||
9069 | } | ||
9070 | if ( draggable ){ | ||
9071 | this._trigger( "activate", event, this.ui( draggable ) ); | ||
9072 | } | ||
9073 | }, | ||
9074 | |||
9075 | _deactivate: function( event ) { | ||
9076 | var draggable = $.ui.ddmanager.current; | ||
9077 | if ( this.options.activeClass ) { | ||
9078 | this.element.removeClass( this.options.activeClass ); | ||
9079 | } | ||
9080 | if ( draggable ){ | ||
9081 | this._trigger( "deactivate", event, this.ui( draggable ) ); | ||
9082 | } | ||
9083 | }, | ||
9084 | |||
9085 | _over: function( event ) { | ||
9086 | |||
9087 | var draggable = $.ui.ddmanager.current; | ||
9088 | |||
9089 | // Bail if draggable and droppable are same element | ||
9090 | if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { | ||
9091 | return; | ||
9092 | } | ||
9093 | |||
9094 | if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { | ||
9095 | if ( this.options.hoverClass ) { | ||
9096 | this.element.addClass( this.options.hoverClass ); | ||
9097 | } | ||
9098 | this._trigger( "over", event, this.ui( draggable ) ); | ||
9099 | } | ||
9100 | |||
9101 | }, | ||
9102 | |||
9103 | _out: function( event ) { | ||
9104 | |||
9105 | var draggable = $.ui.ddmanager.current; | ||
9106 | |||
9107 | // Bail if draggable and droppable are same element | ||
9108 | if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { | ||
9109 | return; | ||
9110 | } | ||
9111 | |||
9112 | if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { | ||
9113 | if ( this.options.hoverClass ) { | ||
9114 | this.element.removeClass( this.options.hoverClass ); | ||
9115 | } | ||
9116 | this._trigger( "out", event, this.ui( draggable ) ); | ||
9117 | } | ||
9118 | |||
9119 | }, | ||
9120 | |||
9121 | _drop: function( event, custom ) { | ||
9122 | |||
9123 | var draggable = custom || $.ui.ddmanager.current, | ||
9124 | childrenIntersection = false; | ||
9125 | |||
9126 | // Bail if draggable and droppable are same element | ||
9127 | if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { | ||
9128 | return false; | ||
9129 | } | ||
9130 | |||
9131 | this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() { | ||
9132 | var inst = $( this ).droppable( "instance" ); | ||
9133 | if ( | ||
9134 | inst.options.greedy && | ||
9135 | !inst.options.disabled && | ||
9136 | inst.options.scope === draggable.options.scope && | ||
9137 | inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) && | ||
9138 | $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event ) | ||
9139 | ) { childrenIntersection = true; return false; } | ||
9140 | }); | ||
9141 | if ( childrenIntersection ) { | ||
9142 | return false; | ||
9143 | } | ||
9144 | |||
9145 | if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { | ||
9146 | if ( this.options.activeClass ) { | ||
9147 | this.element.removeClass( this.options.activeClass ); | ||
9148 | } | ||
9149 | if ( this.options.hoverClass ) { | ||
9150 | this.element.removeClass( this.options.hoverClass ); | ||
9151 | } | ||
9152 | this._trigger( "drop", event, this.ui( draggable ) ); | ||
9153 | return this.element; | ||
9154 | } | ||
9155 | |||
9156 | return false; | ||
9157 | |||
9158 | }, | ||
9159 | |||
9160 | ui: function( c ) { | ||
9161 | return { | ||
9162 | draggable: ( c.currentItem || c.element ), | ||
9163 | helper: c.helper, | ||
9164 | position: c.position, | ||
9165 | offset: c.positionAbs | ||
9166 | }; | ||
9167 | } | ||
9168 | |||
9169 | }); | ||
9170 | |||
9171 | $.ui.intersect = (function() { | ||
9172 | function isOverAxis( x, reference, size ) { | ||
9173 | return ( x >= reference ) && ( x < ( reference + size ) ); | ||
9174 | } | ||
9175 | |||
9176 | return function( draggable, droppable, toleranceMode, event ) { | ||
9177 | |||
9178 | if ( !droppable.offset ) { | ||
9179 | return false; | ||
9180 | } | ||
9181 | |||
9182 | var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left, | ||
9183 | y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top, | ||
9184 | x2 = x1 + draggable.helperProportions.width, | ||
9185 | y2 = y1 + draggable.helperProportions.height, | ||
9186 | l = droppable.offset.left, | ||
9187 | t = droppable.offset.top, | ||
9188 | r = l + droppable.proportions().width, | ||
9189 | b = t + droppable.proportions().height; | ||
9190 | |||
9191 | switch ( toleranceMode ) { | ||
9192 | case "fit": | ||
9193 | return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); | ||
9194 | case "intersect": | ||
9195 | return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half | ||
9196 | x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half | ||
9197 | t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half | ||
9198 | y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half | ||
9199 | case "pointer": | ||
9200 | return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width ); | ||
9201 | case "touch": | ||
9202 | return ( | ||
9203 | ( y1 >= t && y1 <= b ) || // Top edge touching | ||
9204 | ( y2 >= t && y2 <= b ) || // Bottom edge touching | ||
9205 | ( y1 < t && y2 > b ) // Surrounded vertically | ||
9206 | ) && ( | ||
9207 | ( x1 >= l && x1 <= r ) || // Left edge touching | ||
9208 | ( x2 >= l && x2 <= r ) || // Right edge touching | ||
9209 | ( x1 < l && x2 > r ) // Surrounded horizontally | ||
9210 | ); | ||
9211 | default: | ||
9212 | return false; | ||
9213 | } | ||
9214 | }; | ||
9215 | })(); | ||
9216 | |||
9217 | /* | ||
9218 | This manager tracks offsets of draggables and droppables | ||
9219 | */ | ||
9220 | $.ui.ddmanager = { | ||
9221 | current: null, | ||
9222 | droppables: { "default": [] }, | ||
9223 | prepareOffsets: function( t, event ) { | ||
9224 | |||
9225 | var i, j, | ||
9226 | m = $.ui.ddmanager.droppables[ t.options.scope ] || [], | ||
9227 | type = event ? event.type : null, // workaround for #2317 | ||
9228 | list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); | ||
9229 | |||
9230 | droppablesLoop: for ( i = 0; i < m.length; i++ ) { | ||
9231 | |||
9232 | // No disabled and non-accepted | ||
9233 | if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) { | ||
9234 | continue; | ||
9235 | } | ||
9236 | |||
9237 | // Filter out elements in the current dragged item | ||
9238 | for ( j = 0; j < list.length; j++ ) { | ||
9239 | if ( list[ j ] === m[ i ].element[ 0 ] ) { | ||
9240 | m[ i ].proportions().height = 0; | ||
9241 | continue droppablesLoop; | ||
9242 | } | ||
9243 | } | ||
9244 | |||
9245 | m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; | ||
9246 | if ( !m[ i ].visible ) { | ||
9247 | continue; | ||
9248 | } | ||
9249 | |||
9250 | // Activate the droppable if used directly from draggables | ||
9251 | if ( type === "mousedown" ) { | ||
9252 | m[ i ]._activate.call( m[ i ], event ); | ||
9253 | } | ||
9254 | |||
9255 | m[ i ].offset = m[ i ].element.offset(); | ||
9256 | m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight }); | ||
9257 | |||
9258 | } | ||
9259 | |||
9260 | }, | ||
9261 | drop: function( draggable, event ) { | ||
9262 | |||
9263 | var dropped = false; | ||
9264 | // Create a copy of the droppables in case the list changes during the drop (#9116) | ||
9265 | $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { | ||
9266 | |||
9267 | if ( !this.options ) { | ||
9268 | return; | ||
9269 | } | ||
9270 | if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { | ||
9271 | dropped = this._drop.call( this, event ) || dropped; | ||
9272 | } | ||
9273 | |||
9274 | if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { | ||
9275 | this.isout = true; | ||
9276 | this.isover = false; | ||
9277 | this._deactivate.call( this, event ); | ||
9278 | } | ||
9279 | |||
9280 | }); | ||
9281 | return dropped; | ||
9282 | |||
9283 | }, | ||
9284 | dragStart: function( draggable, event ) { | ||
9285 | // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) | ||
9286 | draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { | ||
9287 | if ( !draggable.options.refreshPositions ) { | ||
9288 | $.ui.ddmanager.prepareOffsets( draggable, event ); | ||
9289 | } | ||
9290 | }); | ||
9291 | }, | ||
9292 | drag: function( draggable, event ) { | ||
9293 | |||
9294 | // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. | ||
9295 | if ( draggable.options.refreshPositions ) { | ||
9296 | $.ui.ddmanager.prepareOffsets( draggable, event ); | ||
9297 | } | ||
9298 | |||
9299 | // Run through all droppables and check their positions based on specific tolerance options | ||
9300 | $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { | ||
9301 | |||
9302 | if ( this.options.disabled || this.greedyChild || !this.visible ) { | ||
9303 | return; | ||
9304 | } | ||
9305 | |||
9306 | var parentInstance, scope, parent, | ||
9307 | intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), | ||
9308 | c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null ); | ||
9309 | if ( !c ) { | ||
9310 | return; | ||
9311 | } | ||
9312 | |||
9313 | if ( this.options.greedy ) { | ||
9314 | // find droppable parents with same scope | ||
9315 | scope = this.options.scope; | ||
9316 | parent = this.element.parents( ":data(ui-droppable)" ).filter(function() { | ||
9317 | return $( this ).droppable( "instance" ).options.scope === scope; | ||
9318 | }); | ||
9319 | |||
9320 | if ( parent.length ) { | ||
9321 | parentInstance = $( parent[ 0 ] ).droppable( "instance" ); | ||
9322 | parentInstance.greedyChild = ( c === "isover" ); | ||
9323 | } | ||
9324 | } | ||
9325 | |||
9326 | // we just moved into a greedy child | ||
9327 | if ( parentInstance && c === "isover" ) { | ||
9328 | parentInstance.isover = false; | ||
9329 | parentInstance.isout = true; | ||
9330 | parentInstance._out.call( parentInstance, event ); | ||
9331 | } | ||
9332 | |||
9333 | this[ c ] = true; | ||
9334 | this[c === "isout" ? "isover" : "isout"] = false; | ||
9335 | this[c === "isover" ? "_over" : "_out"].call( this, event ); | ||
9336 | |||
9337 | // we just moved out of a greedy child | ||
9338 | if ( parentInstance && c === "isout" ) { | ||
9339 | parentInstance.isout = false; | ||
9340 | parentInstance.isover = true; | ||
9341 | parentInstance._over.call( parentInstance, event ); | ||
9342 | } | ||
9343 | }); | ||
9344 | |||
9345 | }, | ||
9346 | dragStop: function( draggable, event ) { | ||
9347 | draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); | ||
9348 | // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) | ||
9349 | if ( !draggable.options.refreshPositions ) { | ||
9350 | $.ui.ddmanager.prepareOffsets( draggable, event ); | ||
9351 | } | ||
9352 | } | ||
9353 | }; | ||
9354 | |||
9355 | var droppable = $.ui.droppable; | ||
9356 | |||
9357 | |||
9358 | /*! | ||
9359 | * jQuery UI Effects 1.11.2 | ||
9360 | * http://jqueryui.com | ||
9361 | * | ||
9362 | * Copyright 2014 jQuery Foundation and other contributors | ||
9363 | * Released under the MIT license. | ||
9364 | * http://jquery.org/license | ||
9365 | * | ||
9366 | * http://api.jqueryui.com/category/effects-core/ | ||
9367 | */ | ||
9368 | |||
9369 | |||
9370 | var dataSpace = "ui-effects-", | ||
9371 | |||
9372 | // Create a local jQuery because jQuery Color relies on it and the | ||
9373 | // global may not exist with AMD and a custom build (#10199) | ||
9374 | jQuery = $; | ||
9375 | |||
9376 | $.effects = { | ||
9377 | effect: {} | ||
9378 | }; | ||
9379 | |||
9380 | /*! | ||
9381 | * jQuery Color Animations v2.1.2 | ||
9382 | * https://github.com/jquery/jquery-color | ||
9383 | * | ||
9384 | * Copyright 2014 jQuery Foundation and other contributors | ||
9385 | * Released under the MIT license. | ||
9386 | * http://jquery.org/license | ||
9387 | * | ||
9388 | * Date: Wed Jan 16 08:47:09 2013 -0600 | ||
9389 | */ | ||
9390 | (function( jQuery, undefined ) { | ||
9391 | |||
9392 | var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", | ||
9393 | |||
9394 | // plusequals test for += 100 -= 100 | ||
9395 | rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, | ||
9396 | // a set of RE's that can match strings and generate color tuples. | ||
9397 | stringParsers = [ { | ||
9398 | re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | ||
9399 | parse: function( execResult ) { | ||
9400 | return [ | ||
9401 | execResult[ 1 ], | ||
9402 | execResult[ 2 ], | ||
9403 | execResult[ 3 ], | ||
9404 | execResult[ 4 ] | ||
9405 | ]; | ||
9406 | } | ||
9407 | }, { | ||
9408 | re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | ||
9409 | parse: function( execResult ) { | ||
9410 | return [ | ||
9411 | execResult[ 1 ] * 2.55, | ||
9412 | execResult[ 2 ] * 2.55, | ||
9413 | execResult[ 3 ] * 2.55, | ||
9414 | execResult[ 4 ] | ||
9415 | ]; | ||
9416 | } | ||
9417 | }, { | ||
9418 | // this regex ignores A-F because it's compared against an already lowercased string | ||
9419 | re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, | ||
9420 | parse: function( execResult ) { | ||
9421 | return [ | ||
9422 | parseInt( execResult[ 1 ], 16 ), | ||
9423 | parseInt( execResult[ 2 ], 16 ), | ||
9424 | parseInt( execResult[ 3 ], 16 ) | ||
9425 | ]; | ||
9426 | } | ||
9427 | }, { | ||
9428 | // this regex ignores A-F because it's compared against an already lowercased string | ||
9429 | re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, | ||
9430 | parse: function( execResult ) { | ||
9431 | return [ | ||
9432 | parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), | ||
9433 | parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), | ||
9434 | parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) | ||
9435 | ]; | ||
9436 | } | ||
9437 | }, { | ||
9438 | re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | ||
9439 | space: "hsla", | ||
9440 | parse: function( execResult ) { | ||
9441 | return [ | ||
9442 | execResult[ 1 ], | ||
9443 | execResult[ 2 ] / 100, | ||
9444 | execResult[ 3 ] / 100, | ||
9445 | execResult[ 4 ] | ||
9446 | ]; | ||
9447 | } | ||
9448 | } ], | ||
9449 | |||
9450 | // jQuery.Color( ) | ||
9451 | color = jQuery.Color = function( color, green, blue, alpha ) { | ||
9452 | return new jQuery.Color.fn.parse( color, green, blue, alpha ); | ||
9453 | }, | ||
9454 | spaces = { | ||
9455 | rgba: { | ||
9456 | props: { | ||
9457 | red: { | ||
9458 | idx: 0, | ||
9459 | type: "byte" | ||
9460 | }, | ||
9461 | green: { | ||
9462 | idx: 1, | ||
9463 | type: "byte" | ||
9464 | }, | ||
9465 | blue: { | ||
9466 | idx: 2, | ||
9467 | type: "byte" | ||
9468 | } | ||
9469 | } | ||
9470 | }, | ||
9471 | |||
9472 | hsla: { | ||
9473 | props: { | ||
9474 | hue: { | ||
9475 | idx: 0, | ||
9476 | type: "degrees" | ||
9477 | }, | ||
9478 | saturation: { | ||
9479 | idx: 1, | ||
9480 | type: "percent" | ||
9481 | }, | ||
9482 | lightness: { | ||
9483 | idx: 2, | ||
9484 | type: "percent" | ||
9485 | } | ||
9486 | } | ||
9487 | } | ||
9488 | }, | ||
9489 | propTypes = { | ||
9490 | "byte": { | ||
9491 | floor: true, | ||
9492 | max: 255 | ||
9493 | }, | ||
9494 | "percent": { | ||
9495 | max: 1 | ||
9496 | }, | ||
9497 | "degrees": { | ||
9498 | mod: 360, | ||
9499 | floor: true | ||
9500 | } | ||
9501 | }, | ||
9502 | support = color.support = {}, | ||
9503 | |||
9504 | // element for support tests | ||
9505 | supportElem = jQuery( "<p>" )[ 0 ], | ||
9506 | |||
9507 | // colors = jQuery.Color.names | ||
9508 | colors, | ||
9509 | |||
9510 | // local aliases of functions called often | ||
9511 | each = jQuery.each; | ||
9512 | |||
9513 | // determine rgba support immediately | ||
9514 | supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; | ||
9515 | support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; | ||
9516 | |||
9517 | // define cache name and alpha properties | ||
9518 | // for rgba and hsla spaces | ||
9519 | each( spaces, function( spaceName, space ) { | ||
9520 | space.cache = "_" + spaceName; | ||
9521 | space.props.alpha = { | ||
9522 | idx: 3, | ||
9523 | type: "percent", | ||
9524 | def: 1 | ||
9525 | }; | ||
9526 | }); | ||
9527 | |||
9528 | function clamp( value, prop, allowEmpty ) { | ||
9529 | var type = propTypes[ prop.type ] || {}; | ||
9530 | |||
9531 | if ( value == null ) { | ||
9532 | return (allowEmpty || !prop.def) ? null : prop.def; | ||
9533 | } | ||
9534 | |||
9535 | // ~~ is an short way of doing floor for positive numbers | ||
9536 | value = type.floor ? ~~value : parseFloat( value ); | ||
9537 | |||
9538 | // IE will pass in empty strings as value for alpha, | ||
9539 | // which will hit this case | ||
9540 | if ( isNaN( value ) ) { | ||
9541 | return prop.def; | ||
9542 | } | ||
9543 | |||
9544 | if ( type.mod ) { | ||
9545 | // we add mod before modding to make sure that negatives values | ||
9546 | // get converted properly: -10 -> 350 | ||
9547 | return (value + type.mod) % type.mod; | ||
9548 | } | ||
9549 | |||
9550 | // for now all property types without mod have min and max | ||
9551 | return 0 > value ? 0 : type.max < value ? type.max : value; | ||
9552 | } | ||
9553 | |||
9554 | function stringParse( string ) { | ||
9555 | var inst = color(), | ||
9556 | rgba = inst._rgba = []; | ||
9557 | |||
9558 | string = string.toLowerCase(); | ||
9559 | |||
9560 | each( stringParsers, function( i, parser ) { | ||
9561 | var parsed, | ||
9562 | match = parser.re.exec( string ), | ||
9563 | values = match && parser.parse( match ), | ||
9564 | spaceName = parser.space || "rgba"; | ||
9565 | |||
9566 | if ( values ) { | ||
9567 | parsed = inst[ spaceName ]( values ); | ||
9568 | |||
9569 | // if this was an rgba parse the assignment might happen twice | ||
9570 | // oh well.... | ||
9571 | inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; | ||
9572 | rgba = inst._rgba = parsed._rgba; | ||
9573 | |||
9574 | // exit each( stringParsers ) here because we matched | ||
9575 | return false; | ||
9576 | } | ||
9577 | }); | ||
9578 | |||
9579 | // Found a stringParser that handled it | ||
9580 | if ( rgba.length ) { | ||
9581 | |||
9582 | // if this came from a parsed string, force "transparent" when alpha is 0 | ||
9583 | // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) | ||
9584 | if ( rgba.join() === "0,0,0,0" ) { | ||
9585 | jQuery.extend( rgba, colors.transparent ); | ||
9586 | } | ||
9587 | return inst; | ||
9588 | } | ||
9589 | |||
9590 | // named colors | ||
9591 | return colors[ string ]; | ||
9592 | } | ||
9593 | |||
9594 | color.fn = jQuery.extend( color.prototype, { | ||
9595 | parse: function( red, green, blue, alpha ) { | ||
9596 | if ( red === undefined ) { | ||
9597 | this._rgba = [ null, null, null, null ]; | ||
9598 | return this; | ||
9599 | } | ||
9600 | if ( red.jquery || red.nodeType ) { | ||
9601 | red = jQuery( red ).css( green ); | ||
9602 | green = undefined; | ||
9603 | } | ||
9604 | |||
9605 | var inst = this, | ||
9606 | type = jQuery.type( red ), | ||
9607 | rgba = this._rgba = []; | ||
9608 | |||
9609 | // more than 1 argument specified - assume ( red, green, blue, alpha ) | ||
9610 | if ( green !== undefined ) { | ||
9611 | red = [ red, green, blue, alpha ]; | ||
9612 | type = "array"; | ||
9613 | } | ||
9614 | |||
9615 | if ( type === "string" ) { | ||
9616 | return this.parse( stringParse( red ) || colors._default ); | ||
9617 | } | ||
9618 | |||
9619 | if ( type === "array" ) { | ||
9620 | each( spaces.rgba.props, function( key, prop ) { | ||
9621 | rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); | ||
9622 | }); | ||
9623 | return this; | ||
9624 | } | ||
9625 | |||
9626 | if ( type === "object" ) { | ||
9627 | if ( red instanceof color ) { | ||
9628 | each( spaces, function( spaceName, space ) { | ||
9629 | if ( red[ space.cache ] ) { | ||
9630 | inst[ space.cache ] = red[ space.cache ].slice(); | ||
9631 | } | ||
9632 | }); | ||
9633 | } else { | ||
9634 | each( spaces, function( spaceName, space ) { | ||
9635 | var cache = space.cache; | ||
9636 | each( space.props, function( key, prop ) { | ||
9637 | |||
9638 | // if the cache doesn't exist, and we know how to convert | ||
9639 | if ( !inst[ cache ] && space.to ) { | ||
9640 | |||
9641 | // if the value was null, we don't need to copy it | ||
9642 | // if the key was alpha, we don't need to copy it either | ||
9643 | if ( key === "alpha" || red[ key ] == null ) { | ||
9644 | return; | ||
9645 | } | ||
9646 | inst[ cache ] = space.to( inst._rgba ); | ||
9647 | } | ||
9648 | |||
9649 | // this is the only case where we allow nulls for ALL properties. | ||
9650 | // call clamp with alwaysAllowEmpty | ||
9651 | inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); | ||
9652 | }); | ||
9653 | |||
9654 | // everything defined but alpha? | ||
9655 | if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { | ||
9656 | // use the default of 1 | ||
9657 | inst[ cache ][ 3 ] = 1; | ||
9658 | if ( space.from ) { | ||
9659 | inst._rgba = space.from( inst[ cache ] ); | ||
9660 | } | ||
9661 | } | ||
9662 | }); | ||
9663 | } | ||
9664 | return this; | ||
9665 | } | ||
9666 | }, | ||
9667 | is: function( compare ) { | ||
9668 | var is = color( compare ), | ||
9669 | same = true, | ||
9670 | inst = this; | ||
9671 | |||
9672 | each( spaces, function( _, space ) { | ||
9673 | var localCache, | ||
9674 | isCache = is[ space.cache ]; | ||
9675 | if (isCache) { | ||
9676 | localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; | ||
9677 | each( space.props, function( _, prop ) { | ||
9678 | if ( isCache[ prop.idx ] != null ) { | ||
9679 | same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); | ||
9680 | return same; | ||
9681 | } | ||
9682 | }); | ||
9683 | } | ||
9684 | return same; | ||
9685 | }); | ||
9686 | return same; | ||
9687 | }, | ||
9688 | _space: function() { | ||
9689 | var used = [], | ||
9690 | inst = this; | ||
9691 | each( spaces, function( spaceName, space ) { | ||
9692 | if ( inst[ space.cache ] ) { | ||
9693 | used.push( spaceName ); | ||
9694 | } | ||
9695 | }); | ||
9696 | return used.pop(); | ||
9697 | }, | ||
9698 | transition: function( other, distance ) { | ||
9699 | var end = color( other ), | ||
9700 | spaceName = end._space(), | ||
9701 | space = spaces[ spaceName ], | ||
9702 | startColor = this.alpha() === 0 ? color( "transparent" ) : this, | ||
9703 | start = startColor[ space.cache ] || space.to( startColor._rgba ), | ||
9704 | result = start.slice(); | ||
9705 | |||
9706 | end = end[ space.cache ]; | ||
9707 | each( space.props, function( key, prop ) { | ||
9708 | var index = prop.idx, | ||
9709 | startValue = start[ index ], | ||
9710 | endValue = end[ index ], | ||
9711 | type = propTypes[ prop.type ] || {}; | ||
9712 | |||
9713 | // if null, don't override start value | ||
9714 | if ( endValue === null ) { | ||
9715 | return; | ||
9716 | } | ||
9717 | // if null - use end | ||
9718 | if ( startValue === null ) { | ||
9719 | result[ index ] = endValue; | ||
9720 | } else { | ||
9721 | if ( type.mod ) { | ||
9722 | if ( endValue - startValue > type.mod / 2 ) { | ||
9723 | startValue += type.mod; | ||
9724 | } else if ( startValue - endValue > type.mod / 2 ) { | ||
9725 | startValue -= type.mod; | ||
9726 | } | ||
9727 | } | ||
9728 | result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); | ||
9729 | } | ||
9730 | }); | ||
9731 | return this[ spaceName ]( result ); | ||
9732 | }, | ||
9733 | blend: function( opaque ) { | ||
9734 | // if we are already opaque - return ourself | ||
9735 | if ( this._rgba[ 3 ] === 1 ) { | ||
9736 | return this; | ||
9737 | } | ||
9738 | |||
9739 | var rgb = this._rgba.slice(), | ||
9740 | a = rgb.pop(), | ||
9741 | blend = color( opaque )._rgba; | ||
9742 | |||
9743 | return color( jQuery.map( rgb, function( v, i ) { | ||
9744 | return ( 1 - a ) * blend[ i ] + a * v; | ||
9745 | })); | ||
9746 | }, | ||
9747 | toRgbaString: function() { | ||
9748 | var prefix = "rgba(", | ||
9749 | rgba = jQuery.map( this._rgba, function( v, i ) { | ||
9750 | return v == null ? ( i > 2 ? 1 : 0 ) : v; | ||
9751 | }); | ||
9752 | |||
9753 | if ( rgba[ 3 ] === 1 ) { | ||
9754 | rgba.pop(); | ||
9755 | prefix = "rgb("; | ||
9756 | } | ||
9757 | |||
9758 | return prefix + rgba.join() + ")"; | ||
9759 | }, | ||
9760 | toHslaString: function() { | ||
9761 | var prefix = "hsla(", | ||
9762 | hsla = jQuery.map( this.hsla(), function( v, i ) { | ||
9763 | if ( v == null ) { | ||
9764 | v = i > 2 ? 1 : 0; | ||
9765 | } | ||
9766 | |||
9767 | // catch 1 and 2 | ||
9768 | if ( i && i < 3 ) { | ||
9769 | v = Math.round( v * 100 ) + "%"; | ||
9770 | } | ||
9771 | return v; | ||
9772 | }); | ||
9773 | |||
9774 | if ( hsla[ 3 ] === 1 ) { | ||
9775 | hsla.pop(); | ||
9776 | prefix = "hsl("; | ||
9777 | } | ||
9778 | return prefix + hsla.join() + ")"; | ||
9779 | }, | ||
9780 | toHexString: function( includeAlpha ) { | ||
9781 | var rgba = this._rgba.slice(), | ||
9782 | alpha = rgba.pop(); | ||
9783 | |||
9784 | if ( includeAlpha ) { | ||
9785 | rgba.push( ~~( alpha * 255 ) ); | ||
9786 | } | ||
9787 | |||
9788 | return "#" + jQuery.map( rgba, function( v ) { | ||
9789 | |||
9790 | // default to 0 when nulls exist | ||
9791 | v = ( v || 0 ).toString( 16 ); | ||
9792 | return v.length === 1 ? "0" + v : v; | ||
9793 | }).join(""); | ||
9794 | }, | ||
9795 | toString: function() { | ||
9796 | return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); | ||
9797 | } | ||
9798 | }); | ||
9799 | color.fn.parse.prototype = color.fn; | ||
9800 | |||
9801 | // hsla conversions adapted from: | ||
9802 | // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 | ||
9803 | |||
9804 | function hue2rgb( p, q, h ) { | ||
9805 | h = ( h + 1 ) % 1; | ||
9806 | if ( h * 6 < 1 ) { | ||
9807 | return p + ( q - p ) * h * 6; | ||
9808 | } | ||
9809 | if ( h * 2 < 1) { | ||
9810 | return q; | ||
9811 | } | ||
9812 | if ( h * 3 < 2 ) { | ||
9813 | return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; | ||
9814 | } | ||
9815 | return p; | ||
9816 | } | ||
9817 | |||
9818 | spaces.hsla.to = function( rgba ) { | ||
9819 | if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { | ||
9820 | return [ null, null, null, rgba[ 3 ] ]; | ||
9821 | } | ||
9822 | var r = rgba[ 0 ] / 255, | ||
9823 | g = rgba[ 1 ] / 255, | ||
9824 | b = rgba[ 2 ] / 255, | ||
9825 | a = rgba[ 3 ], | ||
9826 | max = Math.max( r, g, b ), | ||
9827 | min = Math.min( r, g, b ), | ||
9828 | diff = max - min, | ||
9829 | add = max + min, | ||
9830 | l = add * 0.5, | ||
9831 | h, s; | ||
9832 | |||
9833 | if ( min === max ) { | ||
9834 | h = 0; | ||
9835 | } else if ( r === max ) { | ||
9836 | h = ( 60 * ( g - b ) / diff ) + 360; | ||
9837 | } else if ( g === max ) { | ||
9838 | h = ( 60 * ( b - r ) / diff ) + 120; | ||
9839 | } else { | ||
9840 | h = ( 60 * ( r - g ) / diff ) + 240; | ||
9841 | } | ||
9842 | |||
9843 | // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% | ||
9844 | // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) | ||
9845 | if ( diff === 0 ) { | ||
9846 | s = 0; | ||
9847 | } else if ( l <= 0.5 ) { | ||
9848 | s = diff / add; | ||
9849 | } else { | ||
9850 | s = diff / ( 2 - add ); | ||
9851 | } | ||
9852 | return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; | ||
9853 | }; | ||
9854 | |||
9855 | spaces.hsla.from = function( hsla ) { | ||
9856 | if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { | ||
9857 | return [ null, null, null, hsla[ 3 ] ]; | ||
9858 | } | ||
9859 | var h = hsla[ 0 ] / 360, | ||
9860 | s = hsla[ 1 ], | ||
9861 | l = hsla[ 2 ], | ||
9862 | a = hsla[ 3 ], | ||
9863 | q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, | ||
9864 | p = 2 * l - q; | ||
9865 | |||
9866 | return [ | ||
9867 | Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), | ||
9868 | Math.round( hue2rgb( p, q, h ) * 255 ), | ||
9869 | Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), | ||
9870 | a | ||
9871 | ]; | ||
9872 | }; | ||
9873 | |||
9874 | each( spaces, function( spaceName, space ) { | ||
9875 | var props = space.props, | ||
9876 | cache = space.cache, | ||
9877 | to = space.to, | ||
9878 | from = space.from; | ||
9879 | |||
9880 | // makes rgba() and hsla() | ||
9881 | color.fn[ spaceName ] = function( value ) { | ||
9882 | |||
9883 | // generate a cache for this space if it doesn't exist | ||
9884 | if ( to && !this[ cache ] ) { | ||
9885 | this[ cache ] = to( this._rgba ); | ||
9886 | } | ||
9887 | if ( value === undefined ) { | ||
9888 | return this[ cache ].slice(); | ||
9889 | } | ||
9890 | |||
9891 | var ret, | ||
9892 | type = jQuery.type( value ), | ||
9893 | arr = ( type === "array" || type === "object" ) ? value : arguments, | ||
9894 | local = this[ cache ].slice(); | ||
9895 | |||
9896 | each( props, function( key, prop ) { | ||
9897 | var val = arr[ type === "object" ? key : prop.idx ]; | ||
9898 | if ( val == null ) { | ||
9899 | val = local[ prop.idx ]; | ||
9900 | } | ||
9901 | local[ prop.idx ] = clamp( val, prop ); | ||
9902 | }); | ||
9903 | |||
9904 | if ( from ) { | ||
9905 | ret = color( from( local ) ); | ||
9906 | ret[ cache ] = local; | ||
9907 | return ret; | ||
9908 | } else { | ||
9909 | return color( local ); | ||
9910 | } | ||
9911 | }; | ||
9912 | |||
9913 | // makes red() green() blue() alpha() hue() saturation() lightness() | ||
9914 | each( props, function( key, prop ) { | ||
9915 | // alpha is included in more than one space | ||
9916 | if ( color.fn[ key ] ) { | ||
9917 | return; | ||
9918 | } | ||
9919 | color.fn[ key ] = function( value ) { | ||
9920 | var vtype = jQuery.type( value ), | ||
9921 | fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), | ||
9922 | local = this[ fn ](), | ||
9923 | cur = local[ prop.idx ], | ||
9924 | match; | ||
9925 | |||
9926 | if ( vtype === "undefined" ) { | ||
9927 | return cur; | ||
9928 | } | ||
9929 | |||
9930 | if ( vtype === "function" ) { | ||
9931 | value = value.call( this, cur ); | ||
9932 | vtype = jQuery.type( value ); | ||
9933 | } | ||
9934 | if ( value == null && prop.empty ) { | ||
9935 | return this; | ||
9936 | } | ||
9937 | if ( vtype === "string" ) { | ||
9938 | match = rplusequals.exec( value ); | ||
9939 | if ( match ) { | ||
9940 | value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); | ||
9941 | } | ||
9942 | } | ||
9943 | local[ prop.idx ] = value; | ||
9944 | return this[ fn ]( local ); | ||
9945 | }; | ||
9946 | }); | ||
9947 | }); | ||
9948 | |||
9949 | // add cssHook and .fx.step function for each named hook. | ||
9950 | // accept a space separated string of properties | ||
9951 | color.hook = function( hook ) { | ||
9952 | var hooks = hook.split( " " ); | ||
9953 | each( hooks, function( i, hook ) { | ||
9954 | jQuery.cssHooks[ hook ] = { | ||
9955 | set: function( elem, value ) { | ||
9956 | var parsed, curElem, | ||
9957 | backgroundColor = ""; | ||
9958 | |||
9959 | if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { | ||
9960 | value = color( parsed || value ); | ||
9961 | if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { | ||
9962 | curElem = hook === "backgroundColor" ? elem.parentNode : elem; | ||
9963 | while ( | ||
9964 | (backgroundColor === "" || backgroundColor === "transparent") && | ||
9965 | curElem && curElem.style | ||
9966 | ) { | ||
9967 | try { | ||
9968 | backgroundColor = jQuery.css( curElem, "backgroundColor" ); | ||
9969 | curElem = curElem.parentNode; | ||
9970 | } catch ( e ) { | ||
9971 | } | ||
9972 | } | ||
9973 | |||
9974 | value = value.blend( backgroundColor && backgroundColor !== "transparent" ? | ||
9975 | backgroundColor : | ||
9976 | "_default" ); | ||
9977 | } | ||
9978 | |||
9979 | value = value.toRgbaString(); | ||
9980 | } | ||
9981 | try { | ||
9982 | elem.style[ hook ] = value; | ||
9983 | } catch ( e ) { | ||
9984 | // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' | ||
9985 | } | ||
9986 | } | ||
9987 | }; | ||
9988 | jQuery.fx.step[ hook ] = function( fx ) { | ||
9989 | if ( !fx.colorInit ) { | ||
9990 | fx.start = color( fx.elem, hook ); | ||
9991 | fx.end = color( fx.end ); | ||
9992 | fx.colorInit = true; | ||
9993 | } | ||
9994 | jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); | ||
9995 | }; | ||
9996 | }); | ||
9997 | |||
9998 | }; | ||
9999 | |||
10000 | color.hook( stepHooks ); | ||
10001 | |||
10002 | jQuery.cssHooks.borderColor = { | ||
10003 | expand: function( value ) { | ||
10004 | var expanded = {}; | ||
10005 | |||
10006 | each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { | ||
10007 | expanded[ "border" + part + "Color" ] = value; | ||
10008 | }); | ||
10009 | return expanded; | ||
10010 | } | ||
10011 | }; | ||
10012 | |||
10013 | // Basic color names only. | ||
10014 | // Usage of any of the other color names requires adding yourself or including | ||
10015 | // jquery.color.svg-names.js. | ||
10016 | colors = jQuery.Color.names = { | ||
10017 | // 4.1. Basic color keywords | ||
10018 | aqua: "#00ffff", | ||
10019 | black: "#000000", | ||
10020 | blue: "#0000ff", | ||
10021 | fuchsia: "#ff00ff", | ||
10022 | gray: "#808080", | ||
10023 | green: "#008000", | ||
10024 | lime: "#00ff00", | ||
10025 | maroon: "#800000", | ||
10026 | navy: "#000080", | ||
10027 | olive: "#808000", | ||
10028 | purple: "#800080", | ||
10029 | red: "#ff0000", | ||
10030 | silver: "#c0c0c0", | ||
10031 | teal: "#008080", | ||
10032 | white: "#ffffff", | ||
10033 | yellow: "#ffff00", | ||
10034 | |||
10035 | // 4.2.3. "transparent" color keyword | ||
10036 | transparent: [ null, null, null, 0 ], | ||
10037 | |||
10038 | _default: "#ffffff" | ||
10039 | }; | ||
10040 | |||
10041 | })( jQuery ); | ||
10042 | |||
10043 | /******************************************************************************/ | ||
10044 | /****************************** CLASS ANIMATIONS ******************************/ | ||
10045 | /******************************************************************************/ | ||
10046 | (function() { | ||
10047 | |||
10048 | var classAnimationActions = [ "add", "remove", "toggle" ], | ||
10049 | shorthandStyles = { | ||
10050 | border: 1, | ||
10051 | borderBottom: 1, | ||
10052 | borderColor: 1, | ||
10053 | borderLeft: 1, | ||
10054 | borderRight: 1, | ||
10055 | borderTop: 1, | ||
10056 | borderWidth: 1, | ||
10057 | margin: 1, | ||
10058 | padding: 1 | ||
10059 | }; | ||
10060 | |||
10061 | $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { | ||
10062 | $.fx.step[ prop ] = function( fx ) { | ||
10063 | if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { | ||
10064 | jQuery.style( fx.elem, prop, fx.end ); | ||
10065 | fx.setAttr = true; | ||
10066 | } | ||
10067 | }; | ||
10068 | }); | ||
10069 | |||
10070 | function getElementStyles( elem ) { | ||
10071 | var key, len, | ||
10072 | style = elem.ownerDocument.defaultView ? | ||
10073 | elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : | ||
10074 | elem.currentStyle, | ||
10075 | styles = {}; | ||
10076 | |||
10077 | if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { | ||
10078 | len = style.length; | ||
10079 | while ( len-- ) { | ||
10080 | key = style[ len ]; | ||
10081 | if ( typeof style[ key ] === "string" ) { | ||
10082 | styles[ $.camelCase( key ) ] = style[ key ]; | ||
10083 | } | ||
10084 | } | ||
10085 | // support: Opera, IE <9 | ||
10086 | } else { | ||
10087 | for ( key in style ) { | ||
10088 | if ( typeof style[ key ] === "string" ) { | ||
10089 | styles[ key ] = style[ key ]; | ||
10090 | } | ||
10091 | } | ||
10092 | } | ||
10093 | |||
10094 | return styles; | ||
10095 | } | ||
10096 | |||
10097 | function styleDifference( oldStyle, newStyle ) { | ||
10098 | var diff = {}, | ||
10099 | name, value; | ||
10100 | |||
10101 | for ( name in newStyle ) { | ||
10102 | value = newStyle[ name ]; | ||
10103 | if ( oldStyle[ name ] !== value ) { | ||
10104 | if ( !shorthandStyles[ name ] ) { | ||
10105 | if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { | ||
10106 | diff[ name ] = value; | ||
10107 | } | ||
10108 | } | ||
10109 | } | ||
10110 | } | ||
10111 | |||
10112 | return diff; | ||
10113 | } | ||
10114 | |||
10115 | // support: jQuery <1.8 | ||
10116 | if ( !$.fn.addBack ) { | ||
10117 | $.fn.addBack = function( selector ) { | ||
10118 | return this.add( selector == null ? | ||
10119 | this.prevObject : this.prevObject.filter( selector ) | ||
10120 | ); | ||
10121 | }; | ||
10122 | } | ||
10123 | |||
10124 | $.effects.animateClass = function( value, duration, easing, callback ) { | ||
10125 | var o = $.speed( duration, easing, callback ); | ||
10126 | |||
10127 | return this.queue( function() { | ||
10128 | var animated = $( this ), | ||
10129 | baseClass = animated.attr( "class" ) || "", | ||
10130 | applyClassChange, | ||
10131 | allAnimations = o.children ? animated.find( "*" ).addBack() : animated; | ||
10132 | |||
10133 | // map the animated objects to store the original styles. | ||
10134 | allAnimations = allAnimations.map(function() { | ||
10135 | var el = $( this ); | ||
10136 | return { | ||
10137 | el: el, | ||
10138 | start: getElementStyles( this ) | ||
10139 | }; | ||
10140 | }); | ||
10141 | |||
10142 | // apply class change | ||
10143 | applyClassChange = function() { | ||
10144 | $.each( classAnimationActions, function(i, action) { | ||
10145 | if ( value[ action ] ) { | ||
10146 | animated[ action + "Class" ]( value[ action ] ); | ||
10147 | } | ||
10148 | }); | ||
10149 | }; | ||
10150 | applyClassChange(); | ||
10151 | |||
10152 | // map all animated objects again - calculate new styles and diff | ||
10153 | allAnimations = allAnimations.map(function() { | ||
10154 | this.end = getElementStyles( this.el[ 0 ] ); | ||
10155 | this.diff = styleDifference( this.start, this.end ); | ||
10156 | return this; | ||
10157 | }); | ||
10158 | |||
10159 | // apply original class | ||
10160 | animated.attr( "class", baseClass ); | ||
10161 | |||
10162 | // map all animated objects again - this time collecting a promise | ||
10163 | allAnimations = allAnimations.map(function() { | ||
10164 | var styleInfo = this, | ||
10165 | dfd = $.Deferred(), | ||
10166 | opts = $.extend({}, o, { | ||
10167 | queue: false, | ||
10168 | complete: function() { | ||
10169 | dfd.resolve( styleInfo ); | ||
10170 | } | ||
10171 | }); | ||
10172 | |||
10173 | this.el.animate( this.diff, opts ); | ||
10174 | return dfd.promise(); | ||
10175 | }); | ||
10176 | |||
10177 | // once all animations have completed: | ||
10178 | $.when.apply( $, allAnimations.get() ).done(function() { | ||
10179 | |||
10180 | // set the final class | ||
10181 | applyClassChange(); | ||
10182 | |||
10183 | // for each animated element, | ||
10184 | // clear all css properties that were animated | ||
10185 | $.each( arguments, function() { | ||
10186 | var el = this.el; | ||
10187 | $.each( this.diff, function(key) { | ||
10188 | el.css( key, "" ); | ||
10189 | }); | ||
10190 | }); | ||
10191 | |||
10192 | // this is guarnteed to be there if you use jQuery.speed() | ||
10193 | // it also handles dequeuing the next anim... | ||
10194 | o.complete.call( animated[ 0 ] ); | ||
10195 | }); | ||
10196 | }); | ||
10197 | }; | ||
10198 | |||
10199 | $.fn.extend({ | ||
10200 | addClass: (function( orig ) { | ||
10201 | return function( classNames, speed, easing, callback ) { | ||
10202 | return speed ? | ||
10203 | $.effects.animateClass.call( this, | ||
10204 | { add: classNames }, speed, easing, callback ) : | ||
10205 | orig.apply( this, arguments ); | ||
10206 | }; | ||
10207 | })( $.fn.addClass ), | ||
10208 | |||
10209 | removeClass: (function( orig ) { | ||
10210 | return function( classNames, speed, easing, callback ) { | ||
10211 | return arguments.length > 1 ? | ||
10212 | $.effects.animateClass.call( this, | ||
10213 | { remove: classNames }, speed, easing, callback ) : | ||
10214 | orig.apply( this, arguments ); | ||
10215 | }; | ||
10216 | })( $.fn.removeClass ), | ||
10217 | |||
10218 | toggleClass: (function( orig ) { | ||
10219 | return function( classNames, force, speed, easing, callback ) { | ||
10220 | if ( typeof force === "boolean" || force === undefined ) { | ||
10221 | if ( !speed ) { | ||
10222 | // without speed parameter | ||
10223 | return orig.apply( this, arguments ); | ||
10224 | } else { | ||
10225 | return $.effects.animateClass.call( this, | ||
10226 | (force ? { add: classNames } : { remove: classNames }), | ||
10227 | speed, easing, callback ); | ||
10228 | } | ||
10229 | } else { | ||
10230 | // without force parameter | ||
10231 | return $.effects.animateClass.call( this, | ||
10232 | { toggle: classNames }, force, speed, easing ); | ||
10233 | } | ||
10234 | }; | ||
10235 | })( $.fn.toggleClass ), | ||
10236 | |||
10237 | switchClass: function( remove, add, speed, easing, callback) { | ||
10238 | return $.effects.animateClass.call( this, { | ||
10239 | add: add, | ||
10240 | remove: remove | ||
10241 | }, speed, easing, callback ); | ||
10242 | } | ||
10243 | }); | ||
10244 | |||
10245 | })(); | ||
10246 | |||
10247 | /******************************************************************************/ | ||
10248 | /*********************************** EFFECTS **********************************/ | ||
10249 | /******************************************************************************/ | ||
10250 | |||
10251 | (function() { | ||
10252 | |||
10253 | $.extend( $.effects, { | ||
10254 | version: "1.11.2", | ||
10255 | |||
10256 | // Saves a set of properties in a data storage | ||
10257 | save: function( element, set ) { | ||
10258 | for ( var i = 0; i < set.length; i++ ) { | ||
10259 | if ( set[ i ] !== null ) { | ||
10260 | element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); | ||
10261 | } | ||
10262 | } | ||
10263 | }, | ||
10264 | |||
10265 | // Restores a set of previously saved properties from a data storage | ||
10266 | restore: function( element, set ) { | ||
10267 | var val, i; | ||
10268 | for ( i = 0; i < set.length; i++ ) { | ||
10269 | if ( set[ i ] !== null ) { | ||
10270 | val = element.data( dataSpace + set[ i ] ); | ||
10271 | // support: jQuery 1.6.2 | ||
10272 | // http://bugs.jquery.com/ticket/9917 | ||
10273 | // jQuery 1.6.2 incorrectly returns undefined for any falsy value. | ||
10274 | // We can't differentiate between "" and 0 here, so we just assume | ||
10275 | // empty string since it's likely to be a more common value... | ||
10276 | if ( val === undefined ) { | ||
10277 | val = ""; | ||
10278 | } | ||
10279 | element.css( set[ i ], val ); | ||
10280 | } | ||
10281 | } | ||
10282 | }, | ||
10283 | |||
10284 | setMode: function( el, mode ) { | ||
10285 | if (mode === "toggle") { | ||
10286 | mode = el.is( ":hidden" ) ? "show" : "hide"; | ||
10287 | } | ||
10288 | return mode; | ||
10289 | }, | ||
10290 | |||
10291 | // Translates a [top,left] array into a baseline value | ||
10292 | // this should be a little more flexible in the future to handle a string & hash | ||
10293 | getBaseline: function( origin, original ) { | ||
10294 | var y, x; | ||
10295 | switch ( origin[ 0 ] ) { | ||
10296 | case "top": y = 0; break; | ||
10297 | case "middle": y = 0.5; break; | ||
10298 | case "bottom": y = 1; break; | ||
10299 | default: y = origin[ 0 ] / original.height; | ||
10300 | } | ||
10301 | switch ( origin[ 1 ] ) { | ||
10302 | case "left": x = 0; break; | ||
10303 | case "center": x = 0.5; break; | ||
10304 | case "right": x = 1; break; | ||
10305 | default: x = origin[ 1 ] / original.width; | ||
10306 | } | ||
10307 | return { | ||
10308 | x: x, | ||
10309 | y: y | ||
10310 | }; | ||
10311 | }, | ||
10312 | |||
10313 | // Wraps the element around a wrapper that copies position properties | ||
10314 | createWrapper: function( element ) { | ||
10315 | |||
10316 | // if the element is already wrapped, return it | ||
10317 | if ( element.parent().is( ".ui-effects-wrapper" )) { | ||
10318 | return element.parent(); | ||
10319 | } | ||
10320 | |||
10321 | // wrap the element | ||
10322 | var props = { | ||
10323 | width: element.outerWidth(true), | ||
10324 | height: element.outerHeight(true), | ||
10325 | "float": element.css( "float" ) | ||
10326 | }, | ||
10327 | wrapper = $( "<div></div>" ) | ||
10328 | .addClass( "ui-effects-wrapper" ) | ||
10329 | .css({ | ||
10330 | fontSize: "100%", | ||
10331 | background: "transparent", | ||
10332 | border: "none", | ||
10333 | margin: 0, | ||
10334 | padding: 0 | ||
10335 | }), | ||
10336 | // Store the size in case width/height are defined in % - Fixes #5245 | ||
10337 | size = { | ||
10338 | width: element.width(), | ||
10339 | height: element.height() | ||
10340 | }, | ||
10341 | active = document.activeElement; | ||
10342 | |||
10343 | // support: Firefox | ||
10344 | // Firefox incorrectly exposes anonymous content | ||
10345 | // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 | ||
10346 | try { | ||
10347 | active.id; | ||
10348 | } catch ( e ) { | ||
10349 | active = document.body; | ||
10350 | } | ||
10351 | |||
10352 | element.wrap( wrapper ); | ||
10353 | |||
10354 | // Fixes #7595 - Elements lose focus when wrapped. | ||
10355 | if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { | ||
10356 | $( active ).focus(); | ||
10357 | } | ||
10358 | |||
10359 | wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element | ||
10360 | |||
10361 | // transfer positioning properties to the wrapper | ||
10362 | if ( element.css( "position" ) === "static" ) { | ||
10363 | wrapper.css({ position: "relative" }); | ||
10364 | element.css({ position: "relative" }); | ||
10365 | } else { | ||
10366 | $.extend( props, { | ||
10367 | position: element.css( "position" ), | ||
10368 | zIndex: element.css( "z-index" ) | ||
10369 | }); | ||
10370 | $.each([ "top", "left", "bottom", "right" ], function(i, pos) { | ||
10371 | props[ pos ] = element.css( pos ); | ||
10372 | if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { | ||
10373 | props[ pos ] = "auto"; | ||
10374 | } | ||
10375 | }); | ||
10376 | element.css({ | ||
10377 | position: "relative", | ||
10378 | top: 0, | ||
10379 | left: 0, | ||
10380 | right: "auto", | ||
10381 | bottom: "auto" | ||
10382 | }); | ||
10383 | } | ||
10384 | element.css(size); | ||
10385 | |||
10386 | return wrapper.css( props ).show(); | ||
10387 | }, | ||
10388 | |||
10389 | removeWrapper: function( element ) { | ||
10390 | var active = document.activeElement; | ||
10391 | |||
10392 | if ( element.parent().is( ".ui-effects-wrapper" ) ) { | ||
10393 | element.parent().replaceWith( element ); | ||
10394 | |||
10395 | // Fixes #7595 - Elements lose focus when wrapped. | ||
10396 | if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { | ||
10397 | $( active ).focus(); | ||
10398 | } | ||
10399 | } | ||
10400 | |||
10401 | return element; | ||
10402 | }, | ||
10403 | |||
10404 | setTransition: function( element, list, factor, value ) { | ||
10405 | value = value || {}; | ||
10406 | $.each( list, function( i, x ) { | ||
10407 | var unit = element.cssUnit( x ); | ||
10408 | if ( unit[ 0 ] > 0 ) { | ||
10409 | value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; | ||
10410 | } | ||
10411 | }); | ||
10412 | return value; | ||
10413 | } | ||
10414 | }); | ||
10415 | |||
10416 | // return an effect options object for the given parameters: | ||
10417 | function _normalizeArguments( effect, options, speed, callback ) { | ||
10418 | |||
10419 | // allow passing all options as the first parameter | ||
10420 | if ( $.isPlainObject( effect ) ) { | ||
10421 | options = effect; | ||
10422 | effect = effect.effect; | ||
10423 | } | ||
10424 | |||
10425 | // convert to an object | ||
10426 | effect = { effect: effect }; | ||
10427 | |||
10428 | // catch (effect, null, ...) | ||
10429 | if ( options == null ) { | ||
10430 | options = {}; | ||
10431 | } | ||
10432 | |||
10433 | // catch (effect, callback) | ||
10434 | if ( $.isFunction( options ) ) { | ||
10435 | callback = options; | ||
10436 | speed = null; | ||
10437 | options = {}; | ||
10438 | } | ||
10439 | |||
10440 | // catch (effect, speed, ?) | ||
10441 | if ( typeof options === "number" || $.fx.speeds[ options ] ) { | ||
10442 | callback = speed; | ||
10443 | speed = options; | ||
10444 | options = {}; | ||
10445 | } | ||
10446 | |||
10447 | // catch (effect, options, callback) | ||
10448 | if ( $.isFunction( speed ) ) { | ||
10449 | callback = speed; | ||
10450 | speed = null; | ||
10451 | } | ||
10452 | |||
10453 | // add options to effect | ||
10454 | if ( options ) { | ||
10455 | $.extend( effect, options ); | ||
10456 | } | ||
10457 | |||
10458 | speed = speed || options.duration; | ||
10459 | effect.duration = $.fx.off ? 0 : | ||
10460 | typeof speed === "number" ? speed : | ||
10461 | speed in $.fx.speeds ? $.fx.speeds[ speed ] : | ||
10462 | $.fx.speeds._default; | ||
10463 | |||
10464 | effect.complete = callback || options.complete; | ||
10465 | |||
10466 | return effect; | ||
10467 | } | ||
10468 | |||
10469 | function standardAnimationOption( option ) { | ||
10470 | // Valid standard speeds (nothing, number, named speed) | ||
10471 | if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { | ||
10472 | return true; | ||
10473 | } | ||
10474 | |||
10475 | // Invalid strings - treat as "normal" speed | ||
10476 | if ( typeof option === "string" && !$.effects.effect[ option ] ) { | ||
10477 | return true; | ||
10478 | } | ||
10479 | |||
10480 | // Complete callback | ||
10481 | if ( $.isFunction( option ) ) { | ||
10482 | return true; | ||
10483 | } | ||
10484 | |||
10485 | // Options hash (but not naming an effect) | ||
10486 | if ( typeof option === "object" && !option.effect ) { | ||
10487 | return true; | ||
10488 | } | ||
10489 | |||
10490 | // Didn't match any standard API | ||
10491 | return false; | ||
10492 | } | ||
10493 | |||
10494 | $.fn.extend({ | ||
10495 | effect: function( /* effect, options, speed, callback */ ) { | ||
10496 | var args = _normalizeArguments.apply( this, arguments ), | ||
10497 | mode = args.mode, | ||
10498 | queue = args.queue, | ||
10499 | effectMethod = $.effects.effect[ args.effect ]; | ||
10500 | |||
10501 | if ( $.fx.off || !effectMethod ) { | ||
10502 | // delegate to the original method (e.g., .show()) if possible | ||
10503 | if ( mode ) { | ||
10504 | return this[ mode ]( args.duration, args.complete ); | ||
10505 | } else { | ||
10506 | return this.each( function() { | ||
10507 | if ( args.complete ) { | ||
10508 | args.complete.call( this ); | ||
10509 | } | ||
10510 | }); | ||
10511 | } | ||
10512 | } | ||
10513 | |||
10514 | function run( next ) { | ||
10515 | var elem = $( this ), | ||
10516 | complete = args.complete, | ||
10517 | mode = args.mode; | ||
10518 | |||
10519 | function done() { | ||
10520 | if ( $.isFunction( complete ) ) { | ||
10521 | complete.call( elem[0] ); | ||
10522 | } | ||
10523 | if ( $.isFunction( next ) ) { | ||
10524 | next(); | ||
10525 | } | ||
10526 | } | ||
10527 | |||
10528 | // If the element already has the correct final state, delegate to | ||
10529 | // the core methods so the internal tracking of "olddisplay" works. | ||
10530 | if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { | ||
10531 | elem[ mode ](); | ||
10532 | done(); | ||
10533 | } else { | ||
10534 | effectMethod.call( elem[0], args, done ); | ||
10535 | } | ||
10536 | } | ||
10537 | |||
10538 | return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); | ||
10539 | }, | ||
10540 | |||
10541 | show: (function( orig ) { | ||
10542 | return function( option ) { | ||
10543 | if ( standardAnimationOption( option ) ) { | ||
10544 | return orig.apply( this, arguments ); | ||
10545 | } else { | ||
10546 | var args = _normalizeArguments.apply( this, arguments ); | ||
10547 | args.mode = "show"; | ||
10548 | return this.effect.call( this, args ); | ||
10549 | } | ||
10550 | }; | ||
10551 | })( $.fn.show ), | ||
10552 | |||
10553 | hide: (function( orig ) { | ||
10554 | return function( option ) { | ||
10555 | if ( standardAnimationOption( option ) ) { | ||
10556 | return orig.apply( this, arguments ); | ||
10557 | } else { | ||
10558 | var args = _normalizeArguments.apply( this, arguments ); | ||
10559 | args.mode = "hide"; | ||
10560 | return this.effect.call( this, args ); | ||
10561 | } | ||
10562 | }; | ||
10563 | })( $.fn.hide ), | ||
10564 | |||
10565 | toggle: (function( orig ) { | ||
10566 | return function( option ) { | ||
10567 | if ( standardAnimationOption( option ) || typeof option === "boolean" ) { | ||
10568 | return orig.apply( this, arguments ); | ||
10569 | } else { | ||
10570 | var args = _normalizeArguments.apply( this, arguments ); | ||
10571 | args.mode = "toggle"; | ||
10572 | return this.effect.call( this, args ); | ||
10573 | } | ||
10574 | }; | ||
10575 | })( $.fn.toggle ), | ||
10576 | |||
10577 | // helper functions | ||
10578 | cssUnit: function(key) { | ||
10579 | var style = this.css( key ), | ||
10580 | val = []; | ||
10581 | |||
10582 | $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { | ||
10583 | if ( style.indexOf( unit ) > 0 ) { | ||
10584 | val = [ parseFloat( style ), unit ]; | ||
10585 | } | ||
10586 | }); | ||
10587 | return val; | ||
10588 | } | ||
10589 | }); | ||
10590 | |||
10591 | })(); | ||
10592 | |||
10593 | /******************************************************************************/ | ||
10594 | /*********************************** EASING ***********************************/ | ||
10595 | /******************************************************************************/ | ||
10596 | |||
10597 | (function() { | ||
10598 | |||
10599 | // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) | ||
10600 | |||
10601 | var baseEasings = {}; | ||
10602 | |||
10603 | $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { | ||
10604 | baseEasings[ name ] = function( p ) { | ||
10605 | return Math.pow( p, i + 2 ); | ||
10606 | }; | ||
10607 | }); | ||
10608 | |||
10609 | $.extend( baseEasings, { | ||
10610 | Sine: function( p ) { | ||
10611 | return 1 - Math.cos( p * Math.PI / 2 ); | ||
10612 | }, | ||
10613 | Circ: function( p ) { | ||
10614 | return 1 - Math.sqrt( 1 - p * p ); | ||
10615 | }, | ||
10616 | Elastic: function( p ) { | ||
10617 | return p === 0 || p === 1 ? p : | ||
10618 | -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); | ||
10619 | }, | ||
10620 | Back: function( p ) { | ||
10621 | return p * p * ( 3 * p - 2 ); | ||
10622 | }, | ||
10623 | Bounce: function( p ) { | ||
10624 | var pow2, | ||
10625 | bounce = 4; | ||
10626 | |||
10627 | while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} | ||
10628 | return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); | ||
10629 | } | ||
10630 | }); | ||
10631 | |||
10632 | $.each( baseEasings, function( name, easeIn ) { | ||
10633 | $.easing[ "easeIn" + name ] = easeIn; | ||
10634 | $.easing[ "easeOut" + name ] = function( p ) { | ||
10635 | return 1 - easeIn( 1 - p ); | ||
10636 | }; | ||
10637 | $.easing[ "easeInOut" + name ] = function( p ) { | ||
10638 | return p < 0.5 ? | ||
10639 | easeIn( p * 2 ) / 2 : | ||
10640 | 1 - easeIn( p * -2 + 2 ) / 2; | ||
10641 | }; | ||
10642 | }); | ||
10643 | |||
10644 | })(); | ||
10645 | |||
10646 | var effect = $.effects; | ||
10647 | |||
10648 | |||
10649 | /*! | ||
10650 | * jQuery UI Effects Blind 1.11.2 | ||
10651 | * http://jqueryui.com | ||
10652 | * | ||
10653 | * Copyright 2014 jQuery Foundation and other contributors | ||
10654 | * Released under the MIT license. | ||
10655 | * http://jquery.org/license | ||
10656 | * | ||
10657 | * http://api.jqueryui.com/blind-effect/ | ||
10658 | */ | ||
10659 | |||
10660 | |||
10661 | var effectBlind = $.effects.effect.blind = function( o, done ) { | ||
10662 | // Create element | ||
10663 | var el = $( this ), | ||
10664 | rvertical = /up|down|vertical/, | ||
10665 | rpositivemotion = /up|left|vertical|horizontal/, | ||
10666 | props = [ "position", "top", "bottom", "left", "right", "height", "width" ], | ||
10667 | mode = $.effects.setMode( el, o.mode || "hide" ), | ||
10668 | direction = o.direction || "up", | ||
10669 | vertical = rvertical.test( direction ), | ||
10670 | ref = vertical ? "height" : "width", | ||
10671 | ref2 = vertical ? "top" : "left", | ||
10672 | motion = rpositivemotion.test( direction ), | ||
10673 | animation = {}, | ||
10674 | show = mode === "show", | ||
10675 | wrapper, distance, margin; | ||
10676 | |||
10677 | // if already wrapped, the wrapper's properties are my property. #6245 | ||
10678 | if ( el.parent().is( ".ui-effects-wrapper" ) ) { | ||
10679 | $.effects.save( el.parent(), props ); | ||
10680 | } else { | ||
10681 | $.effects.save( el, props ); | ||
10682 | } | ||
10683 | el.show(); | ||
10684 | wrapper = $.effects.createWrapper( el ).css({ | ||
10685 | overflow: "hidden" | ||
10686 | }); | ||
10687 | |||
10688 | distance = wrapper[ ref ](); | ||
10689 | margin = parseFloat( wrapper.css( ref2 ) ) || 0; | ||
10690 | |||
10691 | animation[ ref ] = show ? distance : 0; | ||
10692 | if ( !motion ) { | ||
10693 | el | ||
10694 | .css( vertical ? "bottom" : "right", 0 ) | ||
10695 | .css( vertical ? "top" : "left", "auto" ) | ||
10696 | .css({ position: "absolute" }); | ||
10697 | |||
10698 | animation[ ref2 ] = show ? margin : distance + margin; | ||
10699 | } | ||
10700 | |||
10701 | // start at 0 if we are showing | ||
10702 | if ( show ) { | ||
10703 | wrapper.css( ref, 0 ); | ||
10704 | if ( !motion ) { | ||
10705 | wrapper.css( ref2, margin + distance ); | ||
10706 | } | ||
10707 | } | ||
10708 | |||
10709 | // Animate | ||
10710 | wrapper.animate( animation, { | ||
10711 | duration: o.duration, | ||
10712 | easing: o.easing, | ||
10713 | queue: false, | ||
10714 | complete: function() { | ||
10715 | if ( mode === "hide" ) { | ||
10716 | el.hide(); | ||
10717 | } | ||
10718 | $.effects.restore( el, props ); | ||
10719 | $.effects.removeWrapper( el ); | ||
10720 | done(); | ||
10721 | } | ||
10722 | }); | ||
10723 | }; | ||
10724 | |||
10725 | |||
10726 | /*! | ||
10727 | * jQuery UI Effects Bounce 1.11.2 | ||
10728 | * http://jqueryui.com | ||
10729 | * | ||
10730 | * Copyright 2014 jQuery Foundation and other contributors | ||
10731 | * Released under the MIT license. | ||
10732 | * http://jquery.org/license | ||
10733 | * | ||
10734 | * http://api.jqueryui.com/bounce-effect/ | ||
10735 | */ | ||
10736 | |||
10737 | |||
10738 | var effectBounce = $.effects.effect.bounce = function( o, done ) { | ||
10739 | var el = $( this ), | ||
10740 | props = [ "position", "top", "bottom", "left", "right", "height", "width" ], | ||
10741 | |||
10742 | // defaults: | ||
10743 | mode = $.effects.setMode( el, o.mode || "effect" ), | ||
10744 | hide = mode === "hide", | ||
10745 | show = mode === "show", | ||
10746 | direction = o.direction || "up", | ||
10747 | distance = o.distance, | ||
10748 | times = o.times || 5, | ||
10749 | |||
10750 | // number of internal animations | ||
10751 | anims = times * 2 + ( show || hide ? 1 : 0 ), | ||
10752 | speed = o.duration / anims, | ||
10753 | easing = o.easing, | ||
10754 | |||
10755 | // utility: | ||
10756 | ref = ( direction === "up" || direction === "down" ) ? "top" : "left", | ||
10757 | motion = ( direction === "up" || direction === "left" ), | ||
10758 | i, | ||
10759 | upAnim, | ||
10760 | downAnim, | ||
10761 | |||
10762 | // we will need to re-assemble the queue to stack our animations in place | ||
10763 | queue = el.queue(), | ||
10764 | queuelen = queue.length; | ||
10765 | |||
10766 | // Avoid touching opacity to prevent clearType and PNG issues in IE | ||
10767 | if ( show || hide ) { | ||
10768 | props.push( "opacity" ); | ||
10769 | } | ||
10770 | |||
10771 | $.effects.save( el, props ); | ||
10772 | el.show(); | ||
10773 | $.effects.createWrapper( el ); // Create Wrapper | ||
10774 | |||
10775 | // default distance for the BIGGEST bounce is the outer Distance / 3 | ||
10776 | if ( !distance ) { | ||
10777 | distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; | ||
10778 | } | ||
10779 | |||
10780 | if ( show ) { | ||
10781 | downAnim = { opacity: 1 }; | ||
10782 | downAnim[ ref ] = 0; | ||
10783 | |||
10784 | // if we are showing, force opacity 0 and set the initial position | ||
10785 | // then do the "first" animation | ||
10786 | el.css( "opacity", 0 ) | ||
10787 | .css( ref, motion ? -distance * 2 : distance * 2 ) | ||
10788 | .animate( downAnim, speed, easing ); | ||
10789 | } | ||
10790 | |||
10791 | // start at the smallest distance if we are hiding | ||
10792 | if ( hide ) { | ||
10793 | distance = distance / Math.pow( 2, times - 1 ); | ||
10794 | } | ||
10795 | |||
10796 | downAnim = {}; | ||
10797 | downAnim[ ref ] = 0; | ||
10798 | // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here | ||
10799 | for ( i = 0; i < times; i++ ) { | ||
10800 | upAnim = {}; | ||
10801 | upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; | ||
10802 | |||
10803 | el.animate( upAnim, speed, easing ) | ||
10804 | .animate( downAnim, speed, easing ); | ||
10805 | |||
10806 | distance = hide ? distance * 2 : distance / 2; | ||
10807 | } | ||
10808 | |||
10809 | // Last Bounce when Hiding | ||
10810 | if ( hide ) { | ||
10811 | upAnim = { opacity: 0 }; | ||
10812 | upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; | ||
10813 | |||
10814 | el.animate( upAnim, speed, easing ); | ||
10815 | } | ||
10816 | |||
10817 | el.queue(function() { | ||
10818 | if ( hide ) { | ||
10819 | el.hide(); | ||
10820 | } | ||
10821 | $.effects.restore( el, props ); | ||
10822 | $.effects.removeWrapper( el ); | ||
10823 | done(); | ||
10824 | }); | ||
10825 | |||
10826 | // inject all the animations we just queued to be first in line (after "inprogress") | ||
10827 | if ( queuelen > 1) { | ||
10828 | queue.splice.apply( queue, | ||
10829 | [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); | ||
10830 | } | ||
10831 | el.dequeue(); | ||
10832 | |||
10833 | }; | ||
10834 | |||
10835 | |||
10836 | /*! | ||
10837 | * jQuery UI Effects Clip 1.11.2 | ||
10838 | * http://jqueryui.com | ||
10839 | * | ||
10840 | * Copyright 2014 jQuery Foundation and other contributors | ||
10841 | * Released under the MIT license. | ||
10842 | * http://jquery.org/license | ||
10843 | * | ||
10844 | * http://api.jqueryui.com/clip-effect/ | ||
10845 | */ | ||
10846 | |||
10847 | |||
10848 | var effectClip = $.effects.effect.clip = function( o, done ) { | ||
10849 | // Create element | ||
10850 | var el = $( this ), | ||
10851 | props = [ "position", "top", "bottom", "left", "right", "height", "width" ], | ||
10852 | mode = $.effects.setMode( el, o.mode || "hide" ), | ||
10853 | show = mode === "show", | ||
10854 | direction = o.direction || "vertical", | ||
10855 | vert = direction === "vertical", | ||
10856 | size = vert ? "height" : "width", | ||
10857 | position = vert ? "top" : "left", | ||
10858 | animation = {}, | ||
10859 | wrapper, animate, distance; | ||
10860 | |||
10861 | // Save & Show | ||
10862 | $.effects.save( el, props ); | ||
10863 | el.show(); | ||
10864 | |||
10865 | // Create Wrapper | ||
10866 | wrapper = $.effects.createWrapper( el ).css({ | ||
10867 | overflow: "hidden" | ||
10868 | }); | ||
10869 | animate = ( el[0].tagName === "IMG" ) ? wrapper : el; | ||
10870 | distance = animate[ size ](); | ||
10871 | |||
10872 | // Shift | ||
10873 | if ( show ) { | ||
10874 | animate.css( size, 0 ); | ||
10875 | animate.css( position, distance / 2 ); | ||
10876 | } | ||
10877 | |||
10878 | // Create Animation Object: | ||
10879 | animation[ size ] = show ? distance : 0; | ||
10880 | animation[ position ] = show ? 0 : distance / 2; | ||
10881 | |||
10882 | // Animate | ||
10883 | animate.animate( animation, { | ||
10884 | queue: false, | ||
10885 | duration: o.duration, | ||
10886 | easing: o.easing, | ||
10887 | complete: function() { | ||
10888 | if ( !show ) { | ||
10889 | el.hide(); | ||
10890 | } | ||
10891 | $.effects.restore( el, props ); | ||
10892 | $.effects.removeWrapper( el ); | ||
10893 | done(); | ||
10894 | } | ||
10895 | }); | ||
10896 | |||
10897 | }; | ||
10898 | |||
10899 | |||
10900 | /*! | ||
10901 | * jQuery UI Effects Drop 1.11.2 | ||
10902 | * http://jqueryui.com | ||
10903 | * | ||
10904 | * Copyright 2014 jQuery Foundation and other contributors | ||
10905 | * Released under the MIT license. | ||
10906 | * http://jquery.org/license | ||
10907 | * | ||
10908 | * http://api.jqueryui.com/drop-effect/ | ||
10909 | */ | ||
10910 | |||
10911 | |||
10912 | var effectDrop = $.effects.effect.drop = function( o, done ) { | ||
10913 | |||
10914 | var el = $( this ), | ||
10915 | props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], | ||
10916 | mode = $.effects.setMode( el, o.mode || "hide" ), | ||
10917 | show = mode === "show", | ||
10918 | direction = o.direction || "left", | ||
10919 | ref = ( direction === "up" || direction === "down" ) ? "top" : "left", | ||
10920 | motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", | ||
10921 | animation = { | ||
10922 | opacity: show ? 1 : 0 | ||
10923 | }, | ||
10924 | distance; | ||
10925 | |||
10926 | // Adjust | ||
10927 | $.effects.save( el, props ); | ||
10928 | el.show(); | ||
10929 | $.effects.createWrapper( el ); | ||
10930 | |||
10931 | distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; | ||
10932 | |||
10933 | if ( show ) { | ||
10934 | el | ||
10935 | .css( "opacity", 0 ) | ||
10936 | .css( ref, motion === "pos" ? -distance : distance ); | ||
10937 | } | ||
10938 | |||
10939 | // Animation | ||
10940 | animation[ ref ] = ( show ? | ||
10941 | ( motion === "pos" ? "+=" : "-=" ) : | ||
10942 | ( motion === "pos" ? "-=" : "+=" ) ) + | ||
10943 | distance; | ||
10944 | |||
10945 | // Animate | ||
10946 | el.animate( animation, { | ||
10947 | queue: false, | ||
10948 | duration: o.duration, | ||
10949 | easing: o.easing, | ||
10950 | complete: function() { | ||
10951 | if ( mode === "hide" ) { | ||
10952 | el.hide(); | ||
10953 | } | ||
10954 | $.effects.restore( el, props ); | ||
10955 | $.effects.removeWrapper( el ); | ||
10956 | done(); | ||
10957 | } | ||
10958 | }); | ||
10959 | }; | ||
10960 | |||
10961 | |||
10962 | /*! | ||
10963 | * jQuery UI Effects Explode 1.11.2 | ||
10964 | * http://jqueryui.com | ||
10965 | * | ||
10966 | * Copyright 2014 jQuery Foundation and other contributors | ||
10967 | * Released under the MIT license. | ||
10968 | * http://jquery.org/license | ||
10969 | * | ||
10970 | * http://api.jqueryui.com/explode-effect/ | ||
10971 | */ | ||
10972 | |||
10973 | |||
10974 | var effectExplode = $.effects.effect.explode = function( o, done ) { | ||
10975 | |||
10976 | var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, | ||
10977 | cells = rows, | ||
10978 | el = $( this ), | ||
10979 | mode = $.effects.setMode( el, o.mode || "hide" ), | ||
10980 | show = mode === "show", | ||
10981 | |||
10982 | // show and then visibility:hidden the element before calculating offset | ||
10983 | offset = el.show().css( "visibility", "hidden" ).offset(), | ||
10984 | |||
10985 | // width and height of a piece | ||
10986 | width = Math.ceil( el.outerWidth() / cells ), | ||
10987 | height = Math.ceil( el.outerHeight() / rows ), | ||
10988 | pieces = [], | ||
10989 | |||
10990 | // loop | ||
10991 | i, j, left, top, mx, my; | ||
10992 | |||
10993 | // children animate complete: | ||
10994 | function childComplete() { | ||
10995 | pieces.push( this ); | ||
10996 | if ( pieces.length === rows * cells ) { | ||
10997 | animComplete(); | ||
10998 | } | ||
10999 | } | ||
11000 | |||
11001 | // clone the element for each row and cell. | ||
11002 | for ( i = 0; i < rows ; i++ ) { // ===> | ||
11003 | top = offset.top + i * height; | ||
11004 | my = i - ( rows - 1 ) / 2 ; | ||
11005 | |||
11006 | for ( j = 0; j < cells ; j++ ) { // ||| | ||
11007 | left = offset.left + j * width; | ||
11008 | mx = j - ( cells - 1 ) / 2 ; | ||
11009 | |||
11010 | // Create a clone of the now hidden main element that will be absolute positioned | ||
11011 | // within a wrapper div off the -left and -top equal to size of our pieces | ||
11012 | el | ||
11013 | .clone() | ||
11014 | .appendTo( "body" ) | ||
11015 | .wrap( "<div></div>" ) | ||
11016 | .css({ | ||
11017 | position: "absolute", | ||
11018 | visibility: "visible", | ||
11019 | left: -j * width, | ||
11020 | top: -i * height | ||
11021 | }) | ||
11022 | |||
11023 | // select the wrapper - make it overflow: hidden and absolute positioned based on | ||
11024 | // where the original was located +left and +top equal to the size of pieces | ||
11025 | .parent() | ||
11026 | .addClass( "ui-effects-explode" ) | ||
11027 | .css({ | ||
11028 | position: "absolute", | ||
11029 | overflow: "hidden", | ||
11030 | width: width, | ||
11031 | height: height, | ||
11032 | left: left + ( show ? mx * width : 0 ), | ||
11033 | top: top + ( show ? my * height : 0 ), | ||
11034 | opacity: show ? 0 : 1 | ||
11035 | }).animate({ | ||
11036 | left: left + ( show ? 0 : mx * width ), | ||
11037 | top: top + ( show ? 0 : my * height ), | ||
11038 | opacity: show ? 1 : 0 | ||
11039 | }, o.duration || 500, o.easing, childComplete ); | ||
11040 | } | ||
11041 | } | ||
11042 | |||
11043 | function animComplete() { | ||
11044 | el.css({ | ||
11045 | visibility: "visible" | ||
11046 | }); | ||
11047 | $( pieces ).remove(); | ||
11048 | if ( !show ) { | ||
11049 | el.hide(); | ||
11050 | } | ||
11051 | done(); | ||
11052 | } | ||
11053 | }; | ||
11054 | |||
11055 | |||
11056 | /*! | ||
11057 | * jQuery UI Effects Fade 1.11.2 | ||
11058 | * http://jqueryui.com | ||
11059 | * | ||
11060 | * Copyright 2014 jQuery Foundation and other contributors | ||
11061 | * Released under the MIT license. | ||
11062 | * http://jquery.org/license | ||
11063 | * | ||
11064 | * http://api.jqueryui.com/fade-effect/ | ||
11065 | */ | ||
11066 | |||
11067 | |||
11068 | var effectFade = $.effects.effect.fade = function( o, done ) { | ||
11069 | var el = $( this ), | ||
11070 | mode = $.effects.setMode( el, o.mode || "toggle" ); | ||
11071 | |||
11072 | el.animate({ | ||
11073 | opacity: mode | ||
11074 | }, { | ||
11075 | queue: false, | ||
11076 | duration: o.duration, | ||
11077 | easing: o.easing, | ||
11078 | complete: done | ||
11079 | }); | ||
11080 | }; | ||
11081 | |||
11082 | |||
11083 | /*! | ||
11084 | * jQuery UI Effects Fold 1.11.2 | ||
11085 | * http://jqueryui.com | ||
11086 | * | ||
11087 | * Copyright 2014 jQuery Foundation and other contributors | ||
11088 | * Released under the MIT license. | ||
11089 | * http://jquery.org/license | ||
11090 | * | ||
11091 | * http://api.jqueryui.com/fold-effect/ | ||
11092 | */ | ||
11093 | |||
11094 | |||
11095 | var effectFold = $.effects.effect.fold = function( o, done ) { | ||
11096 | |||
11097 | // Create element | ||
11098 | var el = $( this ), | ||
11099 | props = [ "position", "top", "bottom", "left", "right", "height", "width" ], | ||
11100 | mode = $.effects.setMode( el, o.mode || "hide" ), | ||
11101 | show = mode === "show", | ||
11102 | hide = mode === "hide", | ||
11103 | size = o.size || 15, | ||
11104 | percent = /([0-9]+)%/.exec( size ), | ||
11105 | horizFirst = !!o.horizFirst, | ||
11106 | widthFirst = show !== horizFirst, | ||
11107 | ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], | ||
11108 | duration = o.duration / 2, | ||
11109 | wrapper, distance, | ||
11110 | animation1 = {}, | ||
11111 | animation2 = {}; | ||
11112 | |||
11113 | $.effects.save( el, props ); | ||
11114 | el.show(); | ||
11115 | |||
11116 | // Create Wrapper | ||
11117 | wrapper = $.effects.createWrapper( el ).css({ | ||
11118 | overflow: "hidden" | ||
11119 | }); | ||
11120 | distance = widthFirst ? | ||
11121 | [ wrapper.width(), wrapper.height() ] : | ||
11122 | [ wrapper.height(), wrapper.width() ]; | ||
11123 | |||
11124 | if ( percent ) { | ||
11125 | size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; | ||
11126 | } | ||
11127 | if ( show ) { | ||
11128 | wrapper.css( horizFirst ? { | ||
11129 | height: 0, | ||
11130 | width: size | ||
11131 | } : { | ||
11132 | height: size, | ||
11133 | width: 0 | ||
11134 | }); | ||
11135 | } | ||
11136 | |||
11137 | // Animation | ||
11138 | animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; | ||
11139 | animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; | ||
11140 | |||
11141 | // Animate | ||
11142 | wrapper | ||
11143 | .animate( animation1, duration, o.easing ) | ||
11144 | .animate( animation2, duration, o.easing, function() { | ||
11145 | if ( hide ) { | ||
11146 | el.hide(); | ||
11147 | } | ||
11148 | $.effects.restore( el, props ); | ||
11149 | $.effects.removeWrapper( el ); | ||
11150 | done(); | ||
11151 | }); | ||
11152 | |||
11153 | }; | ||
11154 | |||
11155 | |||
11156 | /*! | ||
11157 | * jQuery UI Effects Highlight 1.11.2 | ||
11158 | * http://jqueryui.com | ||
11159 | * | ||
11160 | * Copyright 2014 jQuery Foundation and other contributors | ||
11161 | * Released under the MIT license. | ||
11162 | * http://jquery.org/license | ||
11163 | * | ||
11164 | * http://api.jqueryui.com/highlight-effect/ | ||
11165 | */ | ||
11166 | |||
11167 | |||
11168 | var effectHighlight = $.effects.effect.highlight = function( o, done ) { | ||
11169 | var elem = $( this ), | ||
11170 | props = [ "backgroundImage", "backgroundColor", "opacity" ], | ||
11171 | mode = $.effects.setMode( elem, o.mode || "show" ), | ||
11172 | animation = { | ||
11173 | backgroundColor: elem.css( "backgroundColor" ) | ||
11174 | }; | ||
11175 | |||
11176 | if (mode === "hide") { | ||
11177 | animation.opacity = 0; | ||
11178 | } | ||
11179 | |||
11180 | $.effects.save( elem, props ); | ||
11181 | |||
11182 | elem | ||
11183 | .show() | ||
11184 | .css({ | ||
11185 | backgroundImage: "none", | ||
11186 | backgroundColor: o.color || "#ffff99" | ||
11187 | }) | ||
11188 | .animate( animation, { | ||
11189 | queue: false, | ||
11190 | duration: o.duration, | ||
11191 | easing: o.easing, | ||
11192 | complete: function() { | ||
11193 | if ( mode === "hide" ) { | ||
11194 | elem.hide(); | ||
11195 | } | ||
11196 | $.effects.restore( elem, props ); | ||
11197 | done(); | ||
11198 | } | ||
11199 | }); | ||
11200 | }; | ||
11201 | |||
11202 | |||
11203 | /*! | ||
11204 | * jQuery UI Effects Size 1.11.2 | ||
11205 | * http://jqueryui.com | ||
11206 | * | ||
11207 | * Copyright 2014 jQuery Foundation and other contributors | ||
11208 | * Released under the MIT license. | ||
11209 | * http://jquery.org/license | ||
11210 | * | ||
11211 | * http://api.jqueryui.com/size-effect/ | ||
11212 | */ | ||
11213 | |||
11214 | |||
11215 | var effectSize = $.effects.effect.size = function( o, done ) { | ||
11216 | |||
11217 | // Create element | ||
11218 | var original, baseline, factor, | ||
11219 | el = $( this ), | ||
11220 | props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], | ||
11221 | |||
11222 | // Always restore | ||
11223 | props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], | ||
11224 | |||
11225 | // Copy for children | ||
11226 | props2 = [ "width", "height", "overflow" ], | ||
11227 | cProps = [ "fontSize" ], | ||
11228 | vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], | ||
11229 | hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], | ||
11230 | |||
11231 | // Set options | ||
11232 | mode = $.effects.setMode( el, o.mode || "effect" ), | ||
11233 | restore = o.restore || mode !== "effect", | ||
11234 | scale = o.scale || "both", | ||
11235 | origin = o.origin || [ "middle", "center" ], | ||
11236 | position = el.css( "position" ), | ||
11237 | props = restore ? props0 : props1, | ||
11238 | zero = { | ||
11239 | height: 0, | ||
11240 | width: 0, | ||
11241 | outerHeight: 0, | ||
11242 | outerWidth: 0 | ||
11243 | }; | ||
11244 | |||
11245 | if ( mode === "show" ) { | ||
11246 | el.show(); | ||
11247 | } | ||
11248 | original = { | ||
11249 | height: el.height(), | ||
11250 | width: el.width(), | ||
11251 | outerHeight: el.outerHeight(), | ||
11252 | outerWidth: el.outerWidth() | ||
11253 | }; | ||
11254 | |||
11255 | if ( o.mode === "toggle" && mode === "show" ) { | ||
11256 | el.from = o.to || zero; | ||
11257 | el.to = o.from || original; | ||
11258 | } else { | ||
11259 | el.from = o.from || ( mode === "show" ? zero : original ); | ||
11260 | el.to = o.to || ( mode === "hide" ? zero : original ); | ||
11261 | } | ||
11262 | |||
11263 | // Set scaling factor | ||
11264 | factor = { | ||
11265 | from: { | ||
11266 | y: el.from.height / original.height, | ||
11267 | x: el.from.width / original.width | ||
11268 | }, | ||
11269 | to: { | ||
11270 | y: el.to.height / original.height, | ||
11271 | x: el.to.width / original.width | ||
11272 | } | ||
11273 | }; | ||
11274 | |||
11275 | // Scale the css box | ||
11276 | if ( scale === "box" || scale === "both" ) { | ||
11277 | |||
11278 | // Vertical props scaling | ||
11279 | if ( factor.from.y !== factor.to.y ) { | ||
11280 | props = props.concat( vProps ); | ||
11281 | el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); | ||
11282 | el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); | ||
11283 | } | ||
11284 | |||
11285 | // Horizontal props scaling | ||
11286 | if ( factor.from.x !== factor.to.x ) { | ||
11287 | props = props.concat( hProps ); | ||
11288 | el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); | ||
11289 | el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); | ||
11290 | } | ||
11291 | } | ||
11292 | |||
11293 | // Scale the content | ||
11294 | if ( scale === "content" || scale === "both" ) { | ||
11295 | |||
11296 | // Vertical props scaling | ||
11297 | if ( factor.from.y !== factor.to.y ) { | ||
11298 | props = props.concat( cProps ).concat( props2 ); | ||
11299 | el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); | ||
11300 | el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); | ||
11301 | } | ||
11302 | } | ||
11303 | |||
11304 | $.effects.save( el, props ); | ||
11305 | el.show(); | ||
11306 | $.effects.createWrapper( el ); | ||
11307 | el.css( "overflow", "hidden" ).css( el.from ); | ||
11308 | |||
11309 | // Adjust | ||
11310 | if (origin) { // Calculate baseline shifts | ||
11311 | baseline = $.effects.getBaseline( origin, original ); | ||
11312 | el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; | ||
11313 | el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; | ||
11314 | el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; | ||
11315 | el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; | ||
11316 | } | ||
11317 | el.css( el.from ); // set top & left | ||
11318 | |||
11319 | // Animate | ||
11320 | if ( scale === "content" || scale === "both" ) { // Scale the children | ||
11321 | |||
11322 | // Add margins/font-size | ||
11323 | vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); | ||
11324 | hProps = hProps.concat([ "marginLeft", "marginRight" ]); | ||
11325 | props2 = props0.concat(vProps).concat(hProps); | ||
11326 | |||
11327 | el.find( "*[width]" ).each( function() { | ||
11328 | var child = $( this ), | ||
11329 | c_original = { | ||
11330 | height: child.height(), | ||
11331 | width: child.width(), | ||
11332 | outerHeight: child.outerHeight(), | ||
11333 | outerWidth: child.outerWidth() | ||
11334 | }; | ||
11335 | if (restore) { | ||
11336 | $.effects.save(child, props2); | ||
11337 | } | ||
11338 | |||
11339 | child.from = { | ||
11340 | height: c_original.height * factor.from.y, | ||
11341 | width: c_original.width * factor.from.x, | ||
11342 | outerHeight: c_original.outerHeight * factor.from.y, | ||
11343 | outerWidth: c_original.outerWidth * factor.from.x | ||
11344 | }; | ||
11345 | child.to = { | ||
11346 | height: c_original.height * factor.to.y, | ||
11347 | width: c_original.width * factor.to.x, | ||
11348 | outerHeight: c_original.height * factor.to.y, | ||
11349 | outerWidth: c_original.width * factor.to.x | ||
11350 | }; | ||
11351 | |||
11352 | // Vertical props scaling | ||
11353 | if ( factor.from.y !== factor.to.y ) { | ||
11354 | child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); | ||
11355 | child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); | ||
11356 | } | ||
11357 | |||
11358 | // Horizontal props scaling | ||
11359 | if ( factor.from.x !== factor.to.x ) { | ||
11360 | child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); | ||
11361 | child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); | ||
11362 | } | ||
11363 | |||
11364 | // Animate children | ||
11365 | child.css( child.from ); | ||
11366 | child.animate( child.to, o.duration, o.easing, function() { | ||
11367 | |||
11368 | // Restore children | ||
11369 | if ( restore ) { | ||
11370 | $.effects.restore( child, props2 ); | ||
11371 | } | ||
11372 | }); | ||
11373 | }); | ||
11374 | } | ||
11375 | |||
11376 | // Animate | ||
11377 | el.animate( el.to, { | ||
11378 | queue: false, | ||
11379 | duration: o.duration, | ||
11380 | easing: o.easing, | ||
11381 | complete: function() { | ||
11382 | if ( el.to.opacity === 0 ) { | ||
11383 | el.css( "opacity", el.from.opacity ); | ||
11384 | } | ||
11385 | if ( mode === "hide" ) { | ||
11386 | el.hide(); | ||
11387 | } | ||
11388 | $.effects.restore( el, props ); | ||
11389 | if ( !restore ) { | ||
11390 | |||
11391 | // we need to calculate our new positioning based on the scaling | ||
11392 | if ( position === "static" ) { | ||
11393 | el.css({ | ||
11394 | position: "relative", | ||
11395 | top: el.to.top, | ||
11396 | left: el.to.left | ||
11397 | }); | ||
11398 | } else { | ||
11399 | $.each([ "top", "left" ], function( idx, pos ) { | ||
11400 | el.css( pos, function( _, str ) { | ||
11401 | var val = parseInt( str, 10 ), | ||
11402 | toRef = idx ? el.to.left : el.to.top; | ||
11403 | |||
11404 | // if original was "auto", recalculate the new value from wrapper | ||
11405 | if ( str === "auto" ) { | ||
11406 | return toRef + "px"; | ||
11407 | } | ||
11408 | |||
11409 | return val + toRef + "px"; | ||
11410 | }); | ||
11411 | }); | ||
11412 | } | ||
11413 | } | ||
11414 | |||
11415 | $.effects.removeWrapper( el ); | ||
11416 | done(); | ||
11417 | } | ||
11418 | }); | ||
11419 | |||
11420 | }; | ||
11421 | |||
11422 | |||
11423 | /*! | ||
11424 | * jQuery UI Effects Scale 1.11.2 | ||
11425 | * http://jqueryui.com | ||
11426 | * | ||
11427 | * Copyright 2014 jQuery Foundation and other contributors | ||
11428 | * Released under the MIT license. | ||
11429 | * http://jquery.org/license | ||
11430 | * | ||
11431 | * http://api.jqueryui.com/scale-effect/ | ||
11432 | */ | ||
11433 | |||
11434 | |||
11435 | var effectScale = $.effects.effect.scale = function( o, done ) { | ||
11436 | |||
11437 | // Create element | ||
11438 | var el = $( this ), | ||
11439 | options = $.extend( true, {}, o ), | ||
11440 | mode = $.effects.setMode( el, o.mode || "effect" ), | ||
11441 | percent = parseInt( o.percent, 10 ) || | ||
11442 | ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), | ||
11443 | direction = o.direction || "both", | ||
11444 | origin = o.origin, | ||
11445 | original = { | ||
11446 | height: el.height(), | ||
11447 | width: el.width(), | ||
11448 | outerHeight: el.outerHeight(), | ||
11449 | outerWidth: el.outerWidth() | ||
11450 | }, | ||
11451 | factor = { | ||
11452 | y: direction !== "horizontal" ? (percent / 100) : 1, | ||
11453 | x: direction !== "vertical" ? (percent / 100) : 1 | ||
11454 | }; | ||
11455 | |||
11456 | // We are going to pass this effect to the size effect: | ||
11457 | options.effect = "size"; | ||
11458 | options.queue = false; | ||
11459 | options.complete = done; | ||
11460 | |||
11461 | // Set default origin and restore for show/hide | ||
11462 | if ( mode !== "effect" ) { | ||
11463 | options.origin = origin || [ "middle", "center" ]; | ||
11464 | options.restore = true; | ||
11465 | } | ||
11466 | |||
11467 | options.from = o.from || ( mode === "show" ? { | ||
11468 | height: 0, | ||
11469 | width: 0, | ||
11470 | outerHeight: 0, | ||
11471 | outerWidth: 0 | ||
11472 | } : original ); | ||
11473 | options.to = { | ||
11474 | height: original.height * factor.y, | ||
11475 | width: original.width * factor.x, | ||
11476 | outerHeight: original.outerHeight * factor.y, | ||
11477 | outerWidth: original.outerWidth * factor.x | ||
11478 | }; | ||
11479 | |||
11480 | // Fade option to support puff | ||
11481 | if ( options.fade ) { | ||
11482 | if ( mode === "show" ) { | ||
11483 | options.from.opacity = 0; | ||
11484 | options.to.opacity = 1; | ||
11485 | } | ||
11486 | if ( mode === "hide" ) { | ||
11487 | options.from.opacity = 1; | ||
11488 | options.to.opacity = 0; | ||
11489 | } | ||
11490 | } | ||
11491 | |||
11492 | // Animate | ||
11493 | el.effect( options ); | ||
11494 | |||
11495 | }; | ||
11496 | |||
11497 | |||
11498 | /*! | ||
11499 | * jQuery UI Effects Puff 1.11.2 | ||
11500 | * http://jqueryui.com | ||
11501 | * | ||
11502 | * Copyright 2014 jQuery Foundation and other contributors | ||
11503 | * Released under the MIT license. | ||
11504 | * http://jquery.org/license | ||
11505 | * | ||
11506 | * http://api.jqueryui.com/puff-effect/ | ||
11507 | */ | ||
11508 | |||
11509 | |||
11510 | var effectPuff = $.effects.effect.puff = function( o, done ) { | ||
11511 | var elem = $( this ), | ||
11512 | mode = $.effects.setMode( elem, o.mode || "hide" ), | ||
11513 | hide = mode === "hide", | ||
11514 | percent = parseInt( o.percent, 10 ) || 150, | ||
11515 | factor = percent / 100, | ||
11516 | original = { | ||
11517 | height: elem.height(), | ||
11518 | width: elem.width(), | ||
11519 | outerHeight: elem.outerHeight(), | ||
11520 | outerWidth: elem.outerWidth() | ||
11521 | }; | ||
11522 | |||
11523 | $.extend( o, { | ||
11524 | effect: "scale", | ||
11525 | queue: false, | ||
11526 | fade: true, | ||
11527 | mode: mode, | ||
11528 | complete: done, | ||
11529 | percent: hide ? percent : 100, | ||
11530 | from: hide ? | ||
11531 | original : | ||
11532 | { | ||
11533 | height: original.height * factor, | ||
11534 | width: original.width * factor, | ||
11535 | outerHeight: original.outerHeight * factor, | ||
11536 | outerWidth: original.outerWidth * factor | ||
11537 | } | ||
11538 | }); | ||
11539 | |||
11540 | elem.effect( o ); | ||
11541 | }; | ||
11542 | |||
11543 | |||
11544 | /*! | ||
11545 | * jQuery UI Effects Pulsate 1.11.2 | ||
11546 | * http://jqueryui.com | ||
11547 | * | ||
11548 | * Copyright 2014 jQuery Foundation and other contributors | ||
11549 | * Released under the MIT license. | ||
11550 | * http://jquery.org/license | ||
11551 | * | ||
11552 | * http://api.jqueryui.com/pulsate-effect/ | ||
11553 | */ | ||
11554 | |||
11555 | |||
11556 | var effectPulsate = $.effects.effect.pulsate = function( o, done ) { | ||
11557 | var elem = $( this ), | ||
11558 | mode = $.effects.setMode( elem, o.mode || "show" ), | ||
11559 | show = mode === "show", | ||
11560 | hide = mode === "hide", | ||
11561 | showhide = ( show || mode === "hide" ), | ||
11562 | |||
11563 | // showing or hiding leaves of the "last" animation | ||
11564 | anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), | ||
11565 | duration = o.duration / anims, | ||
11566 | animateTo = 0, | ||
11567 | queue = elem.queue(), | ||
11568 | queuelen = queue.length, | ||
11569 | i; | ||
11570 | |||
11571 | if ( show || !elem.is(":visible")) { | ||
11572 | elem.css( "opacity", 0 ).show(); | ||
11573 | animateTo = 1; | ||
11574 | } | ||
11575 | |||
11576 | // anims - 1 opacity "toggles" | ||
11577 | for ( i = 1; i < anims; i++ ) { | ||
11578 | elem.animate({ | ||
11579 | opacity: animateTo | ||
11580 | }, duration, o.easing ); | ||
11581 | animateTo = 1 - animateTo; | ||
11582 | } | ||
11583 | |||
11584 | elem.animate({ | ||
11585 | opacity: animateTo | ||
11586 | }, duration, o.easing); | ||
11587 | |||
11588 | elem.queue(function() { | ||
11589 | if ( hide ) { | ||
11590 | elem.hide(); | ||
11591 | } | ||
11592 | done(); | ||
11593 | }); | ||
11594 | |||
11595 | // We just queued up "anims" animations, we need to put them next in the queue | ||
11596 | if ( queuelen > 1 ) { | ||
11597 | queue.splice.apply( queue, | ||
11598 | [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); | ||
11599 | } | ||
11600 | elem.dequeue(); | ||
11601 | }; | ||
11602 | |||
11603 | |||
11604 | /*! | ||
11605 | * jQuery UI Effects Shake 1.11.2 | ||
11606 | * http://jqueryui.com | ||
11607 | * | ||
11608 | * Copyright 2014 jQuery Foundation and other contributors | ||
11609 | * Released under the MIT license. | ||
11610 | * http://jquery.org/license | ||
11611 | * | ||
11612 | * http://api.jqueryui.com/shake-effect/ | ||
11613 | */ | ||
11614 | |||
11615 | |||
11616 | var effectShake = $.effects.effect.shake = function( o, done ) { | ||
11617 | |||
11618 | var el = $( this ), | ||
11619 | props = [ "position", "top", "bottom", "left", "right", "height", "width" ], | ||
11620 | mode = $.effects.setMode( el, o.mode || "effect" ), | ||
11621 | direction = o.direction || "left", | ||
11622 | distance = o.distance || 20, | ||
11623 | times = o.times || 3, | ||
11624 | anims = times * 2 + 1, | ||
11625 | speed = Math.round( o.duration / anims ), | ||
11626 | ref = (direction === "up" || direction === "down") ? "top" : "left", | ||
11627 | positiveMotion = (direction === "up" || direction === "left"), | ||
11628 | animation = {}, | ||
11629 | animation1 = {}, | ||
11630 | animation2 = {}, | ||
11631 | i, | ||
11632 | |||
11633 | // we will need to re-assemble the queue to stack our animations in place | ||
11634 | queue = el.queue(), | ||
11635 | queuelen = queue.length; | ||
11636 | |||
11637 | $.effects.save( el, props ); | ||
11638 | el.show(); | ||
11639 | $.effects.createWrapper( el ); | ||
11640 | |||
11641 | // Animation | ||
11642 | animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; | ||
11643 | animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; | ||
11644 | animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; | ||
11645 | |||
11646 | // Animate | ||
11647 | el.animate( animation, speed, o.easing ); | ||
11648 | |||
11649 | // Shakes | ||
11650 | for ( i = 1; i < times; i++ ) { | ||
11651 | el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); | ||
11652 | } | ||
11653 | el | ||
11654 | .animate( animation1, speed, o.easing ) | ||
11655 | .animate( animation, speed / 2, o.easing ) | ||
11656 | .queue(function() { | ||
11657 | if ( mode === "hide" ) { | ||
11658 | el.hide(); | ||
11659 | } | ||
11660 | $.effects.restore( el, props ); | ||
11661 | $.effects.removeWrapper( el ); | ||
11662 | done(); | ||
11663 | }); | ||
11664 | |||
11665 | // inject all the animations we just queued to be first in line (after "inprogress") | ||
11666 | if ( queuelen > 1) { | ||
11667 | queue.splice.apply( queue, | ||
11668 | [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); | ||
11669 | } | ||
11670 | el.dequeue(); | ||
11671 | |||
11672 | }; | ||
11673 | |||
11674 | |||
11675 | /*! | ||
11676 | * jQuery UI Effects Slide 1.11.2 | ||
11677 | * http://jqueryui.com | ||
11678 | * | ||
11679 | * Copyright 2014 jQuery Foundation and other contributors | ||
11680 | * Released under the MIT license. | ||
11681 | * http://jquery.org/license | ||
11682 | * | ||
11683 | * http://api.jqueryui.com/slide-effect/ | ||
11684 | */ | ||
11685 | |||
11686 | |||
11687 | var effectSlide = $.effects.effect.slide = function( o, done ) { | ||
11688 | |||
11689 | // Create element | ||
11690 | var el = $( this ), | ||
11691 | props = [ "position", "top", "bottom", "left", "right", "width", "height" ], | ||
11692 | mode = $.effects.setMode( el, o.mode || "show" ), | ||
11693 | show = mode === "show", | ||
11694 | direction = o.direction || "left", | ||
11695 | ref = (direction === "up" || direction === "down") ? "top" : "left", | ||
11696 | positiveMotion = (direction === "up" || direction === "left"), | ||
11697 | distance, | ||
11698 | animation = {}; | ||
11699 | |||
11700 | // Adjust | ||
11701 | $.effects.save( el, props ); | ||
11702 | el.show(); | ||
11703 | distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); | ||
11704 | |||
11705 | $.effects.createWrapper( el ).css({ | ||
11706 | overflow: "hidden" | ||
11707 | }); | ||
11708 | |||
11709 | if ( show ) { | ||
11710 | el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); | ||
11711 | } | ||
11712 | |||
11713 | // Animation | ||
11714 | animation[ ref ] = ( show ? | ||
11715 | ( positiveMotion ? "+=" : "-=") : | ||
11716 | ( positiveMotion ? "-=" : "+=")) + | ||
11717 | distance; | ||
11718 | |||
11719 | // Animate | ||
11720 | el.animate( animation, { | ||
11721 | queue: false, | ||
11722 | duration: o.duration, | ||
11723 | easing: o.easing, | ||
11724 | complete: function() { | ||
11725 | if ( mode === "hide" ) { | ||
11726 | el.hide(); | ||
11727 | } | ||
11728 | $.effects.restore( el, props ); | ||
11729 | $.effects.removeWrapper( el ); | ||
11730 | done(); | ||
11731 | } | ||
11732 | }); | ||
11733 | }; | ||
11734 | |||
11735 | |||
11736 | /*! | ||
11737 | * jQuery UI Effects Transfer 1.11.2 | ||
11738 | * http://jqueryui.com | ||
11739 | * | ||
11740 | * Copyright 2014 jQuery Foundation and other contributors | ||
11741 | * Released under the MIT license. | ||
11742 | * http://jquery.org/license | ||
11743 | * | ||
11744 | * http://api.jqueryui.com/transfer-effect/ | ||
11745 | */ | ||
11746 | |||
11747 | |||
11748 | var effectTransfer = $.effects.effect.transfer = function( o, done ) { | ||
11749 | var elem = $( this ), | ||
11750 | target = $( o.to ), | ||
11751 | targetFixed = target.css( "position" ) === "fixed", | ||
11752 | body = $("body"), | ||
11753 | fixTop = targetFixed ? body.scrollTop() : 0, | ||
11754 | fixLeft = targetFixed ? body.scrollLeft() : 0, | ||
11755 | endPosition = target.offset(), | ||
11756 | animation = { | ||
11757 | top: endPosition.top - fixTop, | ||
11758 | left: endPosition.left - fixLeft, | ||
11759 | height: target.innerHeight(), | ||
11760 | width: target.innerWidth() | ||
11761 | }, | ||
11762 | startPosition = elem.offset(), | ||
11763 | transfer = $( "<div class='ui-effects-transfer'></div>" ) | ||
11764 | .appendTo( document.body ) | ||
11765 | .addClass( o.className ) | ||
11766 | .css({ | ||
11767 | top: startPosition.top - fixTop, | ||
11768 | left: startPosition.left - fixLeft, | ||
11769 | height: elem.innerHeight(), | ||
11770 | width: elem.innerWidth(), | ||
11771 | position: targetFixed ? "fixed" : "absolute" | ||
11772 | }) | ||
11773 | .animate( animation, o.duration, o.easing, function() { | ||
11774 | transfer.remove(); | ||
11775 | done(); | ||
11776 | }); | ||
11777 | }; | ||
11778 | |||
11779 | |||
11780 | /*! | ||
11781 | * jQuery UI Progressbar 1.11.2 | ||
11782 | * http://jqueryui.com | ||
11783 | * | ||
11784 | * Copyright 2014 jQuery Foundation and other contributors | ||
11785 | * Released under the MIT license. | ||
11786 | * http://jquery.org/license | ||
11787 | * | ||
11788 | * http://api.jqueryui.com/progressbar/ | ||
11789 | */ | ||
11790 | |||
11791 | |||
11792 | var progressbar = $.widget( "ui.progressbar", { | ||
11793 | version: "1.11.2", | ||
11794 | options: { | ||
11795 | max: 100, | ||
11796 | value: 0, | ||
11797 | |||
11798 | change: null, | ||
11799 | complete: null | ||
11800 | }, | ||
11801 | |||
11802 | min: 0, | ||
11803 | |||
11804 | _create: function() { | ||
11805 | // Constrain initial value | ||
11806 | this.oldValue = this.options.value = this._constrainedValue(); | ||
11807 | |||
11808 | this.element | ||
11809 | .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) | ||
11810 | .attr({ | ||
11811 | // Only set static values, aria-valuenow and aria-valuemax are | ||
11812 | // set inside _refreshValue() | ||
11813 | role: "progressbar", | ||
11814 | "aria-valuemin": this.min | ||
11815 | }); | ||
11816 | |||
11817 | this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) | ||
11818 | .appendTo( this.element ); | ||
11819 | |||
11820 | this._refreshValue(); | ||
11821 | }, | ||
11822 | |||
11823 | _destroy: function() { | ||
11824 | this.element | ||
11825 | .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) | ||
11826 | .removeAttr( "role" ) | ||
11827 | .removeAttr( "aria-valuemin" ) | ||
11828 | .removeAttr( "aria-valuemax" ) | ||
11829 | .removeAttr( "aria-valuenow" ); | ||
11830 | |||
11831 | this.valueDiv.remove(); | ||
11832 | }, | ||
11833 | |||
11834 | value: function( newValue ) { | ||
11835 | if ( newValue === undefined ) { | ||
11836 | return this.options.value; | ||
11837 | } | ||
11838 | |||
11839 | this.options.value = this._constrainedValue( newValue ); | ||
11840 | this._refreshValue(); | ||
11841 | }, | ||
11842 | |||
11843 | _constrainedValue: function( newValue ) { | ||
11844 | if ( newValue === undefined ) { | ||
11845 | newValue = this.options.value; | ||
11846 | } | ||
11847 | |||
11848 | this.indeterminate = newValue === false; | ||
11849 | |||
11850 | // sanitize value | ||
11851 | if ( typeof newValue !== "number" ) { | ||
11852 | newValue = 0; | ||
11853 | } | ||
11854 | |||
11855 | return this.indeterminate ? false : | ||
11856 | Math.min( this.options.max, Math.max( this.min, newValue ) ); | ||
11857 | }, | ||
11858 | |||
11859 | _setOptions: function( options ) { | ||
11860 | // Ensure "value" option is set after other values (like max) | ||
11861 | var value = options.value; | ||
11862 | delete options.value; | ||
11863 | |||
11864 | this._super( options ); | ||
11865 | |||
11866 | this.options.value = this._constrainedValue( value ); | ||
11867 | this._refreshValue(); | ||
11868 | }, | ||
11869 | |||
11870 | _setOption: function( key, value ) { | ||
11871 | if ( key === "max" ) { | ||
11872 | // Don't allow a max less than min | ||
11873 | value = Math.max( this.min, value ); | ||
11874 | } | ||
11875 | if ( key === "disabled" ) { | ||
11876 | this.element | ||
11877 | .toggleClass( "ui-state-disabled", !!value ) | ||
11878 | .attr( "aria-disabled", value ); | ||
11879 | } | ||
11880 | this._super( key, value ); | ||
11881 | }, | ||
11882 | |||
11883 | _percentage: function() { | ||
11884 | return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); | ||
11885 | }, | ||
11886 | |||
11887 | _refreshValue: function() { | ||
11888 | var value = this.options.value, | ||
11889 | percentage = this._percentage(); | ||
11890 | |||
11891 | this.valueDiv | ||
11892 | .toggle( this.indeterminate || value > this.min ) | ||
11893 | .toggleClass( "ui-corner-right", value === this.options.max ) | ||
11894 | .width( percentage.toFixed(0) + "%" ); | ||
11895 | |||
11896 | this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate ); | ||
11897 | |||
11898 | if ( this.indeterminate ) { | ||
11899 | this.element.removeAttr( "aria-valuenow" ); | ||
11900 | if ( !this.overlayDiv ) { | ||
11901 | this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv ); | ||
11902 | } | ||
11903 | } else { | ||
11904 | this.element.attr({ | ||
11905 | "aria-valuemax": this.options.max, | ||
11906 | "aria-valuenow": value | ||
11907 | }); | ||
11908 | if ( this.overlayDiv ) { | ||
11909 | this.overlayDiv.remove(); | ||
11910 | this.overlayDiv = null; | ||
11911 | } | ||
11912 | } | ||
11913 | |||
11914 | if ( this.oldValue !== value ) { | ||
11915 | this.oldValue = value; | ||
11916 | this._trigger( "change" ); | ||
11917 | } | ||
11918 | if ( value === this.options.max ) { | ||
11919 | this._trigger( "complete" ); | ||
11920 | } | ||
11921 | } | ||
11922 | }); | ||
11923 | |||
11924 | |||
11925 | /*! | ||
11926 | * jQuery UI Selectable 1.11.2 | ||
11927 | * http://jqueryui.com | ||
11928 | * | ||
11929 | * Copyright 2014 jQuery Foundation and other contributors | ||
11930 | * Released under the MIT license. | ||
11931 | * http://jquery.org/license | ||
11932 | * | ||
11933 | * http://api.jqueryui.com/selectable/ | ||
11934 | */ | ||
11935 | |||
11936 | |||
11937 | var selectable = $.widget("ui.selectable", $.ui.mouse, { | ||
11938 | version: "1.11.2", | ||
11939 | options: { | ||
11940 | appendTo: "body", | ||
11941 | autoRefresh: true, | ||
11942 | distance: 0, | ||
11943 | filter: "*", | ||
11944 | tolerance: "touch", | ||
11945 | |||
11946 | // callbacks | ||
11947 | selected: null, | ||
11948 | selecting: null, | ||
11949 | start: null, | ||
11950 | stop: null, | ||
11951 | unselected: null, | ||
11952 | unselecting: null | ||
11953 | }, | ||
11954 | _create: function() { | ||
11955 | var selectees, | ||
11956 | that = this; | ||
11957 | |||
11958 | this.element.addClass("ui-selectable"); | ||
11959 | |||
11960 | this.dragged = false; | ||
11961 | |||
11962 | // cache selectee children based on filter | ||
11963 | this.refresh = function() { | ||
11964 | selectees = $(that.options.filter, that.element[0]); | ||
11965 | selectees.addClass("ui-selectee"); | ||
11966 | selectees.each(function() { | ||
11967 | var $this = $(this), | ||
11968 | pos = $this.offset(); | ||
11969 | $.data(this, "selectable-item", { | ||
11970 | element: this, | ||
11971 | $element: $this, | ||
11972 | left: pos.left, | ||
11973 | top: pos.top, | ||
11974 | right: pos.left + $this.outerWidth(), | ||
11975 | bottom: pos.top + $this.outerHeight(), | ||
11976 | startselected: false, | ||
11977 | selected: $this.hasClass("ui-selected"), | ||
11978 | selecting: $this.hasClass("ui-selecting"), | ||
11979 | unselecting: $this.hasClass("ui-unselecting") | ||
11980 | }); | ||
11981 | }); | ||
11982 | }; | ||
11983 | this.refresh(); | ||
11984 | |||
11985 | this.selectees = selectees.addClass("ui-selectee"); | ||
11986 | |||
11987 | this._mouseInit(); | ||
11988 | |||
11989 | this.helper = $("<div class='ui-selectable-helper'></div>"); | ||
11990 | }, | ||
11991 | |||
11992 | _destroy: function() { | ||
11993 | this.selectees | ||
11994 | .removeClass("ui-selectee") | ||
11995 | .removeData("selectable-item"); | ||
11996 | this.element | ||
11997 | .removeClass("ui-selectable ui-selectable-disabled"); | ||
11998 | this._mouseDestroy(); | ||
11999 | }, | ||
12000 | |||
12001 | _mouseStart: function(event) { | ||
12002 | var that = this, | ||
12003 | options = this.options; | ||
12004 | |||
12005 | this.opos = [ event.pageX, event.pageY ]; | ||
12006 | |||
12007 | if (this.options.disabled) { | ||
12008 | return; | ||
12009 | } | ||
12010 | |||
12011 | this.selectees = $(options.filter, this.element[0]); | ||
12012 | |||
12013 | this._trigger("start", event); | ||
12014 | |||
12015 | $(options.appendTo).append(this.helper); | ||
12016 | // position helper (lasso) | ||
12017 | this.helper.css({ | ||
12018 | "left": event.pageX, | ||
12019 | "top": event.pageY, | ||
12020 | "width": 0, | ||
12021 | "height": 0 | ||
12022 | }); | ||
12023 | |||
12024 | if (options.autoRefresh) { | ||
12025 | this.refresh(); | ||
12026 | } | ||
12027 | |||
12028 | this.selectees.filter(".ui-selected").each(function() { | ||
12029 | var selectee = $.data(this, "selectable-item"); | ||
12030 | selectee.startselected = true; | ||
12031 | if (!event.metaKey && !event.ctrlKey) { | ||
12032 | selectee.$element.removeClass("ui-selected"); | ||
12033 | selectee.selected = false; | ||
12034 | selectee.$element.addClass("ui-unselecting"); | ||
12035 | selectee.unselecting = true; | ||
12036 | // selectable UNSELECTING callback | ||
12037 | that._trigger("unselecting", event, { | ||
12038 | unselecting: selectee.element | ||
12039 | }); | ||
12040 | } | ||
12041 | }); | ||
12042 | |||
12043 | $(event.target).parents().addBack().each(function() { | ||
12044 | var doSelect, | ||
12045 | selectee = $.data(this, "selectable-item"); | ||
12046 | if (selectee) { | ||
12047 | doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected"); | ||
12048 | selectee.$element | ||
12049 | .removeClass(doSelect ? "ui-unselecting" : "ui-selected") | ||
12050 | .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); | ||
12051 | selectee.unselecting = !doSelect; | ||
12052 | selectee.selecting = doSelect; | ||
12053 | selectee.selected = doSelect; | ||
12054 | // selectable (UN)SELECTING callback | ||
12055 | if (doSelect) { | ||
12056 | that._trigger("selecting", event, { | ||
12057 | selecting: selectee.element | ||
12058 | }); | ||
12059 | } else { | ||
12060 | that._trigger("unselecting", event, { | ||
12061 | unselecting: selectee.element | ||
12062 | }); | ||
12063 | } | ||
12064 | return false; | ||
12065 | } | ||
12066 | }); | ||
12067 | |||
12068 | }, | ||
12069 | |||
12070 | _mouseDrag: function(event) { | ||
12071 | |||
12072 | this.dragged = true; | ||
12073 | |||
12074 | if (this.options.disabled) { | ||
12075 | return; | ||
12076 | } | ||
12077 | |||
12078 | var tmp, | ||
12079 | that = this, | ||
12080 | options = this.options, | ||
12081 | x1 = this.opos[0], | ||
12082 | y1 = this.opos[1], | ||
12083 | x2 = event.pageX, | ||
12084 | y2 = event.pageY; | ||
12085 | |||
12086 | if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } | ||
12087 | if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } | ||
12088 | this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); | ||
12089 | |||
12090 | this.selectees.each(function() { | ||
12091 | var selectee = $.data(this, "selectable-item"), | ||
12092 | hit = false; | ||
12093 | |||
12094 | //prevent helper from being selected if appendTo: selectable | ||
12095 | if (!selectee || selectee.element === that.element[0]) { | ||
12096 | return; | ||
12097 | } | ||
12098 | |||
12099 | if (options.tolerance === "touch") { | ||
12100 | hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); | ||
12101 | } else if (options.tolerance === "fit") { | ||
12102 | hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); | ||
12103 | } | ||
12104 | |||
12105 | if (hit) { | ||
12106 | // SELECT | ||
12107 | if (selectee.selected) { | ||
12108 | selectee.$element.removeClass("ui-selected"); | ||
12109 | selectee.selected = false; | ||
12110 | } | ||
12111 | if (selectee.unselecting) { | ||
12112 | selectee.$element.removeClass("ui-unselecting"); | ||
12113 | selectee.unselecting = false; | ||
12114 | } | ||
12115 | if (!selectee.selecting) { | ||
12116 | selectee.$element.addClass("ui-selecting"); | ||
12117 | selectee.selecting = true; | ||
12118 | // selectable SELECTING callback | ||
12119 | that._trigger("selecting", event, { | ||
12120 | selecting: selectee.element | ||
12121 | }); | ||
12122 | } | ||
12123 | } else { | ||
12124 | // UNSELECT | ||
12125 | if (selectee.selecting) { | ||
12126 | if ((event.metaKey || event.ctrlKey) && selectee.startselected) { | ||
12127 | selectee.$element.removeClass("ui-selecting"); | ||
12128 | selectee.selecting = false; | ||
12129 | selectee.$element.addClass("ui-selected"); | ||
12130 | selectee.selected = true; | ||
12131 | } else { | ||
12132 | selectee.$element.removeClass("ui-selecting"); | ||
12133 | selectee.selecting = false; | ||
12134 | if (selectee.startselected) { | ||
12135 | selectee.$element.addClass("ui-unselecting"); | ||
12136 | selectee.unselecting = true; | ||
12137 | } | ||
12138 | // selectable UNSELECTING callback | ||
12139 | that._trigger("unselecting", event, { | ||
12140 | unselecting: selectee.element | ||
12141 | }); | ||
12142 | } | ||
12143 | } | ||
12144 | if (selectee.selected) { | ||
12145 | if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { | ||
12146 | selectee.$element.removeClass("ui-selected"); | ||
12147 | selectee.selected = false; | ||
12148 | |||
12149 | selectee.$element.addClass("ui-unselecting"); | ||
12150 | selectee.unselecting = true; | ||
12151 | // selectable UNSELECTING callback | ||
12152 | that._trigger("unselecting", event, { | ||
12153 | unselecting: selectee.element | ||
12154 | }); | ||
12155 | } | ||
12156 | } | ||
12157 | } | ||
12158 | }); | ||
12159 | |||
12160 | return false; | ||
12161 | }, | ||
12162 | |||
12163 | _mouseStop: function(event) { | ||
12164 | var that = this; | ||
12165 | |||
12166 | this.dragged = false; | ||
12167 | |||
12168 | $(".ui-unselecting", this.element[0]).each(function() { | ||
12169 | var selectee = $.data(this, "selectable-item"); | ||
12170 | selectee.$element.removeClass("ui-unselecting"); | ||
12171 | selectee.unselecting = false; | ||
12172 | selectee.startselected = false; | ||
12173 | that._trigger("unselected", event, { | ||
12174 | unselected: selectee.element | ||
12175 | }); | ||
12176 | }); | ||
12177 | $(".ui-selecting", this.element[0]).each(function() { | ||
12178 | var selectee = $.data(this, "selectable-item"); | ||
12179 | selectee.$element.removeClass("ui-selecting").addClass("ui-selected"); | ||
12180 | selectee.selecting = false; | ||
12181 | selectee.selected = true; | ||
12182 | selectee.startselected = true; | ||
12183 | that._trigger("selected", event, { | ||
12184 | selected: selectee.element | ||
12185 | }); | ||
12186 | }); | ||
12187 | this._trigger("stop", event); | ||
12188 | |||
12189 | this.helper.remove(); | ||
12190 | |||
12191 | return false; | ||
12192 | } | ||
12193 | |||
12194 | }); | ||
12195 | |||
12196 | |||
12197 | /*! | ||
12198 | * jQuery UI Selectmenu 1.11.2 | ||
12199 | * http://jqueryui.com | ||
12200 | * | ||
12201 | * Copyright 2014 jQuery Foundation and other contributors | ||
12202 | * Released under the MIT license. | ||
12203 | * http://jquery.org/license | ||
12204 | * | ||
12205 | * http://api.jqueryui.com/selectmenu | ||
12206 | */ | ||
12207 | |||
12208 | |||
12209 | var selectmenu = $.widget( "ui.selectmenu", { | ||
12210 | version: "1.11.2", | ||
12211 | defaultElement: "<select>", | ||
12212 | options: { | ||
12213 | appendTo: null, | ||
12214 | disabled: null, | ||
12215 | icons: { | ||
12216 | button: "ui-icon-triangle-1-s" | ||
12217 | }, | ||
12218 | position: { | ||
12219 | my: "left top", | ||
12220 | at: "left bottom", | ||
12221 | collision: "none" | ||
12222 | }, | ||
12223 | width: null, | ||
12224 | |||
12225 | // callbacks | ||
12226 | change: null, | ||
12227 | close: null, | ||
12228 | focus: null, | ||
12229 | open: null, | ||
12230 | select: null | ||
12231 | }, | ||
12232 | |||
12233 | _create: function() { | ||
12234 | var selectmenuId = this.element.uniqueId().attr( "id" ); | ||
12235 | this.ids = { | ||
12236 | element: selectmenuId, | ||
12237 | button: selectmenuId + "-button", | ||
12238 | menu: selectmenuId + "-menu" | ||
12239 | }; | ||
12240 | |||
12241 | this._drawButton(); | ||
12242 | this._drawMenu(); | ||
12243 | |||
12244 | if ( this.options.disabled ) { | ||
12245 | this.disable(); | ||
12246 | } | ||
12247 | }, | ||
12248 | |||
12249 | _drawButton: function() { | ||
12250 | var that = this, | ||
12251 | tabindex = this.element.attr( "tabindex" ); | ||
12252 | |||
12253 | // Associate existing label with the new button | ||
12254 | this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button ); | ||
12255 | this._on( this.label, { | ||
12256 | click: function( event ) { | ||
12257 | this.button.focus(); | ||
12258 | event.preventDefault(); | ||
12259 | } | ||
12260 | }); | ||
12261 | |||
12262 | // Hide original select element | ||
12263 | this.element.hide(); | ||
12264 | |||
12265 | // Create button | ||
12266 | this.button = $( "<span>", { | ||
12267 | "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all", | ||
12268 | tabindex: tabindex || this.options.disabled ? -1 : 0, | ||
12269 | id: this.ids.button, | ||
12270 | role: "combobox", | ||
12271 | "aria-expanded": "false", | ||
12272 | "aria-autocomplete": "list", | ||
12273 | "aria-owns": this.ids.menu, | ||
12274 | "aria-haspopup": "true" | ||
12275 | }) | ||
12276 | .insertAfter( this.element ); | ||
12277 | |||
12278 | $( "<span>", { | ||
12279 | "class": "ui-icon " + this.options.icons.button | ||
12280 | }) | ||
12281 | .prependTo( this.button ); | ||
12282 | |||
12283 | this.buttonText = $( "<span>", { | ||
12284 | "class": "ui-selectmenu-text" | ||
12285 | }) | ||
12286 | .appendTo( this.button ); | ||
12287 | |||
12288 | this._setText( this.buttonText, this.element.find( "option:selected" ).text() ); | ||
12289 | this._resizeButton(); | ||
12290 | |||
12291 | this._on( this.button, this._buttonEvents ); | ||
12292 | this.button.one( "focusin", function() { | ||
12293 | |||
12294 | // Delay rendering the menu items until the button receives focus. | ||
12295 | // The menu may have already been rendered via a programmatic open. | ||
12296 | if ( !that.menuItems ) { | ||
12297 | that._refreshMenu(); | ||
12298 | } | ||
12299 | }); | ||
12300 | this._hoverable( this.button ); | ||
12301 | this._focusable( this.button ); | ||
12302 | }, | ||
12303 | |||
12304 | _drawMenu: function() { | ||
12305 | var that = this; | ||
12306 | |||
12307 | // Create menu | ||
12308 | this.menu = $( "<ul>", { | ||
12309 | "aria-hidden": "true", | ||
12310 | "aria-labelledby": this.ids.button, | ||
12311 | id: this.ids.menu | ||
12312 | }); | ||
12313 | |||
12314 | // Wrap menu | ||
12315 | this.menuWrap = $( "<div>", { | ||
12316 | "class": "ui-selectmenu-menu ui-front" | ||
12317 | }) | ||
12318 | .append( this.menu ) | ||
12319 | .appendTo( this._appendTo() ); | ||
12320 | |||
12321 | // Initialize menu widget | ||
12322 | this.menuInstance = this.menu | ||
12323 | .menu({ | ||
12324 | role: "listbox", | ||
12325 | select: function( event, ui ) { | ||
12326 | event.preventDefault(); | ||
12327 | |||
12328 | // support: IE8 | ||
12329 | // If the item was selected via a click, the text selection | ||
12330 | // will be destroyed in IE | ||
12331 | that._setSelection(); | ||
12332 | |||
12333 | that._select( ui.item.data( "ui-selectmenu-item" ), event ); | ||
12334 | }, | ||
12335 | focus: function( event, ui ) { | ||
12336 | var item = ui.item.data( "ui-selectmenu-item" ); | ||
12337 | |||
12338 | // Prevent inital focus from firing and check if its a newly focused item | ||
12339 | if ( that.focusIndex != null && item.index !== that.focusIndex ) { | ||
12340 | that._trigger( "focus", event, { item: item } ); | ||
12341 | if ( !that.isOpen ) { | ||
12342 | that._select( item, event ); | ||
12343 | } | ||
12344 | } | ||
12345 | that.focusIndex = item.index; | ||
12346 | |||
12347 | that.button.attr( "aria-activedescendant", | ||
12348 | that.menuItems.eq( item.index ).attr( "id" ) ); | ||
12349 | } | ||
12350 | }) | ||
12351 | .menu( "instance" ); | ||
12352 | |||
12353 | // Adjust menu styles to dropdown | ||
12354 | this.menu | ||
12355 | .addClass( "ui-corner-bottom" ) | ||
12356 | .removeClass( "ui-corner-all" ); | ||
12357 | |||
12358 | // Don't close the menu on mouseleave | ||
12359 | this.menuInstance._off( this.menu, "mouseleave" ); | ||
12360 | |||
12361 | // Cancel the menu's collapseAll on document click | ||
12362 | this.menuInstance._closeOnDocumentClick = function() { | ||
12363 | return false; | ||
12364 | }; | ||
12365 | |||
12366 | // Selects often contain empty items, but never contain dividers | ||
12367 | this.menuInstance._isDivider = function() { | ||
12368 | return false; | ||
12369 | }; | ||
12370 | }, | ||
12371 | |||
12372 | refresh: function() { | ||
12373 | this._refreshMenu(); | ||
12374 | this._setText( this.buttonText, this._getSelectedItem().text() ); | ||
12375 | if ( !this.options.width ) { | ||
12376 | this._resizeButton(); | ||
12377 | } | ||
12378 | }, | ||
12379 | |||
12380 | _refreshMenu: function() { | ||
12381 | this.menu.empty(); | ||
12382 | |||
12383 | var item, | ||
12384 | options = this.element.find( "option" ); | ||
12385 | |||
12386 | if ( !options.length ) { | ||
12387 | return; | ||
12388 | } | ||
12389 | |||
12390 | this._parseOptions( options ); | ||
12391 | this._renderMenu( this.menu, this.items ); | ||
12392 | |||
12393 | this.menuInstance.refresh(); | ||
12394 | this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ); | ||
12395 | |||
12396 | item = this._getSelectedItem(); | ||
12397 | |||
12398 | // Update the menu to have the correct item focused | ||
12399 | this.menuInstance.focus( null, item ); | ||
12400 | this._setAria( item.data( "ui-selectmenu-item" ) ); | ||
12401 | |||
12402 | // Set disabled state | ||
12403 | this._setOption( "disabled", this.element.prop( "disabled" ) ); | ||
12404 | }, | ||
12405 | |||
12406 | open: function( event ) { | ||
12407 | if ( this.options.disabled ) { | ||
12408 | return; | ||
12409 | } | ||
12410 | |||
12411 | // If this is the first time the menu is being opened, render the items | ||
12412 | if ( !this.menuItems ) { | ||
12413 | this._refreshMenu(); | ||
12414 | } else { | ||
12415 | |||
12416 | // Menu clears focus on close, reset focus to selected item | ||
12417 | this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" ); | ||
12418 | this.menuInstance.focus( null, this._getSelectedItem() ); | ||
12419 | } | ||
12420 | |||
12421 | this.isOpen = true; | ||
12422 | this._toggleAttr(); | ||
12423 | this._resizeMenu(); | ||
12424 | this._position(); | ||
12425 | |||
12426 | this._on( this.document, this._documentClick ); | ||
12427 | |||
12428 | this._trigger( "open", event ); | ||
12429 | }, | ||
12430 | |||
12431 | _position: function() { | ||
12432 | this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); | ||
12433 | }, | ||
12434 | |||
12435 | close: function( event ) { | ||
12436 | if ( !this.isOpen ) { | ||
12437 | return; | ||
12438 | } | ||
12439 | |||
12440 | this.isOpen = false; | ||
12441 | this._toggleAttr(); | ||
12442 | |||
12443 | this.range = null; | ||
12444 | this._off( this.document ); | ||
12445 | |||
12446 | this._trigger( "close", event ); | ||
12447 | }, | ||
12448 | |||
12449 | widget: function() { | ||
12450 | return this.button; | ||
12451 | }, | ||
12452 | |||
12453 | menuWidget: function() { | ||
12454 | return this.menu; | ||
12455 | }, | ||
12456 | |||
12457 | _renderMenu: function( ul, items ) { | ||
12458 | var that = this, | ||
12459 | currentOptgroup = ""; | ||
12460 | |||
12461 | $.each( items, function( index, item ) { | ||
12462 | if ( item.optgroup !== currentOptgroup ) { | ||
12463 | $( "<li>", { | ||
12464 | "class": "ui-selectmenu-optgroup ui-menu-divider" + | ||
12465 | ( item.element.parent( "optgroup" ).prop( "disabled" ) ? | ||
12466 | " ui-state-disabled" : | ||
12467 | "" ), | ||
12468 | text: item.optgroup | ||
12469 | }) | ||
12470 | .appendTo( ul ); | ||
12471 | |||
12472 | currentOptgroup = item.optgroup; | ||
12473 | } | ||
12474 | |||
12475 | that._renderItemData( ul, item ); | ||
12476 | }); | ||
12477 | }, | ||
12478 | |||
12479 | _renderItemData: function( ul, item ) { | ||
12480 | return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); | ||
12481 | }, | ||
12482 | |||
12483 | _renderItem: function( ul, item ) { | ||
12484 | var li = $( "<li>" ); | ||
12485 | |||
12486 | if ( item.disabled ) { | ||
12487 | li.addClass( "ui-state-disabled" ); | ||
12488 | } | ||
12489 | this._setText( li, item.label ); | ||
12490 | |||
12491 | return li.appendTo( ul ); | ||
12492 | }, | ||
12493 | |||
12494 | _setText: function( element, value ) { | ||
12495 | if ( value ) { | ||
12496 | element.text( value ); | ||
12497 | } else { | ||
12498 | element.html( " " ); | ||
12499 | } | ||
12500 | }, | ||
12501 | |||
12502 | _move: function( direction, event ) { | ||
12503 | var item, next, | ||
12504 | filter = ".ui-menu-item"; | ||
12505 | |||
12506 | if ( this.isOpen ) { | ||
12507 | item = this.menuItems.eq( this.focusIndex ); | ||
12508 | } else { | ||
12509 | item = this.menuItems.eq( this.element[ 0 ].selectedIndex ); | ||
12510 | filter += ":not(.ui-state-disabled)"; | ||
12511 | } | ||
12512 | |||
12513 | if ( direction === "first" || direction === "last" ) { | ||
12514 | next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); | ||
12515 | } else { | ||
12516 | next = item[ direction + "All" ]( filter ).eq( 0 ); | ||
12517 | } | ||
12518 | |||
12519 | if ( next.length ) { | ||
12520 | this.menuInstance.focus( event, next ); | ||
12521 | } | ||
12522 | }, | ||
12523 | |||
12524 | _getSelectedItem: function() { | ||
12525 | return this.menuItems.eq( this.element[ 0 ].selectedIndex ); | ||
12526 | }, | ||
12527 | |||
12528 | _toggle: function( event ) { | ||
12529 | this[ this.isOpen ? "close" : "open" ]( event ); | ||
12530 | }, | ||
12531 | |||
12532 | _setSelection: function() { | ||
12533 | var selection; | ||
12534 | |||
12535 | if ( !this.range ) { | ||
12536 | return; | ||
12537 | } | ||
12538 | |||
12539 | if ( window.getSelection ) { | ||
12540 | selection = window.getSelection(); | ||
12541 | selection.removeAllRanges(); | ||
12542 | selection.addRange( this.range ); | ||
12543 | |||
12544 | // support: IE8 | ||
12545 | } else { | ||
12546 | this.range.select(); | ||
12547 | } | ||
12548 | |||
12549 | // support: IE | ||
12550 | // Setting the text selection kills the button focus in IE, but | ||
12551 | // restoring the focus doesn't kill the selection. | ||
12552 | this.button.focus(); | ||
12553 | }, | ||
12554 | |||
12555 | _documentClick: { | ||
12556 | mousedown: function( event ) { | ||
12557 | if ( !this.isOpen ) { | ||
12558 | return; | ||
12559 | } | ||
12560 | |||
12561 | if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) { | ||
12562 | this.close( event ); | ||
12563 | } | ||
12564 | } | ||
12565 | }, | ||
12566 | |||
12567 | _buttonEvents: { | ||
12568 | |||
12569 | // Prevent text selection from being reset when interacting with the selectmenu (#10144) | ||
12570 | mousedown: function() { | ||
12571 | var selection; | ||
12572 | |||
12573 | if ( window.getSelection ) { | ||
12574 | selection = window.getSelection(); | ||
12575 | if ( selection.rangeCount ) { | ||
12576 | this.range = selection.getRangeAt( 0 ); | ||
12577 | } | ||
12578 | |||
12579 | // support: IE8 | ||
12580 | } else { | ||
12581 | this.range = document.selection.createRange(); | ||
12582 | } | ||
12583 | }, | ||
12584 | |||
12585 | click: function( event ) { | ||
12586 | this._setSelection(); | ||
12587 | this._toggle( event ); | ||
12588 | }, | ||
12589 | |||
12590 | keydown: function( event ) { | ||
12591 | var preventDefault = true; | ||
12592 | switch ( event.keyCode ) { | ||
12593 | case $.ui.keyCode.TAB: | ||
12594 | case $.ui.keyCode.ESCAPE: | ||
12595 | this.close( event ); | ||
12596 | preventDefault = false; | ||
12597 | break; | ||
12598 | case $.ui.keyCode.ENTER: | ||
12599 | if ( this.isOpen ) { | ||
12600 | this._selectFocusedItem( event ); | ||
12601 | } | ||
12602 | break; | ||
12603 | case $.ui.keyCode.UP: | ||
12604 | if ( event.altKey ) { | ||
12605 | this._toggle( event ); | ||
12606 | } else { | ||
12607 | this._move( "prev", event ); | ||
12608 | } | ||
12609 | break; | ||
12610 | case $.ui.keyCode.DOWN: | ||
12611 | if ( event.altKey ) { | ||
12612 | this._toggle( event ); | ||
12613 | } else { | ||
12614 | this._move( "next", event ); | ||
12615 | } | ||
12616 | break; | ||
12617 | case $.ui.keyCode.SPACE: | ||
12618 | if ( this.isOpen ) { | ||
12619 | this._selectFocusedItem( event ); | ||
12620 | } else { | ||
12621 | this._toggle( event ); | ||
12622 | } | ||
12623 | break; | ||
12624 | case $.ui.keyCode.LEFT: | ||
12625 | this._move( "prev", event ); | ||
12626 | break; | ||
12627 | case $.ui.keyCode.RIGHT: | ||
12628 | this._move( "next", event ); | ||
12629 | break; | ||
12630 | case $.ui.keyCode.HOME: | ||
12631 | case $.ui.keyCode.PAGE_UP: | ||
12632 | this._move( "first", event ); | ||
12633 | break; | ||
12634 | case $.ui.keyCode.END: | ||
12635 | case $.ui.keyCode.PAGE_DOWN: | ||
12636 | this._move( "last", event ); | ||
12637 | break; | ||
12638 | default: | ||
12639 | this.menu.trigger( event ); | ||
12640 | preventDefault = false; | ||
12641 | } | ||
12642 | |||
12643 | if ( preventDefault ) { | ||
12644 | event.preventDefault(); | ||
12645 | } | ||
12646 | } | ||
12647 | }, | ||
12648 | |||
12649 | _selectFocusedItem: function( event ) { | ||
12650 | var item = this.menuItems.eq( this.focusIndex ); | ||
12651 | if ( !item.hasClass( "ui-state-disabled" ) ) { | ||
12652 | this._select( item.data( "ui-selectmenu-item" ), event ); | ||
12653 | } | ||
12654 | }, | ||
12655 | |||
12656 | _select: function( item, event ) { | ||
12657 | var oldIndex = this.element[ 0 ].selectedIndex; | ||
12658 | |||
12659 | // Change native select element | ||
12660 | this.element[ 0 ].selectedIndex = item.index; | ||
12661 | this._setText( this.buttonText, item.label ); | ||
12662 | this._setAria( item ); | ||
12663 | this._trigger( "select", event, { item: item } ); | ||
12664 | |||
12665 | if ( item.index !== oldIndex ) { | ||
12666 | this._trigger( "change", event, { item: item } ); | ||
12667 | } | ||
12668 | |||
12669 | this.close( event ); | ||
12670 | }, | ||
12671 | |||
12672 | _setAria: function( item ) { | ||
12673 | var id = this.menuItems.eq( item.index ).attr( "id" ); | ||
12674 | |||
12675 | this.button.attr({ | ||
12676 | "aria-labelledby": id, | ||
12677 | "aria-activedescendant": id | ||
12678 | }); | ||
12679 | this.menu.attr( "aria-activedescendant", id ); | ||
12680 | }, | ||
12681 | |||
12682 | _setOption: function( key, value ) { | ||
12683 | if ( key === "icons" ) { | ||
12684 | this.button.find( "span.ui-icon" ) | ||
12685 | .removeClass( this.options.icons.button ) | ||
12686 | .addClass( value.button ); | ||
12687 | } | ||
12688 | |||
12689 | this._super( key, value ); | ||
12690 | |||
12691 | if ( key === "appendTo" ) { | ||
12692 | this.menuWrap.appendTo( this._appendTo() ); | ||
12693 | } | ||
12694 | |||
12695 | if ( key === "disabled" ) { | ||
12696 | this.menuInstance.option( "disabled", value ); | ||
12697 | this.button | ||
12698 | .toggleClass( "ui-state-disabled", value ) | ||
12699 | .attr( "aria-disabled", value ); | ||
12700 | |||
12701 | this.element.prop( "disabled", value ); | ||
12702 | if ( value ) { | ||
12703 | this.button.attr( "tabindex", -1 ); | ||
12704 | this.close(); | ||
12705 | } else { | ||
12706 | this.button.attr( "tabindex", 0 ); | ||
12707 | } | ||
12708 | } | ||
12709 | |||
12710 | if ( key === "width" ) { | ||
12711 | this._resizeButton(); | ||
12712 | } | ||
12713 | }, | ||
12714 | |||
12715 | _appendTo: function() { | ||
12716 | var element = this.options.appendTo; | ||
12717 | |||
12718 | if ( element ) { | ||
12719 | element = element.jquery || element.nodeType ? | ||
12720 | $( element ) : | ||
12721 | this.document.find( element ).eq( 0 ); | ||
12722 | } | ||
12723 | |||
12724 | if ( !element || !element[ 0 ] ) { | ||
12725 | element = this.element.closest( ".ui-front" ); | ||
12726 | } | ||
12727 | |||
12728 | if ( !element.length ) { | ||
12729 | element = this.document[ 0 ].body; | ||
12730 | } | ||
12731 | |||
12732 | return element; | ||
12733 | }, | ||
12734 | |||
12735 | _toggleAttr: function() { | ||
12736 | this.button | ||
12737 | .toggleClass( "ui-corner-top", this.isOpen ) | ||
12738 | .toggleClass( "ui-corner-all", !this.isOpen ) | ||
12739 | .attr( "aria-expanded", this.isOpen ); | ||
12740 | this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen ); | ||
12741 | this.menu.attr( "aria-hidden", !this.isOpen ); | ||
12742 | }, | ||
12743 | |||
12744 | _resizeButton: function() { | ||
12745 | var width = this.options.width; | ||
12746 | |||
12747 | if ( !width ) { | ||
12748 | width = this.element.show().outerWidth(); | ||
12749 | this.element.hide(); | ||
12750 | } | ||
12751 | |||
12752 | this.button.outerWidth( width ); | ||
12753 | }, | ||
12754 | |||
12755 | _resizeMenu: function() { | ||
12756 | this.menu.outerWidth( Math.max( | ||
12757 | this.button.outerWidth(), | ||
12758 | |||
12759 | // support: IE10 | ||
12760 | // IE10 wraps long text (possibly a rounding bug) | ||
12761 | // so we add 1px to avoid the wrapping | ||
12762 | this.menu.width( "" ).outerWidth() + 1 | ||
12763 | ) ); | ||
12764 | }, | ||
12765 | |||
12766 | _getCreateOptions: function() { | ||
12767 | return { disabled: this.element.prop( "disabled" ) }; | ||
12768 | }, | ||
12769 | |||
12770 | _parseOptions: function( options ) { | ||
12771 | var data = []; | ||
12772 | options.each(function( index, item ) { | ||
12773 | var option = $( item ), | ||
12774 | optgroup = option.parent( "optgroup" ); | ||
12775 | data.push({ | ||
12776 | element: option, | ||
12777 | index: index, | ||
12778 | value: option.attr( "value" ), | ||
12779 | label: option.text(), | ||
12780 | optgroup: optgroup.attr( "label" ) || "", | ||
12781 | disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) | ||
12782 | }); | ||
12783 | }); | ||
12784 | this.items = data; | ||
12785 | }, | ||
12786 | |||
12787 | _destroy: function() { | ||
12788 | this.menuWrap.remove(); | ||
12789 | this.button.remove(); | ||
12790 | this.element.show(); | ||
12791 | this.element.removeUniqueId(); | ||
12792 | this.label.attr( "for", this.ids.element ); | ||
12793 | } | ||
12794 | }); | ||
12795 | |||
12796 | |||
12797 | /*! | ||
12798 | * jQuery UI Slider 1.11.2 | ||
12799 | * http://jqueryui.com | ||
12800 | * | ||
12801 | * Copyright 2014 jQuery Foundation and other contributors | ||
12802 | * Released under the MIT license. | ||
12803 | * http://jquery.org/license | ||
12804 | * | ||
12805 | * http://api.jqueryui.com/slider/ | ||
12806 | */ | ||
12807 | |||
12808 | |||
12809 | var slider = $.widget( "ui.slider", $.ui.mouse, { | ||
12810 | version: "1.11.2", | ||
12811 | widgetEventPrefix: "slide", | ||
12812 | |||
12813 | options: { | ||
12814 | animate: false, | ||
12815 | distance: 0, | ||
12816 | max: 100, | ||
12817 | min: 0, | ||
12818 | orientation: "horizontal", | ||
12819 | range: false, | ||
12820 | step: 1, | ||
12821 | value: 0, | ||
12822 | values: null, | ||
12823 | |||
12824 | // callbacks | ||
12825 | change: null, | ||
12826 | slide: null, | ||
12827 | start: null, | ||
12828 | stop: null | ||
12829 | }, | ||
12830 | |||
12831 | // number of pages in a slider | ||
12832 | // (how many times can you page up/down to go through the whole range) | ||
12833 | numPages: 5, | ||
12834 | |||
12835 | _create: function() { | ||
12836 | this._keySliding = false; | ||
12837 | this._mouseSliding = false; | ||
12838 | this._animateOff = true; | ||
12839 | this._handleIndex = null; | ||
12840 | this._detectOrientation(); | ||
12841 | this._mouseInit(); | ||
12842 | this._calculateNewMax(); | ||
12843 | |||
12844 | this.element | ||
12845 | .addClass( "ui-slider" + | ||
12846 | " ui-slider-" + this.orientation + | ||
12847 | " ui-widget" + | ||
12848 | " ui-widget-content" + | ||
12849 | " ui-corner-all"); | ||
12850 | |||
12851 | this._refresh(); | ||
12852 | this._setOption( "disabled", this.options.disabled ); | ||
12853 | |||
12854 | this._animateOff = false; | ||
12855 | }, | ||
12856 | |||
12857 | _refresh: function() { | ||
12858 | this._createRange(); | ||
12859 | this._createHandles(); | ||
12860 | this._setupEvents(); | ||
12861 | this._refreshValue(); | ||
12862 | }, | ||
12863 | |||
12864 | _createHandles: function() { | ||
12865 | var i, handleCount, | ||
12866 | options = this.options, | ||
12867 | existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), | ||
12868 | handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>", | ||
12869 | handles = []; | ||
12870 | |||
12871 | handleCount = ( options.values && options.values.length ) || 1; | ||
12872 | |||
12873 | if ( existingHandles.length > handleCount ) { | ||
12874 | existingHandles.slice( handleCount ).remove(); | ||
12875 | existingHandles = existingHandles.slice( 0, handleCount ); | ||
12876 | } | ||
12877 | |||
12878 | for ( i = existingHandles.length; i < handleCount; i++ ) { | ||
12879 | handles.push( handle ); | ||
12880 | } | ||
12881 | |||
12882 | this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); | ||
12883 | |||
12884 | this.handle = this.handles.eq( 0 ); | ||
12885 | |||
12886 | this.handles.each(function( i ) { | ||
12887 | $( this ).data( "ui-slider-handle-index", i ); | ||
12888 | }); | ||
12889 | }, | ||
12890 | |||
12891 | _createRange: function() { | ||
12892 | var options = this.options, | ||
12893 | classes = ""; | ||
12894 | |||
12895 | if ( options.range ) { | ||
12896 | if ( options.range === true ) { | ||
12897 | if ( !options.values ) { | ||
12898 | options.values = [ this._valueMin(), this._valueMin() ]; | ||
12899 | } else if ( options.values.length && options.values.length !== 2 ) { | ||
12900 | options.values = [ options.values[0], options.values[0] ]; | ||
12901 | } else if ( $.isArray( options.values ) ) { | ||
12902 | options.values = options.values.slice(0); | ||
12903 | } | ||
12904 | } | ||
12905 | |||
12906 | if ( !this.range || !this.range.length ) { | ||
12907 | this.range = $( "<div></div>" ) | ||
12908 | .appendTo( this.element ); | ||
12909 | |||
12910 | classes = "ui-slider-range" + | ||
12911 | // note: this isn't the most fittingly semantic framework class for this element, | ||
12912 | // but worked best visually with a variety of themes | ||
12913 | " ui-widget-header ui-corner-all"; | ||
12914 | } else { | ||
12915 | this.range.removeClass( "ui-slider-range-min ui-slider-range-max" ) | ||
12916 | // Handle range switching from true to min/max | ||
12917 | .css({ | ||
12918 | "left": "", | ||
12919 | "bottom": "" | ||
12920 | }); | ||
12921 | } | ||
12922 | |||
12923 | this.range.addClass( classes + | ||
12924 | ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) ); | ||
12925 | } else { | ||
12926 | if ( this.range ) { | ||
12927 | this.range.remove(); | ||
12928 | } | ||
12929 | this.range = null; | ||
12930 | } | ||
12931 | }, | ||
12932 | |||
12933 | _setupEvents: function() { | ||
12934 | this._off( this.handles ); | ||
12935 | this._on( this.handles, this._handleEvents ); | ||
12936 | this._hoverable( this.handles ); | ||
12937 | this._focusable( this.handles ); | ||
12938 | }, | ||
12939 | |||
12940 | _destroy: function() { | ||
12941 | this.handles.remove(); | ||
12942 | if ( this.range ) { | ||
12943 | this.range.remove(); | ||
12944 | } | ||
12945 | |||
12946 | this.element | ||
12947 | .removeClass( "ui-slider" + | ||
12948 | " ui-slider-horizontal" + | ||
12949 | " ui-slider-vertical" + | ||
12950 | " ui-widget" + | ||
12951 | " ui-widget-content" + | ||
12952 | " ui-corner-all" ); | ||
12953 | |||
12954 | this._mouseDestroy(); | ||
12955 | }, | ||
12956 | |||
12957 | _mouseCapture: function( event ) { | ||
12958 | var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, | ||
12959 | that = this, | ||
12960 | o = this.options; | ||
12961 | |||
12962 | if ( o.disabled ) { | ||
12963 | return false; | ||
12964 | } | ||
12965 | |||
12966 | this.elementSize = { | ||
12967 | width: this.element.outerWidth(), | ||
12968 | height: this.element.outerHeight() | ||
12969 | }; | ||
12970 | this.elementOffset = this.element.offset(); | ||
12971 | |||
12972 | position = { x: event.pageX, y: event.pageY }; | ||
12973 | normValue = this._normValueFromMouse( position ); | ||
12974 | distance = this._valueMax() - this._valueMin() + 1; | ||
12975 | this.handles.each(function( i ) { | ||
12976 | var thisDistance = Math.abs( normValue - that.values(i) ); | ||
12977 | if (( distance > thisDistance ) || | ||
12978 | ( distance === thisDistance && | ||
12979 | (i === that._lastChangedValue || that.values(i) === o.min ))) { | ||
12980 | distance = thisDistance; | ||
12981 | closestHandle = $( this ); | ||
12982 | index = i; | ||
12983 | } | ||
12984 | }); | ||
12985 | |||
12986 | allowed = this._start( event, index ); | ||
12987 | if ( allowed === false ) { | ||
12988 | return false; | ||
12989 | } | ||
12990 | this._mouseSliding = true; | ||
12991 | |||
12992 | this._handleIndex = index; | ||
12993 | |||
12994 | closestHandle | ||
12995 | .addClass( "ui-state-active" ) | ||
12996 | .focus(); | ||
12997 | |||
12998 | offset = closestHandle.offset(); | ||
12999 | mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); | ||
13000 | this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { | ||
13001 | left: event.pageX - offset.left - ( closestHandle.width() / 2 ), | ||
13002 | top: event.pageY - offset.top - | ||
13003 | ( closestHandle.height() / 2 ) - | ||
13004 | ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - | ||
13005 | ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + | ||
13006 | ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) | ||
13007 | }; | ||
13008 | |||
13009 | if ( !this.handles.hasClass( "ui-state-hover" ) ) { | ||
13010 | this._slide( event, index, normValue ); | ||
13011 | } | ||
13012 | this._animateOff = true; | ||
13013 | return true; | ||
13014 | }, | ||
13015 | |||
13016 | _mouseStart: function() { | ||
13017 | return true; | ||
13018 | }, | ||
13019 | |||
13020 | _mouseDrag: function( event ) { | ||
13021 | var position = { x: event.pageX, y: event.pageY }, | ||
13022 | normValue = this._normValueFromMouse( position ); | ||
13023 | |||
13024 | this._slide( event, this._handleIndex, normValue ); | ||
13025 | |||
13026 | return false; | ||
13027 | }, | ||
13028 | |||
13029 | _mouseStop: function( event ) { | ||
13030 | this.handles.removeClass( "ui-state-active" ); | ||
13031 | this._mouseSliding = false; | ||
13032 | |||
13033 | this._stop( event, this._handleIndex ); | ||
13034 | this._change( event, this._handleIndex ); | ||
13035 | |||
13036 | this._handleIndex = null; | ||
13037 | this._clickOffset = null; | ||
13038 | this._animateOff = false; | ||
13039 | |||
13040 | return false; | ||
13041 | }, | ||
13042 | |||
13043 | _detectOrientation: function() { | ||
13044 | this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; | ||
13045 | }, | ||
13046 | |||
13047 | _normValueFromMouse: function( position ) { | ||
13048 | var pixelTotal, | ||
13049 | pixelMouse, | ||
13050 | percentMouse, | ||
13051 | valueTotal, | ||
13052 | valueMouse; | ||
13053 | |||
13054 | if ( this.orientation === "horizontal" ) { | ||
13055 | pixelTotal = this.elementSize.width; | ||
13056 | pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); | ||
13057 | } else { | ||
13058 | pixelTotal = this.elementSize.height; | ||
13059 | pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); | ||
13060 | } | ||
13061 | |||
13062 | percentMouse = ( pixelMouse / pixelTotal ); | ||
13063 | if ( percentMouse > 1 ) { | ||
13064 | percentMouse = 1; | ||
13065 | } | ||
13066 | if ( percentMouse < 0 ) { | ||
13067 | percentMouse = 0; | ||
13068 | } | ||
13069 | if ( this.orientation === "vertical" ) { | ||
13070 | percentMouse = 1 - percentMouse; | ||
13071 | } | ||
13072 | |||
13073 | valueTotal = this._valueMax() - this._valueMin(); | ||
13074 | valueMouse = this._valueMin() + percentMouse * valueTotal; | ||
13075 | |||
13076 | return this._trimAlignValue( valueMouse ); | ||
13077 | }, | ||
13078 | |||
13079 | _start: function( event, index ) { | ||
13080 | var uiHash = { | ||
13081 | handle: this.handles[ index ], | ||
13082 | value: this.value() | ||
13083 | }; | ||
13084 | if ( this.options.values && this.options.values.length ) { | ||
13085 | uiHash.value = this.values( index ); | ||
13086 | uiHash.values = this.values(); | ||
13087 | } | ||
13088 | return this._trigger( "start", event, uiHash ); | ||
13089 | }, | ||
13090 | |||
13091 | _slide: function( event, index, newVal ) { | ||
13092 | var otherVal, | ||
13093 | newValues, | ||
13094 | allowed; | ||
13095 | |||
13096 | if ( this.options.values && this.options.values.length ) { | ||
13097 | otherVal = this.values( index ? 0 : 1 ); | ||
13098 | |||
13099 | if ( ( this.options.values.length === 2 && this.options.range === true ) && | ||
13100 | ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) | ||
13101 | ) { | ||
13102 | newVal = otherVal; | ||
13103 | } | ||
13104 | |||
13105 | if ( newVal !== this.values( index ) ) { | ||
13106 | newValues = this.values(); | ||
13107 | newValues[ index ] = newVal; | ||
13108 | // A slide can be canceled by returning false from the slide callback | ||
13109 | allowed = this._trigger( "slide", event, { | ||
13110 | handle: this.handles[ index ], | ||
13111 | value: newVal, | ||
13112 | values: newValues | ||
13113 | } ); | ||
13114 | otherVal = this.values( index ? 0 : 1 ); | ||
13115 | if ( allowed !== false ) { | ||
13116 | this.values( index, newVal ); | ||
13117 | } | ||
13118 | } | ||
13119 | } else { | ||
13120 | if ( newVal !== this.value() ) { | ||
13121 | // A slide can be canceled by returning false from the slide callback | ||
13122 | allowed = this._trigger( "slide", event, { | ||
13123 | handle: this.handles[ index ], | ||
13124 | value: newVal | ||
13125 | } ); | ||
13126 | if ( allowed !== false ) { | ||
13127 | this.value( newVal ); | ||
13128 | } | ||
13129 | } | ||
13130 | } | ||
13131 | }, | ||
13132 | |||
13133 | _stop: function( event, index ) { | ||
13134 | var uiHash = { | ||
13135 | handle: this.handles[ index ], | ||
13136 | value: this.value() | ||
13137 | }; | ||
13138 | if ( this.options.values && this.options.values.length ) { | ||
13139 | uiHash.value = this.values( index ); | ||
13140 | uiHash.values = this.values(); | ||
13141 | } | ||
13142 | |||
13143 | this._trigger( "stop", event, uiHash ); | ||
13144 | }, | ||
13145 | |||
13146 | _change: function( event, index ) { | ||
13147 | if ( !this._keySliding && !this._mouseSliding ) { | ||
13148 | var uiHash = { | ||
13149 | handle: this.handles[ index ], | ||
13150 | value: this.value() | ||
13151 | }; | ||
13152 | if ( this.options.values && this.options.values.length ) { | ||
13153 | uiHash.value = this.values( index ); | ||
13154 | uiHash.values = this.values(); | ||
13155 | } | ||
13156 | |||
13157 | //store the last changed value index for reference when handles overlap | ||
13158 | this._lastChangedValue = index; | ||
13159 | |||
13160 | this._trigger( "change", event, uiHash ); | ||
13161 | } | ||
13162 | }, | ||
13163 | |||
13164 | value: function( newValue ) { | ||
13165 | if ( arguments.length ) { | ||
13166 | this.options.value = this._trimAlignValue( newValue ); | ||
13167 | this._refreshValue(); | ||
13168 | this._change( null, 0 ); | ||
13169 | return; | ||
13170 | } | ||
13171 | |||
13172 | return this._value(); | ||
13173 | }, | ||
13174 | |||
13175 | values: function( index, newValue ) { | ||
13176 | var vals, | ||
13177 | newValues, | ||
13178 | i; | ||
13179 | |||
13180 | if ( arguments.length > 1 ) { | ||
13181 | this.options.values[ index ] = this._trimAlignValue( newValue ); | ||
13182 | this._refreshValue(); | ||
13183 | this._change( null, index ); | ||
13184 | return; | ||
13185 | } | ||
13186 | |||
13187 | if ( arguments.length ) { | ||
13188 | if ( $.isArray( arguments[ 0 ] ) ) { | ||
13189 | vals = this.options.values; | ||
13190 | newValues = arguments[ 0 ]; | ||
13191 | for ( i = 0; i < vals.length; i += 1 ) { | ||
13192 | vals[ i ] = this._trimAlignValue( newValues[ i ] ); | ||
13193 | this._change( null, i ); | ||
13194 | } | ||
13195 | this._refreshValue(); | ||
13196 | } else { | ||
13197 | if ( this.options.values && this.options.values.length ) { | ||
13198 | return this._values( index ); | ||
13199 | } else { | ||
13200 | return this.value(); | ||
13201 | } | ||
13202 | } | ||
13203 | } else { | ||
13204 | return this._values(); | ||
13205 | } | ||
13206 | }, | ||
13207 | |||
13208 | _setOption: function( key, value ) { | ||
13209 | var i, | ||
13210 | valsLength = 0; | ||
13211 | |||
13212 | if ( key === "range" && this.options.range === true ) { | ||
13213 | if ( value === "min" ) { | ||
13214 | this.options.value = this._values( 0 ); | ||
13215 | this.options.values = null; | ||
13216 | } else if ( value === "max" ) { | ||
13217 | this.options.value = this._values( this.options.values.length - 1 ); | ||
13218 | this.options.values = null; | ||
13219 | } | ||
13220 | } | ||
13221 | |||
13222 | if ( $.isArray( this.options.values ) ) { | ||
13223 | valsLength = this.options.values.length; | ||
13224 | } | ||
13225 | |||
13226 | if ( key === "disabled" ) { | ||
13227 | this.element.toggleClass( "ui-state-disabled", !!value ); | ||
13228 | } | ||
13229 | |||
13230 | this._super( key, value ); | ||
13231 | |||
13232 | switch ( key ) { | ||
13233 | case "orientation": | ||
13234 | this._detectOrientation(); | ||
13235 | this.element | ||
13236 | .removeClass( "ui-slider-horizontal ui-slider-vertical" ) | ||
13237 | .addClass( "ui-slider-" + this.orientation ); | ||
13238 | this._refreshValue(); | ||
13239 | |||
13240 | // Reset positioning from previous orientation | ||
13241 | this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); | ||
13242 | break; | ||
13243 | case "value": | ||
13244 | this._animateOff = true; | ||
13245 | this._refreshValue(); | ||
13246 | this._change( null, 0 ); | ||
13247 | this._animateOff = false; | ||
13248 | break; | ||
13249 | case "values": | ||
13250 | this._animateOff = true; | ||
13251 | this._refreshValue(); | ||
13252 | for ( i = 0; i < valsLength; i += 1 ) { | ||
13253 | this._change( null, i ); | ||
13254 | } | ||
13255 | this._animateOff = false; | ||
13256 | break; | ||
13257 | case "step": | ||
13258 | case "min": | ||
13259 | case "max": | ||
13260 | this._animateOff = true; | ||
13261 | this._calculateNewMax(); | ||
13262 | this._refreshValue(); | ||
13263 | this._animateOff = false; | ||
13264 | break; | ||
13265 | case "range": | ||
13266 | this._animateOff = true; | ||
13267 | this._refresh(); | ||
13268 | this._animateOff = false; | ||
13269 | break; | ||
13270 | } | ||
13271 | }, | ||
13272 | |||
13273 | //internal value getter | ||
13274 | // _value() returns value trimmed by min and max, aligned by step | ||
13275 | _value: function() { | ||
13276 | var val = this.options.value; | ||
13277 | val = this._trimAlignValue( val ); | ||
13278 | |||
13279 | return val; | ||
13280 | }, | ||
13281 | |||
13282 | //internal values getter | ||
13283 | // _values() returns array of values trimmed by min and max, aligned by step | ||
13284 | // _values( index ) returns single value trimmed by min and max, aligned by step | ||
13285 | _values: function( index ) { | ||
13286 | var val, | ||
13287 | vals, | ||
13288 | i; | ||
13289 | |||
13290 | if ( arguments.length ) { | ||
13291 | val = this.options.values[ index ]; | ||
13292 | val = this._trimAlignValue( val ); | ||
13293 | |||
13294 | return val; | ||
13295 | } else if ( this.options.values && this.options.values.length ) { | ||
13296 | // .slice() creates a copy of the array | ||
13297 | // this copy gets trimmed by min and max and then returned | ||
13298 | vals = this.options.values.slice(); | ||
13299 | for ( i = 0; i < vals.length; i += 1) { | ||
13300 | vals[ i ] = this._trimAlignValue( vals[ i ] ); | ||
13301 | } | ||
13302 | |||
13303 | return vals; | ||
13304 | } else { | ||
13305 | return []; | ||
13306 | } | ||
13307 | }, | ||
13308 | |||
13309 | // returns the step-aligned value that val is closest to, between (inclusive) min and max | ||
13310 | _trimAlignValue: function( val ) { | ||
13311 | if ( val <= this._valueMin() ) { | ||
13312 | return this._valueMin(); | ||
13313 | } | ||
13314 | if ( val >= this._valueMax() ) { | ||
13315 | return this._valueMax(); | ||
13316 | } | ||
13317 | var step = ( this.options.step > 0 ) ? this.options.step : 1, | ||
13318 | valModStep = (val - this._valueMin()) % step, | ||
13319 | alignValue = val - valModStep; | ||
13320 | |||
13321 | if ( Math.abs(valModStep) * 2 >= step ) { | ||
13322 | alignValue += ( valModStep > 0 ) ? step : ( -step ); | ||
13323 | } | ||
13324 | |||
13325 | // Since JavaScript has problems with large floats, round | ||
13326 | // the final value to 5 digits after the decimal point (see #4124) | ||
13327 | return parseFloat( alignValue.toFixed(5) ); | ||
13328 | }, | ||
13329 | |||
13330 | _calculateNewMax: function() { | ||
13331 | var remainder = ( this.options.max - this._valueMin() ) % this.options.step; | ||
13332 | this.max = this.options.max - remainder; | ||
13333 | }, | ||
13334 | |||
13335 | _valueMin: function() { | ||
13336 | return this.options.min; | ||
13337 | }, | ||
13338 | |||
13339 | _valueMax: function() { | ||
13340 | return this.max; | ||
13341 | }, | ||
13342 | |||
13343 | _refreshValue: function() { | ||
13344 | var lastValPercent, valPercent, value, valueMin, valueMax, | ||
13345 | oRange = this.options.range, | ||
13346 | o = this.options, | ||
13347 | that = this, | ||
13348 | animate = ( !this._animateOff ) ? o.animate : false, | ||
13349 | _set = {}; | ||
13350 | |||
13351 | if ( this.options.values && this.options.values.length ) { | ||
13352 | this.handles.each(function( i ) { | ||
13353 | valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; | ||
13354 | _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; | ||
13355 | $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); | ||
13356 | if ( that.options.range === true ) { | ||
13357 | if ( that.orientation === "horizontal" ) { | ||
13358 | if ( i === 0 ) { | ||
13359 | that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); | ||
13360 | } | ||
13361 | if ( i === 1 ) { | ||
13362 | that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); | ||
13363 | } | ||
13364 | } else { | ||
13365 | if ( i === 0 ) { | ||
13366 | that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); | ||
13367 | } | ||
13368 | if ( i === 1 ) { | ||
13369 | that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); | ||
13370 | } | ||
13371 | } | ||
13372 | } | ||
13373 | lastValPercent = valPercent; | ||
13374 | }); | ||
13375 | } else { | ||
13376 | value = this.value(); | ||
13377 | valueMin = this._valueMin(); | ||
13378 | valueMax = this._valueMax(); | ||
13379 | valPercent = ( valueMax !== valueMin ) ? | ||
13380 | ( value - valueMin ) / ( valueMax - valueMin ) * 100 : | ||
13381 | 0; | ||
13382 | _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; | ||
13383 | this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); | ||
13384 | |||
13385 | if ( oRange === "min" && this.orientation === "horizontal" ) { | ||
13386 | this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); | ||
13387 | } | ||
13388 | if ( oRange === "max" && this.orientation === "horizontal" ) { | ||
13389 | this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); | ||
13390 | } | ||
13391 | if ( oRange === "min" && this.orientation === "vertical" ) { | ||
13392 | this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); | ||
13393 | } | ||
13394 | if ( oRange === "max" && this.orientation === "vertical" ) { | ||
13395 | this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); | ||
13396 | } | ||
13397 | } | ||
13398 | }, | ||
13399 | |||
13400 | _handleEvents: { | ||
13401 | keydown: function( event ) { | ||
13402 | var allowed, curVal, newVal, step, | ||
13403 | index = $( event.target ).data( "ui-slider-handle-index" ); | ||
13404 | |||
13405 | switch ( event.keyCode ) { | ||
13406 | case $.ui.keyCode.HOME: | ||
13407 | case $.ui.keyCode.END: | ||
13408 | case $.ui.keyCode.PAGE_UP: | ||
13409 | case $.ui.keyCode.PAGE_DOWN: | ||
13410 | case $.ui.keyCode.UP: | ||
13411 | case $.ui.keyCode.RIGHT: | ||
13412 | case $.ui.keyCode.DOWN: | ||
13413 | case $.ui.keyCode.LEFT: | ||
13414 | event.preventDefault(); | ||
13415 | if ( !this._keySliding ) { | ||
13416 | this._keySliding = true; | ||
13417 | $( event.target ).addClass( "ui-state-active" ); | ||
13418 | allowed = this._start( event, index ); | ||
13419 | if ( allowed === false ) { | ||
13420 | return; | ||
13421 | } | ||
13422 | } | ||
13423 | break; | ||
13424 | } | ||
13425 | |||
13426 | step = this.options.step; | ||
13427 | if ( this.options.values && this.options.values.length ) { | ||
13428 | curVal = newVal = this.values( index ); | ||
13429 | } else { | ||
13430 | curVal = newVal = this.value(); | ||
13431 | } | ||
13432 | |||
13433 | switch ( event.keyCode ) { | ||
13434 | case $.ui.keyCode.HOME: | ||
13435 | newVal = this._valueMin(); | ||
13436 | break; | ||
13437 | case $.ui.keyCode.END: | ||
13438 | newVal = this._valueMax(); | ||
13439 | break; | ||
13440 | case $.ui.keyCode.PAGE_UP: | ||
13441 | newVal = this._trimAlignValue( | ||
13442 | curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) | ||
13443 | ); | ||
13444 | break; | ||
13445 | case $.ui.keyCode.PAGE_DOWN: | ||
13446 | newVal = this._trimAlignValue( | ||
13447 | curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) ); | ||
13448 | break; | ||
13449 | case $.ui.keyCode.UP: | ||
13450 | case $.ui.keyCode.RIGHT: | ||
13451 | if ( curVal === this._valueMax() ) { | ||
13452 | return; | ||
13453 | } | ||
13454 | newVal = this._trimAlignValue( curVal + step ); | ||
13455 | break; | ||
13456 | case $.ui.keyCode.DOWN: | ||
13457 | case $.ui.keyCode.LEFT: | ||
13458 | if ( curVal === this._valueMin() ) { | ||
13459 | return; | ||
13460 | } | ||
13461 | newVal = this._trimAlignValue( curVal - step ); | ||
13462 | break; | ||
13463 | } | ||
13464 | |||
13465 | this._slide( event, index, newVal ); | ||
13466 | }, | ||
13467 | keyup: function( event ) { | ||
13468 | var index = $( event.target ).data( "ui-slider-handle-index" ); | ||
13469 | |||
13470 | if ( this._keySliding ) { | ||
13471 | this._keySliding = false; | ||
13472 | this._stop( event, index ); | ||
13473 | this._change( event, index ); | ||
13474 | $( event.target ).removeClass( "ui-state-active" ); | ||
13475 | } | ||
13476 | } | ||
13477 | } | ||
13478 | }); | ||
13479 | |||
13480 | |||
13481 | /*! | ||
13482 | * jQuery UI Sortable 1.11.2 | ||
13483 | * http://jqueryui.com | ||
13484 | * | ||
13485 | * Copyright 2014 jQuery Foundation and other contributors | ||
13486 | * Released under the MIT license. | ||
13487 | * http://jquery.org/license | ||
13488 | * | ||
13489 | * http://api.jqueryui.com/sortable/ | ||
13490 | */ | ||
13491 | |||
13492 | |||
13493 | var sortable = $.widget("ui.sortable", $.ui.mouse, { | ||
13494 | version: "1.11.2", | ||
13495 | widgetEventPrefix: "sort", | ||
13496 | ready: false, | ||
13497 | options: { | ||
13498 | appendTo: "parent", | ||
13499 | axis: false, | ||
13500 | connectWith: false, | ||
13501 | containment: false, | ||
13502 | cursor: "auto", | ||
13503 | cursorAt: false, | ||
13504 | dropOnEmpty: true, | ||
13505 | forcePlaceholderSize: false, | ||
13506 | forceHelperSize: false, | ||
13507 | grid: false, | ||
13508 | handle: false, | ||
13509 | helper: "original", | ||
13510 | items: "> *", | ||
13511 | opacity: false, | ||
13512 | placeholder: false, | ||
13513 | revert: false, | ||
13514 | scroll: true, | ||
13515 | scrollSensitivity: 20, | ||
13516 | scrollSpeed: 20, | ||
13517 | scope: "default", | ||
13518 | tolerance: "intersect", | ||
13519 | zIndex: 1000, | ||
13520 | |||
13521 | // callbacks | ||
13522 | activate: null, | ||
13523 | beforeStop: null, | ||
13524 | change: null, | ||
13525 | deactivate: null, | ||
13526 | out: null, | ||
13527 | over: null, | ||
13528 | receive: null, | ||
13529 | remove: null, | ||
13530 | sort: null, | ||
13531 | start: null, | ||
13532 | stop: null, | ||
13533 | update: null | ||
13534 | }, | ||
13535 | |||
13536 | _isOverAxis: function( x, reference, size ) { | ||
13537 | return ( x >= reference ) && ( x < ( reference + size ) ); | ||
13538 | }, | ||
13539 | |||
13540 | _isFloating: function( item ) { | ||
13541 | return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display")); | ||
13542 | }, | ||
13543 | |||
13544 | _create: function() { | ||
13545 | |||
13546 | var o = this.options; | ||
13547 | this.containerCache = {}; | ||
13548 | this.element.addClass("ui-sortable"); | ||
13549 | |||
13550 | //Get the items | ||
13551 | this.refresh(); | ||
13552 | |||
13553 | //Let's determine if the items are being displayed horizontally | ||
13554 | this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false; | ||
13555 | |||
13556 | //Let's determine the parent's offset | ||
13557 | this.offset = this.element.offset(); | ||
13558 | |||
13559 | //Initialize mouse events for interaction | ||
13560 | this._mouseInit(); | ||
13561 | |||
13562 | this._setHandleClassName(); | ||
13563 | |||
13564 | //We're ready to go | ||
13565 | this.ready = true; | ||
13566 | |||
13567 | }, | ||
13568 | |||
13569 | _setOption: function( key, value ) { | ||
13570 | this._super( key, value ); | ||
13571 | |||
13572 | if ( key === "handle" ) { | ||
13573 | this._setHandleClassName(); | ||
13574 | } | ||
13575 | }, | ||
13576 | |||
13577 | _setHandleClassName: function() { | ||
13578 | this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" ); | ||
13579 | $.each( this.items, function() { | ||
13580 | ( this.instance.options.handle ? | ||
13581 | this.item.find( this.instance.options.handle ) : this.item ) | ||
13582 | .addClass( "ui-sortable-handle" ); | ||
13583 | }); | ||
13584 | }, | ||
13585 | |||
13586 | _destroy: function() { | ||
13587 | this.element | ||
13588 | .removeClass( "ui-sortable ui-sortable-disabled" ) | ||
13589 | .find( ".ui-sortable-handle" ) | ||
13590 | .removeClass( "ui-sortable-handle" ); | ||
13591 | this._mouseDestroy(); | ||
13592 | |||
13593 | for ( var i = this.items.length - 1; i >= 0; i-- ) { | ||
13594 | this.items[i].item.removeData(this.widgetName + "-item"); | ||
13595 | } | ||
13596 | |||
13597 | return this; | ||
13598 | }, | ||
13599 | |||
13600 | _mouseCapture: function(event, overrideHandle) { | ||
13601 | var currentItem = null, | ||
13602 | validHandle = false, | ||
13603 | that = this; | ||
13604 | |||
13605 | if (this.reverting) { | ||
13606 | return false; | ||
13607 | } | ||
13608 | |||
13609 | if(this.options.disabled || this.options.type === "static") { | ||
13610 | return false; | ||
13611 | } | ||
13612 | |||
13613 | //We have to refresh the items data once first | ||
13614 | this._refreshItems(event); | ||
13615 | |||
13616 | //Find out if the clicked node (or one of its parents) is a actual item in this.items | ||
13617 | $(event.target).parents().each(function() { | ||
13618 | if($.data(this, that.widgetName + "-item") === that) { | ||
13619 | currentItem = $(this); | ||
13620 | return false; | ||
13621 | } | ||
13622 | }); | ||
13623 | if($.data(event.target, that.widgetName + "-item") === that) { | ||
13624 | currentItem = $(event.target); | ||
13625 | } | ||
13626 | |||
13627 | if(!currentItem) { | ||
13628 | return false; | ||
13629 | } | ||
13630 | if(this.options.handle && !overrideHandle) { | ||
13631 | $(this.options.handle, currentItem).find("*").addBack().each(function() { | ||
13632 | if(this === event.target) { | ||
13633 | validHandle = true; | ||
13634 | } | ||
13635 | }); | ||
13636 | if(!validHandle) { | ||
13637 | return false; | ||
13638 | } | ||
13639 | } | ||
13640 | |||
13641 | this.currentItem = currentItem; | ||
13642 | this._removeCurrentsFromItems(); | ||
13643 | return true; | ||
13644 | |||
13645 | }, | ||
13646 | |||
13647 | _mouseStart: function(event, overrideHandle, noActivation) { | ||
13648 | |||
13649 | var i, body, | ||
13650 | o = this.options; | ||
13651 | |||
13652 | this.currentContainer = this; | ||
13653 | |||
13654 | //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture | ||
13655 | this.refreshPositions(); | ||
13656 | |||
13657 | //Create and append the visible helper | ||
13658 | this.helper = this._createHelper(event); | ||
13659 | |||
13660 | //Cache the helper size | ||
13661 | this._cacheHelperProportions(); | ||
13662 | |||
13663 | /* | ||
13664 | * - Position generation - | ||
13665 | * This block generates everything position related - it's the core of draggables. | ||
13666 | */ | ||
13667 | |||
13668 | //Cache the margins of the original element | ||
13669 | this._cacheMargins(); | ||
13670 | |||
13671 | //Get the next scrolling parent | ||
13672 | this.scrollParent = this.helper.scrollParent(); | ||
13673 | |||
13674 | //The element's absolute position on the page minus margins | ||
13675 | this.offset = this.currentItem.offset(); | ||
13676 | this.offset = { | ||
13677 | top: this.offset.top - this.margins.top, | ||
13678 | left: this.offset.left - this.margins.left | ||
13679 | }; | ||
13680 | |||
13681 | $.extend(this.offset, { | ||
13682 | click: { //Where the click happened, relative to the element | ||
13683 | left: event.pageX - this.offset.left, | ||
13684 | top: event.pageY - this.offset.top | ||
13685 | }, | ||
13686 | parent: this._getParentOffset(), | ||
13687 | relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper | ||
13688 | }); | ||
13689 | |||
13690 | // Only after we got the offset, we can change the helper's position to absolute | ||
13691 | // TODO: Still need to figure out a way to make relative sorting possible | ||
13692 | this.helper.css("position", "absolute"); | ||
13693 | this.cssPosition = this.helper.css("position"); | ||
13694 | |||
13695 | //Generate the original position | ||
13696 | this.originalPosition = this._generatePosition(event); | ||
13697 | this.originalPageX = event.pageX; | ||
13698 | this.originalPageY = event.pageY; | ||
13699 | |||
13700 | //Adjust the mouse offset relative to the helper if "cursorAt" is supplied | ||
13701 | (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); | ||
13702 | |||
13703 | //Cache the former DOM position | ||
13704 | this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; | ||
13705 | |||
13706 | //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way | ||
13707 | if(this.helper[0] !== this.currentItem[0]) { | ||
13708 | this.currentItem.hide(); | ||
13709 | } | ||
13710 | |||
13711 | //Create the placeholder | ||
13712 | this._createPlaceholder(); | ||
13713 | |||
13714 | //Set a containment if given in the options | ||
13715 | if(o.containment) { | ||
13716 | this._setContainment(); | ||
13717 | } | ||
13718 | |||
13719 | if( o.cursor && o.cursor !== "auto" ) { // cursor option | ||
13720 | body = this.document.find( "body" ); | ||
13721 | |||
13722 | // support: IE | ||
13723 | this.storedCursor = body.css( "cursor" ); | ||
13724 | body.css( "cursor", o.cursor ); | ||
13725 | |||
13726 | this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body ); | ||
13727 | } | ||
13728 | |||
13729 | if(o.opacity) { // opacity option | ||
13730 | if (this.helper.css("opacity")) { | ||
13731 | this._storedOpacity = this.helper.css("opacity"); | ||
13732 | } | ||
13733 | this.helper.css("opacity", o.opacity); | ||
13734 | } | ||
13735 | |||
13736 | if(o.zIndex) { // zIndex option | ||
13737 | if (this.helper.css("zIndex")) { | ||
13738 | this._storedZIndex = this.helper.css("zIndex"); | ||
13739 | } | ||
13740 | this.helper.css("zIndex", o.zIndex); | ||
13741 | } | ||
13742 | |||
13743 | //Prepare scrolling | ||
13744 | if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { | ||
13745 | this.overflowOffset = this.scrollParent.offset(); | ||
13746 | } | ||
13747 | |||
13748 | //Call callbacks | ||
13749 | this._trigger("start", event, this._uiHash()); | ||
13750 | |||
13751 | //Recache the helper size | ||
13752 | if(!this._preserveHelperProportions) { | ||
13753 | this._cacheHelperProportions(); | ||
13754 | } | ||
13755 | |||
13756 | |||
13757 | //Post "activate" events to possible containers | ||
13758 | if( !noActivation ) { | ||
13759 | for ( i = this.containers.length - 1; i >= 0; i-- ) { | ||
13760 | this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); | ||
13761 | } | ||
13762 | } | ||
13763 | |||
13764 | //Prepare possible droppables | ||
13765 | if($.ui.ddmanager) { | ||
13766 | $.ui.ddmanager.current = this; | ||
13767 | } | ||
13768 | |||
13769 | if ($.ui.ddmanager && !o.dropBehaviour) { | ||
13770 | $.ui.ddmanager.prepareOffsets(this, event); | ||
13771 | } | ||
13772 | |||
13773 | this.dragging = true; | ||
13774 | |||
13775 | this.helper.addClass("ui-sortable-helper"); | ||
13776 | this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position | ||
13777 | return true; | ||
13778 | |||
13779 | }, | ||
13780 | |||
13781 | _mouseDrag: function(event) { | ||
13782 | var i, item, itemElement, intersection, | ||
13783 | o = this.options, | ||
13784 | scrolled = false; | ||
13785 | |||
13786 | //Compute the helpers position | ||
13787 | this.position = this._generatePosition(event); | ||
13788 | this.positionAbs = this._convertPositionTo("absolute"); | ||
13789 | |||
13790 | if (!this.lastPositionAbs) { | ||
13791 | this.lastPositionAbs = this.positionAbs; | ||
13792 | } | ||
13793 | |||
13794 | //Do scrolling | ||
13795 | if(this.options.scroll) { | ||
13796 | if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { | ||
13797 | |||
13798 | if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { | ||
13799 | this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; | ||
13800 | } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) { | ||
13801 | this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; | ||
13802 | } | ||
13803 | |||
13804 | if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { | ||
13805 | this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; | ||
13806 | } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) { | ||
13807 | this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; | ||
13808 | } | ||
13809 | |||
13810 | } else { | ||
13811 | |||
13812 | if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { | ||
13813 | scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); | ||
13814 | } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { | ||
13815 | scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); | ||
13816 | } | ||
13817 | |||
13818 | if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { | ||
13819 | scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); | ||
13820 | } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { | ||
13821 | scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); | ||
13822 | } | ||
13823 | |||
13824 | } | ||
13825 | |||
13826 | if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { | ||
13827 | $.ui.ddmanager.prepareOffsets(this, event); | ||
13828 | } | ||
13829 | } | ||
13830 | |||
13831 | //Regenerate the absolute position used for position checks | ||
13832 | this.positionAbs = this._convertPositionTo("absolute"); | ||
13833 | |||
13834 | //Set the helper position | ||
13835 | if(!this.options.axis || this.options.axis !== "y") { | ||
13836 | this.helper[0].style.left = this.position.left+"px"; | ||
13837 | } | ||
13838 | if(!this.options.axis || this.options.axis !== "x") { | ||
13839 | this.helper[0].style.top = this.position.top+"px"; | ||
13840 | } | ||
13841 | |||
13842 | //Rearrange | ||
13843 | for (i = this.items.length - 1; i >= 0; i--) { | ||
13844 | |||
13845 | //Cache variables and intersection, continue if no intersection | ||
13846 | item = this.items[i]; | ||
13847 | itemElement = item.item[0]; | ||
13848 | intersection = this._intersectsWithPointer(item); | ||
13849 | if (!intersection) { | ||
13850 | continue; | ||
13851 | } | ||
13852 | |||
13853 | // Only put the placeholder inside the current Container, skip all | ||
13854 | // items from other containers. This works because when moving | ||
13855 | // an item from one container to another the | ||
13856 | // currentContainer is switched before the placeholder is moved. | ||
13857 | // | ||
13858 | // Without this, moving items in "sub-sortables" can cause | ||
13859 | // the placeholder to jitter between the outer and inner container. | ||
13860 | if (item.instance !== this.currentContainer) { | ||
13861 | continue; | ||
13862 | } | ||
13863 | |||
13864 | // cannot intersect with itself | ||
13865 | // no useless actions that have been done before | ||
13866 | // no action if the item moved is the parent of the item checked | ||
13867 | if (itemElement !== this.currentItem[0] && | ||
13868 | this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && | ||
13869 | !$.contains(this.placeholder[0], itemElement) && | ||
13870 | (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) | ||
13871 | ) { | ||
13872 | |||
13873 | this.direction = intersection === 1 ? "down" : "up"; | ||
13874 | |||
13875 | if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { | ||
13876 | this._rearrange(event, item); | ||
13877 | } else { | ||
13878 | break; | ||
13879 | } | ||
13880 | |||
13881 | this._trigger("change", event, this._uiHash()); | ||
13882 | break; | ||
13883 | } | ||
13884 | } | ||
13885 | |||
13886 | //Post events to containers | ||
13887 | this._contactContainers(event); | ||
13888 | |||
13889 | //Interconnect with droppables | ||
13890 | if($.ui.ddmanager) { | ||
13891 | $.ui.ddmanager.drag(this, event); | ||
13892 | } | ||
13893 | |||
13894 | //Call callbacks | ||
13895 | this._trigger("sort", event, this._uiHash()); | ||
13896 | |||
13897 | this.lastPositionAbs = this.positionAbs; | ||
13898 | return false; | ||
13899 | |||
13900 | }, | ||
13901 | |||
13902 | _mouseStop: function(event, noPropagation) { | ||
13903 | |||
13904 | if(!event) { | ||
13905 | return; | ||
13906 | } | ||
13907 | |||
13908 | //If we are using droppables, inform the manager about the drop | ||
13909 | if ($.ui.ddmanager && !this.options.dropBehaviour) { | ||
13910 | $.ui.ddmanager.drop(this, event); | ||
13911 | } | ||
13912 | |||
13913 | if(this.options.revert) { | ||
13914 | var that = this, | ||
13915 | cur = this.placeholder.offset(), | ||
13916 | axis = this.options.axis, | ||
13917 | animation = {}; | ||
13918 | |||
13919 | if ( !axis || axis === "x" ) { | ||
13920 | animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft); | ||
13921 | } | ||
13922 | if ( !axis || axis === "y" ) { | ||
13923 | animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop); | ||
13924 | } | ||
13925 | this.reverting = true; | ||
13926 | $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() { | ||
13927 | that._clear(event); | ||
13928 | }); | ||
13929 | } else { | ||
13930 | this._clear(event, noPropagation); | ||
13931 | } | ||
13932 | |||
13933 | return false; | ||
13934 | |||
13935 | }, | ||
13936 | |||
13937 | cancel: function() { | ||
13938 | |||
13939 | if(this.dragging) { | ||
13940 | |||
13941 | this._mouseUp({ target: null }); | ||
13942 | |||
13943 | if(this.options.helper === "original") { | ||
13944 | this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); | ||
13945 | } else { | ||
13946 | this.currentItem.show(); | ||
13947 | } | ||
13948 | |||
13949 | //Post deactivating events to containers | ||
13950 | for (var i = this.containers.length - 1; i >= 0; i--){ | ||
13951 | this.containers[i]._trigger("deactivate", null, this._uiHash(this)); | ||
13952 | if(this.containers[i].containerCache.over) { | ||
13953 | this.containers[i]._trigger("out", null, this._uiHash(this)); | ||
13954 | this.containers[i].containerCache.over = 0; | ||
13955 | } | ||
13956 | } | ||
13957 | |||
13958 | } | ||
13959 | |||
13960 | if (this.placeholder) { | ||
13961 | //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! | ||
13962 | if(this.placeholder[0].parentNode) { | ||
13963 | this.placeholder[0].parentNode.removeChild(this.placeholder[0]); | ||
13964 | } | ||
13965 | if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { | ||
13966 | this.helper.remove(); | ||
13967 | } | ||
13968 | |||
13969 | $.extend(this, { | ||
13970 | helper: null, | ||
13971 | dragging: false, | ||
13972 | reverting: false, | ||
13973 | _noFinalSort: null | ||
13974 | }); | ||
13975 | |||
13976 | if(this.domPosition.prev) { | ||
13977 | $(this.domPosition.prev).after(this.currentItem); | ||
13978 | } else { | ||
13979 | $(this.domPosition.parent).prepend(this.currentItem); | ||
13980 | } | ||
13981 | } | ||
13982 | |||
13983 | return this; | ||
13984 | |||
13985 | }, | ||
13986 | |||
13987 | serialize: function(o) { | ||
13988 | |||
13989 | var items = this._getItemsAsjQuery(o && o.connected), | ||
13990 | str = []; | ||
13991 | o = o || {}; | ||
13992 | |||
13993 | $(items).each(function() { | ||
13994 | var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); | ||
13995 | if (res) { | ||
13996 | str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2])); | ||
13997 | } | ||
13998 | }); | ||
13999 | |||
14000 | if(!str.length && o.key) { | ||
14001 | str.push(o.key + "="); | ||
14002 | } | ||
14003 | |||
14004 | return str.join("&"); | ||
14005 | |||
14006 | }, | ||
14007 | |||
14008 | toArray: function(o) { | ||
14009 | |||
14010 | var items = this._getItemsAsjQuery(o && o.connected), | ||
14011 | ret = []; | ||
14012 | |||
14013 | o = o || {}; | ||
14014 | |||
14015 | items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); | ||
14016 | return ret; | ||
14017 | |||
14018 | }, | ||
14019 | |||
14020 | /* Be careful with the following core functions */ | ||
14021 | _intersectsWith: function(item) { | ||
14022 | |||
14023 | var x1 = this.positionAbs.left, | ||
14024 | x2 = x1 + this.helperProportions.width, | ||
14025 | y1 = this.positionAbs.top, | ||
14026 | y2 = y1 + this.helperProportions.height, | ||
14027 | l = item.left, | ||
14028 | r = l + item.width, | ||
14029 | t = item.top, | ||
14030 | b = t + item.height, | ||
14031 | dyClick = this.offset.click.top, | ||
14032 | dxClick = this.offset.click.left, | ||
14033 | isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ), | ||
14034 | isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ), | ||
14035 | isOverElement = isOverElementHeight && isOverElementWidth; | ||
14036 | |||
14037 | if ( this.options.tolerance === "pointer" || | ||
14038 | this.options.forcePointerForContainers || | ||
14039 | (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) | ||
14040 | ) { | ||
14041 | return isOverElement; | ||
14042 | } else { | ||
14043 | |||
14044 | return (l < x1 + (this.helperProportions.width / 2) && // Right Half | ||
14045 | x2 - (this.helperProportions.width / 2) < r && // Left Half | ||
14046 | t < y1 + (this.helperProportions.height / 2) && // Bottom Half | ||
14047 | y2 - (this.helperProportions.height / 2) < b ); // Top Half | ||
14048 | |||
14049 | } | ||
14050 | }, | ||
14051 | |||
14052 | _intersectsWithPointer: function(item) { | ||
14053 | |||
14054 | var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), | ||
14055 | isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), | ||
14056 | isOverElement = isOverElementHeight && isOverElementWidth, | ||
14057 | verticalDirection = this._getDragVerticalDirection(), | ||
14058 | horizontalDirection = this._getDragHorizontalDirection(); | ||
14059 | |||
14060 | if (!isOverElement) { | ||
14061 | return false; | ||
14062 | } | ||
14063 | |||
14064 | return this.floating ? | ||
14065 | ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 ) | ||
14066 | : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) ); | ||
14067 | |||
14068 | }, | ||
14069 | |||
14070 | _intersectsWithSides: function(item) { | ||
14071 | |||
14072 | var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), | ||
14073 | isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), | ||
14074 | verticalDirection = this._getDragVerticalDirection(), | ||
14075 | horizontalDirection = this._getDragHorizontalDirection(); | ||
14076 | |||
14077 | if (this.floating && horizontalDirection) { | ||
14078 | return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); | ||
14079 | } else { | ||
14080 | return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); | ||
14081 | } | ||
14082 | |||
14083 | }, | ||
14084 | |||
14085 | _getDragVerticalDirection: function() { | ||
14086 | var delta = this.positionAbs.top - this.lastPositionAbs.top; | ||
14087 | return delta !== 0 && (delta > 0 ? "down" : "up"); | ||
14088 | }, | ||
14089 | |||
14090 | _getDragHorizontalDirection: function() { | ||
14091 | var delta = this.positionAbs.left - this.lastPositionAbs.left; | ||
14092 | return delta !== 0 && (delta > 0 ? "right" : "left"); | ||
14093 | }, | ||
14094 | |||
14095 | refresh: function(event) { | ||
14096 | this._refreshItems(event); | ||
14097 | this._setHandleClassName(); | ||
14098 | this.refreshPositions(); | ||
14099 | return this; | ||
14100 | }, | ||
14101 | |||
14102 | _connectWith: function() { | ||
14103 | var options = this.options; | ||
14104 | return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; | ||
14105 | }, | ||
14106 | |||
14107 | _getItemsAsjQuery: function(connected) { | ||
14108 | |||
14109 | var i, j, cur, inst, | ||
14110 | items = [], | ||
14111 | queries = [], | ||
14112 | connectWith = this._connectWith(); | ||
14113 | |||
14114 | if(connectWith && connected) { | ||
14115 | for (i = connectWith.length - 1; i >= 0; i--){ | ||
14116 | cur = $(connectWith[i]); | ||
14117 | for ( j = cur.length - 1; j >= 0; j--){ | ||
14118 | inst = $.data(cur[j], this.widgetFullName); | ||
14119 | if(inst && inst !== this && !inst.options.disabled) { | ||
14120 | queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); | ||
14121 | } | ||
14122 | } | ||
14123 | } | ||
14124 | } | ||
14125 | |||
14126 | queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); | ||
14127 | |||
14128 | function addItems() { | ||
14129 | items.push( this ); | ||
14130 | } | ||
14131 | for (i = queries.length - 1; i >= 0; i--){ | ||
14132 | queries[i][0].each( addItems ); | ||
14133 | } | ||
14134 | |||
14135 | return $(items); | ||
14136 | |||
14137 | }, | ||
14138 | |||
14139 | _removeCurrentsFromItems: function() { | ||
14140 | |||
14141 | var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); | ||
14142 | |||
14143 | this.items = $.grep(this.items, function (item) { | ||
14144 | for (var j=0; j < list.length; j++) { | ||
14145 | if(list[j] === item.item[0]) { | ||
14146 | return false; | ||
14147 | } | ||
14148 | } | ||
14149 | return true; | ||
14150 | }); | ||
14151 | |||
14152 | }, | ||
14153 | |||
14154 | _refreshItems: function(event) { | ||
14155 | |||
14156 | this.items = []; | ||
14157 | this.containers = [this]; | ||
14158 | |||
14159 | var i, j, cur, inst, targetData, _queries, item, queriesLength, | ||
14160 | items = this.items, | ||
14161 | queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], | ||
14162 | connectWith = this._connectWith(); | ||
14163 | |||
14164 | if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down | ||
14165 | for (i = connectWith.length - 1; i >= 0; i--){ | ||
14166 | cur = $(connectWith[i]); | ||
14167 | for (j = cur.length - 1; j >= 0; j--){ | ||
14168 | inst = $.data(cur[j], this.widgetFullName); | ||
14169 | if(inst && inst !== this && !inst.options.disabled) { | ||
14170 | queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); | ||
14171 | this.containers.push(inst); | ||
14172 | } | ||
14173 | } | ||
14174 | } | ||
14175 | } | ||
14176 | |||
14177 | for (i = queries.length - 1; i >= 0; i--) { | ||
14178 | targetData = queries[i][1]; | ||
14179 | _queries = queries[i][0]; | ||
14180 | |||
14181 | for (j=0, queriesLength = _queries.length; j < queriesLength; j++) { | ||
14182 | item = $(_queries[j]); | ||
14183 | |||
14184 | item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) | ||
14185 | |||
14186 | items.push({ | ||
14187 | item: item, | ||
14188 | instance: targetData, | ||
14189 | width: 0, height: 0, | ||
14190 | left: 0, top: 0 | ||
14191 | }); | ||
14192 | } | ||
14193 | } | ||
14194 | |||
14195 | }, | ||
14196 | |||
14197 | refreshPositions: function(fast) { | ||
14198 | |||
14199 | //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change | ||
14200 | if(this.offsetParent && this.helper) { | ||
14201 | this.offset.parent = this._getParentOffset(); | ||
14202 | } | ||
14203 | |||
14204 | var i, item, t, p; | ||
14205 | |||
14206 | for (i = this.items.length - 1; i >= 0; i--){ | ||
14207 | item = this.items[i]; | ||
14208 | |||
14209 | //We ignore calculating positions of all connected containers when we're not over them | ||
14210 | if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { | ||
14211 | continue; | ||
14212 | } | ||
14213 | |||
14214 | t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; | ||
14215 | |||
14216 | if (!fast) { | ||
14217 | item.width = t.outerWidth(); | ||
14218 | item.height = t.outerHeight(); | ||
14219 | } | ||
14220 | |||
14221 | p = t.offset(); | ||
14222 | item.left = p.left; | ||
14223 | item.top = p.top; | ||
14224 | } | ||
14225 | |||
14226 | if(this.options.custom && this.options.custom.refreshContainers) { | ||
14227 | this.options.custom.refreshContainers.call(this); | ||
14228 | } else { | ||
14229 | for (i = this.containers.length - 1; i >= 0; i--){ | ||
14230 | p = this.containers[i].element.offset(); | ||
14231 | this.containers[i].containerCache.left = p.left; | ||
14232 | this.containers[i].containerCache.top = p.top; | ||
14233 | this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); | ||
14234 | this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); | ||
14235 | } | ||
14236 | } | ||
14237 | |||
14238 | return this; | ||
14239 | }, | ||
14240 | |||
14241 | _createPlaceholder: function(that) { | ||
14242 | that = that || this; | ||
14243 | var className, | ||
14244 | o = that.options; | ||
14245 | |||
14246 | if(!o.placeholder || o.placeholder.constructor === String) { | ||
14247 | className = o.placeholder; | ||
14248 | o.placeholder = { | ||
14249 | element: function() { | ||
14250 | |||
14251 | var nodeName = that.currentItem[0].nodeName.toLowerCase(), | ||
14252 | element = $( "<" + nodeName + ">", that.document[0] ) | ||
14253 | .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") | ||
14254 | .removeClass("ui-sortable-helper"); | ||
14255 | |||
14256 | if ( nodeName === "tr" ) { | ||
14257 | that.currentItem.children().each(function() { | ||
14258 | $( "<td> </td>", that.document[0] ) | ||
14259 | .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) | ||
14260 | .appendTo( element ); | ||
14261 | }); | ||
14262 | } else if ( nodeName === "img" ) { | ||
14263 | element.attr( "src", that.currentItem.attr( "src" ) ); | ||
14264 | } | ||
14265 | |||
14266 | if ( !className ) { | ||
14267 | element.css( "visibility", "hidden" ); | ||
14268 | } | ||
14269 | |||
14270 | return element; | ||
14271 | }, | ||
14272 | update: function(container, p) { | ||
14273 | |||
14274 | // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that | ||
14275 | // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified | ||
14276 | if(className && !o.forcePlaceholderSize) { | ||
14277 | return; | ||
14278 | } | ||
14279 | |||
14280 | //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item | ||
14281 | if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); } | ||
14282 | if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); } | ||
14283 | } | ||
14284 | }; | ||
14285 | } | ||
14286 | |||
14287 | //Create the placeholder | ||
14288 | that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); | ||
14289 | |||
14290 | //Append it after the actual current item | ||
14291 | that.currentItem.after(that.placeholder); | ||
14292 | |||
14293 | //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) | ||
14294 | o.placeholder.update(that, that.placeholder); | ||
14295 | |||
14296 | }, | ||
14297 | |||
14298 | _contactContainers: function(event) { | ||
14299 | var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis, | ||
14300 | innermostContainer = null, | ||
14301 | innermostIndex = null; | ||
14302 | |||
14303 | // get innermost container that intersects with item | ||
14304 | for (i = this.containers.length - 1; i >= 0; i--) { | ||
14305 | |||
14306 | // never consider a container that's located within the item itself | ||
14307 | if($.contains(this.currentItem[0], this.containers[i].element[0])) { | ||
14308 | continue; | ||
14309 | } | ||
14310 | |||
14311 | if(this._intersectsWith(this.containers[i].containerCache)) { | ||
14312 | |||
14313 | // if we've already found a container and it's more "inner" than this, then continue | ||
14314 | if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { | ||
14315 | continue; | ||
14316 | } | ||
14317 | |||
14318 | innermostContainer = this.containers[i]; | ||
14319 | innermostIndex = i; | ||
14320 | |||
14321 | } else { | ||
14322 | // container doesn't intersect. trigger "out" event if necessary | ||
14323 | if(this.containers[i].containerCache.over) { | ||
14324 | this.containers[i]._trigger("out", event, this._uiHash(this)); | ||
14325 | this.containers[i].containerCache.over = 0; | ||
14326 | } | ||
14327 | } | ||
14328 | |||
14329 | } | ||
14330 | |||
14331 | // if no intersecting containers found, return | ||
14332 | if(!innermostContainer) { | ||
14333 | return; | ||
14334 | } | ||
14335 | |||
14336 | // move the item into the container if it's not there already | ||
14337 | if(this.containers.length === 1) { | ||
14338 | if (!this.containers[innermostIndex].containerCache.over) { | ||
14339 | this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); | ||
14340 | this.containers[innermostIndex].containerCache.over = 1; | ||
14341 | } | ||
14342 | } else { | ||
14343 | |||
14344 | //When entering a new container, we will find the item with the least distance and append our item near it | ||
14345 | dist = 10000; | ||
14346 | itemWithLeastDistance = null; | ||
14347 | floating = innermostContainer.floating || this._isFloating(this.currentItem); | ||
14348 | posProperty = floating ? "left" : "top"; | ||
14349 | sizeProperty = floating ? "width" : "height"; | ||
14350 | axis = floating ? "clientX" : "clientY"; | ||
14351 | |||
14352 | for (j = this.items.length - 1; j >= 0; j--) { | ||
14353 | if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { | ||
14354 | continue; | ||
14355 | } | ||
14356 | if(this.items[j].item[0] === this.currentItem[0]) { | ||
14357 | continue; | ||
14358 | } | ||
14359 | |||
14360 | cur = this.items[j].item.offset()[posProperty]; | ||
14361 | nearBottom = false; | ||
14362 | if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { | ||
14363 | nearBottom = true; | ||
14364 | } | ||
14365 | |||
14366 | if ( Math.abs( event[ axis ] - cur ) < dist ) { | ||
14367 | dist = Math.abs( event[ axis ] - cur ); | ||
14368 | itemWithLeastDistance = this.items[ j ]; | ||
14369 | this.direction = nearBottom ? "up": "down"; | ||
14370 | } | ||
14371 | } | ||
14372 | |||
14373 | //Check if dropOnEmpty is enabled | ||
14374 | if(!itemWithLeastDistance && !this.options.dropOnEmpty) { | ||
14375 | return; | ||
14376 | } | ||
14377 | |||
14378 | if(this.currentContainer === this.containers[innermostIndex]) { | ||
14379 | if ( !this.currentContainer.containerCache.over ) { | ||
14380 | this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); | ||
14381 | this.currentContainer.containerCache.over = 1; | ||
14382 | } | ||
14383 | return; | ||
14384 | } | ||
14385 | |||
14386 | itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); | ||
14387 | this._trigger("change", event, this._uiHash()); | ||
14388 | this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); | ||
14389 | this.currentContainer = this.containers[innermostIndex]; | ||
14390 | |||
14391 | //Update the placeholder | ||
14392 | this.options.placeholder.update(this.currentContainer, this.placeholder); | ||
14393 | |||
14394 | this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); | ||
14395 | this.containers[innermostIndex].containerCache.over = 1; | ||
14396 | } | ||
14397 | |||
14398 | |||
14399 | }, | ||
14400 | |||
14401 | _createHelper: function(event) { | ||
14402 | |||
14403 | var o = this.options, | ||
14404 | helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); | ||
14405 | |||
14406 | //Add the helper to the DOM if that didn't happen already | ||
14407 | if(!helper.parents("body").length) { | ||
14408 | $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); | ||
14409 | } | ||
14410 | |||
14411 | if(helper[0] === this.currentItem[0]) { | ||
14412 | this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; | ||
14413 | } | ||
14414 | |||
14415 | if(!helper[0].style.width || o.forceHelperSize) { | ||
14416 | helper.width(this.currentItem.width()); | ||
14417 | } | ||
14418 | if(!helper[0].style.height || o.forceHelperSize) { | ||
14419 | helper.height(this.currentItem.height()); | ||
14420 | } | ||
14421 | |||
14422 | return helper; | ||
14423 | |||
14424 | }, | ||
14425 | |||
14426 | _adjustOffsetFromHelper: function(obj) { | ||
14427 | if (typeof obj === "string") { | ||
14428 | obj = obj.split(" "); | ||
14429 | } | ||
14430 | if ($.isArray(obj)) { | ||
14431 | obj = {left: +obj[0], top: +obj[1] || 0}; | ||
14432 | } | ||
14433 | if ("left" in obj) { | ||
14434 | this.offset.click.left = obj.left + this.margins.left; | ||
14435 | } | ||
14436 | if ("right" in obj) { | ||
14437 | this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; | ||
14438 | } | ||
14439 | if ("top" in obj) { | ||
14440 | this.offset.click.top = obj.top + this.margins.top; | ||
14441 | } | ||
14442 | if ("bottom" in obj) { | ||
14443 | this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; | ||
14444 | } | ||
14445 | }, | ||
14446 | |||
14447 | _getParentOffset: function() { | ||
14448 | |||
14449 | |||
14450 | //Get the offsetParent and cache its position | ||
14451 | this.offsetParent = this.helper.offsetParent(); | ||
14452 | var po = this.offsetParent.offset(); | ||
14453 | |||
14454 | // This is a special case where we need to modify a offset calculated on start, since the following happened: | ||
14455 | // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent | ||
14456 | // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that | ||
14457 | // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag | ||
14458 | if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { | ||
14459 | po.left += this.scrollParent.scrollLeft(); | ||
14460 | po.top += this.scrollParent.scrollTop(); | ||
14461 | } | ||
14462 | |||
14463 | // This needs to be actually done for all browsers, since pageX/pageY includes this information | ||
14464 | // with an ugly IE fix | ||
14465 | if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { | ||
14466 | po = { top: 0, left: 0 }; | ||
14467 | } | ||
14468 | |||
14469 | return { | ||
14470 | top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), | ||
14471 | left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) | ||
14472 | }; | ||
14473 | |||
14474 | }, | ||
14475 | |||
14476 | _getRelativeOffset: function() { | ||
14477 | |||
14478 | if(this.cssPosition === "relative") { | ||
14479 | var p = this.currentItem.position(); | ||
14480 | return { | ||
14481 | top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), | ||
14482 | left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() | ||
14483 | }; | ||
14484 | } else { | ||
14485 | return { top: 0, left: 0 }; | ||
14486 | } | ||
14487 | |||
14488 | }, | ||
14489 | |||
14490 | _cacheMargins: function() { | ||
14491 | this.margins = { | ||
14492 | left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), | ||
14493 | top: (parseInt(this.currentItem.css("marginTop"),10) || 0) | ||
14494 | }; | ||
14495 | }, | ||
14496 | |||
14497 | _cacheHelperProportions: function() { | ||
14498 | this.helperProportions = { | ||
14499 | width: this.helper.outerWidth(), | ||
14500 | height: this.helper.outerHeight() | ||
14501 | }; | ||
14502 | }, | ||
14503 | |||
14504 | _setContainment: function() { | ||
14505 | |||
14506 | var ce, co, over, | ||
14507 | o = this.options; | ||
14508 | if(o.containment === "parent") { | ||
14509 | o.containment = this.helper[0].parentNode; | ||
14510 | } | ||
14511 | if(o.containment === "document" || o.containment === "window") { | ||
14512 | this.containment = [ | ||
14513 | 0 - this.offset.relative.left - this.offset.parent.left, | ||
14514 | 0 - this.offset.relative.top - this.offset.parent.top, | ||
14515 | $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left, | ||
14516 | ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top | ||
14517 | ]; | ||
14518 | } | ||
14519 | |||
14520 | if(!(/^(document|window|parent)$/).test(o.containment)) { | ||
14521 | ce = $(o.containment)[0]; | ||
14522 | co = $(o.containment).offset(); | ||
14523 | over = ($(ce).css("overflow") !== "hidden"); | ||
14524 | |||
14525 | this.containment = [ | ||
14526 | co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, | ||
14527 | co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, | ||
14528 | co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, | ||
14529 | co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top | ||
14530 | ]; | ||
14531 | } | ||
14532 | |||
14533 | }, | ||
14534 | |||
14535 | _convertPositionTo: function(d, pos) { | ||
14536 | |||
14537 | if(!pos) { | ||
14538 | pos = this.position; | ||
14539 | } | ||
14540 | var mod = d === "absolute" ? 1 : -1, | ||
14541 | scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, | ||
14542 | scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); | ||
14543 | |||
14544 | return { | ||
14545 | top: ( | ||
14546 | pos.top + // The absolute mouse position | ||
14547 | this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent | ||
14548 | this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) | ||
14549 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) | ||
14550 | ), | ||
14551 | left: ( | ||
14552 | pos.left + // The absolute mouse position | ||
14553 | this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent | ||
14554 | this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) | ||
14555 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) | ||
14556 | ) | ||
14557 | }; | ||
14558 | |||
14559 | }, | ||
14560 | |||
14561 | _generatePosition: function(event) { | ||
14562 | |||
14563 | var top, left, | ||
14564 | o = this.options, | ||
14565 | pageX = event.pageX, | ||
14566 | pageY = event.pageY, | ||
14567 | scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); | ||
14568 | |||
14569 | // This is another very weird special case that only happens for relative elements: | ||
14570 | // 1. If the css position is relative | ||
14571 | // 2. and the scroll parent is the document or similar to the offset parent | ||
14572 | // we have to refresh the relative offset during the scroll so there are no jumps | ||
14573 | if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) { | ||
14574 | this.offset.relative = this._getRelativeOffset(); | ||
14575 | } | ||
14576 | |||
14577 | /* | ||
14578 | * - Position constraining - | ||
14579 | * Constrain the position to a mix of grid, containment. | ||
14580 | */ | ||
14581 | |||
14582 | if(this.originalPosition) { //If we are not dragging yet, we won't check for options | ||
14583 | |||
14584 | if(this.containment) { | ||
14585 | if(event.pageX - this.offset.click.left < this.containment[0]) { | ||
14586 | pageX = this.containment[0] + this.offset.click.left; | ||
14587 | } | ||
14588 | if(event.pageY - this.offset.click.top < this.containment[1]) { | ||
14589 | pageY = this.containment[1] + this.offset.click.top; | ||
14590 | } | ||
14591 | if(event.pageX - this.offset.click.left > this.containment[2]) { | ||
14592 | pageX = this.containment[2] + this.offset.click.left; | ||
14593 | } | ||
14594 | if(event.pageY - this.offset.click.top > this.containment[3]) { | ||
14595 | pageY = this.containment[3] + this.offset.click.top; | ||
14596 | } | ||
14597 | } | ||
14598 | |||
14599 | if(o.grid) { | ||
14600 | top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; | ||
14601 | pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; | ||
14602 | |||
14603 | left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; | ||
14604 | pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; | ||
14605 | } | ||
14606 | |||
14607 | } | ||
14608 | |||
14609 | return { | ||
14610 | top: ( | ||
14611 | pageY - // The absolute mouse position | ||
14612 | this.offset.click.top - // Click offset (relative to the element) | ||
14613 | this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent | ||
14614 | this.offset.parent.top + // The offsetParent's offset without borders (offset + border) | ||
14615 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) | ||
14616 | ), | ||
14617 | left: ( | ||
14618 | pageX - // The absolute mouse position | ||
14619 | this.offset.click.left - // Click offset (relative to the element) | ||
14620 | this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent | ||
14621 | this.offset.parent.left + // The offsetParent's offset without borders (offset + border) | ||
14622 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) | ||
14623 | ) | ||
14624 | }; | ||
14625 | |||
14626 | }, | ||
14627 | |||
14628 | _rearrange: function(event, i, a, hardRefresh) { | ||
14629 | |||
14630 | a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); | ||
14631 | |||
14632 | //Various things done here to improve the performance: | ||
14633 | // 1. we create a setTimeout, that calls refreshPositions | ||
14634 | // 2. on the instance, we have a counter variable, that get's higher after every append | ||
14635 | // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same | ||
14636 | // 4. this lets only the last addition to the timeout stack through | ||
14637 | this.counter = this.counter ? ++this.counter : 1; | ||
14638 | var counter = this.counter; | ||
14639 | |||
14640 | this._delay(function() { | ||
14641 | if(counter === this.counter) { | ||
14642 | this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove | ||
14643 | } | ||
14644 | }); | ||
14645 | |||
14646 | }, | ||
14647 | |||
14648 | _clear: function(event, noPropagation) { | ||
14649 | |||
14650 | this.reverting = false; | ||
14651 | // We delay all events that have to be triggered to after the point where the placeholder has been removed and | ||
14652 | // everything else normalized again | ||
14653 | var i, | ||
14654 | delayedTriggers = []; | ||
14655 | |||
14656 | // We first have to update the dom position of the actual currentItem | ||
14657 | // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) | ||
14658 | if(!this._noFinalSort && this.currentItem.parent().length) { | ||
14659 | this.placeholder.before(this.currentItem); | ||
14660 | } | ||
14661 | this._noFinalSort = null; | ||
14662 | |||
14663 | if(this.helper[0] === this.currentItem[0]) { | ||
14664 | for(i in this._storedCSS) { | ||
14665 | if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { | ||
14666 | this._storedCSS[i] = ""; | ||
14667 | } | ||
14668 | } | ||
14669 | this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); | ||
14670 | } else { | ||
14671 | this.currentItem.show(); | ||
14672 | } | ||
14673 | |||
14674 | if(this.fromOutside && !noPropagation) { | ||
14675 | delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); | ||
14676 | } | ||
14677 | if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { | ||
14678 | delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed | ||
14679 | } | ||
14680 | |||
14681 | // Check if the items Container has Changed and trigger appropriate | ||
14682 | // events. | ||
14683 | if (this !== this.currentContainer) { | ||
14684 | if(!noPropagation) { | ||
14685 | delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); | ||
14686 | delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); | ||
14687 | delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); | ||
14688 | } | ||
14689 | } | ||
14690 | |||
14691 | |||
14692 | //Post events to containers | ||
14693 | function delayEvent( type, instance, container ) { | ||
14694 | return function( event ) { | ||
14695 | container._trigger( type, event, instance._uiHash( instance ) ); | ||
14696 | }; | ||
14697 | } | ||
14698 | for (i = this.containers.length - 1; i >= 0; i--){ | ||
14699 | if (!noPropagation) { | ||
14700 | delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); | ||
14701 | } | ||
14702 | if(this.containers[i].containerCache.over) { | ||
14703 | delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); | ||
14704 | this.containers[i].containerCache.over = 0; | ||
14705 | } | ||
14706 | } | ||
14707 | |||
14708 | //Do what was originally in plugins | ||
14709 | if ( this.storedCursor ) { | ||
14710 | this.document.find( "body" ).css( "cursor", this.storedCursor ); | ||
14711 | this.storedStylesheet.remove(); | ||
14712 | } | ||
14713 | if(this._storedOpacity) { | ||
14714 | this.helper.css("opacity", this._storedOpacity); | ||
14715 | } | ||
14716 | if(this._storedZIndex) { | ||
14717 | this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); | ||
14718 | } | ||
14719 | |||
14720 | this.dragging = false; | ||
14721 | |||
14722 | if(!noPropagation) { | ||
14723 | this._trigger("beforeStop", event, this._uiHash()); | ||
14724 | } | ||
14725 | |||
14726 | //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! | ||
14727 | this.placeholder[0].parentNode.removeChild(this.placeholder[0]); | ||
14728 | |||
14729 | if ( !this.cancelHelperRemoval ) { | ||
14730 | if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { | ||
14731 | this.helper.remove(); | ||
14732 | } | ||
14733 | this.helper = null; | ||
14734 | } | ||
14735 | |||
14736 | if(!noPropagation) { | ||
14737 | for (i=0; i < delayedTriggers.length; i++) { | ||
14738 | delayedTriggers[i].call(this, event); | ||
14739 | } //Trigger all delayed events | ||
14740 | this._trigger("stop", event, this._uiHash()); | ||
14741 | } | ||
14742 | |||
14743 | this.fromOutside = false; | ||
14744 | return !this.cancelHelperRemoval; | ||
14745 | |||
14746 | }, | ||
14747 | |||
14748 | _trigger: function() { | ||
14749 | if ($.Widget.prototype._trigger.apply(this, arguments) === false) { | ||
14750 | this.cancel(); | ||
14751 | } | ||
14752 | }, | ||
14753 | |||
14754 | _uiHash: function(_inst) { | ||
14755 | var inst = _inst || this; | ||
14756 | return { | ||
14757 | helper: inst.helper, | ||
14758 | placeholder: inst.placeholder || $([]), | ||
14759 | position: inst.position, | ||
14760 | originalPosition: inst.originalPosition, | ||
14761 | offset: inst.positionAbs, | ||
14762 | item: inst.currentItem, | ||
14763 | sender: _inst ? _inst.element : null | ||
14764 | }; | ||
14765 | } | ||
14766 | |||
14767 | }); | ||
14768 | |||
14769 | |||
14770 | /*! | ||
14771 | * jQuery UI Spinner 1.11.2 | ||
14772 | * http://jqueryui.com | ||
14773 | * | ||
14774 | * Copyright 2014 jQuery Foundation and other contributors | ||
14775 | * Released under the MIT license. | ||
14776 | * http://jquery.org/license | ||
14777 | * | ||
14778 | * http://api.jqueryui.com/spinner/ | ||
14779 | */ | ||
14780 | |||
14781 | |||
14782 | function spinner_modifier( fn ) { | ||
14783 | return function() { | ||
14784 | var previous = this.element.val(); | ||
14785 | fn.apply( this, arguments ); | ||
14786 | this._refresh(); | ||
14787 | if ( previous !== this.element.val() ) { | ||
14788 | this._trigger( "change" ); | ||
14789 | } | ||
14790 | }; | ||
14791 | } | ||
14792 | |||
14793 | var spinner = $.widget( "ui.spinner", { | ||
14794 | version: "1.11.2", | ||
14795 | defaultElement: "<input>", | ||
14796 | widgetEventPrefix: "spin", | ||
14797 | options: { | ||
14798 | culture: null, | ||
14799 | icons: { | ||
14800 | down: "ui-icon-triangle-1-s", | ||
14801 | up: "ui-icon-triangle-1-n" | ||
14802 | }, | ||
14803 | incremental: true, | ||
14804 | max: null, | ||
14805 | min: null, | ||
14806 | numberFormat: null, | ||
14807 | page: 10, | ||
14808 | step: 1, | ||
14809 | |||
14810 | change: null, | ||
14811 | spin: null, | ||
14812 | start: null, | ||
14813 | stop: null | ||
14814 | }, | ||
14815 | |||
14816 | _create: function() { | ||
14817 | // handle string values that need to be parsed | ||
14818 | this._setOption( "max", this.options.max ); | ||
14819 | this._setOption( "min", this.options.min ); | ||
14820 | this._setOption( "step", this.options.step ); | ||
14821 | |||
14822 | // Only format if there is a value, prevents the field from being marked | ||
14823 | // as invalid in Firefox, see #9573. | ||
14824 | if ( this.value() !== "" ) { | ||
14825 | // Format the value, but don't constrain. | ||
14826 | this._value( this.element.val(), true ); | ||
14827 | } | ||
14828 | |||
14829 | this._draw(); | ||
14830 | this._on( this._events ); | ||
14831 | this._refresh(); | ||
14832 | |||
14833 | // turning off autocomplete prevents the browser from remembering the | ||
14834 | // value when navigating through history, so we re-enable autocomplete | ||
14835 | // if the page is unloaded before the widget is destroyed. #7790 | ||
14836 | this._on( this.window, { | ||
14837 | beforeunload: function() { | ||
14838 | this.element.removeAttr( "autocomplete" ); | ||
14839 | } | ||
14840 | }); | ||
14841 | }, | ||
14842 | |||
14843 | _getCreateOptions: function() { | ||
14844 | var options = {}, | ||
14845 | element = this.element; | ||
14846 | |||
14847 | $.each( [ "min", "max", "step" ], function( i, option ) { | ||
14848 | var value = element.attr( option ); | ||
14849 | if ( value !== undefined && value.length ) { | ||
14850 | options[ option ] = value; | ||
14851 | } | ||
14852 | }); | ||
14853 | |||
14854 | return options; | ||
14855 | }, | ||
14856 | |||
14857 | _events: { | ||
14858 | keydown: function( event ) { | ||
14859 | if ( this._start( event ) && this._keydown( event ) ) { | ||
14860 | event.preventDefault(); | ||
14861 | } | ||
14862 | }, | ||
14863 | keyup: "_stop", | ||
14864 | focus: function() { | ||
14865 | this.previous = this.element.val(); | ||
14866 | }, | ||
14867 | blur: function( event ) { | ||
14868 | if ( this.cancelBlur ) { | ||
14869 | delete this.cancelBlur; | ||
14870 | return; | ||
14871 | } | ||
14872 | |||
14873 | this._stop(); | ||
14874 | this._refresh(); | ||
14875 | if ( this.previous !== this.element.val() ) { | ||
14876 | this._trigger( "change", event ); | ||
14877 | } | ||
14878 | }, | ||
14879 | mousewheel: function( event, delta ) { | ||
14880 | if ( !delta ) { | ||
14881 | return; | ||
14882 | } | ||
14883 | if ( !this.spinning && !this._start( event ) ) { | ||
14884 | return false; | ||
14885 | } | ||
14886 | |||
14887 | this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); | ||
14888 | clearTimeout( this.mousewheelTimer ); | ||
14889 | this.mousewheelTimer = this._delay(function() { | ||
14890 | if ( this.spinning ) { | ||
14891 | this._stop( event ); | ||
14892 | } | ||
14893 | }, 100 ); | ||
14894 | event.preventDefault(); | ||
14895 | }, | ||
14896 | "mousedown .ui-spinner-button": function( event ) { | ||
14897 | var previous; | ||
14898 | |||
14899 | // We never want the buttons to have focus; whenever the user is | ||
14900 | // interacting with the spinner, the focus should be on the input. | ||
14901 | // If the input is focused then this.previous is properly set from | ||
14902 | // when the input first received focus. If the input is not focused | ||
14903 | // then we need to set this.previous based on the value before spinning. | ||
14904 | previous = this.element[0] === this.document[0].activeElement ? | ||
14905 | this.previous : this.element.val(); | ||
14906 | function checkFocus() { | ||
14907 | var isActive = this.element[0] === this.document[0].activeElement; | ||
14908 | if ( !isActive ) { | ||
14909 | this.element.focus(); | ||
14910 | this.previous = previous; | ||
14911 | // support: IE | ||
14912 | // IE sets focus asynchronously, so we need to check if focus | ||
14913 | // moved off of the input because the user clicked on the button. | ||
14914 | this._delay(function() { | ||
14915 | this.previous = previous; | ||
14916 | }); | ||
14917 | } | ||
14918 | } | ||
14919 | |||
14920 | // ensure focus is on (or stays on) the text field | ||
14921 | event.preventDefault(); | ||
14922 | checkFocus.call( this ); | ||
14923 | |||
14924 | // support: IE | ||
14925 | // IE doesn't prevent moving focus even with event.preventDefault() | ||
14926 | // so we set a flag to know when we should ignore the blur event | ||
14927 | // and check (again) if focus moved off of the input. | ||
14928 | this.cancelBlur = true; | ||
14929 | this._delay(function() { | ||
14930 | delete this.cancelBlur; | ||
14931 | checkFocus.call( this ); | ||
14932 | }); | ||
14933 | |||
14934 | if ( this._start( event ) === false ) { | ||
14935 | return; | ||
14936 | } | ||
14937 | |||
14938 | this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); | ||
14939 | }, | ||
14940 | "mouseup .ui-spinner-button": "_stop", | ||
14941 | "mouseenter .ui-spinner-button": function( event ) { | ||
14942 | // button will add ui-state-active if mouse was down while mouseleave and kept down | ||
14943 | if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { | ||
14944 | return; | ||
14945 | } | ||
14946 | |||
14947 | if ( this._start( event ) === false ) { | ||
14948 | return false; | ||
14949 | } | ||
14950 | this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); | ||
14951 | }, | ||
14952 | // TODO: do we really want to consider this a stop? | ||
14953 | // shouldn't we just stop the repeater and wait until mouseup before | ||
14954 | // we trigger the stop event? | ||
14955 | "mouseleave .ui-spinner-button": "_stop" | ||
14956 | }, | ||
14957 | |||
14958 | _draw: function() { | ||
14959 | var uiSpinner = this.uiSpinner = this.element | ||
14960 | .addClass( "ui-spinner-input" ) | ||
14961 | .attr( "autocomplete", "off" ) | ||
14962 | .wrap( this._uiSpinnerHtml() ) | ||
14963 | .parent() | ||
14964 | // add buttons | ||
14965 | .append( this._buttonHtml() ); | ||
14966 | |||
14967 | this.element.attr( "role", "spinbutton" ); | ||
14968 | |||
14969 | // button bindings | ||
14970 | this.buttons = uiSpinner.find( ".ui-spinner-button" ) | ||
14971 | .attr( "tabIndex", -1 ) | ||
14972 | .button() | ||
14973 | .removeClass( "ui-corner-all" ); | ||
14974 | |||
14975 | // IE 6 doesn't understand height: 50% for the buttons | ||
14976 | // unless the wrapper has an explicit height | ||
14977 | if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && | ||
14978 | uiSpinner.height() > 0 ) { | ||
14979 | uiSpinner.height( uiSpinner.height() ); | ||
14980 | } | ||
14981 | |||
14982 | // disable spinner if element was already disabled | ||
14983 | if ( this.options.disabled ) { | ||
14984 | this.disable(); | ||
14985 | } | ||
14986 | }, | ||
14987 | |||
14988 | _keydown: function( event ) { | ||
14989 | var options = this.options, | ||
14990 | keyCode = $.ui.keyCode; | ||
14991 | |||
14992 | switch ( event.keyCode ) { | ||
14993 | case keyCode.UP: | ||
14994 | this._repeat( null, 1, event ); | ||
14995 | return true; | ||
14996 | case keyCode.DOWN: | ||
14997 | this._repeat( null, -1, event ); | ||
14998 | return true; | ||
14999 | case keyCode.PAGE_UP: | ||
15000 | this._repeat( null, options.page, event ); | ||
15001 | return true; | ||
15002 | case keyCode.PAGE_DOWN: | ||
15003 | this._repeat( null, -options.page, event ); | ||
15004 | return true; | ||
15005 | } | ||
15006 | |||
15007 | return false; | ||
15008 | }, | ||
15009 | |||
15010 | _uiSpinnerHtml: function() { | ||
15011 | return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"; | ||
15012 | }, | ||
15013 | |||
15014 | _buttonHtml: function() { | ||
15015 | return "" + | ||
15016 | "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" + | ||
15017 | "<span class='ui-icon " + this.options.icons.up + "'>▲</span>" + | ||
15018 | "</a>" + | ||
15019 | "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" + | ||
15020 | "<span class='ui-icon " + this.options.icons.down + "'>▼</span>" + | ||
15021 | "</a>"; | ||
15022 | }, | ||
15023 | |||
15024 | _start: function( event ) { | ||
15025 | if ( !this.spinning && this._trigger( "start", event ) === false ) { | ||
15026 | return false; | ||
15027 | } | ||
15028 | |||
15029 | if ( !this.counter ) { | ||
15030 | this.counter = 1; | ||
15031 | } | ||
15032 | this.spinning = true; | ||
15033 | return true; | ||
15034 | }, | ||
15035 | |||
15036 | _repeat: function( i, steps, event ) { | ||
15037 | i = i || 500; | ||
15038 | |||
15039 | clearTimeout( this.timer ); | ||
15040 | this.timer = this._delay(function() { | ||
15041 | this._repeat( 40, steps, event ); | ||
15042 | }, i ); | ||
15043 | |||
15044 | this._spin( steps * this.options.step, event ); | ||
15045 | }, | ||
15046 | |||
15047 | _spin: function( step, event ) { | ||
15048 | var value = this.value() || 0; | ||
15049 | |||
15050 | if ( !this.counter ) { | ||
15051 | this.counter = 1; | ||
15052 | } | ||
15053 | |||
15054 | value = this._adjustValue( value + step * this._increment( this.counter ) ); | ||
15055 | |||
15056 | if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { | ||
15057 | this._value( value ); | ||
15058 | this.counter++; | ||
15059 | } | ||
15060 | }, | ||
15061 | |||
15062 | _increment: function( i ) { | ||
15063 | var incremental = this.options.incremental; | ||
15064 | |||
15065 | if ( incremental ) { | ||
15066 | return $.isFunction( incremental ) ? | ||
15067 | incremental( i ) : | ||
15068 | Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); | ||
15069 | } | ||
15070 | |||
15071 | return 1; | ||
15072 | }, | ||
15073 | |||
15074 | _precision: function() { | ||
15075 | var precision = this._precisionOf( this.options.step ); | ||
15076 | if ( this.options.min !== null ) { | ||
15077 | precision = Math.max( precision, this._precisionOf( this.options.min ) ); | ||
15078 | } | ||
15079 | return precision; | ||
15080 | }, | ||
15081 | |||
15082 | _precisionOf: function( num ) { | ||
15083 | var str = num.toString(), | ||
15084 | decimal = str.indexOf( "." ); | ||
15085 | return decimal === -1 ? 0 : str.length - decimal - 1; | ||
15086 | }, | ||
15087 | |||
15088 | _adjustValue: function( value ) { | ||
15089 | var base, aboveMin, | ||
15090 | options = this.options; | ||
15091 | |||
15092 | // make sure we're at a valid step | ||
15093 | // - find out where we are relative to the base (min or 0) | ||
15094 | base = options.min !== null ? options.min : 0; | ||
15095 | aboveMin = value - base; | ||
15096 | // - round to the nearest step | ||
15097 | aboveMin = Math.round(aboveMin / options.step) * options.step; | ||
15098 | // - rounding is based on 0, so adjust back to our base | ||
15099 | value = base + aboveMin; | ||
15100 | |||
15101 | // fix precision from bad JS floating point math | ||
15102 | value = parseFloat( value.toFixed( this._precision() ) ); | ||
15103 | |||
15104 | // clamp the value | ||
15105 | if ( options.max !== null && value > options.max) { | ||
15106 | return options.max; | ||
15107 | } | ||
15108 | if ( options.min !== null && value < options.min ) { | ||
15109 | return options.min; | ||
15110 | } | ||
15111 | |||
15112 | return value; | ||
15113 | }, | ||
15114 | |||
15115 | _stop: function( event ) { | ||
15116 | if ( !this.spinning ) { | ||
15117 | return; | ||
15118 | } | ||
15119 | |||
15120 | clearTimeout( this.timer ); | ||
15121 | clearTimeout( this.mousewheelTimer ); | ||
15122 | this.counter = 0; | ||
15123 | this.spinning = false; | ||
15124 | this._trigger( "stop", event ); | ||
15125 | }, | ||
15126 | |||
15127 | _setOption: function( key, value ) { | ||
15128 | if ( key === "culture" || key === "numberFormat" ) { | ||
15129 | var prevValue = this._parse( this.element.val() ); | ||
15130 | this.options[ key ] = value; | ||
15131 | this.element.val( this._format( prevValue ) ); | ||
15132 | return; | ||
15133 | } | ||
15134 | |||
15135 | if ( key === "max" || key === "min" || key === "step" ) { | ||
15136 | if ( typeof value === "string" ) { | ||
15137 | value = this._parse( value ); | ||
15138 | } | ||
15139 | } | ||
15140 | if ( key === "icons" ) { | ||
15141 | this.buttons.first().find( ".ui-icon" ) | ||
15142 | .removeClass( this.options.icons.up ) | ||
15143 | .addClass( value.up ); | ||
15144 | this.buttons.last().find( ".ui-icon" ) | ||
15145 | .removeClass( this.options.icons.down ) | ||
15146 | .addClass( value.down ); | ||
15147 | } | ||
15148 | |||
15149 | this._super( key, value ); | ||
15150 | |||
15151 | if ( key === "disabled" ) { | ||
15152 | this.widget().toggleClass( "ui-state-disabled", !!value ); | ||
15153 | this.element.prop( "disabled", !!value ); | ||
15154 | this.buttons.button( value ? "disable" : "enable" ); | ||
15155 | } | ||
15156 | }, | ||
15157 | |||
15158 | _setOptions: spinner_modifier(function( options ) { | ||
15159 | this._super( options ); | ||
15160 | }), | ||
15161 | |||
15162 | _parse: function( val ) { | ||
15163 | if ( typeof val === "string" && val !== "" ) { | ||
15164 | val = window.Globalize && this.options.numberFormat ? | ||
15165 | Globalize.parseFloat( val, 10, this.options.culture ) : +val; | ||
15166 | } | ||
15167 | return val === "" || isNaN( val ) ? null : val; | ||
15168 | }, | ||
15169 | |||
15170 | _format: function( value ) { | ||
15171 | if ( value === "" ) { | ||
15172 | return ""; | ||
15173 | } | ||
15174 | return window.Globalize && this.options.numberFormat ? | ||
15175 | Globalize.format( value, this.options.numberFormat, this.options.culture ) : | ||
15176 | value; | ||
15177 | }, | ||
15178 | |||
15179 | _refresh: function() { | ||
15180 | this.element.attr({ | ||
15181 | "aria-valuemin": this.options.min, | ||
15182 | "aria-valuemax": this.options.max, | ||
15183 | // TODO: what should we do with values that can't be parsed? | ||
15184 | "aria-valuenow": this._parse( this.element.val() ) | ||
15185 | }); | ||
15186 | }, | ||
15187 | |||
15188 | isValid: function() { | ||
15189 | var value = this.value(); | ||
15190 | |||
15191 | // null is invalid | ||
15192 | if ( value === null ) { | ||
15193 | return false; | ||
15194 | } | ||
15195 | |||
15196 | // if value gets adjusted, it's invalid | ||
15197 | return value === this._adjustValue( value ); | ||
15198 | }, | ||
15199 | |||
15200 | // update the value without triggering change | ||
15201 | _value: function( value, allowAny ) { | ||
15202 | var parsed; | ||
15203 | if ( value !== "" ) { | ||
15204 | parsed = this._parse( value ); | ||
15205 | if ( parsed !== null ) { | ||
15206 | if ( !allowAny ) { | ||
15207 | parsed = this._adjustValue( parsed ); | ||
15208 | } | ||
15209 | value = this._format( parsed ); | ||
15210 | } | ||
15211 | } | ||
15212 | this.element.val( value ); | ||
15213 | this._refresh(); | ||
15214 | }, | ||
15215 | |||
15216 | _destroy: function() { | ||
15217 | this.element | ||
15218 | .removeClass( "ui-spinner-input" ) | ||
15219 | .prop( "disabled", false ) | ||
15220 | .removeAttr( "autocomplete" ) | ||
15221 | .removeAttr( "role" ) | ||
15222 | .removeAttr( "aria-valuemin" ) | ||
15223 | .removeAttr( "aria-valuemax" ) | ||
15224 | .removeAttr( "aria-valuenow" ); | ||
15225 | this.uiSpinner.replaceWith( this.element ); | ||
15226 | }, | ||
15227 | |||
15228 | stepUp: spinner_modifier(function( steps ) { | ||
15229 | this._stepUp( steps ); | ||
15230 | }), | ||
15231 | _stepUp: function( steps ) { | ||
15232 | if ( this._start() ) { | ||
15233 | this._spin( (steps || 1) * this.options.step ); | ||
15234 | this._stop(); | ||
15235 | } | ||
15236 | }, | ||
15237 | |||
15238 | stepDown: spinner_modifier(function( steps ) { | ||
15239 | this._stepDown( steps ); | ||
15240 | }), | ||
15241 | _stepDown: function( steps ) { | ||
15242 | if ( this._start() ) { | ||
15243 | this._spin( (steps || 1) * -this.options.step ); | ||
15244 | this._stop(); | ||
15245 | } | ||
15246 | }, | ||
15247 | |||
15248 | pageUp: spinner_modifier(function( pages ) { | ||
15249 | this._stepUp( (pages || 1) * this.options.page ); | ||
15250 | }), | ||
15251 | |||
15252 | pageDown: spinner_modifier(function( pages ) { | ||
15253 | this._stepDown( (pages || 1) * this.options.page ); | ||
15254 | }), | ||
15255 | |||
15256 | value: function( newVal ) { | ||
15257 | if ( !arguments.length ) { | ||
15258 | return this._parse( this.element.val() ); | ||
15259 | } | ||
15260 | spinner_modifier( this._value ).call( this, newVal ); | ||
15261 | }, | ||
15262 | |||
15263 | widget: function() { | ||
15264 | return this.uiSpinner; | ||
15265 | } | ||
15266 | }); | ||
15267 | |||
15268 | |||
15269 | /*! | ||
15270 | * jQuery UI Tabs 1.11.2 | ||
15271 | * http://jqueryui.com | ||
15272 | * | ||
15273 | * Copyright 2014 jQuery Foundation and other contributors | ||
15274 | * Released under the MIT license. | ||
15275 | * http://jquery.org/license | ||
15276 | * | ||
15277 | * http://api.jqueryui.com/tabs/ | ||
15278 | */ | ||
15279 | |||
15280 | |||
15281 | var tabs = $.widget( "ui.tabs", { | ||
15282 | version: "1.11.2", | ||
15283 | delay: 300, | ||
15284 | options: { | ||
15285 | active: null, | ||
15286 | collapsible: false, | ||
15287 | event: "click", | ||
15288 | heightStyle: "content", | ||
15289 | hide: null, | ||
15290 | show: null, | ||
15291 | |||
15292 | // callbacks | ||
15293 | activate: null, | ||
15294 | beforeActivate: null, | ||
15295 | beforeLoad: null, | ||
15296 | load: null | ||
15297 | }, | ||
15298 | |||
15299 | _isLocal: (function() { | ||
15300 | var rhash = /#.*$/; | ||
15301 | |||
15302 | return function( anchor ) { | ||
15303 | var anchorUrl, locationUrl; | ||
15304 | |||
15305 | // support: IE7 | ||
15306 | // IE7 doesn't normalize the href property when set via script (#9317) | ||
15307 | anchor = anchor.cloneNode( false ); | ||
15308 | |||
15309 | anchorUrl = anchor.href.replace( rhash, "" ); | ||
15310 | locationUrl = location.href.replace( rhash, "" ); | ||
15311 | |||
15312 | // decoding may throw an error if the URL isn't UTF-8 (#9518) | ||
15313 | try { | ||
15314 | anchorUrl = decodeURIComponent( anchorUrl ); | ||
15315 | } catch ( error ) {} | ||
15316 | try { | ||
15317 | locationUrl = decodeURIComponent( locationUrl ); | ||
15318 | } catch ( error ) {} | ||
15319 | |||
15320 | return anchor.hash.length > 1 && anchorUrl === locationUrl; | ||
15321 | }; | ||
15322 | })(), | ||
15323 | |||
15324 | _create: function() { | ||
15325 | var that = this, | ||
15326 | options = this.options; | ||
15327 | |||
15328 | this.running = false; | ||
15329 | |||
15330 | this.element | ||
15331 | .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) | ||
15332 | .toggleClass( "ui-tabs-collapsible", options.collapsible ); | ||
15333 | |||
15334 | this._processTabs(); | ||
15335 | options.active = this._initialActive(); | ||
15336 | |||
15337 | // Take disabling tabs via class attribute from HTML | ||
15338 | // into account and update option properly. | ||
15339 | if ( $.isArray( options.disabled ) ) { | ||
15340 | options.disabled = $.unique( options.disabled.concat( | ||
15341 | $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { | ||
15342 | return that.tabs.index( li ); | ||
15343 | }) | ||
15344 | ) ).sort(); | ||
15345 | } | ||
15346 | |||
15347 | // check for length avoids error when initializing empty list | ||
15348 | if ( this.options.active !== false && this.anchors.length ) { | ||
15349 | this.active = this._findActive( options.active ); | ||
15350 | } else { | ||
15351 | this.active = $(); | ||
15352 | } | ||
15353 | |||
15354 | this._refresh(); | ||
15355 | |||
15356 | if ( this.active.length ) { | ||
15357 | this.load( options.active ); | ||
15358 | } | ||
15359 | }, | ||
15360 | |||
15361 | _initialActive: function() { | ||
15362 | var active = this.options.active, | ||
15363 | collapsible = this.options.collapsible, | ||
15364 | locationHash = location.hash.substring( 1 ); | ||
15365 | |||
15366 | if ( active === null ) { | ||
15367 | // check the fragment identifier in the URL | ||
15368 | if ( locationHash ) { | ||
15369 | this.tabs.each(function( i, tab ) { | ||
15370 | if ( $( tab ).attr( "aria-controls" ) === locationHash ) { | ||
15371 | active = i; | ||
15372 | return false; | ||
15373 | } | ||
15374 | }); | ||
15375 | } | ||
15376 | |||
15377 | // check for a tab marked active via a class | ||
15378 | if ( active === null ) { | ||
15379 | active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); | ||
15380 | } | ||
15381 | |||
15382 | // no active tab, set to false | ||
15383 | if ( active === null || active === -1 ) { | ||
15384 | active = this.tabs.length ? 0 : false; | ||
15385 | } | ||
15386 | } | ||
15387 | |||
15388 | // handle numbers: negative, out of range | ||
15389 | if ( active !== false ) { | ||
15390 | active = this.tabs.index( this.tabs.eq( active ) ); | ||
15391 | if ( active === -1 ) { | ||
15392 | active = collapsible ? false : 0; | ||
15393 | } | ||
15394 | } | ||
15395 | |||
15396 | // don't allow collapsible: false and active: false | ||
15397 | if ( !collapsible && active === false && this.anchors.length ) { | ||
15398 | active = 0; | ||
15399 | } | ||
15400 | |||
15401 | return active; | ||
15402 | }, | ||
15403 | |||
15404 | _getCreateEventData: function() { | ||
15405 | return { | ||
15406 | tab: this.active, | ||
15407 | panel: !this.active.length ? $() : this._getPanelForTab( this.active ) | ||
15408 | }; | ||
15409 | }, | ||
15410 | |||
15411 | _tabKeydown: function( event ) { | ||
15412 | var focusedTab = $( this.document[0].activeElement ).closest( "li" ), | ||
15413 | selectedIndex = this.tabs.index( focusedTab ), | ||
15414 | goingForward = true; | ||
15415 | |||
15416 | if ( this._handlePageNav( event ) ) { | ||
15417 | return; | ||
15418 | } | ||
15419 | |||
15420 | switch ( event.keyCode ) { | ||
15421 | case $.ui.keyCode.RIGHT: | ||
15422 | case $.ui.keyCode.DOWN: | ||
15423 | selectedIndex++; | ||
15424 | break; | ||
15425 | case $.ui.keyCode.UP: | ||
15426 | case $.ui.keyCode.LEFT: | ||
15427 | goingForward = false; | ||
15428 | selectedIndex--; | ||
15429 | break; | ||
15430 | case $.ui.keyCode.END: | ||
15431 | selectedIndex = this.anchors.length - 1; | ||
15432 | break; | ||
15433 | case $.ui.keyCode.HOME: | ||
15434 | selectedIndex = 0; | ||
15435 | break; | ||
15436 | case $.ui.keyCode.SPACE: | ||
15437 | // Activate only, no collapsing | ||
15438 | event.preventDefault(); | ||
15439 | clearTimeout( this.activating ); | ||
15440 | this._activate( selectedIndex ); | ||
15441 | return; | ||
15442 | case $.ui.keyCode.ENTER: | ||
15443 | // Toggle (cancel delayed activation, allow collapsing) | ||
15444 | event.preventDefault(); | ||
15445 | clearTimeout( this.activating ); | ||
15446 | // Determine if we should collapse or activate | ||
15447 | this._activate( selectedIndex === this.options.active ? false : selectedIndex ); | ||
15448 | return; | ||
15449 | default: | ||
15450 | return; | ||
15451 | } | ||
15452 | |||
15453 | // Focus the appropriate tab, based on which key was pressed | ||
15454 | event.preventDefault(); | ||
15455 | clearTimeout( this.activating ); | ||
15456 | selectedIndex = this._focusNextTab( selectedIndex, goingForward ); | ||
15457 | |||
15458 | // Navigating with control key will prevent automatic activation | ||
15459 | if ( !event.ctrlKey ) { | ||
15460 | // Update aria-selected immediately so that AT think the tab is already selected. | ||
15461 | // Otherwise AT may confuse the user by stating that they need to activate the tab, | ||
15462 | // but the tab will already be activated by the time the announcement finishes. | ||
15463 | focusedTab.attr( "aria-selected", "false" ); | ||
15464 | this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); | ||
15465 | |||
15466 | this.activating = this._delay(function() { | ||
15467 | this.option( "active", selectedIndex ); | ||
15468 | }, this.delay ); | ||
15469 | } | ||
15470 | }, | ||
15471 | |||
15472 | _panelKeydown: function( event ) { | ||
15473 | if ( this._handlePageNav( event ) ) { | ||
15474 | return; | ||
15475 | } | ||
15476 | |||
15477 | // Ctrl+up moves focus to the current tab | ||
15478 | if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { | ||
15479 | event.preventDefault(); | ||
15480 | this.active.focus(); | ||
15481 | } | ||
15482 | }, | ||
15483 | |||
15484 | // Alt+page up/down moves focus to the previous/next tab (and activates) | ||
15485 | _handlePageNav: function( event ) { | ||
15486 | if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { | ||
15487 | this._activate( this._focusNextTab( this.options.active - 1, false ) ); | ||
15488 | return true; | ||
15489 | } | ||
15490 | if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { | ||
15491 | this._activate( this._focusNextTab( this.options.active + 1, true ) ); | ||
15492 | return true; | ||
15493 | } | ||
15494 | }, | ||
15495 | |||
15496 | _findNextTab: function( index, goingForward ) { | ||
15497 | var lastTabIndex = this.tabs.length - 1; | ||
15498 | |||
15499 | function constrain() { | ||
15500 | if ( index > lastTabIndex ) { | ||
15501 | index = 0; | ||
15502 | } | ||
15503 | if ( index < 0 ) { | ||
15504 | index = lastTabIndex; | ||
15505 | } | ||
15506 | return index; | ||
15507 | } | ||
15508 | |||
15509 | while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { | ||
15510 | index = goingForward ? index + 1 : index - 1; | ||
15511 | } | ||
15512 | |||
15513 | return index; | ||
15514 | }, | ||
15515 | |||
15516 | _focusNextTab: function( index, goingForward ) { | ||
15517 | index = this._findNextTab( index, goingForward ); | ||
15518 | this.tabs.eq( index ).focus(); | ||
15519 | return index; | ||
15520 | }, | ||
15521 | |||
15522 | _setOption: function( key, value ) { | ||
15523 | if ( key === "active" ) { | ||
15524 | // _activate() will handle invalid values and update this.options | ||
15525 | this._activate( value ); | ||
15526 | return; | ||
15527 | } | ||
15528 | |||
15529 | if ( key === "disabled" ) { | ||
15530 | // don't use the widget factory's disabled handling | ||
15531 | this._setupDisabled( value ); | ||
15532 | return; | ||
15533 | } | ||
15534 | |||
15535 | this._super( key, value); | ||
15536 | |||
15537 | if ( key === "collapsible" ) { | ||
15538 | this.element.toggleClass( "ui-tabs-collapsible", value ); | ||
15539 | // Setting collapsible: false while collapsed; open first panel | ||
15540 | if ( !value && this.options.active === false ) { | ||
15541 | this._activate( 0 ); | ||
15542 | } | ||
15543 | } | ||
15544 | |||
15545 | if ( key === "event" ) { | ||
15546 | this._setupEvents( value ); | ||
15547 | } | ||
15548 | |||
15549 | if ( key === "heightStyle" ) { | ||
15550 | this._setupHeightStyle( value ); | ||
15551 | } | ||
15552 | }, | ||
15553 | |||
15554 | _sanitizeSelector: function( hash ) { | ||
15555 | return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; | ||
15556 | }, | ||
15557 | |||
15558 | refresh: function() { | ||
15559 | var options = this.options, | ||
15560 | lis = this.tablist.children( ":has(a[href])" ); | ||
15561 | |||
15562 | // get disabled tabs from class attribute from HTML | ||
15563 | // this will get converted to a boolean if needed in _refresh() | ||
15564 | options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { | ||
15565 | return lis.index( tab ); | ||
15566 | }); | ||
15567 | |||
15568 | this._processTabs(); | ||
15569 | |||
15570 | // was collapsed or no tabs | ||
15571 | if ( options.active === false || !this.anchors.length ) { | ||
15572 | options.active = false; | ||
15573 | this.active = $(); | ||
15574 | // was active, but active tab is gone | ||
15575 | } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { | ||
15576 | // all remaining tabs are disabled | ||
15577 | if ( this.tabs.length === options.disabled.length ) { | ||
15578 | options.active = false; | ||
15579 | this.active = $(); | ||
15580 | // activate previous tab | ||
15581 | } else { | ||
15582 | this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); | ||
15583 | } | ||
15584 | // was active, active tab still exists | ||
15585 | } else { | ||
15586 | // make sure active index is correct | ||
15587 | options.active = this.tabs.index( this.active ); | ||
15588 | } | ||
15589 | |||
15590 | this._refresh(); | ||
15591 | }, | ||
15592 | |||
15593 | _refresh: function() { | ||
15594 | this._setupDisabled( this.options.disabled ); | ||
15595 | this._setupEvents( this.options.event ); | ||
15596 | this._setupHeightStyle( this.options.heightStyle ); | ||
15597 | |||
15598 | this.tabs.not( this.active ).attr({ | ||
15599 | "aria-selected": "false", | ||
15600 | "aria-expanded": "false", | ||
15601 | tabIndex: -1 | ||
15602 | }); | ||
15603 | this.panels.not( this._getPanelForTab( this.active ) ) | ||
15604 | .hide() | ||
15605 | .attr({ | ||
15606 | "aria-hidden": "true" | ||
15607 | }); | ||
15608 | |||
15609 | // Make sure one tab is in the tab order | ||
15610 | if ( !this.active.length ) { | ||
15611 | this.tabs.eq( 0 ).attr( "tabIndex", 0 ); | ||
15612 | } else { | ||
15613 | this.active | ||
15614 | .addClass( "ui-tabs-active ui-state-active" ) | ||
15615 | .attr({ | ||
15616 | "aria-selected": "true", | ||
15617 | "aria-expanded": "true", | ||
15618 | tabIndex: 0 | ||
15619 | }); | ||
15620 | this._getPanelForTab( this.active ) | ||
15621 | .show() | ||
15622 | .attr({ | ||
15623 | "aria-hidden": "false" | ||
15624 | }); | ||
15625 | } | ||
15626 | }, | ||
15627 | |||
15628 | _processTabs: function() { | ||
15629 | var that = this, | ||
15630 | prevTabs = this.tabs, | ||
15631 | prevAnchors = this.anchors, | ||
15632 | prevPanels = this.panels; | ||
15633 | |||
15634 | this.tablist = this._getList() | ||
15635 | .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) | ||
15636 | .attr( "role", "tablist" ) | ||
15637 | |||
15638 | // Prevent users from focusing disabled tabs via click | ||
15639 | .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) { | ||
15640 | if ( $( this ).is( ".ui-state-disabled" ) ) { | ||
15641 | event.preventDefault(); | ||
15642 | } | ||
15643 | }) | ||
15644 | |||
15645 | // support: IE <9 | ||
15646 | // Preventing the default action in mousedown doesn't prevent IE | ||
15647 | // from focusing the element, so if the anchor gets focused, blur. | ||
15648 | // We don't have to worry about focusing the previously focused | ||
15649 | // element since clicking on a non-focusable element should focus | ||
15650 | // the body anyway. | ||
15651 | .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { | ||
15652 | if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { | ||
15653 | this.blur(); | ||
15654 | } | ||
15655 | }); | ||
15656 | |||
15657 | this.tabs = this.tablist.find( "> li:has(a[href])" ) | ||
15658 | .addClass( "ui-state-default ui-corner-top" ) | ||
15659 | .attr({ | ||
15660 | role: "tab", | ||
15661 | tabIndex: -1 | ||
15662 | }); | ||
15663 | |||
15664 | this.anchors = this.tabs.map(function() { | ||
15665 | return $( "a", this )[ 0 ]; | ||
15666 | }) | ||
15667 | .addClass( "ui-tabs-anchor" ) | ||
15668 | .attr({ | ||
15669 | role: "presentation", | ||
15670 | tabIndex: -1 | ||
15671 | }); | ||
15672 | |||
15673 | this.panels = $(); | ||
15674 | |||
15675 | this.anchors.each(function( i, anchor ) { | ||
15676 | var selector, panel, panelId, | ||
15677 | anchorId = $( anchor ).uniqueId().attr( "id" ), | ||
15678 | tab = $( anchor ).closest( "li" ), | ||
15679 | originalAriaControls = tab.attr( "aria-controls" ); | ||
15680 | |||
15681 | // inline tab | ||
15682 | if ( that._isLocal( anchor ) ) { | ||
15683 | selector = anchor.hash; | ||
15684 | panelId = selector.substring( 1 ); | ||
15685 | panel = that.element.find( that._sanitizeSelector( selector ) ); | ||
15686 | // remote tab | ||
15687 | } else { | ||
15688 | // If the tab doesn't already have aria-controls, | ||
15689 | // generate an id by using a throw-away element | ||
15690 | panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; | ||
15691 | selector = "#" + panelId; | ||
15692 | panel = that.element.find( selector ); | ||
15693 | if ( !panel.length ) { | ||
15694 | panel = that._createPanel( panelId ); | ||
15695 | panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); | ||
15696 | } | ||
15697 | panel.attr( "aria-live", "polite" ); | ||
15698 | } | ||
15699 | |||
15700 | if ( panel.length) { | ||
15701 | that.panels = that.panels.add( panel ); | ||
15702 | } | ||
15703 | if ( originalAriaControls ) { | ||
15704 | tab.data( "ui-tabs-aria-controls", originalAriaControls ); | ||
15705 | } | ||
15706 | tab.attr({ | ||
15707 | "aria-controls": panelId, | ||
15708 | "aria-labelledby": anchorId | ||
15709 | }); | ||
15710 | panel.attr( "aria-labelledby", anchorId ); | ||
15711 | }); | ||
15712 | |||
15713 | this.panels | ||
15714 | .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) | ||
15715 | .attr( "role", "tabpanel" ); | ||
15716 | |||
15717 | // Avoid memory leaks (#10056) | ||
15718 | if ( prevTabs ) { | ||
15719 | this._off( prevTabs.not( this.tabs ) ); | ||
15720 | this._off( prevAnchors.not( this.anchors ) ); | ||
15721 | this._off( prevPanels.not( this.panels ) ); | ||
15722 | } | ||
15723 | }, | ||
15724 | |||
15725 | // allow overriding how to find the list for rare usage scenarios (#7715) | ||
15726 | _getList: function() { | ||
15727 | return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); | ||
15728 | }, | ||
15729 | |||
15730 | _createPanel: function( id ) { | ||
15731 | return $( "<div>" ) | ||
15732 | .attr( "id", id ) | ||
15733 | .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) | ||
15734 | .data( "ui-tabs-destroy", true ); | ||
15735 | }, | ||
15736 | |||
15737 | _setupDisabled: function( disabled ) { | ||
15738 | if ( $.isArray( disabled ) ) { | ||
15739 | if ( !disabled.length ) { | ||
15740 | disabled = false; | ||
15741 | } else if ( disabled.length === this.anchors.length ) { | ||
15742 | disabled = true; | ||
15743 | } | ||
15744 | } | ||
15745 | |||
15746 | // disable tabs | ||
15747 | for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { | ||
15748 | if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { | ||
15749 | $( li ) | ||
15750 | .addClass( "ui-state-disabled" ) | ||
15751 | .attr( "aria-disabled", "true" ); | ||
15752 | } else { | ||
15753 | $( li ) | ||
15754 | .removeClass( "ui-state-disabled" ) | ||
15755 | .removeAttr( "aria-disabled" ); | ||
15756 | } | ||
15757 | } | ||
15758 | |||
15759 | this.options.disabled = disabled; | ||
15760 | }, | ||
15761 | |||
15762 | _setupEvents: function( event ) { | ||
15763 | var events = {}; | ||
15764 | if ( event ) { | ||
15765 | $.each( event.split(" "), function( index, eventName ) { | ||
15766 | events[ eventName ] = "_eventHandler"; | ||
15767 | }); | ||
15768 | } | ||
15769 | |||
15770 | this._off( this.anchors.add( this.tabs ).add( this.panels ) ); | ||
15771 | // Always prevent the default action, even when disabled | ||
15772 | this._on( true, this.anchors, { | ||
15773 | click: function( event ) { | ||
15774 | event.preventDefault(); | ||
15775 | } | ||
15776 | }); | ||
15777 | this._on( this.anchors, events ); | ||
15778 | this._on( this.tabs, { keydown: "_tabKeydown" } ); | ||
15779 | this._on( this.panels, { keydown: "_panelKeydown" } ); | ||
15780 | |||
15781 | this._focusable( this.tabs ); | ||
15782 | this._hoverable( this.tabs ); | ||
15783 | }, | ||
15784 | |||
15785 | _setupHeightStyle: function( heightStyle ) { | ||
15786 | var maxHeight, | ||
15787 | parent = this.element.parent(); | ||
15788 | |||
15789 | if ( heightStyle === "fill" ) { | ||
15790 | maxHeight = parent.height(); | ||
15791 | maxHeight -= this.element.outerHeight() - this.element.height(); | ||
15792 | |||
15793 | this.element.siblings( ":visible" ).each(function() { | ||
15794 | var elem = $( this ), | ||
15795 | position = elem.css( "position" ); | ||
15796 | |||
15797 | if ( position === "absolute" || position === "fixed" ) { | ||
15798 | return; | ||
15799 | } | ||
15800 | maxHeight -= elem.outerHeight( true ); | ||
15801 | }); | ||
15802 | |||
15803 | this.element.children().not( this.panels ).each(function() { | ||
15804 | maxHeight -= $( this ).outerHeight( true ); | ||
15805 | }); | ||
15806 | |||
15807 | this.panels.each(function() { | ||
15808 | $( this ).height( Math.max( 0, maxHeight - | ||
15809 | $( this ).innerHeight() + $( this ).height() ) ); | ||
15810 | }) | ||
15811 | .css( "overflow", "auto" ); | ||
15812 | } else if ( heightStyle === "auto" ) { | ||
15813 | maxHeight = 0; | ||
15814 | this.panels.each(function() { | ||
15815 | maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); | ||
15816 | }).height( maxHeight ); | ||
15817 | } | ||
15818 | }, | ||
15819 | |||
15820 | _eventHandler: function( event ) { | ||
15821 | var options = this.options, | ||
15822 | active = this.active, | ||
15823 | anchor = $( event.currentTarget ), | ||
15824 | tab = anchor.closest( "li" ), | ||
15825 | clickedIsActive = tab[ 0 ] === active[ 0 ], | ||
15826 | collapsing = clickedIsActive && options.collapsible, | ||
15827 | toShow = collapsing ? $() : this._getPanelForTab( tab ), | ||
15828 | toHide = !active.length ? $() : this._getPanelForTab( active ), | ||
15829 | eventData = { | ||
15830 | oldTab: active, | ||
15831 | oldPanel: toHide, | ||
15832 | newTab: collapsing ? $() : tab, | ||
15833 | newPanel: toShow | ||
15834 | }; | ||
15835 | |||
15836 | event.preventDefault(); | ||
15837 | |||
15838 | if ( tab.hasClass( "ui-state-disabled" ) || | ||
15839 | // tab is already loading | ||
15840 | tab.hasClass( "ui-tabs-loading" ) || | ||
15841 | // can't switch durning an animation | ||
15842 | this.running || | ||
15843 | // click on active header, but not collapsible | ||
15844 | ( clickedIsActive && !options.collapsible ) || | ||
15845 | // allow canceling activation | ||
15846 | ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { | ||
15847 | return; | ||
15848 | } | ||
15849 | |||
15850 | options.active = collapsing ? false : this.tabs.index( tab ); | ||
15851 | |||
15852 | this.active = clickedIsActive ? $() : tab; | ||
15853 | if ( this.xhr ) { | ||
15854 | this.xhr.abort(); | ||
15855 | } | ||
15856 | |||
15857 | if ( !toHide.length && !toShow.length ) { | ||
15858 | $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); | ||
15859 | } | ||
15860 | |||
15861 | if ( toShow.length ) { | ||
15862 | this.load( this.tabs.index( tab ), event ); | ||
15863 | } | ||
15864 | this._toggle( event, eventData ); | ||
15865 | }, | ||
15866 | |||
15867 | // handles show/hide for selecting tabs | ||
15868 | _toggle: function( event, eventData ) { | ||
15869 | var that = this, | ||
15870 | toShow = eventData.newPanel, | ||
15871 | toHide = eventData.oldPanel; | ||
15872 | |||
15873 | this.running = true; | ||
15874 | |||
15875 | function complete() { | ||
15876 | that.running = false; | ||
15877 | that._trigger( "activate", event, eventData ); | ||
15878 | } | ||
15879 | |||
15880 | function show() { | ||
15881 | eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); | ||
15882 | |||
15883 | if ( toShow.length && that.options.show ) { | ||
15884 | that._show( toShow, that.options.show, complete ); | ||
15885 | } else { | ||
15886 | toShow.show(); | ||
15887 | complete(); | ||
15888 | } | ||
15889 | } | ||
15890 | |||
15891 | // start out by hiding, then showing, then completing | ||
15892 | if ( toHide.length && this.options.hide ) { | ||
15893 | this._hide( toHide, this.options.hide, function() { | ||
15894 | eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); | ||
15895 | show(); | ||
15896 | }); | ||
15897 | } else { | ||
15898 | eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); | ||
15899 | toHide.hide(); | ||
15900 | show(); | ||
15901 | } | ||
15902 | |||
15903 | toHide.attr( "aria-hidden", "true" ); | ||
15904 | eventData.oldTab.attr({ | ||
15905 | "aria-selected": "false", | ||
15906 | "aria-expanded": "false" | ||
15907 | }); | ||
15908 | // If we're switching tabs, remove the old tab from the tab order. | ||
15909 | // If we're opening from collapsed state, remove the previous tab from the tab order. | ||
15910 | // If we're collapsing, then keep the collapsing tab in the tab order. | ||
15911 | if ( toShow.length && toHide.length ) { | ||
15912 | eventData.oldTab.attr( "tabIndex", -1 ); | ||
15913 | } else if ( toShow.length ) { | ||
15914 | this.tabs.filter(function() { | ||
15915 | return $( this ).attr( "tabIndex" ) === 0; | ||
15916 | }) | ||
15917 | .attr( "tabIndex", -1 ); | ||
15918 | } | ||
15919 | |||
15920 | toShow.attr( "aria-hidden", "false" ); | ||
15921 | eventData.newTab.attr({ | ||
15922 | "aria-selected": "true", | ||
15923 | "aria-expanded": "true", | ||
15924 | tabIndex: 0 | ||
15925 | }); | ||
15926 | }, | ||
15927 | |||
15928 | _activate: function( index ) { | ||
15929 | var anchor, | ||
15930 | active = this._findActive( index ); | ||
15931 | |||
15932 | // trying to activate the already active panel | ||
15933 | if ( active[ 0 ] === this.active[ 0 ] ) { | ||
15934 | return; | ||
15935 | } | ||
15936 | |||
15937 | // trying to collapse, simulate a click on the current active header | ||
15938 | if ( !active.length ) { | ||
15939 | active = this.active; | ||
15940 | } | ||
15941 | |||
15942 | anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; | ||
15943 | this._eventHandler({ | ||
15944 | target: anchor, | ||
15945 | currentTarget: anchor, | ||
15946 | preventDefault: $.noop | ||
15947 | }); | ||
15948 | }, | ||
15949 | |||
15950 | _findActive: function( index ) { | ||
15951 | return index === false ? $() : this.tabs.eq( index ); | ||
15952 | }, | ||
15953 | |||
15954 | _getIndex: function( index ) { | ||
15955 | // meta-function to give users option to provide a href string instead of a numerical index. | ||
15956 | if ( typeof index === "string" ) { | ||
15957 | index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); | ||
15958 | } | ||
15959 | |||
15960 | return index; | ||
15961 | }, | ||
15962 | |||
15963 | _destroy: function() { | ||
15964 | if ( this.xhr ) { | ||
15965 | this.xhr.abort(); | ||
15966 | } | ||
15967 | |||
15968 | this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); | ||
15969 | |||
15970 | this.tablist | ||
15971 | .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) | ||
15972 | .removeAttr( "role" ); | ||
15973 | |||
15974 | this.anchors | ||
15975 | .removeClass( "ui-tabs-anchor" ) | ||
15976 | .removeAttr( "role" ) | ||
15977 | .removeAttr( "tabIndex" ) | ||
15978 | .removeUniqueId(); | ||
15979 | |||
15980 | this.tablist.unbind( this.eventNamespace ); | ||
15981 | |||
15982 | this.tabs.add( this.panels ).each(function() { | ||
15983 | if ( $.data( this, "ui-tabs-destroy" ) ) { | ||
15984 | $( this ).remove(); | ||
15985 | } else { | ||
15986 | $( this ) | ||
15987 | .removeClass( "ui-state-default ui-state-active ui-state-disabled " + | ||
15988 | "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) | ||
15989 | .removeAttr( "tabIndex" ) | ||
15990 | .removeAttr( "aria-live" ) | ||
15991 | .removeAttr( "aria-busy" ) | ||
15992 | .removeAttr( "aria-selected" ) | ||
15993 | .removeAttr( "aria-labelledby" ) | ||
15994 | .removeAttr( "aria-hidden" ) | ||
15995 | .removeAttr( "aria-expanded" ) | ||
15996 | .removeAttr( "role" ); | ||
15997 | } | ||
15998 | }); | ||
15999 | |||
16000 | this.tabs.each(function() { | ||
16001 | var li = $( this ), | ||
16002 | prev = li.data( "ui-tabs-aria-controls" ); | ||
16003 | if ( prev ) { | ||
16004 | li | ||
16005 | .attr( "aria-controls", prev ) | ||
16006 | .removeData( "ui-tabs-aria-controls" ); | ||
16007 | } else { | ||
16008 | li.removeAttr( "aria-controls" ); | ||
16009 | } | ||
16010 | }); | ||
16011 | |||
16012 | this.panels.show(); | ||
16013 | |||
16014 | if ( this.options.heightStyle !== "content" ) { | ||
16015 | this.panels.css( "height", "" ); | ||
16016 | } | ||
16017 | }, | ||
16018 | |||
16019 | enable: function( index ) { | ||
16020 | var disabled = this.options.disabled; | ||
16021 | if ( disabled === false ) { | ||
16022 | return; | ||
16023 | } | ||
16024 | |||
16025 | if ( index === undefined ) { | ||
16026 | disabled = false; | ||
16027 | } else { | ||
16028 | index = this._getIndex( index ); | ||
16029 | if ( $.isArray( disabled ) ) { | ||
16030 | disabled = $.map( disabled, function( num ) { | ||
16031 | return num !== index ? num : null; | ||
16032 | }); | ||
16033 | } else { | ||
16034 | disabled = $.map( this.tabs, function( li, num ) { | ||
16035 | return num !== index ? num : null; | ||
16036 | }); | ||
16037 | } | ||
16038 | } | ||
16039 | this._setupDisabled( disabled ); | ||
16040 | }, | ||
16041 | |||
16042 | disable: function( index ) { | ||
16043 | var disabled = this.options.disabled; | ||
16044 | if ( disabled === true ) { | ||
16045 | return; | ||
16046 | } | ||
16047 | |||
16048 | if ( index === undefined ) { | ||
16049 | disabled = true; | ||
16050 | } else { | ||
16051 | index = this._getIndex( index ); | ||
16052 | if ( $.inArray( index, disabled ) !== -1 ) { | ||
16053 | return; | ||
16054 | } | ||
16055 | if ( $.isArray( disabled ) ) { | ||
16056 | disabled = $.merge( [ index ], disabled ).sort(); | ||
16057 | } else { | ||
16058 | disabled = [ index ]; | ||
16059 | } | ||
16060 | } | ||
16061 | this._setupDisabled( disabled ); | ||
16062 | }, | ||
16063 | |||
16064 | load: function( index, event ) { | ||
16065 | index = this._getIndex( index ); | ||
16066 | var that = this, | ||
16067 | tab = this.tabs.eq( index ), | ||
16068 | anchor = tab.find( ".ui-tabs-anchor" ), | ||
16069 | panel = this._getPanelForTab( tab ), | ||
16070 | eventData = { | ||
16071 | tab: tab, | ||
16072 | panel: panel | ||
16073 | }; | ||
16074 | |||
16075 | // not remote | ||
16076 | if ( this._isLocal( anchor[ 0 ] ) ) { | ||
16077 | return; | ||
16078 | } | ||
16079 | |||
16080 | this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); | ||
16081 | |||
16082 | // support: jQuery <1.8 | ||
16083 | // jQuery <1.8 returns false if the request is canceled in beforeSend, | ||
16084 | // but as of 1.8, $.ajax() always returns a jqXHR object. | ||
16085 | if ( this.xhr && this.xhr.statusText !== "canceled" ) { | ||
16086 | tab.addClass( "ui-tabs-loading" ); | ||
16087 | panel.attr( "aria-busy", "true" ); | ||
16088 | |||
16089 | this.xhr | ||
16090 | .success(function( response ) { | ||
16091 | // support: jQuery <1.8 | ||
16092 | // http://bugs.jquery.com/ticket/11778 | ||
16093 | setTimeout(function() { | ||
16094 | panel.html( response ); | ||
16095 | that._trigger( "load", event, eventData ); | ||
16096 | }, 1 ); | ||
16097 | }) | ||
16098 | .complete(function( jqXHR, status ) { | ||
16099 | // support: jQuery <1.8 | ||
16100 | // http://bugs.jquery.com/ticket/11778 | ||
16101 | setTimeout(function() { | ||
16102 | if ( status === "abort" ) { | ||
16103 | that.panels.stop( false, true ); | ||
16104 | } | ||
16105 | |||
16106 | tab.removeClass( "ui-tabs-loading" ); | ||
16107 | panel.removeAttr( "aria-busy" ); | ||
16108 | |||
16109 | if ( jqXHR === that.xhr ) { | ||
16110 | delete that.xhr; | ||
16111 | } | ||
16112 | }, 1 ); | ||
16113 | }); | ||
16114 | } | ||
16115 | }, | ||
16116 | |||
16117 | _ajaxSettings: function( anchor, event, eventData ) { | ||
16118 | var that = this; | ||
16119 | return { | ||
16120 | url: anchor.attr( "href" ), | ||
16121 | beforeSend: function( jqXHR, settings ) { | ||
16122 | return that._trigger( "beforeLoad", event, | ||
16123 | $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); | ||
16124 | } | ||
16125 | }; | ||
16126 | }, | ||
16127 | |||
16128 | _getPanelForTab: function( tab ) { | ||
16129 | var id = $( tab ).attr( "aria-controls" ); | ||
16130 | return this.element.find( this._sanitizeSelector( "#" + id ) ); | ||
16131 | } | ||
16132 | }); | ||
16133 | |||
16134 | |||
16135 | /*! | ||
16136 | * jQuery UI Tooltip 1.11.2 | ||
16137 | * http://jqueryui.com | ||
16138 | * | ||
16139 | * Copyright 2014 jQuery Foundation and other contributors | ||
16140 | * Released under the MIT license. | ||
16141 | * http://jquery.org/license | ||
16142 | * | ||
16143 | * http://api.jqueryui.com/tooltip/ | ||
16144 | */ | ||
16145 | |||
16146 | |||
16147 | var tooltip = $.widget( "ui.tooltip", { | ||
16148 | version: "1.11.2", | ||
16149 | options: { | ||
16150 | content: function() { | ||
16151 | // support: IE<9, Opera in jQuery <1.7 | ||
16152 | // .text() can't accept undefined, so coerce to a string | ||
16153 | var title = $( this ).attr( "title" ) || ""; | ||
16154 | // Escape title, since we're going from an attribute to raw HTML | ||
16155 | return $( "<a>" ).text( title ).html(); | ||
16156 | }, | ||
16157 | hide: true, | ||
16158 | // Disabled elements have inconsistent behavior across browsers (#8661) | ||
16159 | items: "[title]:not([disabled])", | ||
16160 | position: { | ||
16161 | my: "left top+15", | ||
16162 | at: "left bottom", | ||
16163 | collision: "flipfit flip" | ||
16164 | }, | ||
16165 | show: true, | ||
16166 | tooltipClass: null, | ||
16167 | track: false, | ||
16168 | |||
16169 | // callbacks | ||
16170 | close: null, | ||
16171 | open: null | ||
16172 | }, | ||
16173 | |||
16174 | _addDescribedBy: function( elem, id ) { | ||
16175 | var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); | ||
16176 | describedby.push( id ); | ||
16177 | elem | ||
16178 | .data( "ui-tooltip-id", id ) | ||
16179 | .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); | ||
16180 | }, | ||
16181 | |||
16182 | _removeDescribedBy: function( elem ) { | ||
16183 | var id = elem.data( "ui-tooltip-id" ), | ||
16184 | describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), | ||
16185 | index = $.inArray( id, describedby ); | ||
16186 | |||
16187 | if ( index !== -1 ) { | ||
16188 | describedby.splice( index, 1 ); | ||
16189 | } | ||
16190 | |||
16191 | elem.removeData( "ui-tooltip-id" ); | ||
16192 | describedby = $.trim( describedby.join( " " ) ); | ||
16193 | if ( describedby ) { | ||
16194 | elem.attr( "aria-describedby", describedby ); | ||
16195 | } else { | ||
16196 | elem.removeAttr( "aria-describedby" ); | ||
16197 | } | ||
16198 | }, | ||
16199 | |||
16200 | _create: function() { | ||
16201 | this._on({ | ||
16202 | mouseover: "open", | ||
16203 | focusin: "open" | ||
16204 | }); | ||
16205 | |||
16206 | // IDs of generated tooltips, needed for destroy | ||
16207 | this.tooltips = {}; | ||
16208 | |||
16209 | // IDs of parent tooltips where we removed the title attribute | ||
16210 | this.parents = {}; | ||
16211 | |||
16212 | if ( this.options.disabled ) { | ||
16213 | this._disable(); | ||
16214 | } | ||
16215 | |||
16216 | // Append the aria-live region so tooltips announce correctly | ||
16217 | this.liveRegion = $( "<div>" ) | ||
16218 | .attr({ | ||
16219 | role: "log", | ||
16220 | "aria-live": "assertive", | ||
16221 | "aria-relevant": "additions" | ||
16222 | }) | ||
16223 | .addClass( "ui-helper-hidden-accessible" ) | ||
16224 | .appendTo( this.document[ 0 ].body ); | ||
16225 | }, | ||
16226 | |||
16227 | _setOption: function( key, value ) { | ||
16228 | var that = this; | ||
16229 | |||
16230 | if ( key === "disabled" ) { | ||
16231 | this[ value ? "_disable" : "_enable" ](); | ||
16232 | this.options[ key ] = value; | ||
16233 | // disable element style changes | ||
16234 | return; | ||
16235 | } | ||
16236 | |||
16237 | this._super( key, value ); | ||
16238 | |||
16239 | if ( key === "content" ) { | ||
16240 | $.each( this.tooltips, function( id, tooltipData ) { | ||
16241 | that._updateContent( tooltipData.element ); | ||
16242 | }); | ||
16243 | } | ||
16244 | }, | ||
16245 | |||
16246 | _disable: function() { | ||
16247 | var that = this; | ||
16248 | |||
16249 | // close open tooltips | ||
16250 | $.each( this.tooltips, function( id, tooltipData ) { | ||
16251 | var event = $.Event( "blur" ); | ||
16252 | event.target = event.currentTarget = tooltipData.element[ 0 ]; | ||
16253 | that.close( event, true ); | ||
16254 | }); | ||
16255 | |||
16256 | // remove title attributes to prevent native tooltips | ||
16257 | this.element.find( this.options.items ).addBack().each(function() { | ||
16258 | var element = $( this ); | ||
16259 | if ( element.is( "[title]" ) ) { | ||
16260 | element | ||
16261 | .data( "ui-tooltip-title", element.attr( "title" ) ) | ||
16262 | .removeAttr( "title" ); | ||
16263 | } | ||
16264 | }); | ||
16265 | }, | ||
16266 | |||
16267 | _enable: function() { | ||
16268 | // restore title attributes | ||
16269 | this.element.find( this.options.items ).addBack().each(function() { | ||
16270 | var element = $( this ); | ||
16271 | if ( element.data( "ui-tooltip-title" ) ) { | ||
16272 | element.attr( "title", element.data( "ui-tooltip-title" ) ); | ||
16273 | } | ||
16274 | }); | ||
16275 | }, | ||
16276 | |||
16277 | open: function( event ) { | ||
16278 | var that = this, | ||
16279 | target = $( event ? event.target : this.element ) | ||
16280 | // we need closest here due to mouseover bubbling, | ||
16281 | // but always pointing at the same event target | ||
16282 | .closest( this.options.items ); | ||
16283 | |||
16284 | // No element to show a tooltip for or the tooltip is already open | ||
16285 | if ( !target.length || target.data( "ui-tooltip-id" ) ) { | ||
16286 | return; | ||
16287 | } | ||
16288 | |||
16289 | if ( target.attr( "title" ) ) { | ||
16290 | target.data( "ui-tooltip-title", target.attr( "title" ) ); | ||
16291 | } | ||
16292 | |||
16293 | target.data( "ui-tooltip-open", true ); | ||
16294 | |||
16295 | // kill parent tooltips, custom or native, for hover | ||
16296 | if ( event && event.type === "mouseover" ) { | ||
16297 | target.parents().each(function() { | ||
16298 | var parent = $( this ), | ||
16299 | blurEvent; | ||
16300 | if ( parent.data( "ui-tooltip-open" ) ) { | ||
16301 | blurEvent = $.Event( "blur" ); | ||
16302 | blurEvent.target = blurEvent.currentTarget = this; | ||
16303 | that.close( blurEvent, true ); | ||
16304 | } | ||
16305 | if ( parent.attr( "title" ) ) { | ||
16306 | parent.uniqueId(); | ||
16307 | that.parents[ this.id ] = { | ||
16308 | element: this, | ||
16309 | title: parent.attr( "title" ) | ||
16310 | }; | ||
16311 | parent.attr( "title", "" ); | ||
16312 | } | ||
16313 | }); | ||
16314 | } | ||
16315 | |||
16316 | this._updateContent( target, event ); | ||
16317 | }, | ||
16318 | |||
16319 | _updateContent: function( target, event ) { | ||
16320 | var content, | ||
16321 | contentOption = this.options.content, | ||
16322 | that = this, | ||
16323 | eventType = event ? event.type : null; | ||
16324 | |||
16325 | if ( typeof contentOption === "string" ) { | ||
16326 | return this._open( event, target, contentOption ); | ||
16327 | } | ||
16328 | |||
16329 | content = contentOption.call( target[0], function( response ) { | ||
16330 | // ignore async response if tooltip was closed already | ||
16331 | if ( !target.data( "ui-tooltip-open" ) ) { | ||
16332 | return; | ||
16333 | } | ||
16334 | // IE may instantly serve a cached response for ajax requests | ||
16335 | // delay this call to _open so the other call to _open runs first | ||
16336 | that._delay(function() { | ||
16337 | // jQuery creates a special event for focusin when it doesn't | ||
16338 | // exist natively. To improve performance, the native event | ||
16339 | // object is reused and the type is changed. Therefore, we can't | ||
16340 | // rely on the type being correct after the event finished | ||
16341 | // bubbling, so we set it back to the previous value. (#8740) | ||
16342 | if ( event ) { | ||
16343 | event.type = eventType; | ||
16344 | } | ||
16345 | this._open( event, target, response ); | ||
16346 | }); | ||
16347 | }); | ||
16348 | if ( content ) { | ||
16349 | this._open( event, target, content ); | ||
16350 | } | ||
16351 | }, | ||
16352 | |||
16353 | _open: function( event, target, content ) { | ||
16354 | var tooltipData, tooltip, events, delayedShow, a11yContent, | ||
16355 | positionOption = $.extend( {}, this.options.position ); | ||
16356 | |||
16357 | if ( !content ) { | ||
16358 | return; | ||
16359 | } | ||
16360 | |||
16361 | // Content can be updated multiple times. If the tooltip already | ||
16362 | // exists, then just update the content and bail. | ||
16363 | tooltipData = this._find( target ); | ||
16364 | if ( tooltipData ) { | ||
16365 | tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); | ||
16366 | return; | ||
16367 | } | ||
16368 | |||
16369 | // if we have a title, clear it to prevent the native tooltip | ||
16370 | // we have to check first to avoid defining a title if none exists | ||
16371 | // (we don't want to cause an element to start matching [title]) | ||
16372 | // | ||
16373 | // We use removeAttr only for key events, to allow IE to export the correct | ||
16374 | // accessible attributes. For mouse events, set to empty string to avoid | ||
16375 | // native tooltip showing up (happens only when removing inside mouseover). | ||
16376 | if ( target.is( "[title]" ) ) { | ||
16377 | if ( event && event.type === "mouseover" ) { | ||
16378 | target.attr( "title", "" ); | ||
16379 | } else { | ||
16380 | target.removeAttr( "title" ); | ||
16381 | } | ||
16382 | } | ||
16383 | |||
16384 | tooltipData = this._tooltip( target ); | ||
16385 | tooltip = tooltipData.tooltip; | ||
16386 | this._addDescribedBy( target, tooltip.attr( "id" ) ); | ||
16387 | tooltip.find( ".ui-tooltip-content" ).html( content ); | ||
16388 | |||
16389 | // Support: Voiceover on OS X, JAWS on IE <= 9 | ||
16390 | // JAWS announces deletions even when aria-relevant="additions" | ||
16391 | // Voiceover will sometimes re-read the entire log region's contents from the beginning | ||
16392 | this.liveRegion.children().hide(); | ||
16393 | if ( content.clone ) { | ||
16394 | a11yContent = content.clone(); | ||
16395 | a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); | ||
16396 | } else { | ||
16397 | a11yContent = content; | ||
16398 | } | ||
16399 | $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion ); | ||
16400 | |||
16401 | function position( event ) { | ||
16402 | positionOption.of = event; | ||
16403 | if ( tooltip.is( ":hidden" ) ) { | ||
16404 | return; | ||
16405 | } | ||
16406 | tooltip.position( positionOption ); | ||
16407 | } | ||
16408 | if ( this.options.track && event && /^mouse/.test( event.type ) ) { | ||
16409 | this._on( this.document, { | ||
16410 | mousemove: position | ||
16411 | }); | ||
16412 | // trigger once to override element-relative positioning | ||
16413 | position( event ); | ||
16414 | } else { | ||
16415 | tooltip.position( $.extend({ | ||
16416 | of: target | ||
16417 | }, this.options.position ) ); | ||
16418 | } | ||
16419 | |||
16420 | tooltip.hide(); | ||
16421 | |||
16422 | this._show( tooltip, this.options.show ); | ||
16423 | // Handle tracking tooltips that are shown with a delay (#8644). As soon | ||
16424 | // as the tooltip is visible, position the tooltip using the most recent | ||
16425 | // event. | ||
16426 | if ( this.options.show && this.options.show.delay ) { | ||
16427 | delayedShow = this.delayedShow = setInterval(function() { | ||
16428 | if ( tooltip.is( ":visible" ) ) { | ||
16429 | position( positionOption.of ); | ||
16430 | clearInterval( delayedShow ); | ||
16431 | } | ||
16432 | }, $.fx.interval ); | ||
16433 | } | ||
16434 | |||
16435 | this._trigger( "open", event, { tooltip: tooltip } ); | ||
16436 | |||
16437 | events = { | ||
16438 | keyup: function( event ) { | ||
16439 | if ( event.keyCode === $.ui.keyCode.ESCAPE ) { | ||
16440 | var fakeEvent = $.Event(event); | ||
16441 | fakeEvent.currentTarget = target[0]; | ||
16442 | this.close( fakeEvent, true ); | ||
16443 | } | ||
16444 | } | ||
16445 | }; | ||
16446 | |||
16447 | // Only bind remove handler for delegated targets. Non-delegated | ||
16448 | // tooltips will handle this in destroy. | ||
16449 | if ( target[ 0 ] !== this.element[ 0 ] ) { | ||
16450 | events.remove = function() { | ||
16451 | this._removeTooltip( tooltip ); | ||
16452 | }; | ||
16453 | } | ||
16454 | |||
16455 | if ( !event || event.type === "mouseover" ) { | ||
16456 | events.mouseleave = "close"; | ||
16457 | } | ||
16458 | if ( !event || event.type === "focusin" ) { | ||
16459 | events.focusout = "close"; | ||
16460 | } | ||
16461 | this._on( true, target, events ); | ||
16462 | }, | ||
16463 | |||
16464 | close: function( event ) { | ||
16465 | var tooltip, | ||
16466 | that = this, | ||
16467 | target = $( event ? event.currentTarget : this.element ), | ||
16468 | tooltipData = this._find( target ); | ||
16469 | |||
16470 | // The tooltip may already be closed | ||
16471 | if ( !tooltipData ) { | ||
16472 | return; | ||
16473 | } | ||
16474 | |||
16475 | tooltip = tooltipData.tooltip; | ||
16476 | |||
16477 | // disabling closes the tooltip, so we need to track when we're closing | ||
16478 | // to avoid an infinite loop in case the tooltip becomes disabled on close | ||
16479 | if ( tooltipData.closing ) { | ||
16480 | return; | ||
16481 | } | ||
16482 | |||
16483 | // Clear the interval for delayed tracking tooltips | ||
16484 | clearInterval( this.delayedShow ); | ||
16485 | |||
16486 | // only set title if we had one before (see comment in _open()) | ||
16487 | // If the title attribute has changed since open(), don't restore | ||
16488 | if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { | ||
16489 | target.attr( "title", target.data( "ui-tooltip-title" ) ); | ||
16490 | } | ||
16491 | |||
16492 | this._removeDescribedBy( target ); | ||
16493 | |||
16494 | tooltipData.hiding = true; | ||
16495 | tooltip.stop( true ); | ||
16496 | this._hide( tooltip, this.options.hide, function() { | ||
16497 | that._removeTooltip( $( this ) ); | ||
16498 | }); | ||
16499 | |||
16500 | target.removeData( "ui-tooltip-open" ); | ||
16501 | this._off( target, "mouseleave focusout keyup" ); | ||
16502 | |||
16503 | // Remove 'remove' binding only on delegated targets | ||
16504 | if ( target[ 0 ] !== this.element[ 0 ] ) { | ||
16505 | this._off( target, "remove" ); | ||
16506 | } | ||
16507 | this._off( this.document, "mousemove" ); | ||
16508 | |||
16509 | if ( event && event.type === "mouseleave" ) { | ||
16510 | $.each( this.parents, function( id, parent ) { | ||
16511 | $( parent.element ).attr( "title", parent.title ); | ||
16512 | delete that.parents[ id ]; | ||
16513 | }); | ||
16514 | } | ||
16515 | |||
16516 | tooltipData.closing = true; | ||
16517 | this._trigger( "close", event, { tooltip: tooltip } ); | ||
16518 | if ( !tooltipData.hiding ) { | ||
16519 | tooltipData.closing = false; | ||
16520 | } | ||
16521 | }, | ||
16522 | |||
16523 | _tooltip: function( element ) { | ||
16524 | var tooltip = $( "<div>" ) | ||
16525 | .attr( "role", "tooltip" ) | ||
16526 | .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + | ||
16527 | ( this.options.tooltipClass || "" ) ), | ||
16528 | id = tooltip.uniqueId().attr( "id" ); | ||
16529 | |||
16530 | $( "<div>" ) | ||
16531 | .addClass( "ui-tooltip-content" ) | ||
16532 | .appendTo( tooltip ); | ||
16533 | |||
16534 | tooltip.appendTo( this.document[0].body ); | ||
16535 | |||
16536 | return this.tooltips[ id ] = { | ||
16537 | element: element, | ||
16538 | tooltip: tooltip | ||
16539 | }; | ||
16540 | }, | ||
16541 | |||
16542 | _find: function( target ) { | ||
16543 | var id = target.data( "ui-tooltip-id" ); | ||
16544 | return id ? this.tooltips[ id ] : null; | ||
16545 | }, | ||
16546 | |||
16547 | _removeTooltip: function( tooltip ) { | ||
16548 | tooltip.remove(); | ||
16549 | delete this.tooltips[ tooltip.attr( "id" ) ]; | ||
16550 | }, | ||
16551 | |||
16552 | _destroy: function() { | ||
16553 | var that = this; | ||
16554 | |||
16555 | // close open tooltips | ||
16556 | $.each( this.tooltips, function( id, tooltipData ) { | ||
16557 | // Delegate to close method to handle common cleanup | ||
16558 | var event = $.Event( "blur" ), | ||
16559 | element = tooltipData.element; | ||
16560 | event.target = event.currentTarget = element[ 0 ]; | ||
16561 | that.close( event, true ); | ||
16562 | |||
16563 | // Remove immediately; destroying an open tooltip doesn't use the | ||
16564 | // hide animation | ||
16565 | $( "#" + id ).remove(); | ||
16566 | |||
16567 | // Restore the title | ||
16568 | if ( element.data( "ui-tooltip-title" ) ) { | ||
16569 | // If the title attribute has changed since open(), don't restore | ||
16570 | if ( !element.attr( "title" ) ) { | ||
16571 | element.attr( "title", element.data( "ui-tooltip-title" ) ); | ||
16572 | } | ||
16573 | element.removeData( "ui-tooltip-title" ); | ||
16574 | } | ||
16575 | }); | ||
16576 | this.liveRegion.remove(); | ||
16577 | } | ||
16578 | }); | ||
16579 | |||
16580 | |||
16581 | |||
16582 | })); \ No newline at end of file | ||
diff --git a/inc/jquery-ui-1.11.2.min.js b/inc/jquery-ui-1.11.2.min.js deleted file mode 100644 index 17eab790..00000000 --- a/inc/jquery-ui-1.11.2.min.js +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /*! jQuery UI - v1.11.2 - 2014-10-16 | ||
2 | * http://jqueryui.com | ||
3 | * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js | ||
4 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ | ||
5 | |||
6 | (function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return n=!a&&o.length?e.widget.extend.apply(null,[n].concat(o)):n,a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))}),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,e.top+p+f+m>u&&(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},u=h&&l.down||l,d=function(){o._toggleComplete(i)};return"number"==typeof u&&(a=u),"string"==typeof u&&(n=u),n=n||u.easing||l.easing,a=a||u.duration||l.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:d,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?r+=i.now:"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,d):e.animate(this.showProps,a,n,d)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i) | ||
7 | }},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.2",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.2"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0 | ||
8 | },_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,z,H,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),z=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=z,H=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;z>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(H)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[H]):[!0,""],j=H.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>H||$&&H>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(H.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===H.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(H.getTime()===G.getTime()?" "+this._currentClass:"")+(H.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(j&&!v?" ":W?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===R.getTime()?" ui-state-highlight":"")+(H.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":" ")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":" ")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.2",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0) | ||
9 | },_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=u-t.height,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.2",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0; | ||
10 | if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.2",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()}; | ||
11 | f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.2",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.2",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this,i=this.element.attr("tabindex");this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:i||this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html(" ")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.attr("value"),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=(this.options.max-this._valueMin())%this.options.step;this.max=this.options.max-e},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this)); | ||
12 | return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td> </td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0] | ||
13 | }).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,r)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.2",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&n._delay(function(){t&&(t.type=a),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){u.of=e,o.is(":hidden")||o.position(u)}var a,o,r,h,l,u=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(l=s.clone(),l.removeAttr("id").find("[id]").removeAttr("id")):l=s,e("<div>").html(l).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(u.of),clearInterval(h))},e.fx.interval)),this._trigger("open",t,{tooltip:o}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}},i[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(o)}),t&&"mouseover"!==t.type||(r.mouseleave="close"),t&&"focusin"!==t.type||(r.focusout="close"),this._on(!0,i,r)}},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);a&&(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)))},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})}); \ No newline at end of file | ||
diff --git a/inc/shaarli.css b/inc/shaarli.css index a88143ca..53a407c4 100644 --- a/inc/shaarli.css +++ b/inc/shaarli.css | |||
@@ -339,12 +339,15 @@ h1 { | |||
339 | 339 | ||
340 | #editlinkform { | 340 | #editlinkform { |
341 | height: 100%; | 341 | height: 100%; |
342 | color: #ffffff; | ||
343 | padding: 5px 5px 5px 15px; | 342 | padding: 5px 5px 5px 15px; |
344 | width: 80%; | 343 | width: 80%; |
345 | clear: left; | 344 | clear: left; |
346 | } | 345 | } |
347 | 346 | ||
347 | #editlinkform label { | ||
348 | color: #ffffff; | ||
349 | } | ||
350 | |||
348 | #editlinkform textarea, #editlinkform .lf_input { | 351 | #editlinkform textarea, #editlinkform .lf_input { |
349 | width: 100%; | 352 | width: 100%; |
350 | } | 353 | } |
@@ -599,6 +602,17 @@ a.qrcode img { | |||
599 | margin-left: 40px; | 602 | margin-left: 40px; |
600 | } | 603 | } |
601 | 604 | ||
605 | #changetag div { | ||
606 | float:left; | ||
607 | } | ||
608 | |||
609 | #changetag label { | ||
610 | padding: 5px; | ||
611 | } | ||
612 | |||
613 | #changetag li { | ||
614 | color: #000; | ||
615 | } | ||
602 | #configform td { | 616 | #configform td { |
603 | color: #ccc; | 617 | color: #ccc; |
604 | font-size: 10pt; | 618 | font-size: 10pt; |
@@ -691,17 +705,6 @@ a.qrcode img { | |||
691 | text-shadow: 2px 2px 1px #000000; | 705 | text-shadow: 2px 2px 1px #000000; |
692 | } | 706 | } |
693 | 707 | ||
694 | /* Minimal customisation for jQuery widgets */ | ||
695 | .ui-autocomplete { | ||
696 | background-color: #fff; | ||
697 | padding-left: 5px; | ||
698 | } | ||
699 | |||
700 | .ui-state-hover { | ||
701 | background-color: #604dff; | ||
702 | color: #fff; | ||
703 | } | ||
704 | |||
705 | #linklist li.publicLinkHightLight { | 708 | #linklist li.publicLinkHightLight { |
706 | background: #ffffff; | 709 | background: #ffffff; |
707 | } | 710 | } |
@@ -856,6 +859,10 @@ div.dailyNoEntry { | |||
856 | text-align: right; | 859 | text-align: right; |
857 | } | 860 | } |
858 | 861 | ||
862 | .white { | ||
863 | color: white; | ||
864 | } | ||
865 | |||
859 | /* For lazy images loading in picture wall. | 866 | /* For lazy images loading in picture wall. |
860 | Using http://www.appelsiini.net/projects/lazyload | 867 | Using http://www.appelsiini.net/projects/lazyload |
861 | */ | 868 | */ |