diff options
author | clarkzjw <[email protected]> | 2018-01-10 13:33:55 +0000 |
---|---|---|
committer | clarkzjw <[email protected]> | 2018-01-10 13:33:55 +0000 |
commit | 2e82da4aced64c81d6616b4706d57bf93d96c429 (patch) | |
tree | 05323876209107d59585b7bc857a24cc3f535928 /_static | |
parent | ed2409c580c82a5875b10f7acf77cfbab14aab43 (diff) | |
download | blog.jinwei.me-2e82da4aced64c81d6616b4706d57bf93d96c429.tar.gz |
Wed Jan 10 13:33:55 UTC 2018
Diffstat (limited to '_static')
54 files changed, 14620 insertions, 0 deletions
diff --git a/_static/ajax-loader.gif b/_static/ajax-loader.gif new file mode 100644 index 0000000..61faf8c --- /dev/null +++ b/_static/ajax-loader.gif | |||
Binary files differ | |||
diff --git a/_static/alabaster.css b/_static/alabaster.css new file mode 100644 index 0000000..be65b13 --- /dev/null +++ b/_static/alabaster.css | |||
@@ -0,0 +1,693 @@ | |||
1 | |||
2 | |||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 | |||
16 | |||
17 | |||
18 | |||
19 | |||
20 | |||
21 | |||
22 | |||
23 | |||
24 | |||
25 | |||
26 | |||
27 | |||
28 | |||
29 | |||
30 | |||
31 | |||
32 | |||
33 | |||
34 | |||
35 | |||
36 | |||
37 | |||
38 | |||
39 | |||
40 | |||
41 | |||
42 | |||
43 | |||
44 | |||
45 | |||
46 | |||
47 | |||
48 | |||
49 | |||
50 | |||
51 | |||
52 | |||
53 | @import url("basic.css"); | ||
54 | |||
55 | /* -- page layout ----------------------------------------------------------- */ | ||
56 | |||
57 | body { | ||
58 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; | ||
59 | font-size: 17px; | ||
60 | background-color: #fff; | ||
61 | color: #000; | ||
62 | margin: 0; | ||
63 | padding: 0; | ||
64 | } | ||
65 | |||
66 | |||
67 | div.document { | ||
68 | width: 940px; | ||
69 | margin: 30px auto 0 auto; | ||
70 | } | ||
71 | |||
72 | div.documentwrapper { | ||
73 | float: left; | ||
74 | width: 100%; | ||
75 | } | ||
76 | |||
77 | div.bodywrapper { | ||
78 | margin: 0 0 0 220px; | ||
79 | } | ||
80 | |||
81 | div.sphinxsidebar { | ||
82 | width: 220px; | ||
83 | font-size: 14px; | ||
84 | line-height: 1.5; | ||
85 | } | ||
86 | |||
87 | hr { | ||
88 | border: 1px solid #B1B4B6; | ||
89 | } | ||
90 | |||
91 | div.body { | ||
92 | background-color: #fff; | ||
93 | color: #3E4349; | ||
94 | padding: 0 30px 0 30px; | ||
95 | } | ||
96 | |||
97 | div.body > .section { | ||
98 | text-align: left; | ||
99 | } | ||
100 | |||
101 | div.footer { | ||
102 | width: 940px; | ||
103 | margin: 20px auto 30px auto; | ||
104 | font-size: 14px; | ||
105 | color: #888; | ||
106 | text-align: right; | ||
107 | } | ||
108 | |||
109 | div.footer a { | ||
110 | color: #888; | ||
111 | } | ||
112 | |||
113 | p.caption { | ||
114 | font-family: inherit; | ||
115 | font-size: inherit; | ||
116 | } | ||
117 | |||
118 | |||
119 | div.relations { | ||
120 | display: none; | ||
121 | } | ||
122 | |||
123 | |||
124 | div.sphinxsidebar a { | ||
125 | color: #444; | ||
126 | text-decoration: none; | ||
127 | border-bottom: 1px dotted #999; | ||
128 | } | ||
129 | |||
130 | div.sphinxsidebar a:hover { | ||
131 | border-bottom: 1px solid #999; | ||
132 | } | ||
133 | |||
134 | div.sphinxsidebarwrapper { | ||
135 | padding: 18px 10px; | ||
136 | } | ||
137 | |||
138 | div.sphinxsidebarwrapper p.logo { | ||
139 | padding: 0; | ||
140 | margin: -10px 0 0 0px; | ||
141 | text-align: center; | ||
142 | } | ||
143 | |||
144 | div.sphinxsidebarwrapper h1.logo { | ||
145 | margin-top: -10px; | ||
146 | text-align: center; | ||
147 | margin-bottom: 5px; | ||
148 | text-align: left; | ||
149 | } | ||
150 | |||
151 | div.sphinxsidebarwrapper h1.logo-name { | ||
152 | margin-top: 0px; | ||
153 | } | ||
154 | |||
155 | div.sphinxsidebarwrapper p.blurb { | ||
156 | margin-top: 0; | ||
157 | font-style: normal; | ||
158 | } | ||
159 | |||
160 | div.sphinxsidebar h3, | ||
161 | div.sphinxsidebar h4 { | ||
162 | font-family: 'Garamond', 'Georgia', serif; | ||
163 | color: #444; | ||
164 | font-size: 24px; | ||
165 | font-weight: normal; | ||
166 | margin: 0 0 5px 0; | ||
167 | padding: 0; | ||
168 | } | ||
169 | |||
170 | div.sphinxsidebar h4 { | ||
171 | font-size: 20px; | ||
172 | } | ||
173 | |||
174 | div.sphinxsidebar h3 a { | ||
175 | color: #444; | ||
176 | } | ||
177 | |||
178 | div.sphinxsidebar p.logo a, | ||
179 | div.sphinxsidebar h3 a, | ||
180 | div.sphinxsidebar p.logo a:hover, | ||
181 | div.sphinxsidebar h3 a:hover { | ||
182 | border: none; | ||
183 | } | ||
184 | |||
185 | div.sphinxsidebar p { | ||
186 | color: #555; | ||
187 | margin: 10px 0; | ||
188 | } | ||
189 | |||
190 | div.sphinxsidebar ul { | ||
191 | margin: 10px 0; | ||
192 | padding: 0; | ||
193 | color: #000; | ||
194 | } | ||
195 | |||
196 | div.sphinxsidebar ul li.toctree-l1 > a { | ||
197 | font-size: 120%; | ||
198 | } | ||
199 | |||
200 | div.sphinxsidebar ul li.toctree-l2 > a { | ||
201 | font-size: 110%; | ||
202 | } | ||
203 | |||
204 | div.sphinxsidebar input { | ||
205 | border: 1px solid #CCC; | ||
206 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; | ||
207 | font-size: 1em; | ||
208 | } | ||
209 | |||
210 | div.sphinxsidebar hr { | ||
211 | border: none; | ||
212 | height: 1px; | ||
213 | color: #AAA; | ||
214 | background: #AAA; | ||
215 | |||
216 | text-align: left; | ||
217 | margin-left: 0; | ||
218 | width: 50%; | ||
219 | } | ||
220 | |||
221 | /* -- body styles ----------------------------------------------------------- */ | ||
222 | |||
223 | a { | ||
224 | color: #004B6B; | ||
225 | text-decoration: underline; | ||
226 | } | ||
227 | |||
228 | a:hover { | ||
229 | color: #6D4100; | ||
230 | text-decoration: underline; | ||
231 | } | ||
232 | |||
233 | div.body h1, | ||
234 | div.body h2, | ||
235 | div.body h3, | ||
236 | div.body h4, | ||
237 | div.body h5, | ||
238 | div.body h6 { | ||
239 | font-family: 'Garamond', 'Georgia', serif; | ||
240 | font-weight: normal; | ||
241 | margin: 30px 0px 10px 0px; | ||
242 | padding: 0; | ||
243 | } | ||
244 | |||
245 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } | ||
246 | div.body h2 { font-size: 180%; } | ||
247 | div.body h3 { font-size: 150%; } | ||
248 | div.body h4 { font-size: 130%; } | ||
249 | div.body h5 { font-size: 100%; } | ||
250 | div.body h6 { font-size: 100%; } | ||
251 | |||
252 | a.headerlink { | ||
253 | color: #DDD; | ||
254 | padding: 0 4px; | ||
255 | text-decoration: none; | ||
256 | } | ||
257 | |||
258 | a.headerlink:hover { | ||
259 | color: #444; | ||
260 | background: #EAEAEA; | ||
261 | } | ||
262 | |||
263 | div.body p, div.body dd, div.body li { | ||
264 | line-height: 1.4em; | ||
265 | } | ||
266 | |||
267 | div.admonition { | ||
268 | margin: 20px 0px; | ||
269 | padding: 10px 30px; | ||
270 | background-color: #EEE; | ||
271 | border: 1px solid #CCC; | ||
272 | } | ||
273 | |||
274 | div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { | ||
275 | background-color: #FBFBFB; | ||
276 | border-bottom: 1px solid #fafafa; | ||
277 | } | ||
278 | |||
279 | div.admonition p.admonition-title { | ||
280 | font-family: 'Garamond', 'Georgia', serif; | ||
281 | font-weight: normal; | ||
282 | font-size: 24px; | ||
283 | margin: 0 0 10px 0; | ||
284 | padding: 0; | ||
285 | line-height: 1; | ||
286 | } | ||
287 | |||
288 | div.admonition p.last { | ||
289 | margin-bottom: 0; | ||
290 | } | ||
291 | |||
292 | div.highlight { | ||
293 | background-color: #fff; | ||
294 | } | ||
295 | |||
296 | dt:target, .highlight { | ||
297 | background: #FAF3E8; | ||
298 | } | ||
299 | |||
300 | div.warning { | ||
301 | background-color: #FCC; | ||
302 | border: 1px solid #FAA; | ||
303 | } | ||
304 | |||
305 | div.danger { | ||
306 | background-color: #FCC; | ||
307 | border: 1px solid #FAA; | ||
308 | -moz-box-shadow: 2px 2px 4px #D52C2C; | ||
309 | -webkit-box-shadow: 2px 2px 4px #D52C2C; | ||
310 | box-shadow: 2px 2px 4px #D52C2C; | ||
311 | } | ||
312 | |||
313 | div.error { | ||
314 | background-color: #FCC; | ||
315 | border: 1px solid #FAA; | ||
316 | -moz-box-shadow: 2px 2px 4px #D52C2C; | ||
317 | -webkit-box-shadow: 2px 2px 4px #D52C2C; | ||
318 | box-shadow: 2px 2px 4px #D52C2C; | ||
319 | } | ||
320 | |||
321 | div.caution { | ||
322 | background-color: #FCC; | ||
323 | border: 1px solid #FAA; | ||
324 | } | ||
325 | |||
326 | div.attention { | ||
327 | background-color: #FCC; | ||
328 | border: 1px solid #FAA; | ||
329 | } | ||
330 | |||
331 | div.important { | ||
332 | background-color: #EEE; | ||
333 | border: 1px solid #CCC; | ||
334 | } | ||
335 | |||
336 | div.note { | ||
337 | background-color: #EEE; | ||
338 | border: 1px solid #CCC; | ||
339 | } | ||
340 | |||
341 | div.tip { | ||
342 | background-color: #EEE; | ||
343 | border: 1px solid #CCC; | ||
344 | } | ||
345 | |||
346 | div.hint { | ||
347 | background-color: #EEE; | ||
348 | border: 1px solid #CCC; | ||
349 | } | ||
350 | |||
351 | div.seealso { | ||
352 | background-color: #EEE; | ||
353 | border: 1px solid #CCC; | ||
354 | } | ||
355 | |||
356 | div.topic { | ||
357 | background-color: #EEE; | ||
358 | } | ||
359 | |||
360 | p.admonition-title { | ||
361 | display: inline; | ||
362 | } | ||
363 | |||
364 | p.admonition-title:after { | ||
365 | content: ":"; | ||
366 | } | ||
367 | |||
368 | pre, tt, code { | ||
369 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; | ||
370 | font-size: 0.9em; | ||
371 | } | ||
372 | |||
373 | .hll { | ||
374 | background-color: #FFC; | ||
375 | margin: 0 -12px; | ||
376 | padding: 0 12px; | ||
377 | display: block; | ||
378 | } | ||
379 | |||
380 | img.screenshot { | ||
381 | } | ||
382 | |||
383 | tt.descname, tt.descclassname, code.descname, code.descclassname { | ||
384 | font-size: 0.95em; | ||
385 | } | ||
386 | |||
387 | tt.descname, code.descname { | ||
388 | padding-right: 0.08em; | ||
389 | } | ||
390 | |||
391 | img.screenshot { | ||
392 | -moz-box-shadow: 2px 2px 4px #EEE; | ||
393 | -webkit-box-shadow: 2px 2px 4px #EEE; | ||
394 | box-shadow: 2px 2px 4px #EEE; | ||
395 | } | ||
396 | |||
397 | table.docutils { | ||
398 | border: 1px solid #888; | ||
399 | -moz-box-shadow: 2px 2px 4px #EEE; | ||
400 | -webkit-box-shadow: 2px 2px 4px #EEE; | ||
401 | box-shadow: 2px 2px 4px #EEE; | ||
402 | } | ||
403 | |||
404 | table.docutils td, table.docutils th { | ||
405 | border: 1px solid #888; | ||
406 | padding: 0.25em 0.7em; | ||
407 | } | ||
408 | |||
409 | table.field-list, table.footnote { | ||
410 | border: none; | ||
411 | -moz-box-shadow: none; | ||
412 | -webkit-box-shadow: none; | ||
413 | box-shadow: none; | ||
414 | } | ||
415 | |||
416 | table.footnote { | ||
417 | margin: 15px 0; | ||
418 | width: 100%; | ||
419 | border: 1px solid #EEE; | ||
420 | background: #FDFDFD; | ||
421 | font-size: 0.9em; | ||
422 | } | ||
423 | |||
424 | table.footnote + table.footnote { | ||
425 | margin-top: -15px; | ||
426 | border-top: none; | ||
427 | } | ||
428 | |||
429 | table.field-list th { | ||
430 | padding: 0 0.8em 0 0; | ||
431 | } | ||
432 | |||
433 | table.field-list td { | ||
434 | padding: 0; | ||
435 | } | ||
436 | |||
437 | table.field-list p { | ||
438 | margin-bottom: 0.8em; | ||
439 | } | ||
440 | |||
441 | /* Cloned from | ||
442 | * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 | ||
443 | */ | ||
444 | .field-name { | ||
445 | -moz-hyphens: manual; | ||
446 | -ms-hyphens: manual; | ||
447 | -webkit-hyphens: manual; | ||
448 | hyphens: manual; | ||
449 | } | ||
450 | |||
451 | table.footnote td.label { | ||
452 | width: .1px; | ||
453 | padding: 0.3em 0 0.3em 0.5em; | ||
454 | } | ||
455 | |||
456 | table.footnote td { | ||
457 | padding: 0.3em 0.5em; | ||
458 | } | ||
459 | |||
460 | dl { | ||
461 | margin: 0; | ||
462 | padding: 0; | ||
463 | } | ||
464 | |||
465 | dl dd { | ||
466 | margin-left: 30px; | ||
467 | } | ||
468 | |||
469 | blockquote { | ||
470 | margin: 0 0 0 30px; | ||
471 | padding: 0; | ||
472 | } | ||
473 | |||
474 | ul, ol { | ||
475 | /* Matches the 30px from the narrow-screen "li > ul" selector below */ | ||
476 | margin: 10px 0 10px 30px; | ||
477 | padding: 0; | ||
478 | } | ||
479 | |||
480 | pre { | ||
481 | background: #EEE; | ||
482 | padding: 7px 30px; | ||
483 | margin: 15px 0px; | ||
484 | line-height: 1.3em; | ||
485 | } | ||
486 | |||
487 | div.viewcode-block:target { | ||
488 | background: #ffd; | ||
489 | } | ||
490 | |||
491 | dl pre, blockquote pre, li pre { | ||
492 | margin-left: 0; | ||
493 | padding-left: 30px; | ||
494 | } | ||
495 | |||
496 | tt, code { | ||
497 | background-color: #ecf0f3; | ||
498 | color: #222; | ||
499 | /* padding: 1px 2px; */ | ||
500 | } | ||
501 | |||
502 | tt.xref, code.xref, a tt { | ||
503 | background-color: #FBFBFB; | ||
504 | border-bottom: 1px solid #fff; | ||
505 | } | ||
506 | |||
507 | a.reference { | ||
508 | text-decoration: none; | ||
509 | border-bottom: 1px dotted #004B6B; | ||
510 | } | ||
511 | |||
512 | /* Don't put an underline on images */ | ||
513 | a.image-reference, a.image-reference:hover { | ||
514 | border-bottom: none; | ||
515 | } | ||
516 | |||
517 | a.reference:hover { | ||
518 | border-bottom: 1px solid #6D4100; | ||
519 | } | ||
520 | |||
521 | a.footnote-reference { | ||
522 | text-decoration: none; | ||
523 | font-size: 0.7em; | ||
524 | vertical-align: top; | ||
525 | border-bottom: 1px dotted #004B6B; | ||
526 | } | ||
527 | |||
528 | a.footnote-reference:hover { | ||
529 | border-bottom: 1px solid #6D4100; | ||
530 | } | ||
531 | |||
532 | a:hover tt, a:hover code { | ||
533 | background: #EEE; | ||
534 | } | ||
535 | |||
536 | |||
537 | @media screen and (max-width: 870px) { | ||
538 | |||
539 | div.sphinxsidebar { | ||
540 | display: none; | ||
541 | } | ||
542 | |||
543 | div.document { | ||
544 | width: 100%; | ||
545 | |||
546 | } | ||
547 | |||
548 | div.documentwrapper { | ||
549 | margin-left: 0; | ||
550 | margin-top: 0; | ||
551 | margin-right: 0; | ||
552 | margin-bottom: 0; | ||
553 | } | ||
554 | |||
555 | div.bodywrapper { | ||
556 | margin-top: 0; | ||
557 | margin-right: 0; | ||
558 | margin-bottom: 0; | ||
559 | margin-left: 0; | ||
560 | } | ||
561 | |||
562 | ul { | ||
563 | margin-left: 0; | ||
564 | } | ||
565 | |||
566 | li > ul { | ||
567 | /* Matches the 30px from the "ul, ol" selector above */ | ||
568 | margin-left: 30px; | ||
569 | } | ||
570 | |||
571 | .document { | ||
572 | width: auto; | ||
573 | } | ||
574 | |||
575 | .footer { | ||
576 | width: auto; | ||
577 | } | ||
578 | |||
579 | .bodywrapper { | ||
580 | margin: 0; | ||
581 | } | ||
582 | |||
583 | .footer { | ||
584 | width: auto; | ||
585 | } | ||
586 | |||
587 | .github { | ||
588 | display: none; | ||
589 | } | ||
590 | |||
591 | |||
592 | |||
593 | } | ||
594 | |||
595 | |||
596 | |||
597 | @media screen and (max-width: 875px) { | ||
598 | |||
599 | body { | ||
600 | margin: 0; | ||
601 | padding: 20px 30px; | ||
602 | } | ||
603 | |||
604 | div.documentwrapper { | ||
605 | float: none; | ||
606 | background: #fff; | ||
607 | } | ||
608 | |||
609 | div.sphinxsidebar { | ||
610 | display: block; | ||
611 | float: none; | ||
612 | width: 102.5%; | ||
613 | margin: 50px -30px -20px -30px; | ||
614 | padding: 10px 20px; | ||
615 | background: #333; | ||
616 | color: #FFF; | ||
617 | } | ||
618 | |||
619 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, | ||
620 | div.sphinxsidebar h3 a { | ||
621 | color: #fff; | ||
622 | } | ||
623 | |||
624 | div.sphinxsidebar a { | ||
625 | color: #AAA; | ||
626 | } | ||
627 | |||
628 | div.sphinxsidebar p.logo { | ||
629 | display: none; | ||
630 | } | ||
631 | |||
632 | div.document { | ||
633 | width: 100%; | ||
634 | margin: 0; | ||
635 | } | ||
636 | |||
637 | div.footer { | ||
638 | display: none; | ||
639 | } | ||
640 | |||
641 | div.bodywrapper { | ||
642 | margin: 0; | ||
643 | } | ||
644 | |||
645 | div.body { | ||
646 | min-height: 0; | ||
647 | padding: 0; | ||
648 | } | ||
649 | |||
650 | .rtd_doc_footer { | ||
651 | display: none; | ||
652 | } | ||
653 | |||
654 | .document { | ||
655 | width: auto; | ||
656 | } | ||
657 | |||
658 | .footer { | ||
659 | width: auto; | ||
660 | } | ||
661 | |||
662 | .footer { | ||
663 | width: auto; | ||
664 | } | ||
665 | |||
666 | .github { | ||
667 | display: none; | ||
668 | } | ||
669 | } | ||
670 | |||
671 | |||
672 | /* misc. */ | ||
673 | |||
674 | .revsys-inline { | ||
675 | display: none!important; | ||
676 | } | ||
677 | |||
678 | /* Make nested-list/multi-paragraph items look better in Releases changelog | ||
679 | * pages. Without this, docutils' magical list fuckery causes inconsistent | ||
680 | * formatting between different release sub-lists. | ||
681 | */ | ||
682 | div#changelog > div.section > ul > li > p:only-child { | ||
683 | margin-bottom: 0; | ||
684 | } | ||
685 | |||
686 | /* Hide fugly table cell borders in ..bibliography:: directive output */ | ||
687 | table.docutils.citation, table.docutils.citation td, table.docutils.citation th { | ||
688 | border: none; | ||
689 | /* Below needed in some edge cases; if not applied, bottom shadows appear */ | ||
690 | -moz-box-shadow: none; | ||
691 | -webkit-box-shadow: none; | ||
692 | box-shadow: none; | ||
693 | } \ No newline at end of file | ||
diff --git a/_static/alagitpull.css b/_static/alagitpull.css new file mode 100644 index 0000000..af76018 --- /dev/null +++ b/_static/alagitpull.css | |||
@@ -0,0 +1,129 @@ | |||
1 | @import url("alabaster.css"); | ||
2 | |||
3 | div#changelog > div.section > ul > li > p:only-child { | ||
4 | margin-bottom: 0; | ||
5 | } | ||
6 | |||
7 | @media screen and (max-width: 768px) { | ||
8 | #fork-gh img, a.github img { | ||
9 | display: none; | ||
10 | } | ||
11 | } | ||
12 | |||
13 | table.docutils { | ||
14 | background-color: #fafbfc; | ||
15 | border: 0; | ||
16 | } | ||
17 | |||
18 | table.docutils td, table.docutils th { | ||
19 | border: 0; | ||
20 | } | ||
21 | |||
22 | table.docutils pre { | ||
23 | background-color: rgba(239, 242, 244, .75); | ||
24 | } | ||
25 | |||
26 | pre { | ||
27 | background-color: #fafbfc; | ||
28 | border-left: 5px solid #558abb; | ||
29 | padding: 7px 20px !important; | ||
30 | } | ||
31 | |||
32 | div.sidebar { | ||
33 | border-top: 5px solid #558abb !important; | ||
34 | background-color: #fafbfc !important; | ||
35 | padding: 3px !important; | ||
36 | } | ||
37 | |||
38 | div.admonition, | ||
39 | div.caution, | ||
40 | div.danger, | ||
41 | div.error, | ||
42 | div.hint, | ||
43 | div.important, | ||
44 | div.note, | ||
45 | div.tip, | ||
46 | div.seealso, /* sphinx directive */ | ||
47 | div.warning { | ||
48 | background-color: #fafbfc; | ||
49 | border-right: 0; | ||
50 | border-top: 0; | ||
51 | border-bottom: 0; | ||
52 | } | ||
53 | |||
54 | div.seealso { | ||
55 | border-left: 5px solid #8abb55; | ||
56 | } | ||
57 | |||
58 | div.note { | ||
59 | border-left: 5px solid #6C3082; | ||
60 | } | ||
61 | |||
62 | div.hint { | ||
63 | border-left: 5px solid #8899a6; | ||
64 | } | ||
65 | |||
66 | div.tip { | ||
67 | border-left: 5px solid #eef147; | ||
68 | } | ||
69 | |||
70 | div.caution { | ||
71 | border-left: 5px solid #bb5557; | ||
72 | } | ||
73 | |||
74 | div.danger, div.error, div.warning { | ||
75 | border-left: 5px solid #bb5557; | ||
76 | } | ||
77 | |||
78 | div.caution, div.danger, div.error, div.warning { | ||
79 | background: rgba(160, 17, 17, 0.1); | ||
80 | } | ||
81 | |||
82 | code::before, code::after { | ||
83 | letter-spacing: -0.2em; | ||
84 | content: "\00a0"; | ||
85 | } | ||
86 | |||
87 | code.literal { | ||
88 | font-size: 75%; | ||
89 | color: #24292e; | ||
90 | box-sizing: border-box; | ||
91 | display: inline-block; | ||
92 | padding: 0; | ||
93 | background: #fafcfc; | ||
94 | border: 1px solid #f0f4f7; | ||
95 | line-height: 18px; | ||
96 | } | ||
97 | |||
98 | /* BEGIN alabaster.css override for link styling */ | ||
99 | a.reference, a.reference:hover { | ||
100 | border-bottom: 0px !important; | ||
101 | text-decoration-style: solid; | ||
102 | text-decoration-line: underline; | ||
103 | } | ||
104 | |||
105 | a.reference { | ||
106 | text-decoration-color: rgba(0, 75, 107, .4); | ||
107 | } | ||
108 | |||
109 | a.reference:hover { | ||
110 | text-decoration-color: rgba(109, 65, 0, 0.4); | ||
111 | } | ||
112 | /* END alabaster.css override for link styling */ | ||
113 | |||
114 | /* BEGIN alabaster.css override for fonts */ | ||
115 | |||
116 | pre, tt, code { | ||
117 | font-family: "Fira Mono", Consolas, Menlo, Monaco, "Courier New", Courier, monospace !important; | ||
118 | } | ||
119 | |||
120 | body, div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6, | ||
121 | div.admonition p.admonition-title, div.sphinxsidebar input, div.sphinxsidebar h3, | ||
122 | div.sphinxsidebar h4 { | ||
123 | font-family: "Roboto", Corbel, Avenir, "Lucida Grande", "Lucida Sans", sans-serif !important; | ||
124 | } | ||
125 | |||
126 | body { | ||
127 | font-size: 14px !important; | ||
128 | } | ||
129 | /* END alabaster.css override for fonts */ \ No newline at end of file | ||
diff --git a/_static/android-icon-144x144.png b/_static/android-icon-144x144.png new file mode 100644 index 0000000..faf8b3e --- /dev/null +++ b/_static/android-icon-144x144.png | |||
Binary files differ | |||
diff --git a/_static/android-icon-192x192.png b/_static/android-icon-192x192.png new file mode 100644 index 0000000..ec1c5dc --- /dev/null +++ b/_static/android-icon-192x192.png | |||
Binary files differ | |||
diff --git a/_static/android-icon-36x36.png b/_static/android-icon-36x36.png new file mode 100644 index 0000000..85bebd2 --- /dev/null +++ b/_static/android-icon-36x36.png | |||
Binary files differ | |||
diff --git a/_static/android-icon-48x48.png b/_static/android-icon-48x48.png new file mode 100644 index 0000000..ecb2cd9 --- /dev/null +++ b/_static/android-icon-48x48.png | |||
Binary files differ | |||
diff --git a/_static/android-icon-72x72.png b/_static/android-icon-72x72.png new file mode 100644 index 0000000..acb5650 --- /dev/null +++ b/_static/android-icon-72x72.png | |||
Binary files differ | |||
diff --git a/_static/android-icon-96x96.png b/_static/android-icon-96x96.png new file mode 100644 index 0000000..259246c --- /dev/null +++ b/_static/android-icon-96x96.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-114x114.png b/_static/apple-icon-114x114.png new file mode 100644 index 0000000..430d4bf --- /dev/null +++ b/_static/apple-icon-114x114.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-120x120.png b/_static/apple-icon-120x120.png new file mode 100644 index 0000000..c809e1c --- /dev/null +++ b/_static/apple-icon-120x120.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-144x144.png b/_static/apple-icon-144x144.png new file mode 100644 index 0000000..faf8b3e --- /dev/null +++ b/_static/apple-icon-144x144.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-152x152.png b/_static/apple-icon-152x152.png new file mode 100644 index 0000000..bcd3534 --- /dev/null +++ b/_static/apple-icon-152x152.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-180x180.png b/_static/apple-icon-180x180.png new file mode 100644 index 0000000..e87b5d8 --- /dev/null +++ b/_static/apple-icon-180x180.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-57x57.png b/_static/apple-icon-57x57.png new file mode 100644 index 0000000..db94797 --- /dev/null +++ b/_static/apple-icon-57x57.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-60x60.png b/_static/apple-icon-60x60.png new file mode 100644 index 0000000..16a0adb --- /dev/null +++ b/_static/apple-icon-60x60.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-72x72.png b/_static/apple-icon-72x72.png new file mode 100644 index 0000000..acb5650 --- /dev/null +++ b/_static/apple-icon-72x72.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-76x76.png b/_static/apple-icon-76x76.png new file mode 100644 index 0000000..18816fe --- /dev/null +++ b/_static/apple-icon-76x76.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon-precomposed.png b/_static/apple-icon-precomposed.png new file mode 100644 index 0000000..26e71e4 --- /dev/null +++ b/_static/apple-icon-precomposed.png | |||
Binary files differ | |||
diff --git a/_static/apple-icon.png b/_static/apple-icon.png new file mode 100644 index 0000000..26e71e4 --- /dev/null +++ b/_static/apple-icon.png | |||
Binary files differ | |||
diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 0000000..6f40830 --- /dev/null +++ b/_static/basic.css | |||
@@ -0,0 +1,643 @@ | |||
1 | /* | ||
2 | * basic.css | ||
3 | * ~~~~~~~~~ | ||
4 | * | ||
5 | * Sphinx stylesheet -- basic theme. | ||
6 | * | ||
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. | ||
8 | * :license: BSD, see LICENSE for details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | /* -- main layout ----------------------------------------------------------- */ | ||
13 | |||
14 | div.clearer { | ||
15 | clear: both; | ||
16 | } | ||
17 | |||
18 | /* -- relbar ---------------------------------------------------------------- */ | ||
19 | |||
20 | div.related { | ||
21 | width: 100%; | ||
22 | font-size: 90%; | ||
23 | } | ||
24 | |||
25 | div.related h3 { | ||
26 | display: none; | ||
27 | } | ||
28 | |||
29 | div.related ul { | ||
30 | margin: 0; | ||
31 | padding: 0 0 0 10px; | ||
32 | list-style: none; | ||
33 | } | ||
34 | |||
35 | div.related li { | ||
36 | display: inline; | ||
37 | } | ||
38 | |||
39 | div.related li.right { | ||
40 | float: right; | ||
41 | margin-right: 5px; | ||
42 | } | ||
43 | |||
44 | /* -- sidebar --------------------------------------------------------------- */ | ||
45 | |||
46 | div.sphinxsidebarwrapper { | ||
47 | padding: 10px 5px 0 10px; | ||
48 | } | ||
49 | |||
50 | div.sphinxsidebar { | ||
51 | float: left; | ||
52 | width: 230px; | ||
53 | margin-left: -100%; | ||
54 | font-size: 90%; | ||
55 | word-wrap: break-word; | ||
56 | overflow-wrap : break-word; | ||
57 | } | ||
58 | |||
59 | div.sphinxsidebar ul { | ||
60 | list-style: none; | ||
61 | } | ||
62 | |||
63 | div.sphinxsidebar ul ul, | ||
64 | div.sphinxsidebar ul.want-points { | ||
65 | margin-left: 20px; | ||
66 | list-style: square; | ||
67 | } | ||
68 | |||
69 | div.sphinxsidebar ul ul { | ||
70 | margin-top: 0; | ||
71 | margin-bottom: 0; | ||
72 | } | ||
73 | |||
74 | div.sphinxsidebar form { | ||
75 | margin-top: 10px; | ||
76 | } | ||
77 | |||
78 | div.sphinxsidebar input { | ||
79 | border: 1px solid #98dbcc; | ||
80 | font-family: sans-serif; | ||
81 | font-size: 1em; | ||
82 | } | ||
83 | |||
84 | div.sphinxsidebar #searchbox input[type="text"] { | ||
85 | width: 170px; | ||
86 | } | ||
87 | |||
88 | img { | ||
89 | border: 0; | ||
90 | max-width: 100%; | ||
91 | } | ||
92 | |||
93 | /* -- search page ----------------------------------------------------------- */ | ||
94 | |||
95 | ul.search { | ||
96 | margin: 10px 0 0 20px; | ||
97 | padding: 0; | ||
98 | } | ||
99 | |||
100 | ul.search li { | ||
101 | padding: 5px 0 5px 20px; | ||
102 | background-image: url(file.png); | ||
103 | background-repeat: no-repeat; | ||
104 | background-position: 0 7px; | ||
105 | } | ||
106 | |||
107 | ul.search li a { | ||
108 | font-weight: bold; | ||
109 | } | ||
110 | |||
111 | ul.search li div.context { | ||
112 | color: #888; | ||
113 | margin: 2px 0 0 30px; | ||
114 | text-align: left; | ||
115 | } | ||
116 | |||
117 | ul.keywordmatches li.goodmatch a { | ||
118 | font-weight: bold; | ||
119 | } | ||
120 | |||
121 | /* -- index page ------------------------------------------------------------ */ | ||
122 | |||
123 | table.contentstable { | ||
124 | width: 90%; | ||
125 | margin-left: auto; | ||
126 | margin-right: auto; | ||
127 | } | ||
128 | |||
129 | table.contentstable p.biglink { | ||
130 | line-height: 150%; | ||
131 | } | ||
132 | |||
133 | a.biglink { | ||
134 | font-size: 1.3em; | ||
135 | } | ||
136 | |||
137 | span.linkdescr { | ||
138 | font-style: italic; | ||
139 | padding-top: 5px; | ||
140 | font-size: 90%; | ||
141 | } | ||
142 | |||
143 | /* -- general index --------------------------------------------------------- */ | ||
144 | |||
145 | table.indextable { | ||
146 | width: 100%; | ||
147 | } | ||
148 | |||
149 | table.indextable td { | ||
150 | text-align: left; | ||
151 | vertical-align: top; | ||
152 | } | ||
153 | |||
154 | table.indextable ul { | ||
155 | margin-top: 0; | ||
156 | margin-bottom: 0; | ||
157 | list-style-type: none; | ||
158 | } | ||
159 | |||
160 | table.indextable > tbody > tr > td > ul { | ||
161 | padding-left: 0em; | ||
162 | } | ||
163 | |||
164 | table.indextable tr.pcap { | ||
165 | height: 10px; | ||
166 | } | ||
167 | |||
168 | table.indextable tr.cap { | ||
169 | margin-top: 10px; | ||
170 | background-color: #f2f2f2; | ||
171 | } | ||
172 | |||
173 | img.toggler { | ||
174 | margin-right: 3px; | ||
175 | margin-top: 3px; | ||
176 | cursor: pointer; | ||
177 | } | ||
178 | |||
179 | div.modindex-jumpbox { | ||
180 | border-top: 1px solid #ddd; | ||
181 | border-bottom: 1px solid #ddd; | ||
182 | margin: 1em 0 1em 0; | ||
183 | padding: 0.4em; | ||
184 | } | ||
185 | |||
186 | div.genindex-jumpbox { | ||
187 | border-top: 1px solid #ddd; | ||
188 | border-bottom: 1px solid #ddd; | ||
189 | margin: 1em 0 1em 0; | ||
190 | padding: 0.4em; | ||
191 | } | ||
192 | |||
193 | /* -- domain module index --------------------------------------------------- */ | ||
194 | |||
195 | table.modindextable td { | ||
196 | padding: 2px; | ||
197 | border-collapse: collapse; | ||
198 | } | ||
199 | |||
200 | /* -- general body styles --------------------------------------------------- */ | ||
201 | |||
202 | div.body p, div.body dd, div.body li, div.body blockquote { | ||
203 | -moz-hyphens: auto; | ||
204 | -ms-hyphens: auto; | ||
205 | -webkit-hyphens: auto; | ||
206 | hyphens: auto; | ||
207 | } | ||
208 | |||
209 | a.headerlink { | ||
210 | visibility: hidden; | ||
211 | } | ||
212 | |||
213 | h1:hover > a.headerlink, | ||
214 | h2:hover > a.headerlink, | ||
215 | h3:hover > a.headerlink, | ||
216 | h4:hover > a.headerlink, | ||
217 | h5:hover > a.headerlink, | ||
218 | h6:hover > a.headerlink, | ||
219 | dt:hover > a.headerlink, | ||
220 | caption:hover > a.headerlink, | ||
221 | p.caption:hover > a.headerlink, | ||
222 | div.code-block-caption:hover > a.headerlink { | ||
223 | visibility: visible; | ||
224 | } | ||
225 | |||
226 | div.body p.caption { | ||
227 | text-align: inherit; | ||
228 | } | ||
229 | |||
230 | div.body td { | ||
231 | text-align: left; | ||
232 | } | ||
233 | |||
234 | .first { | ||
235 | margin-top: 0 !important; | ||
236 | } | ||
237 | |||
238 | p.rubric { | ||
239 | margin-top: 30px; | ||
240 | font-weight: bold; | ||
241 | } | ||
242 | |||
243 | img.align-left, .figure.align-left, object.align-left { | ||
244 | clear: left; | ||
245 | float: left; | ||
246 | margin-right: 1em; | ||
247 | } | ||
248 | |||
249 | img.align-right, .figure.align-right, object.align-right { | ||
250 | clear: right; | ||
251 | float: right; | ||
252 | margin-left: 1em; | ||
253 | } | ||
254 | |||
255 | img.align-center, .figure.align-center, object.align-center { | ||
256 | display: block; | ||
257 | margin-left: auto; | ||
258 | margin-right: auto; | ||
259 | } | ||
260 | |||
261 | .align-left { | ||
262 | text-align: left; | ||
263 | } | ||
264 | |||
265 | .align-center { | ||
266 | text-align: center; | ||
267 | } | ||
268 | |||
269 | .align-right { | ||
270 | text-align: right; | ||
271 | } | ||
272 | |||
273 | /* -- sidebars -------------------------------------------------------------- */ | ||
274 | |||
275 | div.sidebar { | ||
276 | margin: 0 0 0.5em 1em; | ||
277 | border: 1px solid #ddb; | ||
278 | padding: 7px 7px 0 7px; | ||
279 | background-color: #ffe; | ||
280 | width: 40%; | ||
281 | float: right; | ||
282 | } | ||
283 | |||
284 | p.sidebar-title { | ||
285 | font-weight: bold; | ||
286 | } | ||
287 | |||
288 | /* -- topics ---------------------------------------------------------------- */ | ||
289 | |||
290 | div.topic { | ||
291 | border: 1px solid #ccc; | ||
292 | padding: 7px 7px 0 7px; | ||
293 | margin: 10px 0 10px 0; | ||
294 | } | ||
295 | |||
296 | p.topic-title { | ||
297 | font-size: 1.1em; | ||
298 | font-weight: bold; | ||
299 | margin-top: 10px; | ||
300 | } | ||
301 | |||
302 | /* -- admonitions ----------------------------------------------------------- */ | ||
303 | |||
304 | div.admonition { | ||
305 | margin-top: 10px; | ||
306 | margin-bottom: 10px; | ||
307 | padding: 7px; | ||
308 | } | ||
309 | |||
310 | div.admonition dt { | ||
311 | font-weight: bold; | ||
312 | } | ||
313 | |||
314 | div.admonition dl { | ||
315 | margin-bottom: 0; | ||
316 | } | ||
317 | |||
318 | p.admonition-title { | ||
319 | margin: 0px 10px 5px 0px; | ||
320 | font-weight: bold; | ||
321 | } | ||
322 | |||
323 | div.body p.centered { | ||
324 | text-align: center; | ||
325 | margin-top: 25px; | ||
326 | } | ||
327 | |||
328 | /* -- tables ---------------------------------------------------------------- */ | ||
329 | |||
330 | table.docutils { | ||
331 | border: 0; | ||
332 | border-collapse: collapse; | ||
333 | } | ||
334 | |||
335 | table caption span.caption-number { | ||
336 | font-style: italic; | ||
337 | } | ||
338 | |||
339 | table caption span.caption-text { | ||
340 | } | ||
341 | |||
342 | table.docutils td, table.docutils th { | ||
343 | padding: 1px 8px 1px 5px; | ||
344 | border-top: 0; | ||
345 | border-left: 0; | ||
346 | border-right: 0; | ||
347 | border-bottom: 1px solid #aaa; | ||
348 | } | ||
349 | |||
350 | table.footnote td, table.footnote th { | ||
351 | border: 0 !important; | ||
352 | } | ||
353 | |||
354 | th { | ||
355 | text-align: left; | ||
356 | padding-right: 5px; | ||
357 | } | ||
358 | |||
359 | table.citation { | ||
360 | border-left: solid 1px gray; | ||
361 | margin-left: 1px; | ||
362 | } | ||
363 | |||
364 | table.citation td { | ||
365 | border-bottom: none; | ||
366 | } | ||
367 | |||
368 | /* -- figures --------------------------------------------------------------- */ | ||
369 | |||
370 | div.figure { | ||
371 | margin: 0.5em; | ||
372 | padding: 0.5em; | ||
373 | } | ||
374 | |||
375 | div.figure p.caption { | ||
376 | padding: 0.3em; | ||
377 | } | ||
378 | |||
379 | div.figure p.caption span.caption-number { | ||
380 | font-style: italic; | ||
381 | } | ||
382 | |||
383 | div.figure p.caption span.caption-text { | ||
384 | } | ||
385 | |||
386 | /* -- field list styles ----------------------------------------------------- */ | ||
387 | |||
388 | table.field-list td, table.field-list th { | ||
389 | border: 0 !important; | ||
390 | } | ||
391 | |||
392 | .field-list ul { | ||
393 | margin: 0; | ||
394 | padding-left: 1em; | ||
395 | } | ||
396 | |||
397 | .field-list p { | ||
398 | margin: 0; | ||
399 | } | ||
400 | |||
401 | .field-name { | ||
402 | -moz-hyphens: manual; | ||
403 | -ms-hyphens: manual; | ||
404 | -webkit-hyphens: manual; | ||
405 | hyphens: manual; | ||
406 | } | ||
407 | |||
408 | /* -- other body styles ----------------------------------------------------- */ | ||
409 | |||
410 | ol.arabic { | ||
411 | list-style: decimal; | ||
412 | } | ||
413 | |||
414 | ol.loweralpha { | ||
415 | list-style: lower-alpha; | ||
416 | } | ||
417 | |||
418 | ol.upperalpha { | ||
419 | list-style: upper-alpha; | ||
420 | } | ||
421 | |||
422 | ol.lowerroman { | ||
423 | list-style: lower-roman; | ||
424 | } | ||
425 | |||
426 | ol.upperroman { | ||
427 | list-style: upper-roman; | ||
428 | } | ||
429 | |||
430 | dl { | ||
431 | margin-bottom: 15px; | ||
432 | } | ||
433 | |||
434 | dd p { | ||
435 | margin-top: 0px; | ||
436 | } | ||
437 | |||
438 | dd ul, dd table { | ||
439 | margin-bottom: 10px; | ||
440 | } | ||
441 | |||
442 | dd { | ||
443 | margin-top: 3px; | ||
444 | margin-bottom: 10px; | ||
445 | margin-left: 30px; | ||
446 | } | ||
447 | |||
448 | dt:target, span.highlighted { | ||
449 | background-color: #fbe54e; | ||
450 | } | ||
451 | |||
452 | rect.highlighted { | ||
453 | fill: #fbe54e; | ||
454 | } | ||
455 | |||
456 | dl.glossary dt { | ||
457 | font-weight: bold; | ||
458 | font-size: 1.1em; | ||
459 | } | ||
460 | |||
461 | .optional { | ||
462 | font-size: 1.3em; | ||
463 | } | ||
464 | |||
465 | .sig-paren { | ||
466 | font-size: larger; | ||
467 | } | ||
468 | |||
469 | .versionmodified { | ||
470 | font-style: italic; | ||
471 | } | ||
472 | |||
473 | .system-message { | ||
474 | background-color: #fda; | ||
475 | padding: 5px; | ||
476 | border: 3px solid red; | ||
477 | } | ||
478 | |||
479 | .footnote:target { | ||
480 | background-color: #ffa; | ||
481 | } | ||
482 | |||
483 | .line-block { | ||
484 | display: block; | ||
485 | margin-top: 1em; | ||
486 | margin-bottom: 1em; | ||
487 | } | ||
488 | |||
489 | .line-block .line-block { | ||
490 | margin-top: 0; | ||
491 | margin-bottom: 0; | ||
492 | margin-left: 1.5em; | ||
493 | } | ||
494 | |||
495 | .guilabel, .menuselection { | ||
496 | font-family: sans-serif; | ||
497 | } | ||
498 | |||
499 | .accelerator { | ||
500 | text-decoration: underline; | ||
501 | } | ||
502 | |||
503 | .classifier { | ||
504 | font-style: oblique; | ||
505 | } | ||
506 | |||
507 | abbr, acronym { | ||
508 | border-bottom: dotted 1px; | ||
509 | cursor: help; | ||
510 | } | ||
511 | |||
512 | /* -- code displays --------------------------------------------------------- */ | ||
513 | |||
514 | pre { | ||
515 | overflow: auto; | ||
516 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ | ||
517 | } | ||
518 | |||
519 | span.pre { | ||
520 | -moz-hyphens: none; | ||
521 | -ms-hyphens: none; | ||
522 | -webkit-hyphens: none; | ||
523 | hyphens: none; | ||
524 | } | ||
525 | |||
526 | td.linenos pre { | ||
527 | padding: 5px 0px; | ||
528 | border: 0; | ||
529 | background-color: transparent; | ||
530 | color: #aaa; | ||
531 | } | ||
532 | |||
533 | table.highlighttable { | ||
534 | margin-left: 0.5em; | ||
535 | } | ||
536 | |||
537 | table.highlighttable td { | ||
538 | padding: 0 0.5em 0 0.5em; | ||
539 | } | ||
540 | |||
541 | div.code-block-caption { | ||
542 | padding: 2px 5px; | ||
543 | font-size: small; | ||
544 | } | ||
545 | |||
546 | div.code-block-caption code { | ||
547 | background-color: transparent; | ||
548 | } | ||
549 | |||
550 | div.code-block-caption + div > div.highlight > pre { | ||
551 | margin-top: 0; | ||
552 | } | ||
553 | |||
554 | div.code-block-caption span.caption-number { | ||
555 | padding: 0.1em 0.3em; | ||
556 | font-style: italic; | ||
557 | } | ||
558 | |||
559 | div.code-block-caption span.caption-text { | ||
560 | } | ||
561 | |||
562 | div.literal-block-wrapper { | ||
563 | padding: 1em 1em 0; | ||
564 | } | ||
565 | |||
566 | div.literal-block-wrapper div.highlight { | ||
567 | margin: 0; | ||
568 | } | ||
569 | |||
570 | code.descname { | ||
571 | background-color: transparent; | ||
572 | font-weight: bold; | ||
573 | font-size: 1.2em; | ||
574 | } | ||
575 | |||
576 | code.descclassname { | ||
577 | background-color: transparent; | ||
578 | } | ||
579 | |||
580 | code.xref, a code { | ||
581 | background-color: transparent; | ||
582 | font-weight: bold; | ||
583 | } | ||
584 | |||
585 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { | ||
586 | background-color: transparent; | ||
587 | } | ||
588 | |||
589 | .viewcode-link { | ||
590 | float: right; | ||
591 | } | ||
592 | |||
593 | .viewcode-back { | ||
594 | float: right; | ||
595 | font-family: sans-serif; | ||
596 | } | ||
597 | |||
598 | div.viewcode-block:target { | ||
599 | margin: -1px -10px; | ||
600 | padding: 0 10px; | ||
601 | } | ||
602 | |||
603 | /* -- math display ---------------------------------------------------------- */ | ||
604 | |||
605 | img.math { | ||
606 | vertical-align: middle; | ||
607 | } | ||
608 | |||
609 | div.body div.math p { | ||
610 | text-align: center; | ||
611 | } | ||
612 | |||
613 | span.eqno { | ||
614 | float: right; | ||
615 | } | ||
616 | |||
617 | span.eqno a.headerlink { | ||
618 | position: relative; | ||
619 | left: 0px; | ||
620 | z-index: 1; | ||
621 | } | ||
622 | |||
623 | div.math:hover a.headerlink { | ||
624 | visibility: visible; | ||
625 | } | ||
626 | |||
627 | /* -- printout stylesheet --------------------------------------------------- */ | ||
628 | |||
629 | @media print { | ||
630 | div.document, | ||
631 | div.documentwrapper, | ||
632 | div.bodywrapper { | ||
633 | margin: 0 !important; | ||
634 | width: 100%; | ||
635 | } | ||
636 | |||
637 | div.sphinxsidebar, | ||
638 | div.related, | ||
639 | div.footer, | ||
640 | #top-link { | ||
641 | display: none; | ||
642 | } | ||
643 | } \ No newline at end of file | ||
diff --git a/_static/browserconfig.xml b/_static/browserconfig.xml new file mode 100644 index 0000000..c554148 --- /dev/null +++ b/_static/browserconfig.xml | |||
@@ -0,0 +1,2 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig> \ No newline at end of file | ||
diff --git a/_static/comment-bright.png b/_static/comment-bright.png new file mode 100644 index 0000000..15e27ed --- /dev/null +++ b/_static/comment-bright.png | |||
Binary files differ | |||
diff --git a/_static/comment-close.png b/_static/comment-close.png new file mode 100644 index 0000000..4d91bcf --- /dev/null +++ b/_static/comment-close.png | |||
Binary files differ | |||
diff --git a/_static/comment.png b/_static/comment.png new file mode 100644 index 0000000..dfbc0cb --- /dev/null +++ b/_static/comment.png | |||
Binary files differ | |||
diff --git a/_static/custom.css b/_static/custom.css new file mode 100644 index 0000000..2a924f1 --- /dev/null +++ b/_static/custom.css | |||
@@ -0,0 +1 @@ | |||
/* This file intentionally left blank. */ | |||
diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 0000000..0c15c00 --- /dev/null +++ b/_static/doctools.js | |||
@@ -0,0 +1,311 @@ | |||
1 | /* | ||
2 | * doctools.js | ||
3 | * ~~~~~~~~~~~ | ||
4 | * | ||
5 | * Sphinx JavaScript utilities for all documentation. | ||
6 | * | ||
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. | ||
8 | * :license: BSD, see LICENSE for details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | /** | ||
13 | * select a different prefix for underscore | ||
14 | */ | ||
15 | $u = _.noConflict(); | ||
16 | |||
17 | /** | ||
18 | * make the code below compatible with browsers without | ||
19 | * an installed firebug like debugger | ||
20 | if (!window.console || !console.firebug) { | ||
21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", | ||
22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", | ||
23 | "profile", "profileEnd"]; | ||
24 | window.console = {}; | ||
25 | for (var i = 0; i < names.length; ++i) | ||
26 | window.console[names[i]] = function() {}; | ||
27 | } | ||
28 | */ | ||
29 | |||
30 | /** | ||
31 | * small helper function to urldecode strings | ||
32 | */ | ||
33 | jQuery.urldecode = function(x) { | ||
34 | return decodeURIComponent(x).replace(/\+/g, ' '); | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * small helper function to urlencode strings | ||
39 | */ | ||
40 | jQuery.urlencode = encodeURIComponent; | ||
41 | |||
42 | /** | ||
43 | * This function returns the parsed url parameters of the | ||
44 | * current request. Multiple values per key are supported, | ||
45 | * it will always return arrays of strings for the value parts. | ||
46 | */ | ||
47 | jQuery.getQueryParameters = function(s) { | ||
48 | if (typeof s === 'undefined') | ||
49 | s = document.location.search; | ||
50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); | ||
51 | var result = {}; | ||
52 | for (var i = 0; i < parts.length; i++) { | ||
53 | var tmp = parts[i].split('=', 2); | ||
54 | var key = jQuery.urldecode(tmp[0]); | ||
55 | var value = jQuery.urldecode(tmp[1]); | ||
56 | if (key in result) | ||
57 | result[key].push(value); | ||
58 | else | ||
59 | result[key] = [value]; | ||
60 | } | ||
61 | return result; | ||
62 | }; | ||
63 | |||
64 | /** | ||
65 | * highlight a given string on a jquery object by wrapping it in | ||
66 | * span elements with the given class name. | ||
67 | */ | ||
68 | jQuery.fn.highlightText = function(text, className) { | ||
69 | function highlight(node, addItems) { | ||
70 | if (node.nodeType === 3) { | ||
71 | var val = node.nodeValue; | ||
72 | var pos = val.toLowerCase().indexOf(text); | ||
73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { | ||
74 | var span; | ||
75 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); | ||
76 | if (isInSVG) { | ||
77 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); | ||
78 | } else { | ||
79 | span = document.createElement("span"); | ||
80 | span.className = className; | ||
81 | } | ||
82 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); | ||
83 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( | ||
84 | document.createTextNode(val.substr(pos + text.length)), | ||
85 | node.nextSibling)); | ||
86 | node.nodeValue = val.substr(0, pos); | ||
87 | if (isInSVG) { | ||
88 | var bbox = span.getBBox(); | ||
89 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); | ||
90 | rect.x.baseVal.value = bbox.x; | ||
91 | rect.y.baseVal.value = bbox.y; | ||
92 | rect.width.baseVal.value = bbox.width; | ||
93 | rect.height.baseVal.value = bbox.height; | ||
94 | rect.setAttribute('class', className); | ||
95 | var parentOfText = node.parentNode.parentNode; | ||
96 | addItems.push({ | ||
97 | "parent": node.parentNode, | ||
98 | "target": rect}); | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | else if (!jQuery(node).is("button, select, textarea")) { | ||
103 | jQuery.each(node.childNodes, function() { | ||
104 | highlight(this, addItems); | ||
105 | }); | ||
106 | } | ||
107 | } | ||
108 | var addItems = []; | ||
109 | var result = this.each(function() { | ||
110 | highlight(this, addItems); | ||
111 | }); | ||
112 | for (var i = 0; i < addItems.length; ++i) { | ||
113 | jQuery(addItems[i].parent).before(addItems[i].target); | ||
114 | } | ||
115 | return result; | ||
116 | }; | ||
117 | |||
118 | /* | ||
119 | * backward compatibility for jQuery.browser | ||
120 | * This will be supported until firefox bug is fixed. | ||
121 | */ | ||
122 | if (!jQuery.browser) { | ||
123 | jQuery.uaMatch = function(ua) { | ||
124 | ua = ua.toLowerCase(); | ||
125 | |||
126 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || | ||
127 | /(webkit)[ \/]([\w.]+)/.exec(ua) || | ||
128 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || | ||
129 | /(msie) ([\w.]+)/.exec(ua) || | ||
130 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || | ||
131 | []; | ||
132 | |||
133 | return { | ||
134 | browser: match[ 1 ] || "", | ||
135 | version: match[ 2 ] || "0" | ||
136 | }; | ||
137 | }; | ||
138 | jQuery.browser = {}; | ||
139 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; | ||
140 | } | ||
141 | |||
142 | /** | ||
143 | * Small JavaScript module for the documentation. | ||
144 | */ | ||
145 | var Documentation = { | ||
146 | |||
147 | init : function() { | ||
148 | this.fixFirefoxAnchorBug(); | ||
149 | this.highlightSearchWords(); | ||
150 | this.initIndexTable(); | ||
151 | |||
152 | }, | ||
153 | |||
154 | /** | ||
155 | * i18n support | ||
156 | */ | ||
157 | TRANSLATIONS : {}, | ||
158 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, | ||
159 | LOCALE : 'unknown', | ||
160 | |||
161 | // gettext and ngettext don't access this so that the functions | ||
162 | // can safely bound to a different name (_ = Documentation.gettext) | ||
163 | gettext : function(string) { | ||
164 | var translated = Documentation.TRANSLATIONS[string]; | ||
165 | if (typeof translated === 'undefined') | ||
166 | return string; | ||
167 | return (typeof translated === 'string') ? translated : translated[0]; | ||
168 | }, | ||
169 | |||
170 | ngettext : function(singular, plural, n) { | ||
171 | var translated = Documentation.TRANSLATIONS[singular]; | ||
172 | if (typeof translated === 'undefined') | ||
173 | return (n == 1) ? singular : plural; | ||
174 | return translated[Documentation.PLURALEXPR(n)]; | ||
175 | }, | ||
176 | |||
177 | addTranslations : function(catalog) { | ||
178 | for (var key in catalog.messages) | ||
179 | this.TRANSLATIONS[key] = catalog.messages[key]; | ||
180 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); | ||
181 | this.LOCALE = catalog.locale; | ||
182 | }, | ||
183 | |||
184 | /** | ||
185 | * add context elements like header anchor links | ||
186 | */ | ||
187 | addContextElements : function() { | ||
188 | $('div[id] > :header:first').each(function() { | ||
189 | $('<a class="headerlink">\u00B6</a>'). | ||
190 | attr('href', '#' + this.id). | ||
191 | attr('title', _('Permalink to this headline')). | ||
192 | appendTo(this); | ||
193 | }); | ||
194 | $('dt[id]').each(function() { | ||
195 | $('<a class="headerlink">\u00B6</a>'). | ||
196 | attr('href', '#' + this.id). | ||
197 | attr('title', _('Permalink to this definition')). | ||
198 | appendTo(this); | ||
199 | }); | ||
200 | }, | ||
201 | |||
202 | /** | ||
203 | * workaround a firefox stupidity | ||
204 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 | ||
205 | */ | ||
206 | fixFirefoxAnchorBug : function() { | ||
207 | if (document.location.hash && $.browser.mozilla) | ||
208 | window.setTimeout(function() { | ||
209 | document.location.href += ''; | ||
210 | }, 10); | ||
211 | }, | ||
212 | |||
213 | /** | ||
214 | * highlight the search words provided in the url in the text | ||
215 | */ | ||
216 | highlightSearchWords : function() { | ||
217 | var params = $.getQueryParameters(); | ||
218 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; | ||
219 | if (terms.length) { | ||
220 | var body = $('div.body'); | ||
221 | if (!body.length) { | ||
222 | body = $('body'); | ||
223 | } | ||
224 | window.setTimeout(function() { | ||
225 | $.each(terms, function() { | ||
226 | body.highlightText(this.toLowerCase(), 'highlighted'); | ||
227 | }); | ||
228 | }, 10); | ||
229 | $('<p class="highlight-link"><a href="javascript:Documentation.' + | ||
230 | 'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>') | ||
231 | .appendTo($('#searchbox')); | ||
232 | } | ||
233 | }, | ||
234 | |||
235 | /** | ||
236 | * init the domain index toggle buttons | ||
237 | */ | ||
238 | initIndexTable : function() { | ||
239 | var togglers = $('img.toggler').click(function() { | ||
240 | var src = $(this).attr('src'); | ||
241 | var idnum = $(this).attr('id').substr(7); | ||
242 | $('tr.cg-' + idnum).toggle(); | ||
243 | if (src.substr(-9) === 'minus.png') | ||
244 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); | ||
245 | else | ||
246 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); | ||
247 | }).css('display', ''); | ||
248 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { | ||
249 | togglers.click(); | ||
250 | } | ||
251 | }, | ||
252 | |||
253 | /** | ||
254 | * helper function to hide the search marks again | ||
255 | */ | ||
256 | hideSearchWords : function() { | ||
257 | $('#searchbox .highlight-link').fadeOut(300); | ||
258 | $('span.highlighted').removeClass('highlighted'); | ||
259 | }, | ||
260 | |||
261 | /** | ||
262 | * make the url absolute | ||
263 | */ | ||
264 | makeURL : function(relativeURL) { | ||
265 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; | ||
266 | }, | ||
267 | |||
268 | /** | ||
269 | * get the current relative url | ||
270 | */ | ||
271 | getCurrentURL : function() { | ||
272 | var path = document.location.pathname; | ||
273 | var parts = path.split(/\//); | ||
274 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { | ||
275 | if (this === '..') | ||
276 | parts.pop(); | ||
277 | }); | ||
278 | var url = parts.join('/'); | ||
279 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); | ||
280 | }, | ||
281 | |||
282 | initOnKeyListeners: function() { | ||
283 | $(document).keyup(function(event) { | ||
284 | var activeElementType = document.activeElement.tagName; | ||
285 | // don't navigate when in search box or textarea | ||
286 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { | ||
287 | switch (event.keyCode) { | ||
288 | case 37: // left | ||
289 | var prevHref = $('link[rel="prev"]').prop('href'); | ||
290 | if (prevHref) { | ||
291 | window.location.href = prevHref; | ||
292 | return false; | ||
293 | } | ||
294 | case 39: // right | ||
295 | var nextHref = $('link[rel="next"]').prop('href'); | ||
296 | if (nextHref) { | ||
297 | window.location.href = nextHref; | ||
298 | return false; | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | }); | ||
303 | } | ||
304 | }; | ||
305 | |||
306 | // quick alias for translations | ||
307 | _ = Documentation.gettext; | ||
308 | |||
309 | $(document).ready(function() { | ||
310 | Documentation.init(); | ||
311 | }); \ No newline at end of file | ||
diff --git a/_static/down-pressed.png b/_static/down-pressed.png new file mode 100644 index 0000000..5756c8c --- /dev/null +++ b/_static/down-pressed.png | |||
Binary files differ | |||
diff --git a/_static/down.png b/_static/down.png new file mode 100644 index 0000000..1b3bdad --- /dev/null +++ b/_static/down.png | |||
Binary files differ | |||
diff --git a/_static/favicon-16x16.png b/_static/favicon-16x16.png new file mode 100644 index 0000000..de4e7ea --- /dev/null +++ b/_static/favicon-16x16.png | |||
Binary files differ | |||
diff --git a/_static/favicon-32x32.png b/_static/favicon-32x32.png new file mode 100644 index 0000000..ca56252 --- /dev/null +++ b/_static/favicon-32x32.png | |||
Binary files differ | |||
diff --git a/_static/favicon-96x96.png b/_static/favicon-96x96.png new file mode 100644 index 0000000..259246c --- /dev/null +++ b/_static/favicon-96x96.png | |||
Binary files differ | |||
diff --git a/_static/favicon.ico b/_static/favicon.ico new file mode 100644 index 0000000..bd143db --- /dev/null +++ b/_static/favicon.ico | |||
Binary files differ | |||
diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000..a858a41 --- /dev/null +++ b/_static/file.png | |||
Binary files differ | |||
diff --git a/_static/flexboxgrid.min.css b/_static/flexboxgrid.min.css new file mode 100644 index 0000000..2f502c9 --- /dev/null +++ b/_static/flexboxgrid.min.css | |||
@@ -0,0 +1 @@ | |||
.container,.container-fluid{margin-right:auto;margin-left:auto}.container-fluid{padding-right:2rem;padding-left:2rem}.row{box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-.5rem;margin-left:-.5rem}.row.reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.col.reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.col-xs,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-offset-0,.col-xs-offset-1,.col-xs-offset-10,.col-xs-offset-11,.col-xs-offset-12,.col-xs-offset-2,.col-xs-offset-3,.col-xs-offset-4,.col-xs-offset-5,.col-xs-offset-6,.col-xs-offset-7,.col-xs-offset-8,.col-xs-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;padding-right:.5rem;padding-left:.5rem}.col-xs{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-xs-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-xs-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-xs-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-xs-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-xs-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-xs-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-xs-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-xs-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-xs-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-xs-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-xs-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-xs-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-11{margin-left:91.66666667%}.start-xs{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-xs{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-xs{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-xs{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-xs{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-xs{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-xs{-ms-flex-pack:distribute;justify-content:space-around}.between-xs{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-xs{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-xs{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}@media only screen and (min-width:48em){.container{width:49rem}.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-offset-0,.col-sm-offset-1,.col-sm-offset-10,.col-sm-offset-11,.col-sm-offset-12,.col-sm-offset-2,.col-sm-offset-3,.col-sm-offset-4,.col-sm-offset-5,.col-sm-offset-6,.col-sm-offset-7,.col-sm-offset-8,.col-sm-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;padding-right:.5rem;padding-left:.5rem}.col-sm{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-sm-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-sm-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-sm-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-sm-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-sm-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-sm-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-sm-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-sm-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-sm-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-sm-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-sm-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-sm-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-11{margin-left:91.66666667%}.start-sm{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-sm{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-sm{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-sm{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-sm{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-sm{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-sm{-ms-flex-pack:distribute;justify-content:space-around}.between-sm{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-sm{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-sm{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:64em){.container{width:65rem}.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-offset-0,.col-md-offset-1,.col-md-offset-10,.col-md-offset-11,.col-md-offset-12,.col-md-offset-2,.col-md-offset-3,.col-md-offset-4,.col-md-offset-5,.col-md-offset-6,.col-md-offset-7,.col-md-offset-8,.col-md-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;padding-right:.5rem;padding-left:.5rem}.col-md{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-md-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-md-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-md-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-md-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-md-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-md-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-md-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-md-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-md-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-md-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-md-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-md-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-11{margin-left:91.66666667%}.start-md{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-md{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-md{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-md{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-md{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-md{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-md{-ms-flex-pack:distribute;justify-content:space-around}.between-md{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-md{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-md{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:75em){.container{width:76rem}.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-offset-0,.col-lg-offset-1,.col-lg-offset-10,.col-lg-offset-11,.col-lg-offset-12,.col-lg-offset-2,.col-lg-offset-3,.col-lg-offset-4,.col-lg-offset-5,.col-lg-offset-6,.col-lg-offset-7,.col-lg-offset-8,.col-lg-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;padding-right:.5rem;padding-left:.5rem}.col-lg{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-lg-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-lg-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-lg-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-lg-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-lg-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-lg-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-lg-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-lg-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-lg-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-lg-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-lg-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-lg-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-11{margin-left:91.66666667%}.start-lg{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-lg{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-lg{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-lg{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-lg{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-lg{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-lg{-ms-flex-pack:distribute;justify-content:space-around}.between-lg{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-lg{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-lg{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}} \ No newline at end of file | |||
diff --git a/_static/git-pull.css b/_static/git-pull.css new file mode 100644 index 0000000..a17dd6e --- /dev/null +++ b/_static/git-pull.css | |||
@@ -0,0 +1,53 @@ | |||
1 | h1.logo { | ||
2 | font-size: 13px; | ||
3 | } | ||
4 | |||
5 | img.logo { | ||
6 | margin: 0 0 20px 0; | ||
7 | } | ||
8 | |||
9 | div.book-container > p { | ||
10 | text-align: center; | ||
11 | } | ||
12 | |||
13 | div.book-container { | ||
14 | background: rgba(250, 251, 252, 0.75); | ||
15 | border-left: 5px solid rgba(85, 138, 187, 0.75); | ||
16 | margin-top: 10px; | ||
17 | } | ||
18 | |||
19 | div.book-container:hover { | ||
20 | background: rgba(250, 251, 252, 1); | ||
21 | border-left: 5px solid rgba(85, 138, 187, 1); | ||
22 | } | ||
23 | |||
24 | div.book-container .hsk-right p:first-of-type, | ||
25 | div.book-container .rightside-book p:first-of-type { | ||
26 | padding-top: 10px; | ||
27 | } | ||
28 | |||
29 | /* flexbox.css overrides */ | ||
30 | |||
31 | /*@media only screen and (min-width: 75em),*/ | ||
32 | /*@media only screen and (min-width: 64em),*/ | ||
33 | /*@media only screen and (min-width: 48em) {*/ | ||
34 | /*.container {*/ | ||
35 | /*width: auto !important*/ | ||
36 | /*}*/ | ||
37 | /*}*/ | ||
38 | |||
39 | /*.project div.figure p.caption {*/ | ||
40 | /*margin-bottom: 0;*/ | ||
41 | /*}*/ | ||
42 | |||
43 | /*.book-container a.reference:hover,*/ | ||
44 | /*.project a.reference:hover {*/ | ||
45 | /*border-bottom: 0;*/ | ||
46 | /*}*/ | ||
47 | |||
48 | /*!* attempt to fix flexbox in screen responsiveness at mid-width *!*/ | ||
49 | /*@media only screen and (min-width: 64em) {*/ | ||
50 | /*.container {*/ | ||
51 | /*width: auto !important;*/ | ||
52 | /*}*/ | ||
53 | /*}*/ | ||
diff --git a/_static/img/2017movie.png b/_static/img/2017movie.png new file mode 100644 index 0000000..e8bc198 --- /dev/null +++ b/_static/img/2017movie.png | |||
Binary files differ | |||
diff --git a/_static/img/terminal-icon.png b/_static/img/terminal-icon.png new file mode 100644 index 0000000..fa4a5f8 --- /dev/null +++ b/_static/img/terminal-icon.png | |||
Binary files differ | |||
diff --git a/_static/jquery-3.1.0.js b/_static/jquery-3.1.0.js new file mode 100644 index 0000000..f2fc274 --- /dev/null +++ b/_static/jquery-3.1.0.js | |||
@@ -0,0 +1,10074 @@ | |||
1 | /*eslint-disable no-unused-vars*/ | ||
2 | /*! | ||
3 | * jQuery JavaScript Library v3.1.0 | ||
4 | * https://jquery.com/ | ||
5 | * | ||
6 | * Includes Sizzle.js | ||
7 | * https://sizzlejs.com/ | ||
8 | * | ||
9 | * Copyright jQuery Foundation and other contributors | ||
10 | * Released under the MIT license | ||
11 | * https://jquery.org/license | ||
12 | * | ||
13 | * Date: 2016-07-07T21:44Z | ||
14 | */ | ||
15 | ( function( global, factory ) { | ||
16 | |||
17 | "use strict"; | ||
18 | |||
19 | if ( typeof module === "object" && typeof module.exports === "object" ) { | ||
20 | |||
21 | // For CommonJS and CommonJS-like environments where a proper `window` | ||
22 | // is present, execute the factory and get jQuery. | ||
23 | // For environments that do not have a `window` with a `document` | ||
24 | // (such as Node.js), expose a factory as module.exports. | ||
25 | // This accentuates the need for the creation of a real `window`. | ||
26 | // e.g. var jQuery = require("jquery")(window); | ||
27 | // See ticket #14549 for more info. | ||
28 | module.exports = global.document ? | ||
29 | factory( global, true ) : | ||
30 | function( w ) { | ||
31 | if ( !w.document ) { | ||
32 | throw new Error( "jQuery requires a window with a document" ); | ||
33 | } | ||
34 | return factory( w ); | ||
35 | }; | ||
36 | } else { | ||
37 | factory( global ); | ||
38 | } | ||
39 | |||
40 | // Pass this if window is not defined yet | ||
41 | } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { | ||
42 | |||
43 | // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 | ||
44 | // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode | ||
45 | // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common | ||
46 | // enough that all such attempts are guarded in a try block. | ||
47 | "use strict"; | ||
48 | |||
49 | var arr = []; | ||
50 | |||
51 | var document = window.document; | ||
52 | |||
53 | var getProto = Object.getPrototypeOf; | ||
54 | |||
55 | var slice = arr.slice; | ||
56 | |||
57 | var concat = arr.concat; | ||
58 | |||
59 | var push = arr.push; | ||
60 | |||
61 | var indexOf = arr.indexOf; | ||
62 | |||
63 | var class2type = {}; | ||
64 | |||
65 | var toString = class2type.toString; | ||
66 | |||
67 | var hasOwn = class2type.hasOwnProperty; | ||
68 | |||
69 | var fnToString = hasOwn.toString; | ||
70 | |||
71 | var ObjectFunctionString = fnToString.call( Object ); | ||
72 | |||
73 | var support = {}; | ||
74 | |||
75 | |||
76 | |||
77 | function DOMEval( code, doc ) { | ||
78 | doc = doc || document; | ||
79 | |||
80 | var script = doc.createElement( "script" ); | ||
81 | |||
82 | script.text = code; | ||
83 | doc.head.appendChild( script ).parentNode.removeChild( script ); | ||
84 | } | ||
85 | /* global Symbol */ | ||
86 | // Defining this global in .eslintrc would create a danger of using the global | ||
87 | // unguarded in another place, it seems safer to define global only for this module | ||
88 | |||
89 | |||
90 | |||
91 | var | ||
92 | version = "3.1.0", | ||
93 | |||
94 | // Define a local copy of jQuery | ||
95 | jQuery = function( selector, context ) { | ||
96 | |||
97 | // The jQuery object is actually just the init constructor 'enhanced' | ||
98 | // Need init if jQuery is called (just allow error to be thrown if not included) | ||
99 | return new jQuery.fn.init( selector, context ); | ||
100 | }, | ||
101 | |||
102 | // Support: Android <=4.0 only | ||
103 | // Make sure we trim BOM and NBSP | ||
104 | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | ||
105 | |||
106 | // Matches dashed string for camelizing | ||
107 | rmsPrefix = /^-ms-/, | ||
108 | rdashAlpha = /-([a-z])/g, | ||
109 | |||
110 | // Used by jQuery.camelCase as callback to replace() | ||
111 | fcamelCase = function( all, letter ) { | ||
112 | return letter.toUpperCase(); | ||
113 | }; | ||
114 | |||
115 | jQuery.fn = jQuery.prototype = { | ||
116 | |||
117 | // The current version of jQuery being used | ||
118 | jquery: version, | ||
119 | |||
120 | constructor: jQuery, | ||
121 | |||
122 | // The default length of a jQuery object is 0 | ||
123 | length: 0, | ||
124 | |||
125 | toArray: function() { | ||
126 | return slice.call( this ); | ||
127 | }, | ||
128 | |||
129 | // Get the Nth element in the matched element set OR | ||
130 | // Get the whole matched element set as a clean array | ||
131 | get: function( num ) { | ||
132 | return num != null ? | ||
133 | |||
134 | // Return just the one element from the set | ||
135 | ( num < 0 ? this[ num + this.length ] : this[ num ] ) : | ||
136 | |||
137 | // Return all the elements in a clean array | ||
138 | slice.call( this ); | ||
139 | }, | ||
140 | |||
141 | // Take an array of elements and push it onto the stack | ||
142 | // (returning the new matched element set) | ||
143 | pushStack: function( elems ) { | ||
144 | |||
145 | // Build a new jQuery matched element set | ||
146 | var ret = jQuery.merge( this.constructor(), elems ); | ||
147 | |||
148 | // Add the old object onto the stack (as a reference) | ||
149 | ret.prevObject = this; | ||
150 | |||
151 | // Return the newly-formed element set | ||
152 | return ret; | ||
153 | }, | ||
154 | |||
155 | // Execute a callback for every element in the matched set. | ||
156 | each: function( callback ) { | ||
157 | return jQuery.each( this, callback ); | ||
158 | }, | ||
159 | |||
160 | map: function( callback ) { | ||
161 | return this.pushStack( jQuery.map( this, function( elem, i ) { | ||
162 | return callback.call( elem, i, elem ); | ||
163 | } ) ); | ||
164 | }, | ||
165 | |||
166 | slice: function() { | ||
167 | return this.pushStack( slice.apply( this, arguments ) ); | ||
168 | }, | ||
169 | |||
170 | first: function() { | ||
171 | return this.eq( 0 ); | ||
172 | }, | ||
173 | |||
174 | last: function() { | ||
175 | return this.eq( -1 ); | ||
176 | }, | ||
177 | |||
178 | eq: function( i ) { | ||
179 | var len = this.length, | ||
180 | j = +i + ( i < 0 ? len : 0 ); | ||
181 | return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); | ||
182 | }, | ||
183 | |||
184 | end: function() { | ||
185 | return this.prevObject || this.constructor(); | ||
186 | }, | ||
187 | |||
188 | // For internal use only. | ||
189 | // Behaves like an Array's method, not like a jQuery method. | ||
190 | push: push, | ||
191 | sort: arr.sort, | ||
192 | splice: arr.splice | ||
193 | }; | ||
194 | |||
195 | jQuery.extend = jQuery.fn.extend = function() { | ||
196 | var options, name, src, copy, copyIsArray, clone, | ||
197 | target = arguments[ 0 ] || {}, | ||
198 | i = 1, | ||
199 | length = arguments.length, | ||
200 | deep = false; | ||
201 | |||
202 | // Handle a deep copy situation | ||
203 | if ( typeof target === "boolean" ) { | ||
204 | deep = target; | ||
205 | |||
206 | // Skip the boolean and the target | ||
207 | target = arguments[ i ] || {}; | ||
208 | i++; | ||
209 | } | ||
210 | |||
211 | // Handle case when target is a string or something (possible in deep copy) | ||
212 | if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { | ||
213 | target = {}; | ||
214 | } | ||
215 | |||
216 | // Extend jQuery itself if only one argument is passed | ||
217 | if ( i === length ) { | ||
218 | target = this; | ||
219 | i--; | ||
220 | } | ||
221 | |||
222 | for ( ; i < length; i++ ) { | ||
223 | |||
224 | // Only deal with non-null/undefined values | ||
225 | if ( ( options = arguments[ i ] ) != null ) { | ||
226 | |||
227 | // Extend the base object | ||
228 | for ( name in options ) { | ||
229 | src = target[ name ]; | ||
230 | copy = options[ name ]; | ||
231 | |||
232 | // Prevent never-ending loop | ||
233 | if ( target === copy ) { | ||
234 | continue; | ||
235 | } | ||
236 | |||
237 | // Recurse if we're merging plain objects or arrays | ||
238 | if ( deep && copy && ( jQuery.isPlainObject( copy ) || | ||
239 | ( copyIsArray = jQuery.isArray( copy ) ) ) ) { | ||
240 | |||
241 | if ( copyIsArray ) { | ||
242 | copyIsArray = false; | ||
243 | clone = src && jQuery.isArray( src ) ? src : []; | ||
244 | |||
245 | } else { | ||
246 | clone = src && jQuery.isPlainObject( src ) ? src : {}; | ||
247 | } | ||
248 | |||
249 | // Never move original objects, clone them | ||
250 | target[ name ] = jQuery.extend( deep, clone, copy ); | ||
251 | |||
252 | // Don't bring in undefined values | ||
253 | } else if ( copy !== undefined ) { | ||
254 | target[ name ] = copy; | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | |||
260 | // Return the modified object | ||
261 | return target; | ||
262 | }; | ||
263 | |||
264 | jQuery.extend( { | ||
265 | |||
266 | // Unique for each copy of jQuery on the page | ||
267 | expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), | ||
268 | |||
269 | // Assume jQuery is ready without the ready module | ||
270 | isReady: true, | ||
271 | |||
272 | error: function( msg ) { | ||
273 | throw new Error( msg ); | ||
274 | }, | ||
275 | |||
276 | noop: function() {}, | ||
277 | |||
278 | isFunction: function( obj ) { | ||
279 | return jQuery.type( obj ) === "function"; | ||
280 | }, | ||
281 | |||
282 | isArray: Array.isArray, | ||
283 | |||
284 | isWindow: function( obj ) { | ||
285 | return obj != null && obj === obj.window; | ||
286 | }, | ||
287 | |||
288 | isNumeric: function( obj ) { | ||
289 | |||
290 | // As of jQuery 3.0, isNumeric is limited to | ||
291 | // strings and numbers (primitives or objects) | ||
292 | // that can be coerced to finite numbers (gh-2662) | ||
293 | var type = jQuery.type( obj ); | ||
294 | return ( type === "number" || type === "string" ) && | ||
295 | |||
296 | // parseFloat NaNs numeric-cast false positives ("") | ||
297 | // ...but misinterprets leading-number strings, particularly hex literals ("0x...") | ||
298 | // subtraction forces infinities to NaN | ||
299 | !isNaN( obj - parseFloat( obj ) ); | ||
300 | }, | ||
301 | |||
302 | isPlainObject: function( obj ) { | ||
303 | var proto, Ctor; | ||
304 | |||
305 | // Detect obvious negatives | ||
306 | // Use toString instead of jQuery.type to catch host objects | ||
307 | if ( !obj || toString.call( obj ) !== "[object Object]" ) { | ||
308 | return false; | ||
309 | } | ||
310 | |||
311 | proto = getProto( obj ); | ||
312 | |||
313 | // Objects with no prototype (e.g., `Object.create( null )`) are plain | ||
314 | if ( !proto ) { | ||
315 | return true; | ||
316 | } | ||
317 | |||
318 | // Objects with prototype are plain iff they were constructed by a global Object function | ||
319 | Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; | ||
320 | return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; | ||
321 | }, | ||
322 | |||
323 | isEmptyObject: function( obj ) { | ||
324 | |||
325 | /* eslint-disable no-unused-vars */ | ||
326 | // See https://github.com/eslint/eslint/issues/6125 | ||
327 | var name; | ||
328 | |||
329 | for ( name in obj ) { | ||
330 | return false; | ||
331 | } | ||
332 | return true; | ||
333 | }, | ||
334 | |||
335 | type: function( obj ) { | ||
336 | if ( obj == null ) { | ||
337 | return obj + ""; | ||
338 | } | ||
339 | |||
340 | // Support: Android <=2.3 only (functionish RegExp) | ||
341 | return typeof obj === "object" || typeof obj === "function" ? | ||
342 | class2type[ toString.call( obj ) ] || "object" : | ||
343 | typeof obj; | ||
344 | }, | ||
345 | |||
346 | // Evaluates a script in a global context | ||
347 | globalEval: function( code ) { | ||
348 | DOMEval( code ); | ||
349 | }, | ||
350 | |||
351 | // Convert dashed to camelCase; used by the css and data modules | ||
352 | // Support: IE <=9 - 11, Edge 12 - 13 | ||
353 | // Microsoft forgot to hump their vendor prefix (#9572) | ||
354 | camelCase: function( string ) { | ||
355 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | ||
356 | }, | ||
357 | |||
358 | nodeName: function( elem, name ) { | ||
359 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | ||
360 | }, | ||
361 | |||
362 | each: function( obj, callback ) { | ||
363 | var length, i = 0; | ||
364 | |||
365 | if ( isArrayLike( obj ) ) { | ||
366 | length = obj.length; | ||
367 | for ( ; i < length; i++ ) { | ||
368 | if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { | ||
369 | break; | ||
370 | } | ||
371 | } | ||
372 | } else { | ||
373 | for ( i in obj ) { | ||
374 | if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { | ||
375 | break; | ||
376 | } | ||
377 | } | ||
378 | } | ||
379 | |||
380 | return obj; | ||
381 | }, | ||
382 | |||
383 | // Support: Android <=4.0 only | ||
384 | trim: function( text ) { | ||
385 | return text == null ? | ||
386 | "" : | ||
387 | ( text + "" ).replace( rtrim, "" ); | ||
388 | }, | ||
389 | |||
390 | // results is for internal usage only | ||
391 | makeArray: function( arr, results ) { | ||
392 | var ret = results || []; | ||
393 | |||
394 | if ( arr != null ) { | ||
395 | if ( isArrayLike( Object( arr ) ) ) { | ||
396 | jQuery.merge( ret, | ||
397 | typeof arr === "string" ? | ||
398 | [ arr ] : arr | ||
399 | ); | ||
400 | } else { | ||
401 | push.call( ret, arr ); | ||
402 | } | ||
403 | } | ||
404 | |||
405 | return ret; | ||
406 | }, | ||
407 | |||
408 | inArray: function( elem, arr, i ) { | ||
409 | return arr == null ? -1 : indexOf.call( arr, elem, i ); | ||
410 | }, | ||
411 | |||
412 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
413 | // push.apply(_, arraylike) throws on ancient WebKit | ||
414 | merge: function( first, second ) { | ||
415 | var len = +second.length, | ||
416 | j = 0, | ||
417 | i = first.length; | ||
418 | |||
419 | for ( ; j < len; j++ ) { | ||
420 | first[ i++ ] = second[ j ]; | ||
421 | } | ||
422 | |||
423 | first.length = i; | ||
424 | |||
425 | return first; | ||
426 | }, | ||
427 | |||
428 | grep: function( elems, callback, invert ) { | ||
429 | var callbackInverse, | ||
430 | matches = [], | ||
431 | i = 0, | ||
432 | length = elems.length, | ||
433 | callbackExpect = !invert; | ||
434 | |||
435 | // Go through the array, only saving the items | ||
436 | // that pass the validator function | ||
437 | for ( ; i < length; i++ ) { | ||
438 | callbackInverse = !callback( elems[ i ], i ); | ||
439 | if ( callbackInverse !== callbackExpect ) { | ||
440 | matches.push( elems[ i ] ); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | return matches; | ||
445 | }, | ||
446 | |||
447 | // arg is for internal usage only | ||
448 | map: function( elems, callback, arg ) { | ||
449 | var length, value, | ||
450 | i = 0, | ||
451 | ret = []; | ||
452 | |||
453 | // Go through the array, translating each of the items to their new values | ||
454 | if ( isArrayLike( elems ) ) { | ||
455 | length = elems.length; | ||
456 | for ( ; i < length; i++ ) { | ||
457 | value = callback( elems[ i ], i, arg ); | ||
458 | |||
459 | if ( value != null ) { | ||
460 | ret.push( value ); | ||
461 | } | ||
462 | } | ||
463 | |||
464 | // Go through every key on the object, | ||
465 | } else { | ||
466 | for ( i in elems ) { | ||
467 | value = callback( elems[ i ], i, arg ); | ||
468 | |||
469 | if ( value != null ) { | ||
470 | ret.push( value ); | ||
471 | } | ||
472 | } | ||
473 | } | ||
474 | |||
475 | // Flatten any nested arrays | ||
476 | return concat.apply( [], ret ); | ||
477 | }, | ||
478 | |||
479 | // A global GUID counter for objects | ||
480 | guid: 1, | ||
481 | |||
482 | // Bind a function to a context, optionally partially applying any | ||
483 | // arguments. | ||
484 | proxy: function( fn, context ) { | ||
485 | var tmp, args, proxy; | ||
486 | |||
487 | if ( typeof context === "string" ) { | ||
488 | tmp = fn[ context ]; | ||
489 | context = fn; | ||
490 | fn = tmp; | ||
491 | } | ||
492 | |||
493 | // Quick check to determine if target is callable, in the spec | ||
494 | // this throws a TypeError, but we will just return undefined. | ||
495 | if ( !jQuery.isFunction( fn ) ) { | ||
496 | return undefined; | ||
497 | } | ||
498 | |||
499 | // Simulated bind | ||
500 | args = slice.call( arguments, 2 ); | ||
501 | proxy = function() { | ||
502 | return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); | ||
503 | }; | ||
504 | |||
505 | // Set the guid of unique handler to the same of original handler, so it can be removed | ||
506 | proxy.guid = fn.guid = fn.guid || jQuery.guid++; | ||
507 | |||
508 | return proxy; | ||
509 | }, | ||
510 | |||
511 | now: Date.now, | ||
512 | |||
513 | // jQuery.support is not used in Core but other projects attach their | ||
514 | // properties to it so it needs to exist. | ||
515 | support: support | ||
516 | } ); | ||
517 | |||
518 | if ( typeof Symbol === "function" ) { | ||
519 | jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; | ||
520 | } | ||
521 | |||
522 | // Populate the class2type map | ||
523 | jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), | ||
524 | function( i, name ) { | ||
525 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); | ||
526 | } ); | ||
527 | |||
528 | function isArrayLike( obj ) { | ||
529 | |||
530 | // Support: real iOS 8.2 only (not reproducible in simulator) | ||
531 | // `in` check used to prevent JIT error (gh-2145) | ||
532 | // hasOwn isn't used here due to false negatives | ||
533 | // regarding Nodelist length in IE | ||
534 | var length = !!obj && "length" in obj && obj.length, | ||
535 | type = jQuery.type( obj ); | ||
536 | |||
537 | if ( type === "function" || jQuery.isWindow( obj ) ) { | ||
538 | return false; | ||
539 | } | ||
540 | |||
541 | return type === "array" || length === 0 || | ||
542 | typeof length === "number" && length > 0 && ( length - 1 ) in obj; | ||
543 | } | ||
544 | var Sizzle = | ||
545 | /*! | ||
546 | * Sizzle CSS Selector Engine v2.3.0 | ||
547 | * https://sizzlejs.com/ | ||
548 | * | ||
549 | * Copyright jQuery Foundation and other contributors | ||
550 | * Released under the MIT license | ||
551 | * http://jquery.org/license | ||
552 | * | ||
553 | * Date: 2016-01-04 | ||
554 | */ | ||
555 | (function( window ) { | ||
556 | |||
557 | var i, | ||
558 | support, | ||
559 | Expr, | ||
560 | getText, | ||
561 | isXML, | ||
562 | tokenize, | ||
563 | compile, | ||
564 | select, | ||
565 | outermostContext, | ||
566 | sortInput, | ||
567 | hasDuplicate, | ||
568 | |||
569 | // Local document vars | ||
570 | setDocument, | ||
571 | document, | ||
572 | docElem, | ||
573 | documentIsHTML, | ||
574 | rbuggyQSA, | ||
575 | rbuggyMatches, | ||
576 | matches, | ||
577 | contains, | ||
578 | |||
579 | // Instance-specific data | ||
580 | expando = "sizzle" + 1 * new Date(), | ||
581 | preferredDoc = window.document, | ||
582 | dirruns = 0, | ||
583 | done = 0, | ||
584 | classCache = createCache(), | ||
585 | tokenCache = createCache(), | ||
586 | compilerCache = createCache(), | ||
587 | sortOrder = function( a, b ) { | ||
588 | if ( a === b ) { | ||
589 | hasDuplicate = true; | ||
590 | } | ||
591 | return 0; | ||
592 | }, | ||
593 | |||
594 | // Instance methods | ||
595 | hasOwn = ({}).hasOwnProperty, | ||
596 | arr = [], | ||
597 | pop = arr.pop, | ||
598 | push_native = arr.push, | ||
599 | push = arr.push, | ||
600 | slice = arr.slice, | ||
601 | // Use a stripped-down indexOf as it's faster than native | ||
602 | // https://jsperf.com/thor-indexof-vs-for/5 | ||
603 | indexOf = function( list, elem ) { | ||
604 | var i = 0, | ||
605 | len = list.length; | ||
606 | for ( ; i < len; i++ ) { | ||
607 | if ( list[i] === elem ) { | ||
608 | return i; | ||
609 | } | ||
610 | } | ||
611 | return -1; | ||
612 | }, | ||
613 | |||
614 | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | ||
615 | |||
616 | // Regular expressions | ||
617 | |||
618 | // http://www.w3.org/TR/css3-selectors/#whitespace | ||
619 | whitespace = "[\\x20\\t\\r\\n\\f]", | ||
620 | |||
621 | // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | ||
622 | identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", | ||
623 | |||
624 | // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors | ||
625 | attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + | ||
626 | // Operator (capture 2) | ||
627 | "*([*^$|!~]?=)" + whitespace + | ||
628 | // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" | ||
629 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + | ||
630 | "*\\]", | ||
631 | |||
632 | pseudos = ":(" + identifier + ")(?:\\((" + | ||
633 | // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: | ||
634 | // 1. quoted (capture 3; capture 4 or capture 5) | ||
635 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + | ||
636 | // 2. simple (capture 6) | ||
637 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + | ||
638 | // 3. anything else (capture 2) | ||
639 | ".*" + | ||
640 | ")\\)|)", | ||
641 | |||
642 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | ||
643 | rwhitespace = new RegExp( whitespace + "+", "g" ), | ||
644 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), | ||
645 | |||
646 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), | ||
647 | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), | ||
648 | |||
649 | rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), | ||
650 | |||
651 | rpseudo = new RegExp( pseudos ), | ||
652 | ridentifier = new RegExp( "^" + identifier + "$" ), | ||
653 | |||
654 | matchExpr = { | ||
655 | "ID": new RegExp( "^#(" + identifier + ")" ), | ||
656 | "CLASS": new RegExp( "^\\.(" + identifier + ")" ), | ||
657 | "TAG": new RegExp( "^(" + identifier + "|[*])" ), | ||
658 | "ATTR": new RegExp( "^" + attributes ), | ||
659 | "PSEUDO": new RegExp( "^" + pseudos ), | ||
660 | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + | ||
661 | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | ||
662 | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), | ||
663 | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), | ||
664 | // For use in libraries implementing .is() | ||
665 | // We use this for POS matching in `select` | ||
666 | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | ||
667 | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | ||
668 | }, | ||
669 | |||
670 | rinputs = /^(?:input|select|textarea|button)$/i, | ||
671 | rheader = /^h\d$/i, | ||
672 | |||
673 | rnative = /^[^{]+\{\s*\[native \w/, | ||
674 | |||
675 | // Easily-parseable/retrievable ID or TAG or CLASS selectors | ||
676 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | ||
677 | |||
678 | rsibling = /[+~]/, | ||
679 | |||
680 | // CSS escapes | ||
681 | // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | ||
682 | runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), | ||
683 | funescape = function( _, escaped, escapedWhitespace ) { | ||
684 | var high = "0x" + escaped - 0x10000; | ||
685 | // NaN means non-codepoint | ||
686 | // Support: Firefox<24 | ||
687 | // Workaround erroneous numeric interpretation of +"0x" | ||
688 | return high !== high || escapedWhitespace ? | ||
689 | escaped : | ||
690 | high < 0 ? | ||
691 | // BMP codepoint | ||
692 | String.fromCharCode( high + 0x10000 ) : | ||
693 | // Supplemental Plane codepoint (surrogate pair) | ||
694 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); | ||
695 | }, | ||
696 | |||
697 | // CSS string/identifier serialization | ||
698 | // https://drafts.csswg.org/cssom/#common-serializing-idioms | ||
699 | rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, | ||
700 | fcssescape = function( ch, asCodePoint ) { | ||
701 | if ( asCodePoint ) { | ||
702 | |||
703 | // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER | ||
704 | if ( ch === "\0" ) { | ||
705 | return "\uFFFD"; | ||
706 | } | ||
707 | |||
708 | // Control characters and (dependent upon position) numbers get escaped as code points | ||
709 | return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; | ||
710 | } | ||
711 | |||
712 | // Other potentially-special ASCII characters get backslash-escaped | ||
713 | return "\\" + ch; | ||
714 | }, | ||
715 | |||
716 | // Used for iframes | ||
717 | // See setDocument() | ||
718 | // Removing the function wrapper causes a "Permission Denied" | ||
719 | // error in IE | ||
720 | unloadHandler = function() { | ||
721 | setDocument(); | ||
722 | }, | ||
723 | |||
724 | disabledAncestor = addCombinator( | ||
725 | function( elem ) { | ||
726 | return elem.disabled === true; | ||
727 | }, | ||
728 | { dir: "parentNode", next: "legend" } | ||
729 | ); | ||
730 | |||
731 | // Optimize for push.apply( _, NodeList ) | ||
732 | try { | ||
733 | push.apply( | ||
734 | (arr = slice.call( preferredDoc.childNodes )), | ||
735 | preferredDoc.childNodes | ||
736 | ); | ||
737 | // Support: Android<4.0 | ||
738 | // Detect silently failing push.apply | ||
739 | arr[ preferredDoc.childNodes.length ].nodeType; | ||
740 | } catch ( e ) { | ||
741 | push = { apply: arr.length ? | ||
742 | |||
743 | // Leverage slice if possible | ||
744 | function( target, els ) { | ||
745 | push_native.apply( target, slice.call(els) ); | ||
746 | } : | ||
747 | |||
748 | // Support: IE<9 | ||
749 | // Otherwise append directly | ||
750 | function( target, els ) { | ||
751 | var j = target.length, | ||
752 | i = 0; | ||
753 | // Can't trust NodeList.length | ||
754 | while ( (target[j++] = els[i++]) ) {} | ||
755 | target.length = j - 1; | ||
756 | } | ||
757 | }; | ||
758 | } | ||
759 | |||
760 | function Sizzle( selector, context, results, seed ) { | ||
761 | var m, i, elem, nid, match, groups, newSelector, | ||
762 | newContext = context && context.ownerDocument, | ||
763 | |||
764 | // nodeType defaults to 9, since context defaults to document | ||
765 | nodeType = context ? context.nodeType : 9; | ||
766 | |||
767 | results = results || []; | ||
768 | |||
769 | // Return early from calls with invalid selector or context | ||
770 | if ( typeof selector !== "string" || !selector || | ||
771 | nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { | ||
772 | |||
773 | return results; | ||
774 | } | ||
775 | |||
776 | // Try to shortcut find operations (as opposed to filters) in HTML documents | ||
777 | if ( !seed ) { | ||
778 | |||
779 | if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { | ||
780 | setDocument( context ); | ||
781 | } | ||
782 | context = context || document; | ||
783 | |||
784 | if ( documentIsHTML ) { | ||
785 | |||
786 | // If the selector is sufficiently simple, try using a "get*By*" DOM method | ||
787 | // (excepting DocumentFragment context, where the methods don't exist) | ||
788 | if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { | ||
789 | |||
790 | // ID selector | ||
791 | if ( (m = match[1]) ) { | ||
792 | |||
793 | // Document context | ||
794 | if ( nodeType === 9 ) { | ||
795 | if ( (elem = context.getElementById( m )) ) { | ||
796 | |||
797 | // Support: IE, Opera, Webkit | ||
798 | // TODO: identify versions | ||
799 | // getElementById can match elements by name instead of ID | ||
800 | if ( elem.id === m ) { | ||
801 | results.push( elem ); | ||
802 | return results; | ||
803 | } | ||
804 | } else { | ||
805 | return results; | ||
806 | } | ||
807 | |||
808 | // Element context | ||
809 | } else { | ||
810 | |||
811 | // Support: IE, Opera, Webkit | ||
812 | // TODO: identify versions | ||
813 | // getElementById can match elements by name instead of ID | ||
814 | if ( newContext && (elem = newContext.getElementById( m )) && | ||
815 | contains( context, elem ) && | ||
816 | elem.id === m ) { | ||
817 | |||
818 | results.push( elem ); | ||
819 | return results; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | // Type selector | ||
824 | } else if ( match[2] ) { | ||
825 | push.apply( results, context.getElementsByTagName( selector ) ); | ||
826 | return results; | ||
827 | |||
828 | // Class selector | ||
829 | } else if ( (m = match[3]) && support.getElementsByClassName && | ||
830 | context.getElementsByClassName ) { | ||
831 | |||
832 | push.apply( results, context.getElementsByClassName( m ) ); | ||
833 | return results; | ||
834 | } | ||
835 | } | ||
836 | |||
837 | // Take advantage of querySelectorAll | ||
838 | if ( support.qsa && | ||
839 | !compilerCache[ selector + " " ] && | ||
840 | (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { | ||
841 | |||
842 | if ( nodeType !== 1 ) { | ||
843 | newContext = context; | ||
844 | newSelector = selector; | ||
845 | |||
846 | // qSA looks outside Element context, which is not what we want | ||
847 | // Thanks to Andrew Dupont for this workaround technique | ||
848 | // Support: IE <=8 | ||
849 | // Exclude object elements | ||
850 | } else if ( context.nodeName.toLowerCase() !== "object" ) { | ||
851 | |||
852 | // Capture the context ID, setting it first if necessary | ||
853 | if ( (nid = context.getAttribute( "id" )) ) { | ||
854 | nid = nid.replace( rcssescape, fcssescape ); | ||
855 | } else { | ||
856 | context.setAttribute( "id", (nid = expando) ); | ||
857 | } | ||
858 | |||
859 | // Prefix every selector in the list | ||
860 | groups = tokenize( selector ); | ||
861 | i = groups.length; | ||
862 | while ( i-- ) { | ||
863 | groups[i] = "#" + nid + " " + toSelector( groups[i] ); | ||
864 | } | ||
865 | newSelector = groups.join( "," ); | ||
866 | |||
867 | // Expand context for sibling selectors | ||
868 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || | ||
869 | context; | ||
870 | } | ||
871 | |||
872 | if ( newSelector ) { | ||
873 | try { | ||
874 | push.apply( results, | ||
875 | newContext.querySelectorAll( newSelector ) | ||
876 | ); | ||
877 | return results; | ||
878 | } catch ( qsaError ) { | ||
879 | } finally { | ||
880 | if ( nid === expando ) { | ||
881 | context.removeAttribute( "id" ); | ||
882 | } | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | } | ||
887 | } | ||
888 | |||
889 | // All others | ||
890 | return select( selector.replace( rtrim, "$1" ), context, results, seed ); | ||
891 | } | ||
892 | |||
893 | /** | ||
894 | * Create key-value caches of limited size | ||
895 | * @returns {function(string, object)} Returns the Object data after storing it on itself with | ||
896 | * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) | ||
897 | * deleting the oldest entry | ||
898 | */ | ||
899 | function createCache() { | ||
900 | var keys = []; | ||
901 | |||
902 | function cache( key, value ) { | ||
903 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) | ||
904 | if ( keys.push( key + " " ) > Expr.cacheLength ) { | ||
905 | // Only keep the most recent entries | ||
906 | delete cache[ keys.shift() ]; | ||
907 | } | ||
908 | return (cache[ key + " " ] = value); | ||
909 | } | ||
910 | return cache; | ||
911 | } | ||
912 | |||
913 | /** | ||
914 | * Mark a function for special use by Sizzle | ||
915 | * @param {Function} fn The function to mark | ||
916 | */ | ||
917 | function markFunction( fn ) { | ||
918 | fn[ expando ] = true; | ||
919 | return fn; | ||
920 | } | ||
921 | |||
922 | /** | ||
923 | * Support testing using an element | ||
924 | * @param {Function} fn Passed the created element and returns a boolean result | ||
925 | */ | ||
926 | function assert( fn ) { | ||
927 | var el = document.createElement("fieldset"); | ||
928 | |||
929 | try { | ||
930 | return !!fn( el ); | ||
931 | } catch (e) { | ||
932 | return false; | ||
933 | } finally { | ||
934 | // Remove from its parent by default | ||
935 | if ( el.parentNode ) { | ||
936 | el.parentNode.removeChild( el ); | ||
937 | } | ||
938 | // release memory in IE | ||
939 | el = null; | ||
940 | } | ||
941 | } | ||
942 | |||
943 | /** | ||
944 | * Adds the same handler for all of the specified attrs | ||
945 | * @param {String} attrs Pipe-separated list of attributes | ||
946 | * @param {Function} handler The method that will be applied | ||
947 | */ | ||
948 | function addHandle( attrs, handler ) { | ||
949 | var arr = attrs.split("|"), | ||
950 | i = arr.length; | ||
951 | |||
952 | while ( i-- ) { | ||
953 | Expr.attrHandle[ arr[i] ] = handler; | ||
954 | } | ||
955 | } | ||
956 | |||
957 | /** | ||
958 | * Checks document order of two siblings | ||
959 | * @param {Element} a | ||
960 | * @param {Element} b | ||
961 | * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | ||
962 | */ | ||
963 | function siblingCheck( a, b ) { | ||
964 | var cur = b && a, | ||
965 | diff = cur && a.nodeType === 1 && b.nodeType === 1 && | ||
966 | a.sourceIndex - b.sourceIndex; | ||
967 | |||
968 | // Use IE sourceIndex if available on both nodes | ||
969 | if ( diff ) { | ||
970 | return diff; | ||
971 | } | ||
972 | |||
973 | // Check if b follows a | ||
974 | if ( cur ) { | ||
975 | while ( (cur = cur.nextSibling) ) { | ||
976 | if ( cur === b ) { | ||
977 | return -1; | ||
978 | } | ||
979 | } | ||
980 | } | ||
981 | |||
982 | return a ? 1 : -1; | ||
983 | } | ||
984 | |||
985 | /** | ||
986 | * Returns a function to use in pseudos for input types | ||
987 | * @param {String} type | ||
988 | */ | ||
989 | function createInputPseudo( type ) { | ||
990 | return function( elem ) { | ||
991 | var name = elem.nodeName.toLowerCase(); | ||
992 | return name === "input" && elem.type === type; | ||
993 | }; | ||
994 | } | ||
995 | |||
996 | /** | ||
997 | * Returns a function to use in pseudos for buttons | ||
998 | * @param {String} type | ||
999 | */ | ||
1000 | function createButtonPseudo( type ) { | ||
1001 | return function( elem ) { | ||
1002 | var name = elem.nodeName.toLowerCase(); | ||
1003 | return (name === "input" || name === "button") && elem.type === type; | ||
1004 | }; | ||
1005 | } | ||
1006 | |||
1007 | /** | ||
1008 | * Returns a function to use in pseudos for :enabled/:disabled | ||
1009 | * @param {Boolean} disabled true for :disabled; false for :enabled | ||
1010 | */ | ||
1011 | function createDisabledPseudo( disabled ) { | ||
1012 | // Known :disabled false positives: | ||
1013 | // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) | ||
1014 | // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable | ||
1015 | return function( elem ) { | ||
1016 | |||
1017 | // Check form elements and option elements for explicit disabling | ||
1018 | return "label" in elem && elem.disabled === disabled || | ||
1019 | "form" in elem && elem.disabled === disabled || | ||
1020 | |||
1021 | // Check non-disabled form elements for fieldset[disabled] ancestors | ||
1022 | "form" in elem && elem.disabled === false && ( | ||
1023 | // Support: IE6-11+ | ||
1024 | // Ancestry is covered for us | ||
1025 | elem.isDisabled === disabled || | ||
1026 | |||
1027 | // Otherwise, assume any non-<option> under fieldset[disabled] is disabled | ||
1028 | /* jshint -W018 */ | ||
1029 | elem.isDisabled !== !disabled && | ||
1030 | ("label" in elem || !disabledAncestor( elem )) !== disabled | ||
1031 | ); | ||
1032 | }; | ||
1033 | } | ||
1034 | |||
1035 | /** | ||
1036 | * Returns a function to use in pseudos for positionals | ||
1037 | * @param {Function} fn | ||
1038 | */ | ||
1039 | function createPositionalPseudo( fn ) { | ||
1040 | return markFunction(function( argument ) { | ||
1041 | argument = +argument; | ||
1042 | return markFunction(function( seed, matches ) { | ||
1043 | var j, | ||
1044 | matchIndexes = fn( [], seed.length, argument ), | ||
1045 | i = matchIndexes.length; | ||
1046 | |||
1047 | // Match elements found at the specified indexes | ||
1048 | while ( i-- ) { | ||
1049 | if ( seed[ (j = matchIndexes[i]) ] ) { | ||
1050 | seed[j] = !(matches[j] = seed[j]); | ||
1051 | } | ||
1052 | } | ||
1053 | }); | ||
1054 | }); | ||
1055 | } | ||
1056 | |||
1057 | /** | ||
1058 | * Checks a node for validity as a Sizzle context | ||
1059 | * @param {Element|Object=} context | ||
1060 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | ||
1061 | */ | ||
1062 | function testContext( context ) { | ||
1063 | return context && typeof context.getElementsByTagName !== "undefined" && context; | ||
1064 | } | ||
1065 | |||
1066 | // Expose support vars for convenience | ||
1067 | support = Sizzle.support = {}; | ||
1068 | |||
1069 | /** | ||
1070 | * Detects XML nodes | ||
1071 | * @param {Element|Object} elem An element or a document | ||
1072 | * @returns {Boolean} True iff elem is a non-HTML XML node | ||
1073 | */ | ||
1074 | isXML = Sizzle.isXML = function( elem ) { | ||
1075 | // documentElement is verified for cases where it doesn't yet exist | ||
1076 | // (such as loading iframes in IE - #4833) | ||
1077 | var documentElement = elem && (elem.ownerDocument || elem).documentElement; | ||
1078 | return documentElement ? documentElement.nodeName !== "HTML" : false; | ||
1079 | }; | ||
1080 | |||
1081 | /** | ||
1082 | * Sets document-related variables once based on the current document | ||
1083 | * @param {Element|Object} [doc] An element or document object to use to set the document | ||
1084 | * @returns {Object} Returns the current document | ||
1085 | */ | ||
1086 | setDocument = Sizzle.setDocument = function( node ) { | ||
1087 | var hasCompare, subWindow, | ||
1088 | doc = node ? node.ownerDocument || node : preferredDoc; | ||
1089 | |||
1090 | // Return early if doc is invalid or already selected | ||
1091 | if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { | ||
1092 | return document; | ||
1093 | } | ||
1094 | |||
1095 | // Update global variables | ||
1096 | document = doc; | ||
1097 | docElem = document.documentElement; | ||
1098 | documentIsHTML = !isXML( document ); | ||
1099 | |||
1100 | // Support: IE 9-11, Edge | ||
1101 | // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) | ||
1102 | if ( preferredDoc !== document && | ||
1103 | (subWindow = document.defaultView) && subWindow.top !== subWindow ) { | ||
1104 | |||
1105 | // Support: IE 11, Edge | ||
1106 | if ( subWindow.addEventListener ) { | ||
1107 | subWindow.addEventListener( "unload", unloadHandler, false ); | ||
1108 | |||
1109 | // Support: IE 9 - 10 only | ||
1110 | } else if ( subWindow.attachEvent ) { | ||
1111 | subWindow.attachEvent( "onunload", unloadHandler ); | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | /* Attributes | ||
1116 | ---------------------------------------------------------------------- */ | ||
1117 | |||
1118 | // Support: IE<8 | ||
1119 | // Verify that getAttribute really returns attributes and not properties | ||
1120 | // (excepting IE8 booleans) | ||
1121 | support.attributes = assert(function( el ) { | ||
1122 | el.className = "i"; | ||
1123 | return !el.getAttribute("className"); | ||
1124 | }); | ||
1125 | |||
1126 | /* getElement(s)By* | ||
1127 | ---------------------------------------------------------------------- */ | ||
1128 | |||
1129 | // Check if getElementsByTagName("*") returns only elements | ||
1130 | support.getElementsByTagName = assert(function( el ) { | ||
1131 | el.appendChild( document.createComment("") ); | ||
1132 | return !el.getElementsByTagName("*").length; | ||
1133 | }); | ||
1134 | |||
1135 | // Support: IE<9 | ||
1136 | support.getElementsByClassName = rnative.test( document.getElementsByClassName ); | ||
1137 | |||
1138 | // Support: IE<10 | ||
1139 | // Check if getElementById returns elements by name | ||
1140 | // The broken getElementById methods don't pick up programmatically-set names, | ||
1141 | // so use a roundabout getElementsByName test | ||
1142 | support.getById = assert(function( el ) { | ||
1143 | docElem.appendChild( el ).id = expando; | ||
1144 | return !document.getElementsByName || !document.getElementsByName( expando ).length; | ||
1145 | }); | ||
1146 | |||
1147 | // ID find and filter | ||
1148 | if ( support.getById ) { | ||
1149 | Expr.find["ID"] = function( id, context ) { | ||
1150 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { | ||
1151 | var m = context.getElementById( id ); | ||
1152 | return m ? [ m ] : []; | ||
1153 | } | ||
1154 | }; | ||
1155 | Expr.filter["ID"] = function( id ) { | ||
1156 | var attrId = id.replace( runescape, funescape ); | ||
1157 | return function( elem ) { | ||
1158 | return elem.getAttribute("id") === attrId; | ||
1159 | }; | ||
1160 | }; | ||
1161 | } else { | ||
1162 | // Support: IE6/7 | ||
1163 | // getElementById is not reliable as a find shortcut | ||
1164 | delete Expr.find["ID"]; | ||
1165 | |||
1166 | Expr.filter["ID"] = function( id ) { | ||
1167 | var attrId = id.replace( runescape, funescape ); | ||
1168 | return function( elem ) { | ||
1169 | var node = typeof elem.getAttributeNode !== "undefined" && | ||
1170 | elem.getAttributeNode("id"); | ||
1171 | return node && node.value === attrId; | ||
1172 | }; | ||
1173 | }; | ||
1174 | } | ||
1175 | |||
1176 | // Tag | ||
1177 | Expr.find["TAG"] = support.getElementsByTagName ? | ||
1178 | function( tag, context ) { | ||
1179 | if ( typeof context.getElementsByTagName !== "undefined" ) { | ||
1180 | return context.getElementsByTagName( tag ); | ||
1181 | |||
1182 | // DocumentFragment nodes don't have gEBTN | ||
1183 | } else if ( support.qsa ) { | ||
1184 | return context.querySelectorAll( tag ); | ||
1185 | } | ||
1186 | } : | ||
1187 | |||
1188 | function( tag, context ) { | ||
1189 | var elem, | ||
1190 | tmp = [], | ||
1191 | i = 0, | ||
1192 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too | ||
1193 | results = context.getElementsByTagName( tag ); | ||
1194 | |||
1195 | // Filter out possible comments | ||
1196 | if ( tag === "*" ) { | ||
1197 | while ( (elem = results[i++]) ) { | ||
1198 | if ( elem.nodeType === 1 ) { | ||
1199 | tmp.push( elem ); | ||
1200 | } | ||
1201 | } | ||
1202 | |||
1203 | return tmp; | ||
1204 | } | ||
1205 | return results; | ||
1206 | }; | ||
1207 | |||
1208 | // Class | ||
1209 | Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { | ||
1210 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { | ||
1211 | return context.getElementsByClassName( className ); | ||
1212 | } | ||
1213 | }; | ||
1214 | |||
1215 | /* QSA/matchesSelector | ||
1216 | ---------------------------------------------------------------------- */ | ||
1217 | |||
1218 | // QSA and matchesSelector support | ||
1219 | |||
1220 | // matchesSelector(:active) reports false when true (IE9/Opera 11.5) | ||
1221 | rbuggyMatches = []; | ||
1222 | |||
1223 | // qSa(:focus) reports false when true (Chrome 21) | ||
1224 | // We allow this because of a bug in IE8/9 that throws an error | ||
1225 | // whenever `document.activeElement` is accessed on an iframe | ||
1226 | // So, we allow :focus to pass through QSA all the time to avoid the IE error | ||
1227 | // See https://bugs.jquery.com/ticket/13378 | ||
1228 | rbuggyQSA = []; | ||
1229 | |||
1230 | if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { | ||
1231 | // Build QSA regex | ||
1232 | // Regex strategy adopted from Diego Perini | ||
1233 | assert(function( el ) { | ||
1234 | // Select is set to empty string on purpose | ||
1235 | // This is to test IE's treatment of not explicitly | ||
1236 | // setting a boolean content attribute, | ||
1237 | // since its presence should be enough | ||
1238 | // https://bugs.jquery.com/ticket/12359 | ||
1239 | docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + | ||
1240 | "<select id='" + expando + "-\r\\' msallowcapture=''>" + | ||
1241 | "<option selected=''></option></select>"; | ||
1242 | |||
1243 | // Support: IE8, Opera 11-12.16 | ||
1244 | // Nothing should be selected when empty strings follow ^= or $= or *= | ||
1245 | // The test attribute must be unknown in Opera but "safe" for WinRT | ||
1246 | // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section | ||
1247 | if ( el.querySelectorAll("[msallowcapture^='']").length ) { | ||
1248 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | ||
1249 | } | ||
1250 | |||
1251 | // Support: IE8 | ||
1252 | // Boolean attributes and "value" are not treated correctly | ||
1253 | if ( !el.querySelectorAll("[selected]").length ) { | ||
1254 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | ||
1255 | } | ||
1256 | |||
1257 | // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ | ||
1258 | if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { | ||
1259 | rbuggyQSA.push("~="); | ||
1260 | } | ||
1261 | |||
1262 | // Webkit/Opera - :checked should return selected option elements | ||
1263 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
1264 | // IE8 throws error here and will not see later tests | ||
1265 | if ( !el.querySelectorAll(":checked").length ) { | ||
1266 | rbuggyQSA.push(":checked"); | ||
1267 | } | ||
1268 | |||
1269 | // Support: Safari 8+, iOS 8+ | ||
1270 | // https://bugs.webkit.org/show_bug.cgi?id=136851 | ||
1271 | // In-page `selector#id sibling-combinator selector` fails | ||
1272 | if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { | ||
1273 | rbuggyQSA.push(".#.+[+~]"); | ||
1274 | } | ||
1275 | }); | ||
1276 | |||
1277 | assert(function( el ) { | ||
1278 | el.innerHTML = "<a href='' disabled='disabled'></a>" + | ||
1279 | "<select disabled='disabled'><option/></select>"; | ||
1280 | |||
1281 | // Support: Windows 8 Native Apps | ||
1282 | // The type and name attributes are restricted during .innerHTML assignment | ||
1283 | var input = document.createElement("input"); | ||
1284 | input.setAttribute( "type", "hidden" ); | ||
1285 | el.appendChild( input ).setAttribute( "name", "D" ); | ||
1286 | |||
1287 | // Support: IE8 | ||
1288 | // Enforce case-sensitivity of name attribute | ||
1289 | if ( el.querySelectorAll("[name=d]").length ) { | ||
1290 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); | ||
1291 | } | ||
1292 | |||
1293 | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) | ||
1294 | // IE8 throws error here and will not see later tests | ||
1295 | if ( el.querySelectorAll(":enabled").length !== 2 ) { | ||
1296 | rbuggyQSA.push( ":enabled", ":disabled" ); | ||
1297 | } | ||
1298 | |||
1299 | // Support: IE9-11+ | ||
1300 | // IE's :disabled selector does not pick up the children of disabled fieldsets | ||
1301 | docElem.appendChild( el ).disabled = true; | ||
1302 | if ( el.querySelectorAll(":disabled").length !== 2 ) { | ||
1303 | rbuggyQSA.push( ":enabled", ":disabled" ); | ||
1304 | } | ||
1305 | |||
1306 | // Opera 10-11 does not throw on post-comma invalid pseudos | ||
1307 | el.querySelectorAll("*,:x"); | ||
1308 | rbuggyQSA.push(",.*:"); | ||
1309 | }); | ||
1310 | } | ||
1311 | |||
1312 | if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || | ||
1313 | docElem.webkitMatchesSelector || | ||
1314 | docElem.mozMatchesSelector || | ||
1315 | docElem.oMatchesSelector || | ||
1316 | docElem.msMatchesSelector) )) ) { | ||
1317 | |||
1318 | assert(function( el ) { | ||
1319 | // Check to see if it's possible to do matchesSelector | ||
1320 | // on a disconnected node (IE 9) | ||
1321 | support.disconnectedMatch = matches.call( el, "*" ); | ||
1322 | |||
1323 | // This should fail with an exception | ||
1324 | // Gecko does not error, returns false instead | ||
1325 | matches.call( el, "[s!='']:x" ); | ||
1326 | rbuggyMatches.push( "!=", pseudos ); | ||
1327 | }); | ||
1328 | } | ||
1329 | |||
1330 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); | ||
1331 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); | ||
1332 | |||
1333 | /* Contains | ||
1334 | ---------------------------------------------------------------------- */ | ||
1335 | hasCompare = rnative.test( docElem.compareDocumentPosition ); | ||
1336 | |||
1337 | // Element contains another | ||
1338 | // Purposefully self-exclusive | ||
1339 | // As in, an element does not contain itself | ||
1340 | contains = hasCompare || rnative.test( docElem.contains ) ? | ||
1341 | function( a, b ) { | ||
1342 | var adown = a.nodeType === 9 ? a.documentElement : a, | ||
1343 | bup = b && b.parentNode; | ||
1344 | return a === bup || !!( bup && bup.nodeType === 1 && ( | ||
1345 | adown.contains ? | ||
1346 | adown.contains( bup ) : | ||
1347 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 | ||
1348 | )); | ||
1349 | } : | ||
1350 | function( a, b ) { | ||
1351 | if ( b ) { | ||
1352 | while ( (b = b.parentNode) ) { | ||
1353 | if ( b === a ) { | ||
1354 | return true; | ||
1355 | } | ||
1356 | } | ||
1357 | } | ||
1358 | return false; | ||
1359 | }; | ||
1360 | |||
1361 | /* Sorting | ||
1362 | ---------------------------------------------------------------------- */ | ||
1363 | |||
1364 | // Document order sorting | ||
1365 | sortOrder = hasCompare ? | ||
1366 | function( a, b ) { | ||
1367 | |||
1368 | // Flag for duplicate removal | ||
1369 | if ( a === b ) { | ||
1370 | hasDuplicate = true; | ||
1371 | return 0; | ||
1372 | } | ||
1373 | |||
1374 | // Sort on method existence if only one input has compareDocumentPosition | ||
1375 | var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; | ||
1376 | if ( compare ) { | ||
1377 | return compare; | ||
1378 | } | ||
1379 | |||
1380 | // Calculate position if both inputs belong to the same document | ||
1381 | compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? | ||
1382 | a.compareDocumentPosition( b ) : | ||
1383 | |||
1384 | // Otherwise we know they are disconnected | ||
1385 | 1; | ||
1386 | |||
1387 | // Disconnected nodes | ||
1388 | if ( compare & 1 || | ||
1389 | (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { | ||
1390 | |||
1391 | // Choose the first element that is related to our preferred document | ||
1392 | if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { | ||
1393 | return -1; | ||
1394 | } | ||
1395 | if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { | ||
1396 | return 1; | ||
1397 | } | ||
1398 | |||
1399 | // Maintain original order | ||
1400 | return sortInput ? | ||
1401 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : | ||
1402 | 0; | ||
1403 | } | ||
1404 | |||
1405 | return compare & 4 ? -1 : 1; | ||
1406 | } : | ||
1407 | function( a, b ) { | ||
1408 | // Exit early if the nodes are identical | ||
1409 | if ( a === b ) { | ||
1410 | hasDuplicate = true; | ||
1411 | return 0; | ||
1412 | } | ||
1413 | |||
1414 | var cur, | ||
1415 | i = 0, | ||
1416 | aup = a.parentNode, | ||
1417 | bup = b.parentNode, | ||
1418 | ap = [ a ], | ||
1419 | bp = [ b ]; | ||
1420 | |||
1421 | // Parentless nodes are either documents or disconnected | ||
1422 | if ( !aup || !bup ) { | ||
1423 | return a === document ? -1 : | ||
1424 | b === document ? 1 : | ||
1425 | aup ? -1 : | ||
1426 | bup ? 1 : | ||
1427 | sortInput ? | ||
1428 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : | ||
1429 | 0; | ||
1430 | |||
1431 | // If the nodes are siblings, we can do a quick check | ||
1432 | } else if ( aup === bup ) { | ||
1433 | return siblingCheck( a, b ); | ||
1434 | } | ||
1435 | |||
1436 | // Otherwise we need full lists of their ancestors for comparison | ||
1437 | cur = a; | ||
1438 | while ( (cur = cur.parentNode) ) { | ||
1439 | ap.unshift( cur ); | ||
1440 | } | ||
1441 | cur = b; | ||
1442 | while ( (cur = cur.parentNode) ) { | ||
1443 | bp.unshift( cur ); | ||
1444 | } | ||
1445 | |||
1446 | // Walk down the tree looking for a discrepancy | ||
1447 | while ( ap[i] === bp[i] ) { | ||
1448 | i++; | ||
1449 | } | ||
1450 | |||
1451 | return i ? | ||
1452 | // Do a sibling check if the nodes have a common ancestor | ||
1453 | siblingCheck( ap[i], bp[i] ) : | ||
1454 | |||
1455 | // Otherwise nodes in our document sort first | ||
1456 | ap[i] === preferredDoc ? -1 : | ||
1457 | bp[i] === preferredDoc ? 1 : | ||
1458 | 0; | ||
1459 | }; | ||
1460 | |||
1461 | return document; | ||
1462 | }; | ||
1463 | |||
1464 | Sizzle.matches = function( expr, elements ) { | ||
1465 | return Sizzle( expr, null, null, elements ); | ||
1466 | }; | ||
1467 | |||
1468 | Sizzle.matchesSelector = function( elem, expr ) { | ||
1469 | // Set document vars if needed | ||
1470 | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
1471 | setDocument( elem ); | ||
1472 | } | ||
1473 | |||
1474 | // Make sure that attribute selectors are quoted | ||
1475 | expr = expr.replace( rattributeQuotes, "='$1']" ); | ||
1476 | |||
1477 | if ( support.matchesSelector && documentIsHTML && | ||
1478 | !compilerCache[ expr + " " ] && | ||
1479 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && | ||
1480 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { | ||
1481 | |||
1482 | try { | ||
1483 | var ret = matches.call( elem, expr ); | ||
1484 | |||
1485 | // IE 9's matchesSelector returns false on disconnected nodes | ||
1486 | if ( ret || support.disconnectedMatch || | ||
1487 | // As well, disconnected nodes are said to be in a document | ||
1488 | // fragment in IE 9 | ||
1489 | elem.document && elem.document.nodeType !== 11 ) { | ||
1490 | return ret; | ||
1491 | } | ||
1492 | } catch (e) {} | ||
1493 | } | ||
1494 | |||
1495 | return Sizzle( expr, document, null, [ elem ] ).length > 0; | ||
1496 | }; | ||
1497 | |||
1498 | Sizzle.contains = function( context, elem ) { | ||
1499 | // Set document vars if needed | ||
1500 | if ( ( context.ownerDocument || context ) !== document ) { | ||
1501 | setDocument( context ); | ||
1502 | } | ||
1503 | return contains( context, elem ); | ||
1504 | }; | ||
1505 | |||
1506 | Sizzle.attr = function( elem, name ) { | ||
1507 | // Set document vars if needed | ||
1508 | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
1509 | setDocument( elem ); | ||
1510 | } | ||
1511 | |||
1512 | var fn = Expr.attrHandle[ name.toLowerCase() ], | ||
1513 | // Don't get fooled by Object.prototype properties (jQuery #13807) | ||
1514 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? | ||
1515 | fn( elem, name, !documentIsHTML ) : | ||
1516 | undefined; | ||
1517 | |||
1518 | return val !== undefined ? | ||
1519 | val : | ||
1520 | support.attributes || !documentIsHTML ? | ||
1521 | elem.getAttribute( name ) : | ||
1522 | (val = elem.getAttributeNode(name)) && val.specified ? | ||
1523 | val.value : | ||
1524 | null; | ||
1525 | }; | ||
1526 | |||
1527 | Sizzle.escape = function( sel ) { | ||
1528 | return (sel + "").replace( rcssescape, fcssescape ); | ||
1529 | }; | ||
1530 | |||
1531 | Sizzle.error = function( msg ) { | ||
1532 | throw new Error( "Syntax error, unrecognized expression: " + msg ); | ||
1533 | }; | ||
1534 | |||
1535 | /** | ||
1536 | * Document sorting and removing duplicates | ||
1537 | * @param {ArrayLike} results | ||
1538 | */ | ||
1539 | Sizzle.uniqueSort = function( results ) { | ||
1540 | var elem, | ||
1541 | duplicates = [], | ||
1542 | j = 0, | ||
1543 | i = 0; | ||
1544 | |||
1545 | // Unless we *know* we can detect duplicates, assume their presence | ||
1546 | hasDuplicate = !support.detectDuplicates; | ||
1547 | sortInput = !support.sortStable && results.slice( 0 ); | ||
1548 | results.sort( sortOrder ); | ||
1549 | |||
1550 | if ( hasDuplicate ) { | ||
1551 | while ( (elem = results[i++]) ) { | ||
1552 | if ( elem === results[ i ] ) { | ||
1553 | j = duplicates.push( i ); | ||
1554 | } | ||
1555 | } | ||
1556 | while ( j-- ) { | ||
1557 | results.splice( duplicates[ j ], 1 ); | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1561 | // Clear input after sorting to release objects | ||
1562 | // See https://github.com/jquery/sizzle/pull/225 | ||
1563 | sortInput = null; | ||
1564 | |||
1565 | return results; | ||
1566 | }; | ||
1567 | |||
1568 | /** | ||
1569 | * Utility function for retrieving the text value of an array of DOM nodes | ||
1570 | * @param {Array|Element} elem | ||
1571 | */ | ||
1572 | getText = Sizzle.getText = function( elem ) { | ||
1573 | var node, | ||
1574 | ret = "", | ||
1575 | i = 0, | ||
1576 | nodeType = elem.nodeType; | ||
1577 | |||
1578 | if ( !nodeType ) { | ||
1579 | // If no nodeType, this is expected to be an array | ||
1580 | while ( (node = elem[i++]) ) { | ||
1581 | // Do not traverse comment nodes | ||
1582 | ret += getText( node ); | ||
1583 | } | ||
1584 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { | ||
1585 | // Use textContent for elements | ||
1586 | // innerText usage removed for consistency of new lines (jQuery #11153) | ||
1587 | if ( typeof elem.textContent === "string" ) { | ||
1588 | return elem.textContent; | ||
1589 | } else { | ||
1590 | // Traverse its children | ||
1591 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
1592 | ret += getText( elem ); | ||
1593 | } | ||
1594 | } | ||
1595 | } else if ( nodeType === 3 || nodeType === 4 ) { | ||
1596 | return elem.nodeValue; | ||
1597 | } | ||
1598 | // Do not include comment or processing instruction nodes | ||
1599 | |||
1600 | return ret; | ||
1601 | }; | ||
1602 | |||
1603 | Expr = Sizzle.selectors = { | ||
1604 | |||
1605 | // Can be adjusted by the user | ||
1606 | cacheLength: 50, | ||
1607 | |||
1608 | createPseudo: markFunction, | ||
1609 | |||
1610 | match: matchExpr, | ||
1611 | |||
1612 | attrHandle: {}, | ||
1613 | |||
1614 | find: {}, | ||
1615 | |||
1616 | relative: { | ||
1617 | ">": { dir: "parentNode", first: true }, | ||
1618 | " ": { dir: "parentNode" }, | ||
1619 | "+": { dir: "previousSibling", first: true }, | ||
1620 | "~": { dir: "previousSibling" } | ||
1621 | }, | ||
1622 | |||
1623 | preFilter: { | ||
1624 | "ATTR": function( match ) { | ||
1625 | match[1] = match[1].replace( runescape, funescape ); | ||
1626 | |||
1627 | // Move the given value to match[3] whether quoted or unquoted | ||
1628 | match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); | ||
1629 | |||
1630 | if ( match[2] === "~=" ) { | ||
1631 | match[3] = " " + match[3] + " "; | ||
1632 | } | ||
1633 | |||
1634 | return match.slice( 0, 4 ); | ||
1635 | }, | ||
1636 | |||
1637 | "CHILD": function( match ) { | ||
1638 | /* matches from matchExpr["CHILD"] | ||
1639 | 1 type (only|nth|...) | ||
1640 | 2 what (child|of-type) | ||
1641 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) | ||
1642 | 4 xn-component of xn+y argument ([+-]?\d*n|) | ||
1643 | 5 sign of xn-component | ||
1644 | 6 x of xn-component | ||
1645 | 7 sign of y-component | ||
1646 | 8 y of y-component | ||
1647 | */ | ||
1648 | match[1] = match[1].toLowerCase(); | ||
1649 | |||
1650 | if ( match[1].slice( 0, 3 ) === "nth" ) { | ||
1651 | // nth-* requires argument | ||
1652 | if ( !match[3] ) { | ||
1653 | Sizzle.error( match[0] ); | ||
1654 | } | ||
1655 | |||
1656 | // numeric x and y parameters for Expr.filter.CHILD | ||
1657 | // remember that false/true cast respectively to 0/1 | ||
1658 | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); | ||
1659 | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); | ||
1660 | |||
1661 | // other types prohibit arguments | ||
1662 | } else if ( match[3] ) { | ||
1663 | Sizzle.error( match[0] ); | ||
1664 | } | ||
1665 | |||
1666 | return match; | ||
1667 | }, | ||
1668 | |||
1669 | "PSEUDO": function( match ) { | ||
1670 | var excess, | ||
1671 | unquoted = !match[6] && match[2]; | ||
1672 | |||
1673 | if ( matchExpr["CHILD"].test( match[0] ) ) { | ||
1674 | return null; | ||
1675 | } | ||
1676 | |||
1677 | // Accept quoted arguments as-is | ||
1678 | if ( match[3] ) { | ||
1679 | match[2] = match[4] || match[5] || ""; | ||
1680 | |||
1681 | // Strip excess characters from unquoted arguments | ||
1682 | } else if ( unquoted && rpseudo.test( unquoted ) && | ||
1683 | // Get excess from tokenize (recursively) | ||
1684 | (excess = tokenize( unquoted, true )) && | ||
1685 | // advance to the next closing parenthesis | ||
1686 | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { | ||
1687 | |||
1688 | // excess is a negative index | ||
1689 | match[0] = match[0].slice( 0, excess ); | ||
1690 | match[2] = unquoted.slice( 0, excess ); | ||
1691 | } | ||
1692 | |||
1693 | // Return only captures needed by the pseudo filter method (type and argument) | ||
1694 | return match.slice( 0, 3 ); | ||
1695 | } | ||
1696 | }, | ||
1697 | |||
1698 | filter: { | ||
1699 | |||
1700 | "TAG": function( nodeNameSelector ) { | ||
1701 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); | ||
1702 | return nodeNameSelector === "*" ? | ||
1703 | function() { return true; } : | ||
1704 | function( elem ) { | ||
1705 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | ||
1706 | }; | ||
1707 | }, | ||
1708 | |||
1709 | "CLASS": function( className ) { | ||
1710 | var pattern = classCache[ className + " " ]; | ||
1711 | |||
1712 | return pattern || | ||
1713 | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && | ||
1714 | classCache( className, function( elem ) { | ||
1715 | return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); | ||
1716 | }); | ||
1717 | }, | ||
1718 | |||
1719 | "ATTR": function( name, operator, check ) { | ||
1720 | return function( elem ) { | ||
1721 | var result = Sizzle.attr( elem, name ); | ||
1722 | |||
1723 | if ( result == null ) { | ||
1724 | return operator === "!="; | ||
1725 | } | ||
1726 | if ( !operator ) { | ||
1727 | return true; | ||
1728 | } | ||
1729 | |||
1730 | result += ""; | ||
1731 | |||
1732 | return operator === "=" ? result === check : | ||
1733 | operator === "!=" ? result !== check : | ||
1734 | operator === "^=" ? check && result.indexOf( check ) === 0 : | ||
1735 | operator === "*=" ? check && result.indexOf( check ) > -1 : | ||
1736 | operator === "$=" ? check && result.slice( -check.length ) === check : | ||
1737 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : | ||
1738 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : | ||
1739 | false; | ||
1740 | }; | ||
1741 | }, | ||
1742 | |||
1743 | "CHILD": function( type, what, argument, first, last ) { | ||
1744 | var simple = type.slice( 0, 3 ) !== "nth", | ||
1745 | forward = type.slice( -4 ) !== "last", | ||
1746 | ofType = what === "of-type"; | ||
1747 | |||
1748 | return first === 1 && last === 0 ? | ||
1749 | |||
1750 | // Shortcut for :nth-*(n) | ||
1751 | function( elem ) { | ||
1752 | return !!elem.parentNode; | ||
1753 | } : | ||
1754 | |||
1755 | function( elem, context, xml ) { | ||
1756 | var cache, uniqueCache, outerCache, node, nodeIndex, start, | ||
1757 | dir = simple !== forward ? "nextSibling" : "previousSibling", | ||
1758 | parent = elem.parentNode, | ||
1759 | name = ofType && elem.nodeName.toLowerCase(), | ||
1760 | useCache = !xml && !ofType, | ||
1761 | diff = false; | ||
1762 | |||
1763 | if ( parent ) { | ||
1764 | |||
1765 | // :(first|last|only)-(child|of-type) | ||
1766 | if ( simple ) { | ||
1767 | while ( dir ) { | ||
1768 | node = elem; | ||
1769 | while ( (node = node[ dir ]) ) { | ||
1770 | if ( ofType ? | ||
1771 | node.nodeName.toLowerCase() === name : | ||
1772 | node.nodeType === 1 ) { | ||
1773 | |||
1774 | return false; | ||
1775 | } | ||
1776 | } | ||
1777 | // Reverse direction for :only-* (if we haven't yet done so) | ||
1778 | start = dir = type === "only" && !start && "nextSibling"; | ||
1779 | } | ||
1780 | return true; | ||
1781 | } | ||
1782 | |||
1783 | start = [ forward ? parent.firstChild : parent.lastChild ]; | ||
1784 | |||
1785 | // non-xml :nth-child(...) stores cache data on `parent` | ||
1786 | if ( forward && useCache ) { | ||
1787 | |||
1788 | // Seek `elem` from a previously-cached index | ||
1789 | |||
1790 | // ...in a gzip-friendly way | ||
1791 | node = parent; | ||
1792 | outerCache = node[ expando ] || (node[ expando ] = {}); | ||
1793 | |||
1794 | // Support: IE <9 only | ||
1795 | // Defend against cloned attroperties (jQuery gh-1709) | ||
1796 | uniqueCache = outerCache[ node.uniqueID ] || | ||
1797 | (outerCache[ node.uniqueID ] = {}); | ||
1798 | |||
1799 | cache = uniqueCache[ type ] || []; | ||
1800 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; | ||
1801 | diff = nodeIndex && cache[ 2 ]; | ||
1802 | node = nodeIndex && parent.childNodes[ nodeIndex ]; | ||
1803 | |||
1804 | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
1805 | |||
1806 | // Fallback to seeking `elem` from the start | ||
1807 | (diff = nodeIndex = 0) || start.pop()) ) { | ||
1808 | |||
1809 | // When found, cache indexes on `parent` and break | ||
1810 | if ( node.nodeType === 1 && ++diff && node === elem ) { | ||
1811 | uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; | ||
1812 | break; | ||
1813 | } | ||
1814 | } | ||
1815 | |||
1816 | } else { | ||
1817 | // Use previously-cached element index if available | ||
1818 | if ( useCache ) { | ||
1819 | // ...in a gzip-friendly way | ||
1820 | node = elem; | ||
1821 | outerCache = node[ expando ] || (node[ expando ] = {}); | ||
1822 | |||
1823 | // Support: IE <9 only | ||
1824 | // Defend against cloned attroperties (jQuery gh-1709) | ||
1825 | uniqueCache = outerCache[ node.uniqueID ] || | ||
1826 | (outerCache[ node.uniqueID ] = {}); | ||
1827 | |||
1828 | cache = uniqueCache[ type ] || []; | ||
1829 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; | ||
1830 | diff = nodeIndex; | ||
1831 | } | ||
1832 | |||
1833 | // xml :nth-child(...) | ||
1834 | // or :nth-last-child(...) or :nth(-last)?-of-type(...) | ||
1835 | if ( diff === false ) { | ||
1836 | // Use the same loop as above to seek `elem` from the start | ||
1837 | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
1838 | (diff = nodeIndex = 0) || start.pop()) ) { | ||
1839 | |||
1840 | if ( ( ofType ? | ||
1841 | node.nodeName.toLowerCase() === name : | ||
1842 | node.nodeType === 1 ) && | ||
1843 | ++diff ) { | ||
1844 | |||
1845 | // Cache the index of each encountered element | ||
1846 | if ( useCache ) { | ||
1847 | outerCache = node[ expando ] || (node[ expando ] = {}); | ||
1848 | |||
1849 | // Support: IE <9 only | ||
1850 | // Defend against cloned attroperties (jQuery gh-1709) | ||
1851 | uniqueCache = outerCache[ node.uniqueID ] || | ||
1852 | (outerCache[ node.uniqueID ] = {}); | ||
1853 | |||
1854 | uniqueCache[ type ] = [ dirruns, diff ]; | ||
1855 | } | ||
1856 | |||
1857 | if ( node === elem ) { | ||
1858 | break; | ||
1859 | } | ||
1860 | } | ||
1861 | } | ||
1862 | } | ||
1863 | } | ||
1864 | |||
1865 | // Incorporate the offset, then check against cycle size | ||
1866 | diff -= last; | ||
1867 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); | ||
1868 | } | ||
1869 | }; | ||
1870 | }, | ||
1871 | |||
1872 | "PSEUDO": function( pseudo, argument ) { | ||
1873 | // pseudo-class names are case-insensitive | ||
1874 | // http://www.w3.org/TR/selectors/#pseudo-classes | ||
1875 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | ||
1876 | // Remember that setFilters inherits from pseudos | ||
1877 | var args, | ||
1878 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || | ||
1879 | Sizzle.error( "unsupported pseudo: " + pseudo ); | ||
1880 | |||
1881 | // The user may use createPseudo to indicate that | ||
1882 | // arguments are needed to create the filter function | ||
1883 | // just as Sizzle does | ||
1884 | if ( fn[ expando ] ) { | ||
1885 | return fn( argument ); | ||
1886 | } | ||
1887 | |||
1888 | // But maintain support for old signatures | ||
1889 | if ( fn.length > 1 ) { | ||
1890 | args = [ pseudo, pseudo, "", argument ]; | ||
1891 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? | ||
1892 | markFunction(function( seed, matches ) { | ||
1893 | var idx, | ||
1894 | matched = fn( seed, argument ), | ||
1895 | i = matched.length; | ||
1896 | while ( i-- ) { | ||
1897 | idx = indexOf( seed, matched[i] ); | ||
1898 | seed[ idx ] = !( matches[ idx ] = matched[i] ); | ||
1899 | } | ||
1900 | }) : | ||
1901 | function( elem ) { | ||
1902 | return fn( elem, 0, args ); | ||
1903 | }; | ||
1904 | } | ||
1905 | |||
1906 | return fn; | ||
1907 | } | ||
1908 | }, | ||
1909 | |||
1910 | pseudos: { | ||
1911 | // Potentially complex pseudos | ||
1912 | "not": markFunction(function( selector ) { | ||
1913 | // Trim the selector passed to compile | ||
1914 | // to avoid treating leading and trailing | ||
1915 | // spaces as combinators | ||
1916 | var input = [], | ||
1917 | results = [], | ||
1918 | matcher = compile( selector.replace( rtrim, "$1" ) ); | ||
1919 | |||
1920 | return matcher[ expando ] ? | ||
1921 | markFunction(function( seed, matches, context, xml ) { | ||
1922 | var elem, | ||
1923 | unmatched = matcher( seed, null, xml, [] ), | ||
1924 | i = seed.length; | ||
1925 | |||
1926 | // Match elements unmatched by `matcher` | ||
1927 | while ( i-- ) { | ||
1928 | if ( (elem = unmatched[i]) ) { | ||
1929 | seed[i] = !(matches[i] = elem); | ||
1930 | } | ||
1931 | } | ||
1932 | }) : | ||
1933 | function( elem, context, xml ) { | ||
1934 | input[0] = elem; | ||
1935 | matcher( input, null, xml, results ); | ||
1936 | // Don't keep the element (issue #299) | ||
1937 | input[0] = null; | ||
1938 | return !results.pop(); | ||
1939 | }; | ||
1940 | }), | ||
1941 | |||
1942 | "has": markFunction(function( selector ) { | ||
1943 | return function( elem ) { | ||
1944 | return Sizzle( selector, elem ).length > 0; | ||
1945 | }; | ||
1946 | }), | ||
1947 | |||
1948 | "contains": markFunction(function( text ) { | ||
1949 | text = text.replace( runescape, funescape ); | ||
1950 | return function( elem ) { | ||
1951 | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; | ||
1952 | }; | ||
1953 | }), | ||
1954 | |||
1955 | // "Whether an element is represented by a :lang() selector | ||
1956 | // is based solely on the element's language value | ||
1957 | // being equal to the identifier C, | ||
1958 | // or beginning with the identifier C immediately followed by "-". | ||
1959 | // The matching of C against the element's language value is performed case-insensitively. | ||
1960 | // The identifier C does not have to be a valid language name." | ||
1961 | // http://www.w3.org/TR/selectors/#lang-pseudo | ||
1962 | "lang": markFunction( function( lang ) { | ||
1963 | // lang value must be a valid identifier | ||
1964 | if ( !ridentifier.test(lang || "") ) { | ||
1965 | Sizzle.error( "unsupported lang: " + lang ); | ||
1966 | } | ||
1967 | lang = lang.replace( runescape, funescape ).toLowerCase(); | ||
1968 | return function( elem ) { | ||
1969 | var elemLang; | ||
1970 | do { | ||
1971 | if ( (elemLang = documentIsHTML ? | ||
1972 | elem.lang : | ||
1973 | elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { | ||
1974 | |||
1975 | elemLang = elemLang.toLowerCase(); | ||
1976 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; | ||
1977 | } | ||
1978 | } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); | ||
1979 | return false; | ||
1980 | }; | ||
1981 | }), | ||
1982 | |||
1983 | // Miscellaneous | ||
1984 | "target": function( elem ) { | ||
1985 | var hash = window.location && window.location.hash; | ||
1986 | return hash && hash.slice( 1 ) === elem.id; | ||
1987 | }, | ||
1988 | |||
1989 | "root": function( elem ) { | ||
1990 | return elem === docElem; | ||
1991 | }, | ||
1992 | |||
1993 | "focus": function( elem ) { | ||
1994 | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | ||
1995 | }, | ||
1996 | |||
1997 | // Boolean properties | ||
1998 | "enabled": createDisabledPseudo( false ), | ||
1999 | "disabled": createDisabledPseudo( true ), | ||
2000 | |||
2001 | "checked": function( elem ) { | ||
2002 | // In CSS3, :checked should return both checked and selected elements | ||
2003 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
2004 | var nodeName = elem.nodeName.toLowerCase(); | ||
2005 | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | ||
2006 | }, | ||
2007 | |||
2008 | "selected": function( elem ) { | ||
2009 | // Accessing this property makes selected-by-default | ||
2010 | // options in Safari work properly | ||
2011 | if ( elem.parentNode ) { | ||
2012 | elem.parentNode.selectedIndex; | ||
2013 | } | ||
2014 | |||
2015 | return elem.selected === true; | ||
2016 | }, | ||
2017 | |||
2018 | // Contents | ||
2019 | "empty": function( elem ) { | ||
2020 | // http://www.w3.org/TR/selectors/#empty-pseudo | ||
2021 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), | ||
2022 | // but not by others (comment: 8; processing instruction: 7; etc.) | ||
2023 | // nodeType < 6 works because attributes (2) do not appear as children | ||
2024 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
2025 | if ( elem.nodeType < 6 ) { | ||
2026 | return false; | ||
2027 | } | ||
2028 | } | ||
2029 | return true; | ||
2030 | }, | ||
2031 | |||
2032 | "parent": function( elem ) { | ||
2033 | return !Expr.pseudos["empty"]( elem ); | ||
2034 | }, | ||
2035 | |||
2036 | // Element/input types | ||
2037 | "header": function( elem ) { | ||
2038 | return rheader.test( elem.nodeName ); | ||
2039 | }, | ||
2040 | |||
2041 | "input": function( elem ) { | ||
2042 | return rinputs.test( elem.nodeName ); | ||
2043 | }, | ||
2044 | |||
2045 | "button": function( elem ) { | ||
2046 | var name = elem.nodeName.toLowerCase(); | ||
2047 | return name === "input" && elem.type === "button" || name === "button"; | ||
2048 | }, | ||
2049 | |||
2050 | "text": function( elem ) { | ||
2051 | var attr; | ||
2052 | return elem.nodeName.toLowerCase() === "input" && | ||
2053 | elem.type === "text" && | ||
2054 | |||
2055 | // Support: IE<8 | ||
2056 | // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" | ||
2057 | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); | ||
2058 | }, | ||
2059 | |||
2060 | // Position-in-collection | ||
2061 | "first": createPositionalPseudo(function() { | ||
2062 | return [ 0 ]; | ||
2063 | }), | ||
2064 | |||
2065 | "last": createPositionalPseudo(function( matchIndexes, length ) { | ||
2066 | return [ length - 1 ]; | ||
2067 | }), | ||
2068 | |||
2069 | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
2070 | return [ argument < 0 ? argument + length : argument ]; | ||
2071 | }), | ||
2072 | |||
2073 | "even": createPositionalPseudo(function( matchIndexes, length ) { | ||
2074 | var i = 0; | ||
2075 | for ( ; i < length; i += 2 ) { | ||
2076 | matchIndexes.push( i ); | ||
2077 | } | ||
2078 | return matchIndexes; | ||
2079 | }), | ||
2080 | |||
2081 | "odd": createPositionalPseudo(function( matchIndexes, length ) { | ||
2082 | var i = 1; | ||
2083 | for ( ; i < length; i += 2 ) { | ||
2084 | matchIndexes.push( i ); | ||
2085 | } | ||
2086 | return matchIndexes; | ||
2087 | }), | ||
2088 | |||
2089 | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
2090 | var i = argument < 0 ? argument + length : argument; | ||
2091 | for ( ; --i >= 0; ) { | ||
2092 | matchIndexes.push( i ); | ||
2093 | } | ||
2094 | return matchIndexes; | ||
2095 | }), | ||
2096 | |||
2097 | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
2098 | var i = argument < 0 ? argument + length : argument; | ||
2099 | for ( ; ++i < length; ) { | ||
2100 | matchIndexes.push( i ); | ||
2101 | } | ||
2102 | return matchIndexes; | ||
2103 | }) | ||
2104 | } | ||
2105 | }; | ||
2106 | |||
2107 | Expr.pseudos["nth"] = Expr.pseudos["eq"]; | ||
2108 | |||
2109 | // Add button/input type pseudos | ||
2110 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { | ||
2111 | Expr.pseudos[ i ] = createInputPseudo( i ); | ||
2112 | } | ||
2113 | for ( i in { submit: true, reset: true } ) { | ||
2114 | Expr.pseudos[ i ] = createButtonPseudo( i ); | ||
2115 | } | ||
2116 | |||
2117 | // Easy API for creating new setFilters | ||
2118 | function setFilters() {} | ||
2119 | setFilters.prototype = Expr.filters = Expr.pseudos; | ||
2120 | Expr.setFilters = new setFilters(); | ||
2121 | |||
2122 | tokenize = Sizzle.tokenize = function( selector, parseOnly ) { | ||
2123 | var matched, match, tokens, type, | ||
2124 | soFar, groups, preFilters, | ||
2125 | cached = tokenCache[ selector + " " ]; | ||
2126 | |||
2127 | if ( cached ) { | ||
2128 | return parseOnly ? 0 : cached.slice( 0 ); | ||
2129 | } | ||
2130 | |||
2131 | soFar = selector; | ||
2132 | groups = []; | ||
2133 | preFilters = Expr.preFilter; | ||
2134 | |||
2135 | while ( soFar ) { | ||
2136 | |||
2137 | // Comma and first run | ||
2138 | if ( !matched || (match = rcomma.exec( soFar )) ) { | ||
2139 | if ( match ) { | ||
2140 | // Don't consume trailing commas as valid | ||
2141 | soFar = soFar.slice( match[0].length ) || soFar; | ||
2142 | } | ||
2143 | groups.push( (tokens = []) ); | ||
2144 | } | ||
2145 | |||
2146 | matched = false; | ||
2147 | |||
2148 | // Combinators | ||
2149 | if ( (match = rcombinators.exec( soFar )) ) { | ||
2150 | matched = match.shift(); | ||
2151 | tokens.push({ | ||
2152 | value: matched, | ||
2153 | // Cast descendant combinators to space | ||
2154 | type: match[0].replace( rtrim, " " ) | ||
2155 | }); | ||
2156 | soFar = soFar.slice( matched.length ); | ||
2157 | } | ||
2158 | |||
2159 | // Filters | ||
2160 | for ( type in Expr.filter ) { | ||
2161 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || | ||
2162 | (match = preFilters[ type ]( match ))) ) { | ||
2163 | matched = match.shift(); | ||
2164 | tokens.push({ | ||
2165 | value: matched, | ||
2166 | type: type, | ||
2167 | matches: match | ||
2168 | }); | ||
2169 | soFar = soFar.slice( matched.length ); | ||
2170 | } | ||
2171 | } | ||
2172 | |||
2173 | if ( !matched ) { | ||
2174 | break; | ||
2175 | } | ||
2176 | } | ||
2177 | |||
2178 | // Return the length of the invalid excess | ||
2179 | // if we're just parsing | ||
2180 | // Otherwise, throw an error or return tokens | ||
2181 | return parseOnly ? | ||
2182 | soFar.length : | ||
2183 | soFar ? | ||
2184 | Sizzle.error( selector ) : | ||
2185 | // Cache the tokens | ||
2186 | tokenCache( selector, groups ).slice( 0 ); | ||
2187 | }; | ||
2188 | |||
2189 | function toSelector( tokens ) { | ||
2190 | var i = 0, | ||
2191 | len = tokens.length, | ||
2192 | selector = ""; | ||
2193 | for ( ; i < len; i++ ) { | ||
2194 | selector += tokens[i].value; | ||
2195 | } | ||
2196 | return selector; | ||
2197 | } | ||
2198 | |||
2199 | function addCombinator( matcher, combinator, base ) { | ||
2200 | var dir = combinator.dir, | ||
2201 | skip = combinator.next, | ||
2202 | key = skip || dir, | ||
2203 | checkNonElements = base && key === "parentNode", | ||
2204 | doneName = done++; | ||
2205 | |||
2206 | return combinator.first ? | ||
2207 | // Check against closest ancestor/preceding element | ||
2208 | function( elem, context, xml ) { | ||
2209 | while ( (elem = elem[ dir ]) ) { | ||
2210 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2211 | return matcher( elem, context, xml ); | ||
2212 | } | ||
2213 | } | ||
2214 | } : | ||
2215 | |||
2216 | // Check against all ancestor/preceding elements | ||
2217 | function( elem, context, xml ) { | ||
2218 | var oldCache, uniqueCache, outerCache, | ||
2219 | newCache = [ dirruns, doneName ]; | ||
2220 | |||
2221 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching | ||
2222 | if ( xml ) { | ||
2223 | while ( (elem = elem[ dir ]) ) { | ||
2224 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2225 | if ( matcher( elem, context, xml ) ) { | ||
2226 | return true; | ||
2227 | } | ||
2228 | } | ||
2229 | } | ||
2230 | } else { | ||
2231 | while ( (elem = elem[ dir ]) ) { | ||
2232 | if ( elem.nodeType === 1 || checkNonElements ) { | ||
2233 | outerCache = elem[ expando ] || (elem[ expando ] = {}); | ||
2234 | |||
2235 | // Support: IE <9 only | ||
2236 | // Defend against cloned attroperties (jQuery gh-1709) | ||
2237 | uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); | ||
2238 | |||
2239 | if ( skip && skip === elem.nodeName.toLowerCase() ) { | ||
2240 | elem = elem[ dir ] || elem; | ||
2241 | } else if ( (oldCache = uniqueCache[ key ]) && | ||
2242 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { | ||
2243 | |||
2244 | // Assign to newCache so results back-propagate to previous elements | ||
2245 | return (newCache[ 2 ] = oldCache[ 2 ]); | ||
2246 | } else { | ||
2247 | // Reuse newcache so results back-propagate to previous elements | ||
2248 | uniqueCache[ key ] = newCache; | ||
2249 | |||
2250 | // A match means we're done; a fail means we have to keep checking | ||
2251 | if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { | ||
2252 | return true; | ||
2253 | } | ||
2254 | } | ||
2255 | } | ||
2256 | } | ||
2257 | } | ||
2258 | }; | ||
2259 | } | ||
2260 | |||
2261 | function elementMatcher( matchers ) { | ||
2262 | return matchers.length > 1 ? | ||
2263 | function( elem, context, xml ) { | ||
2264 | var i = matchers.length; | ||
2265 | while ( i-- ) { | ||
2266 | if ( !matchers[i]( elem, context, xml ) ) { | ||
2267 | return false; | ||
2268 | } | ||
2269 | } | ||
2270 | return true; | ||
2271 | } : | ||
2272 | matchers[0]; | ||
2273 | } | ||
2274 | |||
2275 | function multipleContexts( selector, contexts, results ) { | ||
2276 | var i = 0, | ||
2277 | len = contexts.length; | ||
2278 | for ( ; i < len; i++ ) { | ||
2279 | Sizzle( selector, contexts[i], results ); | ||
2280 | } | ||
2281 | return results; | ||
2282 | } | ||
2283 | |||
2284 | function condense( unmatched, map, filter, context, xml ) { | ||
2285 | var elem, | ||
2286 | newUnmatched = [], | ||
2287 | i = 0, | ||
2288 | len = unmatched.length, | ||
2289 | mapped = map != null; | ||
2290 | |||
2291 | for ( ; i < len; i++ ) { | ||
2292 | if ( (elem = unmatched[i]) ) { | ||
2293 | if ( !filter || filter( elem, context, xml ) ) { | ||
2294 | newUnmatched.push( elem ); | ||
2295 | if ( mapped ) { | ||
2296 | map.push( i ); | ||
2297 | } | ||
2298 | } | ||
2299 | } | ||
2300 | } | ||
2301 | |||
2302 | return newUnmatched; | ||
2303 | } | ||
2304 | |||
2305 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { | ||
2306 | if ( postFilter && !postFilter[ expando ] ) { | ||
2307 | postFilter = setMatcher( postFilter ); | ||
2308 | } | ||
2309 | if ( postFinder && !postFinder[ expando ] ) { | ||
2310 | postFinder = setMatcher( postFinder, postSelector ); | ||
2311 | } | ||
2312 | return markFunction(function( seed, results, context, xml ) { | ||
2313 | var temp, i, elem, | ||
2314 | preMap = [], | ||
2315 | postMap = [], | ||
2316 | preexisting = results.length, | ||
2317 | |||
2318 | // Get initial elements from seed or context | ||
2319 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), | ||
2320 | |||
2321 | // Prefilter to get matcher input, preserving a map for seed-results synchronization | ||
2322 | matcherIn = preFilter && ( seed || !selector ) ? | ||
2323 | condense( elems, preMap, preFilter, context, xml ) : | ||
2324 | elems, | ||
2325 | |||
2326 | matcherOut = matcher ? | ||
2327 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, | ||
2328 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? | ||
2329 | |||
2330 | // ...intermediate processing is necessary | ||
2331 | [] : | ||
2332 | |||
2333 | // ...otherwise use results directly | ||
2334 | results : | ||
2335 | matcherIn; | ||
2336 | |||
2337 | // Find primary matches | ||
2338 | if ( matcher ) { | ||
2339 | matcher( matcherIn, matcherOut, context, xml ); | ||
2340 | } | ||
2341 | |||
2342 | // Apply postFilter | ||
2343 | if ( postFilter ) { | ||
2344 | temp = condense( matcherOut, postMap ); | ||
2345 | postFilter( temp, [], context, xml ); | ||
2346 | |||
2347 | // Un-match failing elements by moving them back to matcherIn | ||
2348 | i = temp.length; | ||
2349 | while ( i-- ) { | ||
2350 | if ( (elem = temp[i]) ) { | ||
2351 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); | ||
2352 | } | ||
2353 | } | ||
2354 | } | ||
2355 | |||
2356 | if ( seed ) { | ||
2357 | if ( postFinder || preFilter ) { | ||
2358 | if ( postFinder ) { | ||
2359 | // Get the final matcherOut by condensing this intermediate into postFinder contexts | ||
2360 | temp = []; | ||
2361 | i = matcherOut.length; | ||
2362 | while ( i-- ) { | ||
2363 | if ( (elem = matcherOut[i]) ) { | ||
2364 | // Restore matcherIn since elem is not yet a final match | ||
2365 | temp.push( (matcherIn[i] = elem) ); | ||
2366 | } | ||
2367 | } | ||
2368 | postFinder( null, (matcherOut = []), temp, xml ); | ||
2369 | } | ||
2370 | |||
2371 | // Move matched elements from seed to results to keep them synchronized | ||
2372 | i = matcherOut.length; | ||
2373 | while ( i-- ) { | ||
2374 | if ( (elem = matcherOut[i]) && | ||
2375 | (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { | ||
2376 | |||
2377 | seed[temp] = !(results[temp] = elem); | ||
2378 | } | ||
2379 | } | ||
2380 | } | ||
2381 | |||
2382 | // Add elements to results, through postFinder if defined | ||
2383 | } else { | ||
2384 | matcherOut = condense( | ||
2385 | matcherOut === results ? | ||
2386 | matcherOut.splice( preexisting, matcherOut.length ) : | ||
2387 | matcherOut | ||
2388 | ); | ||
2389 | if ( postFinder ) { | ||
2390 | postFinder( null, results, matcherOut, xml ); | ||
2391 | } else { | ||
2392 | push.apply( results, matcherOut ); | ||
2393 | } | ||
2394 | } | ||
2395 | }); | ||
2396 | } | ||
2397 | |||
2398 | function matcherFromTokens( tokens ) { | ||
2399 | var checkContext, matcher, j, | ||
2400 | len = tokens.length, | ||
2401 | leadingRelative = Expr.relative[ tokens[0].type ], | ||
2402 | implicitRelative = leadingRelative || Expr.relative[" "], | ||
2403 | i = leadingRelative ? 1 : 0, | ||
2404 | |||
2405 | // The foundational matcher ensures that elements are reachable from top-level context(s) | ||
2406 | matchContext = addCombinator( function( elem ) { | ||
2407 | return elem === checkContext; | ||
2408 | }, implicitRelative, true ), | ||
2409 | matchAnyContext = addCombinator( function( elem ) { | ||
2410 | return indexOf( checkContext, elem ) > -1; | ||
2411 | }, implicitRelative, true ), | ||
2412 | matchers = [ function( elem, context, xml ) { | ||
2413 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( | ||
2414 | (checkContext = context).nodeType ? | ||
2415 | matchContext( elem, context, xml ) : | ||
2416 | matchAnyContext( elem, context, xml ) ); | ||
2417 | // Avoid hanging onto element (issue #299) | ||
2418 | checkContext = null; | ||
2419 | return ret; | ||
2420 | } ]; | ||
2421 | |||
2422 | for ( ; i < len; i++ ) { | ||
2423 | if ( (matcher = Expr.relative[ tokens[i].type ]) ) { | ||
2424 | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; | ||
2425 | } else { | ||
2426 | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); | ||
2427 | |||
2428 | // Return special upon seeing a positional matcher | ||
2429 | if ( matcher[ expando ] ) { | ||
2430 | // Find the next relative operator (if any) for proper handling | ||
2431 | j = ++i; | ||
2432 | for ( ; j < len; j++ ) { | ||
2433 | if ( Expr.relative[ tokens[j].type ] ) { | ||
2434 | break; | ||
2435 | } | ||
2436 | } | ||
2437 | return setMatcher( | ||
2438 | i > 1 && elementMatcher( matchers ), | ||
2439 | i > 1 && toSelector( | ||
2440 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` | ||
2441 | tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) | ||
2442 | ).replace( rtrim, "$1" ), | ||
2443 | matcher, | ||
2444 | i < j && matcherFromTokens( tokens.slice( i, j ) ), | ||
2445 | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), | ||
2446 | j < len && toSelector( tokens ) | ||
2447 | ); | ||
2448 | } | ||
2449 | matchers.push( matcher ); | ||
2450 | } | ||
2451 | } | ||
2452 | |||
2453 | return elementMatcher( matchers ); | ||
2454 | } | ||
2455 | |||
2456 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | ||
2457 | var bySet = setMatchers.length > 0, | ||
2458 | byElement = elementMatchers.length > 0, | ||
2459 | superMatcher = function( seed, context, xml, results, outermost ) { | ||
2460 | var elem, j, matcher, | ||
2461 | matchedCount = 0, | ||
2462 | i = "0", | ||
2463 | unmatched = seed && [], | ||
2464 | setMatched = [], | ||
2465 | contextBackup = outermostContext, | ||
2466 | // We must always have either seed elements or outermost context | ||
2467 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), | ||
2468 | // Use integer dirruns iff this is the outermost matcher | ||
2469 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), | ||
2470 | len = elems.length; | ||
2471 | |||
2472 | if ( outermost ) { | ||
2473 | outermostContext = context === document || context || outermost; | ||
2474 | } | ||
2475 | |||
2476 | // Add elements passing elementMatchers directly to results | ||
2477 | // Support: IE<9, Safari | ||
2478 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | ||
2479 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) { | ||
2480 | if ( byElement && elem ) { | ||
2481 | j = 0; | ||
2482 | if ( !context && elem.ownerDocument !== document ) { | ||
2483 | setDocument( elem ); | ||
2484 | xml = !documentIsHTML; | ||
2485 | } | ||
2486 | while ( (matcher = elementMatchers[j++]) ) { | ||
2487 | if ( matcher( elem, context || document, xml) ) { | ||
2488 | results.push( elem ); | ||
2489 | break; | ||
2490 | } | ||
2491 | } | ||
2492 | if ( outermost ) { | ||
2493 | dirruns = dirrunsUnique; | ||
2494 | } | ||
2495 | } | ||
2496 | |||
2497 | // Track unmatched elements for set filters | ||
2498 | if ( bySet ) { | ||
2499 | // They will have gone through all possible matchers | ||
2500 | if ( (elem = !matcher && elem) ) { | ||
2501 | matchedCount--; | ||
2502 | } | ||
2503 | |||
2504 | // Lengthen the array for every element, matched or not | ||
2505 | if ( seed ) { | ||
2506 | unmatched.push( elem ); | ||
2507 | } | ||
2508 | } | ||
2509 | } | ||
2510 | |||
2511 | // `i` is now the count of elements visited above, and adding it to `matchedCount` | ||
2512 | // makes the latter nonnegative. | ||
2513 | matchedCount += i; | ||
2514 | |||
2515 | // Apply set filters to unmatched elements | ||
2516 | // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` | ||
2517 | // equals `i`), unless we didn't visit _any_ elements in the above loop because we have | ||
2518 | // no element matchers and no seed. | ||
2519 | // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that | ||
2520 | // case, which will result in a "00" `matchedCount` that differs from `i` but is also | ||
2521 | // numerically zero. | ||
2522 | if ( bySet && i !== matchedCount ) { | ||
2523 | j = 0; | ||
2524 | while ( (matcher = setMatchers[j++]) ) { | ||
2525 | matcher( unmatched, setMatched, context, xml ); | ||
2526 | } | ||
2527 | |||
2528 | if ( seed ) { | ||
2529 | // Reintegrate element matches to eliminate the need for sorting | ||
2530 | if ( matchedCount > 0 ) { | ||
2531 | while ( i-- ) { | ||
2532 | if ( !(unmatched[i] || setMatched[i]) ) { | ||
2533 | setMatched[i] = pop.call( results ); | ||
2534 | } | ||
2535 | } | ||
2536 | } | ||
2537 | |||
2538 | // Discard index placeholder values to get only actual matches | ||
2539 | setMatched = condense( setMatched ); | ||
2540 | } | ||
2541 | |||
2542 | // Add matches to results | ||
2543 | push.apply( results, setMatched ); | ||
2544 | |||
2545 | // Seedless set matches succeeding multiple successful matchers stipulate sorting | ||
2546 | if ( outermost && !seed && setMatched.length > 0 && | ||
2547 | ( matchedCount + setMatchers.length ) > 1 ) { | ||
2548 | |||
2549 | Sizzle.uniqueSort( results ); | ||
2550 | } | ||
2551 | } | ||
2552 | |||
2553 | // Override manipulation of globals by nested matchers | ||
2554 | if ( outermost ) { | ||
2555 | dirruns = dirrunsUnique; | ||
2556 | outermostContext = contextBackup; | ||
2557 | } | ||
2558 | |||
2559 | return unmatched; | ||
2560 | }; | ||
2561 | |||
2562 | return bySet ? | ||
2563 | markFunction( superMatcher ) : | ||
2564 | superMatcher; | ||
2565 | } | ||
2566 | |||
2567 | compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { | ||
2568 | var i, | ||
2569 | setMatchers = [], | ||
2570 | elementMatchers = [], | ||
2571 | cached = compilerCache[ selector + " " ]; | ||
2572 | |||
2573 | if ( !cached ) { | ||
2574 | // Generate a function of recursive functions that can be used to check each element | ||
2575 | if ( !match ) { | ||
2576 | match = tokenize( selector ); | ||
2577 | } | ||
2578 | i = match.length; | ||
2579 | while ( i-- ) { | ||
2580 | cached = matcherFromTokens( match[i] ); | ||
2581 | if ( cached[ expando ] ) { | ||
2582 | setMatchers.push( cached ); | ||
2583 | } else { | ||
2584 | elementMatchers.push( cached ); | ||
2585 | } | ||
2586 | } | ||
2587 | |||
2588 | // Cache the compiled function | ||
2589 | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); | ||
2590 | |||
2591 | // Save selector and tokenization | ||
2592 | cached.selector = selector; | ||
2593 | } | ||
2594 | return cached; | ||
2595 | }; | ||
2596 | |||
2597 | /** | ||
2598 | * A low-level selection function that works with Sizzle's compiled | ||
2599 | * selector functions | ||
2600 | * @param {String|Function} selector A selector or a pre-compiled | ||
2601 | * selector function built with Sizzle.compile | ||
2602 | * @param {Element} context | ||
2603 | * @param {Array} [results] | ||
2604 | * @param {Array} [seed] A set of elements to match against | ||
2605 | */ | ||
2606 | select = Sizzle.select = function( selector, context, results, seed ) { | ||
2607 | var i, tokens, token, type, find, | ||
2608 | compiled = typeof selector === "function" && selector, | ||
2609 | match = !seed && tokenize( (selector = compiled.selector || selector) ); | ||
2610 | |||
2611 | results = results || []; | ||
2612 | |||
2613 | // Try to minimize operations if there is only one selector in the list and no seed | ||
2614 | // (the latter of which guarantees us context) | ||
2615 | if ( match.length === 1 ) { | ||
2616 | |||
2617 | // Reduce context if the leading compound selector is an ID | ||
2618 | tokens = match[0] = match[0].slice( 0 ); | ||
2619 | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && | ||
2620 | support.getById && context.nodeType === 9 && documentIsHTML && | ||
2621 | Expr.relative[ tokens[1].type ] ) { | ||
2622 | |||
2623 | context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; | ||
2624 | if ( !context ) { | ||
2625 | return results; | ||
2626 | |||
2627 | // Precompiled matchers will still verify ancestry, so step up a level | ||
2628 | } else if ( compiled ) { | ||
2629 | context = context.parentNode; | ||
2630 | } | ||
2631 | |||
2632 | selector = selector.slice( tokens.shift().value.length ); | ||
2633 | } | ||
2634 | |||
2635 | // Fetch a seed set for right-to-left matching | ||
2636 | i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; | ||
2637 | while ( i-- ) { | ||
2638 | token = tokens[i]; | ||
2639 | |||
2640 | // Abort if we hit a combinator | ||
2641 | if ( Expr.relative[ (type = token.type) ] ) { | ||
2642 | break; | ||
2643 | } | ||
2644 | if ( (find = Expr.find[ type ]) ) { | ||
2645 | // Search, expanding context for leading sibling combinators | ||
2646 | if ( (seed = find( | ||
2647 | token.matches[0].replace( runescape, funescape ), | ||
2648 | rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context | ||
2649 | )) ) { | ||
2650 | |||
2651 | // If seed is empty or no tokens remain, we can return early | ||
2652 | tokens.splice( i, 1 ); | ||
2653 | selector = seed.length && toSelector( tokens ); | ||
2654 | if ( !selector ) { | ||
2655 | push.apply( results, seed ); | ||
2656 | return results; | ||
2657 | } | ||
2658 | |||
2659 | break; | ||
2660 | } | ||
2661 | } | ||
2662 | } | ||
2663 | } | ||
2664 | |||
2665 | // Compile and execute a filtering function if one is not provided | ||
2666 | // Provide `match` to avoid retokenization if we modified the selector above | ||
2667 | ( compiled || compile( selector, match ) )( | ||
2668 | seed, | ||
2669 | context, | ||
2670 | !documentIsHTML, | ||
2671 | results, | ||
2672 | !context || rsibling.test( selector ) && testContext( context.parentNode ) || context | ||
2673 | ); | ||
2674 | return results; | ||
2675 | }; | ||
2676 | |||
2677 | // One-time assignments | ||
2678 | |||
2679 | // Sort stability | ||
2680 | support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; | ||
2681 | |||
2682 | // Support: Chrome 14-35+ | ||
2683 | // Always assume duplicates if they aren't passed to the comparison function | ||
2684 | support.detectDuplicates = !!hasDuplicate; | ||
2685 | |||
2686 | // Initialize against the default document | ||
2687 | setDocument(); | ||
2688 | |||
2689 | // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | ||
2690 | // Detached nodes confoundingly follow *each other* | ||
2691 | support.sortDetached = assert(function( el ) { | ||
2692 | // Should return 1, but returns 4 (following) | ||
2693 | return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; | ||
2694 | }); | ||
2695 | |||
2696 | // Support: IE<8 | ||
2697 | // Prevent attribute/property "interpolation" | ||
2698 | // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | ||
2699 | if ( !assert(function( el ) { | ||
2700 | el.innerHTML = "<a href='#'></a>"; | ||
2701 | return el.firstChild.getAttribute("href") === "#" ; | ||
2702 | }) ) { | ||
2703 | addHandle( "type|href|height|width", function( elem, name, isXML ) { | ||
2704 | if ( !isXML ) { | ||
2705 | return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); | ||
2706 | } | ||
2707 | }); | ||
2708 | } | ||
2709 | |||
2710 | // Support: IE<9 | ||
2711 | // Use defaultValue in place of getAttribute("value") | ||
2712 | if ( !support.attributes || !assert(function( el ) { | ||
2713 | el.innerHTML = "<input/>"; | ||
2714 | el.firstChild.setAttribute( "value", "" ); | ||
2715 | return el.firstChild.getAttribute( "value" ) === ""; | ||
2716 | }) ) { | ||
2717 | addHandle( "value", function( elem, name, isXML ) { | ||
2718 | if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { | ||
2719 | return elem.defaultValue; | ||
2720 | } | ||
2721 | }); | ||
2722 | } | ||
2723 | |||
2724 | // Support: IE<9 | ||
2725 | // Use getAttributeNode to fetch booleans when getAttribute lies | ||
2726 | if ( !assert(function( el ) { | ||
2727 | return el.getAttribute("disabled") == null; | ||
2728 | }) ) { | ||
2729 | addHandle( booleans, function( elem, name, isXML ) { | ||
2730 | var val; | ||
2731 | if ( !isXML ) { | ||
2732 | return elem[ name ] === true ? name.toLowerCase() : | ||
2733 | (val = elem.getAttributeNode( name )) && val.specified ? | ||
2734 | val.value : | ||
2735 | null; | ||
2736 | } | ||
2737 | }); | ||
2738 | } | ||
2739 | |||
2740 | return Sizzle; | ||
2741 | |||
2742 | })( window ); | ||
2743 | |||
2744 | |||
2745 | |||
2746 | jQuery.find = Sizzle; | ||
2747 | jQuery.expr = Sizzle.selectors; | ||
2748 | |||
2749 | // Deprecated | ||
2750 | jQuery.expr[ ":" ] = jQuery.expr.pseudos; | ||
2751 | jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; | ||
2752 | jQuery.text = Sizzle.getText; | ||
2753 | jQuery.isXMLDoc = Sizzle.isXML; | ||
2754 | jQuery.contains = Sizzle.contains; | ||
2755 | jQuery.escapeSelector = Sizzle.escape; | ||
2756 | |||
2757 | |||
2758 | |||
2759 | |||
2760 | var dir = function( elem, dir, until ) { | ||
2761 | var matched = [], | ||
2762 | truncate = until !== undefined; | ||
2763 | |||
2764 | while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { | ||
2765 | if ( elem.nodeType === 1 ) { | ||
2766 | if ( truncate && jQuery( elem ).is( until ) ) { | ||
2767 | break; | ||
2768 | } | ||
2769 | matched.push( elem ); | ||
2770 | } | ||
2771 | } | ||
2772 | return matched; | ||
2773 | }; | ||
2774 | |||
2775 | |||
2776 | var siblings = function( n, elem ) { | ||
2777 | var matched = []; | ||
2778 | |||
2779 | for ( ; n; n = n.nextSibling ) { | ||
2780 | if ( n.nodeType === 1 && n !== elem ) { | ||
2781 | matched.push( n ); | ||
2782 | } | ||
2783 | } | ||
2784 | |||
2785 | return matched; | ||
2786 | }; | ||
2787 | |||
2788 | |||
2789 | var rneedsContext = jQuery.expr.match.needsContext; | ||
2790 | |||
2791 | var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); | ||
2792 | |||
2793 | |||
2794 | |||
2795 | var risSimple = /^.[^:#\[\.,]*$/; | ||
2796 | |||
2797 | // Implement the identical functionality for filter and not | ||
2798 | function winnow( elements, qualifier, not ) { | ||
2799 | if ( jQuery.isFunction( qualifier ) ) { | ||
2800 | return jQuery.grep( elements, function( elem, i ) { | ||
2801 | return !!qualifier.call( elem, i, elem ) !== not; | ||
2802 | } ); | ||
2803 | |||
2804 | } | ||
2805 | |||
2806 | if ( qualifier.nodeType ) { | ||
2807 | return jQuery.grep( elements, function( elem ) { | ||
2808 | return ( elem === qualifier ) !== not; | ||
2809 | } ); | ||
2810 | |||
2811 | } | ||
2812 | |||
2813 | if ( typeof qualifier === "string" ) { | ||
2814 | if ( risSimple.test( qualifier ) ) { | ||
2815 | return jQuery.filter( qualifier, elements, not ); | ||
2816 | } | ||
2817 | |||
2818 | qualifier = jQuery.filter( qualifier, elements ); | ||
2819 | } | ||
2820 | |||
2821 | return jQuery.grep( elements, function( elem ) { | ||
2822 | return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; | ||
2823 | } ); | ||
2824 | } | ||
2825 | |||
2826 | jQuery.filter = function( expr, elems, not ) { | ||
2827 | var elem = elems[ 0 ]; | ||
2828 | |||
2829 | if ( not ) { | ||
2830 | expr = ":not(" + expr + ")"; | ||
2831 | } | ||
2832 | |||
2833 | return elems.length === 1 && elem.nodeType === 1 ? | ||
2834 | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : | ||
2835 | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { | ||
2836 | return elem.nodeType === 1; | ||
2837 | } ) ); | ||
2838 | }; | ||
2839 | |||
2840 | jQuery.fn.extend( { | ||
2841 | find: function( selector ) { | ||
2842 | var i, ret, | ||
2843 | len = this.length, | ||
2844 | self = this; | ||
2845 | |||
2846 | if ( typeof selector !== "string" ) { | ||
2847 | return this.pushStack( jQuery( selector ).filter( function() { | ||
2848 | for ( i = 0; i < len; i++ ) { | ||
2849 | if ( jQuery.contains( self[ i ], this ) ) { | ||
2850 | return true; | ||
2851 | } | ||
2852 | } | ||
2853 | } ) ); | ||
2854 | } | ||
2855 | |||
2856 | ret = this.pushStack( [] ); | ||
2857 | |||
2858 | for ( i = 0; i < len; i++ ) { | ||
2859 | jQuery.find( selector, self[ i ], ret ); | ||
2860 | } | ||
2861 | |||
2862 | return len > 1 ? jQuery.uniqueSort( ret ) : ret; | ||
2863 | }, | ||
2864 | filter: function( selector ) { | ||
2865 | return this.pushStack( winnow( this, selector || [], false ) ); | ||
2866 | }, | ||
2867 | not: function( selector ) { | ||
2868 | return this.pushStack( winnow( this, selector || [], true ) ); | ||
2869 | }, | ||
2870 | is: function( selector ) { | ||
2871 | return !!winnow( | ||
2872 | this, | ||
2873 | |||
2874 | // If this is a positional/relative selector, check membership in the returned set | ||
2875 | // so $("p:first").is("p:last") won't return true for a doc with two "p". | ||
2876 | typeof selector === "string" && rneedsContext.test( selector ) ? | ||
2877 | jQuery( selector ) : | ||
2878 | selector || [], | ||
2879 | false | ||
2880 | ).length; | ||
2881 | } | ||
2882 | } ); | ||
2883 | |||
2884 | |||
2885 | // Initialize a jQuery object | ||
2886 | |||
2887 | |||
2888 | // A central reference to the root jQuery(document) | ||
2889 | var rootjQuery, | ||
2890 | |||
2891 | // A simple way to check for HTML strings | ||
2892 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | ||
2893 | // Strict HTML recognition (#11290: must start with <) | ||
2894 | // Shortcut simple #id case for speed | ||
2895 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, | ||
2896 | |||
2897 | init = jQuery.fn.init = function( selector, context, root ) { | ||
2898 | var match, elem; | ||
2899 | |||
2900 | // HANDLE: $(""), $(null), $(undefined), $(false) | ||
2901 | if ( !selector ) { | ||
2902 | return this; | ||
2903 | } | ||
2904 | |||
2905 | // Method init() accepts an alternate rootjQuery | ||
2906 | // so migrate can support jQuery.sub (gh-2101) | ||
2907 | root = root || rootjQuery; | ||
2908 | |||
2909 | // Handle HTML strings | ||
2910 | if ( typeof selector === "string" ) { | ||
2911 | if ( selector[ 0 ] === "<" && | ||
2912 | selector[ selector.length - 1 ] === ">" && | ||
2913 | selector.length >= 3 ) { | ||
2914 | |||
2915 | // Assume that strings that start and end with <> are HTML and skip the regex check | ||
2916 | match = [ null, selector, null ]; | ||
2917 | |||
2918 | } else { | ||
2919 | match = rquickExpr.exec( selector ); | ||
2920 | } | ||
2921 | |||
2922 | // Match html or make sure no context is specified for #id | ||
2923 | if ( match && ( match[ 1 ] || !context ) ) { | ||
2924 | |||
2925 | // HANDLE: $(html) -> $(array) | ||
2926 | if ( match[ 1 ] ) { | ||
2927 | context = context instanceof jQuery ? context[ 0 ] : context; | ||
2928 | |||
2929 | // Option to run scripts is true for back-compat | ||
2930 | // Intentionally let the error be thrown if parseHTML is not present | ||
2931 | jQuery.merge( this, jQuery.parseHTML( | ||
2932 | match[ 1 ], | ||
2933 | context && context.nodeType ? context.ownerDocument || context : document, | ||
2934 | true | ||
2935 | ) ); | ||
2936 | |||
2937 | // HANDLE: $(html, props) | ||
2938 | if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { | ||
2939 | for ( match in context ) { | ||
2940 | |||
2941 | // Properties of context are called as methods if possible | ||
2942 | if ( jQuery.isFunction( this[ match ] ) ) { | ||
2943 | this[ match ]( context[ match ] ); | ||
2944 | |||
2945 | // ...and otherwise set as attributes | ||
2946 | } else { | ||
2947 | this.attr( match, context[ match ] ); | ||
2948 | } | ||
2949 | } | ||
2950 | } | ||
2951 | |||
2952 | return this; | ||
2953 | |||
2954 | // HANDLE: $(#id) | ||
2955 | } else { | ||
2956 | elem = document.getElementById( match[ 2 ] ); | ||
2957 | |||
2958 | if ( elem ) { | ||
2959 | |||
2960 | // Inject the element directly into the jQuery object | ||
2961 | this[ 0 ] = elem; | ||
2962 | this.length = 1; | ||
2963 | } | ||
2964 | return this; | ||
2965 | } | ||
2966 | |||
2967 | // HANDLE: $(expr, $(...)) | ||
2968 | } else if ( !context || context.jquery ) { | ||
2969 | return ( context || root ).find( selector ); | ||
2970 | |||
2971 | // HANDLE: $(expr, context) | ||
2972 | // (which is just equivalent to: $(context).find(expr) | ||
2973 | } else { | ||
2974 | return this.constructor( context ).find( selector ); | ||
2975 | } | ||
2976 | |||
2977 | // HANDLE: $(DOMElement) | ||
2978 | } else if ( selector.nodeType ) { | ||
2979 | this[ 0 ] = selector; | ||
2980 | this.length = 1; | ||
2981 | return this; | ||
2982 | |||
2983 | // HANDLE: $(function) | ||
2984 | // Shortcut for document ready | ||
2985 | } else if ( jQuery.isFunction( selector ) ) { | ||
2986 | return root.ready !== undefined ? | ||
2987 | root.ready( selector ) : | ||
2988 | |||
2989 | // Execute immediately if ready is not present | ||
2990 | selector( jQuery ); | ||
2991 | } | ||
2992 | |||
2993 | return jQuery.makeArray( selector, this ); | ||
2994 | }; | ||
2995 | |||
2996 | // Give the init function the jQuery prototype for later instantiation | ||
2997 | init.prototype = jQuery.fn; | ||
2998 | |||
2999 | // Initialize central reference | ||
3000 | rootjQuery = jQuery( document ); | ||
3001 | |||
3002 | |||
3003 | var rparentsprev = /^(?:parents|prev(?:Until|All))/, | ||
3004 | |||
3005 | // Methods guaranteed to produce a unique set when starting from a unique set | ||
3006 | guaranteedUnique = { | ||
3007 | children: true, | ||
3008 | contents: true, | ||
3009 | next: true, | ||
3010 | prev: true | ||
3011 | }; | ||
3012 | |||
3013 | jQuery.fn.extend( { | ||
3014 | has: function( target ) { | ||
3015 | var targets = jQuery( target, this ), | ||
3016 | l = targets.length; | ||
3017 | |||
3018 | return this.filter( function() { | ||
3019 | var i = 0; | ||
3020 | for ( ; i < l; i++ ) { | ||
3021 | if ( jQuery.contains( this, targets[ i ] ) ) { | ||
3022 | return true; | ||
3023 | } | ||
3024 | } | ||
3025 | } ); | ||
3026 | }, | ||
3027 | |||
3028 | closest: function( selectors, context ) { | ||
3029 | var cur, | ||
3030 | i = 0, | ||
3031 | l = this.length, | ||
3032 | matched = [], | ||
3033 | targets = typeof selectors !== "string" && jQuery( selectors ); | ||
3034 | |||
3035 | // Positional selectors never match, since there's no _selection_ context | ||
3036 | if ( !rneedsContext.test( selectors ) ) { | ||
3037 | for ( ; i < l; i++ ) { | ||
3038 | for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { | ||
3039 | |||
3040 | // Always skip document fragments | ||
3041 | if ( cur.nodeType < 11 && ( targets ? | ||
3042 | targets.index( cur ) > -1 : | ||
3043 | |||
3044 | // Don't pass non-elements to Sizzle | ||
3045 | cur.nodeType === 1 && | ||
3046 | jQuery.find.matchesSelector( cur, selectors ) ) ) { | ||
3047 | |||
3048 | matched.push( cur ); | ||
3049 | break; | ||
3050 | } | ||
3051 | } | ||
3052 | } | ||
3053 | } | ||
3054 | |||
3055 | return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); | ||
3056 | }, | ||
3057 | |||
3058 | // Determine the position of an element within the set | ||
3059 | index: function( elem ) { | ||
3060 | |||
3061 | // No argument, return index in parent | ||
3062 | if ( !elem ) { | ||
3063 | return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; | ||
3064 | } | ||
3065 | |||
3066 | // Index in selector | ||
3067 | if ( typeof elem === "string" ) { | ||
3068 | return indexOf.call( jQuery( elem ), this[ 0 ] ); | ||
3069 | } | ||
3070 | |||
3071 | // Locate the position of the desired element | ||
3072 | return indexOf.call( this, | ||
3073 | |||
3074 | // If it receives a jQuery object, the first element is used | ||
3075 | elem.jquery ? elem[ 0 ] : elem | ||
3076 | ); | ||
3077 | }, | ||
3078 | |||
3079 | add: function( selector, context ) { | ||
3080 | return this.pushStack( | ||
3081 | jQuery.uniqueSort( | ||
3082 | jQuery.merge( this.get(), jQuery( selector, context ) ) | ||
3083 | ) | ||
3084 | ); | ||
3085 | }, | ||
3086 | |||
3087 | addBack: function( selector ) { | ||
3088 | return this.add( selector == null ? | ||
3089 | this.prevObject : this.prevObject.filter( selector ) | ||
3090 | ); | ||
3091 | } | ||
3092 | } ); | ||
3093 | |||
3094 | function sibling( cur, dir ) { | ||
3095 | while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} | ||
3096 | return cur; | ||
3097 | } | ||
3098 | |||
3099 | jQuery.each( { | ||
3100 | parent: function( elem ) { | ||
3101 | var parent = elem.parentNode; | ||
3102 | return parent && parent.nodeType !== 11 ? parent : null; | ||
3103 | }, | ||
3104 | parents: function( elem ) { | ||
3105 | return dir( elem, "parentNode" ); | ||
3106 | }, | ||
3107 | parentsUntil: function( elem, i, until ) { | ||
3108 | return dir( elem, "parentNode", until ); | ||
3109 | }, | ||
3110 | next: function( elem ) { | ||
3111 | return sibling( elem, "nextSibling" ); | ||
3112 | }, | ||
3113 | prev: function( elem ) { | ||
3114 | return sibling( elem, "previousSibling" ); | ||
3115 | }, | ||
3116 | nextAll: function( elem ) { | ||
3117 | return dir( elem, "nextSibling" ); | ||
3118 | }, | ||
3119 | prevAll: function( elem ) { | ||
3120 | return dir( elem, "previousSibling" ); | ||
3121 | }, | ||
3122 | nextUntil: function( elem, i, until ) { | ||
3123 | return dir( elem, "nextSibling", until ); | ||
3124 | }, | ||
3125 | prevUntil: function( elem, i, until ) { | ||
3126 | return dir( elem, "previousSibling", until ); | ||
3127 | }, | ||
3128 | siblings: function( elem ) { | ||
3129 | return siblings( ( elem.parentNode || {} ).firstChild, elem ); | ||
3130 | }, | ||
3131 | children: function( elem ) { | ||
3132 | return siblings( elem.firstChild ); | ||
3133 | }, | ||
3134 | contents: function( elem ) { | ||
3135 | return elem.contentDocument || jQuery.merge( [], elem.childNodes ); | ||
3136 | } | ||
3137 | }, function( name, fn ) { | ||
3138 | jQuery.fn[ name ] = function( until, selector ) { | ||
3139 | var matched = jQuery.map( this, fn, until ); | ||
3140 | |||
3141 | if ( name.slice( -5 ) !== "Until" ) { | ||
3142 | selector = until; | ||
3143 | } | ||
3144 | |||
3145 | if ( selector && typeof selector === "string" ) { | ||
3146 | matched = jQuery.filter( selector, matched ); | ||
3147 | } | ||
3148 | |||
3149 | if ( this.length > 1 ) { | ||
3150 | |||
3151 | // Remove duplicates | ||
3152 | if ( !guaranteedUnique[ name ] ) { | ||
3153 | jQuery.uniqueSort( matched ); | ||
3154 | } | ||
3155 | |||
3156 | // Reverse order for parents* and prev-derivatives | ||
3157 | if ( rparentsprev.test( name ) ) { | ||
3158 | matched.reverse(); | ||
3159 | } | ||
3160 | } | ||
3161 | |||
3162 | return this.pushStack( matched ); | ||
3163 | }; | ||
3164 | } ); | ||
3165 | var rnotwhite = ( /\S+/g ); | ||
3166 | |||
3167 | |||
3168 | |||
3169 | // Convert String-formatted options into Object-formatted ones | ||
3170 | function createOptions( options ) { | ||
3171 | var object = {}; | ||
3172 | jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { | ||
3173 | object[ flag ] = true; | ||
3174 | } ); | ||
3175 | return object; | ||
3176 | } | ||
3177 | |||
3178 | /* | ||
3179 | * Create a callback list using the following parameters: | ||
3180 | * | ||
3181 | * options: an optional list of space-separated options that will change how | ||
3182 | * the callback list behaves or a more traditional option object | ||
3183 | * | ||
3184 | * By default a callback list will act like an event callback list and can be | ||
3185 | * "fired" multiple times. | ||
3186 | * | ||
3187 | * Possible options: | ||
3188 | * | ||
3189 | * once: will ensure the callback list can only be fired once (like a Deferred) | ||
3190 | * | ||
3191 | * memory: will keep track of previous values and will call any callback added | ||
3192 | * after the list has been fired right away with the latest "memorized" | ||
3193 | * values (like a Deferred) | ||
3194 | * | ||
3195 | * unique: will ensure a callback can only be added once (no duplicate in the list) | ||
3196 | * | ||
3197 | * stopOnFalse: interrupt callings when a callback returns false | ||
3198 | * | ||
3199 | */ | ||
3200 | jQuery.Callbacks = function( options ) { | ||
3201 | |||
3202 | // Convert options from String-formatted to Object-formatted if needed | ||
3203 | // (we check in cache first) | ||
3204 | options = typeof options === "string" ? | ||
3205 | createOptions( options ) : | ||
3206 | jQuery.extend( {}, options ); | ||
3207 | |||
3208 | var // Flag to know if list is currently firing | ||
3209 | firing, | ||
3210 | |||
3211 | // Last fire value for non-forgettable lists | ||
3212 | memory, | ||
3213 | |||
3214 | // Flag to know if list was already fired | ||
3215 | fired, | ||
3216 | |||
3217 | // Flag to prevent firing | ||
3218 | locked, | ||
3219 | |||
3220 | // Actual callback list | ||
3221 | list = [], | ||
3222 | |||
3223 | // Queue of execution data for repeatable lists | ||
3224 | queue = [], | ||
3225 | |||
3226 | // Index of currently firing callback (modified by add/remove as needed) | ||
3227 | firingIndex = -1, | ||
3228 | |||
3229 | // Fire callbacks | ||
3230 | fire = function() { | ||
3231 | |||
3232 | // Enforce single-firing | ||
3233 | locked = options.once; | ||
3234 | |||
3235 | // Execute callbacks for all pending executions, | ||
3236 | // respecting firingIndex overrides and runtime changes | ||
3237 | fired = firing = true; | ||
3238 | for ( ; queue.length; firingIndex = -1 ) { | ||
3239 | memory = queue.shift(); | ||
3240 | while ( ++firingIndex < list.length ) { | ||
3241 | |||
3242 | // Run callback and check for early termination | ||
3243 | if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && | ||
3244 | options.stopOnFalse ) { | ||
3245 | |||
3246 | // Jump to end and forget the data so .add doesn't re-fire | ||
3247 | firingIndex = list.length; | ||
3248 | memory = false; | ||
3249 | } | ||
3250 | } | ||
3251 | } | ||
3252 | |||
3253 | // Forget the data if we're done with it | ||
3254 | if ( !options.memory ) { | ||
3255 | memory = false; | ||
3256 | } | ||
3257 | |||
3258 | firing = false; | ||
3259 | |||
3260 | // Clean up if we're done firing for good | ||
3261 | if ( locked ) { | ||
3262 | |||
3263 | // Keep an empty list if we have data for future add calls | ||
3264 | if ( memory ) { | ||
3265 | list = []; | ||
3266 | |||
3267 | // Otherwise, this object is spent | ||
3268 | } else { | ||
3269 | list = ""; | ||
3270 | } | ||
3271 | } | ||
3272 | }, | ||
3273 | |||
3274 | // Actual Callbacks object | ||
3275 | self = { | ||
3276 | |||
3277 | // Add a callback or a collection of callbacks to the list | ||
3278 | add: function() { | ||
3279 | if ( list ) { | ||
3280 | |||
3281 | // If we have memory from a past run, we should fire after adding | ||
3282 | if ( memory && !firing ) { | ||
3283 | firingIndex = list.length - 1; | ||
3284 | queue.push( memory ); | ||
3285 | } | ||
3286 | |||
3287 | ( function add( args ) { | ||
3288 | jQuery.each( args, function( _, arg ) { | ||
3289 | if ( jQuery.isFunction( arg ) ) { | ||
3290 | if ( !options.unique || !self.has( arg ) ) { | ||
3291 | list.push( arg ); | ||
3292 | } | ||
3293 | } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { | ||
3294 | |||
3295 | // Inspect recursively | ||
3296 | add( arg ); | ||
3297 | } | ||
3298 | } ); | ||
3299 | } )( arguments ); | ||
3300 | |||
3301 | if ( memory && !firing ) { | ||
3302 | fire(); | ||
3303 | } | ||
3304 | } | ||
3305 | return this; | ||
3306 | }, | ||
3307 | |||
3308 | // Remove a callback from the list | ||
3309 | remove: function() { | ||
3310 | jQuery.each( arguments, function( _, arg ) { | ||
3311 | var index; | ||
3312 | while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { | ||
3313 | list.splice( index, 1 ); | ||
3314 | |||
3315 | // Handle firing indexes | ||
3316 | if ( index <= firingIndex ) { | ||
3317 | firingIndex--; | ||
3318 | } | ||
3319 | } | ||
3320 | } ); | ||
3321 | return this; | ||
3322 | }, | ||
3323 | |||
3324 | // Check if a given callback is in the list. | ||
3325 | // If no argument is given, return whether or not list has callbacks attached. | ||
3326 | has: function( fn ) { | ||
3327 | return fn ? | ||
3328 | jQuery.inArray( fn, list ) > -1 : | ||
3329 | list.length > 0; | ||
3330 | }, | ||
3331 | |||
3332 | // Remove all callbacks from the list | ||
3333 | empty: function() { | ||
3334 | if ( list ) { | ||
3335 | list = []; | ||
3336 | } | ||
3337 | return this; | ||
3338 | }, | ||
3339 | |||
3340 | // Disable .fire and .add | ||
3341 | // Abort any current/pending executions | ||
3342 | // Clear all callbacks and values | ||
3343 | disable: function() { | ||
3344 | locked = queue = []; | ||
3345 | list = memory = ""; | ||
3346 | return this; | ||
3347 | }, | ||
3348 | disabled: function() { | ||
3349 | return !list; | ||
3350 | }, | ||
3351 | |||
3352 | // Disable .fire | ||
3353 | // Also disable .add unless we have memory (since it would have no effect) | ||
3354 | // Abort any pending executions | ||
3355 | lock: function() { | ||
3356 | locked = queue = []; | ||
3357 | if ( !memory && !firing ) { | ||
3358 | list = memory = ""; | ||
3359 | } | ||
3360 | return this; | ||
3361 | }, | ||
3362 | locked: function() { | ||
3363 | return !!locked; | ||
3364 | }, | ||
3365 | |||
3366 | // Call all callbacks with the given context and arguments | ||
3367 | fireWith: function( context, args ) { | ||
3368 | if ( !locked ) { | ||
3369 | args = args || []; | ||
3370 | args = [ context, args.slice ? args.slice() : args ]; | ||
3371 | queue.push( args ); | ||
3372 | if ( !firing ) { | ||
3373 | fire(); | ||
3374 | } | ||
3375 | } | ||
3376 | return this; | ||
3377 | }, | ||
3378 | |||
3379 | // Call all the callbacks with the given arguments | ||
3380 | fire: function() { | ||
3381 | self.fireWith( this, arguments ); | ||
3382 | return this; | ||
3383 | }, | ||
3384 | |||
3385 | // To know if the callbacks have already been called at least once | ||
3386 | fired: function() { | ||
3387 | return !!fired; | ||
3388 | } | ||
3389 | }; | ||
3390 | |||
3391 | return self; | ||
3392 | }; | ||
3393 | |||
3394 | |||
3395 | function Identity( v ) { | ||
3396 | return v; | ||
3397 | } | ||
3398 | function Thrower( ex ) { | ||
3399 | throw ex; | ||
3400 | } | ||
3401 | |||
3402 | function adoptValue( value, resolve, reject ) { | ||
3403 | var method; | ||
3404 | |||
3405 | try { | ||
3406 | |||
3407 | // Check for promise aspect first to privilege synchronous behavior | ||
3408 | if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { | ||
3409 | method.call( value ).done( resolve ).fail( reject ); | ||
3410 | |||
3411 | // Other thenables | ||
3412 | } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { | ||
3413 | method.call( value, resolve, reject ); | ||
3414 | |||
3415 | // Other non-thenables | ||
3416 | } else { | ||
3417 | |||
3418 | // Support: Android 4.0 only | ||
3419 | // Strict mode functions invoked without .call/.apply get global-object context | ||
3420 | resolve.call( undefined, value ); | ||
3421 | } | ||
3422 | |||
3423 | // For Promises/A+, convert exceptions into rejections | ||
3424 | // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in | ||
3425 | // Deferred#then to conditionally suppress rejection. | ||
3426 | } catch ( value ) { | ||
3427 | |||
3428 | // Support: Android 4.0 only | ||
3429 | // Strict mode functions invoked without .call/.apply get global-object context | ||
3430 | reject.call( undefined, value ); | ||
3431 | } | ||
3432 | } | ||
3433 | |||
3434 | jQuery.extend( { | ||
3435 | |||
3436 | Deferred: function( func ) { | ||
3437 | var tuples = [ | ||
3438 | |||
3439 | // action, add listener, callbacks, | ||
3440 | // ... .then handlers, argument index, [final state] | ||
3441 | [ "notify", "progress", jQuery.Callbacks( "memory" ), | ||
3442 | jQuery.Callbacks( "memory" ), 2 ], | ||
3443 | [ "resolve", "done", jQuery.Callbacks( "once memory" ), | ||
3444 | jQuery.Callbacks( "once memory" ), 0, "resolved" ], | ||
3445 | [ "reject", "fail", jQuery.Callbacks( "once memory" ), | ||
3446 | jQuery.Callbacks( "once memory" ), 1, "rejected" ] | ||
3447 | ], | ||
3448 | state = "pending", | ||
3449 | promise = { | ||
3450 | state: function() { | ||
3451 | return state; | ||
3452 | }, | ||
3453 | always: function() { | ||
3454 | deferred.done( arguments ).fail( arguments ); | ||
3455 | return this; | ||
3456 | }, | ||
3457 | "catch": function( fn ) { | ||
3458 | return promise.then( null, fn ); | ||
3459 | }, | ||
3460 | |||
3461 | // Keep pipe for back-compat | ||
3462 | pipe: function( /* fnDone, fnFail, fnProgress */ ) { | ||
3463 | var fns = arguments; | ||
3464 | |||
3465 | return jQuery.Deferred( function( newDefer ) { | ||
3466 | jQuery.each( tuples, function( i, tuple ) { | ||
3467 | |||
3468 | // Map tuples (progress, done, fail) to arguments (done, fail, progress) | ||
3469 | var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; | ||
3470 | |||
3471 | // deferred.progress(function() { bind to newDefer or newDefer.notify }) | ||
3472 | // deferred.done(function() { bind to newDefer or newDefer.resolve }) | ||
3473 | // deferred.fail(function() { bind to newDefer or newDefer.reject }) | ||
3474 | deferred[ tuple[ 1 ] ]( function() { | ||
3475 | var returned = fn && fn.apply( this, arguments ); | ||
3476 | if ( returned && jQuery.isFunction( returned.promise ) ) { | ||
3477 | returned.promise() | ||
3478 | .progress( newDefer.notify ) | ||
3479 | .done( newDefer.resolve ) | ||
3480 | .fail( newDefer.reject ); | ||
3481 | } else { | ||
3482 | newDefer[ tuple[ 0 ] + "With" ]( | ||
3483 | this, | ||
3484 | fn ? [ returned ] : arguments | ||
3485 | ); | ||
3486 | } | ||
3487 | } ); | ||
3488 | } ); | ||
3489 | fns = null; | ||
3490 | } ).promise(); | ||
3491 | }, | ||
3492 | then: function( onFulfilled, onRejected, onProgress ) { | ||
3493 | var maxDepth = 0; | ||
3494 | function resolve( depth, deferred, handler, special ) { | ||
3495 | return function() { | ||
3496 | var that = this, | ||
3497 | args = arguments, | ||
3498 | mightThrow = function() { | ||
3499 | var returned, then; | ||
3500 | |||
3501 | // Support: Promises/A+ section 2.3.3.3.3 | ||
3502 | // https://promisesaplus.com/#point-59 | ||
3503 | // Ignore double-resolution attempts | ||
3504 | if ( depth < maxDepth ) { | ||
3505 | return; | ||
3506 | } | ||
3507 | |||
3508 | returned = handler.apply( that, args ); | ||
3509 | |||
3510 | // Support: Promises/A+ section 2.3.1 | ||
3511 | // https://promisesaplus.com/#point-48 | ||
3512 | if ( returned === deferred.promise() ) { | ||
3513 | throw new TypeError( "Thenable self-resolution" ); | ||
3514 | } | ||
3515 | |||
3516 | // Support: Promises/A+ sections 2.3.3.1, 3.5 | ||
3517 | // https://promisesaplus.com/#point-54 | ||
3518 | // https://promisesaplus.com/#point-75 | ||
3519 | // Retrieve `then` only once | ||
3520 | then = returned && | ||
3521 | |||
3522 | // Support: Promises/A+ section 2.3.4 | ||
3523 | // https://promisesaplus.com/#point-64 | ||
3524 | // Only check objects and functions for thenability | ||
3525 | ( typeof returned === "object" || | ||
3526 | typeof returned === "function" ) && | ||
3527 | returned.then; | ||
3528 | |||
3529 | // Handle a returned thenable | ||
3530 | if ( jQuery.isFunction( then ) ) { | ||
3531 | |||
3532 | // Special processors (notify) just wait for resolution | ||
3533 | if ( special ) { | ||
3534 | then.call( | ||
3535 | returned, | ||
3536 | resolve( maxDepth, deferred, Identity, special ), | ||
3537 | resolve( maxDepth, deferred, Thrower, special ) | ||
3538 | ); | ||
3539 | |||
3540 | // Normal processors (resolve) also hook into progress | ||
3541 | } else { | ||
3542 | |||
3543 | // ...and disregard older resolution values | ||
3544 | maxDepth++; | ||
3545 | |||
3546 | then.call( | ||
3547 | returned, | ||
3548 | resolve( maxDepth, deferred, Identity, special ), | ||
3549 | resolve( maxDepth, deferred, Thrower, special ), | ||
3550 | resolve( maxDepth, deferred, Identity, | ||
3551 | deferred.notifyWith ) | ||
3552 | ); | ||
3553 | } | ||
3554 | |||
3555 | // Handle all other returned values | ||
3556 | } else { | ||
3557 | |||
3558 | // Only substitute handlers pass on context | ||
3559 | // and multiple values (non-spec behavior) | ||
3560 | if ( handler !== Identity ) { | ||
3561 | that = undefined; | ||
3562 | args = [ returned ]; | ||
3563 | } | ||
3564 | |||
3565 | // Process the value(s) | ||
3566 | // Default process is resolve | ||
3567 | ( special || deferred.resolveWith )( that, args ); | ||
3568 | } | ||
3569 | }, | ||
3570 | |||
3571 | // Only normal processors (resolve) catch and reject exceptions | ||
3572 | process = special ? | ||
3573 | mightThrow : | ||
3574 | function() { | ||
3575 | try { | ||
3576 | mightThrow(); | ||
3577 | } catch ( e ) { | ||
3578 | |||
3579 | if ( jQuery.Deferred.exceptionHook ) { | ||
3580 | jQuery.Deferred.exceptionHook( e, | ||
3581 | process.stackTrace ); | ||
3582 | } | ||
3583 | |||
3584 | // Support: Promises/A+ section 2.3.3.3.4.1 | ||
3585 | // https://promisesaplus.com/#point-61 | ||
3586 | // Ignore post-resolution exceptions | ||
3587 | if ( depth + 1 >= maxDepth ) { | ||
3588 | |||
3589 | // Only substitute handlers pass on context | ||
3590 | // and multiple values (non-spec behavior) | ||
3591 | if ( handler !== Thrower ) { | ||
3592 | that = undefined; | ||
3593 | args = [ e ]; | ||
3594 | } | ||
3595 | |||
3596 | deferred.rejectWith( that, args ); | ||
3597 | } | ||
3598 | } | ||
3599 | }; | ||
3600 | |||
3601 | // Support: Promises/A+ section 2.3.3.3.1 | ||
3602 | // https://promisesaplus.com/#point-57 | ||
3603 | // Re-resolve promises immediately to dodge false rejection from | ||
3604 | // subsequent errors | ||
3605 | if ( depth ) { | ||
3606 | process(); | ||
3607 | } else { | ||
3608 | |||
3609 | // Call an optional hook to record the stack, in case of exception | ||
3610 | // since it's otherwise lost when execution goes async | ||
3611 | if ( jQuery.Deferred.getStackHook ) { | ||
3612 | process.stackTrace = jQuery.Deferred.getStackHook(); | ||
3613 | } | ||
3614 | window.setTimeout( process ); | ||
3615 | } | ||
3616 | }; | ||
3617 | } | ||
3618 | |||
3619 | return jQuery.Deferred( function( newDefer ) { | ||
3620 | |||
3621 | // progress_handlers.add( ... ) | ||
3622 | tuples[ 0 ][ 3 ].add( | ||
3623 | resolve( | ||
3624 | 0, | ||
3625 | newDefer, | ||
3626 | jQuery.isFunction( onProgress ) ? | ||
3627 | onProgress : | ||
3628 | Identity, | ||
3629 | newDefer.notifyWith | ||
3630 | ) | ||
3631 | ); | ||
3632 | |||
3633 | // fulfilled_handlers.add( ... ) | ||
3634 | tuples[ 1 ][ 3 ].add( | ||
3635 | resolve( | ||
3636 | 0, | ||
3637 | newDefer, | ||
3638 | jQuery.isFunction( onFulfilled ) ? | ||
3639 | onFulfilled : | ||
3640 | Identity | ||
3641 | ) | ||
3642 | ); | ||
3643 | |||
3644 | // rejected_handlers.add( ... ) | ||
3645 | tuples[ 2 ][ 3 ].add( | ||
3646 | resolve( | ||
3647 | 0, | ||
3648 | newDefer, | ||
3649 | jQuery.isFunction( onRejected ) ? | ||
3650 | onRejected : | ||
3651 | Thrower | ||
3652 | ) | ||
3653 | ); | ||
3654 | } ).promise(); | ||
3655 | }, | ||
3656 | |||
3657 | // Get a promise for this deferred | ||
3658 | // If obj is provided, the promise aspect is added to the object | ||
3659 | promise: function( obj ) { | ||
3660 | return obj != null ? jQuery.extend( obj, promise ) : promise; | ||
3661 | } | ||
3662 | }, | ||
3663 | deferred = {}; | ||
3664 | |||
3665 | // Add list-specific methods | ||
3666 | jQuery.each( tuples, function( i, tuple ) { | ||
3667 | var list = tuple[ 2 ], | ||
3668 | stateString = tuple[ 5 ]; | ||
3669 | |||
3670 | // promise.progress = list.add | ||
3671 | // promise.done = list.add | ||
3672 | // promise.fail = list.add | ||
3673 | promise[ tuple[ 1 ] ] = list.add; | ||
3674 | |||
3675 | // Handle state | ||
3676 | if ( stateString ) { | ||
3677 | list.add( | ||
3678 | function() { | ||
3679 | |||
3680 | // state = "resolved" (i.e., fulfilled) | ||
3681 | // state = "rejected" | ||
3682 | state = stateString; | ||
3683 | }, | ||
3684 | |||
3685 | // rejected_callbacks.disable | ||
3686 | // fulfilled_callbacks.disable | ||
3687 | tuples[ 3 - i ][ 2 ].disable, | ||
3688 | |||
3689 | // progress_callbacks.lock | ||
3690 | tuples[ 0 ][ 2 ].lock | ||
3691 | ); | ||
3692 | } | ||
3693 | |||
3694 | // progress_handlers.fire | ||
3695 | // fulfilled_handlers.fire | ||
3696 | // rejected_handlers.fire | ||
3697 | list.add( tuple[ 3 ].fire ); | ||
3698 | |||
3699 | // deferred.notify = function() { deferred.notifyWith(...) } | ||
3700 | // deferred.resolve = function() { deferred.resolveWith(...) } | ||
3701 | // deferred.reject = function() { deferred.rejectWith(...) } | ||
3702 | deferred[ tuple[ 0 ] ] = function() { | ||
3703 | deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); | ||
3704 | return this; | ||
3705 | }; | ||
3706 | |||
3707 | // deferred.notifyWith = list.fireWith | ||
3708 | // deferred.resolveWith = list.fireWith | ||
3709 | // deferred.rejectWith = list.fireWith | ||
3710 | deferred[ tuple[ 0 ] + "With" ] = list.fireWith; | ||
3711 | } ); | ||
3712 | |||
3713 | // Make the deferred a promise | ||
3714 | promise.promise( deferred ); | ||
3715 | |||
3716 | // Call given func if any | ||
3717 | if ( func ) { | ||
3718 | func.call( deferred, deferred ); | ||
3719 | } | ||
3720 | |||
3721 | // All done! | ||
3722 | return deferred; | ||
3723 | }, | ||
3724 | |||
3725 | // Deferred helper | ||
3726 | when: function( singleValue ) { | ||
3727 | var | ||
3728 | |||
3729 | // count of uncompleted subordinates | ||
3730 | remaining = arguments.length, | ||
3731 | |||
3732 | // count of unprocessed arguments | ||
3733 | i = remaining, | ||
3734 | |||
3735 | // subordinate fulfillment data | ||
3736 | resolveContexts = Array( i ), | ||
3737 | resolveValues = slice.call( arguments ), | ||
3738 | |||
3739 | // the master Deferred | ||
3740 | master = jQuery.Deferred(), | ||
3741 | |||
3742 | // subordinate callback factory | ||
3743 | updateFunc = function( i ) { | ||
3744 | return function( value ) { | ||
3745 | resolveContexts[ i ] = this; | ||
3746 | resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; | ||
3747 | if ( !( --remaining ) ) { | ||
3748 | master.resolveWith( resolveContexts, resolveValues ); | ||
3749 | } | ||
3750 | }; | ||
3751 | }; | ||
3752 | |||
3753 | // Single- and empty arguments are adopted like Promise.resolve | ||
3754 | if ( remaining <= 1 ) { | ||
3755 | adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject ); | ||
3756 | |||
3757 | // Use .then() to unwrap secondary thenables (cf. gh-3000) | ||
3758 | if ( master.state() === "pending" || | ||
3759 | jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { | ||
3760 | |||
3761 | return master.then(); | ||
3762 | } | ||
3763 | } | ||
3764 | |||
3765 | // Multiple arguments are aggregated like Promise.all array elements | ||
3766 | while ( i-- ) { | ||
3767 | adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); | ||
3768 | } | ||
3769 | |||
3770 | return master.promise(); | ||
3771 | } | ||
3772 | } ); | ||
3773 | |||
3774 | |||
3775 | // These usually indicate a programmer mistake during development, | ||
3776 | // warn about them ASAP rather than swallowing them by default. | ||
3777 | var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; | ||
3778 | |||
3779 | jQuery.Deferred.exceptionHook = function( error, stack ) { | ||
3780 | |||
3781 | // Support: IE 8 - 9 only | ||
3782 | // Console exists when dev tools are open, which can happen at any time | ||
3783 | if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { | ||
3784 | window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); | ||
3785 | } | ||
3786 | }; | ||
3787 | |||
3788 | |||
3789 | |||
3790 | |||
3791 | jQuery.readyException = function( error ) { | ||
3792 | window.setTimeout( function() { | ||
3793 | throw error; | ||
3794 | } ); | ||
3795 | }; | ||
3796 | |||
3797 | |||
3798 | |||
3799 | |||
3800 | // The deferred used on DOM ready | ||
3801 | var readyList = jQuery.Deferred(); | ||
3802 | |||
3803 | jQuery.fn.ready = function( fn ) { | ||
3804 | |||
3805 | readyList | ||
3806 | .then( fn ) | ||
3807 | |||
3808 | // Wrap jQuery.readyException in a function so that the lookup | ||
3809 | // happens at the time of error handling instead of callback | ||
3810 | // registration. | ||
3811 | .catch( function( error ) { | ||
3812 | jQuery.readyException( error ); | ||
3813 | } ); | ||
3814 | |||
3815 | return this; | ||
3816 | }; | ||
3817 | |||
3818 | jQuery.extend( { | ||
3819 | |||
3820 | // Is the DOM ready to be used? Set to true once it occurs. | ||
3821 | isReady: false, | ||
3822 | |||
3823 | // A counter to track how many items to wait for before | ||
3824 | // the ready event fires. See #6781 | ||
3825 | readyWait: 1, | ||
3826 | |||
3827 | // Hold (or release) the ready event | ||
3828 | holdReady: function( hold ) { | ||
3829 | if ( hold ) { | ||
3830 | jQuery.readyWait++; | ||
3831 | } else { | ||
3832 | jQuery.ready( true ); | ||
3833 | } | ||
3834 | }, | ||
3835 | |||
3836 | // Handle when the DOM is ready | ||
3837 | ready: function( wait ) { | ||
3838 | |||
3839 | // Abort if there are pending holds or we're already ready | ||
3840 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { | ||
3841 | return; | ||
3842 | } | ||
3843 | |||
3844 | // Remember that the DOM is ready | ||
3845 | jQuery.isReady = true; | ||
3846 | |||
3847 | // If a normal DOM Ready event fired, decrement, and wait if need be | ||
3848 | if ( wait !== true && --jQuery.readyWait > 0 ) { | ||
3849 | return; | ||
3850 | } | ||
3851 | |||
3852 | // If there are functions bound, to execute | ||
3853 | readyList.resolveWith( document, [ jQuery ] ); | ||
3854 | } | ||
3855 | } ); | ||
3856 | |||
3857 | jQuery.ready.then = readyList.then; | ||
3858 | |||
3859 | // The ready event handler and self cleanup method | ||
3860 | function completed() { | ||
3861 | document.removeEventListener( "DOMContentLoaded", completed ); | ||
3862 | window.removeEventListener( "load", completed ); | ||
3863 | jQuery.ready(); | ||
3864 | } | ||
3865 | |||
3866 | // Catch cases where $(document).ready() is called | ||
3867 | // after the browser event has already occurred. | ||
3868 | // Support: IE <=9 - 10 only | ||
3869 | // Older IE sometimes signals "interactive" too soon | ||
3870 | if ( document.readyState === "complete" || | ||
3871 | ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { | ||
3872 | |||
3873 | // Handle it asynchronously to allow scripts the opportunity to delay ready | ||
3874 | window.setTimeout( jQuery.ready ); | ||
3875 | |||
3876 | } else { | ||
3877 | |||
3878 | // Use the handy event callback | ||
3879 | document.addEventListener( "DOMContentLoaded", completed ); | ||
3880 | |||
3881 | // A fallback to window.onload, that will always work | ||
3882 | window.addEventListener( "load", completed ); | ||
3883 | } | ||
3884 | |||
3885 | |||
3886 | |||
3887 | |||
3888 | // Multifunctional method to get and set values of a collection | ||
3889 | // The value/s can optionally be executed if it's a function | ||
3890 | var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { | ||
3891 | var i = 0, | ||
3892 | len = elems.length, | ||
3893 | bulk = key == null; | ||
3894 | |||
3895 | // Sets many values | ||
3896 | if ( jQuery.type( key ) === "object" ) { | ||
3897 | chainable = true; | ||
3898 | for ( i in key ) { | ||
3899 | access( elems, fn, i, key[ i ], true, emptyGet, raw ); | ||
3900 | } | ||
3901 | |||
3902 | // Sets one value | ||
3903 | } else if ( value !== undefined ) { | ||
3904 | chainable = true; | ||
3905 | |||
3906 | if ( !jQuery.isFunction( value ) ) { | ||
3907 | raw = true; | ||
3908 | } | ||
3909 | |||
3910 | if ( bulk ) { | ||
3911 | |||
3912 | // Bulk operations run against the entire set | ||
3913 | if ( raw ) { | ||
3914 | fn.call( elems, value ); | ||
3915 | fn = null; | ||
3916 | |||
3917 | // ...except when executing function values | ||
3918 | } else { | ||
3919 | bulk = fn; | ||
3920 | fn = function( elem, key, value ) { | ||
3921 | return bulk.call( jQuery( elem ), value ); | ||
3922 | }; | ||
3923 | } | ||
3924 | } | ||
3925 | |||
3926 | if ( fn ) { | ||
3927 | for ( ; i < len; i++ ) { | ||
3928 | fn( | ||
3929 | elems[ i ], key, raw ? | ||
3930 | value : | ||
3931 | value.call( elems[ i ], i, fn( elems[ i ], key ) ) | ||
3932 | ); | ||
3933 | } | ||
3934 | } | ||
3935 | } | ||
3936 | |||
3937 | return chainable ? | ||
3938 | elems : | ||
3939 | |||
3940 | // Gets | ||
3941 | bulk ? | ||
3942 | fn.call( elems ) : | ||
3943 | len ? fn( elems[ 0 ], key ) : emptyGet; | ||
3944 | }; | ||
3945 | var acceptData = function( owner ) { | ||
3946 | |||
3947 | // Accepts only: | ||
3948 | // - Node | ||
3949 | // - Node.ELEMENT_NODE | ||
3950 | // - Node.DOCUMENT_NODE | ||
3951 | // - Object | ||
3952 | // - Any | ||
3953 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); | ||
3954 | }; | ||
3955 | |||
3956 | |||
3957 | |||
3958 | |||
3959 | function Data() { | ||
3960 | this.expando = jQuery.expando + Data.uid++; | ||
3961 | } | ||
3962 | |||
3963 | Data.uid = 1; | ||
3964 | |||
3965 | Data.prototype = { | ||
3966 | |||
3967 | cache: function( owner ) { | ||
3968 | |||
3969 | // Check if the owner object already has a cache | ||
3970 | var value = owner[ this.expando ]; | ||
3971 | |||
3972 | // If not, create one | ||
3973 | if ( !value ) { | ||
3974 | value = {}; | ||
3975 | |||
3976 | // We can accept data for non-element nodes in modern browsers, | ||
3977 | // but we should not, see #8335. | ||
3978 | // Always return an empty object. | ||
3979 | if ( acceptData( owner ) ) { | ||
3980 | |||
3981 | // If it is a node unlikely to be stringify-ed or looped over | ||
3982 | // use plain assignment | ||
3983 | if ( owner.nodeType ) { | ||
3984 | owner[ this.expando ] = value; | ||
3985 | |||
3986 | // Otherwise secure it in a non-enumerable property | ||
3987 | // configurable must be true to allow the property to be | ||
3988 | // deleted when data is removed | ||
3989 | } else { | ||
3990 | Object.defineProperty( owner, this.expando, { | ||
3991 | value: value, | ||
3992 | configurable: true | ||
3993 | } ); | ||
3994 | } | ||
3995 | } | ||
3996 | } | ||
3997 | |||
3998 | return value; | ||
3999 | }, | ||
4000 | set: function( owner, data, value ) { | ||
4001 | var prop, | ||
4002 | cache = this.cache( owner ); | ||
4003 | |||
4004 | // Handle: [ owner, key, value ] args | ||
4005 | // Always use camelCase key (gh-2257) | ||
4006 | if ( typeof data === "string" ) { | ||
4007 | cache[ jQuery.camelCase( data ) ] = value; | ||
4008 | |||
4009 | // Handle: [ owner, { properties } ] args | ||
4010 | } else { | ||
4011 | |||
4012 | // Copy the properties one-by-one to the cache object | ||
4013 | for ( prop in data ) { | ||
4014 | cache[ jQuery.camelCase( prop ) ] = data[ prop ]; | ||
4015 | } | ||
4016 | } | ||
4017 | return cache; | ||
4018 | }, | ||
4019 | get: function( owner, key ) { | ||
4020 | return key === undefined ? | ||
4021 | this.cache( owner ) : | ||
4022 | |||
4023 | // Always use camelCase key (gh-2257) | ||
4024 | owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; | ||
4025 | }, | ||
4026 | access: function( owner, key, value ) { | ||
4027 | |||
4028 | // In cases where either: | ||
4029 | // | ||
4030 | // 1. No key was specified | ||
4031 | // 2. A string key was specified, but no value provided | ||
4032 | // | ||
4033 | // Take the "read" path and allow the get method to determine | ||
4034 | // which value to return, respectively either: | ||
4035 | // | ||
4036 | // 1. The entire cache object | ||
4037 | // 2. The data stored at the key | ||
4038 | // | ||
4039 | if ( key === undefined || | ||
4040 | ( ( key && typeof key === "string" ) && value === undefined ) ) { | ||
4041 | |||
4042 | return this.get( owner, key ); | ||
4043 | } | ||
4044 | |||
4045 | // When the key is not a string, or both a key and value | ||
4046 | // are specified, set or extend (existing objects) with either: | ||
4047 | // | ||
4048 | // 1. An object of properties | ||
4049 | // 2. A key and value | ||
4050 | // | ||
4051 | this.set( owner, key, value ); | ||
4052 | |||
4053 | // Since the "set" path can have two possible entry points | ||
4054 | // return the expected data based on which path was taken[*] | ||
4055 | return value !== undefined ? value : key; | ||
4056 | }, | ||
4057 | remove: function( owner, key ) { | ||
4058 | var i, | ||
4059 | cache = owner[ this.expando ]; | ||
4060 | |||
4061 | if ( cache === undefined ) { | ||
4062 | return; | ||
4063 | } | ||
4064 | |||
4065 | if ( key !== undefined ) { | ||
4066 | |||
4067 | // Support array or space separated string of keys | ||
4068 | if ( jQuery.isArray( key ) ) { | ||
4069 | |||
4070 | // If key is an array of keys... | ||
4071 | // We always set camelCase keys, so remove that. | ||
4072 | key = key.map( jQuery.camelCase ); | ||
4073 | } else { | ||
4074 | key = jQuery.camelCase( key ); | ||
4075 | |||
4076 | // If a key with the spaces exists, use it. | ||
4077 | // Otherwise, create an array by matching non-whitespace | ||
4078 | key = key in cache ? | ||
4079 | [ key ] : | ||
4080 | ( key.match( rnotwhite ) || [] ); | ||
4081 | } | ||
4082 | |||
4083 | i = key.length; | ||
4084 | |||
4085 | while ( i-- ) { | ||
4086 | delete cache[ key[ i ] ]; | ||
4087 | } | ||
4088 | } | ||
4089 | |||
4090 | // Remove the expando if there's no more data | ||
4091 | if ( key === undefined || jQuery.isEmptyObject( cache ) ) { | ||
4092 | |||
4093 | // Support: Chrome <=35 - 45 | ||
4094 | // Webkit & Blink performance suffers when deleting properties | ||
4095 | // from DOM nodes, so set to undefined instead | ||
4096 | // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) | ||
4097 | if ( owner.nodeType ) { | ||
4098 | owner[ this.expando ] = undefined; | ||
4099 | } else { | ||
4100 | delete owner[ this.expando ]; | ||
4101 | } | ||
4102 | } | ||
4103 | }, | ||
4104 | hasData: function( owner ) { | ||
4105 | var cache = owner[ this.expando ]; | ||
4106 | return cache !== undefined && !jQuery.isEmptyObject( cache ); | ||
4107 | } | ||
4108 | }; | ||
4109 | var dataPriv = new Data(); | ||
4110 | |||
4111 | var dataUser = new Data(); | ||
4112 | |||
4113 | |||
4114 | |||
4115 | // Implementation Summary | ||
4116 | // | ||
4117 | // 1. Enforce API surface and semantic compatibility with 1.9.x branch | ||
4118 | // 2. Improve the module's maintainability by reducing the storage | ||
4119 | // paths to a single mechanism. | ||
4120 | // 3. Use the same single mechanism to support "private" and "user" data. | ||
4121 | // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) | ||
4122 | // 5. Avoid exposing implementation details on user objects (eg. expando properties) | ||
4123 | // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 | ||
4124 | |||
4125 | var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | ||
4126 | rmultiDash = /[A-Z]/g; | ||
4127 | |||
4128 | function dataAttr( elem, key, data ) { | ||
4129 | var name; | ||
4130 | |||
4131 | // If nothing was found internally, try to fetch any | ||
4132 | // data from the HTML5 data-* attribute | ||
4133 | if ( data === undefined && elem.nodeType === 1 ) { | ||
4134 | name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); | ||
4135 | data = elem.getAttribute( name ); | ||
4136 | |||
4137 | if ( typeof data === "string" ) { | ||
4138 | try { | ||
4139 | data = data === "true" ? true : | ||
4140 | data === "false" ? false : | ||
4141 | data === "null" ? null : | ||
4142 | |||
4143 | // Only convert to a number if it doesn't change the string | ||
4144 | +data + "" === data ? +data : | ||
4145 | rbrace.test( data ) ? JSON.parse( data ) : | ||
4146 | data; | ||
4147 | } catch ( e ) {} | ||
4148 | |||
4149 | // Make sure we set the data so it isn't changed later | ||
4150 | dataUser.set( elem, key, data ); | ||
4151 | } else { | ||
4152 | data = undefined; | ||
4153 | } | ||
4154 | } | ||
4155 | return data; | ||
4156 | } | ||
4157 | |||
4158 | jQuery.extend( { | ||
4159 | hasData: function( elem ) { | ||
4160 | return dataUser.hasData( elem ) || dataPriv.hasData( elem ); | ||
4161 | }, | ||
4162 | |||
4163 | data: function( elem, name, data ) { | ||
4164 | return dataUser.access( elem, name, data ); | ||
4165 | }, | ||
4166 | |||
4167 | removeData: function( elem, name ) { | ||
4168 | dataUser.remove( elem, name ); | ||
4169 | }, | ||
4170 | |||
4171 | // TODO: Now that all calls to _data and _removeData have been replaced | ||
4172 | // with direct calls to dataPriv methods, these can be deprecated. | ||
4173 | _data: function( elem, name, data ) { | ||
4174 | return dataPriv.access( elem, name, data ); | ||
4175 | }, | ||
4176 | |||
4177 | _removeData: function( elem, name ) { | ||
4178 | dataPriv.remove( elem, name ); | ||
4179 | } | ||
4180 | } ); | ||
4181 | |||
4182 | jQuery.fn.extend( { | ||
4183 | data: function( key, value ) { | ||
4184 | var i, name, data, | ||
4185 | elem = this[ 0 ], | ||
4186 | attrs = elem && elem.attributes; | ||
4187 | |||
4188 | // Gets all values | ||
4189 | if ( key === undefined ) { | ||
4190 | if ( this.length ) { | ||
4191 | data = dataUser.get( elem ); | ||
4192 | |||
4193 | if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { | ||
4194 | i = attrs.length; | ||
4195 | while ( i-- ) { | ||
4196 | |||
4197 | // Support: IE 11 only | ||
4198 | // The attrs elements can be null (#14894) | ||
4199 | if ( attrs[ i ] ) { | ||
4200 | name = attrs[ i ].name; | ||
4201 | if ( name.indexOf( "data-" ) === 0 ) { | ||
4202 | name = jQuery.camelCase( name.slice( 5 ) ); | ||
4203 | dataAttr( elem, name, data[ name ] ); | ||
4204 | } | ||
4205 | } | ||
4206 | } | ||
4207 | dataPriv.set( elem, "hasDataAttrs", true ); | ||
4208 | } | ||
4209 | } | ||
4210 | |||
4211 | return data; | ||
4212 | } | ||
4213 | |||
4214 | // Sets multiple values | ||
4215 | if ( typeof key === "object" ) { | ||
4216 | return this.each( function() { | ||
4217 | dataUser.set( this, key ); | ||
4218 | } ); | ||
4219 | } | ||
4220 | |||
4221 | return access( this, function( value ) { | ||
4222 | var data; | ||
4223 | |||
4224 | // The calling jQuery object (element matches) is not empty | ||
4225 | // (and therefore has an element appears at this[ 0 ]) and the | ||
4226 | // `value` parameter was not undefined. An empty jQuery object | ||
4227 | // will result in `undefined` for elem = this[ 0 ] which will | ||
4228 | // throw an exception if an attempt to read a data cache is made. | ||
4229 | if ( elem && value === undefined ) { | ||
4230 | |||
4231 | // Attempt to get data from the cache | ||
4232 | // The key will always be camelCased in Data | ||
4233 | data = dataUser.get( elem, key ); | ||
4234 | if ( data !== undefined ) { | ||
4235 | return data; | ||
4236 | } | ||
4237 | |||
4238 | // Attempt to "discover" the data in | ||
4239 | // HTML5 custom data-* attrs | ||
4240 | data = dataAttr( elem, key ); | ||
4241 | if ( data !== undefined ) { | ||
4242 | return data; | ||
4243 | } | ||
4244 | |||
4245 | // We tried really hard, but the data doesn't exist. | ||
4246 | return; | ||
4247 | } | ||
4248 | |||
4249 | // Set the data... | ||
4250 | this.each( function() { | ||
4251 | |||
4252 | // We always store the camelCased key | ||
4253 | dataUser.set( this, key, value ); | ||
4254 | } ); | ||
4255 | }, null, value, arguments.length > 1, null, true ); | ||
4256 | }, | ||
4257 | |||
4258 | removeData: function( key ) { | ||
4259 | return this.each( function() { | ||
4260 | dataUser.remove( this, key ); | ||
4261 | } ); | ||
4262 | } | ||
4263 | } ); | ||
4264 | |||
4265 | |||
4266 | jQuery.extend( { | ||
4267 | queue: function( elem, type, data ) { | ||
4268 | var queue; | ||
4269 | |||
4270 | if ( elem ) { | ||
4271 | type = ( type || "fx" ) + "queue"; | ||
4272 | queue = dataPriv.get( elem, type ); | ||
4273 | |||
4274 | // Speed up dequeue by getting out quickly if this is just a lookup | ||
4275 | if ( data ) { | ||
4276 | if ( !queue || jQuery.isArray( data ) ) { | ||
4277 | queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); | ||
4278 | } else { | ||
4279 | queue.push( data ); | ||
4280 | } | ||
4281 | } | ||
4282 | return queue || []; | ||
4283 | } | ||
4284 | }, | ||
4285 | |||
4286 | dequeue: function( elem, type ) { | ||
4287 | type = type || "fx"; | ||
4288 | |||
4289 | var queue = jQuery.queue( elem, type ), | ||
4290 | startLength = queue.length, | ||
4291 | fn = queue.shift(), | ||
4292 | hooks = jQuery._queueHooks( elem, type ), | ||
4293 | next = function() { | ||
4294 | jQuery.dequeue( elem, type ); | ||
4295 | }; | ||
4296 | |||
4297 | // If the fx queue is dequeued, always remove the progress sentinel | ||
4298 | if ( fn === "inprogress" ) { | ||
4299 | fn = queue.shift(); | ||
4300 | startLength--; | ||
4301 | } | ||
4302 | |||
4303 | if ( fn ) { | ||
4304 | |||
4305 | // Add a progress sentinel to prevent the fx queue from being | ||
4306 | // automatically dequeued | ||
4307 | if ( type === "fx" ) { | ||
4308 | queue.unshift( "inprogress" ); | ||
4309 | } | ||
4310 | |||
4311 | // Clear up the last queue stop function | ||
4312 | delete hooks.stop; | ||
4313 | fn.call( elem, next, hooks ); | ||
4314 | } | ||
4315 | |||
4316 | if ( !startLength && hooks ) { | ||
4317 | hooks.empty.fire(); | ||
4318 | } | ||
4319 | }, | ||
4320 | |||
4321 | // Not public - generate a queueHooks object, or return the current one | ||
4322 | _queueHooks: function( elem, type ) { | ||
4323 | var key = type + "queueHooks"; | ||
4324 | return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { | ||
4325 | empty: jQuery.Callbacks( "once memory" ).add( function() { | ||
4326 | dataPriv.remove( elem, [ type + "queue", key ] ); | ||
4327 | } ) | ||
4328 | } ); | ||
4329 | } | ||
4330 | } ); | ||
4331 | |||
4332 | jQuery.fn.extend( { | ||
4333 | queue: function( type, data ) { | ||
4334 | var setter = 2; | ||
4335 | |||
4336 | if ( typeof type !== "string" ) { | ||
4337 | data = type; | ||
4338 | type = "fx"; | ||
4339 | setter--; | ||
4340 | } | ||
4341 | |||
4342 | if ( arguments.length < setter ) { | ||
4343 | return jQuery.queue( this[ 0 ], type ); | ||
4344 | } | ||
4345 | |||
4346 | return data === undefined ? | ||
4347 | this : | ||
4348 | this.each( function() { | ||
4349 | var queue = jQuery.queue( this, type, data ); | ||
4350 | |||
4351 | // Ensure a hooks for this queue | ||
4352 | jQuery._queueHooks( this, type ); | ||
4353 | |||
4354 | if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { | ||
4355 | jQuery.dequeue( this, type ); | ||
4356 | } | ||
4357 | } ); | ||
4358 | }, | ||
4359 | dequeue: function( type ) { | ||
4360 | return this.each( function() { | ||
4361 | jQuery.dequeue( this, type ); | ||
4362 | } ); | ||
4363 | }, | ||
4364 | clearQueue: function( type ) { | ||
4365 | return this.queue( type || "fx", [] ); | ||
4366 | }, | ||
4367 | |||
4368 | // Get a promise resolved when queues of a certain type | ||
4369 | // are emptied (fx is the type by default) | ||
4370 | promise: function( type, obj ) { | ||
4371 | var tmp, | ||
4372 | count = 1, | ||
4373 | defer = jQuery.Deferred(), | ||
4374 | elements = this, | ||
4375 | i = this.length, | ||
4376 | resolve = function() { | ||
4377 | if ( !( --count ) ) { | ||
4378 | defer.resolveWith( elements, [ elements ] ); | ||
4379 | } | ||
4380 | }; | ||
4381 | |||
4382 | if ( typeof type !== "string" ) { | ||
4383 | obj = type; | ||
4384 | type = undefined; | ||
4385 | } | ||
4386 | type = type || "fx"; | ||
4387 | |||
4388 | while ( i-- ) { | ||
4389 | tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); | ||
4390 | if ( tmp && tmp.empty ) { | ||
4391 | count++; | ||
4392 | tmp.empty.add( resolve ); | ||
4393 | } | ||
4394 | } | ||
4395 | resolve(); | ||
4396 | return defer.promise( obj ); | ||
4397 | } | ||
4398 | } ); | ||
4399 | var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; | ||
4400 | |||
4401 | var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); | ||
4402 | |||
4403 | |||
4404 | var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; | ||
4405 | |||
4406 | var isHiddenWithinTree = function( elem, el ) { | ||
4407 | |||
4408 | // isHiddenWithinTree might be called from jQuery#filter function; | ||
4409 | // in that case, element will be second argument | ||
4410 | elem = el || elem; | ||
4411 | |||
4412 | // Inline style trumps all | ||
4413 | return elem.style.display === "none" || | ||
4414 | elem.style.display === "" && | ||
4415 | |||
4416 | // Otherwise, check computed style | ||
4417 | // Support: Firefox <=43 - 45 | ||
4418 | // Disconnected elements can have computed display: none, so first confirm that elem is | ||
4419 | // in the document. | ||
4420 | jQuery.contains( elem.ownerDocument, elem ) && | ||
4421 | |||
4422 | jQuery.css( elem, "display" ) === "none"; | ||
4423 | }; | ||
4424 | |||
4425 | var swap = function( elem, options, callback, args ) { | ||
4426 | var ret, name, | ||
4427 | old = {}; | ||
4428 | |||
4429 | // Remember the old values, and insert the new ones | ||
4430 | for ( name in options ) { | ||
4431 | old[ name ] = elem.style[ name ]; | ||
4432 | elem.style[ name ] = options[ name ]; | ||
4433 | } | ||
4434 | |||
4435 | ret = callback.apply( elem, args || [] ); | ||
4436 | |||
4437 | // Revert the old values | ||
4438 | for ( name in options ) { | ||
4439 | elem.style[ name ] = old[ name ]; | ||
4440 | } | ||
4441 | |||
4442 | return ret; | ||
4443 | }; | ||
4444 | |||
4445 | |||
4446 | |||
4447 | |||
4448 | function adjustCSS( elem, prop, valueParts, tween ) { | ||
4449 | var adjusted, | ||
4450 | scale = 1, | ||
4451 | maxIterations = 20, | ||
4452 | currentValue = tween ? | ||
4453 | function() { | ||
4454 | return tween.cur(); | ||
4455 | } : | ||
4456 | function() { | ||
4457 | return jQuery.css( elem, prop, "" ); | ||
4458 | }, | ||
4459 | initial = currentValue(), | ||
4460 | unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), | ||
4461 | |||
4462 | // Starting value computation is required for potential unit mismatches | ||
4463 | initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && | ||
4464 | rcssNum.exec( jQuery.css( elem, prop ) ); | ||
4465 | |||
4466 | if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { | ||
4467 | |||
4468 | // Trust units reported by jQuery.css | ||
4469 | unit = unit || initialInUnit[ 3 ]; | ||
4470 | |||
4471 | // Make sure we update the tween properties later on | ||
4472 | valueParts = valueParts || []; | ||
4473 | |||
4474 | // Iteratively approximate from a nonzero starting point | ||
4475 | initialInUnit = +initial || 1; | ||
4476 | |||
4477 | do { | ||
4478 | |||
4479 | // If previous iteration zeroed out, double until we get *something*. | ||
4480 | // Use string for doubling so we don't accidentally see scale as unchanged below | ||
4481 | scale = scale || ".5"; | ||
4482 | |||
4483 | // Adjust and apply | ||
4484 | initialInUnit = initialInUnit / scale; | ||
4485 | jQuery.style( elem, prop, initialInUnit + unit ); | ||
4486 | |||
4487 | // Update scale, tolerating zero or NaN from tween.cur() | ||
4488 | // Break the loop if scale is unchanged or perfect, or if we've just had enough. | ||
4489 | } while ( | ||
4490 | scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations | ||
4491 | ); | ||
4492 | } | ||
4493 | |||
4494 | if ( valueParts ) { | ||
4495 | initialInUnit = +initialInUnit || +initial || 0; | ||
4496 | |||
4497 | // Apply relative offset (+=/-=) if specified | ||
4498 | adjusted = valueParts[ 1 ] ? | ||
4499 | initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : | ||
4500 | +valueParts[ 2 ]; | ||
4501 | if ( tween ) { | ||
4502 | tween.unit = unit; | ||
4503 | tween.start = initialInUnit; | ||
4504 | tween.end = adjusted; | ||
4505 | } | ||
4506 | } | ||
4507 | return adjusted; | ||
4508 | } | ||
4509 | |||
4510 | |||
4511 | var defaultDisplayMap = {}; | ||
4512 | |||
4513 | function getDefaultDisplay( elem ) { | ||
4514 | var temp, | ||
4515 | doc = elem.ownerDocument, | ||
4516 | nodeName = elem.nodeName, | ||
4517 | display = defaultDisplayMap[ nodeName ]; | ||
4518 | |||
4519 | if ( display ) { | ||
4520 | return display; | ||
4521 | } | ||
4522 | |||
4523 | temp = doc.body.appendChild( doc.createElement( nodeName ) ), | ||
4524 | display = jQuery.css( temp, "display" ); | ||
4525 | |||
4526 | temp.parentNode.removeChild( temp ); | ||
4527 | |||
4528 | if ( display === "none" ) { | ||
4529 | display = "block"; | ||
4530 | } | ||
4531 | defaultDisplayMap[ nodeName ] = display; | ||
4532 | |||
4533 | return display; | ||
4534 | } | ||
4535 | |||
4536 | function showHide( elements, show ) { | ||
4537 | var display, elem, | ||
4538 | values = [], | ||
4539 | index = 0, | ||
4540 | length = elements.length; | ||
4541 | |||
4542 | // Determine new display value for elements that need to change | ||
4543 | for ( ; index < length; index++ ) { | ||
4544 | elem = elements[ index ]; | ||
4545 | if ( !elem.style ) { | ||
4546 | continue; | ||
4547 | } | ||
4548 | |||
4549 | display = elem.style.display; | ||
4550 | if ( show ) { | ||
4551 | |||
4552 | // Since we force visibility upon cascade-hidden elements, an immediate (and slow) | ||
4553 | // check is required in this first loop unless we have a nonempty display value (either | ||
4554 | // inline or about-to-be-restored) | ||
4555 | if ( display === "none" ) { | ||
4556 | values[ index ] = dataPriv.get( elem, "display" ) || null; | ||
4557 | if ( !values[ index ] ) { | ||
4558 | elem.style.display = ""; | ||
4559 | } | ||
4560 | } | ||
4561 | if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { | ||
4562 | values[ index ] = getDefaultDisplay( elem ); | ||
4563 | } | ||
4564 | } else { | ||
4565 | if ( display !== "none" ) { | ||
4566 | values[ index ] = "none"; | ||
4567 | |||
4568 | // Remember what we're overwriting | ||
4569 | dataPriv.set( elem, "display", display ); | ||
4570 | } | ||
4571 | } | ||
4572 | } | ||
4573 | |||
4574 | // Set the display of the elements in a second loop to avoid constant reflow | ||
4575 | for ( index = 0; index < length; index++ ) { | ||
4576 | if ( values[ index ] != null ) { | ||
4577 | elements[ index ].style.display = values[ index ]; | ||
4578 | } | ||
4579 | } | ||
4580 | |||
4581 | return elements; | ||
4582 | } | ||
4583 | |||
4584 | jQuery.fn.extend( { | ||
4585 | show: function() { | ||
4586 | return showHide( this, true ); | ||
4587 | }, | ||
4588 | hide: function() { | ||
4589 | return showHide( this ); | ||
4590 | }, | ||
4591 | toggle: function( state ) { | ||
4592 | if ( typeof state === "boolean" ) { | ||
4593 | return state ? this.show() : this.hide(); | ||
4594 | } | ||
4595 | |||
4596 | return this.each( function() { | ||
4597 | if ( isHiddenWithinTree( this ) ) { | ||
4598 | jQuery( this ).show(); | ||
4599 | } else { | ||
4600 | jQuery( this ).hide(); | ||
4601 | } | ||
4602 | } ); | ||
4603 | } | ||
4604 | } ); | ||
4605 | var rcheckableType = ( /^(?:checkbox|radio)$/i ); | ||
4606 | |||
4607 | var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); | ||
4608 | |||
4609 | var rscriptType = ( /^$|\/(?:java|ecma)script/i ); | ||
4610 | |||
4611 | |||
4612 | |||
4613 | // We have to close these tags to support XHTML (#13200) | ||
4614 | var wrapMap = { | ||
4615 | |||
4616 | // Support: IE <=9 only | ||
4617 | option: [ 1, "<select multiple='multiple'>", "</select>" ], | ||
4618 | |||
4619 | // XHTML parsers do not magically insert elements in the | ||
4620 | // same way that tag soup parsers do. So we cannot shorten | ||
4621 | // this by omitting <tbody> or other required elements. | ||
4622 | thead: [ 1, "<table>", "</table>" ], | ||
4623 | col: [ 2, "<table><colgroup>", "</colgroup></table>" ], | ||
4624 | tr: [ 2, "<table><tbody>", "</tbody></table>" ], | ||
4625 | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], | ||
4626 | |||
4627 | _default: [ 0, "", "" ] | ||
4628 | }; | ||
4629 | |||
4630 | // Support: IE <=9 only | ||
4631 | wrapMap.optgroup = wrapMap.option; | ||
4632 | |||
4633 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | ||
4634 | wrapMap.th = wrapMap.td; | ||
4635 | |||
4636 | |||
4637 | function getAll( context, tag ) { | ||
4638 | |||
4639 | // Support: IE <=9 - 11 only | ||
4640 | // Use typeof to avoid zero-argument method invocation on host objects (#15151) | ||
4641 | var ret = typeof context.getElementsByTagName !== "undefined" ? | ||
4642 | context.getElementsByTagName( tag || "*" ) : | ||
4643 | typeof context.querySelectorAll !== "undefined" ? | ||
4644 | context.querySelectorAll( tag || "*" ) : | ||
4645 | []; | ||
4646 | |||
4647 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? | ||
4648 | jQuery.merge( [ context ], ret ) : | ||
4649 | ret; | ||
4650 | } | ||
4651 | |||
4652 | |||
4653 | // Mark scripts as having already been evaluated | ||
4654 | function setGlobalEval( elems, refElements ) { | ||
4655 | var i = 0, | ||
4656 | l = elems.length; | ||
4657 | |||
4658 | for ( ; i < l; i++ ) { | ||
4659 | dataPriv.set( | ||
4660 | elems[ i ], | ||
4661 | "globalEval", | ||
4662 | !refElements || dataPriv.get( refElements[ i ], "globalEval" ) | ||
4663 | ); | ||
4664 | } | ||
4665 | } | ||
4666 | |||
4667 | |||
4668 | var rhtml = /<|&#?\w+;/; | ||
4669 | |||
4670 | function buildFragment( elems, context, scripts, selection, ignored ) { | ||
4671 | var elem, tmp, tag, wrap, contains, j, | ||
4672 | fragment = context.createDocumentFragment(), | ||
4673 | nodes = [], | ||
4674 | i = 0, | ||
4675 | l = elems.length; | ||
4676 | |||
4677 | for ( ; i < l; i++ ) { | ||
4678 | elem = elems[ i ]; | ||
4679 | |||
4680 | if ( elem || elem === 0 ) { | ||
4681 | |||
4682 | // Add nodes directly | ||
4683 | if ( jQuery.type( elem ) === "object" ) { | ||
4684 | |||
4685 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
4686 | // push.apply(_, arraylike) throws on ancient WebKit | ||
4687 | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); | ||
4688 | |||
4689 | // Convert non-html into a text node | ||
4690 | } else if ( !rhtml.test( elem ) ) { | ||
4691 | nodes.push( context.createTextNode( elem ) ); | ||
4692 | |||
4693 | // Convert html into DOM nodes | ||
4694 | } else { | ||
4695 | tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); | ||
4696 | |||
4697 | // Deserialize a standard representation | ||
4698 | tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); | ||
4699 | wrap = wrapMap[ tag ] || wrapMap._default; | ||
4700 | tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; | ||
4701 | |||
4702 | // Descend through wrappers to the right content | ||
4703 | j = wrap[ 0 ]; | ||
4704 | while ( j-- ) { | ||
4705 | tmp = tmp.lastChild; | ||
4706 | } | ||
4707 | |||
4708 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
4709 | // push.apply(_, arraylike) throws on ancient WebKit | ||
4710 | jQuery.merge( nodes, tmp.childNodes ); | ||
4711 | |||
4712 | // Remember the top-level container | ||
4713 | tmp = fragment.firstChild; | ||
4714 | |||
4715 | // Ensure the created nodes are orphaned (#12392) | ||
4716 | tmp.textContent = ""; | ||
4717 | } | ||
4718 | } | ||
4719 | } | ||
4720 | |||
4721 | // Remove wrapper from fragment | ||
4722 | fragment.textContent = ""; | ||
4723 | |||
4724 | i = 0; | ||
4725 | while ( ( elem = nodes[ i++ ] ) ) { | ||
4726 | |||
4727 | // Skip elements already in the context collection (trac-4087) | ||
4728 | if ( selection && jQuery.inArray( elem, selection ) > -1 ) { | ||
4729 | if ( ignored ) { | ||
4730 | ignored.push( elem ); | ||
4731 | } | ||
4732 | continue; | ||
4733 | } | ||
4734 | |||
4735 | contains = jQuery.contains( elem.ownerDocument, elem ); | ||
4736 | |||
4737 | // Append to fragment | ||
4738 | tmp = getAll( fragment.appendChild( elem ), "script" ); | ||
4739 | |||
4740 | // Preserve script evaluation history | ||
4741 | if ( contains ) { | ||
4742 | setGlobalEval( tmp ); | ||
4743 | } | ||
4744 | |||
4745 | // Capture executables | ||
4746 | if ( scripts ) { | ||
4747 | j = 0; | ||
4748 | while ( ( elem = tmp[ j++ ] ) ) { | ||
4749 | if ( rscriptType.test( elem.type || "" ) ) { | ||
4750 | scripts.push( elem ); | ||
4751 | } | ||
4752 | } | ||
4753 | } | ||
4754 | } | ||
4755 | |||
4756 | return fragment; | ||
4757 | } | ||
4758 | |||
4759 | |||
4760 | ( function() { | ||
4761 | var fragment = document.createDocumentFragment(), | ||
4762 | div = fragment.appendChild( document.createElement( "div" ) ), | ||
4763 | input = document.createElement( "input" ); | ||
4764 | |||
4765 | // Support: Android 4.0 - 4.3 only | ||
4766 | // Check state lost if the name is set (#11217) | ||
4767 | // Support: Windows Web Apps (WWA) | ||
4768 | // `name` and `type` must use .setAttribute for WWA (#14901) | ||
4769 | input.setAttribute( "type", "radio" ); | ||
4770 | input.setAttribute( "checked", "checked" ); | ||
4771 | input.setAttribute( "name", "t" ); | ||
4772 | |||
4773 | div.appendChild( input ); | ||
4774 | |||
4775 | // Support: Android <=4.1 only | ||
4776 | // Older WebKit doesn't clone checked state correctly in fragments | ||
4777 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; | ||
4778 | |||
4779 | // Support: IE <=11 only | ||
4780 | // Make sure textarea (and checkbox) defaultValue is properly cloned | ||
4781 | div.innerHTML = "<textarea>x</textarea>"; | ||
4782 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; | ||
4783 | } )(); | ||
4784 | var documentElement = document.documentElement; | ||
4785 | |||
4786 | |||
4787 | |||
4788 | var | ||
4789 | rkeyEvent = /^key/, | ||
4790 | rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, | ||
4791 | rtypenamespace = /^([^.]*)(?:\.(.+)|)/; | ||
4792 | |||
4793 | function returnTrue() { | ||
4794 | return true; | ||
4795 | } | ||
4796 | |||
4797 | function returnFalse() { | ||
4798 | return false; | ||
4799 | } | ||
4800 | |||
4801 | // Support: IE <=9 only | ||
4802 | // See #13393 for more info | ||
4803 | function safeActiveElement() { | ||
4804 | try { | ||
4805 | return document.activeElement; | ||
4806 | } catch ( err ) { } | ||
4807 | } | ||
4808 | |||
4809 | function on( elem, types, selector, data, fn, one ) { | ||
4810 | var origFn, type; | ||
4811 | |||
4812 | // Types can be a map of types/handlers | ||
4813 | if ( typeof types === "object" ) { | ||
4814 | |||
4815 | // ( types-Object, selector, data ) | ||
4816 | if ( typeof selector !== "string" ) { | ||
4817 | |||
4818 | // ( types-Object, data ) | ||
4819 | data = data || selector; | ||
4820 | selector = undefined; | ||
4821 | } | ||
4822 | for ( type in types ) { | ||
4823 | on( elem, type, selector, data, types[ type ], one ); | ||
4824 | } | ||
4825 | return elem; | ||
4826 | } | ||
4827 | |||
4828 | if ( data == null && fn == null ) { | ||
4829 | |||
4830 | // ( types, fn ) | ||
4831 | fn = selector; | ||
4832 | data = selector = undefined; | ||
4833 | } else if ( fn == null ) { | ||
4834 | if ( typeof selector === "string" ) { | ||
4835 | |||
4836 | // ( types, selector, fn ) | ||
4837 | fn = data; | ||
4838 | data = undefined; | ||
4839 | } else { | ||
4840 | |||
4841 | // ( types, data, fn ) | ||
4842 | fn = data; | ||
4843 | data = selector; | ||
4844 | selector = undefined; | ||
4845 | } | ||
4846 | } | ||
4847 | if ( fn === false ) { | ||
4848 | fn = returnFalse; | ||
4849 | } else if ( !fn ) { | ||
4850 | return elem; | ||
4851 | } | ||
4852 | |||
4853 | if ( one === 1 ) { | ||
4854 | origFn = fn; | ||
4855 | fn = function( event ) { | ||
4856 | |||
4857 | // Can use an empty set, since event contains the info | ||
4858 | jQuery().off( event ); | ||
4859 | return origFn.apply( this, arguments ); | ||
4860 | }; | ||
4861 | |||
4862 | // Use same guid so caller can remove using origFn | ||
4863 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); | ||
4864 | } | ||
4865 | return elem.each( function() { | ||
4866 | jQuery.event.add( this, types, fn, data, selector ); | ||
4867 | } ); | ||
4868 | } | ||
4869 | |||
4870 | /* | ||
4871 | * Helper functions for managing events -- not part of the public interface. | ||
4872 | * Props to Dean Edwards' addEvent library for many of the ideas. | ||
4873 | */ | ||
4874 | jQuery.event = { | ||
4875 | |||
4876 | global: {}, | ||
4877 | |||
4878 | add: function( elem, types, handler, data, selector ) { | ||
4879 | |||
4880 | var handleObjIn, eventHandle, tmp, | ||
4881 | events, t, handleObj, | ||
4882 | special, handlers, type, namespaces, origType, | ||
4883 | elemData = dataPriv.get( elem ); | ||
4884 | |||
4885 | // Don't attach events to noData or text/comment nodes (but allow plain objects) | ||
4886 | if ( !elemData ) { | ||
4887 | return; | ||
4888 | } | ||
4889 | |||
4890 | // Caller can pass in an object of custom data in lieu of the handler | ||
4891 | if ( handler.handler ) { | ||
4892 | handleObjIn = handler; | ||
4893 | handler = handleObjIn.handler; | ||
4894 | selector = handleObjIn.selector; | ||
4895 | } | ||
4896 | |||
4897 | // Ensure that invalid selectors throw exceptions at attach time | ||
4898 | // Evaluate against documentElement in case elem is a non-element node (e.g., document) | ||
4899 | if ( selector ) { | ||
4900 | jQuery.find.matchesSelector( documentElement, selector ); | ||
4901 | } | ||
4902 | |||
4903 | // Make sure that the handler has a unique ID, used to find/remove it later | ||
4904 | if ( !handler.guid ) { | ||
4905 | handler.guid = jQuery.guid++; | ||
4906 | } | ||
4907 | |||
4908 | // Init the element's event structure and main handler, if this is the first | ||
4909 | if ( !( events = elemData.events ) ) { | ||
4910 | events = elemData.events = {}; | ||
4911 | } | ||
4912 | if ( !( eventHandle = elemData.handle ) ) { | ||
4913 | eventHandle = elemData.handle = function( e ) { | ||
4914 | |||
4915 | // Discard the second event of a jQuery.event.trigger() and | ||
4916 | // when an event is called after a page has unloaded | ||
4917 | return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? | ||
4918 | jQuery.event.dispatch.apply( elem, arguments ) : undefined; | ||
4919 | }; | ||
4920 | } | ||
4921 | |||
4922 | // Handle multiple events separated by a space | ||
4923 | types = ( types || "" ).match( rnotwhite ) || [ "" ]; | ||
4924 | t = types.length; | ||
4925 | while ( t-- ) { | ||
4926 | tmp = rtypenamespace.exec( types[ t ] ) || []; | ||
4927 | type = origType = tmp[ 1 ]; | ||
4928 | namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); | ||
4929 | |||
4930 | // There *must* be a type, no attaching namespace-only handlers | ||
4931 | if ( !type ) { | ||
4932 | continue; | ||
4933 | } | ||
4934 | |||
4935 | // If event changes its type, use the special event handlers for the changed type | ||
4936 | special = jQuery.event.special[ type ] || {}; | ||
4937 | |||
4938 | // If selector defined, determine special event api type, otherwise given type | ||
4939 | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
4940 | |||
4941 | // Update special based on newly reset type | ||
4942 | special = jQuery.event.special[ type ] || {}; | ||
4943 | |||
4944 | // handleObj is passed to all event handlers | ||
4945 | handleObj = jQuery.extend( { | ||
4946 | type: type, | ||
4947 | origType: origType, | ||
4948 | data: data, | ||
4949 | handler: handler, | ||
4950 | guid: handler.guid, | ||
4951 | selector: selector, | ||
4952 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ), | ||
4953 | namespace: namespaces.join( "." ) | ||
4954 | }, handleObjIn ); | ||
4955 | |||
4956 | // Init the event handler queue if we're the first | ||
4957 | if ( !( handlers = events[ type ] ) ) { | ||
4958 | handlers = events[ type ] = []; | ||
4959 | handlers.delegateCount = 0; | ||
4960 | |||
4961 | // Only use addEventListener if the special events handler returns false | ||
4962 | if ( !special.setup || | ||
4963 | special.setup.call( elem, data, namespaces, eventHandle ) === false ) { | ||
4964 | |||
4965 | if ( elem.addEventListener ) { | ||
4966 | elem.addEventListener( type, eventHandle ); | ||
4967 | } | ||
4968 | } | ||
4969 | } | ||
4970 | |||
4971 | if ( special.add ) { | ||
4972 | special.add.call( elem, handleObj ); | ||
4973 | |||
4974 | if ( !handleObj.handler.guid ) { | ||
4975 | handleObj.handler.guid = handler.guid; | ||
4976 | } | ||
4977 | } | ||
4978 | |||
4979 | // Add to the element's handler list, delegates in front | ||
4980 | if ( selector ) { | ||
4981 | handlers.splice( handlers.delegateCount++, 0, handleObj ); | ||
4982 | } else { | ||
4983 | handlers.push( handleObj ); | ||
4984 | } | ||
4985 | |||
4986 | // Keep track of which events have ever been used, for event optimization | ||
4987 | jQuery.event.global[ type ] = true; | ||
4988 | } | ||
4989 | |||
4990 | }, | ||
4991 | |||
4992 | // Detach an event or set of events from an element | ||
4993 | remove: function( elem, types, handler, selector, mappedTypes ) { | ||
4994 | |||
4995 | var j, origCount, tmp, | ||
4996 | events, t, handleObj, | ||
4997 | special, handlers, type, namespaces, origType, | ||
4998 | elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); | ||
4999 | |||
5000 | if ( !elemData || !( events = elemData.events ) ) { | ||
5001 | return; | ||
5002 | } | ||
5003 | |||
5004 | // Once for each type.namespace in types; type may be omitted | ||
5005 | types = ( types || "" ).match( rnotwhite ) || [ "" ]; | ||
5006 | t = types.length; | ||
5007 | while ( t-- ) { | ||
5008 | tmp = rtypenamespace.exec( types[ t ] ) || []; | ||
5009 | type = origType = tmp[ 1 ]; | ||
5010 | namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); | ||
5011 | |||
5012 | // Unbind all events (on this namespace, if provided) for the element | ||
5013 | if ( !type ) { | ||
5014 | for ( type in events ) { | ||
5015 | jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); | ||
5016 | } | ||
5017 | continue; | ||
5018 | } | ||
5019 | |||
5020 | special = jQuery.event.special[ type ] || {}; | ||
5021 | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
5022 | handlers = events[ type ] || []; | ||
5023 | tmp = tmp[ 2 ] && | ||
5024 | new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); | ||
5025 | |||
5026 | // Remove matching events | ||
5027 | origCount = j = handlers.length; | ||
5028 | while ( j-- ) { | ||
5029 | handleObj = handlers[ j ]; | ||
5030 | |||
5031 | if ( ( mappedTypes || origType === handleObj.origType ) && | ||
5032 | ( !handler || handler.guid === handleObj.guid ) && | ||
5033 | ( !tmp || tmp.test( handleObj.namespace ) ) && | ||
5034 | ( !selector || selector === handleObj.selector || | ||
5035 | selector === "**" && handleObj.selector ) ) { | ||
5036 | handlers.splice( j, 1 ); | ||
5037 | |||
5038 | if ( handleObj.selector ) { | ||
5039 | handlers.delegateCount--; | ||
5040 | } | ||
5041 | if ( special.remove ) { | ||
5042 | special.remove.call( elem, handleObj ); | ||
5043 | } | ||
5044 | } | ||
5045 | } | ||
5046 | |||
5047 | // Remove generic event handler if we removed something and no more handlers exist | ||
5048 | // (avoids potential for endless recursion during removal of special event handlers) | ||
5049 | if ( origCount && !handlers.length ) { | ||
5050 | if ( !special.teardown || | ||
5051 | special.teardown.call( elem, namespaces, elemData.handle ) === false ) { | ||
5052 | |||
5053 | jQuery.removeEvent( elem, type, elemData.handle ); | ||
5054 | } | ||
5055 | |||
5056 | delete events[ type ]; | ||
5057 | } | ||
5058 | } | ||
5059 | |||
5060 | // Remove data and the expando if it's no longer used | ||
5061 | if ( jQuery.isEmptyObject( events ) ) { | ||
5062 | dataPriv.remove( elem, "handle events" ); | ||
5063 | } | ||
5064 | }, | ||
5065 | |||
5066 | dispatch: function( nativeEvent ) { | ||
5067 | |||
5068 | // Make a writable jQuery.Event from the native event object | ||
5069 | var event = jQuery.event.fix( nativeEvent ); | ||
5070 | |||
5071 | var i, j, ret, matched, handleObj, handlerQueue, | ||
5072 | args = new Array( arguments.length ), | ||
5073 | handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], | ||
5074 | special = jQuery.event.special[ event.type ] || {}; | ||
5075 | |||
5076 | // Use the fix-ed jQuery.Event rather than the (read-only) native event | ||
5077 | args[ 0 ] = event; | ||
5078 | |||
5079 | for ( i = 1; i < arguments.length; i++ ) { | ||
5080 | args[ i ] = arguments[ i ]; | ||
5081 | } | ||
5082 | |||
5083 | event.delegateTarget = this; | ||
5084 | |||
5085 | // Call the preDispatch hook for the mapped type, and let it bail if desired | ||
5086 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { | ||
5087 | return; | ||
5088 | } | ||
5089 | |||
5090 | // Determine handlers | ||
5091 | handlerQueue = jQuery.event.handlers.call( this, event, handlers ); | ||
5092 | |||
5093 | // Run delegates first; they may want to stop propagation beneath us | ||
5094 | i = 0; | ||
5095 | while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { | ||
5096 | event.currentTarget = matched.elem; | ||
5097 | |||
5098 | j = 0; | ||
5099 | while ( ( handleObj = matched.handlers[ j++ ] ) && | ||
5100 | !event.isImmediatePropagationStopped() ) { | ||
5101 | |||
5102 | // Triggered event must either 1) have no namespace, or 2) have namespace(s) | ||
5103 | // a subset or equal to those in the bound event (both can have no namespace). | ||
5104 | if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { | ||
5105 | |||
5106 | event.handleObj = handleObj; | ||
5107 | event.data = handleObj.data; | ||
5108 | |||
5109 | ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || | ||
5110 | handleObj.handler ).apply( matched.elem, args ); | ||
5111 | |||
5112 | if ( ret !== undefined ) { | ||
5113 | if ( ( event.result = ret ) === false ) { | ||
5114 | event.preventDefault(); | ||
5115 | event.stopPropagation(); | ||
5116 | } | ||
5117 | } | ||
5118 | } | ||
5119 | } | ||
5120 | } | ||
5121 | |||
5122 | // Call the postDispatch hook for the mapped type | ||
5123 | if ( special.postDispatch ) { | ||
5124 | special.postDispatch.call( this, event ); | ||
5125 | } | ||
5126 | |||
5127 | return event.result; | ||
5128 | }, | ||
5129 | |||
5130 | handlers: function( event, handlers ) { | ||
5131 | var i, matches, sel, handleObj, | ||
5132 | handlerQueue = [], | ||
5133 | delegateCount = handlers.delegateCount, | ||
5134 | cur = event.target; | ||
5135 | |||
5136 | // Support: IE <=9 | ||
5137 | // Find delegate handlers | ||
5138 | // Black-hole SVG <use> instance trees (#13180) | ||
5139 | // | ||
5140 | // Support: Firefox <=42 | ||
5141 | // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) | ||
5142 | if ( delegateCount && cur.nodeType && | ||
5143 | ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { | ||
5144 | |||
5145 | for ( ; cur !== this; cur = cur.parentNode || this ) { | ||
5146 | |||
5147 | // Don't check non-elements (#13208) | ||
5148 | // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) | ||
5149 | if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { | ||
5150 | matches = []; | ||
5151 | for ( i = 0; i < delegateCount; i++ ) { | ||
5152 | handleObj = handlers[ i ]; | ||
5153 | |||
5154 | // Don't conflict with Object.prototype properties (#13203) | ||
5155 | sel = handleObj.selector + " "; | ||
5156 | |||
5157 | if ( matches[ sel ] === undefined ) { | ||
5158 | matches[ sel ] = handleObj.needsContext ? | ||
5159 | jQuery( sel, this ).index( cur ) > -1 : | ||
5160 | jQuery.find( sel, this, null, [ cur ] ).length; | ||
5161 | } | ||
5162 | if ( matches[ sel ] ) { | ||
5163 | matches.push( handleObj ); | ||
5164 | } | ||
5165 | } | ||
5166 | if ( matches.length ) { | ||
5167 | handlerQueue.push( { elem: cur, handlers: matches } ); | ||
5168 | } | ||
5169 | } | ||
5170 | } | ||
5171 | } | ||
5172 | |||
5173 | // Add the remaining (directly-bound) handlers | ||
5174 | if ( delegateCount < handlers.length ) { | ||
5175 | handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); | ||
5176 | } | ||
5177 | |||
5178 | return handlerQueue; | ||
5179 | }, | ||
5180 | |||
5181 | addProp: function( name, hook ) { | ||
5182 | Object.defineProperty( jQuery.Event.prototype, name, { | ||
5183 | enumerable: true, | ||
5184 | configurable: true, | ||
5185 | |||
5186 | get: jQuery.isFunction( hook ) ? | ||
5187 | function() { | ||
5188 | if ( this.originalEvent ) { | ||
5189 | return hook( this.originalEvent ); | ||
5190 | } | ||
5191 | } : | ||
5192 | function() { | ||
5193 | if ( this.originalEvent ) { | ||
5194 | return this.originalEvent[ name ]; | ||
5195 | } | ||
5196 | }, | ||
5197 | |||
5198 | set: function( value ) { | ||
5199 | Object.defineProperty( this, name, { | ||
5200 | enumerable: true, | ||
5201 | configurable: true, | ||
5202 | writable: true, | ||
5203 | value: value | ||
5204 | } ); | ||
5205 | } | ||
5206 | } ); | ||
5207 | }, | ||
5208 | |||
5209 | fix: function( originalEvent ) { | ||
5210 | return originalEvent[ jQuery.expando ] ? | ||
5211 | originalEvent : | ||
5212 | new jQuery.Event( originalEvent ); | ||
5213 | }, | ||
5214 | |||
5215 | special: { | ||
5216 | load: { | ||
5217 | |||
5218 | // Prevent triggered image.load events from bubbling to window.load | ||
5219 | noBubble: true | ||
5220 | }, | ||
5221 | focus: { | ||
5222 | |||
5223 | // Fire native event if possible so blur/focus sequence is correct | ||
5224 | trigger: function() { | ||
5225 | if ( this !== safeActiveElement() && this.focus ) { | ||
5226 | this.focus(); | ||
5227 | return false; | ||
5228 | } | ||
5229 | }, | ||
5230 | delegateType: "focusin" | ||
5231 | }, | ||
5232 | blur: { | ||
5233 | trigger: function() { | ||
5234 | if ( this === safeActiveElement() && this.blur ) { | ||
5235 | this.blur(); | ||
5236 | return false; | ||
5237 | } | ||
5238 | }, | ||
5239 | delegateType: "focusout" | ||
5240 | }, | ||
5241 | click: { | ||
5242 | |||
5243 | // For checkbox, fire native event so checked state will be right | ||
5244 | trigger: function() { | ||
5245 | if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { | ||
5246 | this.click(); | ||
5247 | return false; | ||
5248 | } | ||
5249 | }, | ||
5250 | |||
5251 | // For cross-browser consistency, don't fire native .click() on links | ||
5252 | _default: function( event ) { | ||
5253 | return jQuery.nodeName( event.target, "a" ); | ||
5254 | } | ||
5255 | }, | ||
5256 | |||
5257 | beforeunload: { | ||
5258 | postDispatch: function( event ) { | ||
5259 | |||
5260 | // Support: Firefox 20+ | ||
5261 | // Firefox doesn't alert if the returnValue field is not set. | ||
5262 | if ( event.result !== undefined && event.originalEvent ) { | ||
5263 | event.originalEvent.returnValue = event.result; | ||
5264 | } | ||
5265 | } | ||
5266 | } | ||
5267 | } | ||
5268 | }; | ||
5269 | |||
5270 | jQuery.removeEvent = function( elem, type, handle ) { | ||
5271 | |||
5272 | // This "if" is needed for plain objects | ||
5273 | if ( elem.removeEventListener ) { | ||
5274 | elem.removeEventListener( type, handle ); | ||
5275 | } | ||
5276 | }; | ||
5277 | |||
5278 | jQuery.Event = function( src, props ) { | ||
5279 | |||
5280 | // Allow instantiation without the 'new' keyword | ||
5281 | if ( !( this instanceof jQuery.Event ) ) { | ||
5282 | return new jQuery.Event( src, props ); | ||
5283 | } | ||
5284 | |||
5285 | // Event object | ||
5286 | if ( src && src.type ) { | ||
5287 | this.originalEvent = src; | ||
5288 | this.type = src.type; | ||
5289 | |||
5290 | // Events bubbling up the document may have been marked as prevented | ||
5291 | // by a handler lower down the tree; reflect the correct value. | ||
5292 | this.isDefaultPrevented = src.defaultPrevented || | ||
5293 | src.defaultPrevented === undefined && | ||
5294 | |||
5295 | // Support: Android <=2.3 only | ||
5296 | src.returnValue === false ? | ||
5297 | returnTrue : | ||
5298 | returnFalse; | ||
5299 | |||
5300 | // Create target properties | ||
5301 | // Support: Safari <=6 - 7 only | ||
5302 | // Target should not be a text node (#504, #13143) | ||
5303 | this.target = ( src.target && src.target.nodeType === 3 ) ? | ||
5304 | src.target.parentNode : | ||
5305 | src.target; | ||
5306 | |||
5307 | this.currentTarget = src.currentTarget; | ||
5308 | this.relatedTarget = src.relatedTarget; | ||
5309 | |||
5310 | // Event type | ||
5311 | } else { | ||
5312 | this.type = src; | ||
5313 | } | ||
5314 | |||
5315 | // Put explicitly provided properties onto the event object | ||
5316 | if ( props ) { | ||
5317 | jQuery.extend( this, props ); | ||
5318 | } | ||
5319 | |||
5320 | // Create a timestamp if incoming event doesn't have one | ||
5321 | this.timeStamp = src && src.timeStamp || jQuery.now(); | ||
5322 | |||
5323 | // Mark it as fixed | ||
5324 | this[ jQuery.expando ] = true; | ||
5325 | }; | ||
5326 | |||
5327 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | ||
5328 | // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | ||
5329 | jQuery.Event.prototype = { | ||
5330 | constructor: jQuery.Event, | ||
5331 | isDefaultPrevented: returnFalse, | ||
5332 | isPropagationStopped: returnFalse, | ||
5333 | isImmediatePropagationStopped: returnFalse, | ||
5334 | isSimulated: false, | ||
5335 | |||
5336 | preventDefault: function() { | ||
5337 | var e = this.originalEvent; | ||
5338 | |||
5339 | this.isDefaultPrevented = returnTrue; | ||
5340 | |||
5341 | if ( e && !this.isSimulated ) { | ||
5342 | e.preventDefault(); | ||
5343 | } | ||
5344 | }, | ||
5345 | stopPropagation: function() { | ||
5346 | var e = this.originalEvent; | ||
5347 | |||
5348 | this.isPropagationStopped = returnTrue; | ||
5349 | |||
5350 | if ( e && !this.isSimulated ) { | ||
5351 | e.stopPropagation(); | ||
5352 | } | ||
5353 | }, | ||
5354 | stopImmediatePropagation: function() { | ||
5355 | var e = this.originalEvent; | ||
5356 | |||
5357 | this.isImmediatePropagationStopped = returnTrue; | ||
5358 | |||
5359 | if ( e && !this.isSimulated ) { | ||
5360 | e.stopImmediatePropagation(); | ||
5361 | } | ||
5362 | |||
5363 | this.stopPropagation(); | ||
5364 | } | ||
5365 | }; | ||
5366 | |||
5367 | // Includes all common event props including KeyEvent and MouseEvent specific props | ||
5368 | jQuery.each( { | ||
5369 | altKey: true, | ||
5370 | bubbles: true, | ||
5371 | cancelable: true, | ||
5372 | changedTouches: true, | ||
5373 | ctrlKey: true, | ||
5374 | detail: true, | ||
5375 | eventPhase: true, | ||
5376 | metaKey: true, | ||
5377 | pageX: true, | ||
5378 | pageY: true, | ||
5379 | shiftKey: true, | ||
5380 | view: true, | ||
5381 | "char": true, | ||
5382 | charCode: true, | ||
5383 | key: true, | ||
5384 | keyCode: true, | ||
5385 | button: true, | ||
5386 | buttons: true, | ||
5387 | clientX: true, | ||
5388 | clientY: true, | ||
5389 | offsetX: true, | ||
5390 | offsetY: true, | ||
5391 | pointerId: true, | ||
5392 | pointerType: true, | ||
5393 | screenX: true, | ||
5394 | screenY: true, | ||
5395 | targetTouches: true, | ||
5396 | toElement: true, | ||
5397 | touches: true, | ||
5398 | |||
5399 | which: function( event ) { | ||
5400 | var button = event.button; | ||
5401 | |||
5402 | // Add which for key events | ||
5403 | if ( event.which == null && rkeyEvent.test( event.type ) ) { | ||
5404 | return event.charCode != null ? event.charCode : event.keyCode; | ||
5405 | } | ||
5406 | |||
5407 | // Add which for click: 1 === left; 2 === middle; 3 === right | ||
5408 | if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { | ||
5409 | return ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); | ||
5410 | } | ||
5411 | |||
5412 | return event.which; | ||
5413 | } | ||
5414 | }, jQuery.event.addProp ); | ||
5415 | |||
5416 | // Create mouseenter/leave events using mouseover/out and event-time checks | ||
5417 | // so that event delegation works in jQuery. | ||
5418 | // Do the same for pointerenter/pointerleave and pointerover/pointerout | ||
5419 | // | ||
5420 | // Support: Safari 7 only | ||
5421 | // Safari sends mouseenter too often; see: | ||
5422 | // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 | ||
5423 | // for the description of the bug (it existed in older Chrome versions as well). | ||
5424 | jQuery.each( { | ||
5425 | mouseenter: "mouseover", | ||
5426 | mouseleave: "mouseout", | ||
5427 | pointerenter: "pointerover", | ||
5428 | pointerleave: "pointerout" | ||
5429 | }, function( orig, fix ) { | ||
5430 | jQuery.event.special[ orig ] = { | ||
5431 | delegateType: fix, | ||
5432 | bindType: fix, | ||
5433 | |||
5434 | handle: function( event ) { | ||
5435 | var ret, | ||
5436 | target = this, | ||
5437 | related = event.relatedTarget, | ||
5438 | handleObj = event.handleObj; | ||
5439 | |||
5440 | // For mouseenter/leave call the handler if related is outside the target. | ||
5441 | // NB: No relatedTarget if the mouse left/entered the browser window | ||
5442 | if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { | ||
5443 | event.type = handleObj.origType; | ||
5444 | ret = handleObj.handler.apply( this, arguments ); | ||
5445 | event.type = fix; | ||
5446 | } | ||
5447 | return ret; | ||
5448 | } | ||
5449 | }; | ||
5450 | } ); | ||
5451 | |||
5452 | jQuery.fn.extend( { | ||
5453 | |||
5454 | on: function( types, selector, data, fn ) { | ||
5455 | return on( this, types, selector, data, fn ); | ||
5456 | }, | ||
5457 | one: function( types, selector, data, fn ) { | ||
5458 | return on( this, types, selector, data, fn, 1 ); | ||
5459 | }, | ||
5460 | off: function( types, selector, fn ) { | ||
5461 | var handleObj, type; | ||
5462 | if ( types && types.preventDefault && types.handleObj ) { | ||
5463 | |||
5464 | // ( event ) dispatched jQuery.Event | ||
5465 | handleObj = types.handleObj; | ||
5466 | jQuery( types.delegateTarget ).off( | ||
5467 | handleObj.namespace ? | ||
5468 | handleObj.origType + "." + handleObj.namespace : | ||
5469 | handleObj.origType, | ||
5470 | handleObj.selector, | ||
5471 | handleObj.handler | ||
5472 | ); | ||
5473 | return this; | ||
5474 | } | ||
5475 | if ( typeof types === "object" ) { | ||
5476 | |||
5477 | // ( types-object [, selector] ) | ||
5478 | for ( type in types ) { | ||
5479 | this.off( type, selector, types[ type ] ); | ||
5480 | } | ||
5481 | return this; | ||
5482 | } | ||
5483 | if ( selector === false || typeof selector === "function" ) { | ||
5484 | |||
5485 | // ( types [, fn] ) | ||
5486 | fn = selector; | ||
5487 | selector = undefined; | ||
5488 | } | ||
5489 | if ( fn === false ) { | ||
5490 | fn = returnFalse; | ||
5491 | } | ||
5492 | return this.each( function() { | ||
5493 | jQuery.event.remove( this, types, fn, selector ); | ||
5494 | } ); | ||
5495 | } | ||
5496 | } ); | ||
5497 | |||
5498 | |||
5499 | var | ||
5500 | |||
5501 | /* eslint-disable max-len */ | ||
5502 | |||
5503 | // See https://github.com/eslint/eslint/issues/3229 | ||
5504 | rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, | ||
5505 | |||
5506 | /* eslint-enable */ | ||
5507 | |||
5508 | // Support: IE <=10 - 11, Edge 12 - 13 | ||
5509 | // In IE/Edge using regex groups here causes severe slowdowns. | ||
5510 | // See https://connect.microsoft.com/IE/feedback/details/1736512/ | ||
5511 | rnoInnerhtml = /<script|<style|<link/i, | ||
5512 | |||
5513 | // checked="checked" or checked | ||
5514 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | ||
5515 | rscriptTypeMasked = /^true\/(.*)/, | ||
5516 | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; | ||
5517 | |||
5518 | function manipulationTarget( elem, content ) { | ||
5519 | if ( jQuery.nodeName( elem, "table" ) && | ||
5520 | jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { | ||
5521 | |||
5522 | return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; | ||
5523 | } | ||
5524 | |||
5525 | return elem; | ||
5526 | } | ||
5527 | |||
5528 | // Replace/restore the type attribute of script elements for safe DOM manipulation | ||
5529 | function disableScript( elem ) { | ||
5530 | elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; | ||
5531 | return elem; | ||
5532 | } | ||
5533 | function restoreScript( elem ) { | ||
5534 | var match = rscriptTypeMasked.exec( elem.type ); | ||
5535 | |||
5536 | if ( match ) { | ||
5537 | elem.type = match[ 1 ]; | ||
5538 | } else { | ||
5539 | elem.removeAttribute( "type" ); | ||
5540 | } | ||
5541 | |||
5542 | return elem; | ||
5543 | } | ||
5544 | |||
5545 | function cloneCopyEvent( src, dest ) { | ||
5546 | var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; | ||
5547 | |||
5548 | if ( dest.nodeType !== 1 ) { | ||
5549 | return; | ||
5550 | } | ||
5551 | |||
5552 | // 1. Copy private data: events, handlers, etc. | ||
5553 | if ( dataPriv.hasData( src ) ) { | ||
5554 | pdataOld = dataPriv.access( src ); | ||
5555 | pdataCur = dataPriv.set( dest, pdataOld ); | ||
5556 | events = pdataOld.events; | ||
5557 | |||
5558 | if ( events ) { | ||
5559 | delete pdataCur.handle; | ||
5560 | pdataCur.events = {}; | ||
5561 | |||
5562 | for ( type in events ) { | ||
5563 | for ( i = 0, l = events[ type ].length; i < l; i++ ) { | ||
5564 | jQuery.event.add( dest, type, events[ type ][ i ] ); | ||
5565 | } | ||
5566 | } | ||
5567 | } | ||
5568 | } | ||
5569 | |||
5570 | // 2. Copy user data | ||
5571 | if ( dataUser.hasData( src ) ) { | ||
5572 | udataOld = dataUser.access( src ); | ||
5573 | udataCur = jQuery.extend( {}, udataOld ); | ||
5574 | |||
5575 | dataUser.set( dest, udataCur ); | ||
5576 | } | ||
5577 | } | ||
5578 | |||
5579 | // Fix IE bugs, see support tests | ||
5580 | function fixInput( src, dest ) { | ||
5581 | var nodeName = dest.nodeName.toLowerCase(); | ||
5582 | |||
5583 | // Fails to persist the checked state of a cloned checkbox or radio button. | ||
5584 | if ( nodeName === "input" && rcheckableType.test( src.type ) ) { | ||
5585 | dest.checked = src.checked; | ||
5586 | |||
5587 | // Fails to return the selected option to the default selected state when cloning options | ||
5588 | } else if ( nodeName === "input" || nodeName === "textarea" ) { | ||
5589 | dest.defaultValue = src.defaultValue; | ||
5590 | } | ||
5591 | } | ||
5592 | |||
5593 | function domManip( collection, args, callback, ignored ) { | ||
5594 | |||
5595 | // Flatten any nested arrays | ||
5596 | args = concat.apply( [], args ); | ||
5597 | |||
5598 | var fragment, first, scripts, hasScripts, node, doc, | ||
5599 | i = 0, | ||
5600 | l = collection.length, | ||
5601 | iNoClone = l - 1, | ||
5602 | value = args[ 0 ], | ||
5603 | isFunction = jQuery.isFunction( value ); | ||
5604 | |||
5605 | // We can't cloneNode fragments that contain checked, in WebKit | ||
5606 | if ( isFunction || | ||
5607 | ( l > 1 && typeof value === "string" && | ||
5608 | !support.checkClone && rchecked.test( value ) ) ) { | ||
5609 | return collection.each( function( index ) { | ||
5610 | var self = collection.eq( index ); | ||
5611 | if ( isFunction ) { | ||
5612 | args[ 0 ] = value.call( this, index, self.html() ); | ||
5613 | } | ||
5614 | domManip( self, args, callback, ignored ); | ||
5615 | } ); | ||
5616 | } | ||
5617 | |||
5618 | if ( l ) { | ||
5619 | fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); | ||
5620 | first = fragment.firstChild; | ||
5621 | |||
5622 | if ( fragment.childNodes.length === 1 ) { | ||
5623 | fragment = first; | ||
5624 | } | ||
5625 | |||
5626 | // Require either new content or an interest in ignored elements to invoke the callback | ||
5627 | if ( first || ignored ) { | ||
5628 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); | ||
5629 | hasScripts = scripts.length; | ||
5630 | |||
5631 | // Use the original fragment for the last item | ||
5632 | // instead of the first because it can end up | ||
5633 | // being emptied incorrectly in certain situations (#8070). | ||
5634 | for ( ; i < l; i++ ) { | ||
5635 | node = fragment; | ||
5636 | |||
5637 | if ( i !== iNoClone ) { | ||
5638 | node = jQuery.clone( node, true, true ); | ||
5639 | |||
5640 | // Keep references to cloned scripts for later restoration | ||
5641 | if ( hasScripts ) { | ||
5642 | |||
5643 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
5644 | // push.apply(_, arraylike) throws on ancient WebKit | ||
5645 | jQuery.merge( scripts, getAll( node, "script" ) ); | ||
5646 | } | ||
5647 | } | ||
5648 | |||
5649 | callback.call( collection[ i ], node, i ); | ||
5650 | } | ||
5651 | |||
5652 | if ( hasScripts ) { | ||
5653 | doc = scripts[ scripts.length - 1 ].ownerDocument; | ||
5654 | |||
5655 | // Reenable scripts | ||
5656 | jQuery.map( scripts, restoreScript ); | ||
5657 | |||
5658 | // Evaluate executable scripts on first document insertion | ||
5659 | for ( i = 0; i < hasScripts; i++ ) { | ||
5660 | node = scripts[ i ]; | ||
5661 | if ( rscriptType.test( node.type || "" ) && | ||
5662 | !dataPriv.access( node, "globalEval" ) && | ||
5663 | jQuery.contains( doc, node ) ) { | ||
5664 | |||
5665 | if ( node.src ) { | ||
5666 | |||
5667 | // Optional AJAX dependency, but won't run scripts if not present | ||
5668 | if ( jQuery._evalUrl ) { | ||
5669 | jQuery._evalUrl( node.src ); | ||
5670 | } | ||
5671 | } else { | ||
5672 | DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); | ||
5673 | } | ||
5674 | } | ||
5675 | } | ||
5676 | } | ||
5677 | } | ||
5678 | } | ||
5679 | |||
5680 | return collection; | ||
5681 | } | ||
5682 | |||
5683 | function remove( elem, selector, keepData ) { | ||
5684 | var node, | ||
5685 | nodes = selector ? jQuery.filter( selector, elem ) : elem, | ||
5686 | i = 0; | ||
5687 | |||
5688 | for ( ; ( node = nodes[ i ] ) != null; i++ ) { | ||
5689 | if ( !keepData && node.nodeType === 1 ) { | ||
5690 | jQuery.cleanData( getAll( node ) ); | ||
5691 | } | ||
5692 | |||
5693 | if ( node.parentNode ) { | ||
5694 | if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { | ||
5695 | setGlobalEval( getAll( node, "script" ) ); | ||
5696 | } | ||
5697 | node.parentNode.removeChild( node ); | ||
5698 | } | ||
5699 | } | ||
5700 | |||
5701 | return elem; | ||
5702 | } | ||
5703 | |||
5704 | jQuery.extend( { | ||
5705 | htmlPrefilter: function( html ) { | ||
5706 | return html.replace( rxhtmlTag, "<$1></$2>" ); | ||
5707 | }, | ||
5708 | |||
5709 | clone: function( elem, dataAndEvents, deepDataAndEvents ) { | ||
5710 | var i, l, srcElements, destElements, | ||
5711 | clone = elem.cloneNode( true ), | ||
5712 | inPage = jQuery.contains( elem.ownerDocument, elem ); | ||
5713 | |||
5714 | // Fix IE cloning issues | ||
5715 | if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && | ||
5716 | !jQuery.isXMLDoc( elem ) ) { | ||
5717 | |||
5718 | // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 | ||
5719 | destElements = getAll( clone ); | ||
5720 | srcElements = getAll( elem ); | ||
5721 | |||
5722 | for ( i = 0, l = srcElements.length; i < l; i++ ) { | ||
5723 | fixInput( srcElements[ i ], destElements[ i ] ); | ||
5724 | } | ||
5725 | } | ||
5726 | |||
5727 | // Copy the events from the original to the clone | ||
5728 | if ( dataAndEvents ) { | ||
5729 | if ( deepDataAndEvents ) { | ||
5730 | srcElements = srcElements || getAll( elem ); | ||
5731 | destElements = destElements || getAll( clone ); | ||
5732 | |||
5733 | for ( i = 0, l = srcElements.length; i < l; i++ ) { | ||
5734 | cloneCopyEvent( srcElements[ i ], destElements[ i ] ); | ||
5735 | } | ||
5736 | } else { | ||
5737 | cloneCopyEvent( elem, clone ); | ||
5738 | } | ||
5739 | } | ||
5740 | |||
5741 | // Preserve script evaluation history | ||
5742 | destElements = getAll( clone, "script" ); | ||
5743 | if ( destElements.length > 0 ) { | ||
5744 | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); | ||
5745 | } | ||
5746 | |||
5747 | // Return the cloned set | ||
5748 | return clone; | ||
5749 | }, | ||
5750 | |||
5751 | cleanData: function( elems ) { | ||
5752 | var data, elem, type, | ||
5753 | special = jQuery.event.special, | ||
5754 | i = 0; | ||
5755 | |||
5756 | for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { | ||
5757 | if ( acceptData( elem ) ) { | ||
5758 | if ( ( data = elem[ dataPriv.expando ] ) ) { | ||
5759 | if ( data.events ) { | ||
5760 | for ( type in data.events ) { | ||
5761 | if ( special[ type ] ) { | ||
5762 | jQuery.event.remove( elem, type ); | ||
5763 | |||
5764 | // This is a shortcut to avoid jQuery.event.remove's overhead | ||
5765 | } else { | ||
5766 | jQuery.removeEvent( elem, type, data.handle ); | ||
5767 | } | ||
5768 | } | ||
5769 | } | ||
5770 | |||
5771 | // Support: Chrome <=35 - 45+ | ||
5772 | // Assign undefined instead of using delete, see Data#remove | ||
5773 | elem[ dataPriv.expando ] = undefined; | ||
5774 | } | ||
5775 | if ( elem[ dataUser.expando ] ) { | ||
5776 | |||
5777 | // Support: Chrome <=35 - 45+ | ||
5778 | // Assign undefined instead of using delete, see Data#remove | ||
5779 | elem[ dataUser.expando ] = undefined; | ||
5780 | } | ||
5781 | } | ||
5782 | } | ||
5783 | } | ||
5784 | } ); | ||
5785 | |||
5786 | jQuery.fn.extend( { | ||
5787 | detach: function( selector ) { | ||
5788 | return remove( this, selector, true ); | ||
5789 | }, | ||
5790 | |||
5791 | remove: function( selector ) { | ||
5792 | return remove( this, selector ); | ||
5793 | }, | ||
5794 | |||
5795 | text: function( value ) { | ||
5796 | return access( this, function( value ) { | ||
5797 | return value === undefined ? | ||
5798 | jQuery.text( this ) : | ||
5799 | this.empty().each( function() { | ||
5800 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
5801 | this.textContent = value; | ||
5802 | } | ||
5803 | } ); | ||
5804 | }, null, value, arguments.length ); | ||
5805 | }, | ||
5806 | |||
5807 | append: function() { | ||
5808 | return domManip( this, arguments, function( elem ) { | ||
5809 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
5810 | var target = manipulationTarget( this, elem ); | ||
5811 | target.appendChild( elem ); | ||
5812 | } | ||
5813 | } ); | ||
5814 | }, | ||
5815 | |||
5816 | prepend: function() { | ||
5817 | return domManip( this, arguments, function( elem ) { | ||
5818 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
5819 | var target = manipulationTarget( this, elem ); | ||
5820 | target.insertBefore( elem, target.firstChild ); | ||
5821 | } | ||
5822 | } ); | ||
5823 | }, | ||
5824 | |||
5825 | before: function() { | ||
5826 | return domManip( this, arguments, function( elem ) { | ||
5827 | if ( this.parentNode ) { | ||
5828 | this.parentNode.insertBefore( elem, this ); | ||
5829 | } | ||
5830 | } ); | ||
5831 | }, | ||
5832 | |||
5833 | after: function() { | ||
5834 | return domManip( this, arguments, function( elem ) { | ||
5835 | if ( this.parentNode ) { | ||
5836 | this.parentNode.insertBefore( elem, this.nextSibling ); | ||
5837 | } | ||
5838 | } ); | ||
5839 | }, | ||
5840 | |||
5841 | empty: function() { | ||
5842 | var elem, | ||
5843 | i = 0; | ||
5844 | |||
5845 | for ( ; ( elem = this[ i ] ) != null; i++ ) { | ||
5846 | if ( elem.nodeType === 1 ) { | ||
5847 | |||
5848 | // Prevent memory leaks | ||
5849 | jQuery.cleanData( getAll( elem, false ) ); | ||
5850 | |||
5851 | // Remove any remaining nodes | ||
5852 | elem.textContent = ""; | ||
5853 | } | ||
5854 | } | ||
5855 | |||
5856 | return this; | ||
5857 | }, | ||
5858 | |||
5859 | clone: function( dataAndEvents, deepDataAndEvents ) { | ||
5860 | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; | ||
5861 | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; | ||
5862 | |||
5863 | return this.map( function() { | ||
5864 | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); | ||
5865 | } ); | ||
5866 | }, | ||
5867 | |||
5868 | html: function( value ) { | ||
5869 | return access( this, function( value ) { | ||
5870 | var elem = this[ 0 ] || {}, | ||
5871 | i = 0, | ||
5872 | l = this.length; | ||
5873 | |||
5874 | if ( value === undefined && elem.nodeType === 1 ) { | ||
5875 | return elem.innerHTML; | ||
5876 | } | ||
5877 | |||
5878 | // See if we can take a shortcut and just use innerHTML | ||
5879 | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && | ||
5880 | !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { | ||
5881 | |||
5882 | value = jQuery.htmlPrefilter( value ); | ||
5883 | |||
5884 | try { | ||
5885 | for ( ; i < l; i++ ) { | ||
5886 | elem = this[ i ] || {}; | ||
5887 | |||
5888 | // Remove element nodes and prevent memory leaks | ||
5889 | if ( elem.nodeType === 1 ) { | ||
5890 | jQuery.cleanData( getAll( elem, false ) ); | ||
5891 | elem.innerHTML = value; | ||
5892 | } | ||
5893 | } | ||
5894 | |||
5895 | elem = 0; | ||
5896 | |||
5897 | // If using innerHTML throws an exception, use the fallback method | ||
5898 | } catch ( e ) {} | ||
5899 | } | ||
5900 | |||
5901 | if ( elem ) { | ||
5902 | this.empty().append( value ); | ||
5903 | } | ||
5904 | }, null, value, arguments.length ); | ||
5905 | }, | ||
5906 | |||
5907 | replaceWith: function() { | ||
5908 | var ignored = []; | ||
5909 | |||
5910 | // Make the changes, replacing each non-ignored context element with the new content | ||
5911 | return domManip( this, arguments, function( elem ) { | ||
5912 | var parent = this.parentNode; | ||
5913 | |||
5914 | if ( jQuery.inArray( this, ignored ) < 0 ) { | ||
5915 | jQuery.cleanData( getAll( this ) ); | ||
5916 | if ( parent ) { | ||
5917 | parent.replaceChild( elem, this ); | ||
5918 | } | ||
5919 | } | ||
5920 | |||
5921 | // Force callback invocation | ||
5922 | }, ignored ); | ||
5923 | } | ||
5924 | } ); | ||
5925 | |||
5926 | jQuery.each( { | ||
5927 | appendTo: "append", | ||
5928 | prependTo: "prepend", | ||
5929 | insertBefore: "before", | ||
5930 | insertAfter: "after", | ||
5931 | replaceAll: "replaceWith" | ||
5932 | }, function( name, original ) { | ||
5933 | jQuery.fn[ name ] = function( selector ) { | ||
5934 | var elems, | ||
5935 | ret = [], | ||
5936 | insert = jQuery( selector ), | ||
5937 | last = insert.length - 1, | ||
5938 | i = 0; | ||
5939 | |||
5940 | for ( ; i <= last; i++ ) { | ||
5941 | elems = i === last ? this : this.clone( true ); | ||
5942 | jQuery( insert[ i ] )[ original ]( elems ); | ||
5943 | |||
5944 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
5945 | // .get() because push.apply(_, arraylike) throws on ancient WebKit | ||
5946 | push.apply( ret, elems.get() ); | ||
5947 | } | ||
5948 | |||
5949 | return this.pushStack( ret ); | ||
5950 | }; | ||
5951 | } ); | ||
5952 | var rmargin = ( /^margin/ ); | ||
5953 | |||
5954 | var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); | ||
5955 | |||
5956 | var getStyles = function( elem ) { | ||
5957 | |||
5958 | // Support: IE <=11 only, Firefox <=30 (#15098, #14150) | ||
5959 | // IE throws on elements created in popups | ||
5960 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" | ||
5961 | var view = elem.ownerDocument.defaultView; | ||
5962 | |||
5963 | if ( !view || !view.opener ) { | ||
5964 | view = window; | ||
5965 | } | ||
5966 | |||
5967 | return view.getComputedStyle( elem ); | ||
5968 | }; | ||
5969 | |||
5970 | |||
5971 | |||
5972 | ( function() { | ||
5973 | |||
5974 | // Executing both pixelPosition & boxSizingReliable tests require only one layout | ||
5975 | // so they're executed at the same time to save the second computation. | ||
5976 | function computeStyleTests() { | ||
5977 | |||
5978 | // This is a singleton, we need to execute it only once | ||
5979 | if ( !div ) { | ||
5980 | return; | ||
5981 | } | ||
5982 | |||
5983 | div.style.cssText = | ||
5984 | "box-sizing:border-box;" + | ||
5985 | "position:relative;display:block;" + | ||
5986 | "margin:auto;border:1px;padding:1px;" + | ||
5987 | "top:1%;width:50%"; | ||
5988 | div.innerHTML = ""; | ||
5989 | documentElement.appendChild( container ); | ||
5990 | |||
5991 | var divStyle = window.getComputedStyle( div ); | ||
5992 | pixelPositionVal = divStyle.top !== "1%"; | ||
5993 | |||
5994 | // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 | ||
5995 | reliableMarginLeftVal = divStyle.marginLeft === "2px"; | ||
5996 | boxSizingReliableVal = divStyle.width === "4px"; | ||
5997 | |||
5998 | // Support: Android 4.0 - 4.3 only | ||
5999 | // Some styles come back with percentage values, even though they shouldn't | ||
6000 | div.style.marginRight = "50%"; | ||
6001 | pixelMarginRightVal = divStyle.marginRight === "4px"; | ||
6002 | |||
6003 | documentElement.removeChild( container ); | ||
6004 | |||
6005 | // Nullify the div so it wouldn't be stored in the memory and | ||
6006 | // it will also be a sign that checks already performed | ||
6007 | div = null; | ||
6008 | } | ||
6009 | |||
6010 | var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, | ||
6011 | container = document.createElement( "div" ), | ||
6012 | div = document.createElement( "div" ); | ||
6013 | |||
6014 | // Finish early in limited (non-browser) environments | ||
6015 | if ( !div.style ) { | ||
6016 | return; | ||
6017 | } | ||
6018 | |||
6019 | // Support: IE <=9 - 11 only | ||
6020 | // Style of cloned element affects source element cloned (#8908) | ||
6021 | div.style.backgroundClip = "content-box"; | ||
6022 | div.cloneNode( true ).style.backgroundClip = ""; | ||
6023 | support.clearCloneStyle = div.style.backgroundClip === "content-box"; | ||
6024 | |||
6025 | container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + | ||
6026 | "padding:0;margin-top:1px;position:absolute"; | ||
6027 | container.appendChild( div ); | ||
6028 | |||
6029 | jQuery.extend( support, { | ||
6030 | pixelPosition: function() { | ||
6031 | computeStyleTests(); | ||
6032 | return pixelPositionVal; | ||
6033 | }, | ||
6034 | boxSizingReliable: function() { | ||
6035 | computeStyleTests(); | ||
6036 | return boxSizingReliableVal; | ||
6037 | }, | ||
6038 | pixelMarginRight: function() { | ||
6039 | computeStyleTests(); | ||
6040 | return pixelMarginRightVal; | ||
6041 | }, | ||
6042 | reliableMarginLeft: function() { | ||
6043 | computeStyleTests(); | ||
6044 | return reliableMarginLeftVal; | ||
6045 | } | ||
6046 | } ); | ||
6047 | } )(); | ||
6048 | |||
6049 | |||
6050 | function curCSS( elem, name, computed ) { | ||
6051 | var width, minWidth, maxWidth, ret, | ||
6052 | style = elem.style; | ||
6053 | |||
6054 | computed = computed || getStyles( elem ); | ||
6055 | |||
6056 | // Support: IE <=9 only | ||
6057 | // getPropertyValue is only needed for .css('filter') (#12537) | ||
6058 | if ( computed ) { | ||
6059 | ret = computed.getPropertyValue( name ) || computed[ name ]; | ||
6060 | |||
6061 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { | ||
6062 | ret = jQuery.style( elem, name ); | ||
6063 | } | ||
6064 | |||
6065 | // A tribute to the "awesome hack by Dean Edwards" | ||
6066 | // Android Browser returns percentage for some values, | ||
6067 | // but width seems to be reliably pixels. | ||
6068 | // This is against the CSSOM draft spec: | ||
6069 | // https://drafts.csswg.org/cssom/#resolved-values | ||
6070 | if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { | ||
6071 | |||
6072 | // Remember the original values | ||
6073 | width = style.width; | ||
6074 | minWidth = style.minWidth; | ||
6075 | maxWidth = style.maxWidth; | ||
6076 | |||
6077 | // Put in the new values to get a computed value out | ||
6078 | style.minWidth = style.maxWidth = style.width = ret; | ||
6079 | ret = computed.width; | ||
6080 | |||
6081 | // Revert the changed values | ||
6082 | style.width = width; | ||
6083 | style.minWidth = minWidth; | ||
6084 | style.maxWidth = maxWidth; | ||
6085 | } | ||
6086 | } | ||
6087 | |||
6088 | return ret !== undefined ? | ||
6089 | |||
6090 | // Support: IE <=9 - 11 only | ||
6091 | // IE returns zIndex value as an integer. | ||
6092 | ret + "" : | ||
6093 | ret; | ||
6094 | } | ||
6095 | |||
6096 | |||
6097 | function addGetHookIf( conditionFn, hookFn ) { | ||
6098 | |||
6099 | // Define the hook, we'll check on the first run if it's really needed. | ||
6100 | return { | ||
6101 | get: function() { | ||
6102 | if ( conditionFn() ) { | ||
6103 | |||
6104 | // Hook not needed (or it's not possible to use it due | ||
6105 | // to missing dependency), remove it. | ||
6106 | delete this.get; | ||
6107 | return; | ||
6108 | } | ||
6109 | |||
6110 | // Hook needed; redefine it so that the support test is not executed again. | ||
6111 | return ( this.get = hookFn ).apply( this, arguments ); | ||
6112 | } | ||
6113 | }; | ||
6114 | } | ||
6115 | |||
6116 | |||
6117 | var | ||
6118 | |||
6119 | // Swappable if display is none or starts with table | ||
6120 | // except "table", "table-cell", or "table-caption" | ||
6121 | // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display | ||
6122 | rdisplayswap = /^(none|table(?!-c[ea]).+)/, | ||
6123 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, | ||
6124 | cssNormalTransform = { | ||
6125 | letterSpacing: "0", | ||
6126 | fontWeight: "400" | ||
6127 | }, | ||
6128 | |||
6129 | cssPrefixes = [ "Webkit", "Moz", "ms" ], | ||
6130 | emptyStyle = document.createElement( "div" ).style; | ||
6131 | |||
6132 | // Return a css property mapped to a potentially vendor prefixed property | ||
6133 | function vendorPropName( name ) { | ||
6134 | |||
6135 | // Shortcut for names that are not vendor prefixed | ||
6136 | if ( name in emptyStyle ) { | ||
6137 | return name; | ||
6138 | } | ||
6139 | |||
6140 | // Check for vendor prefixed names | ||
6141 | var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), | ||
6142 | i = cssPrefixes.length; | ||
6143 | |||
6144 | while ( i-- ) { | ||
6145 | name = cssPrefixes[ i ] + capName; | ||
6146 | if ( name in emptyStyle ) { | ||
6147 | return name; | ||
6148 | } | ||
6149 | } | ||
6150 | } | ||
6151 | |||
6152 | function setPositiveNumber( elem, value, subtract ) { | ||
6153 | |||
6154 | // Any relative (+/-) values have already been | ||
6155 | // normalized at this point | ||
6156 | var matches = rcssNum.exec( value ); | ||
6157 | return matches ? | ||
6158 | |||
6159 | // Guard against undefined "subtract", e.g., when used as in cssHooks | ||
6160 | Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : | ||
6161 | value; | ||
6162 | } | ||
6163 | |||
6164 | function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { | ||
6165 | var i = extra === ( isBorderBox ? "border" : "content" ) ? | ||
6166 | |||
6167 | // If we already have the right measurement, avoid augmentation | ||
6168 | 4 : | ||
6169 | |||
6170 | // Otherwise initialize for horizontal or vertical properties | ||
6171 | name === "width" ? 1 : 0, | ||
6172 | |||
6173 | val = 0; | ||
6174 | |||
6175 | for ( ; i < 4; i += 2 ) { | ||
6176 | |||
6177 | // Both box models exclude margin, so add it if we want it | ||
6178 | if ( extra === "margin" ) { | ||
6179 | val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); | ||
6180 | } | ||
6181 | |||
6182 | if ( isBorderBox ) { | ||
6183 | |||
6184 | // border-box includes padding, so remove it if we want content | ||
6185 | if ( extra === "content" ) { | ||
6186 | val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
6187 | } | ||
6188 | |||
6189 | // At this point, extra isn't border nor margin, so remove border | ||
6190 | if ( extra !== "margin" ) { | ||
6191 | val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
6192 | } | ||
6193 | } else { | ||
6194 | |||
6195 | // At this point, extra isn't content, so add padding | ||
6196 | val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
6197 | |||
6198 | // At this point, extra isn't content nor padding, so add border | ||
6199 | if ( extra !== "padding" ) { | ||
6200 | val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
6201 | } | ||
6202 | } | ||
6203 | } | ||
6204 | |||
6205 | return val; | ||
6206 | } | ||
6207 | |||
6208 | function getWidthOrHeight( elem, name, extra ) { | ||
6209 | |||
6210 | // Start with offset property, which is equivalent to the border-box value | ||
6211 | var val, | ||
6212 | valueIsBorderBox = true, | ||
6213 | styles = getStyles( elem ), | ||
6214 | isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; | ||
6215 | |||
6216 | // Support: IE <=11 only | ||
6217 | // Running getBoundingClientRect on a disconnected node | ||
6218 | // in IE throws an error. | ||
6219 | if ( elem.getClientRects().length ) { | ||
6220 | val = elem.getBoundingClientRect()[ name ]; | ||
6221 | } | ||
6222 | |||
6223 | // Some non-html elements return undefined for offsetWidth, so check for null/undefined | ||
6224 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 | ||
6225 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 | ||
6226 | if ( val <= 0 || val == null ) { | ||
6227 | |||
6228 | // Fall back to computed then uncomputed css if necessary | ||
6229 | val = curCSS( elem, name, styles ); | ||
6230 | if ( val < 0 || val == null ) { | ||
6231 | val = elem.style[ name ]; | ||
6232 | } | ||
6233 | |||
6234 | // Computed unit is not pixels. Stop here and return. | ||
6235 | if ( rnumnonpx.test( val ) ) { | ||
6236 | return val; | ||
6237 | } | ||
6238 | |||
6239 | // Check for style in case a browser which returns unreliable values | ||
6240 | // for getComputedStyle silently falls back to the reliable elem.style | ||
6241 | valueIsBorderBox = isBorderBox && | ||
6242 | ( support.boxSizingReliable() || val === elem.style[ name ] ); | ||
6243 | |||
6244 | // Normalize "", auto, and prepare for extra | ||
6245 | val = parseFloat( val ) || 0; | ||
6246 | } | ||
6247 | |||
6248 | // Use the active box-sizing model to add/subtract irrelevant styles | ||
6249 | return ( val + | ||
6250 | augmentWidthOrHeight( | ||
6251 | elem, | ||
6252 | name, | ||
6253 | extra || ( isBorderBox ? "border" : "content" ), | ||
6254 | valueIsBorderBox, | ||
6255 | styles | ||
6256 | ) | ||
6257 | ) + "px"; | ||
6258 | } | ||
6259 | |||
6260 | jQuery.extend( { | ||
6261 | |||
6262 | // Add in style property hooks for overriding the default | ||
6263 | // behavior of getting and setting a style property | ||
6264 | cssHooks: { | ||
6265 | opacity: { | ||
6266 | get: function( elem, computed ) { | ||
6267 | if ( computed ) { | ||
6268 | |||
6269 | // We should always get a number back from opacity | ||
6270 | var ret = curCSS( elem, "opacity" ); | ||
6271 | return ret === "" ? "1" : ret; | ||
6272 | } | ||
6273 | } | ||
6274 | } | ||
6275 | }, | ||
6276 | |||
6277 | // Don't automatically add "px" to these possibly-unitless properties | ||
6278 | cssNumber: { | ||
6279 | "animationIterationCount": true, | ||
6280 | "columnCount": true, | ||
6281 | "fillOpacity": true, | ||
6282 | "flexGrow": true, | ||
6283 | "flexShrink": true, | ||
6284 | "fontWeight": true, | ||
6285 | "lineHeight": true, | ||
6286 | "opacity": true, | ||
6287 | "order": true, | ||
6288 | "orphans": true, | ||
6289 | "widows": true, | ||
6290 | "zIndex": true, | ||
6291 | "zoom": true | ||
6292 | }, | ||
6293 | |||
6294 | // Add in properties whose names you wish to fix before | ||
6295 | // setting or getting the value | ||
6296 | cssProps: { | ||
6297 | "float": "cssFloat" | ||
6298 | }, | ||
6299 | |||
6300 | // Get and set the style property on a DOM Node | ||
6301 | style: function( elem, name, value, extra ) { | ||
6302 | |||
6303 | // Don't set styles on text and comment nodes | ||
6304 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { | ||
6305 | return; | ||
6306 | } | ||
6307 | |||
6308 | // Make sure that we're working with the right name | ||
6309 | var ret, type, hooks, | ||
6310 | origName = jQuery.camelCase( name ), | ||
6311 | style = elem.style; | ||
6312 | |||
6313 | name = jQuery.cssProps[ origName ] || | ||
6314 | ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); | ||
6315 | |||
6316 | // Gets hook for the prefixed version, then unprefixed version | ||
6317 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
6318 | |||
6319 | // Check if we're setting a value | ||
6320 | if ( value !== undefined ) { | ||
6321 | type = typeof value; | ||
6322 | |||
6323 | // Convert "+=" or "-=" to relative numbers (#7345) | ||
6324 | if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { | ||
6325 | value = adjustCSS( elem, name, ret ); | ||
6326 | |||
6327 | // Fixes bug #9237 | ||
6328 | type = "number"; | ||
6329 | } | ||
6330 | |||
6331 | // Make sure that null and NaN values aren't set (#7116) | ||
6332 | if ( value == null || value !== value ) { | ||
6333 | return; | ||
6334 | } | ||
6335 | |||
6336 | // If a number was passed in, add the unit (except for certain CSS properties) | ||
6337 | if ( type === "number" ) { | ||
6338 | value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); | ||
6339 | } | ||
6340 | |||
6341 | // background-* props affect original clone's values | ||
6342 | if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { | ||
6343 | style[ name ] = "inherit"; | ||
6344 | } | ||
6345 | |||
6346 | // If a hook was provided, use that value, otherwise just set the specified value | ||
6347 | if ( !hooks || !( "set" in hooks ) || | ||
6348 | ( value = hooks.set( elem, value, extra ) ) !== undefined ) { | ||
6349 | |||
6350 | style[ name ] = value; | ||
6351 | } | ||
6352 | |||
6353 | } else { | ||
6354 | |||
6355 | // If a hook was provided get the non-computed value from there | ||
6356 | if ( hooks && "get" in hooks && | ||
6357 | ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { | ||
6358 | |||
6359 | return ret; | ||
6360 | } | ||
6361 | |||
6362 | // Otherwise just get the value from the style object | ||
6363 | return style[ name ]; | ||
6364 | } | ||
6365 | }, | ||
6366 | |||
6367 | css: function( elem, name, extra, styles ) { | ||
6368 | var val, num, hooks, | ||
6369 | origName = jQuery.camelCase( name ); | ||
6370 | |||
6371 | // Make sure that we're working with the right name | ||
6372 | name = jQuery.cssProps[ origName ] || | ||
6373 | ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); | ||
6374 | |||
6375 | // Try prefixed name followed by the unprefixed name | ||
6376 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
6377 | |||
6378 | // If a hook was provided get the computed value from there | ||
6379 | if ( hooks && "get" in hooks ) { | ||
6380 | val = hooks.get( elem, true, extra ); | ||
6381 | } | ||
6382 | |||
6383 | // Otherwise, if a way to get the computed value exists, use that | ||
6384 | if ( val === undefined ) { | ||
6385 | val = curCSS( elem, name, styles ); | ||
6386 | } | ||
6387 | |||
6388 | // Convert "normal" to computed value | ||
6389 | if ( val === "normal" && name in cssNormalTransform ) { | ||
6390 | val = cssNormalTransform[ name ]; | ||
6391 | } | ||
6392 | |||
6393 | // Make numeric if forced or a qualifier was provided and val looks numeric | ||
6394 | if ( extra === "" || extra ) { | ||
6395 | num = parseFloat( val ); | ||
6396 | return extra === true || isFinite( num ) ? num || 0 : val; | ||
6397 | } | ||
6398 | return val; | ||
6399 | } | ||
6400 | } ); | ||
6401 | |||
6402 | jQuery.each( [ "height", "width" ], function( i, name ) { | ||
6403 | jQuery.cssHooks[ name ] = { | ||
6404 | get: function( elem, computed, extra ) { | ||
6405 | if ( computed ) { | ||
6406 | |||
6407 | // Certain elements can have dimension info if we invisibly show them | ||
6408 | // but it must have a current display style that would benefit | ||
6409 | return rdisplayswap.test( jQuery.css( elem, "display" ) ) && | ||
6410 | |||
6411 | // Support: Safari 8+ | ||
6412 | // Table columns in Safari have non-zero offsetWidth & zero | ||
6413 | // getBoundingClientRect().width unless display is changed. | ||
6414 | // Support: IE <=11 only | ||
6415 | // Running getBoundingClientRect on a disconnected node | ||
6416 | // in IE throws an error. | ||
6417 | ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? | ||
6418 | swap( elem, cssShow, function() { | ||
6419 | return getWidthOrHeight( elem, name, extra ); | ||
6420 | } ) : | ||
6421 | getWidthOrHeight( elem, name, extra ); | ||
6422 | } | ||
6423 | }, | ||
6424 | |||
6425 | set: function( elem, value, extra ) { | ||
6426 | var matches, | ||
6427 | styles = extra && getStyles( elem ), | ||
6428 | subtract = extra && augmentWidthOrHeight( | ||
6429 | elem, | ||
6430 | name, | ||
6431 | extra, | ||
6432 | jQuery.css( elem, "boxSizing", false, styles ) === "border-box", | ||
6433 | styles | ||
6434 | ); | ||
6435 | |||
6436 | // Convert to pixels if value adjustment is needed | ||
6437 | if ( subtract && ( matches = rcssNum.exec( value ) ) && | ||
6438 | ( matches[ 3 ] || "px" ) !== "px" ) { | ||
6439 | |||
6440 | elem.style[ name ] = value; | ||
6441 | value = jQuery.css( elem, name ); | ||
6442 | } | ||
6443 | |||
6444 | return setPositiveNumber( elem, value, subtract ); | ||
6445 | } | ||
6446 | }; | ||
6447 | } ); | ||
6448 | |||
6449 | jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, | ||
6450 | function( elem, computed ) { | ||
6451 | if ( computed ) { | ||
6452 | return ( parseFloat( curCSS( elem, "marginLeft" ) ) || | ||
6453 | elem.getBoundingClientRect().left - | ||
6454 | swap( elem, { marginLeft: 0 }, function() { | ||
6455 | return elem.getBoundingClientRect().left; | ||
6456 | } ) | ||
6457 | ) + "px"; | ||
6458 | } | ||
6459 | } | ||
6460 | ); | ||
6461 | |||
6462 | // These hooks are used by animate to expand properties | ||
6463 | jQuery.each( { | ||
6464 | margin: "", | ||
6465 | padding: "", | ||
6466 | border: "Width" | ||
6467 | }, function( prefix, suffix ) { | ||
6468 | jQuery.cssHooks[ prefix + suffix ] = { | ||
6469 | expand: function( value ) { | ||
6470 | var i = 0, | ||
6471 | expanded = {}, | ||
6472 | |||
6473 | // Assumes a single number if not a string | ||
6474 | parts = typeof value === "string" ? value.split( " " ) : [ value ]; | ||
6475 | |||
6476 | for ( ; i < 4; i++ ) { | ||
6477 | expanded[ prefix + cssExpand[ i ] + suffix ] = | ||
6478 | parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; | ||
6479 | } | ||
6480 | |||
6481 | return expanded; | ||
6482 | } | ||
6483 | }; | ||
6484 | |||
6485 | if ( !rmargin.test( prefix ) ) { | ||
6486 | jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; | ||
6487 | } | ||
6488 | } ); | ||
6489 | |||
6490 | jQuery.fn.extend( { | ||
6491 | css: function( name, value ) { | ||
6492 | return access( this, function( elem, name, value ) { | ||
6493 | var styles, len, | ||
6494 | map = {}, | ||
6495 | i = 0; | ||
6496 | |||
6497 | if ( jQuery.isArray( name ) ) { | ||
6498 | styles = getStyles( elem ); | ||
6499 | len = name.length; | ||
6500 | |||
6501 | for ( ; i < len; i++ ) { | ||
6502 | map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); | ||
6503 | } | ||
6504 | |||
6505 | return map; | ||
6506 | } | ||
6507 | |||
6508 | return value !== undefined ? | ||
6509 | jQuery.style( elem, name, value ) : | ||
6510 | jQuery.css( elem, name ); | ||
6511 | }, name, value, arguments.length > 1 ); | ||
6512 | } | ||
6513 | } ); | ||
6514 | |||
6515 | |||
6516 | function Tween( elem, options, prop, end, easing ) { | ||
6517 | return new Tween.prototype.init( elem, options, prop, end, easing ); | ||
6518 | } | ||
6519 | jQuery.Tween = Tween; | ||
6520 | |||
6521 | Tween.prototype = { | ||
6522 | constructor: Tween, | ||
6523 | init: function( elem, options, prop, end, easing, unit ) { | ||
6524 | this.elem = elem; | ||
6525 | this.prop = prop; | ||
6526 | this.easing = easing || jQuery.easing._default; | ||
6527 | this.options = options; | ||
6528 | this.start = this.now = this.cur(); | ||
6529 | this.end = end; | ||
6530 | this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); | ||
6531 | }, | ||
6532 | cur: function() { | ||
6533 | var hooks = Tween.propHooks[ this.prop ]; | ||
6534 | |||
6535 | return hooks && hooks.get ? | ||
6536 | hooks.get( this ) : | ||
6537 | Tween.propHooks._default.get( this ); | ||
6538 | }, | ||
6539 | run: function( percent ) { | ||
6540 | var eased, | ||
6541 | hooks = Tween.propHooks[ this.prop ]; | ||
6542 | |||
6543 | if ( this.options.duration ) { | ||
6544 | this.pos = eased = jQuery.easing[ this.easing ]( | ||
6545 | percent, this.options.duration * percent, 0, 1, this.options.duration | ||
6546 | ); | ||
6547 | } else { | ||
6548 | this.pos = eased = percent; | ||
6549 | } | ||
6550 | this.now = ( this.end - this.start ) * eased + this.start; | ||
6551 | |||
6552 | if ( this.options.step ) { | ||
6553 | this.options.step.call( this.elem, this.now, this ); | ||
6554 | } | ||
6555 | |||
6556 | if ( hooks && hooks.set ) { | ||
6557 | hooks.set( this ); | ||
6558 | } else { | ||
6559 | Tween.propHooks._default.set( this ); | ||
6560 | } | ||
6561 | return this; | ||
6562 | } | ||
6563 | }; | ||
6564 | |||
6565 | Tween.prototype.init.prototype = Tween.prototype; | ||
6566 | |||
6567 | Tween.propHooks = { | ||
6568 | _default: { | ||
6569 | get: function( tween ) { | ||
6570 | var result; | ||
6571 | |||
6572 | // Use a property on the element directly when it is not a DOM element, | ||
6573 | // or when there is no matching style property that exists. | ||
6574 | if ( tween.elem.nodeType !== 1 || | ||
6575 | tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { | ||
6576 | return tween.elem[ tween.prop ]; | ||
6577 | } | ||
6578 | |||
6579 | // Passing an empty string as a 3rd parameter to .css will automatically | ||
6580 | // attempt a parseFloat and fallback to a string if the parse fails. | ||
6581 | // Simple values such as "10px" are parsed to Float; | ||
6582 | // complex values such as "rotate(1rad)" are returned as-is. | ||
6583 | result = jQuery.css( tween.elem, tween.prop, "" ); | ||
6584 | |||
6585 | // Empty strings, null, undefined and "auto" are converted to 0. | ||
6586 | return !result || result === "auto" ? 0 : result; | ||
6587 | }, | ||
6588 | set: function( tween ) { | ||
6589 | |||
6590 | // Use step hook for back compat. | ||
6591 | // Use cssHook if its there. | ||
6592 | // Use .style if available and use plain properties where available. | ||
6593 | if ( jQuery.fx.step[ tween.prop ] ) { | ||
6594 | jQuery.fx.step[ tween.prop ]( tween ); | ||
6595 | } else if ( tween.elem.nodeType === 1 && | ||
6596 | ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || | ||
6597 | jQuery.cssHooks[ tween.prop ] ) ) { | ||
6598 | jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); | ||
6599 | } else { | ||
6600 | tween.elem[ tween.prop ] = tween.now; | ||
6601 | } | ||
6602 | } | ||
6603 | } | ||
6604 | }; | ||
6605 | |||
6606 | // Support: IE <=9 only | ||
6607 | // Panic based approach to setting things on disconnected nodes | ||
6608 | Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | ||
6609 | set: function( tween ) { | ||
6610 | if ( tween.elem.nodeType && tween.elem.parentNode ) { | ||
6611 | tween.elem[ tween.prop ] = tween.now; | ||
6612 | } | ||
6613 | } | ||
6614 | }; | ||
6615 | |||
6616 | jQuery.easing = { | ||
6617 | linear: function( p ) { | ||
6618 | return p; | ||
6619 | }, | ||
6620 | swing: function( p ) { | ||
6621 | return 0.5 - Math.cos( p * Math.PI ) / 2; | ||
6622 | }, | ||
6623 | _default: "swing" | ||
6624 | }; | ||
6625 | |||
6626 | jQuery.fx = Tween.prototype.init; | ||
6627 | |||
6628 | // Back compat <1.8 extension point | ||
6629 | jQuery.fx.step = {}; | ||
6630 | |||
6631 | |||
6632 | |||
6633 | |||
6634 | var | ||
6635 | fxNow, timerId, | ||
6636 | rfxtypes = /^(?:toggle|show|hide)$/, | ||
6637 | rrun = /queueHooks$/; | ||
6638 | |||
6639 | function raf() { | ||
6640 | if ( timerId ) { | ||
6641 | window.requestAnimationFrame( raf ); | ||
6642 | jQuery.fx.tick(); | ||
6643 | } | ||
6644 | } | ||
6645 | |||
6646 | // Animations created synchronously will run synchronously | ||
6647 | function createFxNow() { | ||
6648 | window.setTimeout( function() { | ||
6649 | fxNow = undefined; | ||
6650 | } ); | ||
6651 | return ( fxNow = jQuery.now() ); | ||
6652 | } | ||
6653 | |||
6654 | // Generate parameters to create a standard animation | ||
6655 | function genFx( type, includeWidth ) { | ||
6656 | var which, | ||
6657 | i = 0, | ||
6658 | attrs = { height: type }; | ||
6659 | |||
6660 | // If we include width, step value is 1 to do all cssExpand values, | ||
6661 | // otherwise step value is 2 to skip over Left and Right | ||
6662 | includeWidth = includeWidth ? 1 : 0; | ||
6663 | for ( ; i < 4; i += 2 - includeWidth ) { | ||
6664 | which = cssExpand[ i ]; | ||
6665 | attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; | ||
6666 | } | ||
6667 | |||
6668 | if ( includeWidth ) { | ||
6669 | attrs.opacity = attrs.width = type; | ||
6670 | } | ||
6671 | |||
6672 | return attrs; | ||
6673 | } | ||
6674 | |||
6675 | function createTween( value, prop, animation ) { | ||
6676 | var tween, | ||
6677 | collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), | ||
6678 | index = 0, | ||
6679 | length = collection.length; | ||
6680 | for ( ; index < length; index++ ) { | ||
6681 | if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { | ||
6682 | |||
6683 | // We're done with this property | ||
6684 | return tween; | ||
6685 | } | ||
6686 | } | ||
6687 | } | ||
6688 | |||
6689 | function defaultPrefilter( elem, props, opts ) { | ||
6690 | var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, | ||
6691 | isBox = "width" in props || "height" in props, | ||
6692 | anim = this, | ||
6693 | orig = {}, | ||
6694 | style = elem.style, | ||
6695 | hidden = elem.nodeType && isHiddenWithinTree( elem ), | ||
6696 | dataShow = dataPriv.get( elem, "fxshow" ); | ||
6697 | |||
6698 | // Queue-skipping animations hijack the fx hooks | ||
6699 | if ( !opts.queue ) { | ||
6700 | hooks = jQuery._queueHooks( elem, "fx" ); | ||
6701 | if ( hooks.unqueued == null ) { | ||
6702 | hooks.unqueued = 0; | ||
6703 | oldfire = hooks.empty.fire; | ||
6704 | hooks.empty.fire = function() { | ||
6705 | if ( !hooks.unqueued ) { | ||
6706 | oldfire(); | ||
6707 | } | ||
6708 | }; | ||
6709 | } | ||
6710 | hooks.unqueued++; | ||
6711 | |||
6712 | anim.always( function() { | ||
6713 | |||
6714 | // Ensure the complete handler is called before this completes | ||
6715 | anim.always( function() { | ||
6716 | hooks.unqueued--; | ||
6717 | if ( !jQuery.queue( elem, "fx" ).length ) { | ||
6718 | hooks.empty.fire(); | ||
6719 | } | ||
6720 | } ); | ||
6721 | } ); | ||
6722 | } | ||
6723 | |||
6724 | // Detect show/hide animations | ||
6725 | for ( prop in props ) { | ||
6726 | value = props[ prop ]; | ||
6727 | if ( rfxtypes.test( value ) ) { | ||
6728 | delete props[ prop ]; | ||
6729 | toggle = toggle || value === "toggle"; | ||
6730 | if ( value === ( hidden ? "hide" : "show" ) ) { | ||
6731 | |||
6732 | // Pretend to be hidden if this is a "show" and | ||
6733 | // there is still data from a stopped show/hide | ||
6734 | if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { | ||
6735 | hidden = true; | ||
6736 | |||
6737 | // Ignore all other no-op show/hide data | ||
6738 | } else { | ||
6739 | continue; | ||
6740 | } | ||
6741 | } | ||
6742 | orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); | ||
6743 | } | ||
6744 | } | ||
6745 | |||
6746 | // Bail out if this is a no-op like .hide().hide() | ||
6747 | propTween = !jQuery.isEmptyObject( props ); | ||
6748 | if ( !propTween && jQuery.isEmptyObject( orig ) ) { | ||
6749 | return; | ||
6750 | } | ||
6751 | |||
6752 | // Restrict "overflow" and "display" styles during box animations | ||
6753 | if ( isBox && elem.nodeType === 1 ) { | ||
6754 | |||
6755 | // Support: IE <=9 - 11, Edge 12 - 13 | ||
6756 | // Record all 3 overflow attributes because IE does not infer the shorthand | ||
6757 | // from identically-valued overflowX and overflowY | ||
6758 | opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; | ||
6759 | |||
6760 | // Identify a display type, preferring old show/hide data over the CSS cascade | ||
6761 | restoreDisplay = dataShow && dataShow.display; | ||
6762 | if ( restoreDisplay == null ) { | ||
6763 | restoreDisplay = dataPriv.get( elem, "display" ); | ||
6764 | } | ||
6765 | display = jQuery.css( elem, "display" ); | ||
6766 | if ( display === "none" ) { | ||
6767 | if ( restoreDisplay ) { | ||
6768 | display = restoreDisplay; | ||
6769 | } else { | ||
6770 | |||
6771 | // Get nonempty value(s) by temporarily forcing visibility | ||
6772 | showHide( [ elem ], true ); | ||
6773 | restoreDisplay = elem.style.display || restoreDisplay; | ||
6774 | display = jQuery.css( elem, "display" ); | ||
6775 | showHide( [ elem ] ); | ||
6776 | } | ||
6777 | } | ||
6778 | |||
6779 | // Animate inline elements as inline-block | ||
6780 | if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { | ||
6781 | if ( jQuery.css( elem, "float" ) === "none" ) { | ||
6782 | |||
6783 | // Restore the original display value at the end of pure show/hide animations | ||
6784 | if ( !propTween ) { | ||
6785 | anim.done( function() { | ||
6786 | style.display = restoreDisplay; | ||
6787 | } ); | ||
6788 | if ( restoreDisplay == null ) { | ||
6789 | display = style.display; | ||
6790 | restoreDisplay = display === "none" ? "" : display; | ||
6791 | } | ||
6792 | } | ||
6793 | style.display = "inline-block"; | ||
6794 | } | ||
6795 | } | ||
6796 | } | ||
6797 | |||
6798 | if ( opts.overflow ) { | ||
6799 | style.overflow = "hidden"; | ||
6800 | anim.always( function() { | ||
6801 | style.overflow = opts.overflow[ 0 ]; | ||
6802 | style.overflowX = opts.overflow[ 1 ]; | ||
6803 | style.overflowY = opts.overflow[ 2 ]; | ||
6804 | } ); | ||
6805 | } | ||
6806 | |||
6807 | // Implement show/hide animations | ||
6808 | propTween = false; | ||
6809 | for ( prop in orig ) { | ||
6810 | |||
6811 | // General show/hide setup for this element animation | ||
6812 | if ( !propTween ) { | ||
6813 | if ( dataShow ) { | ||
6814 | if ( "hidden" in dataShow ) { | ||
6815 | hidden = dataShow.hidden; | ||
6816 | } | ||
6817 | } else { | ||
6818 | dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); | ||
6819 | } | ||
6820 | |||
6821 | // Store hidden/visible for toggle so `.stop().toggle()` "reverses" | ||
6822 | if ( toggle ) { | ||
6823 | dataShow.hidden = !hidden; | ||
6824 | } | ||
6825 | |||
6826 | // Show elements before animating them | ||
6827 | if ( hidden ) { | ||
6828 | showHide( [ elem ], true ); | ||
6829 | } | ||
6830 | |||
6831 | /* eslint-disable no-loop-func */ | ||
6832 | |||
6833 | anim.done( function() { | ||
6834 | |||
6835 | /* eslint-enable no-loop-func */ | ||
6836 | |||
6837 | // The final step of a "hide" animation is actually hiding the element | ||
6838 | if ( !hidden ) { | ||
6839 | showHide( [ elem ] ); | ||
6840 | } | ||
6841 | dataPriv.remove( elem, "fxshow" ); | ||
6842 | for ( prop in orig ) { | ||
6843 | jQuery.style( elem, prop, orig[ prop ] ); | ||
6844 | } | ||
6845 | } ); | ||
6846 | } | ||
6847 | |||
6848 | // Per-property setup | ||
6849 | propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); | ||
6850 | if ( !( prop in dataShow ) ) { | ||
6851 | dataShow[ prop ] = propTween.start; | ||
6852 | if ( hidden ) { | ||
6853 | propTween.end = propTween.start; | ||
6854 | propTween.start = 0; | ||
6855 | } | ||
6856 | } | ||
6857 | } | ||
6858 | } | ||
6859 | |||
6860 | function propFilter( props, specialEasing ) { | ||
6861 | var index, name, easing, value, hooks; | ||
6862 | |||
6863 | // camelCase, specialEasing and expand cssHook pass | ||
6864 | for ( index in props ) { | ||
6865 | name = jQuery.camelCase( index ); | ||
6866 | easing = specialEasing[ name ]; | ||
6867 | value = props[ index ]; | ||
6868 | if ( jQuery.isArray( value ) ) { | ||
6869 | easing = value[ 1 ]; | ||
6870 | value = props[ index ] = value[ 0 ]; | ||
6871 | } | ||
6872 | |||
6873 | if ( index !== name ) { | ||
6874 | props[ name ] = value; | ||
6875 | delete props[ index ]; | ||
6876 | } | ||
6877 | |||
6878 | hooks = jQuery.cssHooks[ name ]; | ||
6879 | if ( hooks && "expand" in hooks ) { | ||
6880 | value = hooks.expand( value ); | ||
6881 | delete props[ name ]; | ||
6882 | |||
6883 | // Not quite $.extend, this won't overwrite existing keys. | ||
6884 | // Reusing 'index' because we have the correct "name" | ||
6885 | for ( index in value ) { | ||
6886 | if ( !( index in props ) ) { | ||
6887 | props[ index ] = value[ index ]; | ||
6888 | specialEasing[ index ] = easing; | ||
6889 | } | ||
6890 | } | ||
6891 | } else { | ||
6892 | specialEasing[ name ] = easing; | ||
6893 | } | ||
6894 | } | ||
6895 | } | ||
6896 | |||
6897 | function Animation( elem, properties, options ) { | ||
6898 | var result, | ||
6899 | stopped, | ||
6900 | index = 0, | ||
6901 | length = Animation.prefilters.length, | ||
6902 | deferred = jQuery.Deferred().always( function() { | ||
6903 | |||
6904 | // Don't match elem in the :animated selector | ||
6905 | delete tick.elem; | ||
6906 | } ), | ||
6907 | tick = function() { | ||
6908 | if ( stopped ) { | ||
6909 | return false; | ||
6910 | } | ||
6911 | var currentTime = fxNow || createFxNow(), | ||
6912 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), | ||
6913 | |||
6914 | // Support: Android 2.3 only | ||
6915 | // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) | ||
6916 | temp = remaining / animation.duration || 0, | ||
6917 | percent = 1 - temp, | ||
6918 | index = 0, | ||
6919 | length = animation.tweens.length; | ||
6920 | |||
6921 | for ( ; index < length; index++ ) { | ||
6922 | animation.tweens[ index ].run( percent ); | ||
6923 | } | ||
6924 | |||
6925 | deferred.notifyWith( elem, [ animation, percent, remaining ] ); | ||
6926 | |||
6927 | if ( percent < 1 && length ) { | ||
6928 | return remaining; | ||
6929 | } else { | ||
6930 | deferred.resolveWith( elem, [ animation ] ); | ||
6931 | return false; | ||
6932 | } | ||
6933 | }, | ||
6934 | animation = deferred.promise( { | ||
6935 | elem: elem, | ||
6936 | props: jQuery.extend( {}, properties ), | ||
6937 | opts: jQuery.extend( true, { | ||
6938 | specialEasing: {}, | ||
6939 | easing: jQuery.easing._default | ||
6940 | }, options ), | ||
6941 | originalProperties: properties, | ||
6942 | originalOptions: options, | ||
6943 | startTime: fxNow || createFxNow(), | ||
6944 | duration: options.duration, | ||
6945 | tweens: [], | ||
6946 | createTween: function( prop, end ) { | ||
6947 | var tween = jQuery.Tween( elem, animation.opts, prop, end, | ||
6948 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); | ||
6949 | animation.tweens.push( tween ); | ||
6950 | return tween; | ||
6951 | }, | ||
6952 | stop: function( gotoEnd ) { | ||
6953 | var index = 0, | ||
6954 | |||
6955 | // If we are going to the end, we want to run all the tweens | ||
6956 | // otherwise we skip this part | ||
6957 | length = gotoEnd ? animation.tweens.length : 0; | ||
6958 | if ( stopped ) { | ||
6959 | return this; | ||
6960 | } | ||
6961 | stopped = true; | ||
6962 | for ( ; index < length; index++ ) { | ||
6963 | animation.tweens[ index ].run( 1 ); | ||
6964 | } | ||
6965 | |||
6966 | // Resolve when we played the last frame; otherwise, reject | ||
6967 | if ( gotoEnd ) { | ||
6968 | deferred.notifyWith( elem, [ animation, 1, 0 ] ); | ||
6969 | deferred.resolveWith( elem, [ animation, gotoEnd ] ); | ||
6970 | } else { | ||
6971 | deferred.rejectWith( elem, [ animation, gotoEnd ] ); | ||
6972 | } | ||
6973 | return this; | ||
6974 | } | ||
6975 | } ), | ||
6976 | props = animation.props; | ||
6977 | |||
6978 | propFilter( props, animation.opts.specialEasing ); | ||
6979 | |||
6980 | for ( ; index < length; index++ ) { | ||
6981 | result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); | ||
6982 | if ( result ) { | ||
6983 | if ( jQuery.isFunction( result.stop ) ) { | ||
6984 | jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = | ||
6985 | jQuery.proxy( result.stop, result ); | ||
6986 | } | ||
6987 | return result; | ||
6988 | } | ||
6989 | } | ||
6990 | |||
6991 | jQuery.map( props, createTween, animation ); | ||
6992 | |||
6993 | if ( jQuery.isFunction( animation.opts.start ) ) { | ||
6994 | animation.opts.start.call( elem, animation ); | ||
6995 | } | ||
6996 | |||
6997 | jQuery.fx.timer( | ||
6998 | jQuery.extend( tick, { | ||
6999 | elem: elem, | ||
7000 | anim: animation, | ||
7001 | queue: animation.opts.queue | ||
7002 | } ) | ||
7003 | ); | ||
7004 | |||
7005 | // attach callbacks from options | ||
7006 | return animation.progress( animation.opts.progress ) | ||
7007 | .done( animation.opts.done, animation.opts.complete ) | ||
7008 | .fail( animation.opts.fail ) | ||
7009 | .always( animation.opts.always ); | ||
7010 | } | ||
7011 | |||
7012 | jQuery.Animation = jQuery.extend( Animation, { | ||
7013 | |||
7014 | tweeners: { | ||
7015 | "*": [ function( prop, value ) { | ||
7016 | var tween = this.createTween( prop, value ); | ||
7017 | adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); | ||
7018 | return tween; | ||
7019 | } ] | ||
7020 | }, | ||
7021 | |||
7022 | tweener: function( props, callback ) { | ||
7023 | if ( jQuery.isFunction( props ) ) { | ||
7024 | callback = props; | ||
7025 | props = [ "*" ]; | ||
7026 | } else { | ||
7027 | props = props.match( rnotwhite ); | ||
7028 | } | ||
7029 | |||
7030 | var prop, | ||
7031 | index = 0, | ||
7032 | length = props.length; | ||
7033 | |||
7034 | for ( ; index < length; index++ ) { | ||
7035 | prop = props[ index ]; | ||
7036 | Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; | ||
7037 | Animation.tweeners[ prop ].unshift( callback ); | ||
7038 | } | ||
7039 | }, | ||
7040 | |||
7041 | prefilters: [ defaultPrefilter ], | ||
7042 | |||
7043 | prefilter: function( callback, prepend ) { | ||
7044 | if ( prepend ) { | ||
7045 | Animation.prefilters.unshift( callback ); | ||
7046 | } else { | ||
7047 | Animation.prefilters.push( callback ); | ||
7048 | } | ||
7049 | } | ||
7050 | } ); | ||
7051 | |||
7052 | jQuery.speed = function( speed, easing, fn ) { | ||
7053 | var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { | ||
7054 | complete: fn || !fn && easing || | ||
7055 | jQuery.isFunction( speed ) && speed, | ||
7056 | duration: speed, | ||
7057 | easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing | ||
7058 | }; | ||
7059 | |||
7060 | // Go to the end state if fx are off or if document is hidden | ||
7061 | if ( jQuery.fx.off || document.hidden ) { | ||
7062 | opt.duration = 0; | ||
7063 | |||
7064 | } else { | ||
7065 | opt.duration = typeof opt.duration === "number" ? | ||
7066 | opt.duration : opt.duration in jQuery.fx.speeds ? | ||
7067 | jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; | ||
7068 | } | ||
7069 | |||
7070 | // Normalize opt.queue - true/undefined/null -> "fx" | ||
7071 | if ( opt.queue == null || opt.queue === true ) { | ||
7072 | opt.queue = "fx"; | ||
7073 | } | ||
7074 | |||
7075 | // Queueing | ||
7076 | opt.old = opt.complete; | ||
7077 | |||
7078 | opt.complete = function() { | ||
7079 | if ( jQuery.isFunction( opt.old ) ) { | ||
7080 | opt.old.call( this ); | ||
7081 | } | ||
7082 | |||
7083 | if ( opt.queue ) { | ||
7084 | jQuery.dequeue( this, opt.queue ); | ||
7085 | } | ||
7086 | }; | ||
7087 | |||
7088 | return opt; | ||
7089 | }; | ||
7090 | |||
7091 | jQuery.fn.extend( { | ||
7092 | fadeTo: function( speed, to, easing, callback ) { | ||
7093 | |||
7094 | // Show any hidden elements after setting opacity to 0 | ||
7095 | return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() | ||
7096 | |||
7097 | // Animate to the value specified | ||
7098 | .end().animate( { opacity: to }, speed, easing, callback ); | ||
7099 | }, | ||
7100 | animate: function( prop, speed, easing, callback ) { | ||
7101 | var empty = jQuery.isEmptyObject( prop ), | ||
7102 | optall = jQuery.speed( speed, easing, callback ), | ||
7103 | doAnimation = function() { | ||
7104 | |||
7105 | // Operate on a copy of prop so per-property easing won't be lost | ||
7106 | var anim = Animation( this, jQuery.extend( {}, prop ), optall ); | ||
7107 | |||
7108 | // Empty animations, or finishing resolves immediately | ||
7109 | if ( empty || dataPriv.get( this, "finish" ) ) { | ||
7110 | anim.stop( true ); | ||
7111 | } | ||
7112 | }; | ||
7113 | doAnimation.finish = doAnimation; | ||
7114 | |||
7115 | return empty || optall.queue === false ? | ||
7116 | this.each( doAnimation ) : | ||
7117 | this.queue( optall.queue, doAnimation ); | ||
7118 | }, | ||
7119 | stop: function( type, clearQueue, gotoEnd ) { | ||
7120 | var stopQueue = function( hooks ) { | ||
7121 | var stop = hooks.stop; | ||
7122 | delete hooks.stop; | ||
7123 | stop( gotoEnd ); | ||
7124 | }; | ||
7125 | |||
7126 | if ( typeof type !== "string" ) { | ||
7127 | gotoEnd = clearQueue; | ||
7128 | clearQueue = type; | ||
7129 | type = undefined; | ||
7130 | } | ||
7131 | if ( clearQueue && type !== false ) { | ||
7132 | this.queue( type || "fx", [] ); | ||
7133 | } | ||
7134 | |||
7135 | return this.each( function() { | ||
7136 | var dequeue = true, | ||
7137 | index = type != null && type + "queueHooks", | ||
7138 | timers = jQuery.timers, | ||
7139 | data = dataPriv.get( this ); | ||
7140 | |||
7141 | if ( index ) { | ||
7142 | if ( data[ index ] && data[ index ].stop ) { | ||
7143 | stopQueue( data[ index ] ); | ||
7144 | } | ||
7145 | } else { | ||
7146 | for ( index in data ) { | ||
7147 | if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { | ||
7148 | stopQueue( data[ index ] ); | ||
7149 | } | ||
7150 | } | ||
7151 | } | ||
7152 | |||
7153 | for ( index = timers.length; index--; ) { | ||
7154 | if ( timers[ index ].elem === this && | ||
7155 | ( type == null || timers[ index ].queue === type ) ) { | ||
7156 | |||
7157 | timers[ index ].anim.stop( gotoEnd ); | ||
7158 | dequeue = false; | ||
7159 | timers.splice( index, 1 ); | ||
7160 | } | ||
7161 | } | ||
7162 | |||
7163 | // Start the next in the queue if the last step wasn't forced. | ||
7164 | // Timers currently will call their complete callbacks, which | ||
7165 | // will dequeue but only if they were gotoEnd. | ||
7166 | if ( dequeue || !gotoEnd ) { | ||
7167 | jQuery.dequeue( this, type ); | ||
7168 | } | ||
7169 | } ); | ||
7170 | }, | ||
7171 | finish: function( type ) { | ||
7172 | if ( type !== false ) { | ||
7173 | type = type || "fx"; | ||
7174 | } | ||
7175 | return this.each( function() { | ||
7176 | var index, | ||
7177 | data = dataPriv.get( this ), | ||
7178 | queue = data[ type + "queue" ], | ||
7179 | hooks = data[ type + "queueHooks" ], | ||
7180 | timers = jQuery.timers, | ||
7181 | length = queue ? queue.length : 0; | ||
7182 | |||
7183 | // Enable finishing flag on private data | ||
7184 | data.finish = true; | ||
7185 | |||
7186 | // Empty the queue first | ||
7187 | jQuery.queue( this, type, [] ); | ||
7188 | |||
7189 | if ( hooks && hooks.stop ) { | ||
7190 | hooks.stop.call( this, true ); | ||
7191 | } | ||
7192 | |||
7193 | // Look for any active animations, and finish them | ||
7194 | for ( index = timers.length; index--; ) { | ||
7195 | if ( timers[ index ].elem === this && timers[ index ].queue === type ) { | ||
7196 | timers[ index ].anim.stop( true ); | ||
7197 | timers.splice( index, 1 ); | ||
7198 | } | ||
7199 | } | ||
7200 | |||
7201 | // Look for any animations in the old queue and finish them | ||
7202 | for ( index = 0; index < length; index++ ) { | ||
7203 | if ( queue[ index ] && queue[ index ].finish ) { | ||
7204 | queue[ index ].finish.call( this ); | ||
7205 | } | ||
7206 | } | ||
7207 | |||
7208 | // Turn off finishing flag | ||
7209 | delete data.finish; | ||
7210 | } ); | ||
7211 | } | ||
7212 | } ); | ||
7213 | |||
7214 | jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { | ||
7215 | var cssFn = jQuery.fn[ name ]; | ||
7216 | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
7217 | return speed == null || typeof speed === "boolean" ? | ||
7218 | cssFn.apply( this, arguments ) : | ||
7219 | this.animate( genFx( name, true ), speed, easing, callback ); | ||
7220 | }; | ||
7221 | } ); | ||
7222 | |||
7223 | // Generate shortcuts for custom animations | ||
7224 | jQuery.each( { | ||
7225 | slideDown: genFx( "show" ), | ||
7226 | slideUp: genFx( "hide" ), | ||
7227 | slideToggle: genFx( "toggle" ), | ||
7228 | fadeIn: { opacity: "show" }, | ||
7229 | fadeOut: { opacity: "hide" }, | ||
7230 | fadeToggle: { opacity: "toggle" } | ||
7231 | }, function( name, props ) { | ||
7232 | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
7233 | return this.animate( props, speed, easing, callback ); | ||
7234 | }; | ||
7235 | } ); | ||
7236 | |||
7237 | jQuery.timers = []; | ||
7238 | jQuery.fx.tick = function() { | ||
7239 | var timer, | ||
7240 | i = 0, | ||
7241 | timers = jQuery.timers; | ||
7242 | |||
7243 | fxNow = jQuery.now(); | ||
7244 | |||
7245 | for ( ; i < timers.length; i++ ) { | ||
7246 | timer = timers[ i ]; | ||
7247 | |||
7248 | // Checks the timer has not already been removed | ||
7249 | if ( !timer() && timers[ i ] === timer ) { | ||
7250 | timers.splice( i--, 1 ); | ||
7251 | } | ||
7252 | } | ||
7253 | |||
7254 | if ( !timers.length ) { | ||
7255 | jQuery.fx.stop(); | ||
7256 | } | ||
7257 | fxNow = undefined; | ||
7258 | }; | ||
7259 | |||
7260 | jQuery.fx.timer = function( timer ) { | ||
7261 | jQuery.timers.push( timer ); | ||
7262 | if ( timer() ) { | ||
7263 | jQuery.fx.start(); | ||
7264 | } else { | ||
7265 | jQuery.timers.pop(); | ||
7266 | } | ||
7267 | }; | ||
7268 | |||
7269 | jQuery.fx.interval = 13; | ||
7270 | jQuery.fx.start = function() { | ||
7271 | if ( !timerId ) { | ||
7272 | timerId = window.requestAnimationFrame ? | ||
7273 | window.requestAnimationFrame( raf ) : | ||
7274 | window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); | ||
7275 | } | ||
7276 | }; | ||
7277 | |||
7278 | jQuery.fx.stop = function() { | ||
7279 | if ( window.cancelAnimationFrame ) { | ||
7280 | window.cancelAnimationFrame( timerId ); | ||
7281 | } else { | ||
7282 | window.clearInterval( timerId ); | ||
7283 | } | ||
7284 | |||
7285 | timerId = null; | ||
7286 | }; | ||
7287 | |||
7288 | jQuery.fx.speeds = { | ||
7289 | slow: 600, | ||
7290 | fast: 200, | ||
7291 | |||
7292 | // Default speed | ||
7293 | _default: 400 | ||
7294 | }; | ||
7295 | |||
7296 | |||
7297 | // Based off of the plugin by Clint Helfers, with permission. | ||
7298 | // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ | ||
7299 | jQuery.fn.delay = function( time, type ) { | ||
7300 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; | ||
7301 | type = type || "fx"; | ||
7302 | |||
7303 | return this.queue( type, function( next, hooks ) { | ||
7304 | var timeout = window.setTimeout( next, time ); | ||
7305 | hooks.stop = function() { | ||
7306 | window.clearTimeout( timeout ); | ||
7307 | }; | ||
7308 | } ); | ||
7309 | }; | ||
7310 | |||
7311 | |||
7312 | ( function() { | ||
7313 | var input = document.createElement( "input" ), | ||
7314 | select = document.createElement( "select" ), | ||
7315 | opt = select.appendChild( document.createElement( "option" ) ); | ||
7316 | |||
7317 | input.type = "checkbox"; | ||
7318 | |||
7319 | // Support: Android <=4.3 only | ||
7320 | // Default value for a checkbox should be "on" | ||
7321 | support.checkOn = input.value !== ""; | ||
7322 | |||
7323 | // Support: IE <=11 only | ||
7324 | // Must access selectedIndex to make default options select | ||
7325 | support.optSelected = opt.selected; | ||
7326 | |||
7327 | // Support: IE <=11 only | ||
7328 | // An input loses its value after becoming a radio | ||
7329 | input = document.createElement( "input" ); | ||
7330 | input.value = "t"; | ||
7331 | input.type = "radio"; | ||
7332 | support.radioValue = input.value === "t"; | ||
7333 | } )(); | ||
7334 | |||
7335 | |||
7336 | var boolHook, | ||
7337 | attrHandle = jQuery.expr.attrHandle; | ||
7338 | |||
7339 | jQuery.fn.extend( { | ||
7340 | attr: function( name, value ) { | ||
7341 | return access( this, jQuery.attr, name, value, arguments.length > 1 ); | ||
7342 | }, | ||
7343 | |||
7344 | removeAttr: function( name ) { | ||
7345 | return this.each( function() { | ||
7346 | jQuery.removeAttr( this, name ); | ||
7347 | } ); | ||
7348 | } | ||
7349 | } ); | ||
7350 | |||
7351 | jQuery.extend( { | ||
7352 | attr: function( elem, name, value ) { | ||
7353 | var ret, hooks, | ||
7354 | nType = elem.nodeType; | ||
7355 | |||
7356 | // Don't get/set attributes on text, comment and attribute nodes | ||
7357 | if ( nType === 3 || nType === 8 || nType === 2 ) { | ||
7358 | return; | ||
7359 | } | ||
7360 | |||
7361 | // Fallback to prop when attributes are not supported | ||
7362 | if ( typeof elem.getAttribute === "undefined" ) { | ||
7363 | return jQuery.prop( elem, name, value ); | ||
7364 | } | ||
7365 | |||
7366 | // Attribute hooks are determined by the lowercase version | ||
7367 | // Grab necessary hook if one is defined | ||
7368 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { | ||
7369 | hooks = jQuery.attrHooks[ name.toLowerCase() ] || | ||
7370 | ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); | ||
7371 | } | ||
7372 | |||
7373 | if ( value !== undefined ) { | ||
7374 | if ( value === null ) { | ||
7375 | jQuery.removeAttr( elem, name ); | ||
7376 | return; | ||
7377 | } | ||
7378 | |||
7379 | if ( hooks && "set" in hooks && | ||
7380 | ( ret = hooks.set( elem, value, name ) ) !== undefined ) { | ||
7381 | return ret; | ||
7382 | } | ||
7383 | |||
7384 | elem.setAttribute( name, value + "" ); | ||
7385 | return value; | ||
7386 | } | ||
7387 | |||
7388 | if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { | ||
7389 | return ret; | ||
7390 | } | ||
7391 | |||
7392 | ret = jQuery.find.attr( elem, name ); | ||
7393 | |||
7394 | // Non-existent attributes return null, we normalize to undefined | ||
7395 | return ret == null ? undefined : ret; | ||
7396 | }, | ||
7397 | |||
7398 | attrHooks: { | ||
7399 | type: { | ||
7400 | set: function( elem, value ) { | ||
7401 | if ( !support.radioValue && value === "radio" && | ||
7402 | jQuery.nodeName( elem, "input" ) ) { | ||
7403 | var val = elem.value; | ||
7404 | elem.setAttribute( "type", value ); | ||
7405 | if ( val ) { | ||
7406 | elem.value = val; | ||
7407 | } | ||
7408 | return value; | ||
7409 | } | ||
7410 | } | ||
7411 | } | ||
7412 | }, | ||
7413 | |||
7414 | removeAttr: function( elem, value ) { | ||
7415 | var name, | ||
7416 | i = 0, | ||
7417 | attrNames = value && value.match( rnotwhite ); | ||
7418 | |||
7419 | if ( attrNames && elem.nodeType === 1 ) { | ||
7420 | while ( ( name = attrNames[ i++ ] ) ) { | ||
7421 | elem.removeAttribute( name ); | ||
7422 | } | ||
7423 | } | ||
7424 | } | ||
7425 | } ); | ||
7426 | |||
7427 | // Hooks for boolean attributes | ||
7428 | boolHook = { | ||
7429 | set: function( elem, value, name ) { | ||
7430 | if ( value === false ) { | ||
7431 | |||
7432 | // Remove boolean attributes when set to false | ||
7433 | jQuery.removeAttr( elem, name ); | ||
7434 | } else { | ||
7435 | elem.setAttribute( name, name ); | ||
7436 | } | ||
7437 | return name; | ||
7438 | } | ||
7439 | }; | ||
7440 | |||
7441 | jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { | ||
7442 | var getter = attrHandle[ name ] || jQuery.find.attr; | ||
7443 | |||
7444 | attrHandle[ name ] = function( elem, name, isXML ) { | ||
7445 | var ret, handle, | ||
7446 | lowercaseName = name.toLowerCase(); | ||
7447 | |||
7448 | if ( !isXML ) { | ||
7449 | |||
7450 | // Avoid an infinite loop by temporarily removing this function from the getter | ||
7451 | handle = attrHandle[ lowercaseName ]; | ||
7452 | attrHandle[ lowercaseName ] = ret; | ||
7453 | ret = getter( elem, name, isXML ) != null ? | ||
7454 | lowercaseName : | ||
7455 | null; | ||
7456 | attrHandle[ lowercaseName ] = handle; | ||
7457 | } | ||
7458 | return ret; | ||
7459 | }; | ||
7460 | } ); | ||
7461 | |||
7462 | |||
7463 | |||
7464 | |||
7465 | var rfocusable = /^(?:input|select|textarea|button)$/i, | ||
7466 | rclickable = /^(?:a|area)$/i; | ||
7467 | |||
7468 | jQuery.fn.extend( { | ||
7469 | prop: function( name, value ) { | ||
7470 | return access( this, jQuery.prop, name, value, arguments.length > 1 ); | ||
7471 | }, | ||
7472 | |||
7473 | removeProp: function( name ) { | ||
7474 | return this.each( function() { | ||
7475 | delete this[ jQuery.propFix[ name ] || name ]; | ||
7476 | } ); | ||
7477 | } | ||
7478 | } ); | ||
7479 | |||
7480 | jQuery.extend( { | ||
7481 | prop: function( elem, name, value ) { | ||
7482 | var ret, hooks, | ||
7483 | nType = elem.nodeType; | ||
7484 | |||
7485 | // Don't get/set properties on text, comment and attribute nodes | ||
7486 | if ( nType === 3 || nType === 8 || nType === 2 ) { | ||
7487 | return; | ||
7488 | } | ||
7489 | |||
7490 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { | ||
7491 | |||
7492 | // Fix name and attach hooks | ||
7493 | name = jQuery.propFix[ name ] || name; | ||
7494 | hooks = jQuery.propHooks[ name ]; | ||
7495 | } | ||
7496 | |||
7497 | if ( value !== undefined ) { | ||
7498 | if ( hooks && "set" in hooks && | ||
7499 | ( ret = hooks.set( elem, value, name ) ) !== undefined ) { | ||
7500 | return ret; | ||
7501 | } | ||
7502 | |||
7503 | return ( elem[ name ] = value ); | ||
7504 | } | ||
7505 | |||
7506 | if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { | ||
7507 | return ret; | ||
7508 | } | ||
7509 | |||
7510 | return elem[ name ]; | ||
7511 | }, | ||
7512 | |||
7513 | propHooks: { | ||
7514 | tabIndex: { | ||
7515 | get: function( elem ) { | ||
7516 | |||
7517 | // Support: IE <=9 - 11 only | ||
7518 | // elem.tabIndex doesn't always return the | ||
7519 | // correct value when it hasn't been explicitly set | ||
7520 | // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ | ||
7521 | // Use proper attribute retrieval(#12072) | ||
7522 | var tabindex = jQuery.find.attr( elem, "tabindex" ); | ||
7523 | |||
7524 | return tabindex ? | ||
7525 | parseInt( tabindex, 10 ) : | ||
7526 | rfocusable.test( elem.nodeName ) || | ||
7527 | rclickable.test( elem.nodeName ) && elem.href ? | ||
7528 | 0 : | ||
7529 | -1; | ||
7530 | } | ||
7531 | } | ||
7532 | }, | ||
7533 | |||
7534 | propFix: { | ||
7535 | "for": "htmlFor", | ||
7536 | "class": "className" | ||
7537 | } | ||
7538 | } ); | ||
7539 | |||
7540 | // Support: IE <=11 only | ||
7541 | // Accessing the selectedIndex property | ||
7542 | // forces the browser to respect setting selected | ||
7543 | // on the option | ||
7544 | // The getter ensures a default option is selected | ||
7545 | // when in an optgroup | ||
7546 | if ( !support.optSelected ) { | ||
7547 | jQuery.propHooks.selected = { | ||
7548 | get: function( elem ) { | ||
7549 | var parent = elem.parentNode; | ||
7550 | if ( parent && parent.parentNode ) { | ||
7551 | parent.parentNode.selectedIndex; | ||
7552 | } | ||
7553 | return null; | ||
7554 | }, | ||
7555 | set: function( elem ) { | ||
7556 | var parent = elem.parentNode; | ||
7557 | if ( parent ) { | ||
7558 | parent.selectedIndex; | ||
7559 | |||
7560 | if ( parent.parentNode ) { | ||
7561 | parent.parentNode.selectedIndex; | ||
7562 | } | ||
7563 | } | ||
7564 | } | ||
7565 | }; | ||
7566 | } | ||
7567 | |||
7568 | jQuery.each( [ | ||
7569 | "tabIndex", | ||
7570 | "readOnly", | ||
7571 | "maxLength", | ||
7572 | "cellSpacing", | ||
7573 | "cellPadding", | ||
7574 | "rowSpan", | ||
7575 | "colSpan", | ||
7576 | "useMap", | ||
7577 | "frameBorder", | ||
7578 | "contentEditable" | ||
7579 | ], function() { | ||
7580 | jQuery.propFix[ this.toLowerCase() ] = this; | ||
7581 | } ); | ||
7582 | |||
7583 | |||
7584 | |||
7585 | |||
7586 | var rclass = /[\t\r\n\f]/g; | ||
7587 | |||
7588 | function getClass( elem ) { | ||
7589 | return elem.getAttribute && elem.getAttribute( "class" ) || ""; | ||
7590 | } | ||
7591 | |||
7592 | jQuery.fn.extend( { | ||
7593 | addClass: function( value ) { | ||
7594 | var classes, elem, cur, curValue, clazz, j, finalValue, | ||
7595 | i = 0; | ||
7596 | |||
7597 | if ( jQuery.isFunction( value ) ) { | ||
7598 | return this.each( function( j ) { | ||
7599 | jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); | ||
7600 | } ); | ||
7601 | } | ||
7602 | |||
7603 | if ( typeof value === "string" && value ) { | ||
7604 | classes = value.match( rnotwhite ) || []; | ||
7605 | |||
7606 | while ( ( elem = this[ i++ ] ) ) { | ||
7607 | curValue = getClass( elem ); | ||
7608 | cur = elem.nodeType === 1 && | ||
7609 | ( " " + curValue + " " ).replace( rclass, " " ); | ||
7610 | |||
7611 | if ( cur ) { | ||
7612 | j = 0; | ||
7613 | while ( ( clazz = classes[ j++ ] ) ) { | ||
7614 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { | ||
7615 | cur += clazz + " "; | ||
7616 | } | ||
7617 | } | ||
7618 | |||
7619 | // Only assign if different to avoid unneeded rendering. | ||
7620 | finalValue = jQuery.trim( cur ); | ||
7621 | if ( curValue !== finalValue ) { | ||
7622 | elem.setAttribute( "class", finalValue ); | ||
7623 | } | ||
7624 | } | ||
7625 | } | ||
7626 | } | ||
7627 | |||
7628 | return this; | ||
7629 | }, | ||
7630 | |||
7631 | removeClass: function( value ) { | ||
7632 | var classes, elem, cur, curValue, clazz, j, finalValue, | ||
7633 | i = 0; | ||
7634 | |||
7635 | if ( jQuery.isFunction( value ) ) { | ||
7636 | return this.each( function( j ) { | ||
7637 | jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); | ||
7638 | } ); | ||
7639 | } | ||
7640 | |||
7641 | if ( !arguments.length ) { | ||
7642 | return this.attr( "class", "" ); | ||
7643 | } | ||
7644 | |||
7645 | if ( typeof value === "string" && value ) { | ||
7646 | classes = value.match( rnotwhite ) || []; | ||
7647 | |||
7648 | while ( ( elem = this[ i++ ] ) ) { | ||
7649 | curValue = getClass( elem ); | ||
7650 | |||
7651 | // This expression is here for better compressibility (see addClass) | ||
7652 | cur = elem.nodeType === 1 && | ||
7653 | ( " " + curValue + " " ).replace( rclass, " " ); | ||
7654 | |||
7655 | if ( cur ) { | ||
7656 | j = 0; | ||
7657 | while ( ( clazz = classes[ j++ ] ) ) { | ||
7658 | |||
7659 | // Remove *all* instances | ||
7660 | while ( cur.indexOf( " " + clazz + " " ) > -1 ) { | ||
7661 | cur = cur.replace( " " + clazz + " ", " " ); | ||
7662 | } | ||
7663 | } | ||
7664 | |||
7665 | // Only assign if different to avoid unneeded rendering. | ||
7666 | finalValue = jQuery.trim( cur ); | ||
7667 | if ( curValue !== finalValue ) { | ||
7668 | elem.setAttribute( "class", finalValue ); | ||
7669 | } | ||
7670 | } | ||
7671 | } | ||
7672 | } | ||
7673 | |||
7674 | return this; | ||
7675 | }, | ||
7676 | |||
7677 | toggleClass: function( value, stateVal ) { | ||
7678 | var type = typeof value; | ||
7679 | |||
7680 | if ( typeof stateVal === "boolean" && type === "string" ) { | ||
7681 | return stateVal ? this.addClass( value ) : this.removeClass( value ); | ||
7682 | } | ||
7683 | |||
7684 | if ( jQuery.isFunction( value ) ) { | ||
7685 | return this.each( function( i ) { | ||
7686 | jQuery( this ).toggleClass( | ||
7687 | value.call( this, i, getClass( this ), stateVal ), | ||
7688 | stateVal | ||
7689 | ); | ||
7690 | } ); | ||
7691 | } | ||
7692 | |||
7693 | return this.each( function() { | ||
7694 | var className, i, self, classNames; | ||
7695 | |||
7696 | if ( type === "string" ) { | ||
7697 | |||
7698 | // Toggle individual class names | ||
7699 | i = 0; | ||
7700 | self = jQuery( this ); | ||
7701 | classNames = value.match( rnotwhite ) || []; | ||
7702 | |||
7703 | while ( ( className = classNames[ i++ ] ) ) { | ||
7704 | |||
7705 | // Check each className given, space separated list | ||
7706 | if ( self.hasClass( className ) ) { | ||
7707 | self.removeClass( className ); | ||
7708 | } else { | ||
7709 | self.addClass( className ); | ||
7710 | } | ||
7711 | } | ||
7712 | |||
7713 | // Toggle whole class name | ||
7714 | } else if ( value === undefined || type === "boolean" ) { | ||
7715 | className = getClass( this ); | ||
7716 | if ( className ) { | ||
7717 | |||
7718 | // Store className if set | ||
7719 | dataPriv.set( this, "__className__", className ); | ||
7720 | } | ||
7721 | |||
7722 | // If the element has a class name or if we're passed `false`, | ||
7723 | // then remove the whole classname (if there was one, the above saved it). | ||
7724 | // Otherwise bring back whatever was previously saved (if anything), | ||
7725 | // falling back to the empty string if nothing was stored. | ||
7726 | if ( this.setAttribute ) { | ||
7727 | this.setAttribute( "class", | ||
7728 | className || value === false ? | ||
7729 | "" : | ||
7730 | dataPriv.get( this, "__className__" ) || "" | ||
7731 | ); | ||
7732 | } | ||
7733 | } | ||
7734 | } ); | ||
7735 | }, | ||
7736 | |||
7737 | hasClass: function( selector ) { | ||
7738 | var className, elem, | ||
7739 | i = 0; | ||
7740 | |||
7741 | className = " " + selector + " "; | ||
7742 | while ( ( elem = this[ i++ ] ) ) { | ||
7743 | if ( elem.nodeType === 1 && | ||
7744 | ( " " + getClass( elem ) + " " ).replace( rclass, " " ) | ||
7745 | .indexOf( className ) > -1 | ||
7746 | ) { | ||
7747 | return true; | ||
7748 | } | ||
7749 | } | ||
7750 | |||
7751 | return false; | ||
7752 | } | ||
7753 | } ); | ||
7754 | |||
7755 | |||
7756 | |||
7757 | |||
7758 | var rreturn = /\r/g, | ||
7759 | rspaces = /[\x20\t\r\n\f]+/g; | ||
7760 | |||
7761 | jQuery.fn.extend( { | ||
7762 | val: function( value ) { | ||
7763 | var hooks, ret, isFunction, | ||
7764 | elem = this[ 0 ]; | ||
7765 | |||
7766 | if ( !arguments.length ) { | ||
7767 | if ( elem ) { | ||
7768 | hooks = jQuery.valHooks[ elem.type ] || | ||
7769 | jQuery.valHooks[ elem.nodeName.toLowerCase() ]; | ||
7770 | |||
7771 | if ( hooks && | ||
7772 | "get" in hooks && | ||
7773 | ( ret = hooks.get( elem, "value" ) ) !== undefined | ||
7774 | ) { | ||
7775 | return ret; | ||
7776 | } | ||
7777 | |||
7778 | ret = elem.value; | ||
7779 | |||
7780 | return typeof ret === "string" ? | ||
7781 | |||
7782 | // Handle most common string cases | ||
7783 | ret.replace( rreturn, "" ) : | ||
7784 | |||
7785 | // Handle cases where value is null/undef or number | ||
7786 | ret == null ? "" : ret; | ||
7787 | } | ||
7788 | |||
7789 | return; | ||
7790 | } | ||
7791 | |||
7792 | isFunction = jQuery.isFunction( value ); | ||
7793 | |||
7794 | return this.each( function( i ) { | ||
7795 | var val; | ||
7796 | |||
7797 | if ( this.nodeType !== 1 ) { | ||
7798 | return; | ||
7799 | } | ||
7800 | |||
7801 | if ( isFunction ) { | ||
7802 | val = value.call( this, i, jQuery( this ).val() ); | ||
7803 | } else { | ||
7804 | val = value; | ||
7805 | } | ||
7806 | |||
7807 | // Treat null/undefined as ""; convert numbers to string | ||
7808 | if ( val == null ) { | ||
7809 | val = ""; | ||
7810 | |||
7811 | } else if ( typeof val === "number" ) { | ||
7812 | val += ""; | ||
7813 | |||
7814 | } else if ( jQuery.isArray( val ) ) { | ||
7815 | val = jQuery.map( val, function( value ) { | ||
7816 | return value == null ? "" : value + ""; | ||
7817 | } ); | ||
7818 | } | ||
7819 | |||
7820 | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; | ||
7821 | |||
7822 | // If set returns undefined, fall back to normal setting | ||
7823 | if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { | ||
7824 | this.value = val; | ||
7825 | } | ||
7826 | } ); | ||
7827 | } | ||
7828 | } ); | ||
7829 | |||
7830 | jQuery.extend( { | ||
7831 | valHooks: { | ||
7832 | option: { | ||
7833 | get: function( elem ) { | ||
7834 | |||
7835 | var val = jQuery.find.attr( elem, "value" ); | ||
7836 | return val != null ? | ||
7837 | val : | ||
7838 | |||
7839 | // Support: IE <=10 - 11 only | ||
7840 | // option.text throws exceptions (#14686, #14858) | ||
7841 | // Strip and collapse whitespace | ||
7842 | // https://html.spec.whatwg.org/#strip-and-collapse-whitespace | ||
7843 | jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); | ||
7844 | } | ||
7845 | }, | ||
7846 | select: { | ||
7847 | get: function( elem ) { | ||
7848 | var value, option, | ||
7849 | options = elem.options, | ||
7850 | index = elem.selectedIndex, | ||
7851 | one = elem.type === "select-one", | ||
7852 | values = one ? null : [], | ||
7853 | max = one ? index + 1 : options.length, | ||
7854 | i = index < 0 ? | ||
7855 | max : | ||
7856 | one ? index : 0; | ||
7857 | |||
7858 | // Loop through all the selected options | ||
7859 | for ( ; i < max; i++ ) { | ||
7860 | option = options[ i ]; | ||
7861 | |||
7862 | // Support: IE <=9 only | ||
7863 | // IE8-9 doesn't update selected after form reset (#2551) | ||
7864 | if ( ( option.selected || i === index ) && | ||
7865 | |||
7866 | // Don't return options that are disabled or in a disabled optgroup | ||
7867 | !option.disabled && | ||
7868 | ( !option.parentNode.disabled || | ||
7869 | !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { | ||
7870 | |||
7871 | // Get the specific value for the option | ||
7872 | value = jQuery( option ).val(); | ||
7873 | |||
7874 | // We don't need an array for one selects | ||
7875 | if ( one ) { | ||
7876 | return value; | ||
7877 | } | ||
7878 | |||
7879 | // Multi-Selects return an array | ||
7880 | values.push( value ); | ||
7881 | } | ||
7882 | } | ||
7883 | |||
7884 | return values; | ||
7885 | }, | ||
7886 | |||
7887 | set: function( elem, value ) { | ||
7888 | var optionSet, option, | ||
7889 | options = elem.options, | ||
7890 | values = jQuery.makeArray( value ), | ||
7891 | i = options.length; | ||
7892 | |||
7893 | while ( i-- ) { | ||
7894 | option = options[ i ]; | ||
7895 | |||
7896 | /* eslint-disable no-cond-assign */ | ||
7897 | |||
7898 | if ( option.selected = | ||
7899 | jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 | ||
7900 | ) { | ||
7901 | optionSet = true; | ||
7902 | } | ||
7903 | |||
7904 | /* eslint-enable no-cond-assign */ | ||
7905 | } | ||
7906 | |||
7907 | // Force browsers to behave consistently when non-matching value is set | ||
7908 | if ( !optionSet ) { | ||
7909 | elem.selectedIndex = -1; | ||
7910 | } | ||
7911 | return values; | ||
7912 | } | ||
7913 | } | ||
7914 | } | ||
7915 | } ); | ||
7916 | |||
7917 | // Radios and checkboxes getter/setter | ||
7918 | jQuery.each( [ "radio", "checkbox" ], function() { | ||
7919 | jQuery.valHooks[ this ] = { | ||
7920 | set: function( elem, value ) { | ||
7921 | if ( jQuery.isArray( value ) ) { | ||
7922 | return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); | ||
7923 | } | ||
7924 | } | ||
7925 | }; | ||
7926 | if ( !support.checkOn ) { | ||
7927 | jQuery.valHooks[ this ].get = function( elem ) { | ||
7928 | return elem.getAttribute( "value" ) === null ? "on" : elem.value; | ||
7929 | }; | ||
7930 | } | ||
7931 | } ); | ||
7932 | |||
7933 | |||
7934 | |||
7935 | |||
7936 | // Return jQuery for attributes-only inclusion | ||
7937 | |||
7938 | |||
7939 | var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; | ||
7940 | |||
7941 | jQuery.extend( jQuery.event, { | ||
7942 | |||
7943 | trigger: function( event, data, elem, onlyHandlers ) { | ||
7944 | |||
7945 | var i, cur, tmp, bubbleType, ontype, handle, special, | ||
7946 | eventPath = [ elem || document ], | ||
7947 | type = hasOwn.call( event, "type" ) ? event.type : event, | ||
7948 | namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; | ||
7949 | |||
7950 | cur = tmp = elem = elem || document; | ||
7951 | |||
7952 | // Don't do events on text and comment nodes | ||
7953 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
7954 | return; | ||
7955 | } | ||
7956 | |||
7957 | // focus/blur morphs to focusin/out; ensure we're not firing them right now | ||
7958 | if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { | ||
7959 | return; | ||
7960 | } | ||
7961 | |||
7962 | if ( type.indexOf( "." ) > -1 ) { | ||
7963 | |||
7964 | // Namespaced trigger; create a regexp to match event type in handle() | ||
7965 | namespaces = type.split( "." ); | ||
7966 | type = namespaces.shift(); | ||
7967 | namespaces.sort(); | ||
7968 | } | ||
7969 | ontype = type.indexOf( ":" ) < 0 && "on" + type; | ||
7970 | |||
7971 | // Caller can pass in a jQuery.Event object, Object, or just an event type string | ||
7972 | event = event[ jQuery.expando ] ? | ||
7973 | event : | ||
7974 | new jQuery.Event( type, typeof event === "object" && event ); | ||
7975 | |||
7976 | // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) | ||
7977 | event.isTrigger = onlyHandlers ? 2 : 3; | ||
7978 | event.namespace = namespaces.join( "." ); | ||
7979 | event.rnamespace = event.namespace ? | ||
7980 | new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : | ||
7981 | null; | ||
7982 | |||
7983 | // Clean up the event in case it is being reused | ||
7984 | event.result = undefined; | ||
7985 | if ( !event.target ) { | ||
7986 | event.target = elem; | ||
7987 | } | ||
7988 | |||
7989 | // Clone any incoming data and prepend the event, creating the handler arg list | ||
7990 | data = data == null ? | ||
7991 | [ event ] : | ||
7992 | jQuery.makeArray( data, [ event ] ); | ||
7993 | |||
7994 | // Allow special events to draw outside the lines | ||
7995 | special = jQuery.event.special[ type ] || {}; | ||
7996 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { | ||
7997 | return; | ||
7998 | } | ||
7999 | |||
8000 | // Determine event propagation path in advance, per W3C events spec (#9951) | ||
8001 | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) | ||
8002 | if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { | ||
8003 | |||
8004 | bubbleType = special.delegateType || type; | ||
8005 | if ( !rfocusMorph.test( bubbleType + type ) ) { | ||
8006 | cur = cur.parentNode; | ||
8007 | } | ||
8008 | for ( ; cur; cur = cur.parentNode ) { | ||
8009 | eventPath.push( cur ); | ||
8010 | tmp = cur; | ||
8011 | } | ||
8012 | |||
8013 | // Only add window if we got to document (e.g., not plain obj or detached DOM) | ||
8014 | if ( tmp === ( elem.ownerDocument || document ) ) { | ||
8015 | eventPath.push( tmp.defaultView || tmp.parentWindow || window ); | ||
8016 | } | ||
8017 | } | ||
8018 | |||
8019 | // Fire handlers on the event path | ||
8020 | i = 0; | ||
8021 | while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { | ||
8022 | |||
8023 | event.type = i > 1 ? | ||
8024 | bubbleType : | ||
8025 | special.bindType || type; | ||
8026 | |||
8027 | // jQuery handler | ||
8028 | handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && | ||
8029 | dataPriv.get( cur, "handle" ); | ||
8030 | if ( handle ) { | ||
8031 | handle.apply( cur, data ); | ||
8032 | } | ||
8033 | |||
8034 | // Native handler | ||
8035 | handle = ontype && cur[ ontype ]; | ||
8036 | if ( handle && handle.apply && acceptData( cur ) ) { | ||
8037 | event.result = handle.apply( cur, data ); | ||
8038 | if ( event.result === false ) { | ||
8039 | event.preventDefault(); | ||
8040 | } | ||
8041 | } | ||
8042 | } | ||
8043 | event.type = type; | ||
8044 | |||
8045 | // If nobody prevented the default action, do it now | ||
8046 | if ( !onlyHandlers && !event.isDefaultPrevented() ) { | ||
8047 | |||
8048 | if ( ( !special._default || | ||
8049 | special._default.apply( eventPath.pop(), data ) === false ) && | ||
8050 | acceptData( elem ) ) { | ||
8051 | |||
8052 | // Call a native DOM method on the target with the same name as the event. | ||
8053 | // Don't do default actions on window, that's where global variables be (#6170) | ||
8054 | if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { | ||
8055 | |||
8056 | // Don't re-trigger an onFOO event when we call its FOO() method | ||
8057 | tmp = elem[ ontype ]; | ||
8058 | |||
8059 | if ( tmp ) { | ||
8060 | elem[ ontype ] = null; | ||
8061 | } | ||
8062 | |||
8063 | // Prevent re-triggering of the same event, since we already bubbled it above | ||
8064 | jQuery.event.triggered = type; | ||
8065 | elem[ type ](); | ||
8066 | jQuery.event.triggered = undefined; | ||
8067 | |||
8068 | if ( tmp ) { | ||
8069 | elem[ ontype ] = tmp; | ||
8070 | } | ||
8071 | } | ||
8072 | } | ||
8073 | } | ||
8074 | |||
8075 | return event.result; | ||
8076 | }, | ||
8077 | |||
8078 | // Piggyback on a donor event to simulate a different one | ||
8079 | // Used only for `focus(in | out)` events | ||
8080 | simulate: function( type, elem, event ) { | ||
8081 | var e = jQuery.extend( | ||
8082 | new jQuery.Event(), | ||
8083 | event, | ||
8084 | { | ||
8085 | type: type, | ||
8086 | isSimulated: true | ||
8087 | } | ||
8088 | ); | ||
8089 | |||
8090 | jQuery.event.trigger( e, null, elem ); | ||
8091 | } | ||
8092 | |||
8093 | } ); | ||
8094 | |||
8095 | jQuery.fn.extend( { | ||
8096 | |||
8097 | trigger: function( type, data ) { | ||
8098 | return this.each( function() { | ||
8099 | jQuery.event.trigger( type, data, this ); | ||
8100 | } ); | ||
8101 | }, | ||
8102 | triggerHandler: function( type, data ) { | ||
8103 | var elem = this[ 0 ]; | ||
8104 | if ( elem ) { | ||
8105 | return jQuery.event.trigger( type, data, elem, true ); | ||
8106 | } | ||
8107 | } | ||
8108 | } ); | ||
8109 | |||
8110 | |||
8111 | jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + | ||
8112 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + | ||
8113 | "change select submit keydown keypress keyup contextmenu" ).split( " " ), | ||
8114 | function( i, name ) { | ||
8115 | |||
8116 | // Handle event binding | ||
8117 | jQuery.fn[ name ] = function( data, fn ) { | ||
8118 | return arguments.length > 0 ? | ||
8119 | this.on( name, null, data, fn ) : | ||
8120 | this.trigger( name ); | ||
8121 | }; | ||
8122 | } ); | ||
8123 | |||
8124 | jQuery.fn.extend( { | ||
8125 | hover: function( fnOver, fnOut ) { | ||
8126 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); | ||
8127 | } | ||
8128 | } ); | ||
8129 | |||
8130 | |||
8131 | |||
8132 | |||
8133 | support.focusin = "onfocusin" in window; | ||
8134 | |||
8135 | |||
8136 | // Support: Firefox <=44 | ||
8137 | // Firefox doesn't have focus(in | out) events | ||
8138 | // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 | ||
8139 | // | ||
8140 | // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 | ||
8141 | // focus(in | out) events fire after focus & blur events, | ||
8142 | // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order | ||
8143 | // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 | ||
8144 | if ( !support.focusin ) { | ||
8145 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { | ||
8146 | |||
8147 | // Attach a single capturing handler on the document while someone wants focusin/focusout | ||
8148 | var handler = function( event ) { | ||
8149 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); | ||
8150 | }; | ||
8151 | |||
8152 | jQuery.event.special[ fix ] = { | ||
8153 | setup: function() { | ||
8154 | var doc = this.ownerDocument || this, | ||
8155 | attaches = dataPriv.access( doc, fix ); | ||
8156 | |||
8157 | if ( !attaches ) { | ||
8158 | doc.addEventListener( orig, handler, true ); | ||
8159 | } | ||
8160 | dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); | ||
8161 | }, | ||
8162 | teardown: function() { | ||
8163 | var doc = this.ownerDocument || this, | ||
8164 | attaches = dataPriv.access( doc, fix ) - 1; | ||
8165 | |||
8166 | if ( !attaches ) { | ||
8167 | doc.removeEventListener( orig, handler, true ); | ||
8168 | dataPriv.remove( doc, fix ); | ||
8169 | |||
8170 | } else { | ||
8171 | dataPriv.access( doc, fix, attaches ); | ||
8172 | } | ||
8173 | } | ||
8174 | }; | ||
8175 | } ); | ||
8176 | } | ||
8177 | var location = window.location; | ||
8178 | |||
8179 | var nonce = jQuery.now(); | ||
8180 | |||
8181 | var rquery = ( /\?/ ); | ||
8182 | |||
8183 | |||
8184 | |||
8185 | // Cross-browser xml parsing | ||
8186 | jQuery.parseXML = function( data ) { | ||
8187 | var xml; | ||
8188 | if ( !data || typeof data !== "string" ) { | ||
8189 | return null; | ||
8190 | } | ||
8191 | |||
8192 | // Support: IE 9 - 11 only | ||
8193 | // IE throws on parseFromString with invalid input. | ||
8194 | try { | ||
8195 | xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); | ||
8196 | } catch ( e ) { | ||
8197 | xml = undefined; | ||
8198 | } | ||
8199 | |||
8200 | if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { | ||
8201 | jQuery.error( "Invalid XML: " + data ); | ||
8202 | } | ||
8203 | return xml; | ||
8204 | }; | ||
8205 | |||
8206 | |||
8207 | var | ||
8208 | rbracket = /\[\]$/, | ||
8209 | rCRLF = /\r?\n/g, | ||
8210 | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, | ||
8211 | rsubmittable = /^(?:input|select|textarea|keygen)/i; | ||
8212 | |||
8213 | function buildParams( prefix, obj, traditional, add ) { | ||
8214 | var name; | ||
8215 | |||
8216 | if ( jQuery.isArray( obj ) ) { | ||
8217 | |||
8218 | // Serialize array item. | ||
8219 | jQuery.each( obj, function( i, v ) { | ||
8220 | if ( traditional || rbracket.test( prefix ) ) { | ||
8221 | |||
8222 | // Treat each array item as a scalar. | ||
8223 | add( prefix, v ); | ||
8224 | |||
8225 | } else { | ||
8226 | |||
8227 | // Item is non-scalar (array or object), encode its numeric index. | ||
8228 | buildParams( | ||
8229 | prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", | ||
8230 | v, | ||
8231 | traditional, | ||
8232 | add | ||
8233 | ); | ||
8234 | } | ||
8235 | } ); | ||
8236 | |||
8237 | } else if ( !traditional && jQuery.type( obj ) === "object" ) { | ||
8238 | |||
8239 | // Serialize object item. | ||
8240 | for ( name in obj ) { | ||
8241 | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); | ||
8242 | } | ||
8243 | |||
8244 | } else { | ||
8245 | |||
8246 | // Serialize scalar item. | ||
8247 | add( prefix, obj ); | ||
8248 | } | ||
8249 | } | ||
8250 | |||
8251 | // Serialize an array of form elements or a set of | ||
8252 | // key/values into a query string | ||
8253 | jQuery.param = function( a, traditional ) { | ||
8254 | var prefix, | ||
8255 | s = [], | ||
8256 | add = function( key, valueOrFunction ) { | ||
8257 | |||
8258 | // If value is a function, invoke it and use its return value | ||
8259 | var value = jQuery.isFunction( valueOrFunction ) ? | ||
8260 | valueOrFunction() : | ||
8261 | valueOrFunction; | ||
8262 | |||
8263 | s[ s.length ] = encodeURIComponent( key ) + "=" + | ||
8264 | encodeURIComponent( value == null ? "" : value ); | ||
8265 | }; | ||
8266 | |||
8267 | // If an array was passed in, assume that it is an array of form elements. | ||
8268 | if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { | ||
8269 | |||
8270 | // Serialize the form elements | ||
8271 | jQuery.each( a, function() { | ||
8272 | add( this.name, this.value ); | ||
8273 | } ); | ||
8274 | |||
8275 | } else { | ||
8276 | |||
8277 | // If traditional, encode the "old" way (the way 1.3.2 or older | ||
8278 | // did it), otherwise encode params recursively. | ||
8279 | for ( prefix in a ) { | ||
8280 | buildParams( prefix, a[ prefix ], traditional, add ); | ||
8281 | } | ||
8282 | } | ||
8283 | |||
8284 | // Return the resulting serialization | ||
8285 | return s.join( "&" ); | ||
8286 | }; | ||
8287 | |||
8288 | jQuery.fn.extend( { | ||
8289 | serialize: function() { | ||
8290 | return jQuery.param( this.serializeArray() ); | ||
8291 | }, | ||
8292 | serializeArray: function() { | ||
8293 | return this.map( function() { | ||
8294 | |||
8295 | // Can add propHook for "elements" to filter or add form elements | ||
8296 | var elements = jQuery.prop( this, "elements" ); | ||
8297 | return elements ? jQuery.makeArray( elements ) : this; | ||
8298 | } ) | ||
8299 | .filter( function() { | ||
8300 | var type = this.type; | ||
8301 | |||
8302 | // Use .is( ":disabled" ) so that fieldset[disabled] works | ||
8303 | return this.name && !jQuery( this ).is( ":disabled" ) && | ||
8304 | rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && | ||
8305 | ( this.checked || !rcheckableType.test( type ) ); | ||
8306 | } ) | ||
8307 | .map( function( i, elem ) { | ||
8308 | var val = jQuery( this ).val(); | ||
8309 | |||
8310 | return val == null ? | ||
8311 | null : | ||
8312 | jQuery.isArray( val ) ? | ||
8313 | jQuery.map( val, function( val ) { | ||
8314 | return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
8315 | } ) : | ||
8316 | { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
8317 | } ).get(); | ||
8318 | } | ||
8319 | } ); | ||
8320 | |||
8321 | |||
8322 | var | ||
8323 | r20 = /%20/g, | ||
8324 | rhash = /#.*$/, | ||
8325 | rts = /([?&])_=[^&]*/, | ||
8326 | rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, | ||
8327 | |||
8328 | // #7653, #8125, #8152: local protocol detection | ||
8329 | rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | ||
8330 | rnoContent = /^(?:GET|HEAD)$/, | ||
8331 | rprotocol = /^\/\//, | ||
8332 | |||
8333 | /* Prefilters | ||
8334 | * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) | ||
8335 | * 2) These are called: | ||
8336 | * - BEFORE asking for a transport | ||
8337 | * - AFTER param serialization (s.data is a string if s.processData is true) | ||
8338 | * 3) key is the dataType | ||
8339 | * 4) the catchall symbol "*" can be used | ||
8340 | * 5) execution will start with transport dataType and THEN continue down to "*" if needed | ||
8341 | */ | ||
8342 | prefilters = {}, | ||
8343 | |||
8344 | /* Transports bindings | ||
8345 | * 1) key is the dataType | ||
8346 | * 2) the catchall symbol "*" can be used | ||
8347 | * 3) selection will start with transport dataType and THEN go to "*" if needed | ||
8348 | */ | ||
8349 | transports = {}, | ||
8350 | |||
8351 | // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression | ||
8352 | allTypes = "*/".concat( "*" ), | ||
8353 | |||
8354 | // Anchor tag for parsing the document origin | ||
8355 | originAnchor = document.createElement( "a" ); | ||
8356 | originAnchor.href = location.href; | ||
8357 | |||
8358 | // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport | ||
8359 | function addToPrefiltersOrTransports( structure ) { | ||
8360 | |||
8361 | // dataTypeExpression is optional and defaults to "*" | ||
8362 | return function( dataTypeExpression, func ) { | ||
8363 | |||
8364 | if ( typeof dataTypeExpression !== "string" ) { | ||
8365 | func = dataTypeExpression; | ||
8366 | dataTypeExpression = "*"; | ||
8367 | } | ||
8368 | |||
8369 | var dataType, | ||
8370 | i = 0, | ||
8371 | dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; | ||
8372 | |||
8373 | if ( jQuery.isFunction( func ) ) { | ||
8374 | |||
8375 | // For each dataType in the dataTypeExpression | ||
8376 | while ( ( dataType = dataTypes[ i++ ] ) ) { | ||
8377 | |||
8378 | // Prepend if requested | ||
8379 | if ( dataType[ 0 ] === "+" ) { | ||
8380 | dataType = dataType.slice( 1 ) || "*"; | ||
8381 | ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); | ||
8382 | |||
8383 | // Otherwise append | ||
8384 | } else { | ||
8385 | ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); | ||
8386 | } | ||
8387 | } | ||
8388 | } | ||
8389 | }; | ||
8390 | } | ||
8391 | |||
8392 | // Base inspection function for prefilters and transports | ||
8393 | function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { | ||
8394 | |||
8395 | var inspected = {}, | ||
8396 | seekingTransport = ( structure === transports ); | ||
8397 | |||
8398 | function inspect( dataType ) { | ||
8399 | var selected; | ||
8400 | inspected[ dataType ] = true; | ||
8401 | jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { | ||
8402 | var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); | ||
8403 | if ( typeof dataTypeOrTransport === "string" && | ||
8404 | !seekingTransport && !inspected[ dataTypeOrTransport ] ) { | ||
8405 | |||
8406 | options.dataTypes.unshift( dataTypeOrTransport ); | ||
8407 | inspect( dataTypeOrTransport ); | ||
8408 | return false; | ||
8409 | } else if ( seekingTransport ) { | ||
8410 | return !( selected = dataTypeOrTransport ); | ||
8411 | } | ||
8412 | } ); | ||
8413 | return selected; | ||
8414 | } | ||
8415 | |||
8416 | return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); | ||
8417 | } | ||
8418 | |||
8419 | // A special extend for ajax options | ||
8420 | // that takes "flat" options (not to be deep extended) | ||
8421 | // Fixes #9887 | ||
8422 | function ajaxExtend( target, src ) { | ||
8423 | var key, deep, | ||
8424 | flatOptions = jQuery.ajaxSettings.flatOptions || {}; | ||
8425 | |||
8426 | for ( key in src ) { | ||
8427 | if ( src[ key ] !== undefined ) { | ||
8428 | ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; | ||
8429 | } | ||
8430 | } | ||
8431 | if ( deep ) { | ||
8432 | jQuery.extend( true, target, deep ); | ||
8433 | } | ||
8434 | |||
8435 | return target; | ||
8436 | } | ||
8437 | |||
8438 | /* Handles responses to an ajax request: | ||
8439 | * - finds the right dataType (mediates between content-type and expected dataType) | ||
8440 | * - returns the corresponding response | ||
8441 | */ | ||
8442 | function ajaxHandleResponses( s, jqXHR, responses ) { | ||
8443 | |||
8444 | var ct, type, finalDataType, firstDataType, | ||
8445 | contents = s.contents, | ||
8446 | dataTypes = s.dataTypes; | ||
8447 | |||
8448 | // Remove auto dataType and get content-type in the process | ||
8449 | while ( dataTypes[ 0 ] === "*" ) { | ||
8450 | dataTypes.shift(); | ||
8451 | if ( ct === undefined ) { | ||
8452 | ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); | ||
8453 | } | ||
8454 | } | ||
8455 | |||
8456 | // Check if we're dealing with a known content-type | ||
8457 | if ( ct ) { | ||
8458 | for ( type in contents ) { | ||
8459 | if ( contents[ type ] && contents[ type ].test( ct ) ) { | ||
8460 | dataTypes.unshift( type ); | ||
8461 | break; | ||
8462 | } | ||
8463 | } | ||
8464 | } | ||
8465 | |||
8466 | // Check to see if we have a response for the expected dataType | ||
8467 | if ( dataTypes[ 0 ] in responses ) { | ||
8468 | finalDataType = dataTypes[ 0 ]; | ||
8469 | } else { | ||
8470 | |||
8471 | // Try convertible dataTypes | ||
8472 | for ( type in responses ) { | ||
8473 | if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { | ||
8474 | finalDataType = type; | ||
8475 | break; | ||
8476 | } | ||
8477 | if ( !firstDataType ) { | ||
8478 | firstDataType = type; | ||
8479 | } | ||
8480 | } | ||
8481 | |||
8482 | // Or just use first one | ||
8483 | finalDataType = finalDataType || firstDataType; | ||
8484 | } | ||
8485 | |||
8486 | // If we found a dataType | ||
8487 | // We add the dataType to the list if needed | ||
8488 | // and return the corresponding response | ||
8489 | if ( finalDataType ) { | ||
8490 | if ( finalDataType !== dataTypes[ 0 ] ) { | ||
8491 | dataTypes.unshift( finalDataType ); | ||
8492 | } | ||
8493 | return responses[ finalDataType ]; | ||
8494 | } | ||
8495 | } | ||
8496 | |||
8497 | /* Chain conversions given the request and the original response | ||
8498 | * Also sets the responseXXX fields on the jqXHR instance | ||
8499 | */ | ||
8500 | function ajaxConvert( s, response, jqXHR, isSuccess ) { | ||
8501 | var conv2, current, conv, tmp, prev, | ||
8502 | converters = {}, | ||
8503 | |||
8504 | // Work with a copy of dataTypes in case we need to modify it for conversion | ||
8505 | dataTypes = s.dataTypes.slice(); | ||
8506 | |||
8507 | // Create converters map with lowercased keys | ||
8508 | if ( dataTypes[ 1 ] ) { | ||
8509 | for ( conv in s.converters ) { | ||
8510 | converters[ conv.toLowerCase() ] = s.converters[ conv ]; | ||
8511 | } | ||
8512 | } | ||
8513 | |||
8514 | current = dataTypes.shift(); | ||
8515 | |||
8516 | // Convert to each sequential dataType | ||
8517 | while ( current ) { | ||
8518 | |||
8519 | if ( s.responseFields[ current ] ) { | ||
8520 | jqXHR[ s.responseFields[ current ] ] = response; | ||
8521 | } | ||
8522 | |||
8523 | // Apply the dataFilter if provided | ||
8524 | if ( !prev && isSuccess && s.dataFilter ) { | ||
8525 | response = s.dataFilter( response, s.dataType ); | ||
8526 | } | ||
8527 | |||
8528 | prev = current; | ||
8529 | current = dataTypes.shift(); | ||
8530 | |||
8531 | if ( current ) { | ||
8532 | |||
8533 | // There's only work to do if current dataType is non-auto | ||
8534 | if ( current === "*" ) { | ||
8535 | |||
8536 | current = prev; | ||
8537 | |||
8538 | // Convert response if prev dataType is non-auto and differs from current | ||
8539 | } else if ( prev !== "*" && prev !== current ) { | ||
8540 | |||
8541 | // Seek a direct converter | ||
8542 | conv = converters[ prev + " " + current ] || converters[ "* " + current ]; | ||
8543 | |||
8544 | // If none found, seek a pair | ||
8545 | if ( !conv ) { | ||
8546 | for ( conv2 in converters ) { | ||
8547 | |||
8548 | // If conv2 outputs current | ||
8549 | tmp = conv2.split( " " ); | ||
8550 | if ( tmp[ 1 ] === current ) { | ||
8551 | |||
8552 | // If prev can be converted to accepted input | ||
8553 | conv = converters[ prev + " " + tmp[ 0 ] ] || | ||
8554 | converters[ "* " + tmp[ 0 ] ]; | ||
8555 | if ( conv ) { | ||
8556 | |||
8557 | // Condense equivalence converters | ||
8558 | if ( conv === true ) { | ||
8559 | conv = converters[ conv2 ]; | ||
8560 | |||
8561 | // Otherwise, insert the intermediate dataType | ||
8562 | } else if ( converters[ conv2 ] !== true ) { | ||
8563 | current = tmp[ 0 ]; | ||
8564 | dataTypes.unshift( tmp[ 1 ] ); | ||
8565 | } | ||
8566 | break; | ||
8567 | } | ||
8568 | } | ||
8569 | } | ||
8570 | } | ||
8571 | |||
8572 | // Apply converter (if not an equivalence) | ||
8573 | if ( conv !== true ) { | ||
8574 | |||
8575 | // Unless errors are allowed to bubble, catch and return them | ||
8576 | if ( conv && s.throws ) { | ||
8577 | response = conv( response ); | ||
8578 | } else { | ||
8579 | try { | ||
8580 | response = conv( response ); | ||
8581 | } catch ( e ) { | ||
8582 | return { | ||
8583 | state: "parsererror", | ||
8584 | error: conv ? e : "No conversion from " + prev + " to " + current | ||
8585 | }; | ||
8586 | } | ||
8587 | } | ||
8588 | } | ||
8589 | } | ||
8590 | } | ||
8591 | } | ||
8592 | |||
8593 | return { state: "success", data: response }; | ||
8594 | } | ||
8595 | |||
8596 | jQuery.extend( { | ||
8597 | |||
8598 | // Counter for holding the number of active queries | ||
8599 | active: 0, | ||
8600 | |||
8601 | // Last-Modified header cache for next request | ||
8602 | lastModified: {}, | ||
8603 | etag: {}, | ||
8604 | |||
8605 | ajaxSettings: { | ||
8606 | url: location.href, | ||
8607 | type: "GET", | ||
8608 | isLocal: rlocalProtocol.test( location.protocol ), | ||
8609 | global: true, | ||
8610 | processData: true, | ||
8611 | async: true, | ||
8612 | contentType: "application/x-www-form-urlencoded; charset=UTF-8", | ||
8613 | |||
8614 | /* | ||
8615 | timeout: 0, | ||
8616 | data: null, | ||
8617 | dataType: null, | ||
8618 | username: null, | ||
8619 | password: null, | ||
8620 | cache: null, | ||
8621 | throws: false, | ||
8622 | traditional: false, | ||
8623 | headers: {}, | ||
8624 | */ | ||
8625 | |||
8626 | accepts: { | ||
8627 | "*": allTypes, | ||
8628 | text: "text/plain", | ||
8629 | html: "text/html", | ||
8630 | xml: "application/xml, text/xml", | ||
8631 | json: "application/json, text/javascript" | ||
8632 | }, | ||
8633 | |||
8634 | contents: { | ||
8635 | xml: /\bxml\b/, | ||
8636 | html: /\bhtml/, | ||
8637 | json: /\bjson\b/ | ||
8638 | }, | ||
8639 | |||
8640 | responseFields: { | ||
8641 | xml: "responseXML", | ||
8642 | text: "responseText", | ||
8643 | json: "responseJSON" | ||
8644 | }, | ||
8645 | |||
8646 | // Data converters | ||
8647 | // Keys separate source (or catchall "*") and destination types with a single space | ||
8648 | converters: { | ||
8649 | |||
8650 | // Convert anything to text | ||
8651 | "* text": String, | ||
8652 | |||
8653 | // Text to html (true = no transformation) | ||
8654 | "text html": true, | ||
8655 | |||
8656 | // Evaluate text as a json expression | ||
8657 | "text json": JSON.parse, | ||
8658 | |||
8659 | // Parse text as xml | ||
8660 | "text xml": jQuery.parseXML | ||
8661 | }, | ||
8662 | |||
8663 | // For options that shouldn't be deep extended: | ||
8664 | // you can add your own custom options here if | ||
8665 | // and when you create one that shouldn't be | ||
8666 | // deep extended (see ajaxExtend) | ||
8667 | flatOptions: { | ||
8668 | url: true, | ||
8669 | context: true | ||
8670 | } | ||
8671 | }, | ||
8672 | |||
8673 | // Creates a full fledged settings object into target | ||
8674 | // with both ajaxSettings and settings fields. | ||
8675 | // If target is omitted, writes into ajaxSettings. | ||
8676 | ajaxSetup: function( target, settings ) { | ||
8677 | return settings ? | ||
8678 | |||
8679 | // Building a settings object | ||
8680 | ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : | ||
8681 | |||
8682 | // Extending ajaxSettings | ||
8683 | ajaxExtend( jQuery.ajaxSettings, target ); | ||
8684 | }, | ||
8685 | |||
8686 | ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), | ||
8687 | ajaxTransport: addToPrefiltersOrTransports( transports ), | ||
8688 | |||
8689 | // Main method | ||
8690 | ajax: function( url, options ) { | ||
8691 | |||
8692 | // If url is an object, simulate pre-1.5 signature | ||
8693 | if ( typeof url === "object" ) { | ||
8694 | options = url; | ||
8695 | url = undefined; | ||
8696 | } | ||
8697 | |||
8698 | // Force options to be an object | ||
8699 | options = options || {}; | ||
8700 | |||
8701 | var transport, | ||
8702 | |||
8703 | // URL without anti-cache param | ||
8704 | cacheURL, | ||
8705 | |||
8706 | // Response headers | ||
8707 | responseHeadersString, | ||
8708 | responseHeaders, | ||
8709 | |||
8710 | // timeout handle | ||
8711 | timeoutTimer, | ||
8712 | |||
8713 | // Url cleanup var | ||
8714 | urlAnchor, | ||
8715 | |||
8716 | // Request state (becomes false upon send and true upon completion) | ||
8717 | completed, | ||
8718 | |||
8719 | // To know if global events are to be dispatched | ||
8720 | fireGlobals, | ||
8721 | |||
8722 | // Loop variable | ||
8723 | i, | ||
8724 | |||
8725 | // uncached part of the url | ||
8726 | uncached, | ||
8727 | |||
8728 | // Create the final options object | ||
8729 | s = jQuery.ajaxSetup( {}, options ), | ||
8730 | |||
8731 | // Callbacks context | ||
8732 | callbackContext = s.context || s, | ||
8733 | |||
8734 | // Context for global events is callbackContext if it is a DOM node or jQuery collection | ||
8735 | globalEventContext = s.context && | ||
8736 | ( callbackContext.nodeType || callbackContext.jquery ) ? | ||
8737 | jQuery( callbackContext ) : | ||
8738 | jQuery.event, | ||
8739 | |||
8740 | // Deferreds | ||
8741 | deferred = jQuery.Deferred(), | ||
8742 | completeDeferred = jQuery.Callbacks( "once memory" ), | ||
8743 | |||
8744 | // Status-dependent callbacks | ||
8745 | statusCode = s.statusCode || {}, | ||
8746 | |||
8747 | // Headers (they are sent all at once) | ||
8748 | requestHeaders = {}, | ||
8749 | requestHeadersNames = {}, | ||
8750 | |||
8751 | // Default abort message | ||
8752 | strAbort = "canceled", | ||
8753 | |||
8754 | // Fake xhr | ||
8755 | jqXHR = { | ||
8756 | readyState: 0, | ||
8757 | |||
8758 | // Builds headers hashtable if needed | ||
8759 | getResponseHeader: function( key ) { | ||
8760 | var match; | ||
8761 | if ( completed ) { | ||
8762 | if ( !responseHeaders ) { | ||
8763 | responseHeaders = {}; | ||
8764 | while ( ( match = rheaders.exec( responseHeadersString ) ) ) { | ||
8765 | responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; | ||
8766 | } | ||
8767 | } | ||
8768 | match = responseHeaders[ key.toLowerCase() ]; | ||
8769 | } | ||
8770 | return match == null ? null : match; | ||
8771 | }, | ||
8772 | |||
8773 | // Raw string | ||
8774 | getAllResponseHeaders: function() { | ||
8775 | return completed ? responseHeadersString : null; | ||
8776 | }, | ||
8777 | |||
8778 | // Caches the header | ||
8779 | setRequestHeader: function( name, value ) { | ||
8780 | if ( completed == null ) { | ||
8781 | name = requestHeadersNames[ name.toLowerCase() ] = | ||
8782 | requestHeadersNames[ name.toLowerCase() ] || name; | ||
8783 | requestHeaders[ name ] = value; | ||
8784 | } | ||
8785 | return this; | ||
8786 | }, | ||
8787 | |||
8788 | // Overrides response content-type header | ||
8789 | overrideMimeType: function( type ) { | ||
8790 | if ( completed == null ) { | ||
8791 | s.mimeType = type; | ||
8792 | } | ||
8793 | return this; | ||
8794 | }, | ||
8795 | |||
8796 | // Status-dependent callbacks | ||
8797 | statusCode: function( map ) { | ||
8798 | var code; | ||
8799 | if ( map ) { | ||
8800 | if ( completed ) { | ||
8801 | |||
8802 | // Execute the appropriate callbacks | ||
8803 | jqXHR.always( map[ jqXHR.status ] ); | ||
8804 | } else { | ||
8805 | |||
8806 | // Lazy-add the new callbacks in a way that preserves old ones | ||
8807 | for ( code in map ) { | ||
8808 | statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; | ||
8809 | } | ||
8810 | } | ||
8811 | } | ||
8812 | return this; | ||
8813 | }, | ||
8814 | |||
8815 | // Cancel the request | ||
8816 | abort: function( statusText ) { | ||
8817 | var finalText = statusText || strAbort; | ||
8818 | if ( transport ) { | ||
8819 | transport.abort( finalText ); | ||
8820 | } | ||
8821 | done( 0, finalText ); | ||
8822 | return this; | ||
8823 | } | ||
8824 | }; | ||
8825 | |||
8826 | // Attach deferreds | ||
8827 | deferred.promise( jqXHR ); | ||
8828 | |||
8829 | // Add protocol if not provided (prefilters might expect it) | ||
8830 | // Handle falsy url in the settings object (#10093: consistency with old signature) | ||
8831 | // We also use the url parameter if available | ||
8832 | s.url = ( ( url || s.url || location.href ) + "" ) | ||
8833 | .replace( rprotocol, location.protocol + "//" ); | ||
8834 | |||
8835 | // Alias method option to type as per ticket #12004 | ||
8836 | s.type = options.method || options.type || s.method || s.type; | ||
8837 | |||
8838 | // Extract dataTypes list | ||
8839 | s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; | ||
8840 | |||
8841 | // A cross-domain request is in order when the origin doesn't match the current origin. | ||
8842 | if ( s.crossDomain == null ) { | ||
8843 | urlAnchor = document.createElement( "a" ); | ||
8844 | |||
8845 | // Support: IE <=8 - 11, Edge 12 - 13 | ||
8846 | // IE throws exception on accessing the href property if url is malformed, | ||
8847 | // e.g. http://example.com:80x/ | ||
8848 | try { | ||
8849 | urlAnchor.href = s.url; | ||
8850 | |||
8851 | // Support: IE <=8 - 11 only | ||
8852 | // Anchor's host property isn't correctly set when s.url is relative | ||
8853 | urlAnchor.href = urlAnchor.href; | ||
8854 | s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== | ||
8855 | urlAnchor.protocol + "//" + urlAnchor.host; | ||
8856 | } catch ( e ) { | ||
8857 | |||
8858 | // If there is an error parsing the URL, assume it is crossDomain, | ||
8859 | // it can be rejected by the transport if it is invalid | ||
8860 | s.crossDomain = true; | ||
8861 | } | ||
8862 | } | ||
8863 | |||
8864 | // Convert data if not already a string | ||
8865 | if ( s.data && s.processData && typeof s.data !== "string" ) { | ||
8866 | s.data = jQuery.param( s.data, s.traditional ); | ||
8867 | } | ||
8868 | |||
8869 | // Apply prefilters | ||
8870 | inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); | ||
8871 | |||
8872 | // If request was aborted inside a prefilter, stop there | ||
8873 | if ( completed ) { | ||
8874 | return jqXHR; | ||
8875 | } | ||
8876 | |||
8877 | // We can fire global events as of now if asked to | ||
8878 | // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) | ||
8879 | fireGlobals = jQuery.event && s.global; | ||
8880 | |||
8881 | // Watch for a new set of requests | ||
8882 | if ( fireGlobals && jQuery.active++ === 0 ) { | ||
8883 | jQuery.event.trigger( "ajaxStart" ); | ||
8884 | } | ||
8885 | |||
8886 | // Uppercase the type | ||
8887 | s.type = s.type.toUpperCase(); | ||
8888 | |||
8889 | // Determine if request has content | ||
8890 | s.hasContent = !rnoContent.test( s.type ); | ||
8891 | |||
8892 | // Save the URL in case we're toying with the If-Modified-Since | ||
8893 | // and/or If-None-Match header later on | ||
8894 | // Remove hash to simplify url manipulation | ||
8895 | cacheURL = s.url.replace( rhash, "" ); | ||
8896 | |||
8897 | // More options handling for requests with no content | ||
8898 | if ( !s.hasContent ) { | ||
8899 | |||
8900 | // Remember the hash so we can put it back | ||
8901 | uncached = s.url.slice( cacheURL.length ); | ||
8902 | |||
8903 | // If data is available, append data to url | ||
8904 | if ( s.data ) { | ||
8905 | cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; | ||
8906 | |||
8907 | // #9682: remove data so that it's not used in an eventual retry | ||
8908 | delete s.data; | ||
8909 | } | ||
8910 | |||
8911 | // Add anti-cache in uncached url if needed | ||
8912 | if ( s.cache === false ) { | ||
8913 | cacheURL = cacheURL.replace( rts, "" ); | ||
8914 | uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; | ||
8915 | } | ||
8916 | |||
8917 | // Put hash and anti-cache on the URL that will be requested (gh-1732) | ||
8918 | s.url = cacheURL + uncached; | ||
8919 | |||
8920 | // Change '%20' to '+' if this is encoded form body content (gh-2658) | ||
8921 | } else if ( s.data && s.processData && | ||
8922 | ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { | ||
8923 | s.data = s.data.replace( r20, "+" ); | ||
8924 | } | ||
8925 | |||
8926 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
8927 | if ( s.ifModified ) { | ||
8928 | if ( jQuery.lastModified[ cacheURL ] ) { | ||
8929 | jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); | ||
8930 | } | ||
8931 | if ( jQuery.etag[ cacheURL ] ) { | ||
8932 | jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); | ||
8933 | } | ||
8934 | } | ||
8935 | |||
8936 | // Set the correct header, if data is being sent | ||
8937 | if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { | ||
8938 | jqXHR.setRequestHeader( "Content-Type", s.contentType ); | ||
8939 | } | ||
8940 | |||
8941 | // Set the Accepts header for the server, depending on the dataType | ||
8942 | jqXHR.setRequestHeader( | ||
8943 | "Accept", | ||
8944 | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? | ||
8945 | s.accepts[ s.dataTypes[ 0 ] ] + | ||
8946 | ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : | ||
8947 | s.accepts[ "*" ] | ||
8948 | ); | ||
8949 | |||
8950 | // Check for headers option | ||
8951 | for ( i in s.headers ) { | ||
8952 | jqXHR.setRequestHeader( i, s.headers[ i ] ); | ||
8953 | } | ||
8954 | |||
8955 | // Allow custom headers/mimetypes and early abort | ||
8956 | if ( s.beforeSend && | ||
8957 | ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { | ||
8958 | |||
8959 | // Abort if not done already and return | ||
8960 | return jqXHR.abort(); | ||
8961 | } | ||
8962 | |||
8963 | // Aborting is no longer a cancellation | ||
8964 | strAbort = "abort"; | ||
8965 | |||
8966 | // Install callbacks on deferreds | ||
8967 | completeDeferred.add( s.complete ); | ||
8968 | jqXHR.done( s.success ); | ||
8969 | jqXHR.fail( s.error ); | ||
8970 | |||
8971 | // Get transport | ||
8972 | transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); | ||
8973 | |||
8974 | // If no transport, we auto-abort | ||
8975 | if ( !transport ) { | ||
8976 | done( -1, "No Transport" ); | ||
8977 | } else { | ||
8978 | jqXHR.readyState = 1; | ||
8979 | |||
8980 | // Send global event | ||
8981 | if ( fireGlobals ) { | ||
8982 | globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); | ||
8983 | } | ||
8984 | |||
8985 | // If request was aborted inside ajaxSend, stop there | ||
8986 | if ( completed ) { | ||
8987 | return jqXHR; | ||
8988 | } | ||
8989 | |||
8990 | // Timeout | ||
8991 | if ( s.async && s.timeout > 0 ) { | ||
8992 | timeoutTimer = window.setTimeout( function() { | ||
8993 | jqXHR.abort( "timeout" ); | ||
8994 | }, s.timeout ); | ||
8995 | } | ||
8996 | |||
8997 | try { | ||
8998 | completed = false; | ||
8999 | transport.send( requestHeaders, done ); | ||
9000 | } catch ( e ) { | ||
9001 | |||
9002 | // Rethrow post-completion exceptions | ||
9003 | if ( completed ) { | ||
9004 | throw e; | ||
9005 | } | ||
9006 | |||
9007 | // Propagate others as results | ||
9008 | done( -1, e ); | ||
9009 | } | ||
9010 | } | ||
9011 | |||
9012 | // Callback for when everything is done | ||
9013 | function done( status, nativeStatusText, responses, headers ) { | ||
9014 | var isSuccess, success, error, response, modified, | ||
9015 | statusText = nativeStatusText; | ||
9016 | |||
9017 | // Ignore repeat invocations | ||
9018 | if ( completed ) { | ||
9019 | return; | ||
9020 | } | ||
9021 | |||
9022 | completed = true; | ||
9023 | |||
9024 | // Clear timeout if it exists | ||
9025 | if ( timeoutTimer ) { | ||
9026 | window.clearTimeout( timeoutTimer ); | ||
9027 | } | ||
9028 | |||
9029 | // Dereference transport for early garbage collection | ||
9030 | // (no matter how long the jqXHR object will be used) | ||
9031 | transport = undefined; | ||
9032 | |||
9033 | // Cache response headers | ||
9034 | responseHeadersString = headers || ""; | ||
9035 | |||
9036 | // Set readyState | ||
9037 | jqXHR.readyState = status > 0 ? 4 : 0; | ||
9038 | |||
9039 | // Determine if successful | ||
9040 | isSuccess = status >= 200 && status < 300 || status === 304; | ||
9041 | |||
9042 | // Get response data | ||
9043 | if ( responses ) { | ||
9044 | response = ajaxHandleResponses( s, jqXHR, responses ); | ||
9045 | } | ||
9046 | |||
9047 | // Convert no matter what (that way responseXXX fields are always set) | ||
9048 | response = ajaxConvert( s, response, jqXHR, isSuccess ); | ||
9049 | |||
9050 | // If successful, handle type chaining | ||
9051 | if ( isSuccess ) { | ||
9052 | |||
9053 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
9054 | if ( s.ifModified ) { | ||
9055 | modified = jqXHR.getResponseHeader( "Last-Modified" ); | ||
9056 | if ( modified ) { | ||
9057 | jQuery.lastModified[ cacheURL ] = modified; | ||
9058 | } | ||
9059 | modified = jqXHR.getResponseHeader( "etag" ); | ||
9060 | if ( modified ) { | ||
9061 | jQuery.etag[ cacheURL ] = modified; | ||
9062 | } | ||
9063 | } | ||
9064 | |||
9065 | // if no content | ||
9066 | if ( status === 204 || s.type === "HEAD" ) { | ||
9067 | statusText = "nocontent"; | ||
9068 | |||
9069 | // if not modified | ||
9070 | } else if ( status === 304 ) { | ||
9071 | statusText = "notmodified"; | ||
9072 | |||
9073 | // If we have data, let's convert it | ||
9074 | } else { | ||
9075 | statusText = response.state; | ||
9076 | success = response.data; | ||
9077 | error = response.error; | ||
9078 | isSuccess = !error; | ||
9079 | } | ||
9080 | } else { | ||
9081 | |||
9082 | // Extract error from statusText and normalize for non-aborts | ||
9083 | error = statusText; | ||
9084 | if ( status || !statusText ) { | ||
9085 | statusText = "error"; | ||
9086 | if ( status < 0 ) { | ||
9087 | status = 0; | ||
9088 | } | ||
9089 | } | ||
9090 | } | ||
9091 | |||
9092 | // Set data for the fake xhr object | ||
9093 | jqXHR.status = status; | ||
9094 | jqXHR.statusText = ( nativeStatusText || statusText ) + ""; | ||
9095 | |||
9096 | // Success/Error | ||
9097 | if ( isSuccess ) { | ||
9098 | deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); | ||
9099 | } else { | ||
9100 | deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); | ||
9101 | } | ||
9102 | |||
9103 | // Status-dependent callbacks | ||
9104 | jqXHR.statusCode( statusCode ); | ||
9105 | statusCode = undefined; | ||
9106 | |||
9107 | if ( fireGlobals ) { | ||
9108 | globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", | ||
9109 | [ jqXHR, s, isSuccess ? success : error ] ); | ||
9110 | } | ||
9111 | |||
9112 | // Complete | ||
9113 | completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); | ||
9114 | |||
9115 | if ( fireGlobals ) { | ||
9116 | globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); | ||
9117 | |||
9118 | // Handle the global AJAX counter | ||
9119 | if ( !( --jQuery.active ) ) { | ||
9120 | jQuery.event.trigger( "ajaxStop" ); | ||
9121 | } | ||
9122 | } | ||
9123 | } | ||
9124 | |||
9125 | return jqXHR; | ||
9126 | }, | ||
9127 | |||
9128 | getJSON: function( url, data, callback ) { | ||
9129 | return jQuery.get( url, data, callback, "json" ); | ||
9130 | }, | ||
9131 | |||
9132 | getScript: function( url, callback ) { | ||
9133 | return jQuery.get( url, undefined, callback, "script" ); | ||
9134 | } | ||
9135 | } ); | ||
9136 | |||
9137 | jQuery.each( [ "get", "post" ], function( i, method ) { | ||
9138 | jQuery[ method ] = function( url, data, callback, type ) { | ||
9139 | |||
9140 | // Shift arguments if data argument was omitted | ||
9141 | if ( jQuery.isFunction( data ) ) { | ||
9142 | type = type || callback; | ||
9143 | callback = data; | ||
9144 | data = undefined; | ||
9145 | } | ||
9146 | |||
9147 | // The url can be an options object (which then must have .url) | ||
9148 | return jQuery.ajax( jQuery.extend( { | ||
9149 | url: url, | ||
9150 | type: method, | ||
9151 | dataType: type, | ||
9152 | data: data, | ||
9153 | success: callback | ||
9154 | }, jQuery.isPlainObject( url ) && url ) ); | ||
9155 | }; | ||
9156 | } ); | ||
9157 | |||
9158 | |||
9159 | jQuery._evalUrl = function( url ) { | ||
9160 | return jQuery.ajax( { | ||
9161 | url: url, | ||
9162 | |||
9163 | // Make this explicit, since user can override this through ajaxSetup (#11264) | ||
9164 | type: "GET", | ||
9165 | dataType: "script", | ||
9166 | cache: true, | ||
9167 | async: false, | ||
9168 | global: false, | ||
9169 | "throws": true | ||
9170 | } ); | ||
9171 | }; | ||
9172 | |||
9173 | |||
9174 | jQuery.fn.extend( { | ||
9175 | wrapAll: function( html ) { | ||
9176 | var wrap; | ||
9177 | |||
9178 | if ( this[ 0 ] ) { | ||
9179 | if ( jQuery.isFunction( html ) ) { | ||
9180 | html = html.call( this[ 0 ] ); | ||
9181 | } | ||
9182 | |||
9183 | // The elements to wrap the target around | ||
9184 | wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); | ||
9185 | |||
9186 | if ( this[ 0 ].parentNode ) { | ||
9187 | wrap.insertBefore( this[ 0 ] ); | ||
9188 | } | ||
9189 | |||
9190 | wrap.map( function() { | ||
9191 | var elem = this; | ||
9192 | |||
9193 | while ( elem.firstElementChild ) { | ||
9194 | elem = elem.firstElementChild; | ||
9195 | } | ||
9196 | |||
9197 | return elem; | ||
9198 | } ).append( this ); | ||
9199 | } | ||
9200 | |||
9201 | return this; | ||
9202 | }, | ||
9203 | |||
9204 | wrapInner: function( html ) { | ||
9205 | if ( jQuery.isFunction( html ) ) { | ||
9206 | return this.each( function( i ) { | ||
9207 | jQuery( this ).wrapInner( html.call( this, i ) ); | ||
9208 | } ); | ||
9209 | } | ||
9210 | |||
9211 | return this.each( function() { | ||
9212 | var self = jQuery( this ), | ||
9213 | contents = self.contents(); | ||
9214 | |||
9215 | if ( contents.length ) { | ||
9216 | contents.wrapAll( html ); | ||
9217 | |||
9218 | } else { | ||
9219 | self.append( html ); | ||
9220 | } | ||
9221 | } ); | ||
9222 | }, | ||
9223 | |||
9224 | wrap: function( html ) { | ||
9225 | var isFunction = jQuery.isFunction( html ); | ||
9226 | |||
9227 | return this.each( function( i ) { | ||
9228 | jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); | ||
9229 | } ); | ||
9230 | }, | ||
9231 | |||
9232 | unwrap: function( selector ) { | ||
9233 | this.parent( selector ).not( "body" ).each( function() { | ||
9234 | jQuery( this ).replaceWith( this.childNodes ); | ||
9235 | } ); | ||
9236 | return this; | ||
9237 | } | ||
9238 | } ); | ||
9239 | |||
9240 | |||
9241 | jQuery.expr.pseudos.hidden = function( elem ) { | ||
9242 | return !jQuery.expr.pseudos.visible( elem ); | ||
9243 | }; | ||
9244 | jQuery.expr.pseudos.visible = function( elem ) { | ||
9245 | return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); | ||
9246 | }; | ||
9247 | |||
9248 | |||
9249 | |||
9250 | |||
9251 | jQuery.ajaxSettings.xhr = function() { | ||
9252 | try { | ||
9253 | return new window.XMLHttpRequest(); | ||
9254 | } catch ( e ) {} | ||
9255 | }; | ||
9256 | |||
9257 | var xhrSuccessStatus = { | ||
9258 | |||
9259 | // File protocol always yields status code 0, assume 200 | ||
9260 | 0: 200, | ||
9261 | |||
9262 | // Support: IE <=9 only | ||
9263 | // #1450: sometimes IE returns 1223 when it should be 204 | ||
9264 | 1223: 204 | ||
9265 | }, | ||
9266 | xhrSupported = jQuery.ajaxSettings.xhr(); | ||
9267 | |||
9268 | support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); | ||
9269 | support.ajax = xhrSupported = !!xhrSupported; | ||
9270 | |||
9271 | jQuery.ajaxTransport( function( options ) { | ||
9272 | var callback, errorCallback; | ||
9273 | |||
9274 | // Cross domain only allowed if supported through XMLHttpRequest | ||
9275 | if ( support.cors || xhrSupported && !options.crossDomain ) { | ||
9276 | return { | ||
9277 | send: function( headers, complete ) { | ||
9278 | var i, | ||
9279 | xhr = options.xhr(); | ||
9280 | |||
9281 | xhr.open( | ||
9282 | options.type, | ||
9283 | options.url, | ||
9284 | options.async, | ||
9285 | options.username, | ||
9286 | options.password | ||
9287 | ); | ||
9288 | |||
9289 | // Apply custom fields if provided | ||
9290 | if ( options.xhrFields ) { | ||
9291 | for ( i in options.xhrFields ) { | ||
9292 | xhr[ i ] = options.xhrFields[ i ]; | ||
9293 | } | ||
9294 | } | ||
9295 | |||
9296 | // Override mime type if needed | ||
9297 | if ( options.mimeType && xhr.overrideMimeType ) { | ||
9298 | xhr.overrideMimeType( options.mimeType ); | ||
9299 | } | ||
9300 | |||
9301 | // X-Requested-With header | ||
9302 | // For cross-domain requests, seeing as conditions for a preflight are | ||
9303 | // akin to a jigsaw puzzle, we simply never set it to be sure. | ||
9304 | // (it can always be set on a per-request basis or even using ajaxSetup) | ||
9305 | // For same-domain requests, won't change header if already provided. | ||
9306 | if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { | ||
9307 | headers[ "X-Requested-With" ] = "XMLHttpRequest"; | ||
9308 | } | ||
9309 | |||
9310 | // Set headers | ||
9311 | for ( i in headers ) { | ||
9312 | xhr.setRequestHeader( i, headers[ i ] ); | ||
9313 | } | ||
9314 | |||
9315 | // Callback | ||
9316 | callback = function( type ) { | ||
9317 | return function() { | ||
9318 | if ( callback ) { | ||
9319 | callback = errorCallback = xhr.onload = | ||
9320 | xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; | ||
9321 | |||
9322 | if ( type === "abort" ) { | ||
9323 | xhr.abort(); | ||
9324 | } else if ( type === "error" ) { | ||
9325 | |||
9326 | // Support: IE <=9 only | ||
9327 | // On a manual native abort, IE9 throws | ||
9328 | // errors on any property access that is not readyState | ||
9329 | if ( typeof xhr.status !== "number" ) { | ||
9330 | complete( 0, "error" ); | ||
9331 | } else { | ||
9332 | complete( | ||
9333 | |||
9334 | // File: protocol always yields status 0; see #8605, #14207 | ||
9335 | xhr.status, | ||
9336 | xhr.statusText | ||
9337 | ); | ||
9338 | } | ||
9339 | } else { | ||
9340 | complete( | ||
9341 | xhrSuccessStatus[ xhr.status ] || xhr.status, | ||
9342 | xhr.statusText, | ||
9343 | |||
9344 | // Support: IE <=9 only | ||
9345 | // IE9 has no XHR2 but throws on binary (trac-11426) | ||
9346 | // For XHR2 non-text, let the caller handle it (gh-2498) | ||
9347 | ( xhr.responseType || "text" ) !== "text" || | ||
9348 | typeof xhr.responseText !== "string" ? | ||
9349 | { binary: xhr.response } : | ||
9350 | { text: xhr.responseText }, | ||
9351 | xhr.getAllResponseHeaders() | ||
9352 | ); | ||
9353 | } | ||
9354 | } | ||
9355 | }; | ||
9356 | }; | ||
9357 | |||
9358 | // Listen to events | ||
9359 | xhr.onload = callback(); | ||
9360 | errorCallback = xhr.onerror = callback( "error" ); | ||
9361 | |||
9362 | // Support: IE 9 only | ||
9363 | // Use onreadystatechange to replace onabort | ||
9364 | // to handle uncaught aborts | ||
9365 | if ( xhr.onabort !== undefined ) { | ||
9366 | xhr.onabort = errorCallback; | ||
9367 | } else { | ||
9368 | xhr.onreadystatechange = function() { | ||
9369 | |||
9370 | // Check readyState before timeout as it changes | ||
9371 | if ( xhr.readyState === 4 ) { | ||
9372 | |||
9373 | // Allow onerror to be called first, | ||
9374 | // but that will not handle a native abort | ||
9375 | // Also, save errorCallback to a variable | ||
9376 | // as xhr.onerror cannot be accessed | ||
9377 | window.setTimeout( function() { | ||
9378 | if ( callback ) { | ||
9379 | errorCallback(); | ||
9380 | } | ||
9381 | } ); | ||
9382 | } | ||
9383 | }; | ||
9384 | } | ||
9385 | |||
9386 | // Create the abort callback | ||
9387 | callback = callback( "abort" ); | ||
9388 | |||
9389 | try { | ||
9390 | |||
9391 | // Do send the request (this may raise an exception) | ||
9392 | xhr.send( options.hasContent && options.data || null ); | ||
9393 | } catch ( e ) { | ||
9394 | |||
9395 | // #14683: Only rethrow if this hasn't been notified as an error yet | ||
9396 | if ( callback ) { | ||
9397 | throw e; | ||
9398 | } | ||
9399 | } | ||
9400 | }, | ||
9401 | |||
9402 | abort: function() { | ||
9403 | if ( callback ) { | ||
9404 | callback(); | ||
9405 | } | ||
9406 | } | ||
9407 | }; | ||
9408 | } | ||
9409 | } ); | ||
9410 | |||
9411 | |||
9412 | |||
9413 | |||
9414 | // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) | ||
9415 | jQuery.ajaxPrefilter( function( s ) { | ||
9416 | if ( s.crossDomain ) { | ||
9417 | s.contents.script = false; | ||
9418 | } | ||
9419 | } ); | ||
9420 | |||
9421 | // Install script dataType | ||
9422 | jQuery.ajaxSetup( { | ||
9423 | accepts: { | ||
9424 | script: "text/javascript, application/javascript, " + | ||
9425 | "application/ecmascript, application/x-ecmascript" | ||
9426 | }, | ||
9427 | contents: { | ||
9428 | script: /\b(?:java|ecma)script\b/ | ||
9429 | }, | ||
9430 | converters: { | ||
9431 | "text script": function( text ) { | ||
9432 | jQuery.globalEval( text ); | ||
9433 | return text; | ||
9434 | } | ||
9435 | } | ||
9436 | } ); | ||
9437 | |||
9438 | // Handle cache's special case and crossDomain | ||
9439 | jQuery.ajaxPrefilter( "script", function( s ) { | ||
9440 | if ( s.cache === undefined ) { | ||
9441 | s.cache = false; | ||
9442 | } | ||
9443 | if ( s.crossDomain ) { | ||
9444 | s.type = "GET"; | ||
9445 | } | ||
9446 | } ); | ||
9447 | |||
9448 | // Bind script tag hack transport | ||
9449 | jQuery.ajaxTransport( "script", function( s ) { | ||
9450 | |||
9451 | // This transport only deals with cross domain requests | ||
9452 | if ( s.crossDomain ) { | ||
9453 | var script, callback; | ||
9454 | return { | ||
9455 | send: function( _, complete ) { | ||
9456 | script = jQuery( "<script>" ).prop( { | ||
9457 | charset: s.scriptCharset, | ||
9458 | src: s.url | ||
9459 | } ).on( | ||
9460 | "load error", | ||
9461 | callback = function( evt ) { | ||
9462 | script.remove(); | ||
9463 | callback = null; | ||
9464 | if ( evt ) { | ||
9465 | complete( evt.type === "error" ? 404 : 200, evt.type ); | ||
9466 | } | ||
9467 | } | ||
9468 | ); | ||
9469 | |||
9470 | // Use native DOM manipulation to avoid our domManip AJAX trickery | ||
9471 | document.head.appendChild( script[ 0 ] ); | ||
9472 | }, | ||
9473 | abort: function() { | ||
9474 | if ( callback ) { | ||
9475 | callback(); | ||
9476 | } | ||
9477 | } | ||
9478 | }; | ||
9479 | } | ||
9480 | } ); | ||
9481 | |||
9482 | |||
9483 | |||
9484 | |||
9485 | var oldCallbacks = [], | ||
9486 | rjsonp = /(=)\?(?=&|$)|\?\?/; | ||
9487 | |||
9488 | // Default jsonp settings | ||
9489 | jQuery.ajaxSetup( { | ||
9490 | jsonp: "callback", | ||
9491 | jsonpCallback: function() { | ||
9492 | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); | ||
9493 | this[ callback ] = true; | ||
9494 | return callback; | ||
9495 | } | ||
9496 | } ); | ||
9497 | |||
9498 | // Detect, normalize options and install callbacks for jsonp requests | ||
9499 | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { | ||
9500 | |||
9501 | var callbackName, overwritten, responseContainer, | ||
9502 | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? | ||
9503 | "url" : | ||
9504 | typeof s.data === "string" && | ||
9505 | ( s.contentType || "" ) | ||
9506 | .indexOf( "application/x-www-form-urlencoded" ) === 0 && | ||
9507 | rjsonp.test( s.data ) && "data" | ||
9508 | ); | ||
9509 | |||
9510 | // Handle iff the expected data type is "jsonp" or we have a parameter to set | ||
9511 | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { | ||
9512 | |||
9513 | // Get callback name, remembering preexisting value associated with it | ||
9514 | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? | ||
9515 | s.jsonpCallback() : | ||
9516 | s.jsonpCallback; | ||
9517 | |||
9518 | // Insert callback into url or form data | ||
9519 | if ( jsonProp ) { | ||
9520 | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); | ||
9521 | } else if ( s.jsonp !== false ) { | ||
9522 | s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; | ||
9523 | } | ||
9524 | |||
9525 | // Use data converter to retrieve json after script execution | ||
9526 | s.converters[ "script json" ] = function() { | ||
9527 | if ( !responseContainer ) { | ||
9528 | jQuery.error( callbackName + " was not called" ); | ||
9529 | } | ||
9530 | return responseContainer[ 0 ]; | ||
9531 | }; | ||
9532 | |||
9533 | // Force json dataType | ||
9534 | s.dataTypes[ 0 ] = "json"; | ||
9535 | |||
9536 | // Install callback | ||
9537 | overwritten = window[ callbackName ]; | ||
9538 | window[ callbackName ] = function() { | ||
9539 | responseContainer = arguments; | ||
9540 | }; | ||
9541 | |||
9542 | // Clean-up function (fires after converters) | ||
9543 | jqXHR.always( function() { | ||
9544 | |||
9545 | // If previous value didn't exist - remove it | ||
9546 | if ( overwritten === undefined ) { | ||
9547 | jQuery( window ).removeProp( callbackName ); | ||
9548 | |||
9549 | // Otherwise restore preexisting value | ||
9550 | } else { | ||
9551 | window[ callbackName ] = overwritten; | ||
9552 | } | ||
9553 | |||
9554 | // Save back as free | ||
9555 | if ( s[ callbackName ] ) { | ||
9556 | |||
9557 | // Make sure that re-using the options doesn't screw things around | ||
9558 | s.jsonpCallback = originalSettings.jsonpCallback; | ||
9559 | |||
9560 | // Save the callback name for future use | ||
9561 | oldCallbacks.push( callbackName ); | ||
9562 | } | ||
9563 | |||
9564 | // Call if it was a function and we have a response | ||
9565 | if ( responseContainer && jQuery.isFunction( overwritten ) ) { | ||
9566 | overwritten( responseContainer[ 0 ] ); | ||
9567 | } | ||
9568 | |||
9569 | responseContainer = overwritten = undefined; | ||
9570 | } ); | ||
9571 | |||
9572 | // Delegate to script | ||
9573 | return "script"; | ||
9574 | } | ||
9575 | } ); | ||
9576 | |||
9577 | |||
9578 | |||
9579 | |||
9580 | // Support: Safari 8 only | ||
9581 | // In Safari 8 documents created via document.implementation.createHTMLDocument | ||
9582 | // collapse sibling forms: the second one becomes a child of the first one. | ||
9583 | // Because of that, this security measure has to be disabled in Safari 8. | ||
9584 | // https://bugs.webkit.org/show_bug.cgi?id=137337 | ||
9585 | support.createHTMLDocument = ( function() { | ||
9586 | var body = document.implementation.createHTMLDocument( "" ).body; | ||
9587 | body.innerHTML = "<form></form><form></form>"; | ||
9588 | return body.childNodes.length === 2; | ||
9589 | } )(); | ||
9590 | |||
9591 | |||
9592 | // Argument "data" should be string of html | ||
9593 | // context (optional): If specified, the fragment will be created in this context, | ||
9594 | // defaults to document | ||
9595 | // keepScripts (optional): If true, will include scripts passed in the html string | ||
9596 | jQuery.parseHTML = function( data, context, keepScripts ) { | ||
9597 | if ( typeof data !== "string" ) { | ||
9598 | return []; | ||
9599 | } | ||
9600 | if ( typeof context === "boolean" ) { | ||
9601 | keepScripts = context; | ||
9602 | context = false; | ||
9603 | } | ||
9604 | |||
9605 | var base, parsed, scripts; | ||
9606 | |||
9607 | if ( !context ) { | ||
9608 | |||
9609 | // Stop scripts or inline event handlers from being executed immediately | ||
9610 | // by using document.implementation | ||
9611 | if ( support.createHTMLDocument ) { | ||
9612 | context = document.implementation.createHTMLDocument( "" ); | ||
9613 | |||
9614 | // Set the base href for the created document | ||
9615 | // so any parsed elements with URLs | ||
9616 | // are based on the document's URL (gh-2965) | ||
9617 | base = context.createElement( "base" ); | ||
9618 | base.href = document.location.href; | ||
9619 | context.head.appendChild( base ); | ||
9620 | } else { | ||
9621 | context = document; | ||
9622 | } | ||
9623 | } | ||
9624 | |||
9625 | parsed = rsingleTag.exec( data ); | ||
9626 | scripts = !keepScripts && []; | ||
9627 | |||
9628 | // Single tag | ||
9629 | if ( parsed ) { | ||
9630 | return [ context.createElement( parsed[ 1 ] ) ]; | ||
9631 | } | ||
9632 | |||
9633 | parsed = buildFragment( [ data ], context, scripts ); | ||
9634 | |||
9635 | if ( scripts && scripts.length ) { | ||
9636 | jQuery( scripts ).remove(); | ||
9637 | } | ||
9638 | |||
9639 | return jQuery.merge( [], parsed.childNodes ); | ||
9640 | }; | ||
9641 | |||
9642 | |||
9643 | /** | ||
9644 | * Load a url into a page | ||
9645 | */ | ||
9646 | jQuery.fn.load = function( url, params, callback ) { | ||
9647 | var selector, type, response, | ||
9648 | self = this, | ||
9649 | off = url.indexOf( " " ); | ||
9650 | |||
9651 | if ( off > -1 ) { | ||
9652 | selector = jQuery.trim( url.slice( off ) ); | ||
9653 | url = url.slice( 0, off ); | ||
9654 | } | ||
9655 | |||
9656 | // If it's a function | ||
9657 | if ( jQuery.isFunction( params ) ) { | ||
9658 | |||
9659 | // We assume that it's the callback | ||
9660 | callback = params; | ||
9661 | params = undefined; | ||
9662 | |||
9663 | // Otherwise, build a param string | ||
9664 | } else if ( params && typeof params === "object" ) { | ||
9665 | type = "POST"; | ||
9666 | } | ||
9667 | |||
9668 | // If we have elements to modify, make the request | ||
9669 | if ( self.length > 0 ) { | ||
9670 | jQuery.ajax( { | ||
9671 | url: url, | ||
9672 | |||
9673 | // If "type" variable is undefined, then "GET" method will be used. | ||
9674 | // Make value of this field explicit since | ||
9675 | // user can override it through ajaxSetup method | ||
9676 | type: type || "GET", | ||
9677 | dataType: "html", | ||
9678 | data: params | ||
9679 | } ).done( function( responseText ) { | ||
9680 | |||
9681 | // Save response for use in complete callback | ||
9682 | response = arguments; | ||
9683 | |||
9684 | self.html( selector ? | ||
9685 | |||
9686 | // If a selector was specified, locate the right elements in a dummy div | ||
9687 | // Exclude scripts to avoid IE 'Permission Denied' errors | ||
9688 | jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : | ||
9689 | |||
9690 | // Otherwise use the full result | ||
9691 | responseText ); | ||
9692 | |||
9693 | // If the request succeeds, this function gets "data", "status", "jqXHR" | ||
9694 | // but they are ignored because response was set above. | ||
9695 | // If it fails, this function gets "jqXHR", "status", "error" | ||
9696 | } ).always( callback && function( jqXHR, status ) { | ||
9697 | self.each( function() { | ||
9698 | callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); | ||
9699 | } ); | ||
9700 | } ); | ||
9701 | } | ||
9702 | |||
9703 | return this; | ||
9704 | }; | ||
9705 | |||
9706 | |||
9707 | |||
9708 | |||
9709 | // Attach a bunch of functions for handling common AJAX events | ||
9710 | jQuery.each( [ | ||
9711 | "ajaxStart", | ||
9712 | "ajaxStop", | ||
9713 | "ajaxComplete", | ||
9714 | "ajaxError", | ||
9715 | "ajaxSuccess", | ||
9716 | "ajaxSend" | ||
9717 | ], function( i, type ) { | ||
9718 | jQuery.fn[ type ] = function( fn ) { | ||
9719 | return this.on( type, fn ); | ||
9720 | }; | ||
9721 | } ); | ||
9722 | |||
9723 | |||
9724 | |||
9725 | |||
9726 | jQuery.expr.pseudos.animated = function( elem ) { | ||
9727 | return jQuery.grep( jQuery.timers, function( fn ) { | ||
9728 | return elem === fn.elem; | ||
9729 | } ).length; | ||
9730 | }; | ||
9731 | |||
9732 | |||
9733 | |||
9734 | |||
9735 | /** | ||
9736 | * Gets a window from an element | ||
9737 | */ | ||
9738 | function getWindow( elem ) { | ||
9739 | return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; | ||
9740 | } | ||
9741 | |||
9742 | jQuery.offset = { | ||
9743 | setOffset: function( elem, options, i ) { | ||
9744 | var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, | ||
9745 | position = jQuery.css( elem, "position" ), | ||
9746 | curElem = jQuery( elem ), | ||
9747 | props = {}; | ||
9748 | |||
9749 | // Set position first, in-case top/left are set even on static elem | ||
9750 | if ( position === "static" ) { | ||
9751 | elem.style.position = "relative"; | ||
9752 | } | ||
9753 | |||
9754 | curOffset = curElem.offset(); | ||
9755 | curCSSTop = jQuery.css( elem, "top" ); | ||
9756 | curCSSLeft = jQuery.css( elem, "left" ); | ||
9757 | calculatePosition = ( position === "absolute" || position === "fixed" ) && | ||
9758 | ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; | ||
9759 | |||
9760 | // Need to be able to calculate position if either | ||
9761 | // top or left is auto and position is either absolute or fixed | ||
9762 | if ( calculatePosition ) { | ||
9763 | curPosition = curElem.position(); | ||
9764 | curTop = curPosition.top; | ||
9765 | curLeft = curPosition.left; | ||
9766 | |||
9767 | } else { | ||
9768 | curTop = parseFloat( curCSSTop ) || 0; | ||
9769 | curLeft = parseFloat( curCSSLeft ) || 0; | ||
9770 | } | ||
9771 | |||
9772 | if ( jQuery.isFunction( options ) ) { | ||
9773 | |||
9774 | // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) | ||
9775 | options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); | ||
9776 | } | ||
9777 | |||
9778 | if ( options.top != null ) { | ||
9779 | props.top = ( options.top - curOffset.top ) + curTop; | ||
9780 | } | ||
9781 | if ( options.left != null ) { | ||
9782 | props.left = ( options.left - curOffset.left ) + curLeft; | ||
9783 | } | ||
9784 | |||
9785 | if ( "using" in options ) { | ||
9786 | options.using.call( elem, props ); | ||
9787 | |||
9788 | } else { | ||
9789 | curElem.css( props ); | ||
9790 | } | ||
9791 | } | ||
9792 | }; | ||
9793 | |||
9794 | jQuery.fn.extend( { | ||
9795 | offset: function( options ) { | ||
9796 | |||
9797 | // Preserve chaining for setter | ||
9798 | if ( arguments.length ) { | ||
9799 | return options === undefined ? | ||
9800 | this : | ||
9801 | this.each( function( i ) { | ||
9802 | jQuery.offset.setOffset( this, options, i ); | ||
9803 | } ); | ||
9804 | } | ||
9805 | |||
9806 | var docElem, win, rect, doc, | ||
9807 | elem = this[ 0 ]; | ||
9808 | |||
9809 | if ( !elem ) { | ||
9810 | return; | ||
9811 | } | ||
9812 | |||
9813 | // Support: IE <=11 only | ||
9814 | // Running getBoundingClientRect on a | ||
9815 | // disconnected node in IE throws an error | ||
9816 | if ( !elem.getClientRects().length ) { | ||
9817 | return { top: 0, left: 0 }; | ||
9818 | } | ||
9819 | |||
9820 | rect = elem.getBoundingClientRect(); | ||
9821 | |||
9822 | // Make sure element is not hidden (display: none) | ||
9823 | if ( rect.width || rect.height ) { | ||
9824 | doc = elem.ownerDocument; | ||
9825 | win = getWindow( doc ); | ||
9826 | docElem = doc.documentElement; | ||
9827 | |||
9828 | return { | ||
9829 | top: rect.top + win.pageYOffset - docElem.clientTop, | ||
9830 | left: rect.left + win.pageXOffset - docElem.clientLeft | ||
9831 | }; | ||
9832 | } | ||
9833 | |||
9834 | // Return zeros for disconnected and hidden elements (gh-2310) | ||
9835 | return rect; | ||
9836 | }, | ||
9837 | |||
9838 | position: function() { | ||
9839 | if ( !this[ 0 ] ) { | ||
9840 | return; | ||
9841 | } | ||
9842 | |||
9843 | var offsetParent, offset, | ||
9844 | elem = this[ 0 ], | ||
9845 | parentOffset = { top: 0, left: 0 }; | ||
9846 | |||
9847 | // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, | ||
9848 | // because it is its only offset parent | ||
9849 | if ( jQuery.css( elem, "position" ) === "fixed" ) { | ||
9850 | |||
9851 | // Assume getBoundingClientRect is there when computed position is fixed | ||
9852 | offset = elem.getBoundingClientRect(); | ||
9853 | |||
9854 | } else { | ||
9855 | |||
9856 | // Get *real* offsetParent | ||
9857 | offsetParent = this.offsetParent(); | ||
9858 | |||
9859 | // Get correct offsets | ||
9860 | offset = this.offset(); | ||
9861 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { | ||
9862 | parentOffset = offsetParent.offset(); | ||
9863 | } | ||
9864 | |||
9865 | // Add offsetParent borders | ||
9866 | parentOffset = { | ||
9867 | top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ), | ||
9868 | left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) | ||
9869 | }; | ||
9870 | } | ||
9871 | |||
9872 | // Subtract parent offsets and element margins | ||
9873 | return { | ||
9874 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), | ||
9875 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) | ||
9876 | }; | ||
9877 | }, | ||
9878 | |||
9879 | // This method will return documentElement in the following cases: | ||
9880 | // 1) For the element inside the iframe without offsetParent, this method will return | ||
9881 | // documentElement of the parent window | ||
9882 | // 2) For the hidden or detached element | ||
9883 | // 3) For body or html element, i.e. in case of the html node - it will return itself | ||
9884 | // | ||
9885 | // but those exceptions were never presented as a real life use-cases | ||
9886 | // and might be considered as more preferable results. | ||
9887 | // | ||
9888 | // This logic, however, is not guaranteed and can change at any point in the future | ||
9889 | offsetParent: function() { | ||
9890 | return this.map( function() { | ||
9891 | var offsetParent = this.offsetParent; | ||
9892 | |||
9893 | while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { | ||
9894 | offsetParent = offsetParent.offsetParent; | ||
9895 | } | ||
9896 | |||
9897 | return offsetParent || documentElement; | ||
9898 | } ); | ||
9899 | } | ||
9900 | } ); | ||
9901 | |||
9902 | // Create scrollLeft and scrollTop methods | ||
9903 | jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { | ||
9904 | var top = "pageYOffset" === prop; | ||
9905 | |||
9906 | jQuery.fn[ method ] = function( val ) { | ||
9907 | return access( this, function( elem, method, val ) { | ||
9908 | var win = getWindow( elem ); | ||
9909 | |||
9910 | if ( val === undefined ) { | ||
9911 | return win ? win[ prop ] : elem[ method ]; | ||
9912 | } | ||
9913 | |||
9914 | if ( win ) { | ||
9915 | win.scrollTo( | ||
9916 | !top ? val : win.pageXOffset, | ||
9917 | top ? val : win.pageYOffset | ||
9918 | ); | ||
9919 | |||
9920 | } else { | ||
9921 | elem[ method ] = val; | ||
9922 | } | ||
9923 | }, method, val, arguments.length ); | ||
9924 | }; | ||
9925 | } ); | ||
9926 | |||
9927 | // Support: Safari <=7 - 9.1, Chrome <=37 - 49 | ||
9928 | // Add the top/left cssHooks using jQuery.fn.position | ||
9929 | // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 | ||
9930 | // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 | ||
9931 | // getComputedStyle returns percent when specified for top/left/bottom/right; | ||
9932 | // rather than make the css module depend on the offset module, just check for it here | ||
9933 | jQuery.each( [ "top", "left" ], function( i, prop ) { | ||
9934 | jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, | ||
9935 | function( elem, computed ) { | ||
9936 | if ( computed ) { | ||
9937 | computed = curCSS( elem, prop ); | ||
9938 | |||
9939 | // If curCSS returns percentage, fallback to offset | ||
9940 | return rnumnonpx.test( computed ) ? | ||
9941 | jQuery( elem ).position()[ prop ] + "px" : | ||
9942 | computed; | ||
9943 | } | ||
9944 | } | ||
9945 | ); | ||
9946 | } ); | ||
9947 | |||
9948 | |||
9949 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods | ||
9950 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { | ||
9951 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, | ||
9952 | function( defaultExtra, funcName ) { | ||
9953 | |||
9954 | // Margin is only for outerHeight, outerWidth | ||
9955 | jQuery.fn[ funcName ] = function( margin, value ) { | ||
9956 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), | ||
9957 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); | ||
9958 | |||
9959 | return access( this, function( elem, type, value ) { | ||
9960 | var doc; | ||
9961 | |||
9962 | if ( jQuery.isWindow( elem ) ) { | ||
9963 | |||
9964 | // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) | ||
9965 | return funcName.indexOf( "outer" ) === 0 ? | ||
9966 | elem[ "inner" + name ] : | ||
9967 | elem.document.documentElement[ "client" + name ]; | ||
9968 | } | ||
9969 | |||
9970 | // Get document width or height | ||
9971 | if ( elem.nodeType === 9 ) { | ||
9972 | doc = elem.documentElement; | ||
9973 | |||
9974 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], | ||
9975 | // whichever is greatest | ||
9976 | return Math.max( | ||
9977 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], | ||
9978 | elem.body[ "offset" + name ], doc[ "offset" + name ], | ||
9979 | doc[ "client" + name ] | ||
9980 | ); | ||
9981 | } | ||
9982 | |||
9983 | return value === undefined ? | ||
9984 | |||
9985 | // Get width or height on the element, requesting but not forcing parseFloat | ||
9986 | jQuery.css( elem, type, extra ) : | ||
9987 | |||
9988 | // Set width or height on the element | ||
9989 | jQuery.style( elem, type, value, extra ); | ||
9990 | }, type, chainable ? margin : undefined, chainable ); | ||
9991 | }; | ||
9992 | } ); | ||
9993 | } ); | ||
9994 | |||
9995 | |||
9996 | jQuery.fn.extend( { | ||
9997 | |||
9998 | bind: function( types, data, fn ) { | ||
9999 | return this.on( types, null, data, fn ); | ||
10000 | }, | ||
10001 | unbind: function( types, fn ) { | ||
10002 | return this.off( types, null, fn ); | ||
10003 | }, | ||
10004 | |||
10005 | delegate: function( selector, types, data, fn ) { | ||
10006 | return this.on( types, selector, data, fn ); | ||
10007 | }, | ||
10008 | undelegate: function( selector, types, fn ) { | ||
10009 | |||
10010 | // ( namespace ) or ( selector, types [, fn] ) | ||
10011 | return arguments.length === 1 ? | ||
10012 | this.off( selector, "**" ) : | ||
10013 | this.off( types, selector || "**", fn ); | ||
10014 | } | ||
10015 | } ); | ||
10016 | |||
10017 | jQuery.parseJSON = JSON.parse; | ||
10018 | |||
10019 | |||
10020 | |||
10021 | |||
10022 | // Register as a named AMD module, since jQuery can be concatenated with other | ||
10023 | // files that may use define, but not via a proper concatenation script that | ||
10024 | // understands anonymous AMD modules. A named AMD is safest and most robust | ||
10025 | // way to register. Lowercase jquery is used because AMD module names are | ||
10026 | // derived from file names, and jQuery is normally delivered in a lowercase | ||
10027 | // file name. Do this after creating the global so that if an AMD module wants | ||
10028 | // to call noConflict to hide this version of jQuery, it will work. | ||
10029 | |||
10030 | // Note that for maximum portability, libraries that are not jQuery should | ||
10031 | // declare themselves as anonymous modules, and avoid setting a global if an | ||
10032 | // AMD loader is present. jQuery is a special case. For more information, see | ||
10033 | // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon | ||
10034 | |||
10035 | if ( typeof define === "function" && define.amd ) { | ||
10036 | define( "jquery", [], function() { | ||
10037 | return jQuery; | ||
10038 | } ); | ||
10039 | } | ||
10040 | |||
10041 | |||
10042 | |||
10043 | |||
10044 | |||
10045 | var | ||
10046 | |||
10047 | // Map over jQuery in case of overwrite | ||
10048 | _jQuery = window.jQuery, | ||
10049 | |||
10050 | // Map over the $ in case of overwrite | ||
10051 | _$ = window.$; | ||
10052 | |||
10053 | jQuery.noConflict = function( deep ) { | ||
10054 | if ( window.$ === jQuery ) { | ||
10055 | window.$ = _$; | ||
10056 | } | ||
10057 | |||
10058 | if ( deep && window.jQuery === jQuery ) { | ||
10059 | window.jQuery = _jQuery; | ||
10060 | } | ||
10061 | |||
10062 | return jQuery; | ||
10063 | }; | ||
10064 | |||
10065 | // Expose jQuery and $ identifiers, even in AMD | ||
10066 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) | ||
10067 | // and CommonJS for browser emulators (#13566) | ||
10068 | if ( !noGlobal ) { | ||
10069 | window.jQuery = window.$ = jQuery; | ||
10070 | } | ||
10071 | |||
10072 | |||
10073 | return jQuery; | ||
10074 | } ); | ||
diff --git a/_static/jquery.js b/_static/jquery.js new file mode 100644 index 0000000..f6a6a99 --- /dev/null +++ b/_static/jquery.js | |||
@@ -0,0 +1,4 @@ | |||
1 | /*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ | ||
2 | !function(a,b){"use strict";"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){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.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||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;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;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=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=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(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 qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.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]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);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){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.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===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(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,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.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},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:V,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(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.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(_,aa).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("(^|"+K+")"+a+"("+K+"|$)"))&&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=ga.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(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},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,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(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:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).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:oa(!1),disabled:oa(!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 X.test(a.nodeName)},input:function(a){return W.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:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?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]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.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=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[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?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(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 va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(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?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(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}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.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(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.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(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0, | ||
3 | r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;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},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.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=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.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 V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.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=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var $=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,_=new RegExp("^(?:([+-])=|)("+$+")([a-z%]*)$","i"),aa=["Top","Right","Bottom","Left"],ba=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ca=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};function da(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&_.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ea={};function fa(a){var b,c=a.ownerDocument,d=a.nodeName,e=ea[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ea[d]=e,e)}function ga(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;c<h;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==va()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===va()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ta:ua,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:ua,isPropagationStopped:ua,isImmediatePropagationStopped:ua,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ta,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ta,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ta,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&qa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ra.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return wa(this,a,b,c,d)},one:function(a,b,c,d){return wa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(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=ua),this.each(function(){r.event.remove(this,a,c,b)})}});var xa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/<script|<style|<link/i,za=/checked\s*(?:[^=]|=\s*.checked.)/i,Aa=/^true\/(.*)/,Ba=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;l<i;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;d<e;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.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}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Ma(a,b,f),(d<0||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,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":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)})},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=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):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function eb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ba(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],$a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ga([a],!0),j=a.style.display||j,k=r.css(a,"display"),ga([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ga([a],!0),m.done(function(){p||ga([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=db(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function fb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.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 gb(a,b,c){var d,e,f=0,g=gb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||bb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Ya||bb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.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;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(fb(k,j.opts.specialEasing);f<g;f++)if(d=gb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,db,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.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)}r.Animation=r.extend(gb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return da(c.elem,a,_.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],gb.tweeners[c]=gb.tweeners[c]||[],gb.tweeners[c].unshift(b)},prefilters:[eb],prefilter:function(a,b){b?gb.prefilters.unshift(a):gb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:e.duration="number"==typeof e.duration?e.duration:e.duration in r.fx.speeds?r.fx.speeds[e.duration]:r.fx.speeds._default,null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ba).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=gb(this,r.extend({},a),f);(e||V.get(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=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&_a.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||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.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;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(cb(b,!0),a,d,e)}}),r.each({slideDown:cb("show"),slideUp:cb("hide"),slideToggle:cb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Ya=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Ya=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){Za||(Za=a.requestAnimationFrame?a.requestAnimationFrame(ab):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame(Za):a.clearInterval(Za),Za=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var hb,ib=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K); | ||
4 | if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.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=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i<h;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.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 Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(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}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=oa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=r.trim(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||pa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Na(o.pixelPosition,function(a,c){if(c)return c=Ma(a,b),Ka.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({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)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r}); | ||
diff --git a/_static/manifest.json b/_static/manifest.json new file mode 100644 index 0000000..013d4a6 --- /dev/null +++ b/_static/manifest.json | |||
@@ -0,0 +1,41 @@ | |||
1 | { | ||
2 | "name": "App", | ||
3 | "icons": [ | ||
4 | { | ||
5 | "src": "\/android-icon-36x36.png", | ||
6 | "sizes": "36x36", | ||
7 | "type": "image\/png", | ||
8 | "density": "0.75" | ||
9 | }, | ||
10 | { | ||
11 | "src": "\/android-icon-48x48.png", | ||
12 | "sizes": "48x48", | ||
13 | "type": "image\/png", | ||
14 | "density": "1.0" | ||
15 | }, | ||
16 | { | ||
17 | "src": "\/android-icon-72x72.png", | ||
18 | "sizes": "72x72", | ||
19 | "type": "image\/png", | ||
20 | "density": "1.5" | ||
21 | }, | ||
22 | { | ||
23 | "src": "\/android-icon-96x96.png", | ||
24 | "sizes": "96x96", | ||
25 | "type": "image\/png", | ||
26 | "density": "2.0" | ||
27 | }, | ||
28 | { | ||
29 | "src": "\/android-icon-144x144.png", | ||
30 | "sizes": "144x144", | ||
31 | "type": "image\/png", | ||
32 | "density": "3.0" | ||
33 | }, | ||
34 | { | ||
35 | "src": "\/android-icon-192x192.png", | ||
36 | "sizes": "192x192", | ||
37 | "type": "image\/png", | ||
38 | "density": "4.0" | ||
39 | } | ||
40 | ] | ||
41 | } \ No newline at end of file | ||
diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000..d96755f --- /dev/null +++ b/_static/minus.png | |||
Binary files differ | |||
diff --git a/_static/ms-icon-144x144.png b/_static/ms-icon-144x144.png new file mode 100644 index 0000000..faf8b3e --- /dev/null +++ b/_static/ms-icon-144x144.png | |||
Binary files differ | |||
diff --git a/_static/ms-icon-150x150.png b/_static/ms-icon-150x150.png new file mode 100644 index 0000000..055030f --- /dev/null +++ b/_static/ms-icon-150x150.png | |||
Binary files differ | |||
diff --git a/_static/ms-icon-310x310.png b/_static/ms-icon-310x310.png new file mode 100644 index 0000000..3f18751 --- /dev/null +++ b/_static/ms-icon-310x310.png | |||
Binary files differ | |||
diff --git a/_static/ms-icon-70x70.png b/_static/ms-icon-70x70.png new file mode 100644 index 0000000..442d226 --- /dev/null +++ b/_static/ms-icon-70x70.png | |||
Binary files differ | |||
diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 0000000..7107cec --- /dev/null +++ b/_static/plus.png | |||
Binary files differ | |||
diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 0000000..20c4814 --- /dev/null +++ b/_static/pygments.css | |||
@@ -0,0 +1,69 @@ | |||
1 | .highlight .hll { background-color: #ffffcc } | ||
2 | .highlight { background: #eeffcc; } | ||
3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ | ||
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ | ||
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ | ||
6 | .highlight .o { color: #666666 } /* Operator */ | ||
7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ | ||
8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ | ||
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */ | ||
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ | ||
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ | ||
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ | ||
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ | ||
14 | .highlight .ge { font-style: italic } /* Generic.Emph */ | ||
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */ | ||
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ | ||
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ | ||
18 | .highlight .go { color: #333333 } /* Generic.Output */ | ||
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ | ||
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */ | ||
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ | ||
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ | ||
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ | ||
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ | ||
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ | ||
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ | ||
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ | ||
28 | .highlight .kt { color: #902000 } /* Keyword.Type */ | ||
29 | .highlight .m { color: #208050 } /* Literal.Number */ | ||
30 | .highlight .s { color: #4070a0 } /* Literal.String */ | ||
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */ | ||
32 | .highlight .nb { color: #007020 } /* Name.Builtin */ | ||
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ | ||
34 | .highlight .no { color: #60add5 } /* Name.Constant */ | ||
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ | ||
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ | ||
37 | .highlight .ne { color: #007020 } /* Name.Exception */ | ||
38 | .highlight .nf { color: #06287e } /* Name.Function */ | ||
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ | ||
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ | ||
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ | ||
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ | ||
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ | ||
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ | ||
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ | ||
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ | ||
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ | ||
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ | ||
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ | ||
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ | ||
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ | ||
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ | ||
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ | ||
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ | ||
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ | ||
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ | ||
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ | ||
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ | ||
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ | ||
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ | ||
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ | ||
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ | ||
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ | ||
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ | ||
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ | ||
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ | ||
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ | ||
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ | ||
69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file | ||
diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 0000000..41b8336 --- /dev/null +++ b/_static/searchtools.js | |||
@@ -0,0 +1,761 @@ | |||
1 | /* | ||
2 | * searchtools.js_t | ||
3 | * ~~~~~~~~~~~~~~~~ | ||
4 | * | ||
5 | * Sphinx JavaScript utilities for the full-text search. | ||
6 | * | ||
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. | ||
8 | * :license: BSD, see LICENSE for details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | |||
13 | /* Non-minified version JS is _stemmer.js if file is provided */ | ||
14 | /** | ||
15 | * Porter Stemmer | ||
16 | */ | ||
17 | var Stemmer = function() { | ||
18 | |||
19 | var step2list = { | ||
20 | ational: 'ate', | ||
21 | tional: 'tion', | ||
22 | enci: 'ence', | ||
23 | anci: 'ance', | ||
24 | izer: 'ize', | ||
25 | bli: 'ble', | ||
26 | alli: 'al', | ||
27 | entli: 'ent', | ||
28 | eli: 'e', | ||
29 | ousli: 'ous', | ||
30 | ization: 'ize', | ||
31 | ation: 'ate', | ||
32 | ator: 'ate', | ||
33 | alism: 'al', | ||
34 | iveness: 'ive', | ||
35 | fulness: 'ful', | ||
36 | ousness: 'ous', | ||
37 | aliti: 'al', | ||
38 | iviti: 'ive', | ||
39 | biliti: 'ble', | ||
40 | logi: 'log' | ||
41 | }; | ||
42 | |||
43 | var step3list = { | ||
44 | icate: 'ic', | ||
45 | ative: '', | ||
46 | alize: 'al', | ||
47 | iciti: 'ic', | ||
48 | ical: 'ic', | ||
49 | ful: '', | ||
50 | ness: '' | ||
51 | }; | ||
52 | |||
53 | var c = "[^aeiou]"; // consonant | ||
54 | var v = "[aeiouy]"; // vowel | ||
55 | var C = c + "[^aeiouy]*"; // consonant sequence | ||
56 | var V = v + "[aeiou]*"; // vowel sequence | ||
57 | |||
58 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 | ||
59 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 | ||
60 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 | ||
61 | var s_v = "^(" + C + ")?" + v; // vowel in stem | ||
62 | |||
63 | this.stemWord = function (w) { | ||
64 | var stem; | ||
65 | var suffix; | ||
66 | var firstch; | ||
67 | var origword = w; | ||
68 | |||
69 | if (w.length < 3) | ||
70 | return w; | ||
71 | |||
72 | var re; | ||
73 | var re2; | ||
74 | var re3; | ||
75 | var re4; | ||
76 | |||
77 | firstch = w.substr(0,1); | ||
78 | if (firstch == "y") | ||
79 | w = firstch.toUpperCase() + w.substr(1); | ||
80 | |||
81 | // Step 1a | ||
82 | re = /^(.+?)(ss|i)es$/; | ||
83 | re2 = /^(.+?)([^s])s$/; | ||
84 | |||
85 | if (re.test(w)) | ||
86 | w = w.replace(re,"$1$2"); | ||
87 | else if (re2.test(w)) | ||
88 | w = w.replace(re2,"$1$2"); | ||
89 | |||
90 | // Step 1b | ||
91 | re = /^(.+?)eed$/; | ||
92 | re2 = /^(.+?)(ed|ing)$/; | ||
93 | if (re.test(w)) { | ||
94 | var fp = re.exec(w); | ||
95 | re = new RegExp(mgr0); | ||
96 | if (re.test(fp[1])) { | ||
97 | re = /.$/; | ||
98 | w = w.replace(re,""); | ||
99 | } | ||
100 | } | ||
101 | else if (re2.test(w)) { | ||
102 | var fp = re2.exec(w); | ||
103 | stem = fp[1]; | ||
104 | re2 = new RegExp(s_v); | ||
105 | if (re2.test(stem)) { | ||
106 | w = stem; | ||
107 | re2 = /(at|bl|iz)$/; | ||
108 | re3 = new RegExp("([^aeiouylsz])\\1$"); | ||
109 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); | ||
110 | if (re2.test(w)) | ||
111 | w = w + "e"; | ||
112 | else if (re3.test(w)) { | ||
113 | re = /.$/; | ||
114 | w = w.replace(re,""); | ||
115 | } | ||
116 | else if (re4.test(w)) | ||
117 | w = w + "e"; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | // Step 1c | ||
122 | re = /^(.+?)y$/; | ||
123 | if (re.test(w)) { | ||
124 | var fp = re.exec(w); | ||
125 | stem = fp[1]; | ||
126 | re = new RegExp(s_v); | ||
127 | if (re.test(stem)) | ||
128 | w = stem + "i"; | ||
129 | } | ||
130 | |||
131 | // Step 2 | ||
132 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; | ||
133 | if (re.test(w)) { | ||
134 | var fp = re.exec(w); | ||
135 | stem = fp[1]; | ||
136 | suffix = fp[2]; | ||
137 | re = new RegExp(mgr0); | ||
138 | if (re.test(stem)) | ||
139 | w = stem + step2list[suffix]; | ||
140 | } | ||
141 | |||
142 | // Step 3 | ||
143 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; | ||
144 | if (re.test(w)) { | ||
145 | var fp = re.exec(w); | ||
146 | stem = fp[1]; | ||
147 | suffix = fp[2]; | ||
148 | re = new RegExp(mgr0); | ||
149 | if (re.test(stem)) | ||
150 | w = stem + step3list[suffix]; | ||
151 | } | ||
152 | |||
153 | // Step 4 | ||
154 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; | ||
155 | re2 = /^(.+?)(s|t)(ion)$/; | ||
156 | if (re.test(w)) { | ||
157 | var fp = re.exec(w); | ||
158 | stem = fp[1]; | ||
159 | re = new RegExp(mgr1); | ||
160 | if (re.test(stem)) | ||
161 | w = stem; | ||
162 | } | ||
163 | else if (re2.test(w)) { | ||
164 | var fp = re2.exec(w); | ||
165 | stem = fp[1] + fp[2]; | ||
166 | re2 = new RegExp(mgr1); | ||
167 | if (re2.test(stem)) | ||
168 | w = stem; | ||
169 | } | ||
170 | |||
171 | // Step 5 | ||
172 | re = /^(.+?)e$/; | ||
173 | if (re.test(w)) { | ||
174 | var fp = re.exec(w); | ||
175 | stem = fp[1]; | ||
176 | re = new RegExp(mgr1); | ||
177 | re2 = new RegExp(meq1); | ||
178 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); | ||
179 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) | ||
180 | w = stem; | ||
181 | } | ||
182 | re = /ll$/; | ||
183 | re2 = new RegExp(mgr1); | ||
184 | if (re.test(w) && re2.test(w)) { | ||
185 | re = /.$/; | ||
186 | w = w.replace(re,""); | ||
187 | } | ||
188 | |||
189 | // and turn initial Y back to y | ||
190 | if (firstch == "y") | ||
191 | w = firstch.toLowerCase() + w.substr(1); | ||
192 | return w; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | |||
197 | |||
198 | /** | ||
199 | * Simple result scoring code. | ||
200 | */ | ||
201 | var Scorer = { | ||
202 | // Implement the following function to further tweak the score for each result | ||
203 | // The function takes a result array [filename, title, anchor, descr, score] | ||
204 | // and returns the new score. | ||
205 | /* | ||
206 | score: function(result) { | ||
207 | return result[4]; | ||
208 | }, | ||
209 | */ | ||
210 | |||
211 | // query matches the full name of an object | ||
212 | objNameMatch: 11, | ||
213 | // or matches in the last dotted part of the object name | ||
214 | objPartialMatch: 6, | ||
215 | // Additive scores depending on the priority of the object | ||
216 | objPrio: {0: 15, // used to be importantResults | ||
217 | 1: 5, // used to be objectResults | ||
218 | 2: -5}, // used to be unimportantResults | ||
219 | // Used when the priority is not in the mapping. | ||
220 | objPrioDefault: 0, | ||
221 | |||
222 | // query found in title | ||
223 | title: 15, | ||
224 | // query found in terms | ||
225 | term: 5 | ||
226 | }; | ||
227 | |||
228 | |||
229 | |||
230 | |||
231 | |||
232 | var splitChars = (function() { | ||
233 | var result = {}; | ||
234 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, | ||
235 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, | ||
236 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, | ||
237 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, | ||
238 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, | ||
239 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, | ||
240 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, | ||
241 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, | ||
242 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, | ||
243 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; | ||
244 | var i, j, start, end; | ||
245 | for (i = 0; i < singles.length; i++) { | ||
246 | result[singles[i]] = true; | ||
247 | } | ||
248 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], | ||
249 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], | ||
250 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], | ||
251 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], | ||
252 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], | ||
253 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], | ||
254 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], | ||
255 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], | ||
256 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], | ||
257 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], | ||
258 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], | ||
259 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], | ||
260 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], | ||
261 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], | ||
262 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], | ||
263 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], | ||
264 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], | ||
265 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], | ||
266 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], | ||
267 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], | ||
268 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], | ||
269 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], | ||
270 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], | ||
271 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], | ||
272 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], | ||
273 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], | ||
274 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], | ||
275 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], | ||
276 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], | ||
277 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], | ||
278 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], | ||
279 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], | ||
280 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], | ||
281 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], | ||
282 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], | ||
283 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], | ||
284 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], | ||
285 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], | ||
286 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], | ||
287 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], | ||
288 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], | ||
289 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], | ||
290 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], | ||
291 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], | ||
292 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], | ||
293 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], | ||
294 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], | ||
295 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], | ||
296 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; | ||
297 | for (i = 0; i < ranges.length; i++) { | ||
298 | start = ranges[i][0]; | ||
299 | end = ranges[i][1]; | ||
300 | for (j = start; j <= end; j++) { | ||
301 | result[j] = true; | ||
302 | } | ||
303 | } | ||
304 | return result; | ||
305 | })(); | ||
306 | |||
307 | function splitQuery(query) { | ||
308 | var result = []; | ||
309 | var start = -1; | ||
310 | for (var i = 0; i < query.length; i++) { | ||
311 | if (splitChars[query.charCodeAt(i)]) { | ||
312 | if (start !== -1) { | ||
313 | result.push(query.slice(start, i)); | ||
314 | start = -1; | ||
315 | } | ||
316 | } else if (start === -1) { | ||
317 | start = i; | ||
318 | } | ||
319 | } | ||
320 | if (start !== -1) { | ||
321 | result.push(query.slice(start)); | ||
322 | } | ||
323 | return result; | ||
324 | } | ||
325 | |||
326 | |||
327 | |||
328 | |||
329 | /** | ||
330 | * Search Module | ||
331 | */ | ||
332 | var Search = { | ||
333 | |||
334 | _index : null, | ||
335 | _queued_query : null, | ||
336 | _pulse_status : -1, | ||
337 | |||
338 | init : function() { | ||
339 | var params = $.getQueryParameters(); | ||
340 | if (params.q) { | ||
341 | var query = params.q[0]; | ||
342 | $('input[name="q"]')[0].value = query; | ||
343 | this.performSearch(query); | ||
344 | } | ||
345 | }, | ||
346 | |||
347 | loadIndex : function(url) { | ||
348 | $.ajax({type: "GET", url: url, data: null, | ||
349 | dataType: "script", cache: true, | ||
350 | complete: function(jqxhr, textstatus) { | ||
351 | if (textstatus != "success") { | ||
352 | document.getElementById("searchindexloader").src = url; | ||
353 | } | ||
354 | }}); | ||
355 | }, | ||
356 | |||
357 | setIndex : function(index) { | ||
358 | var q; | ||
359 | this._index = index; | ||
360 | if ((q = this._queued_query) !== null) { | ||
361 | this._queued_query = null; | ||
362 | Search.query(q); | ||
363 | } | ||
364 | }, | ||
365 | |||
366 | hasIndex : function() { | ||
367 | return this._index !== null; | ||
368 | }, | ||
369 | |||
370 | deferQuery : function(query) { | ||
371 | this._queued_query = query; | ||
372 | }, | ||
373 | |||
374 | stopPulse : function() { | ||
375 | this._pulse_status = 0; | ||
376 | }, | ||
377 | |||
378 | startPulse : function() { | ||
379 | if (this._pulse_status >= 0) | ||
380 | return; | ||
381 | function pulse() { | ||
382 | var i; | ||
383 | Search._pulse_status = (Search._pulse_status + 1) % 4; | ||
384 | var dotString = ''; | ||
385 | for (i = 0; i < Search._pulse_status; i++) | ||
386 | dotString += '.'; | ||
387 | Search.dots.text(dotString); | ||
388 | if (Search._pulse_status > -1) | ||
389 | window.setTimeout(pulse, 500); | ||
390 | } | ||
391 | pulse(); | ||
392 | }, | ||
393 | |||
394 | /** | ||
395 | * perform a search for something (or wait until index is loaded) | ||
396 | */ | ||
397 | performSearch : function(query) { | ||
398 | // create the required interface elements | ||
399 | this.out = $('#search-results'); | ||
400 | this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out); | ||
401 | this.dots = $('<span></span>').appendTo(this.title); | ||
402 | this.status = $('<p style="display: none"></p>').appendTo(this.out); | ||
403 | this.output = $('<ul class="search"/>').appendTo(this.out); | ||
404 | |||
405 | $('#search-progress').text(_('Preparing search...')); | ||
406 | this.startPulse(); | ||
407 | |||
408 | // index already loaded, the browser was quick! | ||
409 | if (this.hasIndex()) | ||
410 | this.query(query); | ||
411 | else | ||
412 | this.deferQuery(query); | ||
413 | }, | ||
414 | |||
415 | /** | ||
416 | * execute search (requires search index to be loaded) | ||
417 | */ | ||
418 | query : function(query) { | ||
419 | var i; | ||
420 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]; | ||
421 | |||
422 | // stem the searchterms and add them to the correct list | ||
423 | var stemmer = new Stemmer(); | ||
424 | var searchterms = []; | ||
425 | var excluded = []; | ||
426 | var hlterms = []; | ||
427 | var tmp = splitQuery(query); | ||
428 | var objectterms = []; | ||
429 | for (i = 0; i < tmp.length; i++) { | ||
430 | if (tmp[i] !== "") { | ||
431 | objectterms.push(tmp[i].toLowerCase()); | ||
432 | } | ||
433 | |||
434 | if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) || | ||
435 | tmp[i] === "") { | ||
436 | // skip this "word" | ||
437 | continue; | ||
438 | } | ||
439 | // stem the word | ||
440 | var word = stemmer.stemWord(tmp[i].toLowerCase()); | ||
441 | // prevent stemmer from cutting word smaller than two chars | ||
442 | if(word.length < 3 && tmp[i].length >= 3) { | ||
443 | word = tmp[i]; | ||
444 | } | ||
445 | var toAppend; | ||
446 | // select the correct list | ||
447 | if (word[0] == '-') { | ||
448 | toAppend = excluded; | ||
449 | word = word.substr(1); | ||
450 | } | ||
451 | else { | ||
452 | toAppend = searchterms; | ||
453 | hlterms.push(tmp[i].toLowerCase()); | ||
454 | } | ||
455 | // only add if not already in the list | ||
456 | if (!$u.contains(toAppend, word)) | ||
457 | toAppend.push(word); | ||
458 | } | ||
459 | var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" ")); | ||
460 | |||
461 | // console.debug('SEARCH: searching for:'); | ||
462 | // console.info('required: ', searchterms); | ||
463 | // console.info('excluded: ', excluded); | ||
464 | |||
465 | // prepare search | ||
466 | var terms = this._index.terms; | ||
467 | var titleterms = this._index.titleterms; | ||
468 | |||
469 | // array of [filename, title, anchor, descr, score] | ||
470 | var results = []; | ||
471 | $('#search-progress').empty(); | ||
472 | |||
473 | // lookup as object | ||
474 | for (i = 0; i < objectterms.length; i++) { | ||
475 | var others = [].concat(objectterms.slice(0, i), | ||
476 | objectterms.slice(i+1, objectterms.length)); | ||
477 | results = results.concat(this.performObjectSearch(objectterms[i], others)); | ||
478 | } | ||
479 | |||
480 | // lookup as search terms in fulltext | ||
481 | results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms)); | ||
482 | |||
483 | // let the scorer override scores with a custom scoring function | ||
484 | if (Scorer.score) { | ||
485 | for (i = 0; i < results.length; i++) | ||
486 | results[i][4] = Scorer.score(results[i]); | ||
487 | } | ||
488 | |||
489 | // now sort the results by score (in opposite order of appearance, since the | ||
490 | // display function below uses pop() to retrieve items) and then | ||
491 | // alphabetically | ||
492 | results.sort(function(a, b) { | ||
493 | var left = a[4]; | ||
494 | var right = b[4]; | ||
495 | if (left > right) { | ||
496 | return 1; | ||
497 | } else if (left < right) { | ||
498 | return -1; | ||
499 | } else { | ||
500 | // same score: sort alphabetically | ||
501 | left = a[1].toLowerCase(); | ||
502 | right = b[1].toLowerCase(); | ||
503 | return (left > right) ? -1 : ((left < right) ? 1 : 0); | ||
504 | } | ||
505 | }); | ||
506 | |||
507 | // for debugging | ||
508 | //Search.lastresults = results.slice(); // a copy | ||
509 | //console.info('search results:', Search.lastresults); | ||
510 | |||
511 | // print the results | ||
512 | var resultCount = results.length; | ||
513 | function displayNextItem() { | ||
514 | // results left, load the summary and display it | ||
515 | if (results.length) { | ||
516 | var item = results.pop(); | ||
517 | var listItem = $('<li style="display:none"></li>'); | ||
518 | if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') { | ||
519 | // dirhtml builder | ||
520 | var dirname = item[0] + '/'; | ||
521 | if (dirname.match(/\/index\/$/)) { | ||
522 | dirname = dirname.substring(0, dirname.length-6); | ||
523 | } else if (dirname == 'index/') { | ||
524 | dirname = ''; | ||
525 | } | ||
526 | listItem.append($('<a/>').attr('href', | ||
527 | DOCUMENTATION_OPTIONS.URL_ROOT + dirname + | ||
528 | highlightstring + item[2]).html(item[1])); | ||
529 | } else { | ||
530 | // normal html builders | ||
531 | listItem.append($('<a/>').attr('href', | ||
532 | item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX + | ||
533 | highlightstring + item[2]).html(item[1])); | ||
534 | } | ||
535 | if (item[3]) { | ||
536 | listItem.append($('<span> (' + item[3] + ')</span>')); | ||
537 | Search.output.append(listItem); | ||
538 | listItem.slideDown(5, function() { | ||
539 | displayNextItem(); | ||
540 | }); | ||
541 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { | ||
542 | var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX; | ||
543 | if (suffix === undefined) { | ||
544 | suffix = '.txt'; | ||
545 | } | ||
546 | $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix), | ||
547 | dataType: "text", | ||
548 | complete: function(jqxhr, textstatus) { | ||
549 | var data = jqxhr.responseText; | ||
550 | if (data !== '' && data !== undefined) { | ||
551 | listItem.append(Search.makeSearchSummary(data, searchterms, hlterms)); | ||
552 | } | ||
553 | Search.output.append(listItem); | ||
554 | listItem.slideDown(5, function() { | ||
555 | displayNextItem(); | ||
556 | }); | ||
557 | }}); | ||
558 | } else { | ||
559 | // no source available, just display title | ||
560 | Search.output.append(listItem); | ||
561 | listItem.slideDown(5, function() { | ||
562 | displayNextItem(); | ||
563 | }); | ||
564 | } | ||
565 | } | ||
566 | // search finished, update title and status message | ||
567 | else { | ||
568 | Search.stopPulse(); | ||
569 | Search.title.text(_('Search Results')); | ||
570 | if (!resultCount) | ||
571 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.')); | ||
572 | else | ||
573 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount)); | ||
574 | Search.status.fadeIn(500); | ||
575 | } | ||
576 | } | ||
577 | displayNextItem(); | ||
578 | }, | ||
579 | |||
580 | /** | ||
581 | * search for object names | ||
582 | */ | ||
583 | performObjectSearch : function(object, otherterms) { | ||
584 | var filenames = this._index.filenames; | ||
585 | var docnames = this._index.docnames; | ||
586 | var objects = this._index.objects; | ||
587 | var objnames = this._index.objnames; | ||
588 | var titles = this._index.titles; | ||
589 | |||
590 | var i; | ||
591 | var results = []; | ||
592 | |||
593 | for (var prefix in objects) { | ||
594 | for (var name in objects[prefix]) { | ||
595 | var fullname = (prefix ? prefix + '.' : '') + name; | ||
596 | if (fullname.toLowerCase().indexOf(object) > -1) { | ||
597 | var score = 0; | ||
598 | var parts = fullname.split('.'); | ||
599 | // check for different match types: exact matches of full name or | ||
600 | // "last name" (i.e. last dotted part) | ||
601 | if (fullname == object || parts[parts.length - 1] == object) { | ||
602 | score += Scorer.objNameMatch; | ||
603 | // matches in last name | ||
604 | } else if (parts[parts.length - 1].indexOf(object) > -1) { | ||
605 | score += Scorer.objPartialMatch; | ||
606 | } | ||
607 | var match = objects[prefix][name]; | ||
608 | var objname = objnames[match[1]][2]; | ||
609 | var title = titles[match[0]]; | ||
610 | // If more than one term searched for, we require other words to be | ||
611 | // found in the name/title/description | ||
612 | if (otherterms.length > 0) { | ||
613 | var haystack = (prefix + ' ' + name + ' ' + | ||
614 | objname + ' ' + title).toLowerCase(); | ||
615 | var allfound = true; | ||
616 | for (i = 0; i < otherterms.length; i++) { | ||
617 | if (haystack.indexOf(otherterms[i]) == -1) { | ||
618 | allfound = false; | ||
619 | break; | ||
620 | } | ||
621 | } | ||
622 | if (!allfound) { | ||
623 | continue; | ||
624 | } | ||
625 | } | ||
626 | var descr = objname + _(', in ') + title; | ||
627 | |||
628 | var anchor = match[3]; | ||
629 | if (anchor === '') | ||
630 | anchor = fullname; | ||
631 | else if (anchor == '-') | ||
632 | anchor = objnames[match[1]][1] + '-' + fullname; | ||
633 | // add custom score for some objects according to scorer | ||
634 | if (Scorer.objPrio.hasOwnProperty(match[2])) { | ||
635 | score += Scorer.objPrio[match[2]]; | ||
636 | } else { | ||
637 | score += Scorer.objPrioDefault; | ||
638 | } | ||
639 | results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]); | ||
640 | } | ||
641 | } | ||
642 | } | ||
643 | |||
644 | return results; | ||
645 | }, | ||
646 | |||
647 | /** | ||
648 | * search for full-text terms in the index | ||
649 | */ | ||
650 | performTermsSearch : function(searchterms, excluded, terms, titleterms) { | ||
651 | var docnames = this._index.docnames; | ||
652 | var filenames = this._index.filenames; | ||
653 | var titles = this._index.titles; | ||
654 | |||
655 | var i, j, file; | ||
656 | var fileMap = {}; | ||
657 | var scoreMap = {}; | ||
658 | var results = []; | ||
659 | |||
660 | // perform the search on the required terms | ||
661 | for (i = 0; i < searchterms.length; i++) { | ||
662 | var word = searchterms[i]; | ||
663 | var files = []; | ||
664 | var _o = [ | ||
665 | {files: terms[word], score: Scorer.term}, | ||
666 | {files: titleterms[word], score: Scorer.title} | ||
667 | ]; | ||
668 | |||
669 | // no match but word was a required one | ||
670 | if ($u.every(_o, function(o){return o.files === undefined;})) { | ||
671 | break; | ||
672 | } | ||
673 | // found search word in contents | ||
674 | $u.each(_o, function(o) { | ||
675 | var _files = o.files; | ||
676 | if (_files === undefined) | ||
677 | return | ||
678 | |||
679 | if (_files.length === undefined) | ||
680 | _files = [_files]; | ||
681 | files = files.concat(_files); | ||
682 | |||
683 | // set score for the word in each file to Scorer.term | ||
684 | for (j = 0; j < _files.length; j++) { | ||
685 | file = _files[j]; | ||
686 | if (!(file in scoreMap)) | ||
687 | scoreMap[file] = {} | ||
688 | scoreMap[file][word] = o.score; | ||
689 | } | ||
690 | }); | ||
691 | |||
692 | // create the mapping | ||
693 | for (j = 0; j < files.length; j++) { | ||
694 | file = files[j]; | ||
695 | if (file in fileMap) | ||
696 | fileMap[file].push(word); | ||
697 | else | ||
698 | fileMap[file] = [word]; | ||
699 | } | ||
700 | } | ||
701 | |||
702 | // now check if the files don't contain excluded terms | ||
703 | for (file in fileMap) { | ||
704 | var valid = true; | ||
705 | |||
706 | // check if all requirements are matched | ||
707 | if (fileMap[file].length != searchterms.length) | ||
708 | continue; | ||
709 | |||
710 | // ensure that none of the excluded terms is in the search result | ||
711 | for (i = 0; i < excluded.length; i++) { | ||
712 | if (terms[excluded[i]] == file || | ||
713 | titleterms[excluded[i]] == file || | ||
714 | $u.contains(terms[excluded[i]] || [], file) || | ||
715 | $u.contains(titleterms[excluded[i]] || [], file)) { | ||
716 | valid = false; | ||
717 | break; | ||
718 | } | ||
719 | } | ||
720 | |||
721 | // if we have still a valid result we can add it to the result list | ||
722 | if (valid) { | ||
723 | // select one (max) score for the file. | ||
724 | // for better ranking, we should calculate ranking by using words statistics like basic tf-idf... | ||
725 | var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]})); | ||
726 | results.push([docnames[file], titles[file], '', null, score, filenames[file]]); | ||
727 | } | ||
728 | } | ||
729 | return results; | ||
730 | }, | ||
731 | |||
732 | /** | ||
733 | * helper function to return a node containing the | ||
734 | * search summary for a given text. keywords is a list | ||
735 | * of stemmed words, hlwords is the list of normal, unstemmed | ||
736 | * words. the first one is used to find the occurrence, the | ||
737 | * latter for highlighting it. | ||
738 | */ | ||
739 | makeSearchSummary : function(text, keywords, hlwords) { | ||
740 | var textLower = text.toLowerCase(); | ||
741 | var start = 0; | ||
742 | $.each(keywords, function() { | ||
743 | var i = textLower.indexOf(this.toLowerCase()); | ||
744 | if (i > -1) | ||
745 | start = i; | ||
746 | }); | ||
747 | start = Math.max(start - 120, 0); | ||
748 | var excerpt = ((start > 0) ? '...' : '') + | ||
749 | $.trim(text.substr(start, 240)) + | ||
750 | ((start + 240 - text.length) ? '...' : ''); | ||
751 | var rv = $('<div class="context"></div>').text(excerpt); | ||
752 | $.each(hlwords, function() { | ||
753 | rv = rv.highlightText(this, 'highlighted'); | ||
754 | }); | ||
755 | return rv; | ||
756 | } | ||
757 | }; | ||
758 | |||
759 | $(document).ready(function() { | ||
760 | Search.init(); | ||
761 | }); \ No newline at end of file | ||
diff --git a/_static/underscore-1.3.1.js b/_static/underscore-1.3.1.js new file mode 100644 index 0000000..208d4cd --- /dev/null +++ b/_static/underscore-1.3.1.js | |||
@@ -0,0 +1,999 @@ | |||
1 | // Underscore.js 1.3.1 | ||
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. | ||
3 | // Underscore is freely distributable under the MIT license. | ||
4 | // Portions of Underscore are inspired or borrowed from Prototype, | ||
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. | ||
6 | // For all details and documentation: | ||
7 | // http://documentcloud.github.com/underscore | ||
8 | |||
9 | (function() { | ||
10 | |||
11 | // Baseline setup | ||
12 | // -------------- | ||
13 | |||
14 | // Establish the root object, `window` in the browser, or `global` on the server. | ||
15 | var root = this; | ||
16 | |||
17 | // Save the previous value of the `_` variable. | ||
18 | var previousUnderscore = root._; | ||
19 | |||
20 | // Establish the object that gets returned to break out of a loop iteration. | ||
21 | var breaker = {}; | ||
22 | |||
23 | // Save bytes in the minified (but not gzipped) version: | ||
24 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; | ||
25 | |||
26 | // Create quick reference variables for speed access to core prototypes. | ||
27 | var slice = ArrayProto.slice, | ||
28 | unshift = ArrayProto.unshift, | ||
29 | toString = ObjProto.toString, | ||
30 | hasOwnProperty = ObjProto.hasOwnProperty; | ||
31 | |||
32 | // All **ECMAScript 5** native function implementations that we hope to use | ||
33 | // are declared here. | ||
34 | var | ||
35 | nativeForEach = ArrayProto.forEach, | ||
36 | nativeMap = ArrayProto.map, | ||
37 | nativeReduce = ArrayProto.reduce, | ||
38 | nativeReduceRight = ArrayProto.reduceRight, | ||
39 | nativeFilter = ArrayProto.filter, | ||
40 | nativeEvery = ArrayProto.every, | ||
41 | nativeSome = ArrayProto.some, | ||
42 | nativeIndexOf = ArrayProto.indexOf, | ||
43 | nativeLastIndexOf = ArrayProto.lastIndexOf, | ||
44 | nativeIsArray = Array.isArray, | ||
45 | nativeKeys = Object.keys, | ||
46 | nativeBind = FuncProto.bind; | ||
47 | |||
48 | // Create a safe reference to the Underscore object for use below. | ||
49 | var _ = function(obj) { return new wrapper(obj); }; | ||
50 | |||
51 | // Export the Underscore object for **Node.js**, with | ||
52 | // backwards-compatibility for the old `require()` API. If we're in | ||
53 | // the browser, add `_` as a global object via a string identifier, | ||
54 | // for Closure Compiler "advanced" mode. | ||
55 | if (typeof exports !== 'undefined') { | ||
56 | if (typeof module !== 'undefined' && module.exports) { | ||
57 | exports = module.exports = _; | ||
58 | } | ||
59 | exports._ = _; | ||
60 | } else { | ||
61 | root['_'] = _; | ||
62 | } | ||
63 | |||
64 | // Current version. | ||
65 | _.VERSION = '1.3.1'; | ||
66 | |||
67 | // Collection Functions | ||
68 | // -------------------- | ||
69 | |||
70 | // The cornerstone, an `each` implementation, aka `forEach`. | ||
71 | // Handles objects with the built-in `forEach`, arrays, and raw objects. | ||
72 | // Delegates to **ECMAScript 5**'s native `forEach` if available. | ||
73 | var each = _.each = _.forEach = function(obj, iterator, context) { | ||
74 | if (obj == null) return; | ||
75 | if (nativeForEach && obj.forEach === nativeForEach) { | ||
76 | obj.forEach(iterator, context); | ||
77 | } else if (obj.length === +obj.length) { | ||
78 | for (var i = 0, l = obj.length; i < l; i++) { | ||
79 | if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; | ||
80 | } | ||
81 | } else { | ||
82 | for (var key in obj) { | ||
83 | if (_.has(obj, key)) { | ||
84 | if (iterator.call(context, obj[key], key, obj) === breaker) return; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | }; | ||
89 | |||
90 | // Return the results of applying the iterator to each element. | ||
91 | // Delegates to **ECMAScript 5**'s native `map` if available. | ||
92 | _.map = _.collect = function(obj, iterator, context) { | ||
93 | var results = []; | ||
94 | if (obj == null) return results; | ||
95 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); | ||
96 | each(obj, function(value, index, list) { | ||
97 | results[results.length] = iterator.call(context, value, index, list); | ||
98 | }); | ||
99 | if (obj.length === +obj.length) results.length = obj.length; | ||
100 | return results; | ||
101 | }; | ||
102 | |||
103 | // **Reduce** builds up a single result from a list of values, aka `inject`, | ||
104 | // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. | ||
105 | _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { | ||
106 | var initial = arguments.length > 2; | ||
107 | if (obj == null) obj = []; | ||
108 | if (nativeReduce && obj.reduce === nativeReduce) { | ||
109 | if (context) iterator = _.bind(iterator, context); | ||
110 | return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); | ||
111 | } | ||
112 | each(obj, function(value, index, list) { | ||
113 | if (!initial) { | ||
114 | memo = value; | ||
115 | initial = true; | ||
116 | } else { | ||
117 | memo = iterator.call(context, memo, value, index, list); | ||
118 | } | ||
119 | }); | ||
120 | if (!initial) throw new TypeError('Reduce of empty array with no initial value'); | ||
121 | return memo; | ||
122 | }; | ||
123 | |||
124 | // The right-associative version of reduce, also known as `foldr`. | ||
125 | // Delegates to **ECMAScript 5**'s native `reduceRight` if available. | ||
126 | _.reduceRight = _.foldr = function(obj, iterator, memo, context) { | ||
127 | var initial = arguments.length > 2; | ||
128 | if (obj == null) obj = []; | ||
129 | if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { | ||
130 | if (context) iterator = _.bind(iterator, context); | ||
131 | return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); | ||
132 | } | ||
133 | var reversed = _.toArray(obj).reverse(); | ||
134 | if (context && !initial) iterator = _.bind(iterator, context); | ||
135 | return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); | ||
136 | }; | ||
137 | |||
138 | // Return the first value which passes a truth test. Aliased as `detect`. | ||
139 | _.find = _.detect = function(obj, iterator, context) { | ||
140 | var result; | ||
141 | any(obj, function(value, index, list) { | ||
142 | if (iterator.call(context, value, index, list)) { | ||
143 | result = value; | ||
144 | return true; | ||
145 | } | ||
146 | }); | ||
147 | return result; | ||
148 | }; | ||
149 | |||
150 | // Return all the elements that pass a truth test. | ||
151 | // Delegates to **ECMAScript 5**'s native `filter` if available. | ||
152 | // Aliased as `select`. | ||
153 | _.filter = _.select = function(obj, iterator, context) { | ||
154 | var results = []; | ||
155 | if (obj == null) return results; | ||
156 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); | ||
157 | each(obj, function(value, index, list) { | ||
158 | if (iterator.call(context, value, index, list)) results[results.length] = value; | ||
159 | }); | ||
160 | return results; | ||
161 | }; | ||
162 | |||
163 | // Return all the elements for which a truth test fails. | ||
164 | _.reject = function(obj, iterator, context) { | ||
165 | var results = []; | ||
166 | if (obj == null) return results; | ||
167 | each(obj, function(value, index, list) { | ||
168 | if (!iterator.call(context, value, index, list)) results[results.length] = value; | ||
169 | }); | ||
170 | return results; | ||
171 | }; | ||
172 | |||
173 | // Determine whether all of the elements match a truth test. | ||
174 | // Delegates to **ECMAScript 5**'s native `every` if available. | ||
175 | // Aliased as `all`. | ||
176 | _.every = _.all = function(obj, iterator, context) { | ||
177 | var result = true; | ||
178 | if (obj == null) return result; | ||
179 | if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); | ||
180 | each(obj, function(value, index, list) { | ||
181 | if (!(result = result && iterator.call(context, value, index, list))) return breaker; | ||
182 | }); | ||
183 | return result; | ||
184 | }; | ||
185 | |||
186 | // Determine if at least one element in the object matches a truth test. | ||
187 | // Delegates to **ECMAScript 5**'s native `some` if available. | ||
188 | // Aliased as `any`. | ||
189 | var any = _.some = _.any = function(obj, iterator, context) { | ||
190 | iterator || (iterator = _.identity); | ||
191 | var result = false; | ||
192 | if (obj == null) return result; | ||
193 | if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); | ||
194 | each(obj, function(value, index, list) { | ||
195 | if (result || (result = iterator.call(context, value, index, list))) return breaker; | ||
196 | }); | ||
197 | return !!result; | ||
198 | }; | ||
199 | |||
200 | // Determine if a given value is included in the array or object using `===`. | ||
201 | // Aliased as `contains`. | ||
202 | _.include = _.contains = function(obj, target) { | ||
203 | var found = false; | ||
204 | if (obj == null) return found; | ||
205 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; | ||
206 | found = any(obj, function(value) { | ||
207 | return value === target; | ||
208 | }); | ||
209 | return found; | ||
210 | }; | ||
211 | |||
212 | // Invoke a method (with arguments) on every item in a collection. | ||
213 | _.invoke = function(obj, method) { | ||
214 | var args = slice.call(arguments, 2); | ||
215 | return _.map(obj, function(value) { | ||
216 | return (_.isFunction(method) ? method || value : value[method]).apply(value, args); | ||
217 | }); | ||
218 | }; | ||
219 | |||
220 | // Convenience version of a common use case of `map`: fetching a property. | ||
221 | _.pluck = function(obj, key) { | ||
222 | return _.map(obj, function(value){ return value[key]; }); | ||
223 | }; | ||
224 | |||
225 | // Return the maximum element or (element-based computation). | ||
226 | _.max = function(obj, iterator, context) { | ||
227 | if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj); | ||
228 | if (!iterator && _.isEmpty(obj)) return -Infinity; | ||
229 | var result = {computed : -Infinity}; | ||
230 | each(obj, function(value, index, list) { | ||
231 | var computed = iterator ? iterator.call(context, value, index, list) : value; | ||
232 | computed >= result.computed && (result = {value : value, computed : computed}); | ||
233 | }); | ||
234 | return result.value; | ||
235 | }; | ||
236 | |||
237 | // Return the minimum element (or element-based computation). | ||
238 | _.min = function(obj, iterator, context) { | ||
239 | if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj); | ||
240 | if (!iterator && _.isEmpty(obj)) return Infinity; | ||
241 | var result = {computed : Infinity}; | ||
242 | each(obj, function(value, index, list) { | ||
243 | var computed = iterator ? iterator.call(context, value, index, list) : value; | ||
244 | computed < result.computed && (result = {value : value, computed : computed}); | ||
245 | }); | ||
246 | return result.value; | ||
247 | }; | ||
248 | |||
249 | // Shuffle an array. | ||
250 | _.shuffle = function(obj) { | ||
251 | var shuffled = [], rand; | ||
252 | each(obj, function(value, index, list) { | ||
253 | if (index == 0) { | ||
254 | shuffled[0] = value; | ||
255 | } else { | ||
256 | rand = Math.floor(Math.random() * (index + 1)); | ||
257 | shuffled[index] = shuffled[rand]; | ||
258 | shuffled[rand] = value; | ||
259 | } | ||
260 | }); | ||
261 | return shuffled; | ||
262 | }; | ||
263 | |||
264 | // Sort the object's values by a criterion produced by an iterator. | ||
265 | _.sortBy = function(obj, iterator, context) { | ||
266 | return _.pluck(_.map(obj, function(value, index, list) { | ||
267 | return { | ||
268 | value : value, | ||
269 | criteria : iterator.call(context, value, index, list) | ||
270 | }; | ||
271 | }).sort(function(left, right) { | ||
272 | var a = left.criteria, b = right.criteria; | ||
273 | return a < b ? -1 : a > b ? 1 : 0; | ||
274 | }), 'value'); | ||
275 | }; | ||
276 | |||
277 | // Groups the object's values by a criterion. Pass either a string attribute | ||
278 | // to group by, or a function that returns the criterion. | ||
279 | _.groupBy = function(obj, val) { | ||
280 | var result = {}; | ||
281 | var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; | ||
282 | each(obj, function(value, index) { | ||
283 | var key = iterator(value, index); | ||
284 | (result[key] || (result[key] = [])).push(value); | ||
285 | }); | ||
286 | return result; | ||
287 | }; | ||
288 | |||
289 | // Use a comparator function to figure out at what index an object should | ||
290 | // be inserted so as to maintain order. Uses binary search. | ||
291 | _.sortedIndex = function(array, obj, iterator) { | ||
292 | iterator || (iterator = _.identity); | ||
293 | var low = 0, high = array.length; | ||
294 | while (low < high) { | ||
295 | var mid = (low + high) >> 1; | ||
296 | iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; | ||
297 | } | ||
298 | return low; | ||
299 | }; | ||
300 | |||
301 | // Safely convert anything iterable into a real, live array. | ||
302 | _.toArray = function(iterable) { | ||
303 | if (!iterable) return []; | ||
304 | if (iterable.toArray) return iterable.toArray(); | ||
305 | if (_.isArray(iterable)) return slice.call(iterable); | ||
306 | if (_.isArguments(iterable)) return slice.call(iterable); | ||
307 | return _.values(iterable); | ||
308 | }; | ||
309 | |||
310 | // Return the number of elements in an object. | ||
311 | _.size = function(obj) { | ||
312 | return _.toArray(obj).length; | ||
313 | }; | ||
314 | |||
315 | // Array Functions | ||
316 | // --------------- | ||
317 | |||
318 | // Get the first element of an array. Passing **n** will return the first N | ||
319 | // values in the array. Aliased as `head`. The **guard** check allows it to work | ||
320 | // with `_.map`. | ||
321 | _.first = _.head = function(array, n, guard) { | ||
322 | return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; | ||
323 | }; | ||
324 | |||
325 | // Returns everything but the last entry of the array. Especcialy useful on | ||
326 | // the arguments object. Passing **n** will return all the values in | ||
327 | // the array, excluding the last N. The **guard** check allows it to work with | ||
328 | // `_.map`. | ||
329 | _.initial = function(array, n, guard) { | ||
330 | return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); | ||
331 | }; | ||
332 | |||
333 | // Get the last element of an array. Passing **n** will return the last N | ||
334 | // values in the array. The **guard** check allows it to work with `_.map`. | ||
335 | _.last = function(array, n, guard) { | ||
336 | if ((n != null) && !guard) { | ||
337 | return slice.call(array, Math.max(array.length - n, 0)); | ||
338 | } else { | ||
339 | return array[array.length - 1]; | ||
340 | } | ||
341 | }; | ||
342 | |||
343 | // Returns everything but the first entry of the array. Aliased as `tail`. | ||
344 | // Especially useful on the arguments object. Passing an **index** will return | ||
345 | // the rest of the values in the array from that index onward. The **guard** | ||
346 | // check allows it to work with `_.map`. | ||
347 | _.rest = _.tail = function(array, index, guard) { | ||
348 | return slice.call(array, (index == null) || guard ? 1 : index); | ||
349 | }; | ||
350 | |||
351 | // Trim out all falsy values from an array. | ||
352 | _.compact = function(array) { | ||
353 | return _.filter(array, function(value){ return !!value; }); | ||
354 | }; | ||
355 | |||
356 | // Return a completely flattened version of an array. | ||
357 | _.flatten = function(array, shallow) { | ||
358 | return _.reduce(array, function(memo, value) { | ||
359 | if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value)); | ||
360 | memo[memo.length] = value; | ||
361 | return memo; | ||
362 | }, []); | ||
363 | }; | ||
364 | |||
365 | // Return a version of the array that does not contain the specified value(s). | ||
366 | _.without = function(array) { | ||
367 | return _.difference(array, slice.call(arguments, 1)); | ||
368 | }; | ||
369 | |||
370 | // Produce a duplicate-free version of the array. If the array has already | ||
371 | // been sorted, you have the option of using a faster algorithm. | ||
372 | // Aliased as `unique`. | ||
373 | _.uniq = _.unique = function(array, isSorted, iterator) { | ||
374 | var initial = iterator ? _.map(array, iterator) : array; | ||
375 | var result = []; | ||
376 | _.reduce(initial, function(memo, el, i) { | ||
377 | if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) { | ||
378 | memo[memo.length] = el; | ||
379 | result[result.length] = array[i]; | ||
380 | } | ||
381 | return memo; | ||
382 | }, []); | ||
383 | return result; | ||
384 | }; | ||
385 | |||
386 | // Produce an array that contains the union: each distinct element from all of | ||
387 | // the passed-in arrays. | ||
388 | _.union = function() { | ||
389 | return _.uniq(_.flatten(arguments, true)); | ||
390 | }; | ||
391 | |||
392 | // Produce an array that contains every item shared between all the | ||
393 | // passed-in arrays. (Aliased as "intersect" for back-compat.) | ||
394 | _.intersection = _.intersect = function(array) { | ||
395 | var rest = slice.call(arguments, 1); | ||
396 | return _.filter(_.uniq(array), function(item) { | ||
397 | return _.every(rest, function(other) { | ||
398 | return _.indexOf(other, item) >= 0; | ||
399 | }); | ||
400 | }); | ||
401 | }; | ||
402 | |||
403 | // Take the difference between one array and a number of other arrays. | ||
404 | // Only the elements present in just the first array will remain. | ||
405 | _.difference = function(array) { | ||
406 | var rest = _.flatten(slice.call(arguments, 1)); | ||
407 | return _.filter(array, function(value){ return !_.include(rest, value); }); | ||
408 | }; | ||
409 | |||
410 | // Zip together multiple lists into a single array -- elements that share | ||
411 | // an index go together. | ||
412 | _.zip = function() { | ||
413 | var args = slice.call(arguments); | ||
414 | var length = _.max(_.pluck(args, 'length')); | ||
415 | var results = new Array(length); | ||
416 | for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); | ||
417 | return results; | ||
418 | }; | ||
419 | |||
420 | // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), | ||
421 | // we need this function. Return the position of the first occurrence of an | ||
422 | // item in an array, or -1 if the item is not included in the array. | ||
423 | // Delegates to **ECMAScript 5**'s native `indexOf` if available. | ||
424 | // If the array is large and already in sort order, pass `true` | ||
425 | // for **isSorted** to use binary search. | ||
426 | _.indexOf = function(array, item, isSorted) { | ||
427 | if (array == null) return -1; | ||
428 | var i, l; | ||
429 | if (isSorted) { | ||
430 | i = _.sortedIndex(array, item); | ||
431 | return array[i] === item ? i : -1; | ||
432 | } | ||
433 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); | ||
434 | for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i; | ||
435 | return -1; | ||
436 | }; | ||
437 | |||
438 | // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. | ||
439 | _.lastIndexOf = function(array, item) { | ||
440 | if (array == null) return -1; | ||
441 | if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); | ||
442 | var i = array.length; | ||
443 | while (i--) if (i in array && array[i] === item) return i; | ||
444 | return -1; | ||
445 | }; | ||
446 | |||
447 | // Generate an integer Array containing an arithmetic progression. A port of | ||
448 | // the native Python `range()` function. See | ||
449 | // [the Python documentation](http://docs.python.org/library/functions.html#range). | ||
450 | _.range = function(start, stop, step) { | ||
451 | if (arguments.length <= 1) { | ||
452 | stop = start || 0; | ||
453 | start = 0; | ||
454 | } | ||
455 | step = arguments[2] || 1; | ||
456 | |||
457 | var len = Math.max(Math.ceil((stop - start) / step), 0); | ||
458 | var idx = 0; | ||
459 | var range = new Array(len); | ||
460 | |||
461 | while(idx < len) { | ||
462 | range[idx++] = start; | ||
463 | start += step; | ||
464 | } | ||
465 | |||
466 | return range; | ||
467 | }; | ||
468 | |||
469 | // Function (ahem) Functions | ||
470 | // ------------------ | ||
471 | |||
472 | // Reusable constructor function for prototype setting. | ||
473 | var ctor = function(){}; | ||
474 | |||
475 | // Create a function bound to a given object (assigning `this`, and arguments, | ||
476 | // optionally). Binding with arguments is also known as `curry`. | ||
477 | // Delegates to **ECMAScript 5**'s native `Function.bind` if available. | ||
478 | // We check for `func.bind` first, to fail fast when `func` is undefined. | ||
479 | _.bind = function bind(func, context) { | ||
480 | var bound, args; | ||
481 | if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); | ||
482 | if (!_.isFunction(func)) throw new TypeError; | ||
483 | args = slice.call(arguments, 2); | ||
484 | return bound = function() { | ||
485 | if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); | ||
486 | ctor.prototype = func.prototype; | ||
487 | var self = new ctor; | ||
488 | var result = func.apply(self, args.concat(slice.call(arguments))); | ||
489 | if (Object(result) === result) return result; | ||
490 | return self; | ||
491 | }; | ||
492 | }; | ||
493 | |||
494 | // Bind all of an object's methods to that object. Useful for ensuring that | ||
495 | // all callbacks defined on an object belong to it. | ||
496 | _.bindAll = function(obj) { | ||
497 | var funcs = slice.call(arguments, 1); | ||
498 | if (funcs.length == 0) funcs = _.functions(obj); | ||
499 | each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); | ||
500 | return obj; | ||
501 | }; | ||
502 | |||
503 | // Memoize an expensive function by storing its results. | ||
504 | _.memoize = function(func, hasher) { | ||
505 | var memo = {}; | ||
506 | hasher || (hasher = _.identity); | ||
507 | return function() { | ||
508 | var key = hasher.apply(this, arguments); | ||
509 | return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); | ||
510 | }; | ||
511 | }; | ||
512 | |||
513 | // Delays a function for the given number of milliseconds, and then calls | ||
514 | // it with the arguments supplied. | ||
515 | _.delay = function(func, wait) { | ||
516 | var args = slice.call(arguments, 2); | ||
517 | return setTimeout(function(){ return func.apply(func, args); }, wait); | ||
518 | }; | ||
519 | |||
520 | // Defers a function, scheduling it to run after the current call stack has | ||
521 | // cleared. | ||
522 | _.defer = function(func) { | ||
523 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); | ||
524 | }; | ||
525 | |||
526 | // Returns a function, that, when invoked, will only be triggered at most once | ||
527 | // during a given window of time. | ||
528 | _.throttle = function(func, wait) { | ||
529 | var context, args, timeout, throttling, more; | ||
530 | var whenDone = _.debounce(function(){ more = throttling = false; }, wait); | ||
531 | return function() { | ||
532 | context = this; args = arguments; | ||
533 | var later = function() { | ||
534 | timeout = null; | ||
535 | if (more) func.apply(context, args); | ||
536 | whenDone(); | ||
537 | }; | ||
538 | if (!timeout) timeout = setTimeout(later, wait); | ||
539 | if (throttling) { | ||
540 | more = true; | ||
541 | } else { | ||
542 | func.apply(context, args); | ||
543 | } | ||
544 | whenDone(); | ||
545 | throttling = true; | ||
546 | }; | ||
547 | }; | ||
548 | |||
549 | // Returns a function, that, as long as it continues to be invoked, will not | ||
550 | // be triggered. The function will be called after it stops being called for | ||
551 | // N milliseconds. | ||
552 | _.debounce = function(func, wait) { | ||
553 | var timeout; | ||
554 | return function() { | ||
555 | var context = this, args = arguments; | ||
556 | var later = function() { | ||
557 | timeout = null; | ||
558 | func.apply(context, args); | ||
559 | }; | ||
560 | clearTimeout(timeout); | ||
561 | timeout = setTimeout(later, wait); | ||
562 | }; | ||
563 | }; | ||
564 | |||
565 | // Returns a function that will be executed at most one time, no matter how | ||
566 | // often you call it. Useful for lazy initialization. | ||
567 | _.once = function(func) { | ||
568 | var ran = false, memo; | ||
569 | return function() { | ||
570 | if (ran) return memo; | ||
571 | ran = true; | ||
572 | return memo = func.apply(this, arguments); | ||
573 | }; | ||
574 | }; | ||
575 | |||
576 | // Returns the first function passed as an argument to the second, | ||
577 | // allowing you to adjust arguments, run code before and after, and | ||
578 | // conditionally execute the original function. | ||
579 | _.wrap = function(func, wrapper) { | ||
580 | return function() { | ||
581 | var args = [func].concat(slice.call(arguments, 0)); | ||
582 | return wrapper.apply(this, args); | ||
583 | }; | ||
584 | }; | ||
585 | |||
586 | // Returns a function that is the composition of a list of functions, each | ||
587 | // consuming the return value of the function that follows. | ||
588 | _.compose = function() { | ||
589 | var funcs = arguments; | ||
590 | return function() { | ||
591 | var args = arguments; | ||
592 | for (var i = funcs.length - 1; i >= 0; i--) { | ||
593 | args = [funcs[i].apply(this, args)]; | ||
594 | } | ||
595 | return args[0]; | ||
596 | }; | ||
597 | }; | ||
598 | |||
599 | // Returns a function that will only be executed after being called N times. | ||
600 | _.after = function(times, func) { | ||
601 | if (times <= 0) return func(); | ||
602 | return function() { | ||
603 | if (--times < 1) { return func.apply(this, arguments); } | ||
604 | }; | ||
605 | }; | ||
606 | |||
607 | // Object Functions | ||
608 | // ---------------- | ||
609 | |||
610 | // Retrieve the names of an object's properties. | ||
611 | // Delegates to **ECMAScript 5**'s native `Object.keys` | ||
612 | _.keys = nativeKeys || function(obj) { | ||
613 | if (obj !== Object(obj)) throw new TypeError('Invalid object'); | ||
614 | var keys = []; | ||
615 | for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; | ||
616 | return keys; | ||
617 | }; | ||
618 | |||
619 | // Retrieve the values of an object's properties. | ||
620 | _.values = function(obj) { | ||
621 | return _.map(obj, _.identity); | ||
622 | }; | ||
623 | |||
624 | // Return a sorted list of the function names available on the object. | ||
625 | // Aliased as `methods` | ||
626 | _.functions = _.methods = function(obj) { | ||
627 | var names = []; | ||
628 | for (var key in obj) { | ||
629 | if (_.isFunction(obj[key])) names.push(key); | ||
630 | } | ||
631 | return names.sort(); | ||
632 | }; | ||
633 | |||
634 | // Extend a given object with all the properties in passed-in object(s). | ||
635 | _.extend = function(obj) { | ||
636 | each(slice.call(arguments, 1), function(source) { | ||
637 | for (var prop in source) { | ||
638 | obj[prop] = source[prop]; | ||
639 | } | ||
640 | }); | ||
641 | return obj; | ||
642 | }; | ||
643 | |||
644 | // Fill in a given object with default properties. | ||
645 | _.defaults = function(obj) { | ||
646 | each(slice.call(arguments, 1), function(source) { | ||
647 | for (var prop in source) { | ||
648 | if (obj[prop] == null) obj[prop] = source[prop]; | ||
649 | } | ||
650 | }); | ||
651 | return obj; | ||
652 | }; | ||
653 | |||
654 | // Create a (shallow-cloned) duplicate of an object. | ||
655 | _.clone = function(obj) { | ||
656 | if (!_.isObject(obj)) return obj; | ||
657 | return _.isArray(obj) ? obj.slice() : _.extend({}, obj); | ||
658 | }; | ||
659 | |||
660 | // Invokes interceptor with the obj, and then returns obj. | ||
661 | // The primary purpose of this method is to "tap into" a method chain, in | ||
662 | // order to perform operations on intermediate results within the chain. | ||
663 | _.tap = function(obj, interceptor) { | ||
664 | interceptor(obj); | ||
665 | return obj; | ||
666 | }; | ||
667 | |||
668 | // Internal recursive comparison function. | ||
669 | function eq(a, b, stack) { | ||
670 | // Identical objects are equal. `0 === -0`, but they aren't identical. | ||
671 | // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. | ||
672 | if (a === b) return a !== 0 || 1 / a == 1 / b; | ||
673 | // A strict comparison is necessary because `null == undefined`. | ||
674 | if (a == null || b == null) return a === b; | ||
675 | // Unwrap any wrapped objects. | ||
676 | if (a._chain) a = a._wrapped; | ||
677 | if (b._chain) b = b._wrapped; | ||
678 | // Invoke a custom `isEqual` method if one is provided. | ||
679 | if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); | ||
680 | if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); | ||
681 | // Compare `[[Class]]` names. | ||
682 | var className = toString.call(a); | ||
683 | if (className != toString.call(b)) return false; | ||
684 | switch (className) { | ||
685 | // Strings, numbers, dates, and booleans are compared by value. | ||
686 | case '[object String]': | ||
687 | // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is | ||
688 | // equivalent to `new String("5")`. | ||
689 | return a == String(b); | ||
690 | case '[object Number]': | ||
691 | // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for | ||
692 | // other numeric values. | ||
693 | return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); | ||
694 | case '[object Date]': | ||
695 | case '[object Boolean]': | ||
696 | // Coerce dates and booleans to numeric primitive values. Dates are compared by their | ||
697 | // millisecond representations. Note that invalid dates with millisecond representations | ||
698 | // of `NaN` are not equivalent. | ||
699 | return +a == +b; | ||
700 | // RegExps are compared by their source patterns and flags. | ||
701 | case '[object RegExp]': | ||
702 | return a.source == b.source && | ||
703 | a.global == b.global && | ||
704 | a.multiline == b.multiline && | ||
705 | a.ignoreCase == b.ignoreCase; | ||
706 | } | ||
707 | if (typeof a != 'object' || typeof b != 'object') return false; | ||
708 | // Assume equality for cyclic structures. The algorithm for detecting cyclic | ||
709 | // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. | ||
710 | var length = stack.length; | ||
711 | while (length--) { | ||
712 | // Linear search. Performance is inversely proportional to the number of | ||
713 | // unique nested structures. | ||
714 | if (stack[length] == a) return true; | ||
715 | } | ||
716 | // Add the first object to the stack of traversed objects. | ||
717 | stack.push(a); | ||
718 | var size = 0, result = true; | ||
719 | // Recursively compare objects and arrays. | ||
720 | if (className == '[object Array]') { | ||
721 | // Compare array lengths to determine if a deep comparison is necessary. | ||
722 | size = a.length; | ||
723 | result = size == b.length; | ||
724 | if (result) { | ||
725 | // Deep compare the contents, ignoring non-numeric properties. | ||
726 | while (size--) { | ||
727 | // Ensure commutative equality for sparse arrays. | ||
728 | if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; | ||
729 | } | ||
730 | } | ||
731 | } else { | ||
732 | // Objects with different constructors are not equivalent. | ||
733 | if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; | ||
734 | // Deep compare objects. | ||
735 | for (var key in a) { | ||
736 | if (_.has(a, key)) { | ||
737 | // Count the expected number of properties. | ||
738 | size++; | ||
739 | // Deep compare each member. | ||
740 | if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; | ||
741 | } | ||
742 | } | ||
743 | // Ensure that both objects contain the same number of properties. | ||
744 | if (result) { | ||
745 | for (key in b) { | ||
746 | if (_.has(b, key) && !(size--)) break; | ||
747 | } | ||
748 | result = !size; | ||
749 | } | ||
750 | } | ||
751 | // Remove the first object from the stack of traversed objects. | ||
752 | stack.pop(); | ||
753 | return result; | ||
754 | } | ||
755 | |||
756 | // Perform a deep comparison to check if two objects are equal. | ||
757 | _.isEqual = function(a, b) { | ||
758 | return eq(a, b, []); | ||
759 | }; | ||
760 | |||
761 | // Is a given array, string, or object empty? | ||
762 | // An "empty" object has no enumerable own-properties. | ||
763 | _.isEmpty = function(obj) { | ||
764 | if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; | ||
765 | for (var key in obj) if (_.has(obj, key)) return false; | ||
766 | return true; | ||
767 | }; | ||
768 | |||
769 | // Is a given value a DOM element? | ||
770 | _.isElement = function(obj) { | ||
771 | return !!(obj && obj.nodeType == 1); | ||
772 | }; | ||
773 | |||
774 | // Is a given value an array? | ||
775 | // Delegates to ECMA5's native Array.isArray | ||
776 | _.isArray = nativeIsArray || function(obj) { | ||
777 | return toString.call(obj) == '[object Array]'; | ||
778 | }; | ||
779 | |||
780 | // Is a given variable an object? | ||
781 | _.isObject = function(obj) { | ||
782 | return obj === Object(obj); | ||
783 | }; | ||
784 | |||
785 | // Is a given variable an arguments object? | ||
786 | _.isArguments = function(obj) { | ||
787 | return toString.call(obj) == '[object Arguments]'; | ||
788 | }; | ||
789 | if (!_.isArguments(arguments)) { | ||
790 | _.isArguments = function(obj) { | ||
791 | return !!(obj && _.has(obj, 'callee')); | ||
792 | }; | ||
793 | } | ||
794 | |||
795 | // Is a given value a function? | ||
796 | _.isFunction = function(obj) { | ||
797 | return toString.call(obj) == '[object Function]'; | ||
798 | }; | ||
799 | |||
800 | // Is a given value a string? | ||
801 | _.isString = function(obj) { | ||
802 | return toString.call(obj) == '[object String]'; | ||
803 | }; | ||
804 | |||
805 | // Is a given value a number? | ||
806 | _.isNumber = function(obj) { | ||
807 | return toString.call(obj) == '[object Number]'; | ||
808 | }; | ||
809 | |||
810 | // Is the given value `NaN`? | ||
811 | _.isNaN = function(obj) { | ||
812 | // `NaN` is the only value for which `===` is not reflexive. | ||
813 | return obj !== obj; | ||
814 | }; | ||
815 | |||
816 | // Is a given value a boolean? | ||
817 | _.isBoolean = function(obj) { | ||
818 | return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; | ||
819 | }; | ||
820 | |||
821 | // Is a given value a date? | ||
822 | _.isDate = function(obj) { | ||
823 | return toString.call(obj) == '[object Date]'; | ||
824 | }; | ||
825 | |||
826 | // Is the given value a regular expression? | ||
827 | _.isRegExp = function(obj) { | ||
828 | return toString.call(obj) == '[object RegExp]'; | ||
829 | }; | ||
830 | |||
831 | // Is a given value equal to null? | ||
832 | _.isNull = function(obj) { | ||
833 | return obj === null; | ||
834 | }; | ||
835 | |||
836 | // Is a given variable undefined? | ||
837 | _.isUndefined = function(obj) { | ||
838 | return obj === void 0; | ||
839 | }; | ||
840 | |||
841 | // Has own property? | ||
842 | _.has = function(obj, key) { | ||
843 | return hasOwnProperty.call(obj, key); | ||
844 | }; | ||
845 | |||
846 | // Utility Functions | ||
847 | // ----------------- | ||
848 | |||
849 | // Run Underscore.js in *noConflict* mode, returning the `_` variable to its | ||
850 | // previous owner. Returns a reference to the Underscore object. | ||
851 | _.noConflict = function() { | ||
852 | root._ = previousUnderscore; | ||
853 | return this; | ||
854 | }; | ||
855 | |||
856 | // Keep the identity function around for default iterators. | ||
857 | _.identity = function(value) { | ||
858 | return value; | ||
859 | }; | ||
860 | |||
861 | // Run a function **n** times. | ||
862 | _.times = function (n, iterator, context) { | ||
863 | for (var i = 0; i < n; i++) iterator.call(context, i); | ||
864 | }; | ||
865 | |||
866 | // Escape a string for HTML interpolation. | ||
867 | _.escape = function(string) { | ||
868 | return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/'); | ||
869 | }; | ||
870 | |||
871 | // Add your own custom functions to the Underscore object, ensuring that | ||
872 | // they're correctly added to the OOP wrapper as well. | ||
873 | _.mixin = function(obj) { | ||
874 | each(_.functions(obj), function(name){ | ||
875 | addToWrapper(name, _[name] = obj[name]); | ||
876 | }); | ||
877 | }; | ||
878 | |||
879 | // Generate a unique integer id (unique within the entire client session). | ||
880 | // Useful for temporary DOM ids. | ||
881 | var idCounter = 0; | ||
882 | _.uniqueId = function(prefix) { | ||
883 | var id = idCounter++; | ||
884 | return prefix ? prefix + id : id; | ||
885 | }; | ||
886 | |||
887 | // By default, Underscore uses ERB-style template delimiters, change the | ||
888 | // following template settings to use alternative delimiters. | ||
889 | _.templateSettings = { | ||
890 | evaluate : /<%([\s\S]+?)%>/g, | ||
891 | interpolate : /<%=([\s\S]+?)%>/g, | ||
892 | escape : /<%-([\s\S]+?)%>/g | ||
893 | }; | ||
894 | |||
895 | // When customizing `templateSettings`, if you don't want to define an | ||
896 | // interpolation, evaluation or escaping regex, we need one that is | ||
897 | // guaranteed not to match. | ||
898 | var noMatch = /.^/; | ||
899 | |||
900 | // Within an interpolation, evaluation, or escaping, remove HTML escaping | ||
901 | // that had been previously added. | ||
902 | var unescape = function(code) { | ||
903 | return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'"); | ||
904 | }; | ||
905 | |||
906 | // JavaScript micro-templating, similar to John Resig's implementation. | ||
907 | // Underscore templating handles arbitrary delimiters, preserves whitespace, | ||
908 | // and correctly escapes quotes within interpolated code. | ||
909 | _.template = function(str, data) { | ||
910 | var c = _.templateSettings; | ||
911 | var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' + | ||
912 | 'with(obj||{}){__p.push(\'' + | ||
913 | str.replace(/\\/g, '\\\\') | ||
914 | .replace(/'/g, "\\'") | ||
915 | .replace(c.escape || noMatch, function(match, code) { | ||
916 | return "',_.escape(" + unescape(code) + "),'"; | ||
917 | }) | ||
918 | .replace(c.interpolate || noMatch, function(match, code) { | ||
919 | return "'," + unescape(code) + ",'"; | ||
920 | }) | ||
921 | .replace(c.evaluate || noMatch, function(match, code) { | ||
922 | return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('"; | ||
923 | }) | ||
924 | .replace(/\r/g, '\\r') | ||
925 | .replace(/\n/g, '\\n') | ||
926 | .replace(/\t/g, '\\t') | ||
927 | + "');}return __p.join('');"; | ||
928 | var func = new Function('obj', '_', tmpl); | ||
929 | if (data) return func(data, _); | ||
930 | return function(data) { | ||
931 | return func.call(this, data, _); | ||
932 | }; | ||
933 | }; | ||
934 | |||
935 | // Add a "chain" function, which will delegate to the wrapper. | ||
936 | _.chain = function(obj) { | ||
937 | return _(obj).chain(); | ||
938 | }; | ||
939 | |||
940 | // The OOP Wrapper | ||
941 | // --------------- | ||
942 | |||
943 | // If Underscore is called as a function, it returns a wrapped object that | ||
944 | // can be used OO-style. This wrapper holds altered versions of all the | ||
945 | // underscore functions. Wrapped objects may be chained. | ||
946 | var wrapper = function(obj) { this._wrapped = obj; }; | ||
947 | |||
948 | // Expose `wrapper.prototype` as `_.prototype` | ||
949 | _.prototype = wrapper.prototype; | ||
950 | |||
951 | // Helper function to continue chaining intermediate results. | ||
952 | var result = function(obj, chain) { | ||
953 | return chain ? _(obj).chain() : obj; | ||
954 | }; | ||
955 | |||
956 | // A method to easily add functions to the OOP wrapper. | ||
957 | var addToWrapper = function(name, func) { | ||
958 | wrapper.prototype[name] = function() { | ||
959 | var args = slice.call(arguments); | ||
960 | unshift.call(args, this._wrapped); | ||
961 | return result(func.apply(_, args), this._chain); | ||
962 | }; | ||
963 | }; | ||
964 | |||
965 | // Add all of the Underscore functions to the wrapper object. | ||
966 | _.mixin(_); | ||
967 | |||
968 | // Add all mutator Array functions to the wrapper. | ||
969 | each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { | ||
970 | var method = ArrayProto[name]; | ||
971 | wrapper.prototype[name] = function() { | ||
972 | var wrapped = this._wrapped; | ||
973 | method.apply(wrapped, arguments); | ||
974 | var length = wrapped.length; | ||
975 | if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0]; | ||
976 | return result(wrapped, this._chain); | ||
977 | }; | ||
978 | }); | ||
979 | |||
980 | // Add all accessor Array functions to the wrapper. | ||
981 | each(['concat', 'join', 'slice'], function(name) { | ||
982 | var method = ArrayProto[name]; | ||
983 | wrapper.prototype[name] = function() { | ||
984 | return result(method.apply(this._wrapped, arguments), this._chain); | ||
985 | }; | ||
986 | }); | ||
987 | |||
988 | // Start chaining a wrapped Underscore object. | ||
989 | wrapper.prototype.chain = function() { | ||
990 | this._chain = true; | ||
991 | return this; | ||
992 | }; | ||
993 | |||
994 | // Extracts the result from a wrapped and chained object. | ||
995 | wrapper.prototype.value = function() { | ||
996 | return this._wrapped; | ||
997 | }; | ||
998 | |||
999 | }).call(this); | ||
diff --git a/_static/underscore.js b/_static/underscore.js new file mode 100644 index 0000000..5b55f32 --- /dev/null +++ b/_static/underscore.js | |||
@@ -0,0 +1,31 @@ | |||
1 | // Underscore.js 1.3.1 | ||
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. | ||
3 | // Underscore is freely distributable under the MIT license. | ||
4 | // Portions of Underscore are inspired or borrowed from Prototype, | ||
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. | ||
6 | // For all details and documentation: | ||
7 | // http://documentcloud.github.com/underscore | ||
8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== | ||
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, | ||
10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= | ||
11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a== | ||
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= | ||
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= | ||
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= | ||
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})}); | ||
16 | return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, | ||
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest= | ||
18 | b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]); | ||
19 | return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c, | ||
20 | d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g}; | ||
21 | var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a, | ||
22 | c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true: | ||
23 | a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}}; | ||
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, | ||
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; | ||
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; | ||
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), | ||
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ | ||
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= | ||
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= | ||
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); | ||
diff --git a/_static/up-pressed.png b/_static/up-pressed.png new file mode 100644 index 0000000..acee3b6 --- /dev/null +++ b/_static/up-pressed.png | |||
Binary files differ | |||
diff --git a/_static/up.png b/_static/up.png new file mode 100644 index 0000000..2a940a7 --- /dev/null +++ b/_static/up.png | |||
Binary files differ | |||
diff --git a/_static/websupport.js b/_static/websupport.js new file mode 100644 index 0000000..79b18e3 --- /dev/null +++ b/_static/websupport.js | |||
@@ -0,0 +1,808 @@ | |||
1 | /* | ||
2 | * websupport.js | ||
3 | * ~~~~~~~~~~~~~ | ||
4 | * | ||
5 | * sphinx.websupport utilities for all documentation. | ||
6 | * | ||
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. | ||
8 | * :license: BSD, see LICENSE for details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | (function($) { | ||
13 | $.fn.autogrow = function() { | ||
14 | return this.each(function() { | ||
15 | var textarea = this; | ||
16 | |||
17 | $.fn.autogrow.resize(textarea); | ||
18 | |||
19 | $(textarea) | ||
20 | .focus(function() { | ||
21 | textarea.interval = setInterval(function() { | ||
22 | $.fn.autogrow.resize(textarea); | ||
23 | }, 500); | ||
24 | }) | ||
25 | .blur(function() { | ||
26 | clearInterval(textarea.interval); | ||
27 | }); | ||
28 | }); | ||
29 | }; | ||
30 | |||
31 | $.fn.autogrow.resize = function(textarea) { | ||
32 | var lineHeight = parseInt($(textarea).css('line-height'), 10); | ||
33 | var lines = textarea.value.split('\n'); | ||
34 | var columns = textarea.cols; | ||
35 | var lineCount = 0; | ||
36 | $.each(lines, function() { | ||
37 | lineCount += Math.ceil(this.length / columns) || 1; | ||
38 | }); | ||
39 | var height = lineHeight * (lineCount + 1); | ||
40 | $(textarea).css('height', height); | ||
41 | }; | ||
42 | })(jQuery); | ||
43 | |||
44 | (function($) { | ||
45 | var comp, by; | ||
46 | |||
47 | function init() { | ||
48 | initEvents(); | ||
49 | initComparator(); | ||
50 | } | ||
51 | |||
52 | function initEvents() { | ||
53 | $(document).on("click", 'a.comment-close', function(event) { | ||
54 | event.preventDefault(); | ||
55 | hide($(this).attr('id').substring(2)); | ||
56 | }); | ||
57 | $(document).on("click", 'a.vote', function(event) { | ||
58 | event.preventDefault(); | ||
59 | handleVote($(this)); | ||
60 | }); | ||
61 | $(document).on("click", 'a.reply', function(event) { | ||
62 | event.preventDefault(); | ||
63 | openReply($(this).attr('id').substring(2)); | ||
64 | }); | ||
65 | $(document).on("click", 'a.close-reply', function(event) { | ||
66 | event.preventDefault(); | ||
67 | closeReply($(this).attr('id').substring(2)); | ||
68 | }); | ||
69 | $(document).on("click", 'a.sort-option', function(event) { | ||
70 | event.preventDefault(); | ||
71 | handleReSort($(this)); | ||
72 | }); | ||
73 | $(document).on("click", 'a.show-proposal', function(event) { | ||
74 | event.preventDefault(); | ||
75 | showProposal($(this).attr('id').substring(2)); | ||
76 | }); | ||
77 | $(document).on("click", 'a.hide-proposal', function(event) { | ||
78 | event.preventDefault(); | ||
79 | hideProposal($(this).attr('id').substring(2)); | ||
80 | }); | ||
81 | $(document).on("click", 'a.show-propose-change', function(event) { | ||
82 | event.preventDefault(); | ||
83 | showProposeChange($(this).attr('id').substring(2)); | ||
84 | }); | ||
85 | $(document).on("click", 'a.hide-propose-change', function(event) { | ||
86 | event.preventDefault(); | ||
87 | hideProposeChange($(this).attr('id').substring(2)); | ||
88 | }); | ||
89 | $(document).on("click", 'a.accept-comment', function(event) { | ||
90 | event.preventDefault(); | ||
91 | acceptComment($(this).attr('id').substring(2)); | ||
92 | }); | ||
93 | $(document).on("click", 'a.delete-comment', function(event) { | ||
94 | event.preventDefault(); | ||
95 | deleteComment($(this).attr('id').substring(2)); | ||
96 | }); | ||
97 | $(document).on("click", 'a.comment-markup', function(event) { | ||
98 | event.preventDefault(); | ||
99 | toggleCommentMarkupBox($(this).attr('id').substring(2)); | ||
100 | }); | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * Set comp, which is a comparator function used for sorting and | ||
105 | * inserting comments into the list. | ||
106 | */ | ||
107 | function setComparator() { | ||
108 | // If the first three letters are "asc", sort in ascending order | ||
109 | // and remove the prefix. | ||
110 | if (by.substring(0,3) == 'asc') { | ||
111 | var i = by.substring(3); | ||
112 | comp = function(a, b) { return a[i] - b[i]; }; | ||
113 | } else { | ||
114 | // Otherwise sort in descending order. | ||
115 | comp = function(a, b) { return b[by] - a[by]; }; | ||
116 | } | ||
117 | |||
118 | // Reset link styles and format the selected sort option. | ||
119 | $('a.sel').attr('href', '#').removeClass('sel'); | ||
120 | $('a.by' + by).removeAttr('href').addClass('sel'); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Create a comp function. If the user has preferences stored in | ||
125 | * the sortBy cookie, use those, otherwise use the default. | ||
126 | */ | ||
127 | function initComparator() { | ||
128 | by = 'rating'; // Default to sort by rating. | ||
129 | // If the sortBy cookie is set, use that instead. | ||
130 | if (document.cookie.length > 0) { | ||
131 | var start = document.cookie.indexOf('sortBy='); | ||
132 | if (start != -1) { | ||
133 | start = start + 7; | ||
134 | var end = document.cookie.indexOf(";", start); | ||
135 | if (end == -1) { | ||
136 | end = document.cookie.length; | ||
137 | by = unescape(document.cookie.substring(start, end)); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | setComparator(); | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * Show a comment div. | ||
146 | */ | ||
147 | function show(id) { | ||
148 | $('#ao' + id).hide(); | ||
149 | $('#ah' + id).show(); | ||
150 | var context = $.extend({id: id}, opts); | ||
151 | var popup = $(renderTemplate(popupTemplate, context)).hide(); | ||
152 | popup.find('textarea[name="proposal"]').hide(); | ||
153 | popup.find('a.by' + by).addClass('sel'); | ||
154 | var form = popup.find('#cf' + id); | ||
155 | form.submit(function(event) { | ||
156 | event.preventDefault(); | ||
157 | addComment(form); | ||
158 | }); | ||
159 | $('#s' + id).after(popup); | ||
160 | popup.slideDown('fast', function() { | ||
161 | getComments(id); | ||
162 | }); | ||
163 | } | ||
164 | |||
165 | /** | ||
166 | * Hide a comment div. | ||
167 | */ | ||
168 | function hide(id) { | ||
169 | $('#ah' + id).hide(); | ||
170 | $('#ao' + id).show(); | ||
171 | var div = $('#sc' + id); | ||
172 | div.slideUp('fast', function() { | ||
173 | div.remove(); | ||
174 | }); | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * Perform an ajax request to get comments for a node | ||
179 | * and insert the comments into the comments tree. | ||
180 | */ | ||
181 | function getComments(id) { | ||
182 | $.ajax({ | ||
183 | type: 'GET', | ||
184 | url: opts.getCommentsURL, | ||
185 | data: {node: id}, | ||
186 | success: function(data, textStatus, request) { | ||
187 | var ul = $('#cl' + id); | ||
188 | var speed = 100; | ||
189 | $('#cf' + id) | ||
190 | .find('textarea[name="proposal"]') | ||
191 | .data('source', data.source); | ||
192 | |||
193 | if (data.comments.length === 0) { | ||
194 | ul.html('<li>No comments yet.</li>'); | ||
195 | ul.data('empty', true); | ||
196 | } else { | ||
197 | // If there are comments, sort them and put them in the list. | ||
198 | var comments = sortComments(data.comments); | ||
199 | speed = data.comments.length * 100; | ||
200 | appendComments(comments, ul); | ||
201 | ul.data('empty', false); | ||
202 | } | ||
203 | $('#cn' + id).slideUp(speed + 200); | ||
204 | ul.slideDown(speed); | ||
205 | }, | ||
206 | error: function(request, textStatus, error) { | ||
207 | showError('Oops, there was a problem retrieving the comments.'); | ||
208 | }, | ||
209 | dataType: 'json' | ||
210 | }); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * Add a comment via ajax and insert the comment into the comment tree. | ||
215 | */ | ||
216 | function addComment(form) { | ||
217 | var node_id = form.find('input[name="node"]').val(); | ||
218 | var parent_id = form.find('input[name="parent"]').val(); | ||
219 | var text = form.find('textarea[name="comment"]').val(); | ||
220 | var proposal = form.find('textarea[name="proposal"]').val(); | ||
221 | |||
222 | if (text == '') { | ||
223 | showError('Please enter a comment.'); | ||
224 | return; | ||
225 | } | ||
226 | |||
227 | // Disable the form that is being submitted. | ||
228 | form.find('textarea,input').attr('disabled', 'disabled'); | ||
229 | |||
230 | // Send the comment to the server. | ||
231 | $.ajax({ | ||
232 | type: "POST", | ||
233 | url: opts.addCommentURL, | ||
234 | dataType: 'json', | ||
235 | data: { | ||
236 | node: node_id, | ||
237 | parent: parent_id, | ||
238 | text: text, | ||
239 | proposal: proposal | ||
240 | }, | ||
241 | success: function(data, textStatus, error) { | ||
242 | // Reset the form. | ||
243 | if (node_id) { | ||
244 | hideProposeChange(node_id); | ||
245 | } | ||
246 | form.find('textarea') | ||
247 | .val('') | ||
248 | .add(form.find('input')) | ||
249 | .removeAttr('disabled'); | ||
250 | var ul = $('#cl' + (node_id || parent_id)); | ||
251 | if (ul.data('empty')) { | ||
252 | $(ul).empty(); | ||
253 | ul.data('empty', false); | ||
254 | } | ||
255 | insertComment(data.comment); | ||
256 | var ao = $('#ao' + node_id); | ||
257 | ao.find('img').attr({'src': opts.commentBrightImage}); | ||
258 | if (node_id) { | ||
259 | // if this was a "root" comment, remove the commenting box | ||
260 | // (the user can get it back by reopening the comment popup) | ||
261 | $('#ca' + node_id).slideUp(); | ||
262 | } | ||
263 | }, | ||
264 | error: function(request, textStatus, error) { | ||
265 | form.find('textarea,input').removeAttr('disabled'); | ||
266 | showError('Oops, there was a problem adding the comment.'); | ||
267 | } | ||
268 | }); | ||
269 | } | ||
270 | |||
271 | /** | ||
272 | * Recursively append comments to the main comment list and children | ||
273 | * lists, creating the comment tree. | ||
274 | */ | ||
275 | function appendComments(comments, ul) { | ||
276 | $.each(comments, function() { | ||
277 | var div = createCommentDiv(this); | ||
278 | ul.append($(document.createElement('li')).html(div)); | ||
279 | appendComments(this.children, div.find('ul.comment-children')); | ||
280 | // To avoid stagnating data, don't store the comments children in data. | ||
281 | this.children = null; | ||
282 | div.data('comment', this); | ||
283 | }); | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * After adding a new comment, it must be inserted in the correct | ||
288 | * location in the comment tree. | ||
289 | */ | ||
290 | function insertComment(comment) { | ||
291 | var div = createCommentDiv(comment); | ||
292 | |||
293 | // To avoid stagnating data, don't store the comments children in data. | ||
294 | comment.children = null; | ||
295 | div.data('comment', comment); | ||
296 | |||
297 | var ul = $('#cl' + (comment.node || comment.parent)); | ||
298 | var siblings = getChildren(ul); | ||
299 | |||
300 | var li = $(document.createElement('li')); | ||
301 | li.hide(); | ||
302 | |||
303 | // Determine where in the parents children list to insert this comment. | ||
304 | for(i=0; i < siblings.length; i++) { | ||
305 | if (comp(comment, siblings[i]) <= 0) { | ||
306 | $('#cd' + siblings[i].id) | ||
307 | .parent() | ||
308 | .before(li.html(div)); | ||
309 | li.slideDown('fast'); | ||
310 | return; | ||
311 | } | ||
312 | } | ||
313 | |||
314 | // If we get here, this comment rates lower than all the others, | ||
315 | // or it is the only comment in the list. | ||
316 | ul.append(li.html(div)); | ||
317 | li.slideDown('fast'); | ||
318 | } | ||
319 | |||
320 | function acceptComment(id) { | ||
321 | $.ajax({ | ||
322 | type: 'POST', | ||
323 | url: opts.acceptCommentURL, | ||
324 | data: {id: id}, | ||
325 | success: function(data, textStatus, request) { | ||
326 | $('#cm' + id).fadeOut('fast'); | ||
327 | $('#cd' + id).removeClass('moderate'); | ||
328 | }, | ||
329 | error: function(request, textStatus, error) { | ||
330 | showError('Oops, there was a problem accepting the comment.'); | ||
331 | } | ||
332 | }); | ||
333 | } | ||
334 | |||
335 | function deleteComment(id) { | ||
336 | $.ajax({ | ||
337 | type: 'POST', | ||
338 | url: opts.deleteCommentURL, | ||
339 | data: {id: id}, | ||
340 | success: function(data, textStatus, request) { | ||
341 | var div = $('#cd' + id); | ||
342 | if (data == 'delete') { | ||
343 | // Moderator mode: remove the comment and all children immediately | ||
344 | div.slideUp('fast', function() { | ||
345 | div.remove(); | ||
346 | }); | ||
347 | return; | ||
348 | } | ||
349 | // User mode: only mark the comment as deleted | ||
350 | div | ||
351 | .find('span.user-id:first') | ||
352 | .text('[deleted]').end() | ||
353 | .find('div.comment-text:first') | ||
354 | .text('[deleted]').end() | ||
355 | .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id + | ||
356 | ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id) | ||
357 | .remove(); | ||
358 | var comment = div.data('comment'); | ||
359 | comment.username = '[deleted]'; | ||
360 | comment.text = '[deleted]'; | ||
361 | div.data('comment', comment); | ||
362 | }, | ||
363 | error: function(request, textStatus, error) { | ||
364 | showError('Oops, there was a problem deleting the comment.'); | ||
365 | } | ||
366 | }); | ||
367 | } | ||
368 | |||
369 | function showProposal(id) { | ||
370 | $('#sp' + id).hide(); | ||
371 | $('#hp' + id).show(); | ||
372 | $('#pr' + id).slideDown('fast'); | ||
373 | } | ||
374 | |||
375 | function hideProposal(id) { | ||
376 | $('#hp' + id).hide(); | ||
377 | $('#sp' + id).show(); | ||
378 | $('#pr' + id).slideUp('fast'); | ||
379 | } | ||
380 | |||
381 | function showProposeChange(id) { | ||
382 | $('#pc' + id).hide(); | ||
383 | $('#hc' + id).show(); | ||
384 | var textarea = $('#pt' + id); | ||
385 | textarea.val(textarea.data('source')); | ||
386 | $.fn.autogrow.resize(textarea[0]); | ||
387 | textarea.slideDown('fast'); | ||
388 | } | ||
389 | |||
390 | function hideProposeChange(id) { | ||
391 | $('#hc' + id).hide(); | ||
392 | $('#pc' + id).show(); | ||
393 | var textarea = $('#pt' + id); | ||
394 | textarea.val('').removeAttr('disabled'); | ||
395 | textarea.slideUp('fast'); | ||
396 | } | ||
397 | |||
398 | function toggleCommentMarkupBox(id) { | ||
399 | $('#mb' + id).toggle(); | ||
400 | } | ||
401 | |||
402 | /** Handle when the user clicks on a sort by link. */ | ||
403 | function handleReSort(link) { | ||
404 | var classes = link.attr('class').split(/\s+/); | ||
405 | for (var i=0; i<classes.length; i++) { | ||
406 | if (classes[i] != 'sort-option') { | ||
407 | by = classes[i].substring(2); | ||
408 | } | ||
409 | } | ||
410 | setComparator(); | ||
411 | // Save/update the sortBy cookie. | ||
412 | var expiration = new Date(); | ||
413 | expiration.setDate(expiration.getDate() + 365); | ||
414 | document.cookie= 'sortBy=' + escape(by) + | ||
415 | ';expires=' + expiration.toUTCString(); | ||
416 | $('ul.comment-ul').each(function(index, ul) { | ||
417 | var comments = getChildren($(ul), true); | ||
418 | comments = sortComments(comments); | ||
419 | appendComments(comments, $(ul).empty()); | ||
420 | }); | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * Function to process a vote when a user clicks an arrow. | ||
425 | */ | ||
426 | function handleVote(link) { | ||
427 | if (!opts.voting) { | ||
428 | showError("You'll need to login to vote."); | ||
429 | return; | ||
430 | } | ||
431 | |||
432 | var id = link.attr('id'); | ||
433 | if (!id) { | ||
434 | // Didn't click on one of the voting arrows. | ||
435 | return; | ||
436 | } | ||
437 | // If it is an unvote, the new vote value is 0, | ||
438 | // Otherwise it's 1 for an upvote, or -1 for a downvote. | ||
439 | var value = 0; | ||
440 | if (id.charAt(1) != 'u') { | ||
441 | value = id.charAt(0) == 'u' ? 1 : -1; | ||
442 | } | ||
443 | // The data to be sent to the server. | ||
444 | var d = { | ||
445 | comment_id: id.substring(2), | ||
446 | value: value | ||
447 | }; | ||
448 | |||
449 | // Swap the vote and unvote links. | ||
450 | link.hide(); | ||
451 | $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id) | ||
452 | .show(); | ||
453 | |||
454 | // The div the comment is displayed in. | ||
455 | var div = $('div#cd' + d.comment_id); | ||
456 | var data = div.data('comment'); | ||
457 | |||
458 | // If this is not an unvote, and the other vote arrow has | ||
459 | // already been pressed, unpress it. | ||
460 | if ((d.value !== 0) && (data.vote === d.value * -1)) { | ||
461 | $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide(); | ||
462 | $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show(); | ||
463 | } | ||
464 | |||
465 | // Update the comments rating in the local data. | ||
466 | data.rating += (data.vote === 0) ? d.value : (d.value - data.vote); | ||
467 | data.vote = d.value; | ||
468 | div.data('comment', data); | ||
469 | |||
470 | // Change the rating text. | ||
471 | div.find('.rating:first') | ||
472 | .text(data.rating + ' point' + (data.rating == 1 ? '' : 's')); | ||
473 | |||
474 | // Send the vote information to the server. | ||
475 | $.ajax({ | ||
476 | type: "POST", | ||
477 | url: opts.processVoteURL, | ||
478 | data: d, | ||
479 | error: function(request, textStatus, error) { | ||
480 | showError('Oops, there was a problem casting that vote.'); | ||
481 | } | ||
482 | }); | ||
483 | } | ||
484 | |||
485 | /** | ||
486 | * Open a reply form used to reply to an existing comment. | ||
487 | */ | ||
488 | function openReply(id) { | ||
489 | // Swap out the reply link for the hide link | ||
490 | $('#rl' + id).hide(); | ||
491 | $('#cr' + id).show(); | ||
492 | |||
493 | // Add the reply li to the children ul. | ||
494 | var div = $(renderTemplate(replyTemplate, {id: id})).hide(); | ||
495 | $('#cl' + id) | ||
496 | .prepend(div) | ||
497 | // Setup the submit handler for the reply form. | ||
498 | .find('#rf' + id) | ||
499 | .submit(function(event) { | ||
500 | event.preventDefault(); | ||
501 | addComment($('#rf' + id)); | ||
502 | closeReply(id); | ||
503 | }) | ||
504 | .find('input[type=button]') | ||
505 | .click(function() { | ||
506 | closeReply(id); | ||
507 | }); | ||
508 | div.slideDown('fast', function() { | ||
509 | $('#rf' + id).find('textarea').focus(); | ||
510 | }); | ||
511 | } | ||
512 | |||
513 | /** | ||
514 | * Close the reply form opened with openReply. | ||
515 | */ | ||
516 | function closeReply(id) { | ||
517 | // Remove the reply div from the DOM. | ||
518 | $('#rd' + id).slideUp('fast', function() { | ||
519 | $(this).remove(); | ||
520 | }); | ||
521 | |||
522 | // Swap out the hide link for the reply link | ||
523 | $('#cr' + id).hide(); | ||
524 | $('#rl' + id).show(); | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * Recursively sort a tree of comments using the comp comparator. | ||
529 | */ | ||
530 | function sortComments(comments) { | ||
531 | comments.sort(comp); | ||
532 | $.each(comments, function() { | ||
533 | this.children = sortComments(this.children); | ||
534 | }); | ||
535 | return comments; | ||
536 | } | ||
537 | |||
538 | /** | ||
539 | * Get the children comments from a ul. If recursive is true, | ||
540 | * recursively include childrens' children. | ||
541 | */ | ||
542 | function getChildren(ul, recursive) { | ||
543 | var children = []; | ||
544 | ul.children().children("[id^='cd']") | ||
545 | .each(function() { | ||
546 | var comment = $(this).data('comment'); | ||
547 | if (recursive) | ||
548 | comment.children = getChildren($(this).find('#cl' + comment.id), true); | ||
549 | children.push(comment); | ||
550 | }); | ||
551 | return children; | ||
552 | } | ||
553 | |||
554 | /** Create a div to display a comment in. */ | ||
555 | function createCommentDiv(comment) { | ||
556 | if (!comment.displayed && !opts.moderator) { | ||
557 | return $('<div class="moderate">Thank you! Your comment will show up ' | ||
558 | + 'once it is has been approved by a moderator.</div>'); | ||
559 | } | ||
560 | // Prettify the comment rating. | ||
561 | comment.pretty_rating = comment.rating + ' point' + | ||
562 | (comment.rating == 1 ? '' : 's'); | ||
563 | // Make a class (for displaying not yet moderated comments differently) | ||
564 | comment.css_class = comment.displayed ? '' : ' moderate'; | ||
565 | // Create a div for this comment. | ||
566 | var context = $.extend({}, opts, comment); | ||
567 | var div = $(renderTemplate(commentTemplate, context)); | ||
568 | |||
569 | // If the user has voted on this comment, highlight the correct arrow. | ||
570 | if (comment.vote) { | ||
571 | var direction = (comment.vote == 1) ? 'u' : 'd'; | ||
572 | div.find('#' + direction + 'v' + comment.id).hide(); | ||
573 | div.find('#' + direction + 'u' + comment.id).show(); | ||
574 | } | ||
575 | |||
576 | if (opts.moderator || comment.text != '[deleted]') { | ||
577 | div.find('a.reply').show(); | ||
578 | if (comment.proposal_diff) | ||
579 | div.find('#sp' + comment.id).show(); | ||
580 | if (opts.moderator && !comment.displayed) | ||
581 | div.find('#cm' + comment.id).show(); | ||
582 | if (opts.moderator || (opts.username == comment.username)) | ||
583 | div.find('#dc' + comment.id).show(); | ||
584 | } | ||
585 | return div; | ||
586 | } | ||
587 | |||
588 | /** | ||
589 | * A simple template renderer. Placeholders such as <%id%> are replaced | ||
590 | * by context['id'] with items being escaped. Placeholders such as <#id#> | ||
591 | * are not escaped. | ||
592 | */ | ||
593 | function renderTemplate(template, context) { | ||
594 | var esc = $(document.createElement('div')); | ||
595 | |||
596 | function handle(ph, escape) { | ||
597 | var cur = context; | ||
598 | $.each(ph.split('.'), function() { | ||
599 | cur = cur[this]; | ||
600 | }); | ||
601 | return escape ? esc.text(cur || "").html() : cur; | ||
602 | } | ||
603 | |||
604 | return template.replace(/<([%#])([\w\.]*)\1>/g, function() { | ||
605 | return handle(arguments[2], arguments[1] == '%' ? true : false); | ||
606 | }); | ||
607 | } | ||
608 | |||
609 | /** Flash an error message briefly. */ | ||
610 | function showError(message) { | ||
611 | $(document.createElement('div')).attr({'class': 'popup-error'}) | ||
612 | .append($(document.createElement('div')) | ||
613 | .attr({'class': 'error-message'}).text(message)) | ||
614 | .appendTo('body') | ||
615 | .fadeIn("slow") | ||
616 | .delay(2000) | ||
617 | .fadeOut("slow"); | ||
618 | } | ||
619 | |||
620 | /** Add a link the user uses to open the comments popup. */ | ||
621 | $.fn.comment = function() { | ||
622 | return this.each(function() { | ||
623 | var id = $(this).attr('id').substring(1); | ||
624 | var count = COMMENT_METADATA[id]; | ||
625 | var title = count + ' comment' + (count == 1 ? '' : 's'); | ||
626 | var image = count > 0 ? opts.commentBrightImage : opts.commentImage; | ||
627 | var addcls = count == 0 ? ' nocomment' : ''; | ||
628 | $(this) | ||
629 | .append( | ||
630 | $(document.createElement('a')).attr({ | ||
631 | href: '#', | ||
632 | 'class': 'sphinx-comment-open' + addcls, | ||
633 | id: 'ao' + id | ||
634 | }) | ||
635 | .append($(document.createElement('img')).attr({ | ||
636 | src: image, | ||
637 | alt: 'comment', | ||
638 | title: title | ||
639 | })) | ||
640 | .click(function(event) { | ||
641 | event.preventDefault(); | ||
642 | show($(this).attr('id').substring(2)); | ||
643 | }) | ||
644 | ) | ||
645 | .append( | ||
646 | $(document.createElement('a')).attr({ | ||
647 | href: '#', | ||
648 | 'class': 'sphinx-comment-close hidden', | ||
649 | id: 'ah' + id | ||
650 | }) | ||
651 | .append($(document.createElement('img')).attr({ | ||
652 | src: opts.closeCommentImage, | ||
653 | alt: 'close', | ||
654 | title: 'close' | ||
655 | })) | ||
656 | .click(function(event) { | ||
657 | event.preventDefault(); | ||
658 | hide($(this).attr('id').substring(2)); | ||
659 | }) | ||
660 | ); | ||
661 | }); | ||
662 | }; | ||
663 | |||
664 | var opts = { | ||
665 | processVoteURL: '/_process_vote', | ||
666 | addCommentURL: '/_add_comment', | ||
667 | getCommentsURL: '/_get_comments', | ||
668 | acceptCommentURL: '/_accept_comment', | ||
669 | deleteCommentURL: '/_delete_comment', | ||
670 | commentImage: '/static/_static/comment.png', | ||
671 | closeCommentImage: '/static/_static/comment-close.png', | ||
672 | loadingImage: '/static/_static/ajax-loader.gif', | ||
673 | commentBrightImage: '/static/_static/comment-bright.png', | ||
674 | upArrow: '/static/_static/up.png', | ||
675 | downArrow: '/static/_static/down.png', | ||
676 | upArrowPressed: '/static/_static/up-pressed.png', | ||
677 | downArrowPressed: '/static/_static/down-pressed.png', | ||
678 | voting: false, | ||
679 | moderator: false | ||
680 | }; | ||
681 | |||
682 | if (typeof COMMENT_OPTIONS != "undefined") { | ||
683 | opts = jQuery.extend(opts, COMMENT_OPTIONS); | ||
684 | } | ||
685 | |||
686 | var popupTemplate = '\ | ||
687 | <div class="sphinx-comments" id="sc<%id%>">\ | ||
688 | <p class="sort-options">\ | ||
689 | Sort by:\ | ||
690 | <a href="#" class="sort-option byrating">best rated</a>\ | ||
691 | <a href="#" class="sort-option byascage">newest</a>\ | ||
692 | <a href="#" class="sort-option byage">oldest</a>\ | ||
693 | </p>\ | ||
694 | <div class="comment-header">Comments</div>\ | ||
695 | <div class="comment-loading" id="cn<%id%>">\ | ||
696 | loading comments... <img src="<%loadingImage%>" alt="" /></div>\ | ||
697 | <ul id="cl<%id%>" class="comment-ul"></ul>\ | ||
698 | <div id="ca<%id%>">\ | ||
699 | <p class="add-a-comment">Add a comment\ | ||
700 | (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\ | ||
701 | <div class="comment-markup-box" id="mb<%id%>">\ | ||
702 | reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \ | ||
703 | <code>``code``</code>, \ | ||
704 | code blocks: <code>::</code> and an indented block after blank line</div>\ | ||
705 | <form method="post" id="cf<%id%>" class="comment-form" action="">\ | ||
706 | <textarea name="comment" cols="80"></textarea>\ | ||
707 | <p class="propose-button">\ | ||
708 | <a href="#" id="pc<%id%>" class="show-propose-change">\ | ||
709 | Propose a change ▹\ | ||
710 | </a>\ | ||
711 | <a href="#" id="hc<%id%>" class="hide-propose-change">\ | ||
712 | Propose a change ▿\ | ||
713 | </a>\ | ||
714 | </p>\ | ||
715 | <textarea name="proposal" id="pt<%id%>" cols="80"\ | ||
716 | spellcheck="false"></textarea>\ | ||
717 | <input type="submit" value="Add comment" />\ | ||
718 | <input type="hidden" name="node" value="<%id%>" />\ | ||
719 | <input type="hidden" name="parent" value="" />\ | ||
720 | </form>\ | ||
721 | </div>\ | ||
722 | </div>'; | ||
723 | |||
724 | var commentTemplate = '\ | ||
725 | <div id="cd<%id%>" class="sphinx-comment<%css_class%>">\ | ||
726 | <div class="vote">\ | ||
727 | <div class="arrow">\ | ||
728 | <a href="#" id="uv<%id%>" class="vote" title="vote up">\ | ||
729 | <img src="<%upArrow%>" />\ | ||
730 | </a>\ | ||
731 | <a href="#" id="uu<%id%>" class="un vote" title="vote up">\ | ||
732 | <img src="<%upArrowPressed%>" />\ | ||
733 | </a>\ | ||
734 | </div>\ | ||
735 | <div class="arrow">\ | ||
736 | <a href="#" id="dv<%id%>" class="vote" title="vote down">\ | ||
737 | <img src="<%downArrow%>" id="da<%id%>" />\ | ||
738 | </a>\ | ||
739 | <a href="#" id="du<%id%>" class="un vote" title="vote down">\ | ||
740 | <img src="<%downArrowPressed%>" />\ | ||
741 | </a>\ | ||
742 | </div>\ | ||
743 | </div>\ | ||
744 | <div class="comment-content">\ | ||
745 | <p class="tagline comment">\ | ||
746 | <span class="user-id"><%username%></span>\ | ||
747 | <span class="rating"><%pretty_rating%></span>\ | ||
748 | <span class="delta"><%time.delta%></span>\ | ||
749 | </p>\ | ||
750 | <div class="comment-text comment"><#text#></div>\ | ||
751 | <p class="comment-opts comment">\ | ||
752 | <a href="#" class="reply hidden" id="rl<%id%>">reply ▹</a>\ | ||
753 | <a href="#" class="close-reply" id="cr<%id%>">reply ▿</a>\ | ||
754 | <a href="#" id="sp<%id%>" class="show-proposal">proposal ▹</a>\ | ||
755 | <a href="#" id="hp<%id%>" class="hide-proposal">proposal ▿</a>\ | ||
756 | <a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\ | ||
757 | <span id="cm<%id%>" class="moderation hidden">\ | ||
758 | <a href="#" id="ac<%id%>" class="accept-comment">accept</a>\ | ||
759 | </span>\ | ||
760 | </p>\ | ||
761 | <pre class="proposal" id="pr<%id%>">\ | ||
762 | <#proposal_diff#>\ | ||
763 | </pre>\ | ||
764 | <ul class="comment-children" id="cl<%id%>"></ul>\ | ||
765 | </div>\ | ||
766 | <div class="clearleft"></div>\ | ||
767 | </div>\ | ||
768 | </div>'; | ||
769 | |||
770 | var replyTemplate = '\ | ||
771 | <li>\ | ||
772 | <div class="reply-div" id="rd<%id%>">\ | ||
773 | <form id="rf<%id%>">\ | ||
774 | <textarea name="comment" cols="80"></textarea>\ | ||
775 | <input type="submit" value="Add reply" />\ | ||
776 | <input type="button" value="Cancel" />\ | ||
777 | <input type="hidden" name="parent" value="<%id%>" />\ | ||
778 | <input type="hidden" name="node" value="" />\ | ||
779 | </form>\ | ||
780 | </div>\ | ||
781 | </li>'; | ||
782 | |||
783 | $(document).ready(function() { | ||
784 | init(); | ||
785 | }); | ||
786 | })(jQuery); | ||
787 | |||
788 | $(document).ready(function() { | ||
789 | // add comment anchors for all paragraphs that are commentable | ||
790 | $('.sphinx-has-comment').comment(); | ||
791 | |||
792 | // highlight search words in search results | ||
793 | $("div.context").each(function() { | ||
794 | var params = $.getQueryParameters(); | ||
795 | var terms = (params.q) ? params.q[0].split(/\s+/) : []; | ||
796 | var result = $(this); | ||
797 | $.each(terms, function() { | ||
798 | result.highlightText(this.toLowerCase(), 'highlighted'); | ||
799 | }); | ||
800 | }); | ||
801 | |||
802 | // directly open comment window if requested | ||
803 | var anchor = document.location.hash; | ||
804 | if (anchor.substring(0, 9) == '#comment-') { | ||
805 | $('#ao' + anchor.substring(9)).click(); | ||
806 | document.location.hash = '#s' + anchor.substring(9); | ||
807 | } | ||
808 | }); | ||