· 9 years ago · Nov 30, 2016, 10:22 PM
1(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2window.$ = window.jQuery = require("./..\\..\\bower_components\\jquery\\dist\\jquery.js");
3require("./..\\..\\bower_components\\bootstrap\\dist\\js\\bootstrap.js");
4
5$(document).ready(function(){
6
7 $(function(){
8 $(".text-typed").typed({
9 strings: ["Strony <span class='red-text'>internetowe</span>", "Sklepy <span class='red-text'>internetowe</span>" , "Portale <span class='red-text'>internetowe</span>", "Aplikacje <span class='red-text'>mobilne</span>"],
10 loop: true,
11 // time before typing starts
12 startDelay: 1100,
13 typeSpeed: 100
14 });
15 });
16
17 /* Waypoint offset */
18 function onScrollInit( items, trigger ) {
19 items.each( function() {
20 var osElement = $(this),
21 osAnimationClass = osElement.attr('data-os-animation'),
22 osAnimationDelay = osElement.attr('data-os-animation-delay');
23
24 osElement.css({
25 '-webkit-animation-delay': osAnimationDelay,
26 '-moz-animation-delay': osAnimationDelay,
27 'animation-delay': osAnimationDelay
28 });
29
30 var osTrigger = ( trigger ) ? trigger : osElement;
31
32 osTrigger.waypoint(function() {
33 osElement.addClass('animated').addClass(osAnimationClass);
34 },{
35 triggerOnce: true,
36 offset: '850px'
37 });
38 });
39 }
40
41 $(window).resize(function() {
42 if ($(window).width() > 768) {
43 onScrollInit($('.os-animation'));
44 }
45 });
46
47 if ($(window).width() > 768) {
48 onScrollInit($('.os-animation'));
49 }
50
51 /* Waypoint normal */
52 function onScrollInit2( items, trigger ) {
53 items.each( function() {
54 var osElement = $(this),
55 osAnimationClass = osElement.attr('data-os-animation'),
56 osAnimationDelay = osElement.attr('data-os-animation-delay');
57
58 osElement.css({
59 '-webkit-animation-delay': osAnimationDelay,
60 '-moz-animation-delay': osAnimationDelay,
61 'animation-delay': osAnimationDelay
62 });
63
64 var osTrigger = ( trigger ) ? trigger : osElement;
65
66 osElement.addClass('animated').addClass(osAnimationClass);
67
68
69 });
70 }
71
72 onScrollInit2( $('.os-animation2') );
73
74
75 $(".anchorLink").click(function(e){
76 e.preventDefault();
77
78 var this_offset = $(this).offset();
79 var that_id = $(this).attr("href");
80 var that_offset = $(that_id).offset();
81 var offset_diff = Math.abs(that_offset.top - this_offset.top);
82
83 var base_speed = 500; // Time in ms per 1,000 pixels
84 var speed = (offset_diff * base_speed) / 1000;
85
86 $("html,body").animate({
87 scrollTop: that_offset.top
88 }, speed);
89 });
90
91
92 $('input').iCheck({
93
94 checkboxClass: 'icheckbox_square-blue',
95 radioClass: 'iradio_square-blue',
96 increaseArea: '20%' // optional
97 });
98
99 /* Burger menu */
100 $('.burger-menu').click(function(){
101 $this = $(this);
102 $this.toggleClass('active');
103
104 if ($('.burger-menu').hasClass("active")) {
105 $(".mobile-menu").slideDown();
106 } else {
107 $(".mobile-menu").slideUp();
108 }
109 });
110
111
112
113
114
115 /* Price calculator */
116
117 // Rozwijanie
118 $( ".new-project" ).click(function() {
119 $( this ).toggleClass( "current-element" );
120
121 if($(this).hasClass( "current-element" )){
122 $('#second-step-calculator').stop().slideDown();
123 } else {
124 $('#second-step-calculator').stop().slideUp();
125 }
126 });
127
128 $( ".simple-site" ).click(function() {
129 $( this ).toggleClass( "current-element" );
130
131 if($(this).hasClass( "current-element" )){
132 $('#third-step-calculator').stop().slideDown();
133 $('.wordpress-site').removeClass("current-element");
134 $('.ecommerce').removeClass("current-element");
135 $('.custom-project').removeClass("current-element");
136 $( ".choosen-options span" ).html( "" );
137 $( ".choosen-options span" ).html( "Strona wizytówka" );
138
139 $chosenOption = $(".choosen-options span").text();
140 $('#chosen-project').val($chosenOption);
141
142 } else {
143 $('#third-step-calculator').stop().slideUp();
144 $( ".choosen-options span" ).html( "" );
145 }
146 });
147
148 $( ".wordpress-site" ).click(function() {
149 $( this ).toggleClass( "current-element" );
150
151 if($(this).hasClass( "current-element" )){
152 $('#third-step-calculator').stop().slideDown();
153 $('.simple-site').removeClass("current-element");
154 $('.ecommerce').removeClass("current-element");
155 $('.custom-project').removeClass("current-element");
156 $( ".choosen-options span" ).html( "" );
157 $( ".choosen-options span" ).html( "CMS Wordpress" );
158
159 $chosenOption = $(".choosen-options span").text();
160 $('#chosen-project').val($chosenOption);
161
162 } else {
163 $('#third-step-calculator').stop().slideUp();
164 $( ".choosen-options span" ).html( "" );
165 }
166 });
167
168 $( ".ecommerce" ).click(function() {
169 $( this ).toggleClass( "current-element" );
170
171 if($(this).hasClass( "current-element" )){
172 $('#third-step-calculator').stop().slideDown();
173 $('.simple-site').removeClass("current-element");
174 $('.wordpress-site').removeClass("current-element");
175 $('.custom-project').removeClass("current-element");
176 $( ".choosen-options span" ).html( "" );
177 $( ".choosen-options span" ).html( "Sklep internetowy" );
178
179 $chosenOption = $(".choosen-options span").text();
180 $('#chosen-project').val($chosenOption);
181
182
183 } else {
184 $('#third-step-calculator').stop().slideUp();
185 $( ".choosen-options span" ).html( "" );
186
187
188
189 }
190 });
191
192
193 /* Edit project - anchor animation scroll */
194 $(".edit-project").click(function() {
195 $('html, body').animate({
196 scrollTop: $("#contact").offset().top
197 }, 300);
198 });
199
200 /* Personalization project */
201 $(".custom-project").click(function() {
202 $('html, body').animate({
203 scrollTop: $("#contact").offset().top
204 }, 300);
205 });
206
207 // Po klknięciu przycisku Przejdź dalej
208 $( "#last-step" ).click(function() {
209 $(this).hide();
210 $('#fourth-step-calculator').stop().slideDown();
211 $('#summary').stop().slideDown();
212
213 });
214
215
216
217
218
219
220 /* Price calculator part 2 */
221 var $totalPrice = 0;
222 var $totalMinuts = 0;
223
224 /* Simple site */
225 $( ".simple-site" ).click(function() {
226
227 $simpleSitePrice = 0;
228 $simpleSiteMinuts = 0;
229 $totalPrice = 0;
230 $totalMinuts = 0
231
232 if($( ".simple-site" ).hasClass( "current-element" )) {
233
234 $simpleSitePrice = $(".simple-site").attr("data-price");
235 $simpleSiteMinuts = $(".simple-site").attr("data-minuts");
236 $totalPrice = $totalPrice + parseInt($simpleSitePrice);
237 $totalMinuts = $totalMinuts + parseInt($simpleSiteMinuts);
238
239 }
240 });
241
242
243 /* Wordpress site */
244 $( ".wordpress-site" ).click(function() {
245
246 $cmsPrice = 0;
247 $cmsMinuts = 0;
248 $totalPrice = 0;
249 $totalMinuts = 0
250
251 if($( ".wordpress-site" ).hasClass( "current-element" )){
252
253 $cmsPrice = $(".wordpress-site").attr("data-price");
254 $cmsMinuts = $(".wordpress-site").attr("data-minuts");
255 $totalPrice = $totalPrice + parseInt($cmsPrice);
256 $totalMinuts = $totalMinuts + parseInt($cmsMinuts);
257 }
258 });
259
260
261 /* Ecommerce site */
262 $( ".ecommerce" ).click(function() {
263
264 $ecommercePrice = 0;
265 $ecommerceMinuts = 0;
266 $totalPrice = 0;
267 $totalMinuts = 0;
268
269 if($( ".ecommerce" ).hasClass( "current-element" )) {
270
271 $ecommercePrice = $(".ecommerce").attr("data-price");
272 $ecommerceMinuts = $(".ecommerce").attr("data-minuts");
273 $totalPrice = $totalPrice + parseInt($ecommercePrice);
274 $totalMinuts = $totalMinuts + parseInt($ecommerceMinuts);
275
276 }
277 });
278
279
280
281
282
283
284
285 /* Price calculator part 3*/
286
287 /* Web type */
288 $singlePagePrice = 0;
289 $singlePageMinuts = 0;
290 $normalSitePrice = 0;
291 $normalSiteMinuts = 0;
292 $webTypeValue = 0;
293
294
295 // Default
296 $( ".choosen-options-list" ).append('<li class="single-page"><i class="circle-icon"></i>Single Page</li>');
297
298 if($webTypeValue == "single-page") {
299
300 $singlePagePrice = $(this).attr("data-price");
301 $singlePageMinuts = $(this).attr("data-minuts");
302 $totalPrice = $totalPrice + parseInt($singlePagePrice);
303 $totalMinuts = $totalMinuts + parseInt($singlePageMinuts);
304
305 } else if($webTypeValue == "normal-site") {
306
307 $normalSitePrice = $(this).attr("data-price");
308 $normalSiteMinuts = $(this).attr("data-minuts");
309 $totalPrice = $totalPrice + parseInt($normalSitePrice);
310 $totalMinuts = $totalMinuts + parseInt($normalSiteMinuts);
311
312 }
313
314
315 // On clicked
316 $('input[name="choose-web-type"]').on('ifChecked', function() {
317
318 $singlePagePrice = 0;
319 $singlePageMinuts = 0;
320 $normalSitePrice = 0;
321 $normalSiteMinuts = 0;
322 $webTypeValue = $(this).val();
323 $( ".choosen-options-list li.single-page").remove();
324 $( ".choosen-options-list li.normal-site").remove();
325
326 if($webTypeValue == "single-page") {
327
328 $singlePagePrice = $(this).attr("data-price");
329 $singlePageMinuts = $(this).attr("data-minuts");
330 $totalPrice = $totalPrice + parseInt($singlePagePrice);
331 $totalMinuts = $totalMinuts + parseInt($singlePageMinuts);
332 $( ".choosen-options-list" ).append('<li class="single-page"><i class="circle-icon"></i>Single Page</li>');
333
334 } else if($webTypeValue == "normal-site") {
335
336 $normalSitePrice = $(this).attr("data-price");
337 $normalSiteMinuts = $(this).attr("data-minuts");
338 $totalPrice = $totalPrice + parseInt($normalSitePrice);
339 $totalMinuts = $totalMinuts + parseInt($normalSiteMinuts);
340 $( ".choosen-options-list" ).append('<li class="normal-site"><i class="circle-icon"></i>Standardowa strona internetowa</li>');
341
342 }
343
344 });
345
346
347
348 /* Custom project PSD */
349 $customPsdPrice = 0;
350 $customPsdMinuts = 0;
351
352
353 // On clicked
354 $('input[name="custom-psd"]').on('ifChecked', function() {
355
356 $customPsdPrice = 0;
357 $customPsdMinuts = 0;
358 $customPsdPrice = $(this).attr("data-price");
359 $customPsdMinuts = $(this).attr("data-minuts");
360 $totalPrice = $totalPrice + parseInt($customPsdPrice);
361 $totalMinuts = $totalMinuts + parseInt($customPsdMinuts);
362 $( ".choosen-options-list" ).append('<li class="custom-psd"><i class="circle-icon"></i>Dedykowany projekt graficzny</li>');
363
364 });
365
366 // On unchecked
367 $('input[name="custom-psd"]').on('ifUnchecked', function() {
368
369 $customPsdPrice = 0;
370 $customPsdMinuts = 0;
371 $( ".choosen-options-list li.custom-psd").remove();
372 $customPsdPrice = $(this).attr("data-price");
373 $customPsdMinuts = $(this).attr("data-minuts");
374 console.log($customPsdMinuts + " " + $customPsdPrice + " " + $totalPrice);
375 $totalPrice = $totalPrice - parseInt($customPsdPrice);
376 $totalMinuts = $totalMinuts - parseInt($customPsdMinuts);
377
378 });
379
380
381
382 /* Pages count */
383 $pagesCount = $('#pages-count').val();
384 $( ".choosen-options-list" ).append('<li class="pages-count"><i class="circle-icon"></i>'+"Ilość podstron: " + "<strong>" +$pagesCount + "</strong>" + '</li>');
385
386 $("input[type='number']").bind("input", function() {
387
388 $pagesCount = $('#pages-count').val();
389 $( ".choosen-options-list li.pages-count").remove();
390 $( ".choosen-options-list" ).append('<li class="pages-count"><i class="circle-icon"></i>'+"Ilość podstron: " + "<strong>" +$pagesCount + "</strong>" + '</li>');
391
392 });
393
394
395 /* Retina */
396 $retinaPrice = 0;
397 $retinaMinuts = 0;
398 $( ".choosen-options-list" ).append('<li class="retina"><i class="circle-icon"></i>Retina</li>');
399
400 // On clicked
401 $('input[name="retina"]').on('ifChecked', function() {
402
403 $retinaValue = $(this).val();
404
405 if($retinaValue == "tak") {
406
407 $retinaPrice = 0;
408 $retinaMinuts = 0;
409 $retinaPrice = $(this).attr("data-price");
410 $retinaMinuts = $(this).attr("data-minuts");
411 $totalPrice = $totalPrice + parseInt($retinaPrice);
412 $totalMinuts = $totalMinuts + parseInt($retinaMinuts);
413 $( ".choosen-options-list li.retina" ).remove();
414 $( ".choosen-options-list" ).append('<li class="retina"><i class="circle-icon"></i>Retina</li>');
415
416 } else if($retinaValue == "nie") {
417
418 $retinaPrice = 0;
419 $retinaMinuts = 0;
420 $( ".choosen-options-list li.retina" ).remove();
421 $retinaPrice = $(this).attr("data-price");
422 $retinaMinuts = $(this).attr("data-minuts");
423 $totalPrice = $totalPrice - parseInt($retinaPrice);
424 $totalMinuts = $totalMinuts - parseInt($retinaMinuts);
425
426 }
427 });
428
429 /* Responsywność */
430 $rwdPrice = 0;
431 $rwdMinuts = 0;
432 $( ".choosen-options-list" ).append('<li class="rwd"><i class="circle-icon"></i>Responsynowść</li>');
433
434 // On clicked
435 $('input[name="rwd"]').on('ifChecked', function() {
436
437 $rwdValue = $(this).val();
438
439 if($rwdValue == "tak") {
440
441 $rwdPrice = 0;
442 $rwdMinuts = 0;
443 $rwdPrice = $(this).attr("data-price");
444 $rwdMinuts = $(this).attr("data-minuts");
445 $totalPrice = $totalPrice + parseInt($rwdPrice);
446 $totalMinuts = $totalMinuts + parseInt($rwdMinuts);
447 $( ".choosen-options-list li.rwd" ).remove();
448 $( ".choosen-options-list" ).append('<li class="rwd"><i class="circle-icon"></i>Responsynowść</li>');
449
450 } else if($rwdValue == "nie") {
451
452 $retinaPrice = 0;
453 $retinaMinuts = 0;
454 $( ".choosen-options-list li.rwd" ).remove();
455 $rwdPrice = $(this).attr("data-price");
456 $rwdMinuts = $(this).attr("data-minuts");
457 $totalPrice = $totalPrice - parseInt($rwdPrice);
458 $totalMinuts = $totalMinuts - parseInt($rwdMinuts);
459
460 }
461 });
462
463 /* 90 dni opieki */
464 $supportPrice = 0;
465 $supportMinuts = 0;
466 $( ".choosen-options-list" ).append('<li class="support"><i class="circle-icon"></i>90 dni opieki</li>');
467
468 // On clicked
469 $('input[name="support"]').on('ifChecked', function() {
470
471 $supportValue = $(this).val();
472
473 if($supportValue == "tak") {
474
475 $supportPrice = 0;
476 $supportMinuts = 0;
477 $supportPrice = $(this).attr("data-price");
478 $supportMinuts = $(this).attr("data-minuts");
479 $totalPrice = $totalPrice + parseInt($supportPrice);
480 $totalMinuts = $totalMinuts + parseInt($supportMinuts);
481 $( ".choosen-options-list li.support" ).remove();
482 $( ".choosen-options-list" ).append('<li class="support"><i class="circle-icon"></i>90 dni opieki</li>');
483
484 } else if($supportValue == "nie") {
485
486 $retinaPrice = 0;
487 $retinaMinuts = 0;
488 $( ".choosen-options-list li.support" ).remove();
489 $supportPrice = $(this).attr("data-price");
490 $supportMinuts = $(this).attr("data-minuts");
491 $totalPrice = $totalPrice - parseInt($supportPrice);
492 $totalMinuts = $totalMinuts - parseInt($supportMinuts);
493
494 }
495 });
496
497 /* Form contact */
498 $formcontactPrice = 0;
499 $formcontactMinuts = 0;
500 $( ".choosen-options-list" ).append('<li class="formcontact"><i class="circle-icon"></i>Formularz kontaktowy</li>');
501
502 // On clicked
503 $('input[name="formcontact"]').on('ifChecked', function() {
504
505 $formcontactValue = $(this).val();
506
507 if($formcontactValue == "tak") {
508
509 $formcontactPrice = 0;
510 $formcontactMinuts = 0;
511 $formcontactPrice = $(this).attr("data-price");
512 $formcontactMinuts = $(this).attr("data-minuts");
513 $totalPrice = $totalPrice + parseInt($formcontactPrice);
514 $totalMinuts = $totalMinuts + parseInt($formcontactMinuts);
515 $( ".choosen-options-list li.formcontact" ).remove();
516 $( ".choosen-options-list" ).append('<li class="formcontact"><i class="circle-icon"></i>Formularz kontaktowy</li>');
517
518 } else if($formcontactValue == "nie") {
519
520 $retinaPrice = 0;
521 $retinaMinuts = 0;
522 $( ".choosen-options-list li.formcontact" ).remove();
523 $formcontactPrice = $(this).attr("data-price");
524 $formcontactMinuts = $(this).attr("data-minuts");
525 $totalPrice = $totalPrice - parseInt($formcontactPrice);
526 $totalMinuts = $totalMinuts - parseInt($formcontactMinuts);
527
528 }
529 });
530
531
532 /* Newsletter */
533 $newsletterPrice = 0;
534 $newsletterMinuts = 0;
535 $( ".choosen-options-list" ).append('<li class="newsletter"><i class="circle-icon"></i>Newsletter</li>');
536
537 // On clicked
538 $('input[name="newsletter"]').on('ifChecked', function() {
539
540 $newsletterValue = $(this).val();
541
542 if($newsletterValue == "tak") {
543
544 $newsletterPrice = 0;
545 $newsletterMinuts = 0;
546 $newsletterPrice = $(this).attr("data-price");
547 $newsletterMinuts = $(this).attr("data-minuts");
548 $totalPrice = $totalPrice + parseInt($newsletterPrice);
549 $totalMinuts = $totalMinuts + parseInt($newsletterMinuts);
550 $( ".choosen-options-list li.newsletter" ).remove();
551 $( ".choosen-options-list" ).append('<li class="newsletter"><i class="circle-icon"></i>Newsletter</li>');
552
553 } else if($newsletterValue == "nie") {
554
555 $newsletterPrice = 0;
556 $newsletterMinuts = 0;
557 $( ".choosen-options-list li.newsletter" ).remove();
558 $newsletterPrice = $(this).attr("data-price");
559 $newsletterMinuts = $(this).attr("data-minuts");
560 $totalPrice = $totalPrice - parseInt($newsletterPrice);
561 $totalMinuts = $totalMinuts - parseInt($newsletterMinuts);
562
563 }
564 });
565
566
567 /* Komentarze do kodu */
568 $commentsPrice = 0;
569 $commentsMinuts = 0;
570 $( ".choosen-options-list" ).append('<li class="comments"><i class="circle-icon"></i>Komentarze do kodu</li>');
571
572 // On clicked
573 $('input[name="comments"]').on('ifChecked', function() {
574
575 $commentsValue = $(this).val();
576
577 if($commentsValue == "tak") {
578
579 $commentsPrice = 0;
580 $commentsMinuts = 0;
581 $commentsPrice = $(this).attr("data-price");
582 $commentsMinuts = $(this).attr("data-minuts");
583 $totalPrice = $totalPrice + parseInt($commentsPrice);
584 $totalMinuts = $totalMinuts + parseInt($commentsMinuts);
585 $( ".choosen-options-list li.comments" ).remove();
586 $( ".choosen-options-list" ).append('<li class="comments"><i class="circle-icon"></i>Komentarze do kodu</li>');
587
588 } else if($commentsValue == "nie") {
589
590 $commentsPrice = 0;
591 $commentsMinuts = 0;
592 $( ".choosen-options-list li.comments" ).remove();
593 $commentsPrice = $(this).attr("data-price");
594 $commentsMinuts = $(this).attr("data-minuts");
595 $totalPrice = $totalPrice - parseInt($commentsPrice);
596 $totalMinuts = $totalMinuts - parseInt($commentsMinuts);
597
598 }
599 });
600
601
602
603 /* Parallax */
604 $parallaxPrice = 0;
605 $parallaxMinuts = 0;
606 $( ".choosen-options-list" ).append('<li class="parallax"><i class="circle-icon"></i>Parallax</li>');
607
608 // On clicked
609 $('input[name="parallax"]').on('ifChecked', function() {
610
611 $parallaxValue = $(this).val();
612
613 if($parallaxValue == "tak") {
614
615 $parallaxPrice = 0;
616 $parallaxMinuts = 0;
617 $parallaxPrice = $(this).attr("data-price");
618 $parallaxMinuts = $(this).attr("data-minuts");
619 $totalPrice = $totalPrice + parseInt($parallaxPrice);
620 $totalMinuts = $totalMinuts + parseInt($parallaxMinuts);
621 $( ".choosen-options-list li.parallax" ).remove();
622 $( ".choosen-options-list" ).append('<li class="parallax"><i class="circle-icon"></i>Parallax</li>');
623
624 } else if($parallaxValue == "nie") {
625
626 $parallaxPrice = 0;
627 $parallaxMinuts = 0;
628 $( ".choosen-options-list li.parallax" ).remove();
629 $parallaxPrice = $(this).attr("data-price");
630 $parallaxMinuts = $(this).attr("data-minuts");
631 $totalPrice = $totalPrice - parseInt($parallaxPrice);
632 $totalMinuts = $totalMinuts - parseInt($parallaxMinuts);
633
634 }
635 });
636
637
638 /* Slider */
639 $sliderPrice = 0;
640 $sliderMinuts = 0;
641 $( ".choosen-options-list" ).append('<li class="slider"><i class="circle-icon"></i>Slider</li>');
642
643 // On clicked
644 $('input[name="slider"]').on('ifChecked', function() {
645
646 $sliderValue = $(this).val();
647
648 if($sliderValue == "tak") {
649
650 $sliderPrice = 0;
651 $sliderMinuts = 0;
652 $sliderPrice = $(this).attr("data-price");
653 $sliderMinuts = $(this).attr("data-minuts");
654 $totalPrice = $totalPrice + parseInt($sliderPrice);
655 $totalMinuts = $totalMinuts + parseInt($sliderMinuts);
656 $( ".choosen-options-list li.slider" ).remove();
657 $( ".choosen-options-list" ).append('<li class="slider"><i class="circle-icon"></i>Slider</li>');
658
659 } else if($sliderValue == "nie") {
660
661 $sliderPrice = 0;
662 $sliderMinuts = 0;
663 $( ".choosen-options-list li.slider" ).remove();
664 $sliderPrice = $(this).attr("data-price");
665 $sliderMinuts = $(this).attr("data-minuts");
666 $totalPrice = $totalPrice + parseInt($sliderPrice);
667 $totalMinuts = $totalMinuts + parseInt($sliderMinuts);
668
669 }
670 });
671
672
673 /* Analitycs */
674 $analitycsPrice = 0;
675 $analitycsMinuts = 0;
676 $( ".choosen-options-list" ).append('<li class="analitycs"><i class="circle-icon"></i>Google analitycs</li>');
677
678 // On clicked
679 $('input[name="analitycs"]').on('ifChecked', function() {
680
681 $analitycsValue = $(this).val();
682
683 if($analitycsValue == "tak") {
684
685 $analitycsPrice = 0;
686 $analitycsMinuts = 0;
687 $analitycsPrice = $(this).attr("data-price");
688 $analitycsMinuts = $(this).attr("data-minuts");
689 $totalPrice = $totalPrice + parseInt($analitycsPrice);
690 $totalMinuts = $totalMinuts + parseInt($analitycsMinuts);
691 $( ".choosen-options-list li.analitycs" ).remove();
692 $( ".choosen-options-list" ).append('<li class="analitycs"><i class="circle-icon"></i>Google analitycs</li>');
693
694 } else if($analitycsValue == "nie") {
695
696 $analitycsPrice = 0;
697 $analitycsMinuts = 0;
698 $( ".choosen-options-list li.analitycs" ).remove();
699 $analitycsPrice = $(this).attr("data-price");
700 $analitycsMinuts = $(this).attr("data-minuts");
701 $totalPrice = $totalPrice - parseInt($analitycsPrice);
702 $totalMinuts = $totalMinuts - parseInt($analitycsMinuts);
703
704 }
705 });
706
707
708 /* Installation */
709 $installationPrice = 0;
710 $installationMinuts = 0;
711 $( ".choosen-options-list" ).append('<li class="installation"><i class="circle-icon"></i>Instalacja na serwerze</li>');
712
713 // On clicked
714 $('input[name="installation"]').on('ifChecked', function() {
715
716 $installationValue = $(this).val();
717
718 if($installationValue == "tak") {
719
720 $installationPrice = 0;
721 $installationMinuts = 0;
722 $installationPrice = $(this).attr("data-price");
723 $installationMinuts = $(this).attr("data-minuts");
724 $totalPrice = $totalPrice + parseInt($installationPrice);
725 $totalMinuts = $totalMinuts + parseInt($installationMinuts);
726 $( ".choosen-options-list li.installation" ).remove();
727 $( ".choosen-options-list" ).append('<li class="installation"><i class="circle-icon"></i>Instalacja na serwerze</li>');
728
729 } else if($installationValue == "nie") {
730
731 $installationPrice = 0;
732 $installationMinuts = 0;
733 $( ".choosen-options-list li.installation" ).remove();
734 $installationPrice = $(this).attr("data-price");
735 $installationMinuts = $(this).attr("data-minuts");
736 $totalPrice = $totalPrice - parseInt($installationPrice);
737 $totalMinuts = $totalMinuts - parseInt($installationMinuts);
738
739 }
740 });
741
742
743
744
745
746
747
748
749 function Oblicz() {
750
751 // Obliczanie daty projektu
752 $endOfProject = 0;
753
754 var d1 = new Date (),
755 d2 = new Date ( d1 );
756 d2.setMinutes ( d1.getMinutes() + $totalMinuts );
757
758 $month = 0;
759
760 switch (d2.getMonth()+1) {
761 case 1:
762 $month = "Styczeń";
763 break;
764 case 2:
765 $month = "Luty";
766 break;
767 case 3:
768 $month = "Marzec";
769 break;
770 case 4:
771 $month = "Kwiecień";
772 break;
773 case 5:
774 $month = "Maj";
775 break;
776 case 6:
777 $month = "Czerwiec";
778 break;
779 case 7:
780 $month = "Lipiec";
781 break;
782 case 8:
783 $month = "Sierpień";
784 break;
785 case 9:
786 $month = "Wrzesień";
787 break;
788 case 10:
789 $month = "Październik";
790 break;
791 case 11:
792 $month = "Listopad";
793 break;
794 case 12:
795 $month = "Grudzień";
796 }
797
798 $endOfProject = d2.getDate() + " " + $month + ", " + d2.getFullYear();
799
800 $('#project-date-box').val($endOfProject);
801 $('.project-date p').html($endOfProject);
802
803
804 // Obliczanie ceny projektu
805 $('#project-price-box').val($totalPrice);
806 $('.project-price p').html($totalPrice+ " zł netto");
807
808 }
809
810 Oblicz();
811
812
813 // Generate price on clicked
814 $('input').on('ifClicked', function(event){
815
816 Oblicz();
817
818 });
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843 /* Formularz kontaktowy */
844 $(function() {
845
846 // Formularz kontaktowy
847 $formularz = $('#calculator-form');
848
849 // Wiadomości error lub sukces
850 $divMessages = $('.calculator-messages');
851
852
853
854 // Po przesłaniu formularza, kliknięciu przycisku submit
855 $formularz.submit(function(event) {
856 // Wyłącz domyślne przekierowanie przeglądarki
857 event.preventDefault();
858
859 // Serialize the form data.
860 $formData = $formularz.serialize();
861
862 submitForm();
863
864 });
865
866
867 function submitForm() {
868 // Ustawiamy value z pól formularza
869 $name = $('#calculator-name').val('');
870 $email = $('#calculator-email').val('');
871 $inspiration = $('#calculator-inspiration').val('');
872 $message = $('#calculator-message').val('');
873
874 $chosenProject = $('#chosen-project').val('');
875
876
877
878
879 $.ajax({
880 method: "POST",
881 url: "mailer.php",
882 data: $formData
883 }).done(function(response) {
884 // Po pomyślnym przesłaniu odpowiedzi z serwera
885 // Upewniamy się czy divMessages nie posiada klasy error, następnie dodajemy klasę success
886 $divMessages.removeClass('alert-warning');
887 $divMessages.addClass('alert-success');
888
889 // Odpowiedź z serwera
890 $divMessages.text(response);
891
892 // Czyścimy pola z wypełnionych wartości
893 $('#calculator-name').val('');
894 $('#calculator-email').val('');
895 $('#calculator-inspiration').val('');
896 $('#calculator-message').val('');
897 $('#chosen-project').val('');
898
899
900 // Następnie chowamy formularz zostawiając samą wiadomość
901 $formularz.slideUp();
902
903 }).fail(function(data) {
904 // Po negatywnym przesłaniu odpowiedzi z serwera
905 // Upewniamy się czy divMessages nie posiada klasy sukces, następnie dodajemy klasę error
906 $divMessages.removeClass('alert-success');
907 $divMessages.addClass('alert-warning');
908
909 // Ustawiamy wiadomość errora
910 if (data.responseText !== '') {
911 $divMessages.text(data.responseText);
912 } else {
913 $divMessages.text('Oops! Wystąpiły błędy przez co Twoja wiadomość nie mogła zostać wysłana.');
914 }
915 });
916 }
917
918
919
920
921 });
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943});
944
945
946},{"./..\\..\\bower_components\\bootstrap\\dist\\js\\bootstrap.js":2,"./..\\..\\bower_components\\jquery\\dist\\jquery.js":3}],2:[function(require,module,exports){
947/*!
948 * Bootstrap v3.3.7 (http://getbootstrap.com)
949 * Copyright 2011-2016 Twitter, Inc.
950 * Licensed under the MIT license
951 */
952
953if (typeof jQuery === 'undefined') {
954 throw new Error('Bootstrap\'s JavaScript requires jQuery')
955}
956
957+function ($) {
958 'use strict';
959 var version = $.fn.jquery.split(' ')[0].split('.')
960 if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
961 throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
962 }
963}(jQuery);
964
965/* ========================================================================
966 * Bootstrap: transition.js v3.3.7
967 * http://getbootstrap.com/javascript/#transitions
968 * ========================================================================
969 * Copyright 2011-2016 Twitter, Inc.
970 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
971 * ======================================================================== */
972
973
974+function ($) {
975 'use strict';
976
977 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
978 // ============================================================
979
980 function transitionEnd() {
981 var el = document.createElement('bootstrap')
982
983 var transEndEventNames = {
984 WebkitTransition : 'webkitTransitionEnd',
985 MozTransition : 'transitionend',
986 OTransition : 'oTransitionEnd otransitionend',
987 transition : 'transitionend'
988 }
989
990 for (var name in transEndEventNames) {
991 if (el.style[name] !== undefined) {
992 return { end: transEndEventNames[name] }
993 }
994 }
995
996 return false // explicit for ie8 ( ._.)
997 }
998
999 // http://blog.alexmaccaw.com/css-transitions
1000 $.fn.emulateTransitionEnd = function (duration) {
1001 var called = false
1002 var $el = this
1003 $(this).one('bsTransitionEnd', function () { called = true })
1004 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
1005 setTimeout(callback, duration)
1006 return this
1007 }
1008
1009 $(function () {
1010 $.support.transition = transitionEnd()
1011
1012 if (!$.support.transition) return
1013
1014 $.event.special.bsTransitionEnd = {
1015 bindType: $.support.transition.end,
1016 delegateType: $.support.transition.end,
1017 handle: function (e) {
1018 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
1019 }
1020 }
1021 })
1022
1023}(jQuery);
1024
1025/* ========================================================================
1026 * Bootstrap: alert.js v3.3.7
1027 * http://getbootstrap.com/javascript/#alerts
1028 * ========================================================================
1029 * Copyright 2011-2016 Twitter, Inc.
1030 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1031 * ======================================================================== */
1032
1033
1034+function ($) {
1035 'use strict';
1036
1037 // ALERT CLASS DEFINITION
1038 // ======================
1039
1040 var dismiss = '[data-dismiss="alert"]'
1041 var Alert = function (el) {
1042 $(el).on('click', dismiss, this.close)
1043 }
1044
1045 Alert.VERSION = '3.3.7'
1046
1047 Alert.TRANSITION_DURATION = 150
1048
1049 Alert.prototype.close = function (e) {
1050 var $this = $(this)
1051 var selector = $this.attr('data-target')
1052
1053 if (!selector) {
1054 selector = $this.attr('href')
1055 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1056 }
1057
1058 var $parent = $(selector === '#' ? [] : selector)
1059
1060 if (e) e.preventDefault()
1061
1062 if (!$parent.length) {
1063 $parent = $this.closest('.alert')
1064 }
1065
1066 $parent.trigger(e = $.Event('close.bs.alert'))
1067
1068 if (e.isDefaultPrevented()) return
1069
1070 $parent.removeClass('in')
1071
1072 function removeElement() {
1073 // detach from parent, fire event then clean up data
1074 $parent.detach().trigger('closed.bs.alert').remove()
1075 }
1076
1077 $.support.transition && $parent.hasClass('fade') ?
1078 $parent
1079 .one('bsTransitionEnd', removeElement)
1080 .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
1081 removeElement()
1082 }
1083
1084
1085 // ALERT PLUGIN DEFINITION
1086 // =======================
1087
1088 function Plugin(option) {
1089 return this.each(function () {
1090 var $this = $(this)
1091 var data = $this.data('bs.alert')
1092
1093 if (!data) $this.data('bs.alert', (data = new Alert(this)))
1094 if (typeof option == 'string') data[option].call($this)
1095 })
1096 }
1097
1098 var old = $.fn.alert
1099
1100 $.fn.alert = Plugin
1101 $.fn.alert.Constructor = Alert
1102
1103
1104 // ALERT NO CONFLICT
1105 // =================
1106
1107 $.fn.alert.noConflict = function () {
1108 $.fn.alert = old
1109 return this
1110 }
1111
1112
1113 // ALERT DATA-API
1114 // ==============
1115
1116 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
1117
1118}(jQuery);
1119
1120/* ========================================================================
1121 * Bootstrap: button.js v3.3.7
1122 * http://getbootstrap.com/javascript/#buttons
1123 * ========================================================================
1124 * Copyright 2011-2016 Twitter, Inc.
1125 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1126 * ======================================================================== */
1127
1128
1129+function ($) {
1130 'use strict';
1131
1132 // BUTTON PUBLIC CLASS DEFINITION
1133 // ==============================
1134
1135 var Button = function (element, options) {
1136 this.$element = $(element)
1137 this.options = $.extend({}, Button.DEFAULTS, options)
1138 this.isLoading = false
1139 }
1140
1141 Button.VERSION = '3.3.7'
1142
1143 Button.DEFAULTS = {
1144 loadingText: 'loading...'
1145 }
1146
1147 Button.prototype.setState = function (state) {
1148 var d = 'disabled'
1149 var $el = this.$element
1150 var val = $el.is('input') ? 'val' : 'html'
1151 var data = $el.data()
1152
1153 state += 'Text'
1154
1155 if (data.resetText == null) $el.data('resetText', $el[val]())
1156
1157 // push to event loop to allow forms to submit
1158 setTimeout($.proxy(function () {
1159 $el[val](data[state] == null ? this.options[state] : data[state])
1160
1161 if (state == 'loadingText') {
1162 this.isLoading = true
1163 $el.addClass(d).attr(d, d).prop(d, true)
1164 } else if (this.isLoading) {
1165 this.isLoading = false
1166 $el.removeClass(d).removeAttr(d).prop(d, false)
1167 }
1168 }, this), 0)
1169 }
1170
1171 Button.prototype.toggle = function () {
1172 var changed = true
1173 var $parent = this.$element.closest('[data-toggle="buttons"]')
1174
1175 if ($parent.length) {
1176 var $input = this.$element.find('input')
1177 if ($input.prop('type') == 'radio') {
1178 if ($input.prop('checked')) changed = false
1179 $parent.find('.active').removeClass('active')
1180 this.$element.addClass('active')
1181 } else if ($input.prop('type') == 'checkbox') {
1182 if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
1183 this.$element.toggleClass('active')
1184 }
1185 $input.prop('checked', this.$element.hasClass('active'))
1186 if (changed) $input.trigger('change')
1187 } else {
1188 this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
1189 this.$element.toggleClass('active')
1190 }
1191 }
1192
1193
1194 // BUTTON PLUGIN DEFINITION
1195 // ========================
1196
1197 function Plugin(option) {
1198 return this.each(function () {
1199 var $this = $(this)
1200 var data = $this.data('bs.button')
1201 var options = typeof option == 'object' && option
1202
1203 if (!data) $this.data('bs.button', (data = new Button(this, options)))
1204
1205 if (option == 'toggle') data.toggle()
1206 else if (option) data.setState(option)
1207 })
1208 }
1209
1210 var old = $.fn.button
1211
1212 $.fn.button = Plugin
1213 $.fn.button.Constructor = Button
1214
1215
1216 // BUTTON NO CONFLICT
1217 // ==================
1218
1219 $.fn.button.noConflict = function () {
1220 $.fn.button = old
1221 return this
1222 }
1223
1224
1225 // BUTTON DATA-API
1226 // ===============
1227
1228 $(document)
1229 .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
1230 var $btn = $(e.target).closest('.btn')
1231 Plugin.call($btn, 'toggle')
1232 if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
1233 // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
1234 e.preventDefault()
1235 // The target component still receive the focus
1236 if ($btn.is('input,button')) $btn.trigger('focus')
1237 else $btn.find('input:visible,button:visible').first().trigger('focus')
1238 }
1239 })
1240 .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
1241 $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
1242 })
1243
1244}(jQuery);
1245
1246/* ========================================================================
1247 * Bootstrap: carousel.js v3.3.7
1248 * http://getbootstrap.com/javascript/#carousel
1249 * ========================================================================
1250 * Copyright 2011-2016 Twitter, Inc.
1251 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1252 * ======================================================================== */
1253
1254
1255+function ($) {
1256 'use strict';
1257
1258 // CAROUSEL CLASS DEFINITION
1259 // =========================
1260
1261 var Carousel = function (element, options) {
1262 this.$element = $(element)
1263 this.$indicators = this.$element.find('.carousel-indicators')
1264 this.options = options
1265 this.paused = null
1266 this.sliding = null
1267 this.interval = null
1268 this.$active = null
1269 this.$items = null
1270
1271 this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
1272
1273 this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
1274 .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
1275 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
1276 }
1277
1278 Carousel.VERSION = '3.3.7'
1279
1280 Carousel.TRANSITION_DURATION = 600
1281
1282 Carousel.DEFAULTS = {
1283 interval: 5000,
1284 pause: 'hover',
1285 wrap: true,
1286 keyboard: true
1287 }
1288
1289 Carousel.prototype.keydown = function (e) {
1290 if (/input|textarea/i.test(e.target.tagName)) return
1291 switch (e.which) {
1292 case 37: this.prev(); break
1293 case 39: this.next(); break
1294 default: return
1295 }
1296
1297 e.preventDefault()
1298 }
1299
1300 Carousel.prototype.cycle = function (e) {
1301 e || (this.paused = false)
1302
1303 this.interval && clearInterval(this.interval)
1304
1305 this.options.interval
1306 && !this.paused
1307 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
1308
1309 return this
1310 }
1311
1312 Carousel.prototype.getItemIndex = function (item) {
1313 this.$items = item.parent().children('.item')
1314 return this.$items.index(item || this.$active)
1315 }
1316
1317 Carousel.prototype.getItemForDirection = function (direction, active) {
1318 var activeIndex = this.getItemIndex(active)
1319 var willWrap = (direction == 'prev' && activeIndex === 0)
1320 || (direction == 'next' && activeIndex == (this.$items.length - 1))
1321 if (willWrap && !this.options.wrap) return active
1322 var delta = direction == 'prev' ? -1 : 1
1323 var itemIndex = (activeIndex + delta) % this.$items.length
1324 return this.$items.eq(itemIndex)
1325 }
1326
1327 Carousel.prototype.to = function (pos) {
1328 var that = this
1329 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
1330
1331 if (pos > (this.$items.length - 1) || pos < 0) return
1332
1333 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
1334 if (activeIndex == pos) return this.pause().cycle()
1335
1336 return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
1337 }
1338
1339 Carousel.prototype.pause = function (e) {
1340 e || (this.paused = true)
1341
1342 if (this.$element.find('.next, .prev').length && $.support.transition) {
1343 this.$element.trigger($.support.transition.end)
1344 this.cycle(true)
1345 }
1346
1347 this.interval = clearInterval(this.interval)
1348
1349 return this
1350 }
1351
1352 Carousel.prototype.next = function () {
1353 if (this.sliding) return
1354 return this.slide('next')
1355 }
1356
1357 Carousel.prototype.prev = function () {
1358 if (this.sliding) return
1359 return this.slide('prev')
1360 }
1361
1362 Carousel.prototype.slide = function (type, next) {
1363 var $active = this.$element.find('.item.active')
1364 var $next = next || this.getItemForDirection(type, $active)
1365 var isCycling = this.interval
1366 var direction = type == 'next' ? 'left' : 'right'
1367 var that = this
1368
1369 if ($next.hasClass('active')) return (this.sliding = false)
1370
1371 var relatedTarget = $next[0]
1372 var slideEvent = $.Event('slide.bs.carousel', {
1373 relatedTarget: relatedTarget,
1374 direction: direction
1375 })
1376 this.$element.trigger(slideEvent)
1377 if (slideEvent.isDefaultPrevented()) return
1378
1379 this.sliding = true
1380
1381 isCycling && this.pause()
1382
1383 if (this.$indicators.length) {
1384 this.$indicators.find('.active').removeClass('active')
1385 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
1386 $nextIndicator && $nextIndicator.addClass('active')
1387 }
1388
1389 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
1390 if ($.support.transition && this.$element.hasClass('slide')) {
1391 $next.addClass(type)
1392 $next[0].offsetWidth // force reflow
1393 $active.addClass(direction)
1394 $next.addClass(direction)
1395 $active
1396 .one('bsTransitionEnd', function () {
1397 $next.removeClass([type, direction].join(' ')).addClass('active')
1398 $active.removeClass(['active', direction].join(' '))
1399 that.sliding = false
1400 setTimeout(function () {
1401 that.$element.trigger(slidEvent)
1402 }, 0)
1403 })
1404 .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
1405 } else {
1406 $active.removeClass('active')
1407 $next.addClass('active')
1408 this.sliding = false
1409 this.$element.trigger(slidEvent)
1410 }
1411
1412 isCycling && this.cycle()
1413
1414 return this
1415 }
1416
1417
1418 // CAROUSEL PLUGIN DEFINITION
1419 // ==========================
1420
1421 function Plugin(option) {
1422 return this.each(function () {
1423 var $this = $(this)
1424 var data = $this.data('bs.carousel')
1425 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
1426 var action = typeof option == 'string' ? option : options.slide
1427
1428 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
1429 if (typeof option == 'number') data.to(option)
1430 else if (action) data[action]()
1431 else if (options.interval) data.pause().cycle()
1432 })
1433 }
1434
1435 var old = $.fn.carousel
1436
1437 $.fn.carousel = Plugin
1438 $.fn.carousel.Constructor = Carousel
1439
1440
1441 // CAROUSEL NO CONFLICT
1442 // ====================
1443
1444 $.fn.carousel.noConflict = function () {
1445 $.fn.carousel = old
1446 return this
1447 }
1448
1449
1450 // CAROUSEL DATA-API
1451 // =================
1452
1453 var clickHandler = function (e) {
1454 var href
1455 var $this = $(this)
1456 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
1457 if (!$target.hasClass('carousel')) return
1458 var options = $.extend({}, $target.data(), $this.data())
1459 var slideIndex = $this.attr('data-slide-to')
1460 if (slideIndex) options.interval = false
1461
1462 Plugin.call($target, options)
1463
1464 if (slideIndex) {
1465 $target.data('bs.carousel').to(slideIndex)
1466 }
1467
1468 e.preventDefault()
1469 }
1470
1471 $(document)
1472 .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
1473 .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
1474
1475 $(window).on('load', function () {
1476 $('[data-ride="carousel"]').each(function () {
1477 var $carousel = $(this)
1478 Plugin.call($carousel, $carousel.data())
1479 })
1480 })
1481
1482}(jQuery);
1483
1484/* ========================================================================
1485 * Bootstrap: collapse.js v3.3.7
1486 * http://getbootstrap.com/javascript/#collapse
1487 * ========================================================================
1488 * Copyright 2011-2016 Twitter, Inc.
1489 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1490 * ======================================================================== */
1491
1492/* jshint latedef: false */
1493
1494+function ($) {
1495 'use strict';
1496
1497 // COLLAPSE PUBLIC CLASS DEFINITION
1498 // ================================
1499
1500 var Collapse = function (element, options) {
1501 this.$element = $(element)
1502 this.options = $.extend({}, Collapse.DEFAULTS, options)
1503 this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
1504 '[data-toggle="collapse"][data-target="#' + element.id + '"]')
1505 this.transitioning = null
1506
1507 if (this.options.parent) {
1508 this.$parent = this.getParent()
1509 } else {
1510 this.addAriaAndCollapsedClass(this.$element, this.$trigger)
1511 }
1512
1513 if (this.options.toggle) this.toggle()
1514 }
1515
1516 Collapse.VERSION = '3.3.7'
1517
1518 Collapse.TRANSITION_DURATION = 350
1519
1520 Collapse.DEFAULTS = {
1521 toggle: true
1522 }
1523
1524 Collapse.prototype.dimension = function () {
1525 var hasWidth = this.$element.hasClass('width')
1526 return hasWidth ? 'width' : 'height'
1527 }
1528
1529 Collapse.prototype.show = function () {
1530 if (this.transitioning || this.$element.hasClass('in')) return
1531
1532 var activesData
1533 var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
1534
1535 if (actives && actives.length) {
1536 activesData = actives.data('bs.collapse')
1537 if (activesData && activesData.transitioning) return
1538 }
1539
1540 var startEvent = $.Event('show.bs.collapse')
1541 this.$element.trigger(startEvent)
1542 if (startEvent.isDefaultPrevented()) return
1543
1544 if (actives && actives.length) {
1545 Plugin.call(actives, 'hide')
1546 activesData || actives.data('bs.collapse', null)
1547 }
1548
1549 var dimension = this.dimension()
1550
1551 this.$element
1552 .removeClass('collapse')
1553 .addClass('collapsing')[dimension](0)
1554 .attr('aria-expanded', true)
1555
1556 this.$trigger
1557 .removeClass('collapsed')
1558 .attr('aria-expanded', true)
1559
1560 this.transitioning = 1
1561
1562 var complete = function () {
1563 this.$element
1564 .removeClass('collapsing')
1565 .addClass('collapse in')[dimension]('')
1566 this.transitioning = 0
1567 this.$element
1568 .trigger('shown.bs.collapse')
1569 }
1570
1571 if (!$.support.transition) return complete.call(this)
1572
1573 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
1574
1575 this.$element
1576 .one('bsTransitionEnd', $.proxy(complete, this))
1577 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
1578 }
1579
1580 Collapse.prototype.hide = function () {
1581 if (this.transitioning || !this.$element.hasClass('in')) return
1582
1583 var startEvent = $.Event('hide.bs.collapse')
1584 this.$element.trigger(startEvent)
1585 if (startEvent.isDefaultPrevented()) return
1586
1587 var dimension = this.dimension()
1588
1589 this.$element[dimension](this.$element[dimension]())[0].offsetHeight
1590
1591 this.$element
1592 .addClass('collapsing')
1593 .removeClass('collapse in')
1594 .attr('aria-expanded', false)
1595
1596 this.$trigger
1597 .addClass('collapsed')
1598 .attr('aria-expanded', false)
1599
1600 this.transitioning = 1
1601
1602 var complete = function () {
1603 this.transitioning = 0
1604 this.$element
1605 .removeClass('collapsing')
1606 .addClass('collapse')
1607 .trigger('hidden.bs.collapse')
1608 }
1609
1610 if (!$.support.transition) return complete.call(this)
1611
1612 this.$element
1613 [dimension](0)
1614 .one('bsTransitionEnd', $.proxy(complete, this))
1615 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
1616 }
1617
1618 Collapse.prototype.toggle = function () {
1619 this[this.$element.hasClass('in') ? 'hide' : 'show']()
1620 }
1621
1622 Collapse.prototype.getParent = function () {
1623 return $(this.options.parent)
1624 .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
1625 .each($.proxy(function (i, element) {
1626 var $element = $(element)
1627 this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
1628 }, this))
1629 .end()
1630 }
1631
1632 Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
1633 var isOpen = $element.hasClass('in')
1634
1635 $element.attr('aria-expanded', isOpen)
1636 $trigger
1637 .toggleClass('collapsed', !isOpen)
1638 .attr('aria-expanded', isOpen)
1639 }
1640
1641 function getTargetFromTrigger($trigger) {
1642 var href
1643 var target = $trigger.attr('data-target')
1644 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
1645
1646 return $(target)
1647 }
1648
1649
1650 // COLLAPSE PLUGIN DEFINITION
1651 // ==========================
1652
1653 function Plugin(option) {
1654 return this.each(function () {
1655 var $this = $(this)
1656 var data = $this.data('bs.collapse')
1657 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
1658
1659 if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
1660 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
1661 if (typeof option == 'string') data[option]()
1662 })
1663 }
1664
1665 var old = $.fn.collapse
1666
1667 $.fn.collapse = Plugin
1668 $.fn.collapse.Constructor = Collapse
1669
1670
1671 // COLLAPSE NO CONFLICT
1672 // ====================
1673
1674 $.fn.collapse.noConflict = function () {
1675 $.fn.collapse = old
1676 return this
1677 }
1678
1679
1680 // COLLAPSE DATA-API
1681 // =================
1682
1683 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
1684 var $this = $(this)
1685
1686 if (!$this.attr('data-target')) e.preventDefault()
1687
1688 var $target = getTargetFromTrigger($this)
1689 var data = $target.data('bs.collapse')
1690 var option = data ? 'toggle' : $this.data()
1691
1692 Plugin.call($target, option)
1693 })
1694
1695}(jQuery);
1696
1697/* ========================================================================
1698 * Bootstrap: dropdown.js v3.3.7
1699 * http://getbootstrap.com/javascript/#dropdowns
1700 * ========================================================================
1701 * Copyright 2011-2016 Twitter, Inc.
1702 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1703 * ======================================================================== */
1704
1705
1706+function ($) {
1707 'use strict';
1708
1709 // DROPDOWN CLASS DEFINITION
1710 // =========================
1711
1712 var backdrop = '.dropdown-backdrop'
1713 var toggle = '[data-toggle="dropdown"]'
1714 var Dropdown = function (element) {
1715 $(element).on('click.bs.dropdown', this.toggle)
1716 }
1717
1718 Dropdown.VERSION = '3.3.7'
1719
1720 function getParent($this) {
1721 var selector = $this.attr('data-target')
1722
1723 if (!selector) {
1724 selector = $this.attr('href')
1725 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1726 }
1727
1728 var $parent = selector && $(selector)
1729
1730 return $parent && $parent.length ? $parent : $this.parent()
1731 }
1732
1733 function clearMenus(e) {
1734 if (e && e.which === 3) return
1735 $(backdrop).remove()
1736 $(toggle).each(function () {
1737 var $this = $(this)
1738 var $parent = getParent($this)
1739 var relatedTarget = { relatedTarget: this }
1740
1741 if (!$parent.hasClass('open')) return
1742
1743 if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
1744
1745 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
1746
1747 if (e.isDefaultPrevented()) return
1748
1749 $this.attr('aria-expanded', 'false')
1750 $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
1751 })
1752 }
1753
1754 Dropdown.prototype.toggle = function (e) {
1755 var $this = $(this)
1756
1757 if ($this.is('.disabled, :disabled')) return
1758
1759 var $parent = getParent($this)
1760 var isActive = $parent.hasClass('open')
1761
1762 clearMenus()
1763
1764 if (!isActive) {
1765 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
1766 // if mobile we use a backdrop because click events don't delegate
1767 $(document.createElement('div'))
1768 .addClass('dropdown-backdrop')
1769 .insertAfter($(this))
1770 .on('click', clearMenus)
1771 }
1772
1773 var relatedTarget = { relatedTarget: this }
1774 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
1775
1776 if (e.isDefaultPrevented()) return
1777
1778 $this
1779 .trigger('focus')
1780 .attr('aria-expanded', 'true')
1781
1782 $parent
1783 .toggleClass('open')
1784 .trigger($.Event('shown.bs.dropdown', relatedTarget))
1785 }
1786
1787 return false
1788 }
1789
1790 Dropdown.prototype.keydown = function (e) {
1791 if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
1792
1793 var $this = $(this)
1794
1795 e.preventDefault()
1796 e.stopPropagation()
1797
1798 if ($this.is('.disabled, :disabled')) return
1799
1800 var $parent = getParent($this)
1801 var isActive = $parent.hasClass('open')
1802
1803 if (!isActive && e.which != 27 || isActive && e.which == 27) {
1804 if (e.which == 27) $parent.find(toggle).trigger('focus')
1805 return $this.trigger('click')
1806 }
1807
1808 var desc = ' li:not(.disabled):visible a'
1809 var $items = $parent.find('.dropdown-menu' + desc)
1810
1811 if (!$items.length) return
1812
1813 var index = $items.index(e.target)
1814
1815 if (e.which == 38 && index > 0) index-- // up
1816 if (e.which == 40 && index < $items.length - 1) index++ // down
1817 if (!~index) index = 0
1818
1819 $items.eq(index).trigger('focus')
1820 }
1821
1822
1823 // DROPDOWN PLUGIN DEFINITION
1824 // ==========================
1825
1826 function Plugin(option) {
1827 return this.each(function () {
1828 var $this = $(this)
1829 var data = $this.data('bs.dropdown')
1830
1831 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
1832 if (typeof option == 'string') data[option].call($this)
1833 })
1834 }
1835
1836 var old = $.fn.dropdown
1837
1838 $.fn.dropdown = Plugin
1839 $.fn.dropdown.Constructor = Dropdown
1840
1841
1842 // DROPDOWN NO CONFLICT
1843 // ====================
1844
1845 $.fn.dropdown.noConflict = function () {
1846 $.fn.dropdown = old
1847 return this
1848 }
1849
1850
1851 // APPLY TO STANDARD DROPDOWN ELEMENTS
1852 // ===================================
1853
1854 $(document)
1855 .on('click.bs.dropdown.data-api', clearMenus)
1856 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
1857 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
1858 .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
1859 .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
1860
1861}(jQuery);
1862
1863/* ========================================================================
1864 * Bootstrap: modal.js v3.3.7
1865 * http://getbootstrap.com/javascript/#modals
1866 * ========================================================================
1867 * Copyright 2011-2016 Twitter, Inc.
1868 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1869 * ======================================================================== */
1870
1871
1872+function ($) {
1873 'use strict';
1874
1875 // MODAL CLASS DEFINITION
1876 // ======================
1877
1878 var Modal = function (element, options) {
1879 this.options = options
1880 this.$body = $(document.body)
1881 this.$element = $(element)
1882 this.$dialog = this.$element.find('.modal-dialog')
1883 this.$backdrop = null
1884 this.isShown = null
1885 this.originalBodyPad = null
1886 this.scrollbarWidth = 0
1887 this.ignoreBackdropClick = false
1888
1889 if (this.options.remote) {
1890 this.$element
1891 .find('.modal-content')
1892 .load(this.options.remote, $.proxy(function () {
1893 this.$element.trigger('loaded.bs.modal')
1894 }, this))
1895 }
1896 }
1897
1898 Modal.VERSION = '3.3.7'
1899
1900 Modal.TRANSITION_DURATION = 300
1901 Modal.BACKDROP_TRANSITION_DURATION = 150
1902
1903 Modal.DEFAULTS = {
1904 backdrop: true,
1905 keyboard: true,
1906 show: true
1907 }
1908
1909 Modal.prototype.toggle = function (_relatedTarget) {
1910 return this.isShown ? this.hide() : this.show(_relatedTarget)
1911 }
1912
1913 Modal.prototype.show = function (_relatedTarget) {
1914 var that = this
1915 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
1916
1917 this.$element.trigger(e)
1918
1919 if (this.isShown || e.isDefaultPrevented()) return
1920
1921 this.isShown = true
1922
1923 this.checkScrollbar()
1924 this.setScrollbar()
1925 this.$body.addClass('modal-open')
1926
1927 this.escape()
1928 this.resize()
1929
1930 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
1931
1932 this.$dialog.on('mousedown.dismiss.bs.modal', function () {
1933 that.$element.one('mouseup.dismiss.bs.modal', function (e) {
1934 if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
1935 })
1936 })
1937
1938 this.backdrop(function () {
1939 var transition = $.support.transition && that.$element.hasClass('fade')
1940
1941 if (!that.$element.parent().length) {
1942 that.$element.appendTo(that.$body) // don't move modals dom position
1943 }
1944
1945 that.$element
1946 .show()
1947 .scrollTop(0)
1948
1949 that.adjustDialog()
1950
1951 if (transition) {
1952 that.$element[0].offsetWidth // force reflow
1953 }
1954
1955 that.$element.addClass('in')
1956
1957 that.enforceFocus()
1958
1959 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
1960
1961 transition ?
1962 that.$dialog // wait for modal to slide in
1963 .one('bsTransitionEnd', function () {
1964 that.$element.trigger('focus').trigger(e)
1965 })
1966 .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
1967 that.$element.trigger('focus').trigger(e)
1968 })
1969 }
1970
1971 Modal.prototype.hide = function (e) {
1972 if (e) e.preventDefault()
1973
1974 e = $.Event('hide.bs.modal')
1975
1976 this.$element.trigger(e)
1977
1978 if (!this.isShown || e.isDefaultPrevented()) return
1979
1980 this.isShown = false
1981
1982 this.escape()
1983 this.resize()
1984
1985 $(document).off('focusin.bs.modal')
1986
1987 this.$element
1988 .removeClass('in')
1989 .off('click.dismiss.bs.modal')
1990 .off('mouseup.dismiss.bs.modal')
1991
1992 this.$dialog.off('mousedown.dismiss.bs.modal')
1993
1994 $.support.transition && this.$element.hasClass('fade') ?
1995 this.$element
1996 .one('bsTransitionEnd', $.proxy(this.hideModal, this))
1997 .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
1998 this.hideModal()
1999 }
2000
2001 Modal.prototype.enforceFocus = function () {
2002 $(document)
2003 .off('focusin.bs.modal') // guard against infinite focus loop
2004 .on('focusin.bs.modal', $.proxy(function (e) {
2005 if (document !== e.target &&
2006 this.$element[0] !== e.target &&
2007 !this.$element.has(e.target).length) {
2008 this.$element.trigger('focus')
2009 }
2010 }, this))
2011 }
2012
2013 Modal.prototype.escape = function () {
2014 if (this.isShown && this.options.keyboard) {
2015 this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
2016 e.which == 27 && this.hide()
2017 }, this))
2018 } else if (!this.isShown) {
2019 this.$element.off('keydown.dismiss.bs.modal')
2020 }
2021 }
2022
2023 Modal.prototype.resize = function () {
2024 if (this.isShown) {
2025 $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
2026 } else {
2027 $(window).off('resize.bs.modal')
2028 }
2029 }
2030
2031 Modal.prototype.hideModal = function () {
2032 var that = this
2033 this.$element.hide()
2034 this.backdrop(function () {
2035 that.$body.removeClass('modal-open')
2036 that.resetAdjustments()
2037 that.resetScrollbar()
2038 that.$element.trigger('hidden.bs.modal')
2039 })
2040 }
2041
2042 Modal.prototype.removeBackdrop = function () {
2043 this.$backdrop && this.$backdrop.remove()
2044 this.$backdrop = null
2045 }
2046
2047 Modal.prototype.backdrop = function (callback) {
2048 var that = this
2049 var animate = this.$element.hasClass('fade') ? 'fade' : ''
2050
2051 if (this.isShown && this.options.backdrop) {
2052 var doAnimate = $.support.transition && animate
2053
2054 this.$backdrop = $(document.createElement('div'))
2055 .addClass('modal-backdrop ' + animate)
2056 .appendTo(this.$body)
2057
2058 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
2059 if (this.ignoreBackdropClick) {
2060 this.ignoreBackdropClick = false
2061 return
2062 }
2063 if (e.target !== e.currentTarget) return
2064 this.options.backdrop == 'static'
2065 ? this.$element[0].focus()
2066 : this.hide()
2067 }, this))
2068
2069 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
2070
2071 this.$backdrop.addClass('in')
2072
2073 if (!callback) return
2074
2075 doAnimate ?
2076 this.$backdrop
2077 .one('bsTransitionEnd', callback)
2078 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
2079 callback()
2080
2081 } else if (!this.isShown && this.$backdrop) {
2082 this.$backdrop.removeClass('in')
2083
2084 var callbackRemove = function () {
2085 that.removeBackdrop()
2086 callback && callback()
2087 }
2088 $.support.transition && this.$element.hasClass('fade') ?
2089 this.$backdrop
2090 .one('bsTransitionEnd', callbackRemove)
2091 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
2092 callbackRemove()
2093
2094 } else if (callback) {
2095 callback()
2096 }
2097 }
2098
2099 // these following methods are used to handle overflowing modals
2100
2101 Modal.prototype.handleUpdate = function () {
2102 this.adjustDialog()
2103 }
2104
2105 Modal.prototype.adjustDialog = function () {
2106 var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
2107
2108 this.$element.css({
2109 paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
2110 paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
2111 })
2112 }
2113
2114 Modal.prototype.resetAdjustments = function () {
2115 this.$element.css({
2116 paddingLeft: '',
2117 paddingRight: ''
2118 })
2119 }
2120
2121 Modal.prototype.checkScrollbar = function () {
2122 var fullWindowWidth = window.innerWidth
2123 if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
2124 var documentElementRect = document.documentElement.getBoundingClientRect()
2125 fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
2126 }
2127 this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
2128 this.scrollbarWidth = this.measureScrollbar()
2129 }
2130
2131 Modal.prototype.setScrollbar = function () {
2132 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
2133 this.originalBodyPad = document.body.style.paddingRight || ''
2134 if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
2135 }
2136
2137 Modal.prototype.resetScrollbar = function () {
2138 this.$body.css('padding-right', this.originalBodyPad)
2139 }
2140
2141 Modal.prototype.measureScrollbar = function () { // thx walsh
2142 var scrollDiv = document.createElement('div')
2143 scrollDiv.className = 'modal-scrollbar-measure'
2144 this.$body.append(scrollDiv)
2145 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
2146 this.$body[0].removeChild(scrollDiv)
2147 return scrollbarWidth
2148 }
2149
2150
2151 // MODAL PLUGIN DEFINITION
2152 // =======================
2153
2154 function Plugin(option, _relatedTarget) {
2155 return this.each(function () {
2156 var $this = $(this)
2157 var data = $this.data('bs.modal')
2158 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
2159
2160 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
2161 if (typeof option == 'string') data[option](_relatedTarget)
2162 else if (options.show) data.show(_relatedTarget)
2163 })
2164 }
2165
2166 var old = $.fn.modal
2167
2168 $.fn.modal = Plugin
2169 $.fn.modal.Constructor = Modal
2170
2171
2172 // MODAL NO CONFLICT
2173 // =================
2174
2175 $.fn.modal.noConflict = function () {
2176 $.fn.modal = old
2177 return this
2178 }
2179
2180
2181 // MODAL DATA-API
2182 // ==============
2183
2184 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
2185 var $this = $(this)
2186 var href = $this.attr('href')
2187 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
2188 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
2189
2190 if ($this.is('a')) e.preventDefault()
2191
2192 $target.one('show.bs.modal', function (showEvent) {
2193 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
2194 $target.one('hidden.bs.modal', function () {
2195 $this.is(':visible') && $this.trigger('focus')
2196 })
2197 })
2198 Plugin.call($target, option, this)
2199 })
2200
2201}(jQuery);
2202
2203/* ========================================================================
2204 * Bootstrap: tooltip.js v3.3.7
2205 * http://getbootstrap.com/javascript/#tooltip
2206 * Inspired by the original jQuery.tipsy by Jason Frame
2207 * ========================================================================
2208 * Copyright 2011-2016 Twitter, Inc.
2209 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2210 * ======================================================================== */
2211
2212
2213+function ($) {
2214 'use strict';
2215
2216 // TOOLTIP PUBLIC CLASS DEFINITION
2217 // ===============================
2218
2219 var Tooltip = function (element, options) {
2220 this.type = null
2221 this.options = null
2222 this.enabled = null
2223 this.timeout = null
2224 this.hoverState = null
2225 this.$element = null
2226 this.inState = null
2227
2228 this.init('tooltip', element, options)
2229 }
2230
2231 Tooltip.VERSION = '3.3.7'
2232
2233 Tooltip.TRANSITION_DURATION = 150
2234
2235 Tooltip.DEFAULTS = {
2236 animation: true,
2237 placement: 'top',
2238 selector: false,
2239 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
2240 trigger: 'hover focus',
2241 title: '',
2242 delay: 0,
2243 html: false,
2244 container: false,
2245 viewport: {
2246 selector: 'body',
2247 padding: 0
2248 }
2249 }
2250
2251 Tooltip.prototype.init = function (type, element, options) {
2252 this.enabled = true
2253 this.type = type
2254 this.$element = $(element)
2255 this.options = this.getOptions(options)
2256 this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
2257 this.inState = { click: false, hover: false, focus: false }
2258
2259 if (this.$element[0] instanceof document.constructor && !this.options.selector) {
2260 throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
2261 }
2262
2263 var triggers = this.options.trigger.split(' ')
2264
2265 for (var i = triggers.length; i--;) {
2266 var trigger = triggers[i]
2267
2268 if (trigger == 'click') {
2269 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
2270 } else if (trigger != 'manual') {
2271 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
2272 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
2273
2274 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
2275 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
2276 }
2277 }
2278
2279 this.options.selector ?
2280 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
2281 this.fixTitle()
2282 }
2283
2284 Tooltip.prototype.getDefaults = function () {
2285 return Tooltip.DEFAULTS
2286 }
2287
2288 Tooltip.prototype.getOptions = function (options) {
2289 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
2290
2291 if (options.delay && typeof options.delay == 'number') {
2292 options.delay = {
2293 show: options.delay,
2294 hide: options.delay
2295 }
2296 }
2297
2298 return options
2299 }
2300
2301 Tooltip.prototype.getDelegateOptions = function () {
2302 var options = {}
2303 var defaults = this.getDefaults()
2304
2305 this._options && $.each(this._options, function (key, value) {
2306 if (defaults[key] != value) options[key] = value
2307 })
2308
2309 return options
2310 }
2311
2312 Tooltip.prototype.enter = function (obj) {
2313 var self = obj instanceof this.constructor ?
2314 obj : $(obj.currentTarget).data('bs.' + this.type)
2315
2316 if (!self) {
2317 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
2318 $(obj.currentTarget).data('bs.' + this.type, self)
2319 }
2320
2321 if (obj instanceof $.Event) {
2322 self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
2323 }
2324
2325 if (self.tip().hasClass('in') || self.hoverState == 'in') {
2326 self.hoverState = 'in'
2327 return
2328 }
2329
2330 clearTimeout(self.timeout)
2331
2332 self.hoverState = 'in'
2333
2334 if (!self.options.delay || !self.options.delay.show) return self.show()
2335
2336 self.timeout = setTimeout(function () {
2337 if (self.hoverState == 'in') self.show()
2338 }, self.options.delay.show)
2339 }
2340
2341 Tooltip.prototype.isInStateTrue = function () {
2342 for (var key in this.inState) {
2343 if (this.inState[key]) return true
2344 }
2345
2346 return false
2347 }
2348
2349 Tooltip.prototype.leave = function (obj) {
2350 var self = obj instanceof this.constructor ?
2351 obj : $(obj.currentTarget).data('bs.' + this.type)
2352
2353 if (!self) {
2354 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
2355 $(obj.currentTarget).data('bs.' + this.type, self)
2356 }
2357
2358 if (obj instanceof $.Event) {
2359 self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
2360 }
2361
2362 if (self.isInStateTrue()) return
2363
2364 clearTimeout(self.timeout)
2365
2366 self.hoverState = 'out'
2367
2368 if (!self.options.delay || !self.options.delay.hide) return self.hide()
2369
2370 self.timeout = setTimeout(function () {
2371 if (self.hoverState == 'out') self.hide()
2372 }, self.options.delay.hide)
2373 }
2374
2375 Tooltip.prototype.show = function () {
2376 var e = $.Event('show.bs.' + this.type)
2377
2378 if (this.hasContent() && this.enabled) {
2379 this.$element.trigger(e)
2380
2381 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
2382 if (e.isDefaultPrevented() || !inDom) return
2383 var that = this
2384
2385 var $tip = this.tip()
2386
2387 var tipId = this.getUID(this.type)
2388
2389 this.setContent()
2390 $tip.attr('id', tipId)
2391 this.$element.attr('aria-describedby', tipId)
2392
2393 if (this.options.animation) $tip.addClass('fade')
2394
2395 var placement = typeof this.options.placement == 'function' ?
2396 this.options.placement.call(this, $tip[0], this.$element[0]) :
2397 this.options.placement
2398
2399 var autoToken = /\s?auto?\s?/i
2400 var autoPlace = autoToken.test(placement)
2401 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
2402
2403 $tip
2404 .detach()
2405 .css({ top: 0, left: 0, display: 'block' })
2406 .addClass(placement)
2407 .data('bs.' + this.type, this)
2408
2409 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
2410 this.$element.trigger('inserted.bs.' + this.type)
2411
2412 var pos = this.getPosition()
2413 var actualWidth = $tip[0].offsetWidth
2414 var actualHeight = $tip[0].offsetHeight
2415
2416 if (autoPlace) {
2417 var orgPlacement = placement
2418 var viewportDim = this.getPosition(this.$viewport)
2419
2420 placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
2421 placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
2422 placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
2423 placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
2424 placement
2425
2426 $tip
2427 .removeClass(orgPlacement)
2428 .addClass(placement)
2429 }
2430
2431 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
2432
2433 this.applyPlacement(calculatedOffset, placement)
2434
2435 var complete = function () {
2436 var prevHoverState = that.hoverState
2437 that.$element.trigger('shown.bs.' + that.type)
2438 that.hoverState = null
2439
2440 if (prevHoverState == 'out') that.leave(that)
2441 }
2442
2443 $.support.transition && this.$tip.hasClass('fade') ?
2444 $tip
2445 .one('bsTransitionEnd', complete)
2446 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
2447 complete()
2448 }
2449 }
2450
2451 Tooltip.prototype.applyPlacement = function (offset, placement) {
2452 var $tip = this.tip()
2453 var width = $tip[0].offsetWidth
2454 var height = $tip[0].offsetHeight
2455
2456 // manually read margins because getBoundingClientRect includes difference
2457 var marginTop = parseInt($tip.css('margin-top'), 10)
2458 var marginLeft = parseInt($tip.css('margin-left'), 10)
2459
2460 // we must check for NaN for ie 8/9
2461 if (isNaN(marginTop)) marginTop = 0
2462 if (isNaN(marginLeft)) marginLeft = 0
2463
2464 offset.top += marginTop
2465 offset.left += marginLeft
2466
2467 // $.fn.offset doesn't round pixel values
2468 // so we use setOffset directly with our own function B-0
2469 $.offset.setOffset($tip[0], $.extend({
2470 using: function (props) {
2471 $tip.css({
2472 top: Math.round(props.top),
2473 left: Math.round(props.left)
2474 })
2475 }
2476 }, offset), 0)
2477
2478 $tip.addClass('in')
2479
2480 // check to see if placing tip in new offset caused the tip to resize itself
2481 var actualWidth = $tip[0].offsetWidth
2482 var actualHeight = $tip[0].offsetHeight
2483
2484 if (placement == 'top' && actualHeight != height) {
2485 offset.top = offset.top + height - actualHeight
2486 }
2487
2488 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
2489
2490 if (delta.left) offset.left += delta.left
2491 else offset.top += delta.top
2492
2493 var isVertical = /top|bottom/.test(placement)
2494 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
2495 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
2496
2497 $tip.offset(offset)
2498 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
2499 }
2500
2501 Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
2502 this.arrow()
2503 .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
2504 .css(isVertical ? 'top' : 'left', '')
2505 }
2506
2507 Tooltip.prototype.setContent = function () {
2508 var $tip = this.tip()
2509 var title = this.getTitle()
2510
2511 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
2512 $tip.removeClass('fade in top bottom left right')
2513 }
2514
2515 Tooltip.prototype.hide = function (callback) {
2516 var that = this
2517 var $tip = $(this.$tip)
2518 var e = $.Event('hide.bs.' + this.type)
2519
2520 function complete() {
2521 if (that.hoverState != 'in') $tip.detach()
2522 if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
2523 that.$element
2524 .removeAttr('aria-describedby')
2525 .trigger('hidden.bs.' + that.type)
2526 }
2527 callback && callback()
2528 }
2529
2530 this.$element.trigger(e)
2531
2532 if (e.isDefaultPrevented()) return
2533
2534 $tip.removeClass('in')
2535
2536 $.support.transition && $tip.hasClass('fade') ?
2537 $tip
2538 .one('bsTransitionEnd', complete)
2539 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
2540 complete()
2541
2542 this.hoverState = null
2543
2544 return this
2545 }
2546
2547 Tooltip.prototype.fixTitle = function () {
2548 var $e = this.$element
2549 if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
2550 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
2551 }
2552 }
2553
2554 Tooltip.prototype.hasContent = function () {
2555 return this.getTitle()
2556 }
2557
2558 Tooltip.prototype.getPosition = function ($element) {
2559 $element = $element || this.$element
2560
2561 var el = $element[0]
2562 var isBody = el.tagName == 'BODY'
2563
2564 var elRect = el.getBoundingClientRect()
2565 if (elRect.width == null) {
2566 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
2567 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
2568 }
2569 var isSvg = window.SVGElement && el instanceof window.SVGElement
2570 // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
2571 // See https://github.com/twbs/bootstrap/issues/20280
2572 var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
2573 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
2574 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
2575
2576 return $.extend({}, elRect, scroll, outerDims, elOffset)
2577 }
2578
2579 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
2580 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
2581 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
2582 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
2583 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
2584
2585 }
2586
2587 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
2588 var delta = { top: 0, left: 0 }
2589 if (!this.$viewport) return delta
2590
2591 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
2592 var viewportDimensions = this.getPosition(this.$viewport)
2593
2594 if (/right|left/.test(placement)) {
2595 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
2596 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
2597 if (topEdgeOffset < viewportDimensions.top) { // top overflow
2598 delta.top = viewportDimensions.top - topEdgeOffset
2599 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
2600 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
2601 }
2602 } else {
2603 var leftEdgeOffset = pos.left - viewportPadding
2604 var rightEdgeOffset = pos.left + viewportPadding + actualWidth
2605 if (leftEdgeOffset < viewportDimensions.left) { // left overflow
2606 delta.left = viewportDimensions.left - leftEdgeOffset
2607 } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
2608 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
2609 }
2610 }
2611
2612 return delta
2613 }
2614
2615 Tooltip.prototype.getTitle = function () {
2616 var title
2617 var $e = this.$element
2618 var o = this.options
2619
2620 title = $e.attr('data-original-title')
2621 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
2622
2623 return title
2624 }
2625
2626 Tooltip.prototype.getUID = function (prefix) {
2627 do prefix += ~~(Math.random() * 1000000)
2628 while (document.getElementById(prefix))
2629 return prefix
2630 }
2631
2632 Tooltip.prototype.tip = function () {
2633 if (!this.$tip) {
2634 this.$tip = $(this.options.template)
2635 if (this.$tip.length != 1) {
2636 throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
2637 }
2638 }
2639 return this.$tip
2640 }
2641
2642 Tooltip.prototype.arrow = function () {
2643 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
2644 }
2645
2646 Tooltip.prototype.enable = function () {
2647 this.enabled = true
2648 }
2649
2650 Tooltip.prototype.disable = function () {
2651 this.enabled = false
2652 }
2653
2654 Tooltip.prototype.toggleEnabled = function () {
2655 this.enabled = !this.enabled
2656 }
2657
2658 Tooltip.prototype.toggle = function (e) {
2659 var self = this
2660 if (e) {
2661 self = $(e.currentTarget).data('bs.' + this.type)
2662 if (!self) {
2663 self = new this.constructor(e.currentTarget, this.getDelegateOptions())
2664 $(e.currentTarget).data('bs.' + this.type, self)
2665 }
2666 }
2667
2668 if (e) {
2669 self.inState.click = !self.inState.click
2670 if (self.isInStateTrue()) self.enter(self)
2671 else self.leave(self)
2672 } else {
2673 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
2674 }
2675 }
2676
2677 Tooltip.prototype.destroy = function () {
2678 var that = this
2679 clearTimeout(this.timeout)
2680 this.hide(function () {
2681 that.$element.off('.' + that.type).removeData('bs.' + that.type)
2682 if (that.$tip) {
2683 that.$tip.detach()
2684 }
2685 that.$tip = null
2686 that.$arrow = null
2687 that.$viewport = null
2688 that.$element = null
2689 })
2690 }
2691
2692
2693 // TOOLTIP PLUGIN DEFINITION
2694 // =========================
2695
2696 function Plugin(option) {
2697 return this.each(function () {
2698 var $this = $(this)
2699 var data = $this.data('bs.tooltip')
2700 var options = typeof option == 'object' && option
2701
2702 if (!data && /destroy|hide/.test(option)) return
2703 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
2704 if (typeof option == 'string') data[option]()
2705 })
2706 }
2707
2708 var old = $.fn.tooltip
2709
2710 $.fn.tooltip = Plugin
2711 $.fn.tooltip.Constructor = Tooltip
2712
2713
2714 // TOOLTIP NO CONFLICT
2715 // ===================
2716
2717 $.fn.tooltip.noConflict = function () {
2718 $.fn.tooltip = old
2719 return this
2720 }
2721
2722}(jQuery);
2723
2724/* ========================================================================
2725 * Bootstrap: popover.js v3.3.7
2726 * http://getbootstrap.com/javascript/#popovers
2727 * ========================================================================
2728 * Copyright 2011-2016 Twitter, Inc.
2729 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2730 * ======================================================================== */
2731
2732
2733+function ($) {
2734 'use strict';
2735
2736 // POPOVER PUBLIC CLASS DEFINITION
2737 // ===============================
2738
2739 var Popover = function (element, options) {
2740 this.init('popover', element, options)
2741 }
2742
2743 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
2744
2745 Popover.VERSION = '3.3.7'
2746
2747 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
2748 placement: 'right',
2749 trigger: 'click',
2750 content: '',
2751 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
2752 })
2753
2754
2755 // NOTE: POPOVER EXTENDS tooltip.js
2756 // ================================
2757
2758 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
2759
2760 Popover.prototype.constructor = Popover
2761
2762 Popover.prototype.getDefaults = function () {
2763 return Popover.DEFAULTS
2764 }
2765
2766 Popover.prototype.setContent = function () {
2767 var $tip = this.tip()
2768 var title = this.getTitle()
2769 var content = this.getContent()
2770
2771 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
2772 $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
2773 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
2774 ](content)
2775
2776 $tip.removeClass('fade top bottom left right in')
2777
2778 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
2779 // this manually by checking the contents.
2780 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
2781 }
2782
2783 Popover.prototype.hasContent = function () {
2784 return this.getTitle() || this.getContent()
2785 }
2786
2787 Popover.prototype.getContent = function () {
2788 var $e = this.$element
2789 var o = this.options
2790
2791 return $e.attr('data-content')
2792 || (typeof o.content == 'function' ?
2793 o.content.call($e[0]) :
2794 o.content)
2795 }
2796
2797 Popover.prototype.arrow = function () {
2798 return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
2799 }
2800
2801
2802 // POPOVER PLUGIN DEFINITION
2803 // =========================
2804
2805 function Plugin(option) {
2806 return this.each(function () {
2807 var $this = $(this)
2808 var data = $this.data('bs.popover')
2809 var options = typeof option == 'object' && option
2810
2811 if (!data && /destroy|hide/.test(option)) return
2812 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
2813 if (typeof option == 'string') data[option]()
2814 })
2815 }
2816
2817 var old = $.fn.popover
2818
2819 $.fn.popover = Plugin
2820 $.fn.popover.Constructor = Popover
2821
2822
2823 // POPOVER NO CONFLICT
2824 // ===================
2825
2826 $.fn.popover.noConflict = function () {
2827 $.fn.popover = old
2828 return this
2829 }
2830
2831}(jQuery);
2832
2833/* ========================================================================
2834 * Bootstrap: scrollspy.js v3.3.7
2835 * http://getbootstrap.com/javascript/#scrollspy
2836 * ========================================================================
2837 * Copyright 2011-2016 Twitter, Inc.
2838 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2839 * ======================================================================== */
2840
2841
2842+function ($) {
2843 'use strict';
2844
2845 // SCROLLSPY CLASS DEFINITION
2846 // ==========================
2847
2848 function ScrollSpy(element, options) {
2849 this.$body = $(document.body)
2850 this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
2851 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
2852 this.selector = (this.options.target || '') + ' .nav li > a'
2853 this.offsets = []
2854 this.targets = []
2855 this.activeTarget = null
2856 this.scrollHeight = 0
2857
2858 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
2859 this.refresh()
2860 this.process()
2861 }
2862
2863 ScrollSpy.VERSION = '3.3.7'
2864
2865 ScrollSpy.DEFAULTS = {
2866 offset: 10
2867 }
2868
2869 ScrollSpy.prototype.getScrollHeight = function () {
2870 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
2871 }
2872
2873 ScrollSpy.prototype.refresh = function () {
2874 var that = this
2875 var offsetMethod = 'offset'
2876 var offsetBase = 0
2877
2878 this.offsets = []
2879 this.targets = []
2880 this.scrollHeight = this.getScrollHeight()
2881
2882 if (!$.isWindow(this.$scrollElement[0])) {
2883 offsetMethod = 'position'
2884 offsetBase = this.$scrollElement.scrollTop()
2885 }
2886
2887 this.$body
2888 .find(this.selector)
2889 .map(function () {
2890 var $el = $(this)
2891 var href = $el.data('target') || $el.attr('href')
2892 var $href = /^#./.test(href) && $(href)
2893
2894 return ($href
2895 && $href.length
2896 && $href.is(':visible')
2897 && [[$href[offsetMethod]().top + offsetBase, href]]) || null
2898 })
2899 .sort(function (a, b) { return a[0] - b[0] })
2900 .each(function () {
2901 that.offsets.push(this[0])
2902 that.targets.push(this[1])
2903 })
2904 }
2905
2906 ScrollSpy.prototype.process = function () {
2907 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
2908 var scrollHeight = this.getScrollHeight()
2909 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
2910 var offsets = this.offsets
2911 var targets = this.targets
2912 var activeTarget = this.activeTarget
2913 var i
2914
2915 if (this.scrollHeight != scrollHeight) {
2916 this.refresh()
2917 }
2918
2919 if (scrollTop >= maxScroll) {
2920 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
2921 }
2922
2923 if (activeTarget && scrollTop < offsets[0]) {
2924 this.activeTarget = null
2925 return this.clear()
2926 }
2927
2928 for (i = offsets.length; i--;) {
2929 activeTarget != targets[i]
2930 && scrollTop >= offsets[i]
2931 && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
2932 && this.activate(targets[i])
2933 }
2934 }
2935
2936 ScrollSpy.prototype.activate = function (target) {
2937 this.activeTarget = target
2938
2939 this.clear()
2940
2941 var selector = this.selector +
2942 '[data-target="' + target + '"],' +
2943 this.selector + '[href="' + target + '"]'
2944
2945 var active = $(selector)
2946 .parents('li')
2947 .addClass('active')
2948
2949 if (active.parent('.dropdown-menu').length) {
2950 active = active
2951 .closest('li.dropdown')
2952 .addClass('active')
2953 }
2954
2955 active.trigger('activate.bs.scrollspy')
2956 }
2957
2958 ScrollSpy.prototype.clear = function () {
2959 $(this.selector)
2960 .parentsUntil(this.options.target, '.active')
2961 .removeClass('active')
2962 }
2963
2964
2965 // SCROLLSPY PLUGIN DEFINITION
2966 // ===========================
2967
2968 function Plugin(option) {
2969 return this.each(function () {
2970 var $this = $(this)
2971 var data = $this.data('bs.scrollspy')
2972 var options = typeof option == 'object' && option
2973
2974 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
2975 if (typeof option == 'string') data[option]()
2976 })
2977 }
2978
2979 var old = $.fn.scrollspy
2980
2981 $.fn.scrollspy = Plugin
2982 $.fn.scrollspy.Constructor = ScrollSpy
2983
2984
2985 // SCROLLSPY NO CONFLICT
2986 // =====================
2987
2988 $.fn.scrollspy.noConflict = function () {
2989 $.fn.scrollspy = old
2990 return this
2991 }
2992
2993
2994 // SCROLLSPY DATA-API
2995 // ==================
2996
2997 $(window).on('load.bs.scrollspy.data-api', function () {
2998 $('[data-spy="scroll"]').each(function () {
2999 var $spy = $(this)
3000 Plugin.call($spy, $spy.data())
3001 })
3002 })
3003
3004}(jQuery);
3005
3006/* ========================================================================
3007 * Bootstrap: tab.js v3.3.7
3008 * http://getbootstrap.com/javascript/#tabs
3009 * ========================================================================
3010 * Copyright 2011-2016 Twitter, Inc.
3011 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
3012 * ======================================================================== */
3013
3014
3015+function ($) {
3016 'use strict';
3017
3018 // TAB CLASS DEFINITION
3019 // ====================
3020
3021 var Tab = function (element) {
3022 // jscs:disable requireDollarBeforejQueryAssignment
3023 this.element = $(element)
3024 // jscs:enable requireDollarBeforejQueryAssignment
3025 }
3026
3027 Tab.VERSION = '3.3.7'
3028
3029 Tab.TRANSITION_DURATION = 150
3030
3031 Tab.prototype.show = function () {
3032 var $this = this.element
3033 var $ul = $this.closest('ul:not(.dropdown-menu)')
3034 var selector = $this.data('target')
3035
3036 if (!selector) {
3037 selector = $this.attr('href')
3038 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
3039 }
3040
3041 if ($this.parent('li').hasClass('active')) return
3042
3043 var $previous = $ul.find('.active:last a')
3044 var hideEvent = $.Event('hide.bs.tab', {
3045 relatedTarget: $this[0]
3046 })
3047 var showEvent = $.Event('show.bs.tab', {
3048 relatedTarget: $previous[0]
3049 })
3050
3051 $previous.trigger(hideEvent)
3052 $this.trigger(showEvent)
3053
3054 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
3055
3056 var $target = $(selector)
3057
3058 this.activate($this.closest('li'), $ul)
3059 this.activate($target, $target.parent(), function () {
3060 $previous.trigger({
3061 type: 'hidden.bs.tab',
3062 relatedTarget: $this[0]
3063 })
3064 $this.trigger({
3065 type: 'shown.bs.tab',
3066 relatedTarget: $previous[0]
3067 })
3068 })
3069 }
3070
3071 Tab.prototype.activate = function (element, container, callback) {
3072 var $active = container.find('> .active')
3073 var transition = callback
3074 && $.support.transition
3075 && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
3076
3077 function next() {
3078 $active
3079 .removeClass('active')
3080 .find('> .dropdown-menu > .active')
3081 .removeClass('active')
3082 .end()
3083 .find('[data-toggle="tab"]')
3084 .attr('aria-expanded', false)
3085
3086 element
3087 .addClass('active')
3088 .find('[data-toggle="tab"]')
3089 .attr('aria-expanded', true)
3090
3091 if (transition) {
3092 element[0].offsetWidth // reflow for transition
3093 element.addClass('in')
3094 } else {
3095 element.removeClass('fade')
3096 }
3097
3098 if (element.parent('.dropdown-menu').length) {
3099 element
3100 .closest('li.dropdown')
3101 .addClass('active')
3102 .end()
3103 .find('[data-toggle="tab"]')
3104 .attr('aria-expanded', true)
3105 }
3106
3107 callback && callback()
3108 }
3109
3110 $active.length && transition ?
3111 $active
3112 .one('bsTransitionEnd', next)
3113 .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
3114 next()
3115
3116 $active.removeClass('in')
3117 }
3118
3119
3120 // TAB PLUGIN DEFINITION
3121 // =====================
3122
3123 function Plugin(option) {
3124 return this.each(function () {
3125 var $this = $(this)
3126 var data = $this.data('bs.tab')
3127
3128 if (!data) $this.data('bs.tab', (data = new Tab(this)))
3129 if (typeof option == 'string') data[option]()
3130 })
3131 }
3132
3133 var old = $.fn.tab
3134
3135 $.fn.tab = Plugin
3136 $.fn.tab.Constructor = Tab
3137
3138
3139 // TAB NO CONFLICT
3140 // ===============
3141
3142 $.fn.tab.noConflict = function () {
3143 $.fn.tab = old
3144 return this
3145 }
3146
3147
3148 // TAB DATA-API
3149 // ============
3150
3151 var clickHandler = function (e) {
3152 e.preventDefault()
3153 Plugin.call($(this), 'show')
3154 }
3155
3156 $(document)
3157 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
3158 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
3159
3160}(jQuery);
3161
3162/* ========================================================================
3163 * Bootstrap: affix.js v3.3.7
3164 * http://getbootstrap.com/javascript/#affix
3165 * ========================================================================
3166 * Copyright 2011-2016 Twitter, Inc.
3167 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
3168 * ======================================================================== */
3169
3170
3171+function ($) {
3172 'use strict';
3173
3174 // AFFIX CLASS DEFINITION
3175 // ======================
3176
3177 var Affix = function (element, options) {
3178 this.options = $.extend({}, Affix.DEFAULTS, options)
3179
3180 this.$target = $(this.options.target)
3181 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
3182 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
3183
3184 this.$element = $(element)
3185 this.affixed = null
3186 this.unpin = null
3187 this.pinnedOffset = null
3188
3189 this.checkPosition()
3190 }
3191
3192 Affix.VERSION = '3.3.7'
3193
3194 Affix.RESET = 'affix affix-top affix-bottom'
3195
3196 Affix.DEFAULTS = {
3197 offset: 0,
3198 target: window
3199 }
3200
3201 Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
3202 var scrollTop = this.$target.scrollTop()
3203 var position = this.$element.offset()
3204 var targetHeight = this.$target.height()
3205
3206 if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
3207
3208 if (this.affixed == 'bottom') {
3209 if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
3210 return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
3211 }
3212
3213 var initializing = this.affixed == null
3214 var colliderTop = initializing ? scrollTop : position.top
3215 var colliderHeight = initializing ? targetHeight : height
3216
3217 if (offsetTop != null && scrollTop <= offsetTop) return 'top'
3218 if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
3219
3220 return false
3221 }
3222
3223 Affix.prototype.getPinnedOffset = function () {
3224 if (this.pinnedOffset) return this.pinnedOffset
3225 this.$element.removeClass(Affix.RESET).addClass('affix')
3226 var scrollTop = this.$target.scrollTop()
3227 var position = this.$element.offset()
3228 return (this.pinnedOffset = position.top - scrollTop)
3229 }
3230
3231 Affix.prototype.checkPositionWithEventLoop = function () {
3232 setTimeout($.proxy(this.checkPosition, this), 1)
3233 }
3234
3235 Affix.prototype.checkPosition = function () {
3236 if (!this.$element.is(':visible')) return
3237
3238 var height = this.$element.height()
3239 var offset = this.options.offset
3240 var offsetTop = offset.top
3241 var offsetBottom = offset.bottom
3242 var scrollHeight = Math.max($(document).height(), $(document.body).height())
3243
3244 if (typeof offset != 'object') offsetBottom = offsetTop = offset
3245 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
3246 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
3247
3248 var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
3249
3250 if (this.affixed != affix) {
3251 if (this.unpin != null) this.$element.css('top', '')
3252
3253 var affixType = 'affix' + (affix ? '-' + affix : '')
3254 var e = $.Event(affixType + '.bs.affix')
3255
3256 this.$element.trigger(e)
3257
3258 if (e.isDefaultPrevented()) return
3259
3260 this.affixed = affix
3261 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
3262
3263 this.$element
3264 .removeClass(Affix.RESET)
3265 .addClass(affixType)
3266 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
3267 }
3268
3269 if (affix == 'bottom') {
3270 this.$element.offset({
3271 top: scrollHeight - height - offsetBottom
3272 })
3273 }
3274 }
3275
3276
3277 // AFFIX PLUGIN DEFINITION
3278 // =======================
3279
3280 function Plugin(option) {
3281 return this.each(function () {
3282 var $this = $(this)
3283 var data = $this.data('bs.affix')
3284 var options = typeof option == 'object' && option
3285
3286 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
3287 if (typeof option == 'string') data[option]()
3288 })
3289 }
3290
3291 var old = $.fn.affix
3292
3293 $.fn.affix = Plugin
3294 $.fn.affix.Constructor = Affix
3295
3296
3297 // AFFIX NO CONFLICT
3298 // =================
3299
3300 $.fn.affix.noConflict = function () {
3301 $.fn.affix = old
3302 return this
3303 }
3304
3305
3306 // AFFIX DATA-API
3307 // ==============
3308
3309 $(window).on('load', function () {
3310 $('[data-spy="affix"]').each(function () {
3311 var $spy = $(this)
3312 var data = $spy.data()
3313
3314 data.offset = data.offset || {}
3315
3316 if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
3317 if (data.offsetTop != null) data.offset.top = data.offsetTop
3318
3319 Plugin.call($spy, data)
3320 })
3321 })
3322
3323}(jQuery);
3324
3325},{}],3:[function(require,module,exports){
3326/*!
3327 * jQuery JavaScript Library v3.1.1
3328 * https://jquery.com/
3329 *
3330 * Includes Sizzle.js
3331 * https://sizzlejs.com/
3332 *
3333 * Copyright jQuery Foundation and other contributors
3334 * Released under the MIT license
3335 * https://jquery.org/license
3336 *
3337 * Date: 2016-09-22T22:30Z
3338 */
3339( function( global, factory ) {
3340
3341 "use strict";
3342
3343 if ( typeof module === "object" && typeof module.exports === "object" ) {
3344
3345 // For CommonJS and CommonJS-like environments where a proper `window`
3346 // is present, execute the factory and get jQuery.
3347 // For environments that do not have a `window` with a `document`
3348 // (such as Node.js), expose a factory as module.exports.
3349 // This accentuates the need for the creation of a real `window`.
3350 // e.g. var jQuery = require("jquery")(window);
3351 // See ticket #14549 for more info.
3352 module.exports = global.document ?
3353 factory( global, true ) :
3354 function( w ) {
3355 if ( !w.document ) {
3356 throw new Error( "jQuery requires a window with a document" );
3357 }
3358 return factory( w );
3359 };
3360 } else {
3361 factory( global );
3362 }
3363
3364// Pass this if window is not defined yet
3365} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
3366
3367// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
3368// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
3369// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
3370// enough that all such attempts are guarded in a try block.
3371"use strict";
3372
3373var arr = [];
3374
3375var document = window.document;
3376
3377var getProto = Object.getPrototypeOf;
3378
3379var slice = arr.slice;
3380
3381var concat = arr.concat;
3382
3383var push = arr.push;
3384
3385var indexOf = arr.indexOf;
3386
3387var class2type = {};
3388
3389var toString = class2type.toString;
3390
3391var hasOwn = class2type.hasOwnProperty;
3392
3393var fnToString = hasOwn.toString;
3394
3395var ObjectFunctionString = fnToString.call( Object );
3396
3397var support = {};
3398
3399
3400
3401 function DOMEval( code, doc ) {
3402 doc = doc || document;
3403
3404 var script = doc.createElement( "script" );
3405
3406 script.text = code;
3407 doc.head.appendChild( script ).parentNode.removeChild( script );
3408 }
3409/* global Symbol */
3410// Defining this global in .eslintrc.json would create a danger of using the global
3411// unguarded in another place, it seems safer to define global only for this module
3412
3413
3414
3415var
3416 version = "3.1.1",
3417
3418 // Define a local copy of jQuery
3419 jQuery = function( selector, context ) {
3420
3421 // The jQuery object is actually just the init constructor 'enhanced'
3422 // Need init if jQuery is called (just allow error to be thrown if not included)
3423 return new jQuery.fn.init( selector, context );
3424 },
3425
3426 // Support: Android <=4.0 only
3427 // Make sure we trim BOM and NBSP
3428 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
3429
3430 // Matches dashed string for camelizing
3431 rmsPrefix = /^-ms-/,
3432 rdashAlpha = /-([a-z])/g,
3433
3434 // Used by jQuery.camelCase as callback to replace()
3435 fcamelCase = function( all, letter ) {
3436 return letter.toUpperCase();
3437 };
3438
3439jQuery.fn = jQuery.prototype = {
3440
3441 // The current version of jQuery being used
3442 jquery: version,
3443
3444 constructor: jQuery,
3445
3446 // The default length of a jQuery object is 0
3447 length: 0,
3448
3449 toArray: function() {
3450 return slice.call( this );
3451 },
3452
3453 // Get the Nth element in the matched element set OR
3454 // Get the whole matched element set as a clean array
3455 get: function( num ) {
3456
3457 // Return all the elements in a clean array
3458 if ( num == null ) {
3459 return slice.call( this );
3460 }
3461
3462 // Return just the one element from the set
3463 return num < 0 ? this[ num + this.length ] : this[ num ];
3464 },
3465
3466 // Take an array of elements and push it onto the stack
3467 // (returning the new matched element set)
3468 pushStack: function( elems ) {
3469
3470 // Build a new jQuery matched element set
3471 var ret = jQuery.merge( this.constructor(), elems );
3472
3473 // Add the old object onto the stack (as a reference)
3474 ret.prevObject = this;
3475
3476 // Return the newly-formed element set
3477 return ret;
3478 },
3479
3480 // Execute a callback for every element in the matched set.
3481 each: function( callback ) {
3482 return jQuery.each( this, callback );
3483 },
3484
3485 map: function( callback ) {
3486 return this.pushStack( jQuery.map( this, function( elem, i ) {
3487 return callback.call( elem, i, elem );
3488 } ) );
3489 },
3490
3491 slice: function() {
3492 return this.pushStack( slice.apply( this, arguments ) );
3493 },
3494
3495 first: function() {
3496 return this.eq( 0 );
3497 },
3498
3499 last: function() {
3500 return this.eq( -1 );
3501 },
3502
3503 eq: function( i ) {
3504 var len = this.length,
3505 j = +i + ( i < 0 ? len : 0 );
3506 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
3507 },
3508
3509 end: function() {
3510 return this.prevObject || this.constructor();
3511 },
3512
3513 // For internal use only.
3514 // Behaves like an Array's method, not like a jQuery method.
3515 push: push,
3516 sort: arr.sort,
3517 splice: arr.splice
3518};
3519
3520jQuery.extend = jQuery.fn.extend = function() {
3521 var options, name, src, copy, copyIsArray, clone,
3522 target = arguments[ 0 ] || {},
3523 i = 1,
3524 length = arguments.length,
3525 deep = false;
3526
3527 // Handle a deep copy situation
3528 if ( typeof target === "boolean" ) {
3529 deep = target;
3530
3531 // Skip the boolean and the target
3532 target = arguments[ i ] || {};
3533 i++;
3534 }
3535
3536 // Handle case when target is a string or something (possible in deep copy)
3537 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
3538 target = {};
3539 }
3540
3541 // Extend jQuery itself if only one argument is passed
3542 if ( i === length ) {
3543 target = this;
3544 i--;
3545 }
3546
3547 for ( ; i < length; i++ ) {
3548
3549 // Only deal with non-null/undefined values
3550 if ( ( options = arguments[ i ] ) != null ) {
3551
3552 // Extend the base object
3553 for ( name in options ) {
3554 src = target[ name ];
3555 copy = options[ name ];
3556
3557 // Prevent never-ending loop
3558 if ( target === copy ) {
3559 continue;
3560 }
3561
3562 // Recurse if we're merging plain objects or arrays
3563 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
3564 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
3565
3566 if ( copyIsArray ) {
3567 copyIsArray = false;
3568 clone = src && jQuery.isArray( src ) ? src : [];
3569
3570 } else {
3571 clone = src && jQuery.isPlainObject( src ) ? src : {};
3572 }
3573
3574 // Never move original objects, clone them
3575 target[ name ] = jQuery.extend( deep, clone, copy );
3576
3577 // Don't bring in undefined values
3578 } else if ( copy !== undefined ) {
3579 target[ name ] = copy;
3580 }
3581 }
3582 }
3583 }
3584
3585 // Return the modified object
3586 return target;
3587};
3588
3589jQuery.extend( {
3590
3591 // Unique for each copy of jQuery on the page
3592 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
3593
3594 // Assume jQuery is ready without the ready module
3595 isReady: true,
3596
3597 error: function( msg ) {
3598 throw new Error( msg );
3599 },
3600
3601 noop: function() {},
3602
3603 isFunction: function( obj ) {
3604 return jQuery.type( obj ) === "function";
3605 },
3606
3607 isArray: Array.isArray,
3608
3609 isWindow: function( obj ) {
3610 return obj != null && obj === obj.window;
3611 },
3612
3613 isNumeric: function( obj ) {
3614
3615 // As of jQuery 3.0, isNumeric is limited to
3616 // strings and numbers (primitives or objects)
3617 // that can be coerced to finite numbers (gh-2662)
3618 var type = jQuery.type( obj );
3619 return ( type === "number" || type === "string" ) &&
3620
3621 // parseFloat NaNs numeric-cast false positives ("")
3622 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
3623 // subtraction forces infinities to NaN
3624 !isNaN( obj - parseFloat( obj ) );
3625 },
3626
3627 isPlainObject: function( obj ) {
3628 var proto, Ctor;
3629
3630 // Detect obvious negatives
3631 // Use toString instead of jQuery.type to catch host objects
3632 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
3633 return false;
3634 }
3635
3636 proto = getProto( obj );
3637
3638 // Objects with no prototype (e.g., `Object.create( null )`) are plain
3639 if ( !proto ) {
3640 return true;
3641 }
3642
3643 // Objects with prototype are plain iff they were constructed by a global Object function
3644 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
3645 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
3646 },
3647
3648 isEmptyObject: function( obj ) {
3649
3650 /* eslint-disable no-unused-vars */
3651 // See https://github.com/eslint/eslint/issues/6125
3652 var name;
3653
3654 for ( name in obj ) {
3655 return false;
3656 }
3657 return true;
3658 },
3659
3660 type: function( obj ) {
3661 if ( obj == null ) {
3662 return obj + "";
3663 }
3664
3665 // Support: Android <=2.3 only (functionish RegExp)
3666 return typeof obj === "object" || typeof obj === "function" ?
3667 class2type[ toString.call( obj ) ] || "object" :
3668 typeof obj;
3669 },
3670
3671 // Evaluates a script in a global context
3672 globalEval: function( code ) {
3673 DOMEval( code );
3674 },
3675
3676 // Convert dashed to camelCase; used by the css and data modules
3677 // Support: IE <=9 - 11, Edge 12 - 13
3678 // Microsoft forgot to hump their vendor prefix (#9572)
3679 camelCase: function( string ) {
3680 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
3681 },
3682
3683 nodeName: function( elem, name ) {
3684 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3685 },
3686
3687 each: function( obj, callback ) {
3688 var length, i = 0;
3689
3690 if ( isArrayLike( obj ) ) {
3691 length = obj.length;
3692 for ( ; i < length; i++ ) {
3693 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
3694 break;
3695 }
3696 }
3697 } else {
3698 for ( i in obj ) {
3699 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
3700 break;
3701 }
3702 }
3703 }
3704
3705 return obj;
3706 },
3707
3708 // Support: Android <=4.0 only
3709 trim: function( text ) {
3710 return text == null ?
3711 "" :
3712 ( text + "" ).replace( rtrim, "" );
3713 },
3714
3715 // results is for internal usage only
3716 makeArray: function( arr, results ) {
3717 var ret = results || [];
3718
3719 if ( arr != null ) {
3720 if ( isArrayLike( Object( arr ) ) ) {
3721 jQuery.merge( ret,
3722 typeof arr === "string" ?
3723 [ arr ] : arr
3724 );
3725 } else {
3726 push.call( ret, arr );
3727 }
3728 }
3729
3730 return ret;
3731 },
3732
3733 inArray: function( elem, arr, i ) {
3734 return arr == null ? -1 : indexOf.call( arr, elem, i );
3735 },
3736
3737 // Support: Android <=4.0 only, PhantomJS 1 only
3738 // push.apply(_, arraylike) throws on ancient WebKit
3739 merge: function( first, second ) {
3740 var len = +second.length,
3741 j = 0,
3742 i = first.length;
3743
3744 for ( ; j < len; j++ ) {
3745 first[ i++ ] = second[ j ];
3746 }
3747
3748 first.length = i;
3749
3750 return first;
3751 },
3752
3753 grep: function( elems, callback, invert ) {
3754 var callbackInverse,
3755 matches = [],
3756 i = 0,
3757 length = elems.length,
3758 callbackExpect = !invert;
3759
3760 // Go through the array, only saving the items
3761 // that pass the validator function
3762 for ( ; i < length; i++ ) {
3763 callbackInverse = !callback( elems[ i ], i );
3764 if ( callbackInverse !== callbackExpect ) {
3765 matches.push( elems[ i ] );
3766 }
3767 }
3768
3769 return matches;
3770 },
3771
3772 // arg is for internal usage only
3773 map: function( elems, callback, arg ) {
3774 var length, value,
3775 i = 0,
3776 ret = [];
3777
3778 // Go through the array, translating each of the items to their new values
3779 if ( isArrayLike( elems ) ) {
3780 length = elems.length;
3781 for ( ; i < length; i++ ) {
3782 value = callback( elems[ i ], i, arg );
3783
3784 if ( value != null ) {
3785 ret.push( value );
3786 }
3787 }
3788
3789 // Go through every key on the object,
3790 } else {
3791 for ( i in elems ) {
3792 value = callback( elems[ i ], i, arg );
3793
3794 if ( value != null ) {
3795 ret.push( value );
3796 }
3797 }
3798 }
3799
3800 // Flatten any nested arrays
3801 return concat.apply( [], ret );
3802 },
3803
3804 // A global GUID counter for objects
3805 guid: 1,
3806
3807 // Bind a function to a context, optionally partially applying any
3808 // arguments.
3809 proxy: function( fn, context ) {
3810 var tmp, args, proxy;
3811
3812 if ( typeof context === "string" ) {
3813 tmp = fn[ context ];
3814 context = fn;
3815 fn = tmp;
3816 }
3817
3818 // Quick check to determine if target is callable, in the spec
3819 // this throws a TypeError, but we will just return undefined.
3820 if ( !jQuery.isFunction( fn ) ) {
3821 return undefined;
3822 }
3823
3824 // Simulated bind
3825 args = slice.call( arguments, 2 );
3826 proxy = function() {
3827 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
3828 };
3829
3830 // Set the guid of unique handler to the same of original handler, so it can be removed
3831 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
3832
3833 return proxy;
3834 },
3835
3836 now: Date.now,
3837
3838 // jQuery.support is not used in Core but other projects attach their
3839 // properties to it so it needs to exist.
3840 support: support
3841} );
3842
3843if ( typeof Symbol === "function" ) {
3844 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
3845}
3846
3847// Populate the class2type map
3848jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
3849function( i, name ) {
3850 class2type[ "[object " + name + "]" ] = name.toLowerCase();
3851} );
3852
3853function isArrayLike( obj ) {
3854
3855 // Support: real iOS 8.2 only (not reproducible in simulator)
3856 // `in` check used to prevent JIT error (gh-2145)
3857 // hasOwn isn't used here due to false negatives
3858 // regarding Nodelist length in IE
3859 var length = !!obj && "length" in obj && obj.length,
3860 type = jQuery.type( obj );
3861
3862 if ( type === "function" || jQuery.isWindow( obj ) ) {
3863 return false;
3864 }
3865
3866 return type === "array" || length === 0 ||
3867 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
3868}
3869var Sizzle =
3870/*!
3871 * Sizzle CSS Selector Engine v2.3.3
3872 * https://sizzlejs.com/
3873 *
3874 * Copyright jQuery Foundation and other contributors
3875 * Released under the MIT license
3876 * http://jquery.org/license
3877 *
3878 * Date: 2016-08-08
3879 */
3880(function( window ) {
3881
3882var i,
3883 support,
3884 Expr,
3885 getText,
3886 isXML,
3887 tokenize,
3888 compile,
3889 select,
3890 outermostContext,
3891 sortInput,
3892 hasDuplicate,
3893
3894 // Local document vars
3895 setDocument,
3896 document,
3897 docElem,
3898 documentIsHTML,
3899 rbuggyQSA,
3900 rbuggyMatches,
3901 matches,
3902 contains,
3903
3904 // Instance-specific data
3905 expando = "sizzle" + 1 * new Date(),
3906 preferredDoc = window.document,
3907 dirruns = 0,
3908 done = 0,
3909 classCache = createCache(),
3910 tokenCache = createCache(),
3911 compilerCache = createCache(),
3912 sortOrder = function( a, b ) {
3913 if ( a === b ) {
3914 hasDuplicate = true;
3915 }
3916 return 0;
3917 },
3918
3919 // Instance methods
3920 hasOwn = ({}).hasOwnProperty,
3921 arr = [],
3922 pop = arr.pop,
3923 push_native = arr.push,
3924 push = arr.push,
3925 slice = arr.slice,
3926 // Use a stripped-down indexOf as it's faster than native
3927 // https://jsperf.com/thor-indexof-vs-for/5
3928 indexOf = function( list, elem ) {
3929 var i = 0,
3930 len = list.length;
3931 for ( ; i < len; i++ ) {
3932 if ( list[i] === elem ) {
3933 return i;
3934 }
3935 }
3936 return -1;
3937 },
3938
3939 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
3940
3941 // Regular expressions
3942
3943 // http://www.w3.org/TR/css3-selectors/#whitespace
3944 whitespace = "[\\x20\\t\\r\\n\\f]",
3945
3946 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3947 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
3948
3949 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
3950 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
3951 // Operator (capture 2)
3952 "*([*^$|!~]?=)" + whitespace +
3953 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
3954 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
3955 "*\\]",
3956
3957 pseudos = ":(" + identifier + ")(?:\\((" +
3958 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
3959 // 1. quoted (capture 3; capture 4 or capture 5)
3960 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
3961 // 2. simple (capture 6)
3962 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
3963 // 3. anything else (capture 2)
3964 ".*" +
3965 ")\\)|)",
3966
3967 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3968 rwhitespace = new RegExp( whitespace + "+", "g" ),
3969 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3970
3971 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
3972 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
3973
3974 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
3975
3976 rpseudo = new RegExp( pseudos ),
3977 ridentifier = new RegExp( "^" + identifier + "$" ),
3978
3979 matchExpr = {
3980 "ID": new RegExp( "^#(" + identifier + ")" ),
3981 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
3982 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
3983 "ATTR": new RegExp( "^" + attributes ),
3984 "PSEUDO": new RegExp( "^" + pseudos ),
3985 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
3986 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3987 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3988 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
3989 // For use in libraries implementing .is()
3990 // We use this for POS matching in `select`
3991 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
3992 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
3993 },
3994
3995 rinputs = /^(?:input|select|textarea|button)$/i,
3996 rheader = /^h\d$/i,
3997
3998 rnative = /^[^{]+\{\s*\[native \w/,
3999
4000 // Easily-parseable/retrievable ID or TAG or CLASS selectors
4001 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
4002
4003 rsibling = /[+~]/,
4004
4005 // CSS escapes
4006 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
4007 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
4008 funescape = function( _, escaped, escapedWhitespace ) {
4009 var high = "0x" + escaped - 0x10000;
4010 // NaN means non-codepoint
4011 // Support: Firefox<24
4012 // Workaround erroneous numeric interpretation of +"0x"
4013 return high !== high || escapedWhitespace ?
4014 escaped :
4015 high < 0 ?
4016 // BMP codepoint
4017 String.fromCharCode( high + 0x10000 ) :
4018 // Supplemental Plane codepoint (surrogate pair)
4019 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
4020 },
4021
4022 // CSS string/identifier serialization
4023 // https://drafts.csswg.org/cssom/#common-serializing-idioms
4024 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
4025 fcssescape = function( ch, asCodePoint ) {
4026 if ( asCodePoint ) {
4027
4028 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
4029 if ( ch === "\0" ) {
4030 return "\uFFFD";
4031 }
4032
4033 // Control characters and (dependent upon position) numbers get escaped as code points
4034 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
4035 }
4036
4037 // Other potentially-special ASCII characters get backslash-escaped
4038 return "\\" + ch;
4039 },
4040
4041 // Used for iframes
4042 // See setDocument()
4043 // Removing the function wrapper causes a "Permission Denied"
4044 // error in IE
4045 unloadHandler = function() {
4046 setDocument();
4047 },
4048
4049 disabledAncestor = addCombinator(
4050 function( elem ) {
4051 return elem.disabled === true && ("form" in elem || "label" in elem);
4052 },
4053 { dir: "parentNode", next: "legend" }
4054 );
4055
4056// Optimize for push.apply( _, NodeList )
4057try {
4058 push.apply(
4059 (arr = slice.call( preferredDoc.childNodes )),
4060 preferredDoc.childNodes
4061 );
4062 // Support: Android<4.0
4063 // Detect silently failing push.apply
4064 arr[ preferredDoc.childNodes.length ].nodeType;
4065} catch ( e ) {
4066 push = { apply: arr.length ?
4067
4068 // Leverage slice if possible
4069 function( target, els ) {
4070 push_native.apply( target, slice.call(els) );
4071 } :
4072
4073 // Support: IE<9
4074 // Otherwise append directly
4075 function( target, els ) {
4076 var j = target.length,
4077 i = 0;
4078 // Can't trust NodeList.length
4079 while ( (target[j++] = els[i++]) ) {}
4080 target.length = j - 1;
4081 }
4082 };
4083}
4084
4085function Sizzle( selector, context, results, seed ) {
4086 var m, i, elem, nid, match, groups, newSelector,
4087 newContext = context && context.ownerDocument,
4088
4089 // nodeType defaults to 9, since context defaults to document
4090 nodeType = context ? context.nodeType : 9;
4091
4092 results = results || [];
4093
4094 // Return early from calls with invalid selector or context
4095 if ( typeof selector !== "string" || !selector ||
4096 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
4097
4098 return results;
4099 }
4100
4101 // Try to shortcut find operations (as opposed to filters) in HTML documents
4102 if ( !seed ) {
4103
4104 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
4105 setDocument( context );
4106 }
4107 context = context || document;
4108
4109 if ( documentIsHTML ) {
4110
4111 // If the selector is sufficiently simple, try using a "get*By*" DOM method
4112 // (excepting DocumentFragment context, where the methods don't exist)
4113 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
4114
4115 // ID selector
4116 if ( (m = match[1]) ) {
4117
4118 // Document context
4119 if ( nodeType === 9 ) {
4120 if ( (elem = context.getElementById( m )) ) {
4121
4122 // Support: IE, Opera, Webkit
4123 // TODO: identify versions
4124 // getElementById can match elements by name instead of ID
4125 if ( elem.id === m ) {
4126 results.push( elem );
4127 return results;
4128 }
4129 } else {
4130 return results;
4131 }
4132
4133 // Element context
4134 } else {
4135
4136 // Support: IE, Opera, Webkit
4137 // TODO: identify versions
4138 // getElementById can match elements by name instead of ID
4139 if ( newContext && (elem = newContext.getElementById( m )) &&
4140 contains( context, elem ) &&
4141 elem.id === m ) {
4142
4143 results.push( elem );
4144 return results;
4145 }
4146 }
4147
4148 // Type selector
4149 } else if ( match[2] ) {
4150 push.apply( results, context.getElementsByTagName( selector ) );
4151 return results;
4152
4153 // Class selector
4154 } else if ( (m = match[3]) && support.getElementsByClassName &&
4155 context.getElementsByClassName ) {
4156
4157 push.apply( results, context.getElementsByClassName( m ) );
4158 return results;
4159 }
4160 }
4161
4162 // Take advantage of querySelectorAll
4163 if ( support.qsa &&
4164 !compilerCache[ selector + " " ] &&
4165 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
4166
4167 if ( nodeType !== 1 ) {
4168 newContext = context;
4169 newSelector = selector;
4170
4171 // qSA looks outside Element context, which is not what we want
4172 // Thanks to Andrew Dupont for this workaround technique
4173 // Support: IE <=8
4174 // Exclude object elements
4175 } else if ( context.nodeName.toLowerCase() !== "object" ) {
4176
4177 // Capture the context ID, setting it first if necessary
4178 if ( (nid = context.getAttribute( "id" )) ) {
4179 nid = nid.replace( rcssescape, fcssescape );
4180 } else {
4181 context.setAttribute( "id", (nid = expando) );
4182 }
4183
4184 // Prefix every selector in the list
4185 groups = tokenize( selector );
4186 i = groups.length;
4187 while ( i-- ) {
4188 groups[i] = "#" + nid + " " + toSelector( groups[i] );
4189 }
4190 newSelector = groups.join( "," );
4191
4192 // Expand context for sibling selectors
4193 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
4194 context;
4195 }
4196
4197 if ( newSelector ) {
4198 try {
4199 push.apply( results,
4200 newContext.querySelectorAll( newSelector )
4201 );
4202 return results;
4203 } catch ( qsaError ) {
4204 } finally {
4205 if ( nid === expando ) {
4206 context.removeAttribute( "id" );
4207 }
4208 }
4209 }
4210 }
4211 }
4212 }
4213
4214 // All others
4215 return select( selector.replace( rtrim, "$1" ), context, results, seed );
4216}
4217
4218/**
4219 * Create key-value caches of limited size
4220 * @returns {function(string, object)} Returns the Object data after storing it on itself with
4221 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
4222 * deleting the oldest entry
4223 */
4224function createCache() {
4225 var keys = [];
4226
4227 function cache( key, value ) {
4228 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
4229 if ( keys.push( key + " " ) > Expr.cacheLength ) {
4230 // Only keep the most recent entries
4231 delete cache[ keys.shift() ];
4232 }
4233 return (cache[ key + " " ] = value);
4234 }
4235 return cache;
4236}
4237
4238/**
4239 * Mark a function for special use by Sizzle
4240 * @param {Function} fn The function to mark
4241 */
4242function markFunction( fn ) {
4243 fn[ expando ] = true;
4244 return fn;
4245}
4246
4247/**
4248 * Support testing using an element
4249 * @param {Function} fn Passed the created element and returns a boolean result
4250 */
4251function assert( fn ) {
4252 var el = document.createElement("fieldset");
4253
4254 try {
4255 return !!fn( el );
4256 } catch (e) {
4257 return false;
4258 } finally {
4259 // Remove from its parent by default
4260 if ( el.parentNode ) {
4261 el.parentNode.removeChild( el );
4262 }
4263 // release memory in IE
4264 el = null;
4265 }
4266}
4267
4268/**
4269 * Adds the same handler for all of the specified attrs
4270 * @param {String} attrs Pipe-separated list of attributes
4271 * @param {Function} handler The method that will be applied
4272 */
4273function addHandle( attrs, handler ) {
4274 var arr = attrs.split("|"),
4275 i = arr.length;
4276
4277 while ( i-- ) {
4278 Expr.attrHandle[ arr[i] ] = handler;
4279 }
4280}
4281
4282/**
4283 * Checks document order of two siblings
4284 * @param {Element} a
4285 * @param {Element} b
4286 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
4287 */
4288function siblingCheck( a, b ) {
4289 var cur = b && a,
4290 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
4291 a.sourceIndex - b.sourceIndex;
4292
4293 // Use IE sourceIndex if available on both nodes
4294 if ( diff ) {
4295 return diff;
4296 }
4297
4298 // Check if b follows a
4299 if ( cur ) {
4300 while ( (cur = cur.nextSibling) ) {
4301 if ( cur === b ) {
4302 return -1;
4303 }
4304 }
4305 }
4306
4307 return a ? 1 : -1;
4308}
4309
4310/**
4311 * Returns a function to use in pseudos for input types
4312 * @param {String} type
4313 */
4314function createInputPseudo( type ) {
4315 return function( elem ) {
4316 var name = elem.nodeName.toLowerCase();
4317 return name === "input" && elem.type === type;
4318 };
4319}
4320
4321/**
4322 * Returns a function to use in pseudos for buttons
4323 * @param {String} type
4324 */
4325function createButtonPseudo( type ) {
4326 return function( elem ) {
4327 var name = elem.nodeName.toLowerCase();
4328 return (name === "input" || name === "button") && elem.type === type;
4329 };
4330}
4331
4332/**
4333 * Returns a function to use in pseudos for :enabled/:disabled
4334 * @param {Boolean} disabled true for :disabled; false for :enabled
4335 */
4336function createDisabledPseudo( disabled ) {
4337
4338 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
4339 return function( elem ) {
4340
4341 // Only certain elements can match :enabled or :disabled
4342 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
4343 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
4344 if ( "form" in elem ) {
4345
4346 // Check for inherited disabledness on relevant non-disabled elements:
4347 // * listed form-associated elements in a disabled fieldset
4348 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
4349 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
4350 // * option elements in a disabled optgroup
4351 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
4352 // All such elements have a "form" property.
4353 if ( elem.parentNode && elem.disabled === false ) {
4354
4355 // Option elements defer to a parent optgroup if present
4356 if ( "label" in elem ) {
4357 if ( "label" in elem.parentNode ) {
4358 return elem.parentNode.disabled === disabled;
4359 } else {
4360 return elem.disabled === disabled;
4361 }
4362 }
4363
4364 // Support: IE 6 - 11
4365 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
4366 return elem.isDisabled === disabled ||
4367
4368 // Where there is no isDisabled, check manually
4369 /* jshint -W018 */
4370 elem.isDisabled !== !disabled &&
4371 disabledAncestor( elem ) === disabled;
4372 }
4373
4374 return elem.disabled === disabled;
4375
4376 // Try to winnow out elements that can't be disabled before trusting the disabled property.
4377 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
4378 // even exist on them, let alone have a boolean value.
4379 } else if ( "label" in elem ) {
4380 return elem.disabled === disabled;
4381 }
4382
4383 // Remaining elements are neither :enabled nor :disabled
4384 return false;
4385 };
4386}
4387
4388/**
4389 * Returns a function to use in pseudos for positionals
4390 * @param {Function} fn
4391 */
4392function createPositionalPseudo( fn ) {
4393 return markFunction(function( argument ) {
4394 argument = +argument;
4395 return markFunction(function( seed, matches ) {
4396 var j,
4397 matchIndexes = fn( [], seed.length, argument ),
4398 i = matchIndexes.length;
4399
4400 // Match elements found at the specified indexes
4401 while ( i-- ) {
4402 if ( seed[ (j = matchIndexes[i]) ] ) {
4403 seed[j] = !(matches[j] = seed[j]);
4404 }
4405 }
4406 });
4407 });
4408}
4409
4410/**
4411 * Checks a node for validity as a Sizzle context
4412 * @param {Element|Object=} context
4413 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
4414 */
4415function testContext( context ) {
4416 return context && typeof context.getElementsByTagName !== "undefined" && context;
4417}
4418
4419// Expose support vars for convenience
4420support = Sizzle.support = {};
4421
4422/**
4423 * Detects XML nodes
4424 * @param {Element|Object} elem An element or a document
4425 * @returns {Boolean} True iff elem is a non-HTML XML node
4426 */
4427isXML = Sizzle.isXML = function( elem ) {
4428 // documentElement is verified for cases where it doesn't yet exist
4429 // (such as loading iframes in IE - #4833)
4430 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
4431 return documentElement ? documentElement.nodeName !== "HTML" : false;
4432};
4433
4434/**
4435 * Sets document-related variables once based on the current document
4436 * @param {Element|Object} [doc] An element or document object to use to set the document
4437 * @returns {Object} Returns the current document
4438 */
4439setDocument = Sizzle.setDocument = function( node ) {
4440 var hasCompare, subWindow,
4441 doc = node ? node.ownerDocument || node : preferredDoc;
4442
4443 // Return early if doc is invalid or already selected
4444 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
4445 return document;
4446 }
4447
4448 // Update global variables
4449 document = doc;
4450 docElem = document.documentElement;
4451 documentIsHTML = !isXML( document );
4452
4453 // Support: IE 9-11, Edge
4454 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
4455 if ( preferredDoc !== document &&
4456 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
4457
4458 // Support: IE 11, Edge
4459 if ( subWindow.addEventListener ) {
4460 subWindow.addEventListener( "unload", unloadHandler, false );
4461
4462 // Support: IE 9 - 10 only
4463 } else if ( subWindow.attachEvent ) {
4464 subWindow.attachEvent( "onunload", unloadHandler );
4465 }
4466 }
4467
4468 /* Attributes
4469 ---------------------------------------------------------------------- */
4470
4471 // Support: IE<8
4472 // Verify that getAttribute really returns attributes and not properties
4473 // (excepting IE8 booleans)
4474 support.attributes = assert(function( el ) {
4475 el.className = "i";
4476 return !el.getAttribute("className");
4477 });
4478
4479 /* getElement(s)By*
4480 ---------------------------------------------------------------------- */
4481
4482 // Check if getElementsByTagName("*") returns only elements
4483 support.getElementsByTagName = assert(function( el ) {
4484 el.appendChild( document.createComment("") );
4485 return !el.getElementsByTagName("*").length;
4486 });
4487
4488 // Support: IE<9
4489 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
4490
4491 // Support: IE<10
4492 // Check if getElementById returns elements by name
4493 // The broken getElementById methods don't pick up programmatically-set names,
4494 // so use a roundabout getElementsByName test
4495 support.getById = assert(function( el ) {
4496 docElem.appendChild( el ).id = expando;
4497 return !document.getElementsByName || !document.getElementsByName( expando ).length;
4498 });
4499
4500 // ID filter and find
4501 if ( support.getById ) {
4502 Expr.filter["ID"] = function( id ) {
4503 var attrId = id.replace( runescape, funescape );
4504 return function( elem ) {
4505 return elem.getAttribute("id") === attrId;
4506 };
4507 };
4508 Expr.find["ID"] = function( id, context ) {
4509 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
4510 var elem = context.getElementById( id );
4511 return elem ? [ elem ] : [];
4512 }
4513 };
4514 } else {
4515 Expr.filter["ID"] = function( id ) {
4516 var attrId = id.replace( runescape, funescape );
4517 return function( elem ) {
4518 var node = typeof elem.getAttributeNode !== "undefined" &&
4519 elem.getAttributeNode("id");
4520 return node && node.value === attrId;
4521 };
4522 };
4523
4524 // Support: IE 6 - 7 only
4525 // getElementById is not reliable as a find shortcut
4526 Expr.find["ID"] = function( id, context ) {
4527 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
4528 var node, i, elems,
4529 elem = context.getElementById( id );
4530
4531 if ( elem ) {
4532
4533 // Verify the id attribute
4534 node = elem.getAttributeNode("id");
4535 if ( node && node.value === id ) {
4536 return [ elem ];
4537 }
4538
4539 // Fall back on getElementsByName
4540 elems = context.getElementsByName( id );
4541 i = 0;
4542 while ( (elem = elems[i++]) ) {
4543 node = elem.getAttributeNode("id");
4544 if ( node && node.value === id ) {
4545 return [ elem ];
4546 }
4547 }
4548 }
4549
4550 return [];
4551 }
4552 };
4553 }
4554
4555 // Tag
4556 Expr.find["TAG"] = support.getElementsByTagName ?
4557 function( tag, context ) {
4558 if ( typeof context.getElementsByTagName !== "undefined" ) {
4559 return context.getElementsByTagName( tag );
4560
4561 // DocumentFragment nodes don't have gEBTN
4562 } else if ( support.qsa ) {
4563 return context.querySelectorAll( tag );
4564 }
4565 } :
4566
4567 function( tag, context ) {
4568 var elem,
4569 tmp = [],
4570 i = 0,
4571 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
4572 results = context.getElementsByTagName( tag );
4573
4574 // Filter out possible comments
4575 if ( tag === "*" ) {
4576 while ( (elem = results[i++]) ) {
4577 if ( elem.nodeType === 1 ) {
4578 tmp.push( elem );
4579 }
4580 }
4581
4582 return tmp;
4583 }
4584 return results;
4585 };
4586
4587 // Class
4588 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
4589 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
4590 return context.getElementsByClassName( className );
4591 }
4592 };
4593
4594 /* QSA/matchesSelector
4595 ---------------------------------------------------------------------- */
4596
4597 // QSA and matchesSelector support
4598
4599 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
4600 rbuggyMatches = [];
4601
4602 // qSa(:focus) reports false when true (Chrome 21)
4603 // We allow this because of a bug in IE8/9 that throws an error
4604 // whenever `document.activeElement` is accessed on an iframe
4605 // So, we allow :focus to pass through QSA all the time to avoid the IE error
4606 // See https://bugs.jquery.com/ticket/13378
4607 rbuggyQSA = [];
4608
4609 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
4610 // Build QSA regex
4611 // Regex strategy adopted from Diego Perini
4612 assert(function( el ) {
4613 // Select is set to empty string on purpose
4614 // This is to test IE's treatment of not explicitly
4615 // setting a boolean content attribute,
4616 // since its presence should be enough
4617 // https://bugs.jquery.com/ticket/12359
4618 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
4619 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
4620 "<option selected=''></option></select>";
4621
4622 // Support: IE8, Opera 11-12.16
4623 // Nothing should be selected when empty strings follow ^= or $= or *=
4624 // The test attribute must be unknown in Opera but "safe" for WinRT
4625 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
4626 if ( el.querySelectorAll("[msallowcapture^='']").length ) {
4627 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
4628 }
4629
4630 // Support: IE8
4631 // Boolean attributes and "value" are not treated correctly
4632 if ( !el.querySelectorAll("[selected]").length ) {
4633 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
4634 }
4635
4636 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
4637 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
4638 rbuggyQSA.push("~=");
4639 }
4640
4641 // Webkit/Opera - :checked should return selected option elements
4642 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4643 // IE8 throws error here and will not see later tests
4644 if ( !el.querySelectorAll(":checked").length ) {
4645 rbuggyQSA.push(":checked");
4646 }
4647
4648 // Support: Safari 8+, iOS 8+
4649 // https://bugs.webkit.org/show_bug.cgi?id=136851
4650 // In-page `selector#id sibling-combinator selector` fails
4651 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
4652 rbuggyQSA.push(".#.+[+~]");
4653 }
4654 });
4655
4656 assert(function( el ) {
4657 el.innerHTML = "<a href='' disabled='disabled'></a>" +
4658 "<select disabled='disabled'><option/></select>";
4659
4660 // Support: Windows 8 Native Apps
4661 // The type and name attributes are restricted during .innerHTML assignment
4662 var input = document.createElement("input");
4663 input.setAttribute( "type", "hidden" );
4664 el.appendChild( input ).setAttribute( "name", "D" );
4665
4666 // Support: IE8
4667 // Enforce case-sensitivity of name attribute
4668 if ( el.querySelectorAll("[name=d]").length ) {
4669 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
4670 }
4671
4672 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
4673 // IE8 throws error here and will not see later tests
4674 if ( el.querySelectorAll(":enabled").length !== 2 ) {
4675 rbuggyQSA.push( ":enabled", ":disabled" );
4676 }
4677
4678 // Support: IE9-11+
4679 // IE's :disabled selector does not pick up the children of disabled fieldsets
4680 docElem.appendChild( el ).disabled = true;
4681 if ( el.querySelectorAll(":disabled").length !== 2 ) {
4682 rbuggyQSA.push( ":enabled", ":disabled" );
4683 }
4684
4685 // Opera 10-11 does not throw on post-comma invalid pseudos
4686 el.querySelectorAll("*,:x");
4687 rbuggyQSA.push(",.*:");
4688 });
4689 }
4690
4691 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
4692 docElem.webkitMatchesSelector ||
4693 docElem.mozMatchesSelector ||
4694 docElem.oMatchesSelector ||
4695 docElem.msMatchesSelector) )) ) {
4696
4697 assert(function( el ) {
4698 // Check to see if it's possible to do matchesSelector
4699 // on a disconnected node (IE 9)
4700 support.disconnectedMatch = matches.call( el, "*" );
4701
4702 // This should fail with an exception
4703 // Gecko does not error, returns false instead
4704 matches.call( el, "[s!='']:x" );
4705 rbuggyMatches.push( "!=", pseudos );
4706 });
4707 }
4708
4709 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
4710 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
4711
4712 /* Contains
4713 ---------------------------------------------------------------------- */
4714 hasCompare = rnative.test( docElem.compareDocumentPosition );
4715
4716 // Element contains another
4717 // Purposefully self-exclusive
4718 // As in, an element does not contain itself
4719 contains = hasCompare || rnative.test( docElem.contains ) ?
4720 function( a, b ) {
4721 var adown = a.nodeType === 9 ? a.documentElement : a,
4722 bup = b && b.parentNode;
4723 return a === bup || !!( bup && bup.nodeType === 1 && (
4724 adown.contains ?
4725 adown.contains( bup ) :
4726 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
4727 ));
4728 } :
4729 function( a, b ) {
4730 if ( b ) {
4731 while ( (b = b.parentNode) ) {
4732 if ( b === a ) {
4733 return true;
4734 }
4735 }
4736 }
4737 return false;
4738 };
4739
4740 /* Sorting
4741 ---------------------------------------------------------------------- */
4742
4743 // Document order sorting
4744 sortOrder = hasCompare ?
4745 function( a, b ) {
4746
4747 // Flag for duplicate removal
4748 if ( a === b ) {
4749 hasDuplicate = true;
4750 return 0;
4751 }
4752
4753 // Sort on method existence if only one input has compareDocumentPosition
4754 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
4755 if ( compare ) {
4756 return compare;
4757 }
4758
4759 // Calculate position if both inputs belong to the same document
4760 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
4761 a.compareDocumentPosition( b ) :
4762
4763 // Otherwise we know they are disconnected
4764 1;
4765
4766 // Disconnected nodes
4767 if ( compare & 1 ||
4768 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
4769
4770 // Choose the first element that is related to our preferred document
4771 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
4772 return -1;
4773 }
4774 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
4775 return 1;
4776 }
4777
4778 // Maintain original order
4779 return sortInput ?
4780 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
4781 0;
4782 }
4783
4784 return compare & 4 ? -1 : 1;
4785 } :
4786 function( a, b ) {
4787 // Exit early if the nodes are identical
4788 if ( a === b ) {
4789 hasDuplicate = true;
4790 return 0;
4791 }
4792
4793 var cur,
4794 i = 0,
4795 aup = a.parentNode,
4796 bup = b.parentNode,
4797 ap = [ a ],
4798 bp = [ b ];
4799
4800 // Parentless nodes are either documents or disconnected
4801 if ( !aup || !bup ) {
4802 return a === document ? -1 :
4803 b === document ? 1 :
4804 aup ? -1 :
4805 bup ? 1 :
4806 sortInput ?
4807 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
4808 0;
4809
4810 // If the nodes are siblings, we can do a quick check
4811 } else if ( aup === bup ) {
4812 return siblingCheck( a, b );
4813 }
4814
4815 // Otherwise we need full lists of their ancestors for comparison
4816 cur = a;
4817 while ( (cur = cur.parentNode) ) {
4818 ap.unshift( cur );
4819 }
4820 cur = b;
4821 while ( (cur = cur.parentNode) ) {
4822 bp.unshift( cur );
4823 }
4824
4825 // Walk down the tree looking for a discrepancy
4826 while ( ap[i] === bp[i] ) {
4827 i++;
4828 }
4829
4830 return i ?
4831 // Do a sibling check if the nodes have a common ancestor
4832 siblingCheck( ap[i], bp[i] ) :
4833
4834 // Otherwise nodes in our document sort first
4835 ap[i] === preferredDoc ? -1 :
4836 bp[i] === preferredDoc ? 1 :
4837 0;
4838 };
4839
4840 return document;
4841};
4842
4843Sizzle.matches = function( expr, elements ) {
4844 return Sizzle( expr, null, null, elements );
4845};
4846
4847Sizzle.matchesSelector = function( elem, expr ) {
4848 // Set document vars if needed
4849 if ( ( elem.ownerDocument || elem ) !== document ) {
4850 setDocument( elem );
4851 }
4852
4853 // Make sure that attribute selectors are quoted
4854 expr = expr.replace( rattributeQuotes, "='$1']" );
4855
4856 if ( support.matchesSelector && documentIsHTML &&
4857 !compilerCache[ expr + " " ] &&
4858 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
4859 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
4860
4861 try {
4862 var ret = matches.call( elem, expr );
4863
4864 // IE 9's matchesSelector returns false on disconnected nodes
4865 if ( ret || support.disconnectedMatch ||
4866 // As well, disconnected nodes are said to be in a document
4867 // fragment in IE 9
4868 elem.document && elem.document.nodeType !== 11 ) {
4869 return ret;
4870 }
4871 } catch (e) {}
4872 }
4873
4874 return Sizzle( expr, document, null, [ elem ] ).length > 0;
4875};
4876
4877Sizzle.contains = function( context, elem ) {
4878 // Set document vars if needed
4879 if ( ( context.ownerDocument || context ) !== document ) {
4880 setDocument( context );
4881 }
4882 return contains( context, elem );
4883};
4884
4885Sizzle.attr = function( elem, name ) {
4886 // Set document vars if needed
4887 if ( ( elem.ownerDocument || elem ) !== document ) {
4888 setDocument( elem );
4889 }
4890
4891 var fn = Expr.attrHandle[ name.toLowerCase() ],
4892 // Don't get fooled by Object.prototype properties (jQuery #13807)
4893 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
4894 fn( elem, name, !documentIsHTML ) :
4895 undefined;
4896
4897 return val !== undefined ?
4898 val :
4899 support.attributes || !documentIsHTML ?
4900 elem.getAttribute( name ) :
4901 (val = elem.getAttributeNode(name)) && val.specified ?
4902 val.value :
4903 null;
4904};
4905
4906Sizzle.escape = function( sel ) {
4907 return (sel + "").replace( rcssescape, fcssescape );
4908};
4909
4910Sizzle.error = function( msg ) {
4911 throw new Error( "Syntax error, unrecognized expression: " + msg );
4912};
4913
4914/**
4915 * Document sorting and removing duplicates
4916 * @param {ArrayLike} results
4917 */
4918Sizzle.uniqueSort = function( results ) {
4919 var elem,
4920 duplicates = [],
4921 j = 0,
4922 i = 0;
4923
4924 // Unless we *know* we can detect duplicates, assume their presence
4925 hasDuplicate = !support.detectDuplicates;
4926 sortInput = !support.sortStable && results.slice( 0 );
4927 results.sort( sortOrder );
4928
4929 if ( hasDuplicate ) {
4930 while ( (elem = results[i++]) ) {
4931 if ( elem === results[ i ] ) {
4932 j = duplicates.push( i );
4933 }
4934 }
4935 while ( j-- ) {
4936 results.splice( duplicates[ j ], 1 );
4937 }
4938 }
4939
4940 // Clear input after sorting to release objects
4941 // See https://github.com/jquery/sizzle/pull/225
4942 sortInput = null;
4943
4944 return results;
4945};
4946
4947/**
4948 * Utility function for retrieving the text value of an array of DOM nodes
4949 * @param {Array|Element} elem
4950 */
4951getText = Sizzle.getText = function( elem ) {
4952 var node,
4953 ret = "",
4954 i = 0,
4955 nodeType = elem.nodeType;
4956
4957 if ( !nodeType ) {
4958 // If no nodeType, this is expected to be an array
4959 while ( (node = elem[i++]) ) {
4960 // Do not traverse comment nodes
4961 ret += getText( node );
4962 }
4963 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
4964 // Use textContent for elements
4965 // innerText usage removed for consistency of new lines (jQuery #11153)
4966 if ( typeof elem.textContent === "string" ) {
4967 return elem.textContent;
4968 } else {
4969 // Traverse its children
4970 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4971 ret += getText( elem );
4972 }
4973 }
4974 } else if ( nodeType === 3 || nodeType === 4 ) {
4975 return elem.nodeValue;
4976 }
4977 // Do not include comment or processing instruction nodes
4978
4979 return ret;
4980};
4981
4982Expr = Sizzle.selectors = {
4983
4984 // Can be adjusted by the user
4985 cacheLength: 50,
4986
4987 createPseudo: markFunction,
4988
4989 match: matchExpr,
4990
4991 attrHandle: {},
4992
4993 find: {},
4994
4995 relative: {
4996 ">": { dir: "parentNode", first: true },
4997 " ": { dir: "parentNode" },
4998 "+": { dir: "previousSibling", first: true },
4999 "~": { dir: "previousSibling" }
5000 },
5001
5002 preFilter: {
5003 "ATTR": function( match ) {
5004 match[1] = match[1].replace( runescape, funescape );
5005
5006 // Move the given value to match[3] whether quoted or unquoted
5007 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
5008
5009 if ( match[2] === "~=" ) {
5010 match[3] = " " + match[3] + " ";
5011 }
5012
5013 return match.slice( 0, 4 );
5014 },
5015
5016 "CHILD": function( match ) {
5017 /* matches from matchExpr["CHILD"]
5018 1 type (only|nth|...)
5019 2 what (child|of-type)
5020 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
5021 4 xn-component of xn+y argument ([+-]?\d*n|)
5022 5 sign of xn-component
5023 6 x of xn-component
5024 7 sign of y-component
5025 8 y of y-component
5026 */
5027 match[1] = match[1].toLowerCase();
5028
5029 if ( match[1].slice( 0, 3 ) === "nth" ) {
5030 // nth-* requires argument
5031 if ( !match[3] ) {
5032 Sizzle.error( match[0] );
5033 }
5034
5035 // numeric x and y parameters for Expr.filter.CHILD
5036 // remember that false/true cast respectively to 0/1
5037 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
5038 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
5039
5040 // other types prohibit arguments
5041 } else if ( match[3] ) {
5042 Sizzle.error( match[0] );
5043 }
5044
5045 return match;
5046 },
5047
5048 "PSEUDO": function( match ) {
5049 var excess,
5050 unquoted = !match[6] && match[2];
5051
5052 if ( matchExpr["CHILD"].test( match[0] ) ) {
5053 return null;
5054 }
5055
5056 // Accept quoted arguments as-is
5057 if ( match[3] ) {
5058 match[2] = match[4] || match[5] || "";
5059
5060 // Strip excess characters from unquoted arguments
5061 } else if ( unquoted && rpseudo.test( unquoted ) &&
5062 // Get excess from tokenize (recursively)
5063 (excess = tokenize( unquoted, true )) &&
5064 // advance to the next closing parenthesis
5065 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
5066
5067 // excess is a negative index
5068 match[0] = match[0].slice( 0, excess );
5069 match[2] = unquoted.slice( 0, excess );
5070 }
5071
5072 // Return only captures needed by the pseudo filter method (type and argument)
5073 return match.slice( 0, 3 );
5074 }
5075 },
5076
5077 filter: {
5078
5079 "TAG": function( nodeNameSelector ) {
5080 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
5081 return nodeNameSelector === "*" ?
5082 function() { return true; } :
5083 function( elem ) {
5084 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
5085 };
5086 },
5087
5088 "CLASS": function( className ) {
5089 var pattern = classCache[ className + " " ];
5090
5091 return pattern ||
5092 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
5093 classCache( className, function( elem ) {
5094 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
5095 });
5096 },
5097
5098 "ATTR": function( name, operator, check ) {
5099 return function( elem ) {
5100 var result = Sizzle.attr( elem, name );
5101
5102 if ( result == null ) {
5103 return operator === "!=";
5104 }
5105 if ( !operator ) {
5106 return true;
5107 }
5108
5109 result += "";
5110
5111 return operator === "=" ? result === check :
5112 operator === "!=" ? result !== check :
5113 operator === "^=" ? check && result.indexOf( check ) === 0 :
5114 operator === "*=" ? check && result.indexOf( check ) > -1 :
5115 operator === "$=" ? check && result.slice( -check.length ) === check :
5116 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
5117 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
5118 false;
5119 };
5120 },
5121
5122 "CHILD": function( type, what, argument, first, last ) {
5123 var simple = type.slice( 0, 3 ) !== "nth",
5124 forward = type.slice( -4 ) !== "last",
5125 ofType = what === "of-type";
5126
5127 return first === 1 && last === 0 ?
5128
5129 // Shortcut for :nth-*(n)
5130 function( elem ) {
5131 return !!elem.parentNode;
5132 } :
5133
5134 function( elem, context, xml ) {
5135 var cache, uniqueCache, outerCache, node, nodeIndex, start,
5136 dir = simple !== forward ? "nextSibling" : "previousSibling",
5137 parent = elem.parentNode,
5138 name = ofType && elem.nodeName.toLowerCase(),
5139 useCache = !xml && !ofType,
5140 diff = false;
5141
5142 if ( parent ) {
5143
5144 // :(first|last|only)-(child|of-type)
5145 if ( simple ) {
5146 while ( dir ) {
5147 node = elem;
5148 while ( (node = node[ dir ]) ) {
5149 if ( ofType ?
5150 node.nodeName.toLowerCase() === name :
5151 node.nodeType === 1 ) {
5152
5153 return false;
5154 }
5155 }
5156 // Reverse direction for :only-* (if we haven't yet done so)
5157 start = dir = type === "only" && !start && "nextSibling";
5158 }
5159 return true;
5160 }
5161
5162 start = [ forward ? parent.firstChild : parent.lastChild ];
5163
5164 // non-xml :nth-child(...) stores cache data on `parent`
5165 if ( forward && useCache ) {
5166
5167 // Seek `elem` from a previously-cached index
5168
5169 // ...in a gzip-friendly way
5170 node = parent;
5171 outerCache = node[ expando ] || (node[ expando ] = {});
5172
5173 // Support: IE <9 only
5174 // Defend against cloned attroperties (jQuery gh-1709)
5175 uniqueCache = outerCache[ node.uniqueID ] ||
5176 (outerCache[ node.uniqueID ] = {});
5177
5178 cache = uniqueCache[ type ] || [];
5179 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
5180 diff = nodeIndex && cache[ 2 ];
5181 node = nodeIndex && parent.childNodes[ nodeIndex ];
5182
5183 while ( (node = ++nodeIndex && node && node[ dir ] ||
5184
5185 // Fallback to seeking `elem` from the start
5186 (diff = nodeIndex = 0) || start.pop()) ) {
5187
5188 // When found, cache indexes on `parent` and break
5189 if ( node.nodeType === 1 && ++diff && node === elem ) {
5190 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
5191 break;
5192 }
5193 }
5194
5195 } else {
5196 // Use previously-cached element index if available
5197 if ( useCache ) {
5198 // ...in a gzip-friendly way
5199 node = elem;
5200 outerCache = node[ expando ] || (node[ expando ] = {});
5201
5202 // Support: IE <9 only
5203 // Defend against cloned attroperties (jQuery gh-1709)
5204 uniqueCache = outerCache[ node.uniqueID ] ||
5205 (outerCache[ node.uniqueID ] = {});
5206
5207 cache = uniqueCache[ type ] || [];
5208 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
5209 diff = nodeIndex;
5210 }
5211
5212 // xml :nth-child(...)
5213 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
5214 if ( diff === false ) {
5215 // Use the same loop as above to seek `elem` from the start
5216 while ( (node = ++nodeIndex && node && node[ dir ] ||
5217 (diff = nodeIndex = 0) || start.pop()) ) {
5218
5219 if ( ( ofType ?
5220 node.nodeName.toLowerCase() === name :
5221 node.nodeType === 1 ) &&
5222 ++diff ) {
5223
5224 // Cache the index of each encountered element
5225 if ( useCache ) {
5226 outerCache = node[ expando ] || (node[ expando ] = {});
5227
5228 // Support: IE <9 only
5229 // Defend against cloned attroperties (jQuery gh-1709)
5230 uniqueCache = outerCache[ node.uniqueID ] ||
5231 (outerCache[ node.uniqueID ] = {});
5232
5233 uniqueCache[ type ] = [ dirruns, diff ];
5234 }
5235
5236 if ( node === elem ) {
5237 break;
5238 }
5239 }
5240 }
5241 }
5242 }
5243
5244 // Incorporate the offset, then check against cycle size
5245 diff -= last;
5246 return diff === first || ( diff % first === 0 && diff / first >= 0 );
5247 }
5248 };
5249 },
5250
5251 "PSEUDO": function( pseudo, argument ) {
5252 // pseudo-class names are case-insensitive
5253 // http://www.w3.org/TR/selectors/#pseudo-classes
5254 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
5255 // Remember that setFilters inherits from pseudos
5256 var args,
5257 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
5258 Sizzle.error( "unsupported pseudo: " + pseudo );
5259
5260 // The user may use createPseudo to indicate that
5261 // arguments are needed to create the filter function
5262 // just as Sizzle does
5263 if ( fn[ expando ] ) {
5264 return fn( argument );
5265 }
5266
5267 // But maintain support for old signatures
5268 if ( fn.length > 1 ) {
5269 args = [ pseudo, pseudo, "", argument ];
5270 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
5271 markFunction(function( seed, matches ) {
5272 var idx,
5273 matched = fn( seed, argument ),
5274 i = matched.length;
5275 while ( i-- ) {
5276 idx = indexOf( seed, matched[i] );
5277 seed[ idx ] = !( matches[ idx ] = matched[i] );
5278 }
5279 }) :
5280 function( elem ) {
5281 return fn( elem, 0, args );
5282 };
5283 }
5284
5285 return fn;
5286 }
5287 },
5288
5289 pseudos: {
5290 // Potentially complex pseudos
5291 "not": markFunction(function( selector ) {
5292 // Trim the selector passed to compile
5293 // to avoid treating leading and trailing
5294 // spaces as combinators
5295 var input = [],
5296 results = [],
5297 matcher = compile( selector.replace( rtrim, "$1" ) );
5298
5299 return matcher[ expando ] ?
5300 markFunction(function( seed, matches, context, xml ) {
5301 var elem,
5302 unmatched = matcher( seed, null, xml, [] ),
5303 i = seed.length;
5304
5305 // Match elements unmatched by `matcher`
5306 while ( i-- ) {
5307 if ( (elem = unmatched[i]) ) {
5308 seed[i] = !(matches[i] = elem);
5309 }
5310 }
5311 }) :
5312 function( elem, context, xml ) {
5313 input[0] = elem;
5314 matcher( input, null, xml, results );
5315 // Don't keep the element (issue #299)
5316 input[0] = null;
5317 return !results.pop();
5318 };
5319 }),
5320
5321 "has": markFunction(function( selector ) {
5322 return function( elem ) {
5323 return Sizzle( selector, elem ).length > 0;
5324 };
5325 }),
5326
5327 "contains": markFunction(function( text ) {
5328 text = text.replace( runescape, funescape );
5329 return function( elem ) {
5330 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
5331 };
5332 }),
5333
5334 // "Whether an element is represented by a :lang() selector
5335 // is based solely on the element's language value
5336 // being equal to the identifier C,
5337 // or beginning with the identifier C immediately followed by "-".
5338 // The matching of C against the element's language value is performed case-insensitively.
5339 // The identifier C does not have to be a valid language name."
5340 // http://www.w3.org/TR/selectors/#lang-pseudo
5341 "lang": markFunction( function( lang ) {
5342 // lang value must be a valid identifier
5343 if ( !ridentifier.test(lang || "") ) {
5344 Sizzle.error( "unsupported lang: " + lang );
5345 }
5346 lang = lang.replace( runescape, funescape ).toLowerCase();
5347 return function( elem ) {
5348 var elemLang;
5349 do {
5350 if ( (elemLang = documentIsHTML ?
5351 elem.lang :
5352 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
5353
5354 elemLang = elemLang.toLowerCase();
5355 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
5356 }
5357 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
5358 return false;
5359 };
5360 }),
5361
5362 // Miscellaneous
5363 "target": function( elem ) {
5364 var hash = window.location && window.location.hash;
5365 return hash && hash.slice( 1 ) === elem.id;
5366 },
5367
5368 "root": function( elem ) {
5369 return elem === docElem;
5370 },
5371
5372 "focus": function( elem ) {
5373 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
5374 },
5375
5376 // Boolean properties
5377 "enabled": createDisabledPseudo( false ),
5378 "disabled": createDisabledPseudo( true ),
5379
5380 "checked": function( elem ) {
5381 // In CSS3, :checked should return both checked and selected elements
5382 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5383 var nodeName = elem.nodeName.toLowerCase();
5384 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
5385 },
5386
5387 "selected": function( elem ) {
5388 // Accessing this property makes selected-by-default
5389 // options in Safari work properly
5390 if ( elem.parentNode ) {
5391 elem.parentNode.selectedIndex;
5392 }
5393
5394 return elem.selected === true;
5395 },
5396
5397 // Contents
5398 "empty": function( elem ) {
5399 // http://www.w3.org/TR/selectors/#empty-pseudo
5400 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
5401 // but not by others (comment: 8; processing instruction: 7; etc.)
5402 // nodeType < 6 works because attributes (2) do not appear as children
5403 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
5404 if ( elem.nodeType < 6 ) {
5405 return false;
5406 }
5407 }
5408 return true;
5409 },
5410
5411 "parent": function( elem ) {
5412 return !Expr.pseudos["empty"]( elem );
5413 },
5414
5415 // Element/input types
5416 "header": function( elem ) {
5417 return rheader.test( elem.nodeName );
5418 },
5419
5420 "input": function( elem ) {
5421 return rinputs.test( elem.nodeName );
5422 },
5423
5424 "button": function( elem ) {
5425 var name = elem.nodeName.toLowerCase();
5426 return name === "input" && elem.type === "button" || name === "button";
5427 },
5428
5429 "text": function( elem ) {
5430 var attr;
5431 return elem.nodeName.toLowerCase() === "input" &&
5432 elem.type === "text" &&
5433
5434 // Support: IE<8
5435 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
5436 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
5437 },
5438
5439 // Position-in-collection
5440 "first": createPositionalPseudo(function() {
5441 return [ 0 ];
5442 }),
5443
5444 "last": createPositionalPseudo(function( matchIndexes, length ) {
5445 return [ length - 1 ];
5446 }),
5447
5448 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
5449 return [ argument < 0 ? argument + length : argument ];
5450 }),
5451
5452 "even": createPositionalPseudo(function( matchIndexes, length ) {
5453 var i = 0;
5454 for ( ; i < length; i += 2 ) {
5455 matchIndexes.push( i );
5456 }
5457 return matchIndexes;
5458 }),
5459
5460 "odd": createPositionalPseudo(function( matchIndexes, length ) {
5461 var i = 1;
5462 for ( ; i < length; i += 2 ) {
5463 matchIndexes.push( i );
5464 }
5465 return matchIndexes;
5466 }),
5467
5468 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
5469 var i = argument < 0 ? argument + length : argument;
5470 for ( ; --i >= 0; ) {
5471 matchIndexes.push( i );
5472 }
5473 return matchIndexes;
5474 }),
5475
5476 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
5477 var i = argument < 0 ? argument + length : argument;
5478 for ( ; ++i < length; ) {
5479 matchIndexes.push( i );
5480 }
5481 return matchIndexes;
5482 })
5483 }
5484};
5485
5486Expr.pseudos["nth"] = Expr.pseudos["eq"];
5487
5488// Add button/input type pseudos
5489for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
5490 Expr.pseudos[ i ] = createInputPseudo( i );
5491}
5492for ( i in { submit: true, reset: true } ) {
5493 Expr.pseudos[ i ] = createButtonPseudo( i );
5494}
5495
5496// Easy API for creating new setFilters
5497function setFilters() {}
5498setFilters.prototype = Expr.filters = Expr.pseudos;
5499Expr.setFilters = new setFilters();
5500
5501tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
5502 var matched, match, tokens, type,
5503 soFar, groups, preFilters,
5504 cached = tokenCache[ selector + " " ];
5505
5506 if ( cached ) {
5507 return parseOnly ? 0 : cached.slice( 0 );
5508 }
5509
5510 soFar = selector;
5511 groups = [];
5512 preFilters = Expr.preFilter;
5513
5514 while ( soFar ) {
5515
5516 // Comma and first run
5517 if ( !matched || (match = rcomma.exec( soFar )) ) {
5518 if ( match ) {
5519 // Don't consume trailing commas as valid
5520 soFar = soFar.slice( match[0].length ) || soFar;
5521 }
5522 groups.push( (tokens = []) );
5523 }
5524
5525 matched = false;
5526
5527 // Combinators
5528 if ( (match = rcombinators.exec( soFar )) ) {
5529 matched = match.shift();
5530 tokens.push({
5531 value: matched,
5532 // Cast descendant combinators to space
5533 type: match[0].replace( rtrim, " " )
5534 });
5535 soFar = soFar.slice( matched.length );
5536 }
5537
5538 // Filters
5539 for ( type in Expr.filter ) {
5540 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
5541 (match = preFilters[ type ]( match ))) ) {
5542 matched = match.shift();
5543 tokens.push({
5544 value: matched,
5545 type: type,
5546 matches: match
5547 });
5548 soFar = soFar.slice( matched.length );
5549 }
5550 }
5551
5552 if ( !matched ) {
5553 break;
5554 }
5555 }
5556
5557 // Return the length of the invalid excess
5558 // if we're just parsing
5559 // Otherwise, throw an error or return tokens
5560 return parseOnly ?
5561 soFar.length :
5562 soFar ?
5563 Sizzle.error( selector ) :
5564 // Cache the tokens
5565 tokenCache( selector, groups ).slice( 0 );
5566};
5567
5568function toSelector( tokens ) {
5569 var i = 0,
5570 len = tokens.length,
5571 selector = "";
5572 for ( ; i < len; i++ ) {
5573 selector += tokens[i].value;
5574 }
5575 return selector;
5576}
5577
5578function addCombinator( matcher, combinator, base ) {
5579 var dir = combinator.dir,
5580 skip = combinator.next,
5581 key = skip || dir,
5582 checkNonElements = base && key === "parentNode",
5583 doneName = done++;
5584
5585 return combinator.first ?
5586 // Check against closest ancestor/preceding element
5587 function( elem, context, xml ) {
5588 while ( (elem = elem[ dir ]) ) {
5589 if ( elem.nodeType === 1 || checkNonElements ) {
5590 return matcher( elem, context, xml );
5591 }
5592 }
5593 return false;
5594 } :
5595
5596 // Check against all ancestor/preceding elements
5597 function( elem, context, xml ) {
5598 var oldCache, uniqueCache, outerCache,
5599 newCache = [ dirruns, doneName ];
5600
5601 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
5602 if ( xml ) {
5603 while ( (elem = elem[ dir ]) ) {
5604 if ( elem.nodeType === 1 || checkNonElements ) {
5605 if ( matcher( elem, context, xml ) ) {
5606 return true;
5607 }
5608 }
5609 }
5610 } else {
5611 while ( (elem = elem[ dir ]) ) {
5612 if ( elem.nodeType === 1 || checkNonElements ) {
5613 outerCache = elem[ expando ] || (elem[ expando ] = {});
5614
5615 // Support: IE <9 only
5616 // Defend against cloned attroperties (jQuery gh-1709)
5617 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
5618
5619 if ( skip && skip === elem.nodeName.toLowerCase() ) {
5620 elem = elem[ dir ] || elem;
5621 } else if ( (oldCache = uniqueCache[ key ]) &&
5622 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
5623
5624 // Assign to newCache so results back-propagate to previous elements
5625 return (newCache[ 2 ] = oldCache[ 2 ]);
5626 } else {
5627 // Reuse newcache so results back-propagate to previous elements
5628 uniqueCache[ key ] = newCache;
5629
5630 // A match means we're done; a fail means we have to keep checking
5631 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
5632 return true;
5633 }
5634 }
5635 }
5636 }
5637 }
5638 return false;
5639 };
5640}
5641
5642function elementMatcher( matchers ) {
5643 return matchers.length > 1 ?
5644 function( elem, context, xml ) {
5645 var i = matchers.length;
5646 while ( i-- ) {
5647 if ( !matchers[i]( elem, context, xml ) ) {
5648 return false;
5649 }
5650 }
5651 return true;
5652 } :
5653 matchers[0];
5654}
5655
5656function multipleContexts( selector, contexts, results ) {
5657 var i = 0,
5658 len = contexts.length;
5659 for ( ; i < len; i++ ) {
5660 Sizzle( selector, contexts[i], results );
5661 }
5662 return results;
5663}
5664
5665function condense( unmatched, map, filter, context, xml ) {
5666 var elem,
5667 newUnmatched = [],
5668 i = 0,
5669 len = unmatched.length,
5670 mapped = map != null;
5671
5672 for ( ; i < len; i++ ) {
5673 if ( (elem = unmatched[i]) ) {
5674 if ( !filter || filter( elem, context, xml ) ) {
5675 newUnmatched.push( elem );
5676 if ( mapped ) {
5677 map.push( i );
5678 }
5679 }
5680 }
5681 }
5682
5683 return newUnmatched;
5684}
5685
5686function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
5687 if ( postFilter && !postFilter[ expando ] ) {
5688 postFilter = setMatcher( postFilter );
5689 }
5690 if ( postFinder && !postFinder[ expando ] ) {
5691 postFinder = setMatcher( postFinder, postSelector );
5692 }
5693 return markFunction(function( seed, results, context, xml ) {
5694 var temp, i, elem,
5695 preMap = [],
5696 postMap = [],
5697 preexisting = results.length,
5698
5699 // Get initial elements from seed or context
5700 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
5701
5702 // Prefilter to get matcher input, preserving a map for seed-results synchronization
5703 matcherIn = preFilter && ( seed || !selector ) ?
5704 condense( elems, preMap, preFilter, context, xml ) :
5705 elems,
5706
5707 matcherOut = matcher ?
5708 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
5709 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
5710
5711 // ...intermediate processing is necessary
5712 [] :
5713
5714 // ...otherwise use results directly
5715 results :
5716 matcherIn;
5717
5718 // Find primary matches
5719 if ( matcher ) {
5720 matcher( matcherIn, matcherOut, context, xml );
5721 }
5722
5723 // Apply postFilter
5724 if ( postFilter ) {
5725 temp = condense( matcherOut, postMap );
5726 postFilter( temp, [], context, xml );
5727
5728 // Un-match failing elements by moving them back to matcherIn
5729 i = temp.length;
5730 while ( i-- ) {
5731 if ( (elem = temp[i]) ) {
5732 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
5733 }
5734 }
5735 }
5736
5737 if ( seed ) {
5738 if ( postFinder || preFilter ) {
5739 if ( postFinder ) {
5740 // Get the final matcherOut by condensing this intermediate into postFinder contexts
5741 temp = [];
5742 i = matcherOut.length;
5743 while ( i-- ) {
5744 if ( (elem = matcherOut[i]) ) {
5745 // Restore matcherIn since elem is not yet a final match
5746 temp.push( (matcherIn[i] = elem) );
5747 }
5748 }
5749 postFinder( null, (matcherOut = []), temp, xml );
5750 }
5751
5752 // Move matched elements from seed to results to keep them synchronized
5753 i = matcherOut.length;
5754 while ( i-- ) {
5755 if ( (elem = matcherOut[i]) &&
5756 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
5757
5758 seed[temp] = !(results[temp] = elem);
5759 }
5760 }
5761 }
5762
5763 // Add elements to results, through postFinder if defined
5764 } else {
5765 matcherOut = condense(
5766 matcherOut === results ?
5767 matcherOut.splice( preexisting, matcherOut.length ) :
5768 matcherOut
5769 );
5770 if ( postFinder ) {
5771 postFinder( null, results, matcherOut, xml );
5772 } else {
5773 push.apply( results, matcherOut );
5774 }
5775 }
5776 });
5777}
5778
5779function matcherFromTokens( tokens ) {
5780 var checkContext, matcher, j,
5781 len = tokens.length,
5782 leadingRelative = Expr.relative[ tokens[0].type ],
5783 implicitRelative = leadingRelative || Expr.relative[" "],
5784 i = leadingRelative ? 1 : 0,
5785
5786 // The foundational matcher ensures that elements are reachable from top-level context(s)
5787 matchContext = addCombinator( function( elem ) {
5788 return elem === checkContext;
5789 }, implicitRelative, true ),
5790 matchAnyContext = addCombinator( function( elem ) {
5791 return indexOf( checkContext, elem ) > -1;
5792 }, implicitRelative, true ),
5793 matchers = [ function( elem, context, xml ) {
5794 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
5795 (checkContext = context).nodeType ?
5796 matchContext( elem, context, xml ) :
5797 matchAnyContext( elem, context, xml ) );
5798 // Avoid hanging onto element (issue #299)
5799 checkContext = null;
5800 return ret;
5801 } ];
5802
5803 for ( ; i < len; i++ ) {
5804 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
5805 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
5806 } else {
5807 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
5808
5809 // Return special upon seeing a positional matcher
5810 if ( matcher[ expando ] ) {
5811 // Find the next relative operator (if any) for proper handling
5812 j = ++i;
5813 for ( ; j < len; j++ ) {
5814 if ( Expr.relative[ tokens[j].type ] ) {
5815 break;
5816 }
5817 }
5818 return setMatcher(
5819 i > 1 && elementMatcher( matchers ),
5820 i > 1 && toSelector(
5821 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
5822 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
5823 ).replace( rtrim, "$1" ),
5824 matcher,
5825 i < j && matcherFromTokens( tokens.slice( i, j ) ),
5826 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
5827 j < len && toSelector( tokens )
5828 );
5829 }
5830 matchers.push( matcher );
5831 }
5832 }
5833
5834 return elementMatcher( matchers );
5835}
5836
5837function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
5838 var bySet = setMatchers.length > 0,
5839 byElement = elementMatchers.length > 0,
5840 superMatcher = function( seed, context, xml, results, outermost ) {
5841 var elem, j, matcher,
5842 matchedCount = 0,
5843 i = "0",
5844 unmatched = seed && [],
5845 setMatched = [],
5846 contextBackup = outermostContext,
5847 // We must always have either seed elements or outermost context
5848 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
5849 // Use integer dirruns iff this is the outermost matcher
5850 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
5851 len = elems.length;
5852
5853 if ( outermost ) {
5854 outermostContext = context === document || context || outermost;
5855 }
5856
5857 // Add elements passing elementMatchers directly to results
5858 // Support: IE<9, Safari
5859 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
5860 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
5861 if ( byElement && elem ) {
5862 j = 0;
5863 if ( !context && elem.ownerDocument !== document ) {
5864 setDocument( elem );
5865 xml = !documentIsHTML;
5866 }
5867 while ( (matcher = elementMatchers[j++]) ) {
5868 if ( matcher( elem, context || document, xml) ) {
5869 results.push( elem );
5870 break;
5871 }
5872 }
5873 if ( outermost ) {
5874 dirruns = dirrunsUnique;
5875 }
5876 }
5877
5878 // Track unmatched elements for set filters
5879 if ( bySet ) {
5880 // They will have gone through all possible matchers
5881 if ( (elem = !matcher && elem) ) {
5882 matchedCount--;
5883 }
5884
5885 // Lengthen the array for every element, matched or not
5886 if ( seed ) {
5887 unmatched.push( elem );
5888 }
5889 }
5890 }
5891
5892 // `i` is now the count of elements visited above, and adding it to `matchedCount`
5893 // makes the latter nonnegative.
5894 matchedCount += i;
5895
5896 // Apply set filters to unmatched elements
5897 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
5898 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
5899 // no element matchers and no seed.
5900 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
5901 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
5902 // numerically zero.
5903 if ( bySet && i !== matchedCount ) {
5904 j = 0;
5905 while ( (matcher = setMatchers[j++]) ) {
5906 matcher( unmatched, setMatched, context, xml );
5907 }
5908
5909 if ( seed ) {
5910 // Reintegrate element matches to eliminate the need for sorting
5911 if ( matchedCount > 0 ) {
5912 while ( i-- ) {
5913 if ( !(unmatched[i] || setMatched[i]) ) {
5914 setMatched[i] = pop.call( results );
5915 }
5916 }
5917 }
5918
5919 // Discard index placeholder values to get only actual matches
5920 setMatched = condense( setMatched );
5921 }
5922
5923 // Add matches to results
5924 push.apply( results, setMatched );
5925
5926 // Seedless set matches succeeding multiple successful matchers stipulate sorting
5927 if ( outermost && !seed && setMatched.length > 0 &&
5928 ( matchedCount + setMatchers.length ) > 1 ) {
5929
5930 Sizzle.uniqueSort( results );
5931 }
5932 }
5933
5934 // Override manipulation of globals by nested matchers
5935 if ( outermost ) {
5936 dirruns = dirrunsUnique;
5937 outermostContext = contextBackup;
5938 }
5939
5940 return unmatched;
5941 };
5942
5943 return bySet ?
5944 markFunction( superMatcher ) :
5945 superMatcher;
5946}
5947
5948compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
5949 var i,
5950 setMatchers = [],
5951 elementMatchers = [],
5952 cached = compilerCache[ selector + " " ];
5953
5954 if ( !cached ) {
5955 // Generate a function of recursive functions that can be used to check each element
5956 if ( !match ) {
5957 match = tokenize( selector );
5958 }
5959 i = match.length;
5960 while ( i-- ) {
5961 cached = matcherFromTokens( match[i] );
5962 if ( cached[ expando ] ) {
5963 setMatchers.push( cached );
5964 } else {
5965 elementMatchers.push( cached );
5966 }
5967 }
5968
5969 // Cache the compiled function
5970 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
5971
5972 // Save selector and tokenization
5973 cached.selector = selector;
5974 }
5975 return cached;
5976};
5977
5978/**
5979 * A low-level selection function that works with Sizzle's compiled
5980 * selector functions
5981 * @param {String|Function} selector A selector or a pre-compiled
5982 * selector function built with Sizzle.compile
5983 * @param {Element} context
5984 * @param {Array} [results]
5985 * @param {Array} [seed] A set of elements to match against
5986 */
5987select = Sizzle.select = function( selector, context, results, seed ) {
5988 var i, tokens, token, type, find,
5989 compiled = typeof selector === "function" && selector,
5990 match = !seed && tokenize( (selector = compiled.selector || selector) );
5991
5992 results = results || [];
5993
5994 // Try to minimize operations if there is only one selector in the list and no seed
5995 // (the latter of which guarantees us context)
5996 if ( match.length === 1 ) {
5997
5998 // Reduce context if the leading compound selector is an ID
5999 tokens = match[0] = match[0].slice( 0 );
6000 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
6001 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
6002
6003 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
6004 if ( !context ) {
6005 return results;
6006
6007 // Precompiled matchers will still verify ancestry, so step up a level
6008 } else if ( compiled ) {
6009 context = context.parentNode;
6010 }
6011
6012 selector = selector.slice( tokens.shift().value.length );
6013 }
6014
6015 // Fetch a seed set for right-to-left matching
6016 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
6017 while ( i-- ) {
6018 token = tokens[i];
6019
6020 // Abort if we hit a combinator
6021 if ( Expr.relative[ (type = token.type) ] ) {
6022 break;
6023 }
6024 if ( (find = Expr.find[ type ]) ) {
6025 // Search, expanding context for leading sibling combinators
6026 if ( (seed = find(
6027 token.matches[0].replace( runescape, funescape ),
6028 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
6029 )) ) {
6030
6031 // If seed is empty or no tokens remain, we can return early
6032 tokens.splice( i, 1 );
6033 selector = seed.length && toSelector( tokens );
6034 if ( !selector ) {
6035 push.apply( results, seed );
6036 return results;
6037 }
6038
6039 break;
6040 }
6041 }
6042 }
6043 }
6044
6045 // Compile and execute a filtering function if one is not provided
6046 // Provide `match` to avoid retokenization if we modified the selector above
6047 ( compiled || compile( selector, match ) )(
6048 seed,
6049 context,
6050 !documentIsHTML,
6051 results,
6052 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
6053 );
6054 return results;
6055};
6056
6057// One-time assignments
6058
6059// Sort stability
6060support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
6061
6062// Support: Chrome 14-35+
6063// Always assume duplicates if they aren't passed to the comparison function
6064support.detectDuplicates = !!hasDuplicate;
6065
6066// Initialize against the default document
6067setDocument();
6068
6069// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
6070// Detached nodes confoundingly follow *each other*
6071support.sortDetached = assert(function( el ) {
6072 // Should return 1, but returns 4 (following)
6073 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
6074});
6075
6076// Support: IE<8
6077// Prevent attribute/property "interpolation"
6078// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
6079if ( !assert(function( el ) {
6080 el.innerHTML = "<a href='#'></a>";
6081 return el.firstChild.getAttribute("href") === "#" ;
6082}) ) {
6083 addHandle( "type|href|height|width", function( elem, name, isXML ) {
6084 if ( !isXML ) {
6085 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
6086 }
6087 });
6088}
6089
6090// Support: IE<9
6091// Use defaultValue in place of getAttribute("value")
6092if ( !support.attributes || !assert(function( el ) {
6093 el.innerHTML = "<input/>";
6094 el.firstChild.setAttribute( "value", "" );
6095 return el.firstChild.getAttribute( "value" ) === "";
6096}) ) {
6097 addHandle( "value", function( elem, name, isXML ) {
6098 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
6099 return elem.defaultValue;
6100 }
6101 });
6102}
6103
6104// Support: IE<9
6105// Use getAttributeNode to fetch booleans when getAttribute lies
6106if ( !assert(function( el ) {
6107 return el.getAttribute("disabled") == null;
6108}) ) {
6109 addHandle( booleans, function( elem, name, isXML ) {
6110 var val;
6111 if ( !isXML ) {
6112 return elem[ name ] === true ? name.toLowerCase() :
6113 (val = elem.getAttributeNode( name )) && val.specified ?
6114 val.value :
6115 null;
6116 }
6117 });
6118}
6119
6120return Sizzle;
6121
6122})( window );
6123
6124
6125
6126jQuery.find = Sizzle;
6127jQuery.expr = Sizzle.selectors;
6128
6129// Deprecated
6130jQuery.expr[ ":" ] = jQuery.expr.pseudos;
6131jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
6132jQuery.text = Sizzle.getText;
6133jQuery.isXMLDoc = Sizzle.isXML;
6134jQuery.contains = Sizzle.contains;
6135jQuery.escapeSelector = Sizzle.escape;
6136
6137
6138
6139
6140var dir = function( elem, dir, until ) {
6141 var matched = [],
6142 truncate = until !== undefined;
6143
6144 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
6145 if ( elem.nodeType === 1 ) {
6146 if ( truncate && jQuery( elem ).is( until ) ) {
6147 break;
6148 }
6149 matched.push( elem );
6150 }
6151 }
6152 return matched;
6153};
6154
6155
6156var siblings = function( n, elem ) {
6157 var matched = [];
6158
6159 for ( ; n; n = n.nextSibling ) {
6160 if ( n.nodeType === 1 && n !== elem ) {
6161 matched.push( n );
6162 }
6163 }
6164
6165 return matched;
6166};
6167
6168
6169var rneedsContext = jQuery.expr.match.needsContext;
6170
6171var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
6172
6173
6174
6175var risSimple = /^.[^:#\[\.,]*$/;
6176
6177// Implement the identical functionality for filter and not
6178function winnow( elements, qualifier, not ) {
6179 if ( jQuery.isFunction( qualifier ) ) {
6180 return jQuery.grep( elements, function( elem, i ) {
6181 return !!qualifier.call( elem, i, elem ) !== not;
6182 } );
6183 }
6184
6185 // Single element
6186 if ( qualifier.nodeType ) {
6187 return jQuery.grep( elements, function( elem ) {
6188 return ( elem === qualifier ) !== not;
6189 } );
6190 }
6191
6192 // Arraylike of elements (jQuery, arguments, Array)
6193 if ( typeof qualifier !== "string" ) {
6194 return jQuery.grep( elements, function( elem ) {
6195 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
6196 } );
6197 }
6198
6199 // Simple selector that can be filtered directly, removing non-Elements
6200 if ( risSimple.test( qualifier ) ) {
6201 return jQuery.filter( qualifier, elements, not );
6202 }
6203
6204 // Complex selector, compare the two sets, removing non-Elements
6205 qualifier = jQuery.filter( qualifier, elements );
6206 return jQuery.grep( elements, function( elem ) {
6207 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
6208 } );
6209}
6210
6211jQuery.filter = function( expr, elems, not ) {
6212 var elem = elems[ 0 ];
6213
6214 if ( not ) {
6215 expr = ":not(" + expr + ")";
6216 }
6217
6218 if ( elems.length === 1 && elem.nodeType === 1 ) {
6219 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
6220 }
6221
6222 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
6223 return elem.nodeType === 1;
6224 } ) );
6225};
6226
6227jQuery.fn.extend( {
6228 find: function( selector ) {
6229 var i, ret,
6230 len = this.length,
6231 self = this;
6232
6233 if ( typeof selector !== "string" ) {
6234 return this.pushStack( jQuery( selector ).filter( function() {
6235 for ( i = 0; i < len; i++ ) {
6236 if ( jQuery.contains( self[ i ], this ) ) {
6237 return true;
6238 }
6239 }
6240 } ) );
6241 }
6242
6243 ret = this.pushStack( [] );
6244
6245 for ( i = 0; i < len; i++ ) {
6246 jQuery.find( selector, self[ i ], ret );
6247 }
6248
6249 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
6250 },
6251 filter: function( selector ) {
6252 return this.pushStack( winnow( this, selector || [], false ) );
6253 },
6254 not: function( selector ) {
6255 return this.pushStack( winnow( this, selector || [], true ) );
6256 },
6257 is: function( selector ) {
6258 return !!winnow(
6259 this,
6260
6261 // If this is a positional/relative selector, check membership in the returned set
6262 // so $("p:first").is("p:last") won't return true for a doc with two "p".
6263 typeof selector === "string" && rneedsContext.test( selector ) ?
6264 jQuery( selector ) :
6265 selector || [],
6266 false
6267 ).length;
6268 }
6269} );
6270
6271
6272// Initialize a jQuery object
6273
6274
6275// A central reference to the root jQuery(document)
6276var rootjQuery,
6277
6278 // A simple way to check for HTML strings
6279 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
6280 // Strict HTML recognition (#11290: must start with <)
6281 // Shortcut simple #id case for speed
6282 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
6283
6284 init = jQuery.fn.init = function( selector, context, root ) {
6285 var match, elem;
6286
6287 // HANDLE: $(""), $(null), $(undefined), $(false)
6288 if ( !selector ) {
6289 return this;
6290 }
6291
6292 // Method init() accepts an alternate rootjQuery
6293 // so migrate can support jQuery.sub (gh-2101)
6294 root = root || rootjQuery;
6295
6296 // Handle HTML strings
6297 if ( typeof selector === "string" ) {
6298 if ( selector[ 0 ] === "<" &&
6299 selector[ selector.length - 1 ] === ">" &&
6300 selector.length >= 3 ) {
6301
6302 // Assume that strings that start and end with <> are HTML and skip the regex check
6303 match = [ null, selector, null ];
6304
6305 } else {
6306 match = rquickExpr.exec( selector );
6307 }
6308
6309 // Match html or make sure no context is specified for #id
6310 if ( match && ( match[ 1 ] || !context ) ) {
6311
6312 // HANDLE: $(html) -> $(array)
6313 if ( match[ 1 ] ) {
6314 context = context instanceof jQuery ? context[ 0 ] : context;
6315
6316 // Option to run scripts is true for back-compat
6317 // Intentionally let the error be thrown if parseHTML is not present
6318 jQuery.merge( this, jQuery.parseHTML(
6319 match[ 1 ],
6320 context && context.nodeType ? context.ownerDocument || context : document,
6321 true
6322 ) );
6323
6324 // HANDLE: $(html, props)
6325 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
6326 for ( match in context ) {
6327
6328 // Properties of context are called as methods if possible
6329 if ( jQuery.isFunction( this[ match ] ) ) {
6330 this[ match ]( context[ match ] );
6331
6332 // ...and otherwise set as attributes
6333 } else {
6334 this.attr( match, context[ match ] );
6335 }
6336 }
6337 }
6338
6339 return this;
6340
6341 // HANDLE: $(#id)
6342 } else {
6343 elem = document.getElementById( match[ 2 ] );
6344
6345 if ( elem ) {
6346
6347 // Inject the element directly into the jQuery object
6348 this[ 0 ] = elem;
6349 this.length = 1;
6350 }
6351 return this;
6352 }
6353
6354 // HANDLE: $(expr, $(...))
6355 } else if ( !context || context.jquery ) {
6356 return ( context || root ).find( selector );
6357
6358 // HANDLE: $(expr, context)
6359 // (which is just equivalent to: $(context).find(expr)
6360 } else {
6361 return this.constructor( context ).find( selector );
6362 }
6363
6364 // HANDLE: $(DOMElement)
6365 } else if ( selector.nodeType ) {
6366 this[ 0 ] = selector;
6367 this.length = 1;
6368 return this;
6369
6370 // HANDLE: $(function)
6371 // Shortcut for document ready
6372 } else if ( jQuery.isFunction( selector ) ) {
6373 return root.ready !== undefined ?
6374 root.ready( selector ) :
6375
6376 // Execute immediately if ready is not present
6377 selector( jQuery );
6378 }
6379
6380 return jQuery.makeArray( selector, this );
6381 };
6382
6383// Give the init function the jQuery prototype for later instantiation
6384init.prototype = jQuery.fn;
6385
6386// Initialize central reference
6387rootjQuery = jQuery( document );
6388
6389
6390var rparentsprev = /^(?:parents|prev(?:Until|All))/,
6391
6392 // Methods guaranteed to produce a unique set when starting from a unique set
6393 guaranteedUnique = {
6394 children: true,
6395 contents: true,
6396 next: true,
6397 prev: true
6398 };
6399
6400jQuery.fn.extend( {
6401 has: function( target ) {
6402 var targets = jQuery( target, this ),
6403 l = targets.length;
6404
6405 return this.filter( function() {
6406 var i = 0;
6407 for ( ; i < l; i++ ) {
6408 if ( jQuery.contains( this, targets[ i ] ) ) {
6409 return true;
6410 }
6411 }
6412 } );
6413 },
6414
6415 closest: function( selectors, context ) {
6416 var cur,
6417 i = 0,
6418 l = this.length,
6419 matched = [],
6420 targets = typeof selectors !== "string" && jQuery( selectors );
6421
6422 // Positional selectors never match, since there's no _selection_ context
6423 if ( !rneedsContext.test( selectors ) ) {
6424 for ( ; i < l; i++ ) {
6425 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
6426
6427 // Always skip document fragments
6428 if ( cur.nodeType < 11 && ( targets ?
6429 targets.index( cur ) > -1 :
6430
6431 // Don't pass non-elements to Sizzle
6432 cur.nodeType === 1 &&
6433 jQuery.find.matchesSelector( cur, selectors ) ) ) {
6434
6435 matched.push( cur );
6436 break;
6437 }
6438 }
6439 }
6440 }
6441
6442 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
6443 },
6444
6445 // Determine the position of an element within the set
6446 index: function( elem ) {
6447
6448 // No argument, return index in parent
6449 if ( !elem ) {
6450 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
6451 }
6452
6453 // Index in selector
6454 if ( typeof elem === "string" ) {
6455 return indexOf.call( jQuery( elem ), this[ 0 ] );
6456 }
6457
6458 // Locate the position of the desired element
6459 return indexOf.call( this,
6460
6461 // If it receives a jQuery object, the first element is used
6462 elem.jquery ? elem[ 0 ] : elem
6463 );
6464 },
6465
6466 add: function( selector, context ) {
6467 return this.pushStack(
6468 jQuery.uniqueSort(
6469 jQuery.merge( this.get(), jQuery( selector, context ) )
6470 )
6471 );
6472 },
6473
6474 addBack: function( selector ) {
6475 return this.add( selector == null ?
6476 this.prevObject : this.prevObject.filter( selector )
6477 );
6478 }
6479} );
6480
6481function sibling( cur, dir ) {
6482 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
6483 return cur;
6484}
6485
6486jQuery.each( {
6487 parent: function( elem ) {
6488 var parent = elem.parentNode;
6489 return parent && parent.nodeType !== 11 ? parent : null;
6490 },
6491 parents: function( elem ) {
6492 return dir( elem, "parentNode" );
6493 },
6494 parentsUntil: function( elem, i, until ) {
6495 return dir( elem, "parentNode", until );
6496 },
6497 next: function( elem ) {
6498 return sibling( elem, "nextSibling" );
6499 },
6500 prev: function( elem ) {
6501 return sibling( elem, "previousSibling" );
6502 },
6503 nextAll: function( elem ) {
6504 return dir( elem, "nextSibling" );
6505 },
6506 prevAll: function( elem ) {
6507 return dir( elem, "previousSibling" );
6508 },
6509 nextUntil: function( elem, i, until ) {
6510 return dir( elem, "nextSibling", until );
6511 },
6512 prevUntil: function( elem, i, until ) {
6513 return dir( elem, "previousSibling", until );
6514 },
6515 siblings: function( elem ) {
6516 return siblings( ( elem.parentNode || {} ).firstChild, elem );
6517 },
6518 children: function( elem ) {
6519 return siblings( elem.firstChild );
6520 },
6521 contents: function( elem ) {
6522 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
6523 }
6524}, function( name, fn ) {
6525 jQuery.fn[ name ] = function( until, selector ) {
6526 var matched = jQuery.map( this, fn, until );
6527
6528 if ( name.slice( -5 ) !== "Until" ) {
6529 selector = until;
6530 }
6531
6532 if ( selector && typeof selector === "string" ) {
6533 matched = jQuery.filter( selector, matched );
6534 }
6535
6536 if ( this.length > 1 ) {
6537
6538 // Remove duplicates
6539 if ( !guaranteedUnique[ name ] ) {
6540 jQuery.uniqueSort( matched );
6541 }
6542
6543 // Reverse order for parents* and prev-derivatives
6544 if ( rparentsprev.test( name ) ) {
6545 matched.reverse();
6546 }
6547 }
6548
6549 return this.pushStack( matched );
6550 };
6551} );
6552var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
6553
6554
6555
6556// Convert String-formatted options into Object-formatted ones
6557function createOptions( options ) {
6558 var object = {};
6559 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
6560 object[ flag ] = true;
6561 } );
6562 return object;
6563}
6564
6565/*
6566 * Create a callback list using the following parameters:
6567 *
6568 * options: an optional list of space-separated options that will change how
6569 * the callback list behaves or a more traditional option object
6570 *
6571 * By default a callback list will act like an event callback list and can be
6572 * "fired" multiple times.
6573 *
6574 * Possible options:
6575 *
6576 * once: will ensure the callback list can only be fired once (like a Deferred)
6577 *
6578 * memory: will keep track of previous values and will call any callback added
6579 * after the list has been fired right away with the latest "memorized"
6580 * values (like a Deferred)
6581 *
6582 * unique: will ensure a callback can only be added once (no duplicate in the list)
6583 *
6584 * stopOnFalse: interrupt callings when a callback returns false
6585 *
6586 */
6587jQuery.Callbacks = function( options ) {
6588
6589 // Convert options from String-formatted to Object-formatted if needed
6590 // (we check in cache first)
6591 options = typeof options === "string" ?
6592 createOptions( options ) :
6593 jQuery.extend( {}, options );
6594
6595 var // Flag to know if list is currently firing
6596 firing,
6597
6598 // Last fire value for non-forgettable lists
6599 memory,
6600
6601 // Flag to know if list was already fired
6602 fired,
6603
6604 // Flag to prevent firing
6605 locked,
6606
6607 // Actual callback list
6608 list = [],
6609
6610 // Queue of execution data for repeatable lists
6611 queue = [],
6612
6613 // Index of currently firing callback (modified by add/remove as needed)
6614 firingIndex = -1,
6615
6616 // Fire callbacks
6617 fire = function() {
6618
6619 // Enforce single-firing
6620 locked = options.once;
6621
6622 // Execute callbacks for all pending executions,
6623 // respecting firingIndex overrides and runtime changes
6624 fired = firing = true;
6625 for ( ; queue.length; firingIndex = -1 ) {
6626 memory = queue.shift();
6627 while ( ++firingIndex < list.length ) {
6628
6629 // Run callback and check for early termination
6630 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
6631 options.stopOnFalse ) {
6632
6633 // Jump to end and forget the data so .add doesn't re-fire
6634 firingIndex = list.length;
6635 memory = false;
6636 }
6637 }
6638 }
6639
6640 // Forget the data if we're done with it
6641 if ( !options.memory ) {
6642 memory = false;
6643 }
6644
6645 firing = false;
6646
6647 // Clean up if we're done firing for good
6648 if ( locked ) {
6649
6650 // Keep an empty list if we have data for future add calls
6651 if ( memory ) {
6652 list = [];
6653
6654 // Otherwise, this object is spent
6655 } else {
6656 list = "";
6657 }
6658 }
6659 },
6660
6661 // Actual Callbacks object
6662 self = {
6663
6664 // Add a callback or a collection of callbacks to the list
6665 add: function() {
6666 if ( list ) {
6667
6668 // If we have memory from a past run, we should fire after adding
6669 if ( memory && !firing ) {
6670 firingIndex = list.length - 1;
6671 queue.push( memory );
6672 }
6673
6674 ( function add( args ) {
6675 jQuery.each( args, function( _, arg ) {
6676 if ( jQuery.isFunction( arg ) ) {
6677 if ( !options.unique || !self.has( arg ) ) {
6678 list.push( arg );
6679 }
6680 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
6681
6682 // Inspect recursively
6683 add( arg );
6684 }
6685 } );
6686 } )( arguments );
6687
6688 if ( memory && !firing ) {
6689 fire();
6690 }
6691 }
6692 return this;
6693 },
6694
6695 // Remove a callback from the list
6696 remove: function() {
6697 jQuery.each( arguments, function( _, arg ) {
6698 var index;
6699 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
6700 list.splice( index, 1 );
6701
6702 // Handle firing indexes
6703 if ( index <= firingIndex ) {
6704 firingIndex--;
6705 }
6706 }
6707 } );
6708 return this;
6709 },
6710
6711 // Check if a given callback is in the list.
6712 // If no argument is given, return whether or not list has callbacks attached.
6713 has: function( fn ) {
6714 return fn ?
6715 jQuery.inArray( fn, list ) > -1 :
6716 list.length > 0;
6717 },
6718
6719 // Remove all callbacks from the list
6720 empty: function() {
6721 if ( list ) {
6722 list = [];
6723 }
6724 return this;
6725 },
6726
6727 // Disable .fire and .add
6728 // Abort any current/pending executions
6729 // Clear all callbacks and values
6730 disable: function() {
6731 locked = queue = [];
6732 list = memory = "";
6733 return this;
6734 },
6735 disabled: function() {
6736 return !list;
6737 },
6738
6739 // Disable .fire
6740 // Also disable .add unless we have memory (since it would have no effect)
6741 // Abort any pending executions
6742 lock: function() {
6743 locked = queue = [];
6744 if ( !memory && !firing ) {
6745 list = memory = "";
6746 }
6747 return this;
6748 },
6749 locked: function() {
6750 return !!locked;
6751 },
6752
6753 // Call all callbacks with the given context and arguments
6754 fireWith: function( context, args ) {
6755 if ( !locked ) {
6756 args = args || [];
6757 args = [ context, args.slice ? args.slice() : args ];
6758 queue.push( args );
6759 if ( !firing ) {
6760 fire();
6761 }
6762 }
6763 return this;
6764 },
6765
6766 // Call all the callbacks with the given arguments
6767 fire: function() {
6768 self.fireWith( this, arguments );
6769 return this;
6770 },
6771
6772 // To know if the callbacks have already been called at least once
6773 fired: function() {
6774 return !!fired;
6775 }
6776 };
6777
6778 return self;
6779};
6780
6781
6782function Identity( v ) {
6783 return v;
6784}
6785function Thrower( ex ) {
6786 throw ex;
6787}
6788
6789function adoptValue( value, resolve, reject ) {
6790 var method;
6791
6792 try {
6793
6794 // Check for promise aspect first to privilege synchronous behavior
6795 if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
6796 method.call( value ).done( resolve ).fail( reject );
6797
6798 // Other thenables
6799 } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
6800 method.call( value, resolve, reject );
6801
6802 // Other non-thenables
6803 } else {
6804
6805 // Support: Android 4.0 only
6806 // Strict mode functions invoked without .call/.apply get global-object context
6807 resolve.call( undefined, value );
6808 }
6809
6810 // For Promises/A+, convert exceptions into rejections
6811 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
6812 // Deferred#then to conditionally suppress rejection.
6813 } catch ( value ) {
6814
6815 // Support: Android 4.0 only
6816 // Strict mode functions invoked without .call/.apply get global-object context
6817 reject.call( undefined, value );
6818 }
6819}
6820
6821jQuery.extend( {
6822
6823 Deferred: function( func ) {
6824 var tuples = [
6825
6826 // action, add listener, callbacks,
6827 // ... .then handlers, argument index, [final state]
6828 [ "notify", "progress", jQuery.Callbacks( "memory" ),
6829 jQuery.Callbacks( "memory" ), 2 ],
6830 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
6831 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
6832 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
6833 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
6834 ],
6835 state = "pending",
6836 promise = {
6837 state: function() {
6838 return state;
6839 },
6840 always: function() {
6841 deferred.done( arguments ).fail( arguments );
6842 return this;
6843 },
6844 "catch": function( fn ) {
6845 return promise.then( null, fn );
6846 },
6847
6848 // Keep pipe for back-compat
6849 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
6850 var fns = arguments;
6851
6852 return jQuery.Deferred( function( newDefer ) {
6853 jQuery.each( tuples, function( i, tuple ) {
6854
6855 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
6856 var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
6857
6858 // deferred.progress(function() { bind to newDefer or newDefer.notify })
6859 // deferred.done(function() { bind to newDefer or newDefer.resolve })
6860 // deferred.fail(function() { bind to newDefer or newDefer.reject })
6861 deferred[ tuple[ 1 ] ]( function() {
6862 var returned = fn && fn.apply( this, arguments );
6863 if ( returned && jQuery.isFunction( returned.promise ) ) {
6864 returned.promise()
6865 .progress( newDefer.notify )
6866 .done( newDefer.resolve )
6867 .fail( newDefer.reject );
6868 } else {
6869 newDefer[ tuple[ 0 ] + "With" ](
6870 this,
6871 fn ? [ returned ] : arguments
6872 );
6873 }
6874 } );
6875 } );
6876 fns = null;
6877 } ).promise();
6878 },
6879 then: function( onFulfilled, onRejected, onProgress ) {
6880 var maxDepth = 0;
6881 function resolve( depth, deferred, handler, special ) {
6882 return function() {
6883 var that = this,
6884 args = arguments,
6885 mightThrow = function() {
6886 var returned, then;
6887
6888 // Support: Promises/A+ section 2.3.3.3.3
6889 // https://promisesaplus.com/#point-59
6890 // Ignore double-resolution attempts
6891 if ( depth < maxDepth ) {
6892 return;
6893 }
6894
6895 returned = handler.apply( that, args );
6896
6897 // Support: Promises/A+ section 2.3.1
6898 // https://promisesaplus.com/#point-48
6899 if ( returned === deferred.promise() ) {
6900 throw new TypeError( "Thenable self-resolution" );
6901 }
6902
6903 // Support: Promises/A+ sections 2.3.3.1, 3.5
6904 // https://promisesaplus.com/#point-54
6905 // https://promisesaplus.com/#point-75
6906 // Retrieve `then` only once
6907 then = returned &&
6908
6909 // Support: Promises/A+ section 2.3.4
6910 // https://promisesaplus.com/#point-64
6911 // Only check objects and functions for thenability
6912 ( typeof returned === "object" ||
6913 typeof returned === "function" ) &&
6914 returned.then;
6915
6916 // Handle a returned thenable
6917 if ( jQuery.isFunction( then ) ) {
6918
6919 // Special processors (notify) just wait for resolution
6920 if ( special ) {
6921 then.call(
6922 returned,
6923 resolve( maxDepth, deferred, Identity, special ),
6924 resolve( maxDepth, deferred, Thrower, special )
6925 );
6926
6927 // Normal processors (resolve) also hook into progress
6928 } else {
6929
6930 // ...and disregard older resolution values
6931 maxDepth++;
6932
6933 then.call(
6934 returned,
6935 resolve( maxDepth, deferred, Identity, special ),
6936 resolve( maxDepth, deferred, Thrower, special ),
6937 resolve( maxDepth, deferred, Identity,
6938 deferred.notifyWith )
6939 );
6940 }
6941
6942 // Handle all other returned values
6943 } else {
6944
6945 // Only substitute handlers pass on context
6946 // and multiple values (non-spec behavior)
6947 if ( handler !== Identity ) {
6948 that = undefined;
6949 args = [ returned ];
6950 }
6951
6952 // Process the value(s)
6953 // Default process is resolve
6954 ( special || deferred.resolveWith )( that, args );
6955 }
6956 },
6957
6958 // Only normal processors (resolve) catch and reject exceptions
6959 process = special ?
6960 mightThrow :
6961 function() {
6962 try {
6963 mightThrow();
6964 } catch ( e ) {
6965
6966 if ( jQuery.Deferred.exceptionHook ) {
6967 jQuery.Deferred.exceptionHook( e,
6968 process.stackTrace );
6969 }
6970
6971 // Support: Promises/A+ section 2.3.3.3.4.1
6972 // https://promisesaplus.com/#point-61
6973 // Ignore post-resolution exceptions
6974 if ( depth + 1 >= maxDepth ) {
6975
6976 // Only substitute handlers pass on context
6977 // and multiple values (non-spec behavior)
6978 if ( handler !== Thrower ) {
6979 that = undefined;
6980 args = [ e ];
6981 }
6982
6983 deferred.rejectWith( that, args );
6984 }
6985 }
6986 };
6987
6988 // Support: Promises/A+ section 2.3.3.3.1
6989 // https://promisesaplus.com/#point-57
6990 // Re-resolve promises immediately to dodge false rejection from
6991 // subsequent errors
6992 if ( depth ) {
6993 process();
6994 } else {
6995
6996 // Call an optional hook to record the stack, in case of exception
6997 // since it's otherwise lost when execution goes async
6998 if ( jQuery.Deferred.getStackHook ) {
6999 process.stackTrace = jQuery.Deferred.getStackHook();
7000 }
7001 window.setTimeout( process );
7002 }
7003 };
7004 }
7005
7006 return jQuery.Deferred( function( newDefer ) {
7007
7008 // progress_handlers.add( ... )
7009 tuples[ 0 ][ 3 ].add(
7010 resolve(
7011 0,
7012 newDefer,
7013 jQuery.isFunction( onProgress ) ?
7014 onProgress :
7015 Identity,
7016 newDefer.notifyWith
7017 )
7018 );
7019
7020 // fulfilled_handlers.add( ... )
7021 tuples[ 1 ][ 3 ].add(
7022 resolve(
7023 0,
7024 newDefer,
7025 jQuery.isFunction( onFulfilled ) ?
7026 onFulfilled :
7027 Identity
7028 )
7029 );
7030
7031 // rejected_handlers.add( ... )
7032 tuples[ 2 ][ 3 ].add(
7033 resolve(
7034 0,
7035 newDefer,
7036 jQuery.isFunction( onRejected ) ?
7037 onRejected :
7038 Thrower
7039 )
7040 );
7041 } ).promise();
7042 },
7043
7044 // Get a promise for this deferred
7045 // If obj is provided, the promise aspect is added to the object
7046 promise: function( obj ) {
7047 return obj != null ? jQuery.extend( obj, promise ) : promise;
7048 }
7049 },
7050 deferred = {};
7051
7052 // Add list-specific methods
7053 jQuery.each( tuples, function( i, tuple ) {
7054 var list = tuple[ 2 ],
7055 stateString = tuple[ 5 ];
7056
7057 // promise.progress = list.add
7058 // promise.done = list.add
7059 // promise.fail = list.add
7060 promise[ tuple[ 1 ] ] = list.add;
7061
7062 // Handle state
7063 if ( stateString ) {
7064 list.add(
7065 function() {
7066
7067 // state = "resolved" (i.e., fulfilled)
7068 // state = "rejected"
7069 state = stateString;
7070 },
7071
7072 // rejected_callbacks.disable
7073 // fulfilled_callbacks.disable
7074 tuples[ 3 - i ][ 2 ].disable,
7075
7076 // progress_callbacks.lock
7077 tuples[ 0 ][ 2 ].lock
7078 );
7079 }
7080
7081 // progress_handlers.fire
7082 // fulfilled_handlers.fire
7083 // rejected_handlers.fire
7084 list.add( tuple[ 3 ].fire );
7085
7086 // deferred.notify = function() { deferred.notifyWith(...) }
7087 // deferred.resolve = function() { deferred.resolveWith(...) }
7088 // deferred.reject = function() { deferred.rejectWith(...) }
7089 deferred[ tuple[ 0 ] ] = function() {
7090 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
7091 return this;
7092 };
7093
7094 // deferred.notifyWith = list.fireWith
7095 // deferred.resolveWith = list.fireWith
7096 // deferred.rejectWith = list.fireWith
7097 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
7098 } );
7099
7100 // Make the deferred a promise
7101 promise.promise( deferred );
7102
7103 // Call given func if any
7104 if ( func ) {
7105 func.call( deferred, deferred );
7106 }
7107
7108 // All done!
7109 return deferred;
7110 },
7111
7112 // Deferred helper
7113 when: function( singleValue ) {
7114 var
7115
7116 // count of uncompleted subordinates
7117 remaining = arguments.length,
7118
7119 // count of unprocessed arguments
7120 i = remaining,
7121
7122 // subordinate fulfillment data
7123 resolveContexts = Array( i ),
7124 resolveValues = slice.call( arguments ),
7125
7126 // the master Deferred
7127 master = jQuery.Deferred(),
7128
7129 // subordinate callback factory
7130 updateFunc = function( i ) {
7131 return function( value ) {
7132 resolveContexts[ i ] = this;
7133 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
7134 if ( !( --remaining ) ) {
7135 master.resolveWith( resolveContexts, resolveValues );
7136 }
7137 };
7138 };
7139
7140 // Single- and empty arguments are adopted like Promise.resolve
7141 if ( remaining <= 1 ) {
7142 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
7143
7144 // Use .then() to unwrap secondary thenables (cf. gh-3000)
7145 if ( master.state() === "pending" ||
7146 jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
7147
7148 return master.then();
7149 }
7150 }
7151
7152 // Multiple arguments are aggregated like Promise.all array elements
7153 while ( i-- ) {
7154 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
7155 }
7156
7157 return master.promise();
7158 }
7159} );
7160
7161
7162// These usually indicate a programmer mistake during development,
7163// warn about them ASAP rather than swallowing them by default.
7164var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
7165
7166jQuery.Deferred.exceptionHook = function( error, stack ) {
7167
7168 // Support: IE 8 - 9 only
7169 // Console exists when dev tools are open, which can happen at any time
7170 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
7171 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
7172 }
7173};
7174
7175
7176
7177
7178jQuery.readyException = function( error ) {
7179 window.setTimeout( function() {
7180 throw error;
7181 } );
7182};
7183
7184
7185
7186
7187// The deferred used on DOM ready
7188var readyList = jQuery.Deferred();
7189
7190jQuery.fn.ready = function( fn ) {
7191
7192 readyList
7193 .then( fn )
7194
7195 // Wrap jQuery.readyException in a function so that the lookup
7196 // happens at the time of error handling instead of callback
7197 // registration.
7198 .catch( function( error ) {
7199 jQuery.readyException( error );
7200 } );
7201
7202 return this;
7203};
7204
7205jQuery.extend( {
7206
7207 // Is the DOM ready to be used? Set to true once it occurs.
7208 isReady: false,
7209
7210 // A counter to track how many items to wait for before
7211 // the ready event fires. See #6781
7212 readyWait: 1,
7213
7214 // Hold (or release) the ready event
7215 holdReady: function( hold ) {
7216 if ( hold ) {
7217 jQuery.readyWait++;
7218 } else {
7219 jQuery.ready( true );
7220 }
7221 },
7222
7223 // Handle when the DOM is ready
7224 ready: function( wait ) {
7225
7226 // Abort if there are pending holds or we're already ready
7227 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
7228 return;
7229 }
7230
7231 // Remember that the DOM is ready
7232 jQuery.isReady = true;
7233
7234 // If a normal DOM Ready event fired, decrement, and wait if need be
7235 if ( wait !== true && --jQuery.readyWait > 0 ) {
7236 return;
7237 }
7238
7239 // If there are functions bound, to execute
7240 readyList.resolveWith( document, [ jQuery ] );
7241 }
7242} );
7243
7244jQuery.ready.then = readyList.then;
7245
7246// The ready event handler and self cleanup method
7247function completed() {
7248 document.removeEventListener( "DOMContentLoaded", completed );
7249 window.removeEventListener( "load", completed );
7250 jQuery.ready();
7251}
7252
7253// Catch cases where $(document).ready() is called
7254// after the browser event has already occurred.
7255// Support: IE <=9 - 10 only
7256// Older IE sometimes signals "interactive" too soon
7257if ( document.readyState === "complete" ||
7258 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
7259
7260 // Handle it asynchronously to allow scripts the opportunity to delay ready
7261 window.setTimeout( jQuery.ready );
7262
7263} else {
7264
7265 // Use the handy event callback
7266 document.addEventListener( "DOMContentLoaded", completed );
7267
7268 // A fallback to window.onload, that will always work
7269 window.addEventListener( "load", completed );
7270}
7271
7272
7273
7274
7275// Multifunctional method to get and set values of a collection
7276// The value/s can optionally be executed if it's a function
7277var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
7278 var i = 0,
7279 len = elems.length,
7280 bulk = key == null;
7281
7282 // Sets many values
7283 if ( jQuery.type( key ) === "object" ) {
7284 chainable = true;
7285 for ( i in key ) {
7286 access( elems, fn, i, key[ i ], true, emptyGet, raw );
7287 }
7288
7289 // Sets one value
7290 } else if ( value !== undefined ) {
7291 chainable = true;
7292
7293 if ( !jQuery.isFunction( value ) ) {
7294 raw = true;
7295 }
7296
7297 if ( bulk ) {
7298
7299 // Bulk operations run against the entire set
7300 if ( raw ) {
7301 fn.call( elems, value );
7302 fn = null;
7303
7304 // ...except when executing function values
7305 } else {
7306 bulk = fn;
7307 fn = function( elem, key, value ) {
7308 return bulk.call( jQuery( elem ), value );
7309 };
7310 }
7311 }
7312
7313 if ( fn ) {
7314 for ( ; i < len; i++ ) {
7315 fn(
7316 elems[ i ], key, raw ?
7317 value :
7318 value.call( elems[ i ], i, fn( elems[ i ], key ) )
7319 );
7320 }
7321 }
7322 }
7323
7324 if ( chainable ) {
7325 return elems;
7326 }
7327
7328 // Gets
7329 if ( bulk ) {
7330 return fn.call( elems );
7331 }
7332
7333 return len ? fn( elems[ 0 ], key ) : emptyGet;
7334};
7335var acceptData = function( owner ) {
7336
7337 // Accepts only:
7338 // - Node
7339 // - Node.ELEMENT_NODE
7340 // - Node.DOCUMENT_NODE
7341 // - Object
7342 // - Any
7343 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
7344};
7345
7346
7347
7348
7349function Data() {
7350 this.expando = jQuery.expando + Data.uid++;
7351}
7352
7353Data.uid = 1;
7354
7355Data.prototype = {
7356
7357 cache: function( owner ) {
7358
7359 // Check if the owner object already has a cache
7360 var value = owner[ this.expando ];
7361
7362 // If not, create one
7363 if ( !value ) {
7364 value = {};
7365
7366 // We can accept data for non-element nodes in modern browsers,
7367 // but we should not, see #8335.
7368 // Always return an empty object.
7369 if ( acceptData( owner ) ) {
7370
7371 // If it is a node unlikely to be stringify-ed or looped over
7372 // use plain assignment
7373 if ( owner.nodeType ) {
7374 owner[ this.expando ] = value;
7375
7376 // Otherwise secure it in a non-enumerable property
7377 // configurable must be true to allow the property to be
7378 // deleted when data is removed
7379 } else {
7380 Object.defineProperty( owner, this.expando, {
7381 value: value,
7382 configurable: true
7383 } );
7384 }
7385 }
7386 }
7387
7388 return value;
7389 },
7390 set: function( owner, data, value ) {
7391 var prop,
7392 cache = this.cache( owner );
7393
7394 // Handle: [ owner, key, value ] args
7395 // Always use camelCase key (gh-2257)
7396 if ( typeof data === "string" ) {
7397 cache[ jQuery.camelCase( data ) ] = value;
7398
7399 // Handle: [ owner, { properties } ] args
7400 } else {
7401
7402 // Copy the properties one-by-one to the cache object
7403 for ( prop in data ) {
7404 cache[ jQuery.camelCase( prop ) ] = data[ prop ];
7405 }
7406 }
7407 return cache;
7408 },
7409 get: function( owner, key ) {
7410 return key === undefined ?
7411 this.cache( owner ) :
7412
7413 // Always use camelCase key (gh-2257)
7414 owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
7415 },
7416 access: function( owner, key, value ) {
7417
7418 // In cases where either:
7419 //
7420 // 1. No key was specified
7421 // 2. A string key was specified, but no value provided
7422 //
7423 // Take the "read" path and allow the get method to determine
7424 // which value to return, respectively either:
7425 //
7426 // 1. The entire cache object
7427 // 2. The data stored at the key
7428 //
7429 if ( key === undefined ||
7430 ( ( key && typeof key === "string" ) && value === undefined ) ) {
7431
7432 return this.get( owner, key );
7433 }
7434
7435 // When the key is not a string, or both a key and value
7436 // are specified, set or extend (existing objects) with either:
7437 //
7438 // 1. An object of properties
7439 // 2. A key and value
7440 //
7441 this.set( owner, key, value );
7442
7443 // Since the "set" path can have two possible entry points
7444 // return the expected data based on which path was taken[*]
7445 return value !== undefined ? value : key;
7446 },
7447 remove: function( owner, key ) {
7448 var i,
7449 cache = owner[ this.expando ];
7450
7451 if ( cache === undefined ) {
7452 return;
7453 }
7454
7455 if ( key !== undefined ) {
7456
7457 // Support array or space separated string of keys
7458 if ( jQuery.isArray( key ) ) {
7459
7460 // If key is an array of keys...
7461 // We always set camelCase keys, so remove that.
7462 key = key.map( jQuery.camelCase );
7463 } else {
7464 key = jQuery.camelCase( key );
7465
7466 // If a key with the spaces exists, use it.
7467 // Otherwise, create an array by matching non-whitespace
7468 key = key in cache ?
7469 [ key ] :
7470 ( key.match( rnothtmlwhite ) || [] );
7471 }
7472
7473 i = key.length;
7474
7475 while ( i-- ) {
7476 delete cache[ key[ i ] ];
7477 }
7478 }
7479
7480 // Remove the expando if there's no more data
7481 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
7482
7483 // Support: Chrome <=35 - 45
7484 // Webkit & Blink performance suffers when deleting properties
7485 // from DOM nodes, so set to undefined instead
7486 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
7487 if ( owner.nodeType ) {
7488 owner[ this.expando ] = undefined;
7489 } else {
7490 delete owner[ this.expando ];
7491 }
7492 }
7493 },
7494 hasData: function( owner ) {
7495 var cache = owner[ this.expando ];
7496 return cache !== undefined && !jQuery.isEmptyObject( cache );
7497 }
7498};
7499var dataPriv = new Data();
7500
7501var dataUser = new Data();
7502
7503
7504
7505// Implementation Summary
7506//
7507// 1. Enforce API surface and semantic compatibility with 1.9.x branch
7508// 2. Improve the module's maintainability by reducing the storage
7509// paths to a single mechanism.
7510// 3. Use the same single mechanism to support "private" and "user" data.
7511// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
7512// 5. Avoid exposing implementation details on user objects (eg. expando properties)
7513// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
7514
7515var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
7516 rmultiDash = /[A-Z]/g;
7517
7518function getData( data ) {
7519 if ( data === "true" ) {
7520 return true;
7521 }
7522
7523 if ( data === "false" ) {
7524 return false;
7525 }
7526
7527 if ( data === "null" ) {
7528 return null;
7529 }
7530
7531 // Only convert to a number if it doesn't change the string
7532 if ( data === +data + "" ) {
7533 return +data;
7534 }
7535
7536 if ( rbrace.test( data ) ) {
7537 return JSON.parse( data );
7538 }
7539
7540 return data;
7541}
7542
7543function dataAttr( elem, key, data ) {
7544 var name;
7545
7546 // If nothing was found internally, try to fetch any
7547 // data from the HTML5 data-* attribute
7548 if ( data === undefined && elem.nodeType === 1 ) {
7549 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
7550 data = elem.getAttribute( name );
7551
7552 if ( typeof data === "string" ) {
7553 try {
7554 data = getData( data );
7555 } catch ( e ) {}
7556
7557 // Make sure we set the data so it isn't changed later
7558 dataUser.set( elem, key, data );
7559 } else {
7560 data = undefined;
7561 }
7562 }
7563 return data;
7564}
7565
7566jQuery.extend( {
7567 hasData: function( elem ) {
7568 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
7569 },
7570
7571 data: function( elem, name, data ) {
7572 return dataUser.access( elem, name, data );
7573 },
7574
7575 removeData: function( elem, name ) {
7576 dataUser.remove( elem, name );
7577 },
7578
7579 // TODO: Now that all calls to _data and _removeData have been replaced
7580 // with direct calls to dataPriv methods, these can be deprecated.
7581 _data: function( elem, name, data ) {
7582 return dataPriv.access( elem, name, data );
7583 },
7584
7585 _removeData: function( elem, name ) {
7586 dataPriv.remove( elem, name );
7587 }
7588} );
7589
7590jQuery.fn.extend( {
7591 data: function( key, value ) {
7592 var i, name, data,
7593 elem = this[ 0 ],
7594 attrs = elem && elem.attributes;
7595
7596 // Gets all values
7597 if ( key === undefined ) {
7598 if ( this.length ) {
7599 data = dataUser.get( elem );
7600
7601 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
7602 i = attrs.length;
7603 while ( i-- ) {
7604
7605 // Support: IE 11 only
7606 // The attrs elements can be null (#14894)
7607 if ( attrs[ i ] ) {
7608 name = attrs[ i ].name;
7609 if ( name.indexOf( "data-" ) === 0 ) {
7610 name = jQuery.camelCase( name.slice( 5 ) );
7611 dataAttr( elem, name, data[ name ] );
7612 }
7613 }
7614 }
7615 dataPriv.set( elem, "hasDataAttrs", true );
7616 }
7617 }
7618
7619 return data;
7620 }
7621
7622 // Sets multiple values
7623 if ( typeof key === "object" ) {
7624 return this.each( function() {
7625 dataUser.set( this, key );
7626 } );
7627 }
7628
7629 return access( this, function( value ) {
7630 var data;
7631
7632 // The calling jQuery object (element matches) is not empty
7633 // (and therefore has an element appears at this[ 0 ]) and the
7634 // `value` parameter was not undefined. An empty jQuery object
7635 // will result in `undefined` for elem = this[ 0 ] which will
7636 // throw an exception if an attempt to read a data cache is made.
7637 if ( elem && value === undefined ) {
7638
7639 // Attempt to get data from the cache
7640 // The key will always be camelCased in Data
7641 data = dataUser.get( elem, key );
7642 if ( data !== undefined ) {
7643 return data;
7644 }
7645
7646 // Attempt to "discover" the data in
7647 // HTML5 custom data-* attrs
7648 data = dataAttr( elem, key );
7649 if ( data !== undefined ) {
7650 return data;
7651 }
7652
7653 // We tried really hard, but the data doesn't exist.
7654 return;
7655 }
7656
7657 // Set the data...
7658 this.each( function() {
7659
7660 // We always store the camelCased key
7661 dataUser.set( this, key, value );
7662 } );
7663 }, null, value, arguments.length > 1, null, true );
7664 },
7665
7666 removeData: function( key ) {
7667 return this.each( function() {
7668 dataUser.remove( this, key );
7669 } );
7670 }
7671} );
7672
7673
7674jQuery.extend( {
7675 queue: function( elem, type, data ) {
7676 var queue;
7677
7678 if ( elem ) {
7679 type = ( type || "fx" ) + "queue";
7680 queue = dataPriv.get( elem, type );
7681
7682 // Speed up dequeue by getting out quickly if this is just a lookup
7683 if ( data ) {
7684 if ( !queue || jQuery.isArray( data ) ) {
7685 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
7686 } else {
7687 queue.push( data );
7688 }
7689 }
7690 return queue || [];
7691 }
7692 },
7693
7694 dequeue: function( elem, type ) {
7695 type = type || "fx";
7696
7697 var queue = jQuery.queue( elem, type ),
7698 startLength = queue.length,
7699 fn = queue.shift(),
7700 hooks = jQuery._queueHooks( elem, type ),
7701 next = function() {
7702 jQuery.dequeue( elem, type );
7703 };
7704
7705 // If the fx queue is dequeued, always remove the progress sentinel
7706 if ( fn === "inprogress" ) {
7707 fn = queue.shift();
7708 startLength--;
7709 }
7710
7711 if ( fn ) {
7712
7713 // Add a progress sentinel to prevent the fx queue from being
7714 // automatically dequeued
7715 if ( type === "fx" ) {
7716 queue.unshift( "inprogress" );
7717 }
7718
7719 // Clear up the last queue stop function
7720 delete hooks.stop;
7721 fn.call( elem, next, hooks );
7722 }
7723
7724 if ( !startLength && hooks ) {
7725 hooks.empty.fire();
7726 }
7727 },
7728
7729 // Not public - generate a queueHooks object, or return the current one
7730 _queueHooks: function( elem, type ) {
7731 var key = type + "queueHooks";
7732 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
7733 empty: jQuery.Callbacks( "once memory" ).add( function() {
7734 dataPriv.remove( elem, [ type + "queue", key ] );
7735 } )
7736 } );
7737 }
7738} );
7739
7740jQuery.fn.extend( {
7741 queue: function( type, data ) {
7742 var setter = 2;
7743
7744 if ( typeof type !== "string" ) {
7745 data = type;
7746 type = "fx";
7747 setter--;
7748 }
7749
7750 if ( arguments.length < setter ) {
7751 return jQuery.queue( this[ 0 ], type );
7752 }
7753
7754 return data === undefined ?
7755 this :
7756 this.each( function() {
7757 var queue = jQuery.queue( this, type, data );
7758
7759 // Ensure a hooks for this queue
7760 jQuery._queueHooks( this, type );
7761
7762 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
7763 jQuery.dequeue( this, type );
7764 }
7765 } );
7766 },
7767 dequeue: function( type ) {
7768 return this.each( function() {
7769 jQuery.dequeue( this, type );
7770 } );
7771 },
7772 clearQueue: function( type ) {
7773 return this.queue( type || "fx", [] );
7774 },
7775
7776 // Get a promise resolved when queues of a certain type
7777 // are emptied (fx is the type by default)
7778 promise: function( type, obj ) {
7779 var tmp,
7780 count = 1,
7781 defer = jQuery.Deferred(),
7782 elements = this,
7783 i = this.length,
7784 resolve = function() {
7785 if ( !( --count ) ) {
7786 defer.resolveWith( elements, [ elements ] );
7787 }
7788 };
7789
7790 if ( typeof type !== "string" ) {
7791 obj = type;
7792 type = undefined;
7793 }
7794 type = type || "fx";
7795
7796 while ( i-- ) {
7797 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
7798 if ( tmp && tmp.empty ) {
7799 count++;
7800 tmp.empty.add( resolve );
7801 }
7802 }
7803 resolve();
7804 return defer.promise( obj );
7805 }
7806} );
7807var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
7808
7809var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
7810
7811
7812var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
7813
7814var isHiddenWithinTree = function( elem, el ) {
7815
7816 // isHiddenWithinTree might be called from jQuery#filter function;
7817 // in that case, element will be second argument
7818 elem = el || elem;
7819
7820 // Inline style trumps all
7821 return elem.style.display === "none" ||
7822 elem.style.display === "" &&
7823
7824 // Otherwise, check computed style
7825 // Support: Firefox <=43 - 45
7826 // Disconnected elements can have computed display: none, so first confirm that elem is
7827 // in the document.
7828 jQuery.contains( elem.ownerDocument, elem ) &&
7829
7830 jQuery.css( elem, "display" ) === "none";
7831 };
7832
7833var swap = function( elem, options, callback, args ) {
7834 var ret, name,
7835 old = {};
7836
7837 // Remember the old values, and insert the new ones
7838 for ( name in options ) {
7839 old[ name ] = elem.style[ name ];
7840 elem.style[ name ] = options[ name ];
7841 }
7842
7843 ret = callback.apply( elem, args || [] );
7844
7845 // Revert the old values
7846 for ( name in options ) {
7847 elem.style[ name ] = old[ name ];
7848 }
7849
7850 return ret;
7851};
7852
7853
7854
7855
7856function adjustCSS( elem, prop, valueParts, tween ) {
7857 var adjusted,
7858 scale = 1,
7859 maxIterations = 20,
7860 currentValue = tween ?
7861 function() {
7862 return tween.cur();
7863 } :
7864 function() {
7865 return jQuery.css( elem, prop, "" );
7866 },
7867 initial = currentValue(),
7868 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
7869
7870 // Starting value computation is required for potential unit mismatches
7871 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
7872 rcssNum.exec( jQuery.css( elem, prop ) );
7873
7874 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
7875
7876 // Trust units reported by jQuery.css
7877 unit = unit || initialInUnit[ 3 ];
7878
7879 // Make sure we update the tween properties later on
7880 valueParts = valueParts || [];
7881
7882 // Iteratively approximate from a nonzero starting point
7883 initialInUnit = +initial || 1;
7884
7885 do {
7886
7887 // If previous iteration zeroed out, double until we get *something*.
7888 // Use string for doubling so we don't accidentally see scale as unchanged below
7889 scale = scale || ".5";
7890
7891 // Adjust and apply
7892 initialInUnit = initialInUnit / scale;
7893 jQuery.style( elem, prop, initialInUnit + unit );
7894
7895 // Update scale, tolerating zero or NaN from tween.cur()
7896 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
7897 } while (
7898 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
7899 );
7900 }
7901
7902 if ( valueParts ) {
7903 initialInUnit = +initialInUnit || +initial || 0;
7904
7905 // Apply relative offset (+=/-=) if specified
7906 adjusted = valueParts[ 1 ] ?
7907 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
7908 +valueParts[ 2 ];
7909 if ( tween ) {
7910 tween.unit = unit;
7911 tween.start = initialInUnit;
7912 tween.end = adjusted;
7913 }
7914 }
7915 return adjusted;
7916}
7917
7918
7919var defaultDisplayMap = {};
7920
7921function getDefaultDisplay( elem ) {
7922 var temp,
7923 doc = elem.ownerDocument,
7924 nodeName = elem.nodeName,
7925 display = defaultDisplayMap[ nodeName ];
7926
7927 if ( display ) {
7928 return display;
7929 }
7930
7931 temp = doc.body.appendChild( doc.createElement( nodeName ) );
7932 display = jQuery.css( temp, "display" );
7933
7934 temp.parentNode.removeChild( temp );
7935
7936 if ( display === "none" ) {
7937 display = "block";
7938 }
7939 defaultDisplayMap[ nodeName ] = display;
7940
7941 return display;
7942}
7943
7944function showHide( elements, show ) {
7945 var display, elem,
7946 values = [],
7947 index = 0,
7948 length = elements.length;
7949
7950 // Determine new display value for elements that need to change
7951 for ( ; index < length; index++ ) {
7952 elem = elements[ index ];
7953 if ( !elem.style ) {
7954 continue;
7955 }
7956
7957 display = elem.style.display;
7958 if ( show ) {
7959
7960 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
7961 // check is required in this first loop unless we have a nonempty display value (either
7962 // inline or about-to-be-restored)
7963 if ( display === "none" ) {
7964 values[ index ] = dataPriv.get( elem, "display" ) || null;
7965 if ( !values[ index ] ) {
7966 elem.style.display = "";
7967 }
7968 }
7969 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
7970 values[ index ] = getDefaultDisplay( elem );
7971 }
7972 } else {
7973 if ( display !== "none" ) {
7974 values[ index ] = "none";
7975
7976 // Remember what we're overwriting
7977 dataPriv.set( elem, "display", display );
7978 }
7979 }
7980 }
7981
7982 // Set the display of the elements in a second loop to avoid constant reflow
7983 for ( index = 0; index < length; index++ ) {
7984 if ( values[ index ] != null ) {
7985 elements[ index ].style.display = values[ index ];
7986 }
7987 }
7988
7989 return elements;
7990}
7991
7992jQuery.fn.extend( {
7993 show: function() {
7994 return showHide( this, true );
7995 },
7996 hide: function() {
7997 return showHide( this );
7998 },
7999 toggle: function( state ) {
8000 if ( typeof state === "boolean" ) {
8001 return state ? this.show() : this.hide();
8002 }
8003
8004 return this.each( function() {
8005 if ( isHiddenWithinTree( this ) ) {
8006 jQuery( this ).show();
8007 } else {
8008 jQuery( this ).hide();
8009 }
8010 } );
8011 }
8012} );
8013var rcheckableType = ( /^(?:checkbox|radio)$/i );
8014
8015var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
8016
8017var rscriptType = ( /^$|\/(?:java|ecma)script/i );
8018
8019
8020
8021// We have to close these tags to support XHTML (#13200)
8022var wrapMap = {
8023
8024 // Support: IE <=9 only
8025 option: [ 1, "<select multiple='multiple'>", "</select>" ],
8026
8027 // XHTML parsers do not magically insert elements in the
8028 // same way that tag soup parsers do. So we cannot shorten
8029 // this by omitting <tbody> or other required elements.
8030 thead: [ 1, "<table>", "</table>" ],
8031 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
8032 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
8033 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
8034
8035 _default: [ 0, "", "" ]
8036};
8037
8038// Support: IE <=9 only
8039wrapMap.optgroup = wrapMap.option;
8040
8041wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
8042wrapMap.th = wrapMap.td;
8043
8044
8045function getAll( context, tag ) {
8046
8047 // Support: IE <=9 - 11 only
8048 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
8049 var ret;
8050
8051 if ( typeof context.getElementsByTagName !== "undefined" ) {
8052 ret = context.getElementsByTagName( tag || "*" );
8053
8054 } else if ( typeof context.querySelectorAll !== "undefined" ) {
8055 ret = context.querySelectorAll( tag || "*" );
8056
8057 } else {
8058 ret = [];
8059 }
8060
8061 if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
8062 return jQuery.merge( [ context ], ret );
8063 }
8064
8065 return ret;
8066}
8067
8068
8069// Mark scripts as having already been evaluated
8070function setGlobalEval( elems, refElements ) {
8071 var i = 0,
8072 l = elems.length;
8073
8074 for ( ; i < l; i++ ) {
8075 dataPriv.set(
8076 elems[ i ],
8077 "globalEval",
8078 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
8079 );
8080 }
8081}
8082
8083
8084var rhtml = /<|&#?\w+;/;
8085
8086function buildFragment( elems, context, scripts, selection, ignored ) {
8087 var elem, tmp, tag, wrap, contains, j,
8088 fragment = context.createDocumentFragment(),
8089 nodes = [],
8090 i = 0,
8091 l = elems.length;
8092
8093 for ( ; i < l; i++ ) {
8094 elem = elems[ i ];
8095
8096 if ( elem || elem === 0 ) {
8097
8098 // Add nodes directly
8099 if ( jQuery.type( elem ) === "object" ) {
8100
8101 // Support: Android <=4.0 only, PhantomJS 1 only
8102 // push.apply(_, arraylike) throws on ancient WebKit
8103 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
8104
8105 // Convert non-html into a text node
8106 } else if ( !rhtml.test( elem ) ) {
8107 nodes.push( context.createTextNode( elem ) );
8108
8109 // Convert html into DOM nodes
8110 } else {
8111 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
8112
8113 // Deserialize a standard representation
8114 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
8115 wrap = wrapMap[ tag ] || wrapMap._default;
8116 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
8117
8118 // Descend through wrappers to the right content
8119 j = wrap[ 0 ];
8120 while ( j-- ) {
8121 tmp = tmp.lastChild;
8122 }
8123
8124 // Support: Android <=4.0 only, PhantomJS 1 only
8125 // push.apply(_, arraylike) throws on ancient WebKit
8126 jQuery.merge( nodes, tmp.childNodes );
8127
8128 // Remember the top-level container
8129 tmp = fragment.firstChild;
8130
8131 // Ensure the created nodes are orphaned (#12392)
8132 tmp.textContent = "";
8133 }
8134 }
8135 }
8136
8137 // Remove wrapper from fragment
8138 fragment.textContent = "";
8139
8140 i = 0;
8141 while ( ( elem = nodes[ i++ ] ) ) {
8142
8143 // Skip elements already in the context collection (trac-4087)
8144 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
8145 if ( ignored ) {
8146 ignored.push( elem );
8147 }
8148 continue;
8149 }
8150
8151 contains = jQuery.contains( elem.ownerDocument, elem );
8152
8153 // Append to fragment
8154 tmp = getAll( fragment.appendChild( elem ), "script" );
8155
8156 // Preserve script evaluation history
8157 if ( contains ) {
8158 setGlobalEval( tmp );
8159 }
8160
8161 // Capture executables
8162 if ( scripts ) {
8163 j = 0;
8164 while ( ( elem = tmp[ j++ ] ) ) {
8165 if ( rscriptType.test( elem.type || "" ) ) {
8166 scripts.push( elem );
8167 }
8168 }
8169 }
8170 }
8171
8172 return fragment;
8173}
8174
8175
8176( function() {
8177 var fragment = document.createDocumentFragment(),
8178 div = fragment.appendChild( document.createElement( "div" ) ),
8179 input = document.createElement( "input" );
8180
8181 // Support: Android 4.0 - 4.3 only
8182 // Check state lost if the name is set (#11217)
8183 // Support: Windows Web Apps (WWA)
8184 // `name` and `type` must use .setAttribute for WWA (#14901)
8185 input.setAttribute( "type", "radio" );
8186 input.setAttribute( "checked", "checked" );
8187 input.setAttribute( "name", "t" );
8188
8189 div.appendChild( input );
8190
8191 // Support: Android <=4.1 only
8192 // Older WebKit doesn't clone checked state correctly in fragments
8193 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
8194
8195 // Support: IE <=11 only
8196 // Make sure textarea (and checkbox) defaultValue is properly cloned
8197 div.innerHTML = "<textarea>x</textarea>";
8198 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
8199} )();
8200var documentElement = document.documentElement;
8201
8202
8203
8204var
8205 rkeyEvent = /^key/,
8206 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
8207 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
8208
8209function returnTrue() {
8210 return true;
8211}
8212
8213function returnFalse() {
8214 return false;
8215}
8216
8217// Support: IE <=9 only
8218// See #13393 for more info
8219function safeActiveElement() {
8220 try {
8221 return document.activeElement;
8222 } catch ( err ) { }
8223}
8224
8225function on( elem, types, selector, data, fn, one ) {
8226 var origFn, type;
8227
8228 // Types can be a map of types/handlers
8229 if ( typeof types === "object" ) {
8230
8231 // ( types-Object, selector, data )
8232 if ( typeof selector !== "string" ) {
8233
8234 // ( types-Object, data )
8235 data = data || selector;
8236 selector = undefined;
8237 }
8238 for ( type in types ) {
8239 on( elem, type, selector, data, types[ type ], one );
8240 }
8241 return elem;
8242 }
8243
8244 if ( data == null && fn == null ) {
8245
8246 // ( types, fn )
8247 fn = selector;
8248 data = selector = undefined;
8249 } else if ( fn == null ) {
8250 if ( typeof selector === "string" ) {
8251
8252 // ( types, selector, fn )
8253 fn = data;
8254 data = undefined;
8255 } else {
8256
8257 // ( types, data, fn )
8258 fn = data;
8259 data = selector;
8260 selector = undefined;
8261 }
8262 }
8263 if ( fn === false ) {
8264 fn = returnFalse;
8265 } else if ( !fn ) {
8266 return elem;
8267 }
8268
8269 if ( one === 1 ) {
8270 origFn = fn;
8271 fn = function( event ) {
8272
8273 // Can use an empty set, since event contains the info
8274 jQuery().off( event );
8275 return origFn.apply( this, arguments );
8276 };
8277
8278 // Use same guid so caller can remove using origFn
8279 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
8280 }
8281 return elem.each( function() {
8282 jQuery.event.add( this, types, fn, data, selector );
8283 } );
8284}
8285
8286/*
8287 * Helper functions for managing events -- not part of the public interface.
8288 * Props to Dean Edwards' addEvent library for many of the ideas.
8289 */
8290jQuery.event = {
8291
8292 global: {},
8293
8294 add: function( elem, types, handler, data, selector ) {
8295
8296 var handleObjIn, eventHandle, tmp,
8297 events, t, handleObj,
8298 special, handlers, type, namespaces, origType,
8299 elemData = dataPriv.get( elem );
8300
8301 // Don't attach events to noData or text/comment nodes (but allow plain objects)
8302 if ( !elemData ) {
8303 return;
8304 }
8305
8306 // Caller can pass in an object of custom data in lieu of the handler
8307 if ( handler.handler ) {
8308 handleObjIn = handler;
8309 handler = handleObjIn.handler;
8310 selector = handleObjIn.selector;
8311 }
8312
8313 // Ensure that invalid selectors throw exceptions at attach time
8314 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
8315 if ( selector ) {
8316 jQuery.find.matchesSelector( documentElement, selector );
8317 }
8318
8319 // Make sure that the handler has a unique ID, used to find/remove it later
8320 if ( !handler.guid ) {
8321 handler.guid = jQuery.guid++;
8322 }
8323
8324 // Init the element's event structure and main handler, if this is the first
8325 if ( !( events = elemData.events ) ) {
8326 events = elemData.events = {};
8327 }
8328 if ( !( eventHandle = elemData.handle ) ) {
8329 eventHandle = elemData.handle = function( e ) {
8330
8331 // Discard the second event of a jQuery.event.trigger() and
8332 // when an event is called after a page has unloaded
8333 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
8334 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
8335 };
8336 }
8337
8338 // Handle multiple events separated by a space
8339 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
8340 t = types.length;
8341 while ( t-- ) {
8342 tmp = rtypenamespace.exec( types[ t ] ) || [];
8343 type = origType = tmp[ 1 ];
8344 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
8345
8346 // There *must* be a type, no attaching namespace-only handlers
8347 if ( !type ) {
8348 continue;
8349 }
8350
8351 // If event changes its type, use the special event handlers for the changed type
8352 special = jQuery.event.special[ type ] || {};
8353
8354 // If selector defined, determine special event api type, otherwise given type
8355 type = ( selector ? special.delegateType : special.bindType ) || type;
8356
8357 // Update special based on newly reset type
8358 special = jQuery.event.special[ type ] || {};
8359
8360 // handleObj is passed to all event handlers
8361 handleObj = jQuery.extend( {
8362 type: type,
8363 origType: origType,
8364 data: data,
8365 handler: handler,
8366 guid: handler.guid,
8367 selector: selector,
8368 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
8369 namespace: namespaces.join( "." )
8370 }, handleObjIn );
8371
8372 // Init the event handler queue if we're the first
8373 if ( !( handlers = events[ type ] ) ) {
8374 handlers = events[ type ] = [];
8375 handlers.delegateCount = 0;
8376
8377 // Only use addEventListener if the special events handler returns false
8378 if ( !special.setup ||
8379 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
8380
8381 if ( elem.addEventListener ) {
8382 elem.addEventListener( type, eventHandle );
8383 }
8384 }
8385 }
8386
8387 if ( special.add ) {
8388 special.add.call( elem, handleObj );
8389
8390 if ( !handleObj.handler.guid ) {
8391 handleObj.handler.guid = handler.guid;
8392 }
8393 }
8394
8395 // Add to the element's handler list, delegates in front
8396 if ( selector ) {
8397 handlers.splice( handlers.delegateCount++, 0, handleObj );
8398 } else {
8399 handlers.push( handleObj );
8400 }
8401
8402 // Keep track of which events have ever been used, for event optimization
8403 jQuery.event.global[ type ] = true;
8404 }
8405
8406 },
8407
8408 // Detach an event or set of events from an element
8409 remove: function( elem, types, handler, selector, mappedTypes ) {
8410
8411 var j, origCount, tmp,
8412 events, t, handleObj,
8413 special, handlers, type, namespaces, origType,
8414 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
8415
8416 if ( !elemData || !( events = elemData.events ) ) {
8417 return;
8418 }
8419
8420 // Once for each type.namespace in types; type may be omitted
8421 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
8422 t = types.length;
8423 while ( t-- ) {
8424 tmp = rtypenamespace.exec( types[ t ] ) || [];
8425 type = origType = tmp[ 1 ];
8426 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
8427
8428 // Unbind all events (on this namespace, if provided) for the element
8429 if ( !type ) {
8430 for ( type in events ) {
8431 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
8432 }
8433 continue;
8434 }
8435
8436 special = jQuery.event.special[ type ] || {};
8437 type = ( selector ? special.delegateType : special.bindType ) || type;
8438 handlers = events[ type ] || [];
8439 tmp = tmp[ 2 ] &&
8440 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
8441
8442 // Remove matching events
8443 origCount = j = handlers.length;
8444 while ( j-- ) {
8445 handleObj = handlers[ j ];
8446
8447 if ( ( mappedTypes || origType === handleObj.origType ) &&
8448 ( !handler || handler.guid === handleObj.guid ) &&
8449 ( !tmp || tmp.test( handleObj.namespace ) ) &&
8450 ( !selector || selector === handleObj.selector ||
8451 selector === "**" && handleObj.selector ) ) {
8452 handlers.splice( j, 1 );
8453
8454 if ( handleObj.selector ) {
8455 handlers.delegateCount--;
8456 }
8457 if ( special.remove ) {
8458 special.remove.call( elem, handleObj );
8459 }
8460 }
8461 }
8462
8463 // Remove generic event handler if we removed something and no more handlers exist
8464 // (avoids potential for endless recursion during removal of special event handlers)
8465 if ( origCount && !handlers.length ) {
8466 if ( !special.teardown ||
8467 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
8468
8469 jQuery.removeEvent( elem, type, elemData.handle );
8470 }
8471
8472 delete events[ type ];
8473 }
8474 }
8475
8476 // Remove data and the expando if it's no longer used
8477 if ( jQuery.isEmptyObject( events ) ) {
8478 dataPriv.remove( elem, "handle events" );
8479 }
8480 },
8481
8482 dispatch: function( nativeEvent ) {
8483
8484 // Make a writable jQuery.Event from the native event object
8485 var event = jQuery.event.fix( nativeEvent );
8486
8487 var i, j, ret, matched, handleObj, handlerQueue,
8488 args = new Array( arguments.length ),
8489 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
8490 special = jQuery.event.special[ event.type ] || {};
8491
8492 // Use the fix-ed jQuery.Event rather than the (read-only) native event
8493 args[ 0 ] = event;
8494
8495 for ( i = 1; i < arguments.length; i++ ) {
8496 args[ i ] = arguments[ i ];
8497 }
8498
8499 event.delegateTarget = this;
8500
8501 // Call the preDispatch hook for the mapped type, and let it bail if desired
8502 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
8503 return;
8504 }
8505
8506 // Determine handlers
8507 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
8508
8509 // Run delegates first; they may want to stop propagation beneath us
8510 i = 0;
8511 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
8512 event.currentTarget = matched.elem;
8513
8514 j = 0;
8515 while ( ( handleObj = matched.handlers[ j++ ] ) &&
8516 !event.isImmediatePropagationStopped() ) {
8517
8518 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
8519 // a subset or equal to those in the bound event (both can have no namespace).
8520 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
8521
8522 event.handleObj = handleObj;
8523 event.data = handleObj.data;
8524
8525 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
8526 handleObj.handler ).apply( matched.elem, args );
8527
8528 if ( ret !== undefined ) {
8529 if ( ( event.result = ret ) === false ) {
8530 event.preventDefault();
8531 event.stopPropagation();
8532 }
8533 }
8534 }
8535 }
8536 }
8537
8538 // Call the postDispatch hook for the mapped type
8539 if ( special.postDispatch ) {
8540 special.postDispatch.call( this, event );
8541 }
8542
8543 return event.result;
8544 },
8545
8546 handlers: function( event, handlers ) {
8547 var i, handleObj, sel, matchedHandlers, matchedSelectors,
8548 handlerQueue = [],
8549 delegateCount = handlers.delegateCount,
8550 cur = event.target;
8551
8552 // Find delegate handlers
8553 if ( delegateCount &&
8554
8555 // Support: IE <=9
8556 // Black-hole SVG <use> instance trees (trac-13180)
8557 cur.nodeType &&
8558
8559 // Support: Firefox <=42
8560 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
8561 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
8562 // Support: IE 11 only
8563 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
8564 !( event.type === "click" && event.button >= 1 ) ) {
8565
8566 for ( ; cur !== this; cur = cur.parentNode || this ) {
8567
8568 // Don't check non-elements (#13208)
8569 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
8570 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
8571 matchedHandlers = [];
8572 matchedSelectors = {};
8573 for ( i = 0; i < delegateCount; i++ ) {
8574 handleObj = handlers[ i ];
8575
8576 // Don't conflict with Object.prototype properties (#13203)
8577 sel = handleObj.selector + " ";
8578
8579 if ( matchedSelectors[ sel ] === undefined ) {
8580 matchedSelectors[ sel ] = handleObj.needsContext ?
8581 jQuery( sel, this ).index( cur ) > -1 :
8582 jQuery.find( sel, this, null, [ cur ] ).length;
8583 }
8584 if ( matchedSelectors[ sel ] ) {
8585 matchedHandlers.push( handleObj );
8586 }
8587 }
8588 if ( matchedHandlers.length ) {
8589 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
8590 }
8591 }
8592 }
8593 }
8594
8595 // Add the remaining (directly-bound) handlers
8596 cur = this;
8597 if ( delegateCount < handlers.length ) {
8598 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
8599 }
8600
8601 return handlerQueue;
8602 },
8603
8604 addProp: function( name, hook ) {
8605 Object.defineProperty( jQuery.Event.prototype, name, {
8606 enumerable: true,
8607 configurable: true,
8608
8609 get: jQuery.isFunction( hook ) ?
8610 function() {
8611 if ( this.originalEvent ) {
8612 return hook( this.originalEvent );
8613 }
8614 } :
8615 function() {
8616 if ( this.originalEvent ) {
8617 return this.originalEvent[ name ];
8618 }
8619 },
8620
8621 set: function( value ) {
8622 Object.defineProperty( this, name, {
8623 enumerable: true,
8624 configurable: true,
8625 writable: true,
8626 value: value
8627 } );
8628 }
8629 } );
8630 },
8631
8632 fix: function( originalEvent ) {
8633 return originalEvent[ jQuery.expando ] ?
8634 originalEvent :
8635 new jQuery.Event( originalEvent );
8636 },
8637
8638 special: {
8639 load: {
8640
8641 // Prevent triggered image.load events from bubbling to window.load
8642 noBubble: true
8643 },
8644 focus: {
8645
8646 // Fire native event if possible so blur/focus sequence is correct
8647 trigger: function() {
8648 if ( this !== safeActiveElement() && this.focus ) {
8649 this.focus();
8650 return false;
8651 }
8652 },
8653 delegateType: "focusin"
8654 },
8655 blur: {
8656 trigger: function() {
8657 if ( this === safeActiveElement() && this.blur ) {
8658 this.blur();
8659 return false;
8660 }
8661 },
8662 delegateType: "focusout"
8663 },
8664 click: {
8665
8666 // For checkbox, fire native event so checked state will be right
8667 trigger: function() {
8668 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
8669 this.click();
8670 return false;
8671 }
8672 },
8673
8674 // For cross-browser consistency, don't fire native .click() on links
8675 _default: function( event ) {
8676 return jQuery.nodeName( event.target, "a" );
8677 }
8678 },
8679
8680 beforeunload: {
8681 postDispatch: function( event ) {
8682
8683 // Support: Firefox 20+
8684 // Firefox doesn't alert if the returnValue field is not set.
8685 if ( event.result !== undefined && event.originalEvent ) {
8686 event.originalEvent.returnValue = event.result;
8687 }
8688 }
8689 }
8690 }
8691};
8692
8693jQuery.removeEvent = function( elem, type, handle ) {
8694
8695 // This "if" is needed for plain objects
8696 if ( elem.removeEventListener ) {
8697 elem.removeEventListener( type, handle );
8698 }
8699};
8700
8701jQuery.Event = function( src, props ) {
8702
8703 // Allow instantiation without the 'new' keyword
8704 if ( !( this instanceof jQuery.Event ) ) {
8705 return new jQuery.Event( src, props );
8706 }
8707
8708 // Event object
8709 if ( src && src.type ) {
8710 this.originalEvent = src;
8711 this.type = src.type;
8712
8713 // Events bubbling up the document may have been marked as prevented
8714 // by a handler lower down the tree; reflect the correct value.
8715 this.isDefaultPrevented = src.defaultPrevented ||
8716 src.defaultPrevented === undefined &&
8717
8718 // Support: Android <=2.3 only
8719 src.returnValue === false ?
8720 returnTrue :
8721 returnFalse;
8722
8723 // Create target properties
8724 // Support: Safari <=6 - 7 only
8725 // Target should not be a text node (#504, #13143)
8726 this.target = ( src.target && src.target.nodeType === 3 ) ?
8727 src.target.parentNode :
8728 src.target;
8729
8730 this.currentTarget = src.currentTarget;
8731 this.relatedTarget = src.relatedTarget;
8732
8733 // Event type
8734 } else {
8735 this.type = src;
8736 }
8737
8738 // Put explicitly provided properties onto the event object
8739 if ( props ) {
8740 jQuery.extend( this, props );
8741 }
8742
8743 // Create a timestamp if incoming event doesn't have one
8744 this.timeStamp = src && src.timeStamp || jQuery.now();
8745
8746 // Mark it as fixed
8747 this[ jQuery.expando ] = true;
8748};
8749
8750// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
8751// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
8752jQuery.Event.prototype = {
8753 constructor: jQuery.Event,
8754 isDefaultPrevented: returnFalse,
8755 isPropagationStopped: returnFalse,
8756 isImmediatePropagationStopped: returnFalse,
8757 isSimulated: false,
8758
8759 preventDefault: function() {
8760 var e = this.originalEvent;
8761
8762 this.isDefaultPrevented = returnTrue;
8763
8764 if ( e && !this.isSimulated ) {
8765 e.preventDefault();
8766 }
8767 },
8768 stopPropagation: function() {
8769 var e = this.originalEvent;
8770
8771 this.isPropagationStopped = returnTrue;
8772
8773 if ( e && !this.isSimulated ) {
8774 e.stopPropagation();
8775 }
8776 },
8777 stopImmediatePropagation: function() {
8778 var e = this.originalEvent;
8779
8780 this.isImmediatePropagationStopped = returnTrue;
8781
8782 if ( e && !this.isSimulated ) {
8783 e.stopImmediatePropagation();
8784 }
8785
8786 this.stopPropagation();
8787 }
8788};
8789
8790// Includes all common event props including KeyEvent and MouseEvent specific props
8791jQuery.each( {
8792 altKey: true,
8793 bubbles: true,
8794 cancelable: true,
8795 changedTouches: true,
8796 ctrlKey: true,
8797 detail: true,
8798 eventPhase: true,
8799 metaKey: true,
8800 pageX: true,
8801 pageY: true,
8802 shiftKey: true,
8803 view: true,
8804 "char": true,
8805 charCode: true,
8806 key: true,
8807 keyCode: true,
8808 button: true,
8809 buttons: true,
8810 clientX: true,
8811 clientY: true,
8812 offsetX: true,
8813 offsetY: true,
8814 pointerId: true,
8815 pointerType: true,
8816 screenX: true,
8817 screenY: true,
8818 targetTouches: true,
8819 toElement: true,
8820 touches: true,
8821
8822 which: function( event ) {
8823 var button = event.button;
8824
8825 // Add which for key events
8826 if ( event.which == null && rkeyEvent.test( event.type ) ) {
8827 return event.charCode != null ? event.charCode : event.keyCode;
8828 }
8829
8830 // Add which for click: 1 === left; 2 === middle; 3 === right
8831 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
8832 if ( button & 1 ) {
8833 return 1;
8834 }
8835
8836 if ( button & 2 ) {
8837 return 3;
8838 }
8839
8840 if ( button & 4 ) {
8841 return 2;
8842 }
8843
8844 return 0;
8845 }
8846
8847 return event.which;
8848 }
8849}, jQuery.event.addProp );
8850
8851// Create mouseenter/leave events using mouseover/out and event-time checks
8852// so that event delegation works in jQuery.
8853// Do the same for pointerenter/pointerleave and pointerover/pointerout
8854//
8855// Support: Safari 7 only
8856// Safari sends mouseenter too often; see:
8857// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
8858// for the description of the bug (it existed in older Chrome versions as well).
8859jQuery.each( {
8860 mouseenter: "mouseover",
8861 mouseleave: "mouseout",
8862 pointerenter: "pointerover",
8863 pointerleave: "pointerout"
8864}, function( orig, fix ) {
8865 jQuery.event.special[ orig ] = {
8866 delegateType: fix,
8867 bindType: fix,
8868
8869 handle: function( event ) {
8870 var ret,
8871 target = this,
8872 related = event.relatedTarget,
8873 handleObj = event.handleObj;
8874
8875 // For mouseenter/leave call the handler if related is outside the target.
8876 // NB: No relatedTarget if the mouse left/entered the browser window
8877 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
8878 event.type = handleObj.origType;
8879 ret = handleObj.handler.apply( this, arguments );
8880 event.type = fix;
8881 }
8882 return ret;
8883 }
8884 };
8885} );
8886
8887jQuery.fn.extend( {
8888
8889 on: function( types, selector, data, fn ) {
8890 return on( this, types, selector, data, fn );
8891 },
8892 one: function( types, selector, data, fn ) {
8893 return on( this, types, selector, data, fn, 1 );
8894 },
8895 off: function( types, selector, fn ) {
8896 var handleObj, type;
8897 if ( types && types.preventDefault && types.handleObj ) {
8898
8899 // ( event ) dispatched jQuery.Event
8900 handleObj = types.handleObj;
8901 jQuery( types.delegateTarget ).off(
8902 handleObj.namespace ?
8903 handleObj.origType + "." + handleObj.namespace :
8904 handleObj.origType,
8905 handleObj.selector,
8906 handleObj.handler
8907 );
8908 return this;
8909 }
8910 if ( typeof types === "object" ) {
8911
8912 // ( types-object [, selector] )
8913 for ( type in types ) {
8914 this.off( type, selector, types[ type ] );
8915 }
8916 return this;
8917 }
8918 if ( selector === false || typeof selector === "function" ) {
8919
8920 // ( types [, fn] )
8921 fn = selector;
8922 selector = undefined;
8923 }
8924 if ( fn === false ) {
8925 fn = returnFalse;
8926 }
8927 return this.each( function() {
8928 jQuery.event.remove( this, types, fn, selector );
8929 } );
8930 }
8931} );
8932
8933
8934var
8935
8936 /* eslint-disable max-len */
8937
8938 // See https://github.com/eslint/eslint/issues/3229
8939 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
8940
8941 /* eslint-enable */
8942
8943 // Support: IE <=10 - 11, Edge 12 - 13
8944 // In IE/Edge using regex groups here causes severe slowdowns.
8945 // See https://connect.microsoft.com/IE/feedback/details/1736512/
8946 rnoInnerhtml = /<script|<style|<link/i,
8947
8948 // checked="checked" or checked
8949 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
8950 rscriptTypeMasked = /^true\/(.*)/,
8951 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
8952
8953function manipulationTarget( elem, content ) {
8954 if ( jQuery.nodeName( elem, "table" ) &&
8955 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
8956
8957 return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
8958 }
8959
8960 return elem;
8961}
8962
8963// Replace/restore the type attribute of script elements for safe DOM manipulation
8964function disableScript( elem ) {
8965 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
8966 return elem;
8967}
8968function restoreScript( elem ) {
8969 var match = rscriptTypeMasked.exec( elem.type );
8970
8971 if ( match ) {
8972 elem.type = match[ 1 ];
8973 } else {
8974 elem.removeAttribute( "type" );
8975 }
8976
8977 return elem;
8978}
8979
8980function cloneCopyEvent( src, dest ) {
8981 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
8982
8983 if ( dest.nodeType !== 1 ) {
8984 return;
8985 }
8986
8987 // 1. Copy private data: events, handlers, etc.
8988 if ( dataPriv.hasData( src ) ) {
8989 pdataOld = dataPriv.access( src );
8990 pdataCur = dataPriv.set( dest, pdataOld );
8991 events = pdataOld.events;
8992
8993 if ( events ) {
8994 delete pdataCur.handle;
8995 pdataCur.events = {};
8996
8997 for ( type in events ) {
8998 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
8999 jQuery.event.add( dest, type, events[ type ][ i ] );
9000 }
9001 }
9002 }
9003 }
9004
9005 // 2. Copy user data
9006 if ( dataUser.hasData( src ) ) {
9007 udataOld = dataUser.access( src );
9008 udataCur = jQuery.extend( {}, udataOld );
9009
9010 dataUser.set( dest, udataCur );
9011 }
9012}
9013
9014// Fix IE bugs, see support tests
9015function fixInput( src, dest ) {
9016 var nodeName = dest.nodeName.toLowerCase();
9017
9018 // Fails to persist the checked state of a cloned checkbox or radio button.
9019 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
9020 dest.checked = src.checked;
9021
9022 // Fails to return the selected option to the default selected state when cloning options
9023 } else if ( nodeName === "input" || nodeName === "textarea" ) {
9024 dest.defaultValue = src.defaultValue;
9025 }
9026}
9027
9028function domManip( collection, args, callback, ignored ) {
9029
9030 // Flatten any nested arrays
9031 args = concat.apply( [], args );
9032
9033 var fragment, first, scripts, hasScripts, node, doc,
9034 i = 0,
9035 l = collection.length,
9036 iNoClone = l - 1,
9037 value = args[ 0 ],
9038 isFunction = jQuery.isFunction( value );
9039
9040 // We can't cloneNode fragments that contain checked, in WebKit
9041 if ( isFunction ||
9042 ( l > 1 && typeof value === "string" &&
9043 !support.checkClone && rchecked.test( value ) ) ) {
9044 return collection.each( function( index ) {
9045 var self = collection.eq( index );
9046 if ( isFunction ) {
9047 args[ 0 ] = value.call( this, index, self.html() );
9048 }
9049 domManip( self, args, callback, ignored );
9050 } );
9051 }
9052
9053 if ( l ) {
9054 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
9055 first = fragment.firstChild;
9056
9057 if ( fragment.childNodes.length === 1 ) {
9058 fragment = first;
9059 }
9060
9061 // Require either new content or an interest in ignored elements to invoke the callback
9062 if ( first || ignored ) {
9063 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
9064 hasScripts = scripts.length;
9065
9066 // Use the original fragment for the last item
9067 // instead of the first because it can end up
9068 // being emptied incorrectly in certain situations (#8070).
9069 for ( ; i < l; i++ ) {
9070 node = fragment;
9071
9072 if ( i !== iNoClone ) {
9073 node = jQuery.clone( node, true, true );
9074
9075 // Keep references to cloned scripts for later restoration
9076 if ( hasScripts ) {
9077
9078 // Support: Android <=4.0 only, PhantomJS 1 only
9079 // push.apply(_, arraylike) throws on ancient WebKit
9080 jQuery.merge( scripts, getAll( node, "script" ) );
9081 }
9082 }
9083
9084 callback.call( collection[ i ], node, i );
9085 }
9086
9087 if ( hasScripts ) {
9088 doc = scripts[ scripts.length - 1 ].ownerDocument;
9089
9090 // Reenable scripts
9091 jQuery.map( scripts, restoreScript );
9092
9093 // Evaluate executable scripts on first document insertion
9094 for ( i = 0; i < hasScripts; i++ ) {
9095 node = scripts[ i ];
9096 if ( rscriptType.test( node.type || "" ) &&
9097 !dataPriv.access( node, "globalEval" ) &&
9098 jQuery.contains( doc, node ) ) {
9099
9100 if ( node.src ) {
9101
9102 // Optional AJAX dependency, but won't run scripts if not present
9103 if ( jQuery._evalUrl ) {
9104 jQuery._evalUrl( node.src );
9105 }
9106 } else {
9107 DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
9108 }
9109 }
9110 }
9111 }
9112 }
9113 }
9114
9115 return collection;
9116}
9117
9118function remove( elem, selector, keepData ) {
9119 var node,
9120 nodes = selector ? jQuery.filter( selector, elem ) : elem,
9121 i = 0;
9122
9123 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
9124 if ( !keepData && node.nodeType === 1 ) {
9125 jQuery.cleanData( getAll( node ) );
9126 }
9127
9128 if ( node.parentNode ) {
9129 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
9130 setGlobalEval( getAll( node, "script" ) );
9131 }
9132 node.parentNode.removeChild( node );
9133 }
9134 }
9135
9136 return elem;
9137}
9138
9139jQuery.extend( {
9140 htmlPrefilter: function( html ) {
9141 return html.replace( rxhtmlTag, "<$1></$2>" );
9142 },
9143
9144 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
9145 var i, l, srcElements, destElements,
9146 clone = elem.cloneNode( true ),
9147 inPage = jQuery.contains( elem.ownerDocument, elem );
9148
9149 // Fix IE cloning issues
9150 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
9151 !jQuery.isXMLDoc( elem ) ) {
9152
9153 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
9154 destElements = getAll( clone );
9155 srcElements = getAll( elem );
9156
9157 for ( i = 0, l = srcElements.length; i < l; i++ ) {
9158 fixInput( srcElements[ i ], destElements[ i ] );
9159 }
9160 }
9161
9162 // Copy the events from the original to the clone
9163 if ( dataAndEvents ) {
9164 if ( deepDataAndEvents ) {
9165 srcElements = srcElements || getAll( elem );
9166 destElements = destElements || getAll( clone );
9167
9168 for ( i = 0, l = srcElements.length; i < l; i++ ) {
9169 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
9170 }
9171 } else {
9172 cloneCopyEvent( elem, clone );
9173 }
9174 }
9175
9176 // Preserve script evaluation history
9177 destElements = getAll( clone, "script" );
9178 if ( destElements.length > 0 ) {
9179 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
9180 }
9181
9182 // Return the cloned set
9183 return clone;
9184 },
9185
9186 cleanData: function( elems ) {
9187 var data, elem, type,
9188 special = jQuery.event.special,
9189 i = 0;
9190
9191 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
9192 if ( acceptData( elem ) ) {
9193 if ( ( data = elem[ dataPriv.expando ] ) ) {
9194 if ( data.events ) {
9195 for ( type in data.events ) {
9196 if ( special[ type ] ) {
9197 jQuery.event.remove( elem, type );
9198
9199 // This is a shortcut to avoid jQuery.event.remove's overhead
9200 } else {
9201 jQuery.removeEvent( elem, type, data.handle );
9202 }
9203 }
9204 }
9205
9206 // Support: Chrome <=35 - 45+
9207 // Assign undefined instead of using delete, see Data#remove
9208 elem[ dataPriv.expando ] = undefined;
9209 }
9210 if ( elem[ dataUser.expando ] ) {
9211
9212 // Support: Chrome <=35 - 45+
9213 // Assign undefined instead of using delete, see Data#remove
9214 elem[ dataUser.expando ] = undefined;
9215 }
9216 }
9217 }
9218 }
9219} );
9220
9221jQuery.fn.extend( {
9222 detach: function( selector ) {
9223 return remove( this, selector, true );
9224 },
9225
9226 remove: function( selector ) {
9227 return remove( this, selector );
9228 },
9229
9230 text: function( value ) {
9231 return access( this, function( value ) {
9232 return value === undefined ?
9233 jQuery.text( this ) :
9234 this.empty().each( function() {
9235 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
9236 this.textContent = value;
9237 }
9238 } );
9239 }, null, value, arguments.length );
9240 },
9241
9242 append: function() {
9243 return domManip( this, arguments, function( elem ) {
9244 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
9245 var target = manipulationTarget( this, elem );
9246 target.appendChild( elem );
9247 }
9248 } );
9249 },
9250
9251 prepend: function() {
9252 return domManip( this, arguments, function( elem ) {
9253 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
9254 var target = manipulationTarget( this, elem );
9255 target.insertBefore( elem, target.firstChild );
9256 }
9257 } );
9258 },
9259
9260 before: function() {
9261 return domManip( this, arguments, function( elem ) {
9262 if ( this.parentNode ) {
9263 this.parentNode.insertBefore( elem, this );
9264 }
9265 } );
9266 },
9267
9268 after: function() {
9269 return domManip( this, arguments, function( elem ) {
9270 if ( this.parentNode ) {
9271 this.parentNode.insertBefore( elem, this.nextSibling );
9272 }
9273 } );
9274 },
9275
9276 empty: function() {
9277 var elem,
9278 i = 0;
9279
9280 for ( ; ( elem = this[ i ] ) != null; i++ ) {
9281 if ( elem.nodeType === 1 ) {
9282
9283 // Prevent memory leaks
9284 jQuery.cleanData( getAll( elem, false ) );
9285
9286 // Remove any remaining nodes
9287 elem.textContent = "";
9288 }
9289 }
9290
9291 return this;
9292 },
9293
9294 clone: function( dataAndEvents, deepDataAndEvents ) {
9295 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
9296 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
9297
9298 return this.map( function() {
9299 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
9300 } );
9301 },
9302
9303 html: function( value ) {
9304 return access( this, function( value ) {
9305 var elem = this[ 0 ] || {},
9306 i = 0,
9307 l = this.length;
9308
9309 if ( value === undefined && elem.nodeType === 1 ) {
9310 return elem.innerHTML;
9311 }
9312
9313 // See if we can take a shortcut and just use innerHTML
9314 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
9315 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
9316
9317 value = jQuery.htmlPrefilter( value );
9318
9319 try {
9320 for ( ; i < l; i++ ) {
9321 elem = this[ i ] || {};
9322
9323 // Remove element nodes and prevent memory leaks
9324 if ( elem.nodeType === 1 ) {
9325 jQuery.cleanData( getAll( elem, false ) );
9326 elem.innerHTML = value;
9327 }
9328 }
9329
9330 elem = 0;
9331
9332 // If using innerHTML throws an exception, use the fallback method
9333 } catch ( e ) {}
9334 }
9335
9336 if ( elem ) {
9337 this.empty().append( value );
9338 }
9339 }, null, value, arguments.length );
9340 },
9341
9342 replaceWith: function() {
9343 var ignored = [];
9344
9345 // Make the changes, replacing each non-ignored context element with the new content
9346 return domManip( this, arguments, function( elem ) {
9347 var parent = this.parentNode;
9348
9349 if ( jQuery.inArray( this, ignored ) < 0 ) {
9350 jQuery.cleanData( getAll( this ) );
9351 if ( parent ) {
9352 parent.replaceChild( elem, this );
9353 }
9354 }
9355
9356 // Force callback invocation
9357 }, ignored );
9358 }
9359} );
9360
9361jQuery.each( {
9362 appendTo: "append",
9363 prependTo: "prepend",
9364 insertBefore: "before",
9365 insertAfter: "after",
9366 replaceAll: "replaceWith"
9367}, function( name, original ) {
9368 jQuery.fn[ name ] = function( selector ) {
9369 var elems,
9370 ret = [],
9371 insert = jQuery( selector ),
9372 last = insert.length - 1,
9373 i = 0;
9374
9375 for ( ; i <= last; i++ ) {
9376 elems = i === last ? this : this.clone( true );
9377 jQuery( insert[ i ] )[ original ]( elems );
9378
9379 // Support: Android <=4.0 only, PhantomJS 1 only
9380 // .get() because push.apply(_, arraylike) throws on ancient WebKit
9381 push.apply( ret, elems.get() );
9382 }
9383
9384 return this.pushStack( ret );
9385 };
9386} );
9387var rmargin = ( /^margin/ );
9388
9389var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
9390
9391var getStyles = function( elem ) {
9392
9393 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
9394 // IE throws on elements created in popups
9395 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
9396 var view = elem.ownerDocument.defaultView;
9397
9398 if ( !view || !view.opener ) {
9399 view = window;
9400 }
9401
9402 return view.getComputedStyle( elem );
9403 };
9404
9405
9406
9407( function() {
9408
9409 // Executing both pixelPosition & boxSizingReliable tests require only one layout
9410 // so they're executed at the same time to save the second computation.
9411 function computeStyleTests() {
9412
9413 // This is a singleton, we need to execute it only once
9414 if ( !div ) {
9415 return;
9416 }
9417
9418 div.style.cssText =
9419 "box-sizing:border-box;" +
9420 "position:relative;display:block;" +
9421 "margin:auto;border:1px;padding:1px;" +
9422 "top:1%;width:50%";
9423 div.innerHTML = "";
9424 documentElement.appendChild( container );
9425
9426 var divStyle = window.getComputedStyle( div );
9427 pixelPositionVal = divStyle.top !== "1%";
9428
9429 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
9430 reliableMarginLeftVal = divStyle.marginLeft === "2px";
9431 boxSizingReliableVal = divStyle.width === "4px";
9432
9433 // Support: Android 4.0 - 4.3 only
9434 // Some styles come back with percentage values, even though they shouldn't
9435 div.style.marginRight = "50%";
9436 pixelMarginRightVal = divStyle.marginRight === "4px";
9437
9438 documentElement.removeChild( container );
9439
9440 // Nullify the div so it wouldn't be stored in the memory and
9441 // it will also be a sign that checks already performed
9442 div = null;
9443 }
9444
9445 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
9446 container = document.createElement( "div" ),
9447 div = document.createElement( "div" );
9448
9449 // Finish early in limited (non-browser) environments
9450 if ( !div.style ) {
9451 return;
9452 }
9453
9454 // Support: IE <=9 - 11 only
9455 // Style of cloned element affects source element cloned (#8908)
9456 div.style.backgroundClip = "content-box";
9457 div.cloneNode( true ).style.backgroundClip = "";
9458 support.clearCloneStyle = div.style.backgroundClip === "content-box";
9459
9460 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
9461 "padding:0;margin-top:1px;position:absolute";
9462 container.appendChild( div );
9463
9464 jQuery.extend( support, {
9465 pixelPosition: function() {
9466 computeStyleTests();
9467 return pixelPositionVal;
9468 },
9469 boxSizingReliable: function() {
9470 computeStyleTests();
9471 return boxSizingReliableVal;
9472 },
9473 pixelMarginRight: function() {
9474 computeStyleTests();
9475 return pixelMarginRightVal;
9476 },
9477 reliableMarginLeft: function() {
9478 computeStyleTests();
9479 return reliableMarginLeftVal;
9480 }
9481 } );
9482} )();
9483
9484
9485function curCSS( elem, name, computed ) {
9486 var width, minWidth, maxWidth, ret,
9487 style = elem.style;
9488
9489 computed = computed || getStyles( elem );
9490
9491 // Support: IE <=9 only
9492 // getPropertyValue is only needed for .css('filter') (#12537)
9493 if ( computed ) {
9494 ret = computed.getPropertyValue( name ) || computed[ name ];
9495
9496 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
9497 ret = jQuery.style( elem, name );
9498 }
9499
9500 // A tribute to the "awesome hack by Dean Edwards"
9501 // Android Browser returns percentage for some values,
9502 // but width seems to be reliably pixels.
9503 // This is against the CSSOM draft spec:
9504 // https://drafts.csswg.org/cssom/#resolved-values
9505 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
9506
9507 // Remember the original values
9508 width = style.width;
9509 minWidth = style.minWidth;
9510 maxWidth = style.maxWidth;
9511
9512 // Put in the new values to get a computed value out
9513 style.minWidth = style.maxWidth = style.width = ret;
9514 ret = computed.width;
9515
9516 // Revert the changed values
9517 style.width = width;
9518 style.minWidth = minWidth;
9519 style.maxWidth = maxWidth;
9520 }
9521 }
9522
9523 return ret !== undefined ?
9524
9525 // Support: IE <=9 - 11 only
9526 // IE returns zIndex value as an integer.
9527 ret + "" :
9528 ret;
9529}
9530
9531
9532function addGetHookIf( conditionFn, hookFn ) {
9533
9534 // Define the hook, we'll check on the first run if it's really needed.
9535 return {
9536 get: function() {
9537 if ( conditionFn() ) {
9538
9539 // Hook not needed (or it's not possible to use it due
9540 // to missing dependency), remove it.
9541 delete this.get;
9542 return;
9543 }
9544
9545 // Hook needed; redefine it so that the support test is not executed again.
9546 return ( this.get = hookFn ).apply( this, arguments );
9547 }
9548 };
9549}
9550
9551
9552var
9553
9554 // Swappable if display is none or starts with table
9555 // except "table", "table-cell", or "table-caption"
9556 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
9557 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
9558 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
9559 cssNormalTransform = {
9560 letterSpacing: "0",
9561 fontWeight: "400"
9562 },
9563
9564 cssPrefixes = [ "Webkit", "Moz", "ms" ],
9565 emptyStyle = document.createElement( "div" ).style;
9566
9567// Return a css property mapped to a potentially vendor prefixed property
9568function vendorPropName( name ) {
9569
9570 // Shortcut for names that are not vendor prefixed
9571 if ( name in emptyStyle ) {
9572 return name;
9573 }
9574
9575 // Check for vendor prefixed names
9576 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
9577 i = cssPrefixes.length;
9578
9579 while ( i-- ) {
9580 name = cssPrefixes[ i ] + capName;
9581 if ( name in emptyStyle ) {
9582 return name;
9583 }
9584 }
9585}
9586
9587function setPositiveNumber( elem, value, subtract ) {
9588
9589 // Any relative (+/-) values have already been
9590 // normalized at this point
9591 var matches = rcssNum.exec( value );
9592 return matches ?
9593
9594 // Guard against undefined "subtract", e.g., when used as in cssHooks
9595 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
9596 value;
9597}
9598
9599function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
9600 var i,
9601 val = 0;
9602
9603 // If we already have the right measurement, avoid augmentation
9604 if ( extra === ( isBorderBox ? "border" : "content" ) ) {
9605 i = 4;
9606
9607 // Otherwise initialize for horizontal or vertical properties
9608 } else {
9609 i = name === "width" ? 1 : 0;
9610 }
9611
9612 for ( ; i < 4; i += 2 ) {
9613
9614 // Both box models exclude margin, so add it if we want it
9615 if ( extra === "margin" ) {
9616 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
9617 }
9618
9619 if ( isBorderBox ) {
9620
9621 // border-box includes padding, so remove it if we want content
9622 if ( extra === "content" ) {
9623 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
9624 }
9625
9626 // At this point, extra isn't border nor margin, so remove border
9627 if ( extra !== "margin" ) {
9628 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
9629 }
9630 } else {
9631
9632 // At this point, extra isn't content, so add padding
9633 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
9634
9635 // At this point, extra isn't content nor padding, so add border
9636 if ( extra !== "padding" ) {
9637 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
9638 }
9639 }
9640 }
9641
9642 return val;
9643}
9644
9645function getWidthOrHeight( elem, name, extra ) {
9646
9647 // Start with offset property, which is equivalent to the border-box value
9648 var val,
9649 valueIsBorderBox = true,
9650 styles = getStyles( elem ),
9651 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
9652
9653 // Support: IE <=11 only
9654 // Running getBoundingClientRect on a disconnected node
9655 // in IE throws an error.
9656 if ( elem.getClientRects().length ) {
9657 val = elem.getBoundingClientRect()[ name ];
9658 }
9659
9660 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
9661 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
9662 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
9663 if ( val <= 0 || val == null ) {
9664
9665 // Fall back to computed then uncomputed css if necessary
9666 val = curCSS( elem, name, styles );
9667 if ( val < 0 || val == null ) {
9668 val = elem.style[ name ];
9669 }
9670
9671 // Computed unit is not pixels. Stop here and return.
9672 if ( rnumnonpx.test( val ) ) {
9673 return val;
9674 }
9675
9676 // Check for style in case a browser which returns unreliable values
9677 // for getComputedStyle silently falls back to the reliable elem.style
9678 valueIsBorderBox = isBorderBox &&
9679 ( support.boxSizingReliable() || val === elem.style[ name ] );
9680
9681 // Normalize "", auto, and prepare for extra
9682 val = parseFloat( val ) || 0;
9683 }
9684
9685 // Use the active box-sizing model to add/subtract irrelevant styles
9686 return ( val +
9687 augmentWidthOrHeight(
9688 elem,
9689 name,
9690 extra || ( isBorderBox ? "border" : "content" ),
9691 valueIsBorderBox,
9692 styles
9693 )
9694 ) + "px";
9695}
9696
9697jQuery.extend( {
9698
9699 // Add in style property hooks for overriding the default
9700 // behavior of getting and setting a style property
9701 cssHooks: {
9702 opacity: {
9703 get: function( elem, computed ) {
9704 if ( computed ) {
9705
9706 // We should always get a number back from opacity
9707 var ret = curCSS( elem, "opacity" );
9708 return ret === "" ? "1" : ret;
9709 }
9710 }
9711 }
9712 },
9713
9714 // Don't automatically add "px" to these possibly-unitless properties
9715 cssNumber: {
9716 "animationIterationCount": true,
9717 "columnCount": true,
9718 "fillOpacity": true,
9719 "flexGrow": true,
9720 "flexShrink": true,
9721 "fontWeight": true,
9722 "lineHeight": true,
9723 "opacity": true,
9724 "order": true,
9725 "orphans": true,
9726 "widows": true,
9727 "zIndex": true,
9728 "zoom": true
9729 },
9730
9731 // Add in properties whose names you wish to fix before
9732 // setting or getting the value
9733 cssProps: {
9734 "float": "cssFloat"
9735 },
9736
9737 // Get and set the style property on a DOM Node
9738 style: function( elem, name, value, extra ) {
9739
9740 // Don't set styles on text and comment nodes
9741 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
9742 return;
9743 }
9744
9745 // Make sure that we're working with the right name
9746 var ret, type, hooks,
9747 origName = jQuery.camelCase( name ),
9748 style = elem.style;
9749
9750 name = jQuery.cssProps[ origName ] ||
9751 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
9752
9753 // Gets hook for the prefixed version, then unprefixed version
9754 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
9755
9756 // Check if we're setting a value
9757 if ( value !== undefined ) {
9758 type = typeof value;
9759
9760 // Convert "+=" or "-=" to relative numbers (#7345)
9761 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
9762 value = adjustCSS( elem, name, ret );
9763
9764 // Fixes bug #9237
9765 type = "number";
9766 }
9767
9768 // Make sure that null and NaN values aren't set (#7116)
9769 if ( value == null || value !== value ) {
9770 return;
9771 }
9772
9773 // If a number was passed in, add the unit (except for certain CSS properties)
9774 if ( type === "number" ) {
9775 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
9776 }
9777
9778 // background-* props affect original clone's values
9779 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
9780 style[ name ] = "inherit";
9781 }
9782
9783 // If a hook was provided, use that value, otherwise just set the specified value
9784 if ( !hooks || !( "set" in hooks ) ||
9785 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
9786
9787 style[ name ] = value;
9788 }
9789
9790 } else {
9791
9792 // If a hook was provided get the non-computed value from there
9793 if ( hooks && "get" in hooks &&
9794 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
9795
9796 return ret;
9797 }
9798
9799 // Otherwise just get the value from the style object
9800 return style[ name ];
9801 }
9802 },
9803
9804 css: function( elem, name, extra, styles ) {
9805 var val, num, hooks,
9806 origName = jQuery.camelCase( name );
9807
9808 // Make sure that we're working with the right name
9809 name = jQuery.cssProps[ origName ] ||
9810 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
9811
9812 // Try prefixed name followed by the unprefixed name
9813 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
9814
9815 // If a hook was provided get the computed value from there
9816 if ( hooks && "get" in hooks ) {
9817 val = hooks.get( elem, true, extra );
9818 }
9819
9820 // Otherwise, if a way to get the computed value exists, use that
9821 if ( val === undefined ) {
9822 val = curCSS( elem, name, styles );
9823 }
9824
9825 // Convert "normal" to computed value
9826 if ( val === "normal" && name in cssNormalTransform ) {
9827 val = cssNormalTransform[ name ];
9828 }
9829
9830 // Make numeric if forced or a qualifier was provided and val looks numeric
9831 if ( extra === "" || extra ) {
9832 num = parseFloat( val );
9833 return extra === true || isFinite( num ) ? num || 0 : val;
9834 }
9835 return val;
9836 }
9837} );
9838
9839jQuery.each( [ "height", "width" ], function( i, name ) {
9840 jQuery.cssHooks[ name ] = {
9841 get: function( elem, computed, extra ) {
9842 if ( computed ) {
9843
9844 // Certain elements can have dimension info if we invisibly show them
9845 // but it must have a current display style that would benefit
9846 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
9847
9848 // Support: Safari 8+
9849 // Table columns in Safari have non-zero offsetWidth & zero
9850 // getBoundingClientRect().width unless display is changed.
9851 // Support: IE <=11 only
9852 // Running getBoundingClientRect on a disconnected node
9853 // in IE throws an error.
9854 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
9855 swap( elem, cssShow, function() {
9856 return getWidthOrHeight( elem, name, extra );
9857 } ) :
9858 getWidthOrHeight( elem, name, extra );
9859 }
9860 },
9861
9862 set: function( elem, value, extra ) {
9863 var matches,
9864 styles = extra && getStyles( elem ),
9865 subtract = extra && augmentWidthOrHeight(
9866 elem,
9867 name,
9868 extra,
9869 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
9870 styles
9871 );
9872
9873 // Convert to pixels if value adjustment is needed
9874 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
9875 ( matches[ 3 ] || "px" ) !== "px" ) {
9876
9877 elem.style[ name ] = value;
9878 value = jQuery.css( elem, name );
9879 }
9880
9881 return setPositiveNumber( elem, value, subtract );
9882 }
9883 };
9884} );
9885
9886jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
9887 function( elem, computed ) {
9888 if ( computed ) {
9889 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
9890 elem.getBoundingClientRect().left -
9891 swap( elem, { marginLeft: 0 }, function() {
9892 return elem.getBoundingClientRect().left;
9893 } )
9894 ) + "px";
9895 }
9896 }
9897);
9898
9899// These hooks are used by animate to expand properties
9900jQuery.each( {
9901 margin: "",
9902 padding: "",
9903 border: "Width"
9904}, function( prefix, suffix ) {
9905 jQuery.cssHooks[ prefix + suffix ] = {
9906 expand: function( value ) {
9907 var i = 0,
9908 expanded = {},
9909
9910 // Assumes a single number if not a string
9911 parts = typeof value === "string" ? value.split( " " ) : [ value ];
9912
9913 for ( ; i < 4; i++ ) {
9914 expanded[ prefix + cssExpand[ i ] + suffix ] =
9915 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
9916 }
9917
9918 return expanded;
9919 }
9920 };
9921
9922 if ( !rmargin.test( prefix ) ) {
9923 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
9924 }
9925} );
9926
9927jQuery.fn.extend( {
9928 css: function( name, value ) {
9929 return access( this, function( elem, name, value ) {
9930 var styles, len,
9931 map = {},
9932 i = 0;
9933
9934 if ( jQuery.isArray( name ) ) {
9935 styles = getStyles( elem );
9936 len = name.length;
9937
9938 for ( ; i < len; i++ ) {
9939 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
9940 }
9941
9942 return map;
9943 }
9944
9945 return value !== undefined ?
9946 jQuery.style( elem, name, value ) :
9947 jQuery.css( elem, name );
9948 }, name, value, arguments.length > 1 );
9949 }
9950} );
9951
9952
9953function Tween( elem, options, prop, end, easing ) {
9954 return new Tween.prototype.init( elem, options, prop, end, easing );
9955}
9956jQuery.Tween = Tween;
9957
9958Tween.prototype = {
9959 constructor: Tween,
9960 init: function( elem, options, prop, end, easing, unit ) {
9961 this.elem = elem;
9962 this.prop = prop;
9963 this.easing = easing || jQuery.easing._default;
9964 this.options = options;
9965 this.start = this.now = this.cur();
9966 this.end = end;
9967 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
9968 },
9969 cur: function() {
9970 var hooks = Tween.propHooks[ this.prop ];
9971
9972 return hooks && hooks.get ?
9973 hooks.get( this ) :
9974 Tween.propHooks._default.get( this );
9975 },
9976 run: function( percent ) {
9977 var eased,
9978 hooks = Tween.propHooks[ this.prop ];
9979
9980 if ( this.options.duration ) {
9981 this.pos = eased = jQuery.easing[ this.easing ](
9982 percent, this.options.duration * percent, 0, 1, this.options.duration
9983 );
9984 } else {
9985 this.pos = eased = percent;
9986 }
9987 this.now = ( this.end - this.start ) * eased + this.start;
9988
9989 if ( this.options.step ) {
9990 this.options.step.call( this.elem, this.now, this );
9991 }
9992
9993 if ( hooks && hooks.set ) {
9994 hooks.set( this );
9995 } else {
9996 Tween.propHooks._default.set( this );
9997 }
9998 return this;
9999 }
10000};
10001
10002Tween.prototype.init.prototype = Tween.prototype;
10003
10004Tween.propHooks = {
10005 _default: {
10006 get: function( tween ) {
10007 var result;
10008
10009 // Use a property on the element directly when it is not a DOM element,
10010 // or when there is no matching style property that exists.
10011 if ( tween.elem.nodeType !== 1 ||
10012 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
10013 return tween.elem[ tween.prop ];
10014 }
10015
10016 // Passing an empty string as a 3rd parameter to .css will automatically
10017 // attempt a parseFloat and fallback to a string if the parse fails.
10018 // Simple values such as "10px" are parsed to Float;
10019 // complex values such as "rotate(1rad)" are returned as-is.
10020 result = jQuery.css( tween.elem, tween.prop, "" );
10021
10022 // Empty strings, null, undefined and "auto" are converted to 0.
10023 return !result || result === "auto" ? 0 : result;
10024 },
10025 set: function( tween ) {
10026
10027 // Use step hook for back compat.
10028 // Use cssHook if its there.
10029 // Use .style if available and use plain properties where available.
10030 if ( jQuery.fx.step[ tween.prop ] ) {
10031 jQuery.fx.step[ tween.prop ]( tween );
10032 } else if ( tween.elem.nodeType === 1 &&
10033 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
10034 jQuery.cssHooks[ tween.prop ] ) ) {
10035 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
10036 } else {
10037 tween.elem[ tween.prop ] = tween.now;
10038 }
10039 }
10040 }
10041};
10042
10043// Support: IE <=9 only
10044// Panic based approach to setting things on disconnected nodes
10045Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
10046 set: function( tween ) {
10047 if ( tween.elem.nodeType && tween.elem.parentNode ) {
10048 tween.elem[ tween.prop ] = tween.now;
10049 }
10050 }
10051};
10052
10053jQuery.easing = {
10054 linear: function( p ) {
10055 return p;
10056 },
10057 swing: function( p ) {
10058 return 0.5 - Math.cos( p * Math.PI ) / 2;
10059 },
10060 _default: "swing"
10061};
10062
10063jQuery.fx = Tween.prototype.init;
10064
10065// Back compat <1.8 extension point
10066jQuery.fx.step = {};
10067
10068
10069
10070
10071var
10072 fxNow, timerId,
10073 rfxtypes = /^(?:toggle|show|hide)$/,
10074 rrun = /queueHooks$/;
10075
10076function raf() {
10077 if ( timerId ) {
10078 window.requestAnimationFrame( raf );
10079 jQuery.fx.tick();
10080 }
10081}
10082
10083// Animations created synchronously will run synchronously
10084function createFxNow() {
10085 window.setTimeout( function() {
10086 fxNow = undefined;
10087 } );
10088 return ( fxNow = jQuery.now() );
10089}
10090
10091// Generate parameters to create a standard animation
10092function genFx( type, includeWidth ) {
10093 var which,
10094 i = 0,
10095 attrs = { height: type };
10096
10097 // If we include width, step value is 1 to do all cssExpand values,
10098 // otherwise step value is 2 to skip over Left and Right
10099 includeWidth = includeWidth ? 1 : 0;
10100 for ( ; i < 4; i += 2 - includeWidth ) {
10101 which = cssExpand[ i ];
10102 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
10103 }
10104
10105 if ( includeWidth ) {
10106 attrs.opacity = attrs.width = type;
10107 }
10108
10109 return attrs;
10110}
10111
10112function createTween( value, prop, animation ) {
10113 var tween,
10114 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
10115 index = 0,
10116 length = collection.length;
10117 for ( ; index < length; index++ ) {
10118 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
10119
10120 // We're done with this property
10121 return tween;
10122 }
10123 }
10124}
10125
10126function defaultPrefilter( elem, props, opts ) {
10127 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
10128 isBox = "width" in props || "height" in props,
10129 anim = this,
10130 orig = {},
10131 style = elem.style,
10132 hidden = elem.nodeType && isHiddenWithinTree( elem ),
10133 dataShow = dataPriv.get( elem, "fxshow" );
10134
10135 // Queue-skipping animations hijack the fx hooks
10136 if ( !opts.queue ) {
10137 hooks = jQuery._queueHooks( elem, "fx" );
10138 if ( hooks.unqueued == null ) {
10139 hooks.unqueued = 0;
10140 oldfire = hooks.empty.fire;
10141 hooks.empty.fire = function() {
10142 if ( !hooks.unqueued ) {
10143 oldfire();
10144 }
10145 };
10146 }
10147 hooks.unqueued++;
10148
10149 anim.always( function() {
10150
10151 // Ensure the complete handler is called before this completes
10152 anim.always( function() {
10153 hooks.unqueued--;
10154 if ( !jQuery.queue( elem, "fx" ).length ) {
10155 hooks.empty.fire();
10156 }
10157 } );
10158 } );
10159 }
10160
10161 // Detect show/hide animations
10162 for ( prop in props ) {
10163 value = props[ prop ];
10164 if ( rfxtypes.test( value ) ) {
10165 delete props[ prop ];
10166 toggle = toggle || value === "toggle";
10167 if ( value === ( hidden ? "hide" : "show" ) ) {
10168
10169 // Pretend to be hidden if this is a "show" and
10170 // there is still data from a stopped show/hide
10171 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
10172 hidden = true;
10173
10174 // Ignore all other no-op show/hide data
10175 } else {
10176 continue;
10177 }
10178 }
10179 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
10180 }
10181 }
10182
10183 // Bail out if this is a no-op like .hide().hide()
10184 propTween = !jQuery.isEmptyObject( props );
10185 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
10186 return;
10187 }
10188
10189 // Restrict "overflow" and "display" styles during box animations
10190 if ( isBox && elem.nodeType === 1 ) {
10191
10192 // Support: IE <=9 - 11, Edge 12 - 13
10193 // Record all 3 overflow attributes because IE does not infer the shorthand
10194 // from identically-valued overflowX and overflowY
10195 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
10196
10197 // Identify a display type, preferring old show/hide data over the CSS cascade
10198 restoreDisplay = dataShow && dataShow.display;
10199 if ( restoreDisplay == null ) {
10200 restoreDisplay = dataPriv.get( elem, "display" );
10201 }
10202 display = jQuery.css( elem, "display" );
10203 if ( display === "none" ) {
10204 if ( restoreDisplay ) {
10205 display = restoreDisplay;
10206 } else {
10207
10208 // Get nonempty value(s) by temporarily forcing visibility
10209 showHide( [ elem ], true );
10210 restoreDisplay = elem.style.display || restoreDisplay;
10211 display = jQuery.css( elem, "display" );
10212 showHide( [ elem ] );
10213 }
10214 }
10215
10216 // Animate inline elements as inline-block
10217 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
10218 if ( jQuery.css( elem, "float" ) === "none" ) {
10219
10220 // Restore the original display value at the end of pure show/hide animations
10221 if ( !propTween ) {
10222 anim.done( function() {
10223 style.display = restoreDisplay;
10224 } );
10225 if ( restoreDisplay == null ) {
10226 display = style.display;
10227 restoreDisplay = display === "none" ? "" : display;
10228 }
10229 }
10230 style.display = "inline-block";
10231 }
10232 }
10233 }
10234
10235 if ( opts.overflow ) {
10236 style.overflow = "hidden";
10237 anim.always( function() {
10238 style.overflow = opts.overflow[ 0 ];
10239 style.overflowX = opts.overflow[ 1 ];
10240 style.overflowY = opts.overflow[ 2 ];
10241 } );
10242 }
10243
10244 // Implement show/hide animations
10245 propTween = false;
10246 for ( prop in orig ) {
10247
10248 // General show/hide setup for this element animation
10249 if ( !propTween ) {
10250 if ( dataShow ) {
10251 if ( "hidden" in dataShow ) {
10252 hidden = dataShow.hidden;
10253 }
10254 } else {
10255 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
10256 }
10257
10258 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
10259 if ( toggle ) {
10260 dataShow.hidden = !hidden;
10261 }
10262
10263 // Show elements before animating them
10264 if ( hidden ) {
10265 showHide( [ elem ], true );
10266 }
10267
10268 /* eslint-disable no-loop-func */
10269
10270 anim.done( function() {
10271
10272 /* eslint-enable no-loop-func */
10273
10274 // The final step of a "hide" animation is actually hiding the element
10275 if ( !hidden ) {
10276 showHide( [ elem ] );
10277 }
10278 dataPriv.remove( elem, "fxshow" );
10279 for ( prop in orig ) {
10280 jQuery.style( elem, prop, orig[ prop ] );
10281 }
10282 } );
10283 }
10284
10285 // Per-property setup
10286 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
10287 if ( !( prop in dataShow ) ) {
10288 dataShow[ prop ] = propTween.start;
10289 if ( hidden ) {
10290 propTween.end = propTween.start;
10291 propTween.start = 0;
10292 }
10293 }
10294 }
10295}
10296
10297function propFilter( props, specialEasing ) {
10298 var index, name, easing, value, hooks;
10299
10300 // camelCase, specialEasing and expand cssHook pass
10301 for ( index in props ) {
10302 name = jQuery.camelCase( index );
10303 easing = specialEasing[ name ];
10304 value = props[ index ];
10305 if ( jQuery.isArray( value ) ) {
10306 easing = value[ 1 ];
10307 value = props[ index ] = value[ 0 ];
10308 }
10309
10310 if ( index !== name ) {
10311 props[ name ] = value;
10312 delete props[ index ];
10313 }
10314
10315 hooks = jQuery.cssHooks[ name ];
10316 if ( hooks && "expand" in hooks ) {
10317 value = hooks.expand( value );
10318 delete props[ name ];
10319
10320 // Not quite $.extend, this won't overwrite existing keys.
10321 // Reusing 'index' because we have the correct "name"
10322 for ( index in value ) {
10323 if ( !( index in props ) ) {
10324 props[ index ] = value[ index ];
10325 specialEasing[ index ] = easing;
10326 }
10327 }
10328 } else {
10329 specialEasing[ name ] = easing;
10330 }
10331 }
10332}
10333
10334function Animation( elem, properties, options ) {
10335 var result,
10336 stopped,
10337 index = 0,
10338 length = Animation.prefilters.length,
10339 deferred = jQuery.Deferred().always( function() {
10340
10341 // Don't match elem in the :animated selector
10342 delete tick.elem;
10343 } ),
10344 tick = function() {
10345 if ( stopped ) {
10346 return false;
10347 }
10348 var currentTime = fxNow || createFxNow(),
10349 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
10350
10351 // Support: Android 2.3 only
10352 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
10353 temp = remaining / animation.duration || 0,
10354 percent = 1 - temp,
10355 index = 0,
10356 length = animation.tweens.length;
10357
10358 for ( ; index < length; index++ ) {
10359 animation.tweens[ index ].run( percent );
10360 }
10361
10362 deferred.notifyWith( elem, [ animation, percent, remaining ] );
10363
10364 if ( percent < 1 && length ) {
10365 return remaining;
10366 } else {
10367 deferred.resolveWith( elem, [ animation ] );
10368 return false;
10369 }
10370 },
10371 animation = deferred.promise( {
10372 elem: elem,
10373 props: jQuery.extend( {}, properties ),
10374 opts: jQuery.extend( true, {
10375 specialEasing: {},
10376 easing: jQuery.easing._default
10377 }, options ),
10378 originalProperties: properties,
10379 originalOptions: options,
10380 startTime: fxNow || createFxNow(),
10381 duration: options.duration,
10382 tweens: [],
10383 createTween: function( prop, end ) {
10384 var tween = jQuery.Tween( elem, animation.opts, prop, end,
10385 animation.opts.specialEasing[ prop ] || animation.opts.easing );
10386 animation.tweens.push( tween );
10387 return tween;
10388 },
10389 stop: function( gotoEnd ) {
10390 var index = 0,
10391
10392 // If we are going to the end, we want to run all the tweens
10393 // otherwise we skip this part
10394 length = gotoEnd ? animation.tweens.length : 0;
10395 if ( stopped ) {
10396 return this;
10397 }
10398 stopped = true;
10399 for ( ; index < length; index++ ) {
10400 animation.tweens[ index ].run( 1 );
10401 }
10402
10403 // Resolve when we played the last frame; otherwise, reject
10404 if ( gotoEnd ) {
10405 deferred.notifyWith( elem, [ animation, 1, 0 ] );
10406 deferred.resolveWith( elem, [ animation, gotoEnd ] );
10407 } else {
10408 deferred.rejectWith( elem, [ animation, gotoEnd ] );
10409 }
10410 return this;
10411 }
10412 } ),
10413 props = animation.props;
10414
10415 propFilter( props, animation.opts.specialEasing );
10416
10417 for ( ; index < length; index++ ) {
10418 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
10419 if ( result ) {
10420 if ( jQuery.isFunction( result.stop ) ) {
10421 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
10422 jQuery.proxy( result.stop, result );
10423 }
10424 return result;
10425 }
10426 }
10427
10428 jQuery.map( props, createTween, animation );
10429
10430 if ( jQuery.isFunction( animation.opts.start ) ) {
10431 animation.opts.start.call( elem, animation );
10432 }
10433
10434 jQuery.fx.timer(
10435 jQuery.extend( tick, {
10436 elem: elem,
10437 anim: animation,
10438 queue: animation.opts.queue
10439 } )
10440 );
10441
10442 // attach callbacks from options
10443 return animation.progress( animation.opts.progress )
10444 .done( animation.opts.done, animation.opts.complete )
10445 .fail( animation.opts.fail )
10446 .always( animation.opts.always );
10447}
10448
10449jQuery.Animation = jQuery.extend( Animation, {
10450
10451 tweeners: {
10452 "*": [ function( prop, value ) {
10453 var tween = this.createTween( prop, value );
10454 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
10455 return tween;
10456 } ]
10457 },
10458
10459 tweener: function( props, callback ) {
10460 if ( jQuery.isFunction( props ) ) {
10461 callback = props;
10462 props = [ "*" ];
10463 } else {
10464 props = props.match( rnothtmlwhite );
10465 }
10466
10467 var prop,
10468 index = 0,
10469 length = props.length;
10470
10471 for ( ; index < length; index++ ) {
10472 prop = props[ index ];
10473 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
10474 Animation.tweeners[ prop ].unshift( callback );
10475 }
10476 },
10477
10478 prefilters: [ defaultPrefilter ],
10479
10480 prefilter: function( callback, prepend ) {
10481 if ( prepend ) {
10482 Animation.prefilters.unshift( callback );
10483 } else {
10484 Animation.prefilters.push( callback );
10485 }
10486 }
10487} );
10488
10489jQuery.speed = function( speed, easing, fn ) {
10490 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
10491 complete: fn || !fn && easing ||
10492 jQuery.isFunction( speed ) && speed,
10493 duration: speed,
10494 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
10495 };
10496
10497 // Go to the end state if fx are off or if document is hidden
10498 if ( jQuery.fx.off || document.hidden ) {
10499 opt.duration = 0;
10500
10501 } else {
10502 if ( typeof opt.duration !== "number" ) {
10503 if ( opt.duration in jQuery.fx.speeds ) {
10504 opt.duration = jQuery.fx.speeds[ opt.duration ];
10505
10506 } else {
10507 opt.duration = jQuery.fx.speeds._default;
10508 }
10509 }
10510 }
10511
10512 // Normalize opt.queue - true/undefined/null -> "fx"
10513 if ( opt.queue == null || opt.queue === true ) {
10514 opt.queue = "fx";
10515 }
10516
10517 // Queueing
10518 opt.old = opt.complete;
10519
10520 opt.complete = function() {
10521 if ( jQuery.isFunction( opt.old ) ) {
10522 opt.old.call( this );
10523 }
10524
10525 if ( opt.queue ) {
10526 jQuery.dequeue( this, opt.queue );
10527 }
10528 };
10529
10530 return opt;
10531};
10532
10533jQuery.fn.extend( {
10534 fadeTo: function( speed, to, easing, callback ) {
10535
10536 // Show any hidden elements after setting opacity to 0
10537 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
10538
10539 // Animate to the value specified
10540 .end().animate( { opacity: to }, speed, easing, callback );
10541 },
10542 animate: function( prop, speed, easing, callback ) {
10543 var empty = jQuery.isEmptyObject( prop ),
10544 optall = jQuery.speed( speed, easing, callback ),
10545 doAnimation = function() {
10546
10547 // Operate on a copy of prop so per-property easing won't be lost
10548 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
10549
10550 // Empty animations, or finishing resolves immediately
10551 if ( empty || dataPriv.get( this, "finish" ) ) {
10552 anim.stop( true );
10553 }
10554 };
10555 doAnimation.finish = doAnimation;
10556
10557 return empty || optall.queue === false ?
10558 this.each( doAnimation ) :
10559 this.queue( optall.queue, doAnimation );
10560 },
10561 stop: function( type, clearQueue, gotoEnd ) {
10562 var stopQueue = function( hooks ) {
10563 var stop = hooks.stop;
10564 delete hooks.stop;
10565 stop( gotoEnd );
10566 };
10567
10568 if ( typeof type !== "string" ) {
10569 gotoEnd = clearQueue;
10570 clearQueue = type;
10571 type = undefined;
10572 }
10573 if ( clearQueue && type !== false ) {
10574 this.queue( type || "fx", [] );
10575 }
10576
10577 return this.each( function() {
10578 var dequeue = true,
10579 index = type != null && type + "queueHooks",
10580 timers = jQuery.timers,
10581 data = dataPriv.get( this );
10582
10583 if ( index ) {
10584 if ( data[ index ] && data[ index ].stop ) {
10585 stopQueue( data[ index ] );
10586 }
10587 } else {
10588 for ( index in data ) {
10589 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
10590 stopQueue( data[ index ] );
10591 }
10592 }
10593 }
10594
10595 for ( index = timers.length; index--; ) {
10596 if ( timers[ index ].elem === this &&
10597 ( type == null || timers[ index ].queue === type ) ) {
10598
10599 timers[ index ].anim.stop( gotoEnd );
10600 dequeue = false;
10601 timers.splice( index, 1 );
10602 }
10603 }
10604
10605 // Start the next in the queue if the last step wasn't forced.
10606 // Timers currently will call their complete callbacks, which
10607 // will dequeue but only if they were gotoEnd.
10608 if ( dequeue || !gotoEnd ) {
10609 jQuery.dequeue( this, type );
10610 }
10611 } );
10612 },
10613 finish: function( type ) {
10614 if ( type !== false ) {
10615 type = type || "fx";
10616 }
10617 return this.each( function() {
10618 var index,
10619 data = dataPriv.get( this ),
10620 queue = data[ type + "queue" ],
10621 hooks = data[ type + "queueHooks" ],
10622 timers = jQuery.timers,
10623 length = queue ? queue.length : 0;
10624
10625 // Enable finishing flag on private data
10626 data.finish = true;
10627
10628 // Empty the queue first
10629 jQuery.queue( this, type, [] );
10630
10631 if ( hooks && hooks.stop ) {
10632 hooks.stop.call( this, true );
10633 }
10634
10635 // Look for any active animations, and finish them
10636 for ( index = timers.length; index--; ) {
10637 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
10638 timers[ index ].anim.stop( true );
10639 timers.splice( index, 1 );
10640 }
10641 }
10642
10643 // Look for any animations in the old queue and finish them
10644 for ( index = 0; index < length; index++ ) {
10645 if ( queue[ index ] && queue[ index ].finish ) {
10646 queue[ index ].finish.call( this );
10647 }
10648 }
10649
10650 // Turn off finishing flag
10651 delete data.finish;
10652 } );
10653 }
10654} );
10655
10656jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
10657 var cssFn = jQuery.fn[ name ];
10658 jQuery.fn[ name ] = function( speed, easing, callback ) {
10659 return speed == null || typeof speed === "boolean" ?
10660 cssFn.apply( this, arguments ) :
10661 this.animate( genFx( name, true ), speed, easing, callback );
10662 };
10663} );
10664
10665// Generate shortcuts for custom animations
10666jQuery.each( {
10667 slideDown: genFx( "show" ),
10668 slideUp: genFx( "hide" ),
10669 slideToggle: genFx( "toggle" ),
10670 fadeIn: { opacity: "show" },
10671 fadeOut: { opacity: "hide" },
10672 fadeToggle: { opacity: "toggle" }
10673}, function( name, props ) {
10674 jQuery.fn[ name ] = function( speed, easing, callback ) {
10675 return this.animate( props, speed, easing, callback );
10676 };
10677} );
10678
10679jQuery.timers = [];
10680jQuery.fx.tick = function() {
10681 var timer,
10682 i = 0,
10683 timers = jQuery.timers;
10684
10685 fxNow = jQuery.now();
10686
10687 for ( ; i < timers.length; i++ ) {
10688 timer = timers[ i ];
10689
10690 // Checks the timer has not already been removed
10691 if ( !timer() && timers[ i ] === timer ) {
10692 timers.splice( i--, 1 );
10693 }
10694 }
10695
10696 if ( !timers.length ) {
10697 jQuery.fx.stop();
10698 }
10699 fxNow = undefined;
10700};
10701
10702jQuery.fx.timer = function( timer ) {
10703 jQuery.timers.push( timer );
10704 if ( timer() ) {
10705 jQuery.fx.start();
10706 } else {
10707 jQuery.timers.pop();
10708 }
10709};
10710
10711jQuery.fx.interval = 13;
10712jQuery.fx.start = function() {
10713 if ( !timerId ) {
10714 timerId = window.requestAnimationFrame ?
10715 window.requestAnimationFrame( raf ) :
10716 window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
10717 }
10718};
10719
10720jQuery.fx.stop = function() {
10721 if ( window.cancelAnimationFrame ) {
10722 window.cancelAnimationFrame( timerId );
10723 } else {
10724 window.clearInterval( timerId );
10725 }
10726
10727 timerId = null;
10728};
10729
10730jQuery.fx.speeds = {
10731 slow: 600,
10732 fast: 200,
10733
10734 // Default speed
10735 _default: 400
10736};
10737
10738
10739// Based off of the plugin by Clint Helfers, with permission.
10740// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
10741jQuery.fn.delay = function( time, type ) {
10742 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
10743 type = type || "fx";
10744
10745 return this.queue( type, function( next, hooks ) {
10746 var timeout = window.setTimeout( next, time );
10747 hooks.stop = function() {
10748 window.clearTimeout( timeout );
10749 };
10750 } );
10751};
10752
10753
10754( function() {
10755 var input = document.createElement( "input" ),
10756 select = document.createElement( "select" ),
10757 opt = select.appendChild( document.createElement( "option" ) );
10758
10759 input.type = "checkbox";
10760
10761 // Support: Android <=4.3 only
10762 // Default value for a checkbox should be "on"
10763 support.checkOn = input.value !== "";
10764
10765 // Support: IE <=11 only
10766 // Must access selectedIndex to make default options select
10767 support.optSelected = opt.selected;
10768
10769 // Support: IE <=11 only
10770 // An input loses its value after becoming a radio
10771 input = document.createElement( "input" );
10772 input.value = "t";
10773 input.type = "radio";
10774 support.radioValue = input.value === "t";
10775} )();
10776
10777
10778var boolHook,
10779 attrHandle = jQuery.expr.attrHandle;
10780
10781jQuery.fn.extend( {
10782 attr: function( name, value ) {
10783 return access( this, jQuery.attr, name, value, arguments.length > 1 );
10784 },
10785
10786 removeAttr: function( name ) {
10787 return this.each( function() {
10788 jQuery.removeAttr( this, name );
10789 } );
10790 }
10791} );
10792
10793jQuery.extend( {
10794 attr: function( elem, name, value ) {
10795 var ret, hooks,
10796 nType = elem.nodeType;
10797
10798 // Don't get/set attributes on text, comment and attribute nodes
10799 if ( nType === 3 || nType === 8 || nType === 2 ) {
10800 return;
10801 }
10802
10803 // Fallback to prop when attributes are not supported
10804 if ( typeof elem.getAttribute === "undefined" ) {
10805 return jQuery.prop( elem, name, value );
10806 }
10807
10808 // Attribute hooks are determined by the lowercase version
10809 // Grab necessary hook if one is defined
10810 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
10811 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
10812 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
10813 }
10814
10815 if ( value !== undefined ) {
10816 if ( value === null ) {
10817 jQuery.removeAttr( elem, name );
10818 return;
10819 }
10820
10821 if ( hooks && "set" in hooks &&
10822 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
10823 return ret;
10824 }
10825
10826 elem.setAttribute( name, value + "" );
10827 return value;
10828 }
10829
10830 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
10831 return ret;
10832 }
10833
10834 ret = jQuery.find.attr( elem, name );
10835
10836 // Non-existent attributes return null, we normalize to undefined
10837 return ret == null ? undefined : ret;
10838 },
10839
10840 attrHooks: {
10841 type: {
10842 set: function( elem, value ) {
10843 if ( !support.radioValue && value === "radio" &&
10844 jQuery.nodeName( elem, "input" ) ) {
10845 var val = elem.value;
10846 elem.setAttribute( "type", value );
10847 if ( val ) {
10848 elem.value = val;
10849 }
10850 return value;
10851 }
10852 }
10853 }
10854 },
10855
10856 removeAttr: function( elem, value ) {
10857 var name,
10858 i = 0,
10859
10860 // Attribute names can contain non-HTML whitespace characters
10861 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
10862 attrNames = value && value.match( rnothtmlwhite );
10863
10864 if ( attrNames && elem.nodeType === 1 ) {
10865 while ( ( name = attrNames[ i++ ] ) ) {
10866 elem.removeAttribute( name );
10867 }
10868 }
10869 }
10870} );
10871
10872// Hooks for boolean attributes
10873boolHook = {
10874 set: function( elem, value, name ) {
10875 if ( value === false ) {
10876
10877 // Remove boolean attributes when set to false
10878 jQuery.removeAttr( elem, name );
10879 } else {
10880 elem.setAttribute( name, name );
10881 }
10882 return name;
10883 }
10884};
10885
10886jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
10887 var getter = attrHandle[ name ] || jQuery.find.attr;
10888
10889 attrHandle[ name ] = function( elem, name, isXML ) {
10890 var ret, handle,
10891 lowercaseName = name.toLowerCase();
10892
10893 if ( !isXML ) {
10894
10895 // Avoid an infinite loop by temporarily removing this function from the getter
10896 handle = attrHandle[ lowercaseName ];
10897 attrHandle[ lowercaseName ] = ret;
10898 ret = getter( elem, name, isXML ) != null ?
10899 lowercaseName :
10900 null;
10901 attrHandle[ lowercaseName ] = handle;
10902 }
10903 return ret;
10904 };
10905} );
10906
10907
10908
10909
10910var rfocusable = /^(?:input|select|textarea|button)$/i,
10911 rclickable = /^(?:a|area)$/i;
10912
10913jQuery.fn.extend( {
10914 prop: function( name, value ) {
10915 return access( this, jQuery.prop, name, value, arguments.length > 1 );
10916 },
10917
10918 removeProp: function( name ) {
10919 return this.each( function() {
10920 delete this[ jQuery.propFix[ name ] || name ];
10921 } );
10922 }
10923} );
10924
10925jQuery.extend( {
10926 prop: function( elem, name, value ) {
10927 var ret, hooks,
10928 nType = elem.nodeType;
10929
10930 // Don't get/set properties on text, comment and attribute nodes
10931 if ( nType === 3 || nType === 8 || nType === 2 ) {
10932 return;
10933 }
10934
10935 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
10936
10937 // Fix name and attach hooks
10938 name = jQuery.propFix[ name ] || name;
10939 hooks = jQuery.propHooks[ name ];
10940 }
10941
10942 if ( value !== undefined ) {
10943 if ( hooks && "set" in hooks &&
10944 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
10945 return ret;
10946 }
10947
10948 return ( elem[ name ] = value );
10949 }
10950
10951 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
10952 return ret;
10953 }
10954
10955 return elem[ name ];
10956 },
10957
10958 propHooks: {
10959 tabIndex: {
10960 get: function( elem ) {
10961
10962 // Support: IE <=9 - 11 only
10963 // elem.tabIndex doesn't always return the
10964 // correct value when it hasn't been explicitly set
10965 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
10966 // Use proper attribute retrieval(#12072)
10967 var tabindex = jQuery.find.attr( elem, "tabindex" );
10968
10969 if ( tabindex ) {
10970 return parseInt( tabindex, 10 );
10971 }
10972
10973 if (
10974 rfocusable.test( elem.nodeName ) ||
10975 rclickable.test( elem.nodeName ) &&
10976 elem.href
10977 ) {
10978 return 0;
10979 }
10980
10981 return -1;
10982 }
10983 }
10984 },
10985
10986 propFix: {
10987 "for": "htmlFor",
10988 "class": "className"
10989 }
10990} );
10991
10992// Support: IE <=11 only
10993// Accessing the selectedIndex property
10994// forces the browser to respect setting selected
10995// on the option
10996// The getter ensures a default option is selected
10997// when in an optgroup
10998// eslint rule "no-unused-expressions" is disabled for this code
10999// since it considers such accessions noop
11000if ( !support.optSelected ) {
11001 jQuery.propHooks.selected = {
11002 get: function( elem ) {
11003
11004 /* eslint no-unused-expressions: "off" */
11005
11006 var parent = elem.parentNode;
11007 if ( parent && parent.parentNode ) {
11008 parent.parentNode.selectedIndex;
11009 }
11010 return null;
11011 },
11012 set: function( elem ) {
11013
11014 /* eslint no-unused-expressions: "off" */
11015
11016 var parent = elem.parentNode;
11017 if ( parent ) {
11018 parent.selectedIndex;
11019
11020 if ( parent.parentNode ) {
11021 parent.parentNode.selectedIndex;
11022 }
11023 }
11024 }
11025 };
11026}
11027
11028jQuery.each( [
11029 "tabIndex",
11030 "readOnly",
11031 "maxLength",
11032 "cellSpacing",
11033 "cellPadding",
11034 "rowSpan",
11035 "colSpan",
11036 "useMap",
11037 "frameBorder",
11038 "contentEditable"
11039], function() {
11040 jQuery.propFix[ this.toLowerCase() ] = this;
11041} );
11042
11043
11044
11045
11046 // Strip and collapse whitespace according to HTML spec
11047 // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
11048 function stripAndCollapse( value ) {
11049 var tokens = value.match( rnothtmlwhite ) || [];
11050 return tokens.join( " " );
11051 }
11052
11053
11054function getClass( elem ) {
11055 return elem.getAttribute && elem.getAttribute( "class" ) || "";
11056}
11057
11058jQuery.fn.extend( {
11059 addClass: function( value ) {
11060 var classes, elem, cur, curValue, clazz, j, finalValue,
11061 i = 0;
11062
11063 if ( jQuery.isFunction( value ) ) {
11064 return this.each( function( j ) {
11065 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
11066 } );
11067 }
11068
11069 if ( typeof value === "string" && value ) {
11070 classes = value.match( rnothtmlwhite ) || [];
11071
11072 while ( ( elem = this[ i++ ] ) ) {
11073 curValue = getClass( elem );
11074 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
11075
11076 if ( cur ) {
11077 j = 0;
11078 while ( ( clazz = classes[ j++ ] ) ) {
11079 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
11080 cur += clazz + " ";
11081 }
11082 }
11083
11084 // Only assign if different to avoid unneeded rendering.
11085 finalValue = stripAndCollapse( cur );
11086 if ( curValue !== finalValue ) {
11087 elem.setAttribute( "class", finalValue );
11088 }
11089 }
11090 }
11091 }
11092
11093 return this;
11094 },
11095
11096 removeClass: function( value ) {
11097 var classes, elem, cur, curValue, clazz, j, finalValue,
11098 i = 0;
11099
11100 if ( jQuery.isFunction( value ) ) {
11101 return this.each( function( j ) {
11102 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
11103 } );
11104 }
11105
11106 if ( !arguments.length ) {
11107 return this.attr( "class", "" );
11108 }
11109
11110 if ( typeof value === "string" && value ) {
11111 classes = value.match( rnothtmlwhite ) || [];
11112
11113 while ( ( elem = this[ i++ ] ) ) {
11114 curValue = getClass( elem );
11115
11116 // This expression is here for better compressibility (see addClass)
11117 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
11118
11119 if ( cur ) {
11120 j = 0;
11121 while ( ( clazz = classes[ j++ ] ) ) {
11122
11123 // Remove *all* instances
11124 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
11125 cur = cur.replace( " " + clazz + " ", " " );
11126 }
11127 }
11128
11129 // Only assign if different to avoid unneeded rendering.
11130 finalValue = stripAndCollapse( cur );
11131 if ( curValue !== finalValue ) {
11132 elem.setAttribute( "class", finalValue );
11133 }
11134 }
11135 }
11136 }
11137
11138 return this;
11139 },
11140
11141 toggleClass: function( value, stateVal ) {
11142 var type = typeof value;
11143
11144 if ( typeof stateVal === "boolean" && type === "string" ) {
11145 return stateVal ? this.addClass( value ) : this.removeClass( value );
11146 }
11147
11148 if ( jQuery.isFunction( value ) ) {
11149 return this.each( function( i ) {
11150 jQuery( this ).toggleClass(
11151 value.call( this, i, getClass( this ), stateVal ),
11152 stateVal
11153 );
11154 } );
11155 }
11156
11157 return this.each( function() {
11158 var className, i, self, classNames;
11159
11160 if ( type === "string" ) {
11161
11162 // Toggle individual class names
11163 i = 0;
11164 self = jQuery( this );
11165 classNames = value.match( rnothtmlwhite ) || [];
11166
11167 while ( ( className = classNames[ i++ ] ) ) {
11168
11169 // Check each className given, space separated list
11170 if ( self.hasClass( className ) ) {
11171 self.removeClass( className );
11172 } else {
11173 self.addClass( className );
11174 }
11175 }
11176
11177 // Toggle whole class name
11178 } else if ( value === undefined || type === "boolean" ) {
11179 className = getClass( this );
11180 if ( className ) {
11181
11182 // Store className if set
11183 dataPriv.set( this, "__className__", className );
11184 }
11185
11186 // If the element has a class name or if we're passed `false`,
11187 // then remove the whole classname (if there was one, the above saved it).
11188 // Otherwise bring back whatever was previously saved (if anything),
11189 // falling back to the empty string if nothing was stored.
11190 if ( this.setAttribute ) {
11191 this.setAttribute( "class",
11192 className || value === false ?
11193 "" :
11194 dataPriv.get( this, "__className__" ) || ""
11195 );
11196 }
11197 }
11198 } );
11199 },
11200
11201 hasClass: function( selector ) {
11202 var className, elem,
11203 i = 0;
11204
11205 className = " " + selector + " ";
11206 while ( ( elem = this[ i++ ] ) ) {
11207 if ( elem.nodeType === 1 &&
11208 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
11209 return true;
11210 }
11211 }
11212
11213 return false;
11214 }
11215} );
11216
11217
11218
11219
11220var rreturn = /\r/g;
11221
11222jQuery.fn.extend( {
11223 val: function( value ) {
11224 var hooks, ret, isFunction,
11225 elem = this[ 0 ];
11226
11227 if ( !arguments.length ) {
11228 if ( elem ) {
11229 hooks = jQuery.valHooks[ elem.type ] ||
11230 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
11231
11232 if ( hooks &&
11233 "get" in hooks &&
11234 ( ret = hooks.get( elem, "value" ) ) !== undefined
11235 ) {
11236 return ret;
11237 }
11238
11239 ret = elem.value;
11240
11241 // Handle most common string cases
11242 if ( typeof ret === "string" ) {
11243 return ret.replace( rreturn, "" );
11244 }
11245
11246 // Handle cases where value is null/undef or number
11247 return ret == null ? "" : ret;
11248 }
11249
11250 return;
11251 }
11252
11253 isFunction = jQuery.isFunction( value );
11254
11255 return this.each( function( i ) {
11256 var val;
11257
11258 if ( this.nodeType !== 1 ) {
11259 return;
11260 }
11261
11262 if ( isFunction ) {
11263 val = value.call( this, i, jQuery( this ).val() );
11264 } else {
11265 val = value;
11266 }
11267
11268 // Treat null/undefined as ""; convert numbers to string
11269 if ( val == null ) {
11270 val = "";
11271
11272 } else if ( typeof val === "number" ) {
11273 val += "";
11274
11275 } else if ( jQuery.isArray( val ) ) {
11276 val = jQuery.map( val, function( value ) {
11277 return value == null ? "" : value + "";
11278 } );
11279 }
11280
11281 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
11282
11283 // If set returns undefined, fall back to normal setting
11284 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
11285 this.value = val;
11286 }
11287 } );
11288 }
11289} );
11290
11291jQuery.extend( {
11292 valHooks: {
11293 option: {
11294 get: function( elem ) {
11295
11296 var val = jQuery.find.attr( elem, "value" );
11297 return val != null ?
11298 val :
11299
11300 // Support: IE <=10 - 11 only
11301 // option.text throws exceptions (#14686, #14858)
11302 // Strip and collapse whitespace
11303 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
11304 stripAndCollapse( jQuery.text( elem ) );
11305 }
11306 },
11307 select: {
11308 get: function( elem ) {
11309 var value, option, i,
11310 options = elem.options,
11311 index = elem.selectedIndex,
11312 one = elem.type === "select-one",
11313 values = one ? null : [],
11314 max = one ? index + 1 : options.length;
11315
11316 if ( index < 0 ) {
11317 i = max;
11318
11319 } else {
11320 i = one ? index : 0;
11321 }
11322
11323 // Loop through all the selected options
11324 for ( ; i < max; i++ ) {
11325 option = options[ i ];
11326
11327 // Support: IE <=9 only
11328 // IE8-9 doesn't update selected after form reset (#2551)
11329 if ( ( option.selected || i === index ) &&
11330
11331 // Don't return options that are disabled or in a disabled optgroup
11332 !option.disabled &&
11333 ( !option.parentNode.disabled ||
11334 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
11335
11336 // Get the specific value for the option
11337 value = jQuery( option ).val();
11338
11339 // We don't need an array for one selects
11340 if ( one ) {
11341 return value;
11342 }
11343
11344 // Multi-Selects return an array
11345 values.push( value );
11346 }
11347 }
11348
11349 return values;
11350 },
11351
11352 set: function( elem, value ) {
11353 var optionSet, option,
11354 options = elem.options,
11355 values = jQuery.makeArray( value ),
11356 i = options.length;
11357
11358 while ( i-- ) {
11359 option = options[ i ];
11360
11361 /* eslint-disable no-cond-assign */
11362
11363 if ( option.selected =
11364 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
11365 ) {
11366 optionSet = true;
11367 }
11368
11369 /* eslint-enable no-cond-assign */
11370 }
11371
11372 // Force browsers to behave consistently when non-matching value is set
11373 if ( !optionSet ) {
11374 elem.selectedIndex = -1;
11375 }
11376 return values;
11377 }
11378 }
11379 }
11380} );
11381
11382// Radios and checkboxes getter/setter
11383jQuery.each( [ "radio", "checkbox" ], function() {
11384 jQuery.valHooks[ this ] = {
11385 set: function( elem, value ) {
11386 if ( jQuery.isArray( value ) ) {
11387 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
11388 }
11389 }
11390 };
11391 if ( !support.checkOn ) {
11392 jQuery.valHooks[ this ].get = function( elem ) {
11393 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
11394 };
11395 }
11396} );
11397
11398
11399
11400
11401// Return jQuery for attributes-only inclusion
11402
11403
11404var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
11405
11406jQuery.extend( jQuery.event, {
11407
11408 trigger: function( event, data, elem, onlyHandlers ) {
11409
11410 var i, cur, tmp, bubbleType, ontype, handle, special,
11411 eventPath = [ elem || document ],
11412 type = hasOwn.call( event, "type" ) ? event.type : event,
11413 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
11414
11415 cur = tmp = elem = elem || document;
11416
11417 // Don't do events on text and comment nodes
11418 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
11419 return;
11420 }
11421
11422 // focus/blur morphs to focusin/out; ensure we're not firing them right now
11423 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
11424 return;
11425 }
11426
11427 if ( type.indexOf( "." ) > -1 ) {
11428
11429 // Namespaced trigger; create a regexp to match event type in handle()
11430 namespaces = type.split( "." );
11431 type = namespaces.shift();
11432 namespaces.sort();
11433 }
11434 ontype = type.indexOf( ":" ) < 0 && "on" + type;
11435
11436 // Caller can pass in a jQuery.Event object, Object, or just an event type string
11437 event = event[ jQuery.expando ] ?
11438 event :
11439 new jQuery.Event( type, typeof event === "object" && event );
11440
11441 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
11442 event.isTrigger = onlyHandlers ? 2 : 3;
11443 event.namespace = namespaces.join( "." );
11444 event.rnamespace = event.namespace ?
11445 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
11446 null;
11447
11448 // Clean up the event in case it is being reused
11449 event.result = undefined;
11450 if ( !event.target ) {
11451 event.target = elem;
11452 }
11453
11454 // Clone any incoming data and prepend the event, creating the handler arg list
11455 data = data == null ?
11456 [ event ] :
11457 jQuery.makeArray( data, [ event ] );
11458
11459 // Allow special events to draw outside the lines
11460 special = jQuery.event.special[ type ] || {};
11461 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
11462 return;
11463 }
11464
11465 // Determine event propagation path in advance, per W3C events spec (#9951)
11466 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
11467 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
11468
11469 bubbleType = special.delegateType || type;
11470 if ( !rfocusMorph.test( bubbleType + type ) ) {
11471 cur = cur.parentNode;
11472 }
11473 for ( ; cur; cur = cur.parentNode ) {
11474 eventPath.push( cur );
11475 tmp = cur;
11476 }
11477
11478 // Only add window if we got to document (e.g., not plain obj or detached DOM)
11479 if ( tmp === ( elem.ownerDocument || document ) ) {
11480 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
11481 }
11482 }
11483
11484 // Fire handlers on the event path
11485 i = 0;
11486 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
11487
11488 event.type = i > 1 ?
11489 bubbleType :
11490 special.bindType || type;
11491
11492 // jQuery handler
11493 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
11494 dataPriv.get( cur, "handle" );
11495 if ( handle ) {
11496 handle.apply( cur, data );
11497 }
11498
11499 // Native handler
11500 handle = ontype && cur[ ontype ];
11501 if ( handle && handle.apply && acceptData( cur ) ) {
11502 event.result = handle.apply( cur, data );
11503 if ( event.result === false ) {
11504 event.preventDefault();
11505 }
11506 }
11507 }
11508 event.type = type;
11509
11510 // If nobody prevented the default action, do it now
11511 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
11512
11513 if ( ( !special._default ||
11514 special._default.apply( eventPath.pop(), data ) === false ) &&
11515 acceptData( elem ) ) {
11516
11517 // Call a native DOM method on the target with the same name as the event.
11518 // Don't do default actions on window, that's where global variables be (#6170)
11519 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
11520
11521 // Don't re-trigger an onFOO event when we call its FOO() method
11522 tmp = elem[ ontype ];
11523
11524 if ( tmp ) {
11525 elem[ ontype ] = null;
11526 }
11527
11528 // Prevent re-triggering of the same event, since we already bubbled it above
11529 jQuery.event.triggered = type;
11530 elem[ type ]();
11531 jQuery.event.triggered = undefined;
11532
11533 if ( tmp ) {
11534 elem[ ontype ] = tmp;
11535 }
11536 }
11537 }
11538 }
11539
11540 return event.result;
11541 },
11542
11543 // Piggyback on a donor event to simulate a different one
11544 // Used only for `focus(in | out)` events
11545 simulate: function( type, elem, event ) {
11546 var e = jQuery.extend(
11547 new jQuery.Event(),
11548 event,
11549 {
11550 type: type,
11551 isSimulated: true
11552 }
11553 );
11554
11555 jQuery.event.trigger( e, null, elem );
11556 }
11557
11558} );
11559
11560jQuery.fn.extend( {
11561
11562 trigger: function( type, data ) {
11563 return this.each( function() {
11564 jQuery.event.trigger( type, data, this );
11565 } );
11566 },
11567 triggerHandler: function( type, data ) {
11568 var elem = this[ 0 ];
11569 if ( elem ) {
11570 return jQuery.event.trigger( type, data, elem, true );
11571 }
11572 }
11573} );
11574
11575
11576jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
11577 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
11578 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
11579 function( i, name ) {
11580
11581 // Handle event binding
11582 jQuery.fn[ name ] = function( data, fn ) {
11583 return arguments.length > 0 ?
11584 this.on( name, null, data, fn ) :
11585 this.trigger( name );
11586 };
11587} );
11588
11589jQuery.fn.extend( {
11590 hover: function( fnOver, fnOut ) {
11591 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
11592 }
11593} );
11594
11595
11596
11597
11598support.focusin = "onfocusin" in window;
11599
11600
11601// Support: Firefox <=44
11602// Firefox doesn't have focus(in | out) events
11603// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
11604//
11605// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
11606// focus(in | out) events fire after focus & blur events,
11607// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
11608// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
11609if ( !support.focusin ) {
11610 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
11611
11612 // Attach a single capturing handler on the document while someone wants focusin/focusout
11613 var handler = function( event ) {
11614 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
11615 };
11616
11617 jQuery.event.special[ fix ] = {
11618 setup: function() {
11619 var doc = this.ownerDocument || this,
11620 attaches = dataPriv.access( doc, fix );
11621
11622 if ( !attaches ) {
11623 doc.addEventListener( orig, handler, true );
11624 }
11625 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
11626 },
11627 teardown: function() {
11628 var doc = this.ownerDocument || this,
11629 attaches = dataPriv.access( doc, fix ) - 1;
11630
11631 if ( !attaches ) {
11632 doc.removeEventListener( orig, handler, true );
11633 dataPriv.remove( doc, fix );
11634
11635 } else {
11636 dataPriv.access( doc, fix, attaches );
11637 }
11638 }
11639 };
11640 } );
11641}
11642var location = window.location;
11643
11644var nonce = jQuery.now();
11645
11646var rquery = ( /\?/ );
11647
11648
11649
11650// Cross-browser xml parsing
11651jQuery.parseXML = function( data ) {
11652 var xml;
11653 if ( !data || typeof data !== "string" ) {
11654 return null;
11655 }
11656
11657 // Support: IE 9 - 11 only
11658 // IE throws on parseFromString with invalid input.
11659 try {
11660 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
11661 } catch ( e ) {
11662 xml = undefined;
11663 }
11664
11665 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
11666 jQuery.error( "Invalid XML: " + data );
11667 }
11668 return xml;
11669};
11670
11671
11672var
11673 rbracket = /\[\]$/,
11674 rCRLF = /\r?\n/g,
11675 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
11676 rsubmittable = /^(?:input|select|textarea|keygen)/i;
11677
11678function buildParams( prefix, obj, traditional, add ) {
11679 var name;
11680
11681 if ( jQuery.isArray( obj ) ) {
11682
11683 // Serialize array item.
11684 jQuery.each( obj, function( i, v ) {
11685 if ( traditional || rbracket.test( prefix ) ) {
11686
11687 // Treat each array item as a scalar.
11688 add( prefix, v );
11689
11690 } else {
11691
11692 // Item is non-scalar (array or object), encode its numeric index.
11693 buildParams(
11694 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
11695 v,
11696 traditional,
11697 add
11698 );
11699 }
11700 } );
11701
11702 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
11703
11704 // Serialize object item.
11705 for ( name in obj ) {
11706 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
11707 }
11708
11709 } else {
11710
11711 // Serialize scalar item.
11712 add( prefix, obj );
11713 }
11714}
11715
11716// Serialize an array of form elements or a set of
11717// key/values into a query string
11718jQuery.param = function( a, traditional ) {
11719 var prefix,
11720 s = [],
11721 add = function( key, valueOrFunction ) {
11722
11723 // If value is a function, invoke it and use its return value
11724 var value = jQuery.isFunction( valueOrFunction ) ?
11725 valueOrFunction() :
11726 valueOrFunction;
11727
11728 s[ s.length ] = encodeURIComponent( key ) + "=" +
11729 encodeURIComponent( value == null ? "" : value );
11730 };
11731
11732 // If an array was passed in, assume that it is an array of form elements.
11733 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
11734
11735 // Serialize the form elements
11736 jQuery.each( a, function() {
11737 add( this.name, this.value );
11738 } );
11739
11740 } else {
11741
11742 // If traditional, encode the "old" way (the way 1.3.2 or older
11743 // did it), otherwise encode params recursively.
11744 for ( prefix in a ) {
11745 buildParams( prefix, a[ prefix ], traditional, add );
11746 }
11747 }
11748
11749 // Return the resulting serialization
11750 return s.join( "&" );
11751};
11752
11753jQuery.fn.extend( {
11754 serialize: function() {
11755 return jQuery.param( this.serializeArray() );
11756 },
11757 serializeArray: function() {
11758 return this.map( function() {
11759
11760 // Can add propHook for "elements" to filter or add form elements
11761 var elements = jQuery.prop( this, "elements" );
11762 return elements ? jQuery.makeArray( elements ) : this;
11763 } )
11764 .filter( function() {
11765 var type = this.type;
11766
11767 // Use .is( ":disabled" ) so that fieldset[disabled] works
11768 return this.name && !jQuery( this ).is( ":disabled" ) &&
11769 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
11770 ( this.checked || !rcheckableType.test( type ) );
11771 } )
11772 .map( function( i, elem ) {
11773 var val = jQuery( this ).val();
11774
11775 if ( val == null ) {
11776 return null;
11777 }
11778
11779 if ( jQuery.isArray( val ) ) {
11780 return jQuery.map( val, function( val ) {
11781 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
11782 } );
11783 }
11784
11785 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
11786 } ).get();
11787 }
11788} );
11789
11790
11791var
11792 r20 = /%20/g,
11793 rhash = /#.*$/,
11794 rantiCache = /([?&])_=[^&]*/,
11795 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
11796
11797 // #7653, #8125, #8152: local protocol detection
11798 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
11799 rnoContent = /^(?:GET|HEAD)$/,
11800 rprotocol = /^\/\//,
11801
11802 /* Prefilters
11803 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
11804 * 2) These are called:
11805 * - BEFORE asking for a transport
11806 * - AFTER param serialization (s.data is a string if s.processData is true)
11807 * 3) key is the dataType
11808 * 4) the catchall symbol "*" can be used
11809 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
11810 */
11811 prefilters = {},
11812
11813 /* Transports bindings
11814 * 1) key is the dataType
11815 * 2) the catchall symbol "*" can be used
11816 * 3) selection will start with transport dataType and THEN go to "*" if needed
11817 */
11818 transports = {},
11819
11820 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
11821 allTypes = "*/".concat( "*" ),
11822
11823 // Anchor tag for parsing the document origin
11824 originAnchor = document.createElement( "a" );
11825 originAnchor.href = location.href;
11826
11827// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
11828function addToPrefiltersOrTransports( structure ) {
11829
11830 // dataTypeExpression is optional and defaults to "*"
11831 return function( dataTypeExpression, func ) {
11832
11833 if ( typeof dataTypeExpression !== "string" ) {
11834 func = dataTypeExpression;
11835 dataTypeExpression = "*";
11836 }
11837
11838 var dataType,
11839 i = 0,
11840 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
11841
11842 if ( jQuery.isFunction( func ) ) {
11843
11844 // For each dataType in the dataTypeExpression
11845 while ( ( dataType = dataTypes[ i++ ] ) ) {
11846
11847 // Prepend if requested
11848 if ( dataType[ 0 ] === "+" ) {
11849 dataType = dataType.slice( 1 ) || "*";
11850 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
11851
11852 // Otherwise append
11853 } else {
11854 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
11855 }
11856 }
11857 }
11858 };
11859}
11860
11861// Base inspection function for prefilters and transports
11862function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
11863
11864 var inspected = {},
11865 seekingTransport = ( structure === transports );
11866
11867 function inspect( dataType ) {
11868 var selected;
11869 inspected[ dataType ] = true;
11870 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
11871 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
11872 if ( typeof dataTypeOrTransport === "string" &&
11873 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
11874
11875 options.dataTypes.unshift( dataTypeOrTransport );
11876 inspect( dataTypeOrTransport );
11877 return false;
11878 } else if ( seekingTransport ) {
11879 return !( selected = dataTypeOrTransport );
11880 }
11881 } );
11882 return selected;
11883 }
11884
11885 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
11886}
11887
11888// A special extend for ajax options
11889// that takes "flat" options (not to be deep extended)
11890// Fixes #9887
11891function ajaxExtend( target, src ) {
11892 var key, deep,
11893 flatOptions = jQuery.ajaxSettings.flatOptions || {};
11894
11895 for ( key in src ) {
11896 if ( src[ key ] !== undefined ) {
11897 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
11898 }
11899 }
11900 if ( deep ) {
11901 jQuery.extend( true, target, deep );
11902 }
11903
11904 return target;
11905}
11906
11907/* Handles responses to an ajax request:
11908 * - finds the right dataType (mediates between content-type and expected dataType)
11909 * - returns the corresponding response
11910 */
11911function ajaxHandleResponses( s, jqXHR, responses ) {
11912
11913 var ct, type, finalDataType, firstDataType,
11914 contents = s.contents,
11915 dataTypes = s.dataTypes;
11916
11917 // Remove auto dataType and get content-type in the process
11918 while ( dataTypes[ 0 ] === "*" ) {
11919 dataTypes.shift();
11920 if ( ct === undefined ) {
11921 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
11922 }
11923 }
11924
11925 // Check if we're dealing with a known content-type
11926 if ( ct ) {
11927 for ( type in contents ) {
11928 if ( contents[ type ] && contents[ type ].test( ct ) ) {
11929 dataTypes.unshift( type );
11930 break;
11931 }
11932 }
11933 }
11934
11935 // Check to see if we have a response for the expected dataType
11936 if ( dataTypes[ 0 ] in responses ) {
11937 finalDataType = dataTypes[ 0 ];
11938 } else {
11939
11940 // Try convertible dataTypes
11941 for ( type in responses ) {
11942 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
11943 finalDataType = type;
11944 break;
11945 }
11946 if ( !firstDataType ) {
11947 firstDataType = type;
11948 }
11949 }
11950
11951 // Or just use first one
11952 finalDataType = finalDataType || firstDataType;
11953 }
11954
11955 // If we found a dataType
11956 // We add the dataType to the list if needed
11957 // and return the corresponding response
11958 if ( finalDataType ) {
11959 if ( finalDataType !== dataTypes[ 0 ] ) {
11960 dataTypes.unshift( finalDataType );
11961 }
11962 return responses[ finalDataType ];
11963 }
11964}
11965
11966/* Chain conversions given the request and the original response
11967 * Also sets the responseXXX fields on the jqXHR instance
11968 */
11969function ajaxConvert( s, response, jqXHR, isSuccess ) {
11970 var conv2, current, conv, tmp, prev,
11971 converters = {},
11972
11973 // Work with a copy of dataTypes in case we need to modify it for conversion
11974 dataTypes = s.dataTypes.slice();
11975
11976 // Create converters map with lowercased keys
11977 if ( dataTypes[ 1 ] ) {
11978 for ( conv in s.converters ) {
11979 converters[ conv.toLowerCase() ] = s.converters[ conv ];
11980 }
11981 }
11982
11983 current = dataTypes.shift();
11984
11985 // Convert to each sequential dataType
11986 while ( current ) {
11987
11988 if ( s.responseFields[ current ] ) {
11989 jqXHR[ s.responseFields[ current ] ] = response;
11990 }
11991
11992 // Apply the dataFilter if provided
11993 if ( !prev && isSuccess && s.dataFilter ) {
11994 response = s.dataFilter( response, s.dataType );
11995 }
11996
11997 prev = current;
11998 current = dataTypes.shift();
11999
12000 if ( current ) {
12001
12002 // There's only work to do if current dataType is non-auto
12003 if ( current === "*" ) {
12004
12005 current = prev;
12006
12007 // Convert response if prev dataType is non-auto and differs from current
12008 } else if ( prev !== "*" && prev !== current ) {
12009
12010 // Seek a direct converter
12011 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
12012
12013 // If none found, seek a pair
12014 if ( !conv ) {
12015 for ( conv2 in converters ) {
12016
12017 // If conv2 outputs current
12018 tmp = conv2.split( " " );
12019 if ( tmp[ 1 ] === current ) {
12020
12021 // If prev can be converted to accepted input
12022 conv = converters[ prev + " " + tmp[ 0 ] ] ||
12023 converters[ "* " + tmp[ 0 ] ];
12024 if ( conv ) {
12025
12026 // Condense equivalence converters
12027 if ( conv === true ) {
12028 conv = converters[ conv2 ];
12029
12030 // Otherwise, insert the intermediate dataType
12031 } else if ( converters[ conv2 ] !== true ) {
12032 current = tmp[ 0 ];
12033 dataTypes.unshift( tmp[ 1 ] );
12034 }
12035 break;
12036 }
12037 }
12038 }
12039 }
12040
12041 // Apply converter (if not an equivalence)
12042 if ( conv !== true ) {
12043
12044 // Unless errors are allowed to bubble, catch and return them
12045 if ( conv && s.throws ) {
12046 response = conv( response );
12047 } else {
12048 try {
12049 response = conv( response );
12050 } catch ( e ) {
12051 return {
12052 state: "parsererror",
12053 error: conv ? e : "No conversion from " + prev + " to " + current
12054 };
12055 }
12056 }
12057 }
12058 }
12059 }
12060 }
12061
12062 return { state: "success", data: response };
12063}
12064
12065jQuery.extend( {
12066
12067 // Counter for holding the number of active queries
12068 active: 0,
12069
12070 // Last-Modified header cache for next request
12071 lastModified: {},
12072 etag: {},
12073
12074 ajaxSettings: {
12075 url: location.href,
12076 type: "GET",
12077 isLocal: rlocalProtocol.test( location.protocol ),
12078 global: true,
12079 processData: true,
12080 async: true,
12081 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
12082
12083 /*
12084 timeout: 0,
12085 data: null,
12086 dataType: null,
12087 username: null,
12088 password: null,
12089 cache: null,
12090 throws: false,
12091 traditional: false,
12092 headers: {},
12093 */
12094
12095 accepts: {
12096 "*": allTypes,
12097 text: "text/plain",
12098 html: "text/html",
12099 xml: "application/xml, text/xml",
12100 json: "application/json, text/javascript"
12101 },
12102
12103 contents: {
12104 xml: /\bxml\b/,
12105 html: /\bhtml/,
12106 json: /\bjson\b/
12107 },
12108
12109 responseFields: {
12110 xml: "responseXML",
12111 text: "responseText",
12112 json: "responseJSON"
12113 },
12114
12115 // Data converters
12116 // Keys separate source (or catchall "*") and destination types with a single space
12117 converters: {
12118
12119 // Convert anything to text
12120 "* text": String,
12121
12122 // Text to html (true = no transformation)
12123 "text html": true,
12124
12125 // Evaluate text as a json expression
12126 "text json": JSON.parse,
12127
12128 // Parse text as xml
12129 "text xml": jQuery.parseXML
12130 },
12131
12132 // For options that shouldn't be deep extended:
12133 // you can add your own custom options here if
12134 // and when you create one that shouldn't be
12135 // deep extended (see ajaxExtend)
12136 flatOptions: {
12137 url: true,
12138 context: true
12139 }
12140 },
12141
12142 // Creates a full fledged settings object into target
12143 // with both ajaxSettings and settings fields.
12144 // If target is omitted, writes into ajaxSettings.
12145 ajaxSetup: function( target, settings ) {
12146 return settings ?
12147
12148 // Building a settings object
12149 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
12150
12151 // Extending ajaxSettings
12152 ajaxExtend( jQuery.ajaxSettings, target );
12153 },
12154
12155 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
12156 ajaxTransport: addToPrefiltersOrTransports( transports ),
12157
12158 // Main method
12159 ajax: function( url, options ) {
12160
12161 // If url is an object, simulate pre-1.5 signature
12162 if ( typeof url === "object" ) {
12163 options = url;
12164 url = undefined;
12165 }
12166
12167 // Force options to be an object
12168 options = options || {};
12169
12170 var transport,
12171
12172 // URL without anti-cache param
12173 cacheURL,
12174
12175 // Response headers
12176 responseHeadersString,
12177 responseHeaders,
12178
12179 // timeout handle
12180 timeoutTimer,
12181
12182 // Url cleanup var
12183 urlAnchor,
12184
12185 // Request state (becomes false upon send and true upon completion)
12186 completed,
12187
12188 // To know if global events are to be dispatched
12189 fireGlobals,
12190
12191 // Loop variable
12192 i,
12193
12194 // uncached part of the url
12195 uncached,
12196
12197 // Create the final options object
12198 s = jQuery.ajaxSetup( {}, options ),
12199
12200 // Callbacks context
12201 callbackContext = s.context || s,
12202
12203 // Context for global events is callbackContext if it is a DOM node or jQuery collection
12204 globalEventContext = s.context &&
12205 ( callbackContext.nodeType || callbackContext.jquery ) ?
12206 jQuery( callbackContext ) :
12207 jQuery.event,
12208
12209 // Deferreds
12210 deferred = jQuery.Deferred(),
12211 completeDeferred = jQuery.Callbacks( "once memory" ),
12212
12213 // Status-dependent callbacks
12214 statusCode = s.statusCode || {},
12215
12216 // Headers (they are sent all at once)
12217 requestHeaders = {},
12218 requestHeadersNames = {},
12219
12220 // Default abort message
12221 strAbort = "canceled",
12222
12223 // Fake xhr
12224 jqXHR = {
12225 readyState: 0,
12226
12227 // Builds headers hashtable if needed
12228 getResponseHeader: function( key ) {
12229 var match;
12230 if ( completed ) {
12231 if ( !responseHeaders ) {
12232 responseHeaders = {};
12233 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
12234 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
12235 }
12236 }
12237 match = responseHeaders[ key.toLowerCase() ];
12238 }
12239 return match == null ? null : match;
12240 },
12241
12242 // Raw string
12243 getAllResponseHeaders: function() {
12244 return completed ? responseHeadersString : null;
12245 },
12246
12247 // Caches the header
12248 setRequestHeader: function( name, value ) {
12249 if ( completed == null ) {
12250 name = requestHeadersNames[ name.toLowerCase() ] =
12251 requestHeadersNames[ name.toLowerCase() ] || name;
12252 requestHeaders[ name ] = value;
12253 }
12254 return this;
12255 },
12256
12257 // Overrides response content-type header
12258 overrideMimeType: function( type ) {
12259 if ( completed == null ) {
12260 s.mimeType = type;
12261 }
12262 return this;
12263 },
12264
12265 // Status-dependent callbacks
12266 statusCode: function( map ) {
12267 var code;
12268 if ( map ) {
12269 if ( completed ) {
12270
12271 // Execute the appropriate callbacks
12272 jqXHR.always( map[ jqXHR.status ] );
12273 } else {
12274
12275 // Lazy-add the new callbacks in a way that preserves old ones
12276 for ( code in map ) {
12277 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
12278 }
12279 }
12280 }
12281 return this;
12282 },
12283
12284 // Cancel the request
12285 abort: function( statusText ) {
12286 var finalText = statusText || strAbort;
12287 if ( transport ) {
12288 transport.abort( finalText );
12289 }
12290 done( 0, finalText );
12291 return this;
12292 }
12293 };
12294
12295 // Attach deferreds
12296 deferred.promise( jqXHR );
12297
12298 // Add protocol if not provided (prefilters might expect it)
12299 // Handle falsy url in the settings object (#10093: consistency with old signature)
12300 // We also use the url parameter if available
12301 s.url = ( ( url || s.url || location.href ) + "" )
12302 .replace( rprotocol, location.protocol + "//" );
12303
12304 // Alias method option to type as per ticket #12004
12305 s.type = options.method || options.type || s.method || s.type;
12306
12307 // Extract dataTypes list
12308 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
12309
12310 // A cross-domain request is in order when the origin doesn't match the current origin.
12311 if ( s.crossDomain == null ) {
12312 urlAnchor = document.createElement( "a" );
12313
12314 // Support: IE <=8 - 11, Edge 12 - 13
12315 // IE throws exception on accessing the href property if url is malformed,
12316 // e.g. http://example.com:80x/
12317 try {
12318 urlAnchor.href = s.url;
12319
12320 // Support: IE <=8 - 11 only
12321 // Anchor's host property isn't correctly set when s.url is relative
12322 urlAnchor.href = urlAnchor.href;
12323 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
12324 urlAnchor.protocol + "//" + urlAnchor.host;
12325 } catch ( e ) {
12326
12327 // If there is an error parsing the URL, assume it is crossDomain,
12328 // it can be rejected by the transport if it is invalid
12329 s.crossDomain = true;
12330 }
12331 }
12332
12333 // Convert data if not already a string
12334 if ( s.data && s.processData && typeof s.data !== "string" ) {
12335 s.data = jQuery.param( s.data, s.traditional );
12336 }
12337
12338 // Apply prefilters
12339 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
12340
12341 // If request was aborted inside a prefilter, stop there
12342 if ( completed ) {
12343 return jqXHR;
12344 }
12345
12346 // We can fire global events as of now if asked to
12347 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
12348 fireGlobals = jQuery.event && s.global;
12349
12350 // Watch for a new set of requests
12351 if ( fireGlobals && jQuery.active++ === 0 ) {
12352 jQuery.event.trigger( "ajaxStart" );
12353 }
12354
12355 // Uppercase the type
12356 s.type = s.type.toUpperCase();
12357
12358 // Determine if request has content
12359 s.hasContent = !rnoContent.test( s.type );
12360
12361 // Save the URL in case we're toying with the If-Modified-Since
12362 // and/or If-None-Match header later on
12363 // Remove hash to simplify url manipulation
12364 cacheURL = s.url.replace( rhash, "" );
12365
12366 // More options handling for requests with no content
12367 if ( !s.hasContent ) {
12368
12369 // Remember the hash so we can put it back
12370 uncached = s.url.slice( cacheURL.length );
12371
12372 // If data is available, append data to url
12373 if ( s.data ) {
12374 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
12375
12376 // #9682: remove data so that it's not used in an eventual retry
12377 delete s.data;
12378 }
12379
12380 // Add or update anti-cache param if needed
12381 if ( s.cache === false ) {
12382 cacheURL = cacheURL.replace( rantiCache, "$1" );
12383 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
12384 }
12385
12386 // Put hash and anti-cache on the URL that will be requested (gh-1732)
12387 s.url = cacheURL + uncached;
12388
12389 // Change '%20' to '+' if this is encoded form body content (gh-2658)
12390 } else if ( s.data && s.processData &&
12391 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
12392 s.data = s.data.replace( r20, "+" );
12393 }
12394
12395 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
12396 if ( s.ifModified ) {
12397 if ( jQuery.lastModified[ cacheURL ] ) {
12398 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
12399 }
12400 if ( jQuery.etag[ cacheURL ] ) {
12401 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
12402 }
12403 }
12404
12405 // Set the correct header, if data is being sent
12406 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
12407 jqXHR.setRequestHeader( "Content-Type", s.contentType );
12408 }
12409
12410 // Set the Accepts header for the server, depending on the dataType
12411 jqXHR.setRequestHeader(
12412 "Accept",
12413 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
12414 s.accepts[ s.dataTypes[ 0 ] ] +
12415 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
12416 s.accepts[ "*" ]
12417 );
12418
12419 // Check for headers option
12420 for ( i in s.headers ) {
12421 jqXHR.setRequestHeader( i, s.headers[ i ] );
12422 }
12423
12424 // Allow custom headers/mimetypes and early abort
12425 if ( s.beforeSend &&
12426 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
12427
12428 // Abort if not done already and return
12429 return jqXHR.abort();
12430 }
12431
12432 // Aborting is no longer a cancellation
12433 strAbort = "abort";
12434
12435 // Install callbacks on deferreds
12436 completeDeferred.add( s.complete );
12437 jqXHR.done( s.success );
12438 jqXHR.fail( s.error );
12439
12440 // Get transport
12441 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
12442
12443 // If no transport, we auto-abort
12444 if ( !transport ) {
12445 done( -1, "No Transport" );
12446 } else {
12447 jqXHR.readyState = 1;
12448
12449 // Send global event
12450 if ( fireGlobals ) {
12451 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
12452 }
12453
12454 // If request was aborted inside ajaxSend, stop there
12455 if ( completed ) {
12456 return jqXHR;
12457 }
12458
12459 // Timeout
12460 if ( s.async && s.timeout > 0 ) {
12461 timeoutTimer = window.setTimeout( function() {
12462 jqXHR.abort( "timeout" );
12463 }, s.timeout );
12464 }
12465
12466 try {
12467 completed = false;
12468 transport.send( requestHeaders, done );
12469 } catch ( e ) {
12470
12471 // Rethrow post-completion exceptions
12472 if ( completed ) {
12473 throw e;
12474 }
12475
12476 // Propagate others as results
12477 done( -1, e );
12478 }
12479 }
12480
12481 // Callback for when everything is done
12482 function done( status, nativeStatusText, responses, headers ) {
12483 var isSuccess, success, error, response, modified,
12484 statusText = nativeStatusText;
12485
12486 // Ignore repeat invocations
12487 if ( completed ) {
12488 return;
12489 }
12490
12491 completed = true;
12492
12493 // Clear timeout if it exists
12494 if ( timeoutTimer ) {
12495 window.clearTimeout( timeoutTimer );
12496 }
12497
12498 // Dereference transport for early garbage collection
12499 // (no matter how long the jqXHR object will be used)
12500 transport = undefined;
12501
12502 // Cache response headers
12503 responseHeadersString = headers || "";
12504
12505 // Set readyState
12506 jqXHR.readyState = status > 0 ? 4 : 0;
12507
12508 // Determine if successful
12509 isSuccess = status >= 200 && status < 300 || status === 304;
12510
12511 // Get response data
12512 if ( responses ) {
12513 response = ajaxHandleResponses( s, jqXHR, responses );
12514 }
12515
12516 // Convert no matter what (that way responseXXX fields are always set)
12517 response = ajaxConvert( s, response, jqXHR, isSuccess );
12518
12519 // If successful, handle type chaining
12520 if ( isSuccess ) {
12521
12522 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
12523 if ( s.ifModified ) {
12524 modified = jqXHR.getResponseHeader( "Last-Modified" );
12525 if ( modified ) {
12526 jQuery.lastModified[ cacheURL ] = modified;
12527 }
12528 modified = jqXHR.getResponseHeader( "etag" );
12529 if ( modified ) {
12530 jQuery.etag[ cacheURL ] = modified;
12531 }
12532 }
12533
12534 // if no content
12535 if ( status === 204 || s.type === "HEAD" ) {
12536 statusText = "nocontent";
12537
12538 // if not modified
12539 } else if ( status === 304 ) {
12540 statusText = "notmodified";
12541
12542 // If we have data, let's convert it
12543 } else {
12544 statusText = response.state;
12545 success = response.data;
12546 error = response.error;
12547 isSuccess = !error;
12548 }
12549 } else {
12550
12551 // Extract error from statusText and normalize for non-aborts
12552 error = statusText;
12553 if ( status || !statusText ) {
12554 statusText = "error";
12555 if ( status < 0 ) {
12556 status = 0;
12557 }
12558 }
12559 }
12560
12561 // Set data for the fake xhr object
12562 jqXHR.status = status;
12563 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
12564
12565 // Success/Error
12566 if ( isSuccess ) {
12567 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
12568 } else {
12569 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
12570 }
12571
12572 // Status-dependent callbacks
12573 jqXHR.statusCode( statusCode );
12574 statusCode = undefined;
12575
12576 if ( fireGlobals ) {
12577 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
12578 [ jqXHR, s, isSuccess ? success : error ] );
12579 }
12580
12581 // Complete
12582 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
12583
12584 if ( fireGlobals ) {
12585 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
12586
12587 // Handle the global AJAX counter
12588 if ( !( --jQuery.active ) ) {
12589 jQuery.event.trigger( "ajaxStop" );
12590 }
12591 }
12592 }
12593
12594 return jqXHR;
12595 },
12596
12597 getJSON: function( url, data, callback ) {
12598 return jQuery.get( url, data, callback, "json" );
12599 },
12600
12601 getScript: function( url, callback ) {
12602 return jQuery.get( url, undefined, callback, "script" );
12603 }
12604} );
12605
12606jQuery.each( [ "get", "post" ], function( i, method ) {
12607 jQuery[ method ] = function( url, data, callback, type ) {
12608
12609 // Shift arguments if data argument was omitted
12610 if ( jQuery.isFunction( data ) ) {
12611 type = type || callback;
12612 callback = data;
12613 data = undefined;
12614 }
12615
12616 // The url can be an options object (which then must have .url)
12617 return jQuery.ajax( jQuery.extend( {
12618 url: url,
12619 type: method,
12620 dataType: type,
12621 data: data,
12622 success: callback
12623 }, jQuery.isPlainObject( url ) && url ) );
12624 };
12625} );
12626
12627
12628jQuery._evalUrl = function( url ) {
12629 return jQuery.ajax( {
12630 url: url,
12631
12632 // Make this explicit, since user can override this through ajaxSetup (#11264)
12633 type: "GET",
12634 dataType: "script",
12635 cache: true,
12636 async: false,
12637 global: false,
12638 "throws": true
12639 } );
12640};
12641
12642
12643jQuery.fn.extend( {
12644 wrapAll: function( html ) {
12645 var wrap;
12646
12647 if ( this[ 0 ] ) {
12648 if ( jQuery.isFunction( html ) ) {
12649 html = html.call( this[ 0 ] );
12650 }
12651
12652 // The elements to wrap the target around
12653 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
12654
12655 if ( this[ 0 ].parentNode ) {
12656 wrap.insertBefore( this[ 0 ] );
12657 }
12658
12659 wrap.map( function() {
12660 var elem = this;
12661
12662 while ( elem.firstElementChild ) {
12663 elem = elem.firstElementChild;
12664 }
12665
12666 return elem;
12667 } ).append( this );
12668 }
12669
12670 return this;
12671 },
12672
12673 wrapInner: function( html ) {
12674 if ( jQuery.isFunction( html ) ) {
12675 return this.each( function( i ) {
12676 jQuery( this ).wrapInner( html.call( this, i ) );
12677 } );
12678 }
12679
12680 return this.each( function() {
12681 var self = jQuery( this ),
12682 contents = self.contents();
12683
12684 if ( contents.length ) {
12685 contents.wrapAll( html );
12686
12687 } else {
12688 self.append( html );
12689 }
12690 } );
12691 },
12692
12693 wrap: function( html ) {
12694 var isFunction = jQuery.isFunction( html );
12695
12696 return this.each( function( i ) {
12697 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
12698 } );
12699 },
12700
12701 unwrap: function( selector ) {
12702 this.parent( selector ).not( "body" ).each( function() {
12703 jQuery( this ).replaceWith( this.childNodes );
12704 } );
12705 return this;
12706 }
12707} );
12708
12709
12710jQuery.expr.pseudos.hidden = function( elem ) {
12711 return !jQuery.expr.pseudos.visible( elem );
12712};
12713jQuery.expr.pseudos.visible = function( elem ) {
12714 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
12715};
12716
12717
12718
12719
12720jQuery.ajaxSettings.xhr = function() {
12721 try {
12722 return new window.XMLHttpRequest();
12723 } catch ( e ) {}
12724};
12725
12726var xhrSuccessStatus = {
12727
12728 // File protocol always yields status code 0, assume 200
12729 0: 200,
12730
12731 // Support: IE <=9 only
12732 // #1450: sometimes IE returns 1223 when it should be 204
12733 1223: 204
12734 },
12735 xhrSupported = jQuery.ajaxSettings.xhr();
12736
12737support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
12738support.ajax = xhrSupported = !!xhrSupported;
12739
12740jQuery.ajaxTransport( function( options ) {
12741 var callback, errorCallback;
12742
12743 // Cross domain only allowed if supported through XMLHttpRequest
12744 if ( support.cors || xhrSupported && !options.crossDomain ) {
12745 return {
12746 send: function( headers, complete ) {
12747 var i,
12748 xhr = options.xhr();
12749
12750 xhr.open(
12751 options.type,
12752 options.url,
12753 options.async,
12754 options.username,
12755 options.password
12756 );
12757
12758 // Apply custom fields if provided
12759 if ( options.xhrFields ) {
12760 for ( i in options.xhrFields ) {
12761 xhr[ i ] = options.xhrFields[ i ];
12762 }
12763 }
12764
12765 // Override mime type if needed
12766 if ( options.mimeType && xhr.overrideMimeType ) {
12767 xhr.overrideMimeType( options.mimeType );
12768 }
12769
12770 // X-Requested-With header
12771 // For cross-domain requests, seeing as conditions for a preflight are
12772 // akin to a jigsaw puzzle, we simply never set it to be sure.
12773 // (it can always be set on a per-request basis or even using ajaxSetup)
12774 // For same-domain requests, won't change header if already provided.
12775 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
12776 headers[ "X-Requested-With" ] = "XMLHttpRequest";
12777 }
12778
12779 // Set headers
12780 for ( i in headers ) {
12781 xhr.setRequestHeader( i, headers[ i ] );
12782 }
12783
12784 // Callback
12785 callback = function( type ) {
12786 return function() {
12787 if ( callback ) {
12788 callback = errorCallback = xhr.onload =
12789 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
12790
12791 if ( type === "abort" ) {
12792 xhr.abort();
12793 } else if ( type === "error" ) {
12794
12795 // Support: IE <=9 only
12796 // On a manual native abort, IE9 throws
12797 // errors on any property access that is not readyState
12798 if ( typeof xhr.status !== "number" ) {
12799 complete( 0, "error" );
12800 } else {
12801 complete(
12802
12803 // File: protocol always yields status 0; see #8605, #14207
12804 xhr.status,
12805 xhr.statusText
12806 );
12807 }
12808 } else {
12809 complete(
12810 xhrSuccessStatus[ xhr.status ] || xhr.status,
12811 xhr.statusText,
12812
12813 // Support: IE <=9 only
12814 // IE9 has no XHR2 but throws on binary (trac-11426)
12815 // For XHR2 non-text, let the caller handle it (gh-2498)
12816 ( xhr.responseType || "text" ) !== "text" ||
12817 typeof xhr.responseText !== "string" ?
12818 { binary: xhr.response } :
12819 { text: xhr.responseText },
12820 xhr.getAllResponseHeaders()
12821 );
12822 }
12823 }
12824 };
12825 };
12826
12827 // Listen to events
12828 xhr.onload = callback();
12829 errorCallback = xhr.onerror = callback( "error" );
12830
12831 // Support: IE 9 only
12832 // Use onreadystatechange to replace onabort
12833 // to handle uncaught aborts
12834 if ( xhr.onabort !== undefined ) {
12835 xhr.onabort = errorCallback;
12836 } else {
12837 xhr.onreadystatechange = function() {
12838
12839 // Check readyState before timeout as it changes
12840 if ( xhr.readyState === 4 ) {
12841
12842 // Allow onerror to be called first,
12843 // but that will not handle a native abort
12844 // Also, save errorCallback to a variable
12845 // as xhr.onerror cannot be accessed
12846 window.setTimeout( function() {
12847 if ( callback ) {
12848 errorCallback();
12849 }
12850 } );
12851 }
12852 };
12853 }
12854
12855 // Create the abort callback
12856 callback = callback( "abort" );
12857
12858 try {
12859
12860 // Do send the request (this may raise an exception)
12861 xhr.send( options.hasContent && options.data || null );
12862 } catch ( e ) {
12863
12864 // #14683: Only rethrow if this hasn't been notified as an error yet
12865 if ( callback ) {
12866 throw e;
12867 }
12868 }
12869 },
12870
12871 abort: function() {
12872 if ( callback ) {
12873 callback();
12874 }
12875 }
12876 };
12877 }
12878} );
12879
12880
12881
12882
12883// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
12884jQuery.ajaxPrefilter( function( s ) {
12885 if ( s.crossDomain ) {
12886 s.contents.script = false;
12887 }
12888} );
12889
12890// Install script dataType
12891jQuery.ajaxSetup( {
12892 accepts: {
12893 script: "text/javascript, application/javascript, " +
12894 "application/ecmascript, application/x-ecmascript"
12895 },
12896 contents: {
12897 script: /\b(?:java|ecma)script\b/
12898 },
12899 converters: {
12900 "text script": function( text ) {
12901 jQuery.globalEval( text );
12902 return text;
12903 }
12904 }
12905} );
12906
12907// Handle cache's special case and crossDomain
12908jQuery.ajaxPrefilter( "script", function( s ) {
12909 if ( s.cache === undefined ) {
12910 s.cache = false;
12911 }
12912 if ( s.crossDomain ) {
12913 s.type = "GET";
12914 }
12915} );
12916
12917// Bind script tag hack transport
12918jQuery.ajaxTransport( "script", function( s ) {
12919
12920 // This transport only deals with cross domain requests
12921 if ( s.crossDomain ) {
12922 var script, callback;
12923 return {
12924 send: function( _, complete ) {
12925 script = jQuery( "<script>" ).prop( {
12926 charset: s.scriptCharset,
12927 src: s.url
12928 } ).on(
12929 "load error",
12930 callback = function( evt ) {
12931 script.remove();
12932 callback = null;
12933 if ( evt ) {
12934 complete( evt.type === "error" ? 404 : 200, evt.type );
12935 }
12936 }
12937 );
12938
12939 // Use native DOM manipulation to avoid our domManip AJAX trickery
12940 document.head.appendChild( script[ 0 ] );
12941 },
12942 abort: function() {
12943 if ( callback ) {
12944 callback();
12945 }
12946 }
12947 };
12948 }
12949} );
12950
12951
12952
12953
12954var oldCallbacks = [],
12955 rjsonp = /(=)\?(?=&|$)|\?\?/;
12956
12957// Default jsonp settings
12958jQuery.ajaxSetup( {
12959 jsonp: "callback",
12960 jsonpCallback: function() {
12961 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
12962 this[ callback ] = true;
12963 return callback;
12964 }
12965} );
12966
12967// Detect, normalize options and install callbacks for jsonp requests
12968jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
12969
12970 var callbackName, overwritten, responseContainer,
12971 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
12972 "url" :
12973 typeof s.data === "string" &&
12974 ( s.contentType || "" )
12975 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
12976 rjsonp.test( s.data ) && "data"
12977 );
12978
12979 // Handle iff the expected data type is "jsonp" or we have a parameter to set
12980 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
12981
12982 // Get callback name, remembering preexisting value associated with it
12983 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
12984 s.jsonpCallback() :
12985 s.jsonpCallback;
12986
12987 // Insert callback into url or form data
12988 if ( jsonProp ) {
12989 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
12990 } else if ( s.jsonp !== false ) {
12991 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
12992 }
12993
12994 // Use data converter to retrieve json after script execution
12995 s.converters[ "script json" ] = function() {
12996 if ( !responseContainer ) {
12997 jQuery.error( callbackName + " was not called" );
12998 }
12999 return responseContainer[ 0 ];
13000 };
13001
13002 // Force json dataType
13003 s.dataTypes[ 0 ] = "json";
13004
13005 // Install callback
13006 overwritten = window[ callbackName ];
13007 window[ callbackName ] = function() {
13008 responseContainer = arguments;
13009 };
13010
13011 // Clean-up function (fires after converters)
13012 jqXHR.always( function() {
13013
13014 // If previous value didn't exist - remove it
13015 if ( overwritten === undefined ) {
13016 jQuery( window ).removeProp( callbackName );
13017
13018 // Otherwise restore preexisting value
13019 } else {
13020 window[ callbackName ] = overwritten;
13021 }
13022
13023 // Save back as free
13024 if ( s[ callbackName ] ) {
13025
13026 // Make sure that re-using the options doesn't screw things around
13027 s.jsonpCallback = originalSettings.jsonpCallback;
13028
13029 // Save the callback name for future use
13030 oldCallbacks.push( callbackName );
13031 }
13032
13033 // Call if it was a function and we have a response
13034 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
13035 overwritten( responseContainer[ 0 ] );
13036 }
13037
13038 responseContainer = overwritten = undefined;
13039 } );
13040
13041 // Delegate to script
13042 return "script";
13043 }
13044} );
13045
13046
13047
13048
13049// Support: Safari 8 only
13050// In Safari 8 documents created via document.implementation.createHTMLDocument
13051// collapse sibling forms: the second one becomes a child of the first one.
13052// Because of that, this security measure has to be disabled in Safari 8.
13053// https://bugs.webkit.org/show_bug.cgi?id=137337
13054support.createHTMLDocument = ( function() {
13055 var body = document.implementation.createHTMLDocument( "" ).body;
13056 body.innerHTML = "<form></form><form></form>";
13057 return body.childNodes.length === 2;
13058} )();
13059
13060
13061// Argument "data" should be string of html
13062// context (optional): If specified, the fragment will be created in this context,
13063// defaults to document
13064// keepScripts (optional): If true, will include scripts passed in the html string
13065jQuery.parseHTML = function( data, context, keepScripts ) {
13066 if ( typeof data !== "string" ) {
13067 return [];
13068 }
13069 if ( typeof context === "boolean" ) {
13070 keepScripts = context;
13071 context = false;
13072 }
13073
13074 var base, parsed, scripts;
13075
13076 if ( !context ) {
13077
13078 // Stop scripts or inline event handlers from being executed immediately
13079 // by using document.implementation
13080 if ( support.createHTMLDocument ) {
13081 context = document.implementation.createHTMLDocument( "" );
13082
13083 // Set the base href for the created document
13084 // so any parsed elements with URLs
13085 // are based on the document's URL (gh-2965)
13086 base = context.createElement( "base" );
13087 base.href = document.location.href;
13088 context.head.appendChild( base );
13089 } else {
13090 context = document;
13091 }
13092 }
13093
13094 parsed = rsingleTag.exec( data );
13095 scripts = !keepScripts && [];
13096
13097 // Single tag
13098 if ( parsed ) {
13099 return [ context.createElement( parsed[ 1 ] ) ];
13100 }
13101
13102 parsed = buildFragment( [ data ], context, scripts );
13103
13104 if ( scripts && scripts.length ) {
13105 jQuery( scripts ).remove();
13106 }
13107
13108 return jQuery.merge( [], parsed.childNodes );
13109};
13110
13111
13112/**
13113 * Load a url into a page
13114 */
13115jQuery.fn.load = function( url, params, callback ) {
13116 var selector, type, response,
13117 self = this,
13118 off = url.indexOf( " " );
13119
13120 if ( off > -1 ) {
13121 selector = stripAndCollapse( url.slice( off ) );
13122 url = url.slice( 0, off );
13123 }
13124
13125 // If it's a function
13126 if ( jQuery.isFunction( params ) ) {
13127
13128 // We assume that it's the callback
13129 callback = params;
13130 params = undefined;
13131
13132 // Otherwise, build a param string
13133 } else if ( params && typeof params === "object" ) {
13134 type = "POST";
13135 }
13136
13137 // If we have elements to modify, make the request
13138 if ( self.length > 0 ) {
13139 jQuery.ajax( {
13140 url: url,
13141
13142 // If "type" variable is undefined, then "GET" method will be used.
13143 // Make value of this field explicit since
13144 // user can override it through ajaxSetup method
13145 type: type || "GET",
13146 dataType: "html",
13147 data: params
13148 } ).done( function( responseText ) {
13149
13150 // Save response for use in complete callback
13151 response = arguments;
13152
13153 self.html( selector ?
13154
13155 // If a selector was specified, locate the right elements in a dummy div
13156 // Exclude scripts to avoid IE 'Permission Denied' errors
13157 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
13158
13159 // Otherwise use the full result
13160 responseText );
13161
13162 // If the request succeeds, this function gets "data", "status", "jqXHR"
13163 // but they are ignored because response was set above.
13164 // If it fails, this function gets "jqXHR", "status", "error"
13165 } ).always( callback && function( jqXHR, status ) {
13166 self.each( function() {
13167 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
13168 } );
13169 } );
13170 }
13171
13172 return this;
13173};
13174
13175
13176
13177
13178// Attach a bunch of functions for handling common AJAX events
13179jQuery.each( [
13180 "ajaxStart",
13181 "ajaxStop",
13182 "ajaxComplete",
13183 "ajaxError",
13184 "ajaxSuccess",
13185 "ajaxSend"
13186], function( i, type ) {
13187 jQuery.fn[ type ] = function( fn ) {
13188 return this.on( type, fn );
13189 };
13190} );
13191
13192
13193
13194
13195jQuery.expr.pseudos.animated = function( elem ) {
13196 return jQuery.grep( jQuery.timers, function( fn ) {
13197 return elem === fn.elem;
13198 } ).length;
13199};
13200
13201
13202
13203
13204/**
13205 * Gets a window from an element
13206 */
13207function getWindow( elem ) {
13208 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
13209}
13210
13211jQuery.offset = {
13212 setOffset: function( elem, options, i ) {
13213 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
13214 position = jQuery.css( elem, "position" ),
13215 curElem = jQuery( elem ),
13216 props = {};
13217
13218 // Set position first, in-case top/left are set even on static elem
13219 if ( position === "static" ) {
13220 elem.style.position = "relative";
13221 }
13222
13223 curOffset = curElem.offset();
13224 curCSSTop = jQuery.css( elem, "top" );
13225 curCSSLeft = jQuery.css( elem, "left" );
13226 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
13227 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
13228
13229 // Need to be able to calculate position if either
13230 // top or left is auto and position is either absolute or fixed
13231 if ( calculatePosition ) {
13232 curPosition = curElem.position();
13233 curTop = curPosition.top;
13234 curLeft = curPosition.left;
13235
13236 } else {
13237 curTop = parseFloat( curCSSTop ) || 0;
13238 curLeft = parseFloat( curCSSLeft ) || 0;
13239 }
13240
13241 if ( jQuery.isFunction( options ) ) {
13242
13243 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
13244 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
13245 }
13246
13247 if ( options.top != null ) {
13248 props.top = ( options.top - curOffset.top ) + curTop;
13249 }
13250 if ( options.left != null ) {
13251 props.left = ( options.left - curOffset.left ) + curLeft;
13252 }
13253
13254 if ( "using" in options ) {
13255 options.using.call( elem, props );
13256
13257 } else {
13258 curElem.css( props );
13259 }
13260 }
13261};
13262
13263jQuery.fn.extend( {
13264 offset: function( options ) {
13265
13266 // Preserve chaining for setter
13267 if ( arguments.length ) {
13268 return options === undefined ?
13269 this :
13270 this.each( function( i ) {
13271 jQuery.offset.setOffset( this, options, i );
13272 } );
13273 }
13274
13275 var docElem, win, rect, doc,
13276 elem = this[ 0 ];
13277
13278 if ( !elem ) {
13279 return;
13280 }
13281
13282 // Support: IE <=11 only
13283 // Running getBoundingClientRect on a
13284 // disconnected node in IE throws an error
13285 if ( !elem.getClientRects().length ) {
13286 return { top: 0, left: 0 };
13287 }
13288
13289 rect = elem.getBoundingClientRect();
13290
13291 // Make sure element is not hidden (display: none)
13292 if ( rect.width || rect.height ) {
13293 doc = elem.ownerDocument;
13294 win = getWindow( doc );
13295 docElem = doc.documentElement;
13296
13297 return {
13298 top: rect.top + win.pageYOffset - docElem.clientTop,
13299 left: rect.left + win.pageXOffset - docElem.clientLeft
13300 };
13301 }
13302
13303 // Return zeros for disconnected and hidden elements (gh-2310)
13304 return rect;
13305 },
13306
13307 position: function() {
13308 if ( !this[ 0 ] ) {
13309 return;
13310 }
13311
13312 var offsetParent, offset,
13313 elem = this[ 0 ],
13314 parentOffset = { top: 0, left: 0 };
13315
13316 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
13317 // because it is its only offset parent
13318 if ( jQuery.css( elem, "position" ) === "fixed" ) {
13319
13320 // Assume getBoundingClientRect is there when computed position is fixed
13321 offset = elem.getBoundingClientRect();
13322
13323 } else {
13324
13325 // Get *real* offsetParent
13326 offsetParent = this.offsetParent();
13327
13328 // Get correct offsets
13329 offset = this.offset();
13330 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
13331 parentOffset = offsetParent.offset();
13332 }
13333
13334 // Add offsetParent borders
13335 parentOffset = {
13336 top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
13337 left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
13338 };
13339 }
13340
13341 // Subtract parent offsets and element margins
13342 return {
13343 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
13344 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
13345 };
13346 },
13347
13348 // This method will return documentElement in the following cases:
13349 // 1) For the element inside the iframe without offsetParent, this method will return
13350 // documentElement of the parent window
13351 // 2) For the hidden or detached element
13352 // 3) For body or html element, i.e. in case of the html node - it will return itself
13353 //
13354 // but those exceptions were never presented as a real life use-cases
13355 // and might be considered as more preferable results.
13356 //
13357 // This logic, however, is not guaranteed and can change at any point in the future
13358 offsetParent: function() {
13359 return this.map( function() {
13360 var offsetParent = this.offsetParent;
13361
13362 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
13363 offsetParent = offsetParent.offsetParent;
13364 }
13365
13366 return offsetParent || documentElement;
13367 } );
13368 }
13369} );
13370
13371// Create scrollLeft and scrollTop methods
13372jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
13373 var top = "pageYOffset" === prop;
13374
13375 jQuery.fn[ method ] = function( val ) {
13376 return access( this, function( elem, method, val ) {
13377 var win = getWindow( elem );
13378
13379 if ( val === undefined ) {
13380 return win ? win[ prop ] : elem[ method ];
13381 }
13382
13383 if ( win ) {
13384 win.scrollTo(
13385 !top ? val : win.pageXOffset,
13386 top ? val : win.pageYOffset
13387 );
13388
13389 } else {
13390 elem[ method ] = val;
13391 }
13392 }, method, val, arguments.length );
13393 };
13394} );
13395
13396// Support: Safari <=7 - 9.1, Chrome <=37 - 49
13397// Add the top/left cssHooks using jQuery.fn.position
13398// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
13399// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
13400// getComputedStyle returns percent when specified for top/left/bottom/right;
13401// rather than make the css module depend on the offset module, just check for it here
13402jQuery.each( [ "top", "left" ], function( i, prop ) {
13403 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
13404 function( elem, computed ) {
13405 if ( computed ) {
13406 computed = curCSS( elem, prop );
13407
13408 // If curCSS returns percentage, fallback to offset
13409 return rnumnonpx.test( computed ) ?
13410 jQuery( elem ).position()[ prop ] + "px" :
13411 computed;
13412 }
13413 }
13414 );
13415} );
13416
13417
13418// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
13419jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
13420 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
13421 function( defaultExtra, funcName ) {
13422
13423 // Margin is only for outerHeight, outerWidth
13424 jQuery.fn[ funcName ] = function( margin, value ) {
13425 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
13426 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
13427
13428 return access( this, function( elem, type, value ) {
13429 var doc;
13430
13431 if ( jQuery.isWindow( elem ) ) {
13432
13433 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
13434 return funcName.indexOf( "outer" ) === 0 ?
13435 elem[ "inner" + name ] :
13436 elem.document.documentElement[ "client" + name ];
13437 }
13438
13439 // Get document width or height
13440 if ( elem.nodeType === 9 ) {
13441 doc = elem.documentElement;
13442
13443 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
13444 // whichever is greatest
13445 return Math.max(
13446 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
13447 elem.body[ "offset" + name ], doc[ "offset" + name ],
13448 doc[ "client" + name ]
13449 );
13450 }
13451
13452 return value === undefined ?
13453
13454 // Get width or height on the element, requesting but not forcing parseFloat
13455 jQuery.css( elem, type, extra ) :
13456
13457 // Set width or height on the element
13458 jQuery.style( elem, type, value, extra );
13459 }, type, chainable ? margin : undefined, chainable );
13460 };
13461 } );
13462} );
13463
13464
13465jQuery.fn.extend( {
13466
13467 bind: function( types, data, fn ) {
13468 return this.on( types, null, data, fn );
13469 },
13470 unbind: function( types, fn ) {
13471 return this.off( types, null, fn );
13472 },
13473
13474 delegate: function( selector, types, data, fn ) {
13475 return this.on( types, selector, data, fn );
13476 },
13477 undelegate: function( selector, types, fn ) {
13478
13479 // ( namespace ) or ( selector, types [, fn] )
13480 return arguments.length === 1 ?
13481 this.off( selector, "**" ) :
13482 this.off( types, selector || "**", fn );
13483 }
13484} );
13485
13486jQuery.parseJSON = JSON.parse;
13487
13488
13489
13490
13491// Register as a named AMD module, since jQuery can be concatenated with other
13492// files that may use define, but not via a proper concatenation script that
13493// understands anonymous AMD modules. A named AMD is safest and most robust
13494// way to register. Lowercase jquery is used because AMD module names are
13495// derived from file names, and jQuery is normally delivered in a lowercase
13496// file name. Do this after creating the global so that if an AMD module wants
13497// to call noConflict to hide this version of jQuery, it will work.
13498
13499// Note that for maximum portability, libraries that are not jQuery should
13500// declare themselves as anonymous modules, and avoid setting a global if an
13501// AMD loader is present. jQuery is a special case. For more information, see
13502// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
13503
13504if ( typeof define === "function" && define.amd ) {
13505 define( "jquery", [], function() {
13506 return jQuery;
13507 } );
13508}
13509
13510
13511
13512
13513var
13514
13515 // Map over jQuery in case of overwrite
13516 _jQuery = window.jQuery,
13517
13518 // Map over the $ in case of overwrite
13519 _$ = window.$;
13520
13521jQuery.noConflict = function( deep ) {
13522 if ( window.$ === jQuery ) {
13523 window.$ = _$;
13524 }
13525
13526 if ( deep && window.jQuery === jQuery ) {
13527 window.jQuery = _jQuery;
13528 }
13529
13530 return jQuery;
13531};
13532
13533// Expose jQuery and $ identifiers, even in AMD
13534// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
13535// and CommonJS for browser emulators (#13566)
13536if ( !noGlobal ) {
13537 window.jQuery = window.$ = jQuery;
13538}
13539
13540
13541
13542
13543
13544return jQuery;
13545} );
13546
13547},{}]},{},[1])