· 10 years ago · Aug 30, 2016, 04:48 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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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){
2/*!
3 * jQuery JavaScript Library v2.2.4
4 * http://jquery.com/
5 *
6 * Includes Sizzle.js
7 * http://sizzlejs.com/
8 *
9 * Copyright jQuery Foundation and other contributors
10 * Released under the MIT license
11 * http://jquery.org/license
12 *
13 * Date: 2016-05-20T17:23Z
14 */
15
16(function( global, factory ) {
17
18 if ( typeof module === "object" && typeof module.exports === "object" ) {
19 // For CommonJS and CommonJS-like environments where a proper `window`
20 // is present, execute the factory and get jQuery.
21 // For environments that do not have a `window` with a `document`
22 // (such as Node.js), expose a factory as module.exports.
23 // This accentuates the need for the creation of a real `window`.
24 // e.g. var jQuery = require("jquery")(window);
25 // See ticket #14549 for more info.
26 module.exports = global.document ?
27 factory( global, true ) :
28 function( w ) {
29 if ( !w.document ) {
30 throw new Error( "jQuery requires a window with a document" );
31 }
32 return factory( w );
33 };
34 } else {
35 factory( global );
36 }
37
38// Pass this if window is not defined yet
39}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
40
41// Support: Firefox 18+
42// Can't be in strict mode, several libs including ASP.NET trace
43// the stack via arguments.caller.callee and Firefox dies if
44// you try to trace through "use strict" call chains. (#13335)
45//"use strict";
46var arr = [];
47
48var document = window.document;
49
50var slice = arr.slice;
51
52var concat = arr.concat;
53
54var push = arr.push;
55
56var indexOf = arr.indexOf;
57
58var class2type = {};
59
60var toString = class2type.toString;
61
62var hasOwn = class2type.hasOwnProperty;
63
64var support = {};
65
66
67
68var
69 version = "2.2.4",
70
71 // Define a local copy of jQuery
72 jQuery = function( selector, context ) {
73
74 // The jQuery object is actually just the init constructor 'enhanced'
75 // Need init if jQuery is called (just allow error to be thrown if not included)
76 return new jQuery.fn.init( selector, context );
77 },
78
79 // Support: Android<4.1
80 // Make sure we trim BOM and NBSP
81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
82
83 // Matches dashed string for camelizing
84 rmsPrefix = /^-ms-/,
85 rdashAlpha = /-([\da-z])/gi,
86
87 // Used by jQuery.camelCase as callback to replace()
88 fcamelCase = function( all, letter ) {
89 return letter.toUpperCase();
90 };
91
92jQuery.fn = jQuery.prototype = {
93
94 // The current version of jQuery being used
95 jquery: version,
96
97 constructor: jQuery,
98
99 // Start with an empty selector
100 selector: "",
101
102 // The default length of a jQuery object is 0
103 length: 0,
104
105 toArray: function() {
106 return slice.call( this );
107 },
108
109 // Get the Nth element in the matched element set OR
110 // Get the whole matched element set as a clean array
111 get: function( num ) {
112 return num != null ?
113
114 // Return just the one element from the set
115 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
116
117 // Return all the elements in a clean array
118 slice.call( this );
119 },
120
121 // Take an array of elements and push it onto the stack
122 // (returning the new matched element set)
123 pushStack: function( elems ) {
124
125 // Build a new jQuery matched element set
126 var ret = jQuery.merge( this.constructor(), elems );
127
128 // Add the old object onto the stack (as a reference)
129 ret.prevObject = this;
130 ret.context = this.context;
131
132 // Return the newly-formed element set
133 return ret;
134 },
135
136 // Execute a callback for every element in the matched set.
137 each: function( callback ) {
138 return jQuery.each( this, callback );
139 },
140
141 map: function( callback ) {
142 return this.pushStack( jQuery.map( this, function( elem, i ) {
143 return callback.call( elem, i, elem );
144 } ) );
145 },
146
147 slice: function() {
148 return this.pushStack( slice.apply( this, arguments ) );
149 },
150
151 first: function() {
152 return this.eq( 0 );
153 },
154
155 last: function() {
156 return this.eq( -1 );
157 },
158
159 eq: function( i ) {
160 var len = this.length,
161 j = +i + ( i < 0 ? len : 0 );
162 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
163 },
164
165 end: function() {
166 return this.prevObject || this.constructor();
167 },
168
169 // For internal use only.
170 // Behaves like an Array's method, not like a jQuery method.
171 push: push,
172 sort: arr.sort,
173 splice: arr.splice
174};
175
176jQuery.extend = jQuery.fn.extend = function() {
177 var options, name, src, copy, copyIsArray, clone,
178 target = arguments[ 0 ] || {},
179 i = 1,
180 length = arguments.length,
181 deep = false;
182
183 // Handle a deep copy situation
184 if ( typeof target === "boolean" ) {
185 deep = target;
186
187 // Skip the boolean and the target
188 target = arguments[ i ] || {};
189 i++;
190 }
191
192 // Handle case when target is a string or something (possible in deep copy)
193 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
194 target = {};
195 }
196
197 // Extend jQuery itself if only one argument is passed
198 if ( i === length ) {
199 target = this;
200 i--;
201 }
202
203 for ( ; i < length; i++ ) {
204
205 // Only deal with non-null/undefined values
206 if ( ( options = arguments[ i ] ) != null ) {
207
208 // Extend the base object
209 for ( name in options ) {
210 src = target[ name ];
211 copy = options[ name ];
212
213 // Prevent never-ending loop
214 if ( target === copy ) {
215 continue;
216 }
217
218 // Recurse if we're merging plain objects or arrays
219 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
220 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
221
222 if ( copyIsArray ) {
223 copyIsArray = false;
224 clone = src && jQuery.isArray( src ) ? src : [];
225
226 } else {
227 clone = src && jQuery.isPlainObject( src ) ? src : {};
228 }
229
230 // Never move original objects, clone them
231 target[ name ] = jQuery.extend( deep, clone, copy );
232
233 // Don't bring in undefined values
234 } else if ( copy !== undefined ) {
235 target[ name ] = copy;
236 }
237 }
238 }
239 }
240
241 // Return the modified object
242 return target;
243};
244
245jQuery.extend( {
246
247 // Unique for each copy of jQuery on the page
248 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
249
250 // Assume jQuery is ready without the ready module
251 isReady: true,
252
253 error: function( msg ) {
254 throw new Error( msg );
255 },
256
257 noop: function() {},
258
259 isFunction: function( obj ) {
260 return jQuery.type( obj ) === "function";
261 },
262
263 isArray: Array.isArray,
264
265 isWindow: function( obj ) {
266 return obj != null && obj === obj.window;
267 },
268
269 isNumeric: function( obj ) {
270
271 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
272 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
273 // subtraction forces infinities to NaN
274 // adding 1 corrects loss of precision from parseFloat (#15100)
275 var realStringObj = obj && obj.toString();
276 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
277 },
278
279 isPlainObject: function( obj ) {
280 var key;
281
282 // Not plain objects:
283 // - Any object or value whose internal [[Class]] property is not "[object Object]"
284 // - DOM nodes
285 // - window
286 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
287 return false;
288 }
289
290 // Not own constructor property must be Object
291 if ( obj.constructor &&
292 !hasOwn.call( obj, "constructor" ) &&
293 !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
294 return false;
295 }
296
297 // Own properties are enumerated firstly, so to speed up,
298 // if last one is own, then all properties are own
299 for ( key in obj ) {}
300
301 return key === undefined || hasOwn.call( obj, key );
302 },
303
304 isEmptyObject: function( obj ) {
305 var name;
306 for ( name in obj ) {
307 return false;
308 }
309 return true;
310 },
311
312 type: function( obj ) {
313 if ( obj == null ) {
314 return obj + "";
315 }
316
317 // Support: Android<4.0, iOS<6 (functionish RegExp)
318 return typeof obj === "object" || typeof obj === "function" ?
319 class2type[ toString.call( obj ) ] || "object" :
320 typeof obj;
321 },
322
323 // Evaluates a script in a global context
324 globalEval: function( code ) {
325 var script,
326 indirect = eval;
327
328 code = jQuery.trim( code );
329
330 if ( code ) {
331
332 // If the code includes a valid, prologue position
333 // strict mode pragma, execute code by injecting a
334 // script tag into the document.
335 if ( code.indexOf( "use strict" ) === 1 ) {
336 script = document.createElement( "script" );
337 script.text = code;
338 document.head.appendChild( script ).parentNode.removeChild( script );
339 } else {
340
341 // Otherwise, avoid the DOM node creation, insertion
342 // and removal by using an indirect global eval
343
344 indirect( code );
345 }
346 }
347 },
348
349 // Convert dashed to camelCase; used by the css and data modules
350 // Support: IE9-11+
351 // Microsoft forgot to hump their vendor prefix (#9572)
352 camelCase: function( string ) {
353 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
354 },
355
356 nodeName: function( elem, name ) {
357 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
358 },
359
360 each: function( obj, callback ) {
361 var length, i = 0;
362
363 if ( isArrayLike( obj ) ) {
364 length = obj.length;
365 for ( ; i < length; i++ ) {
366 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
367 break;
368 }
369 }
370 } else {
371 for ( i in obj ) {
372 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
373 break;
374 }
375 }
376 }
377
378 return obj;
379 },
380
381 // Support: Android<4.1
382 trim: function( text ) {
383 return text == null ?
384 "" :
385 ( text + "" ).replace( rtrim, "" );
386 },
387
388 // results is for internal usage only
389 makeArray: function( arr, results ) {
390 var ret = results || [];
391
392 if ( arr != null ) {
393 if ( isArrayLike( Object( arr ) ) ) {
394 jQuery.merge( ret,
395 typeof arr === "string" ?
396 [ arr ] : arr
397 );
398 } else {
399 push.call( ret, arr );
400 }
401 }
402
403 return ret;
404 },
405
406 inArray: function( elem, arr, i ) {
407 return arr == null ? -1 : indexOf.call( arr, elem, i );
408 },
409
410 merge: function( first, second ) {
411 var len = +second.length,
412 j = 0,
413 i = first.length;
414
415 for ( ; j < len; j++ ) {
416 first[ i++ ] = second[ j ];
417 }
418
419 first.length = i;
420
421 return first;
422 },
423
424 grep: function( elems, callback, invert ) {
425 var callbackInverse,
426 matches = [],
427 i = 0,
428 length = elems.length,
429 callbackExpect = !invert;
430
431 // Go through the array, only saving the items
432 // that pass the validator function
433 for ( ; i < length; i++ ) {
434 callbackInverse = !callback( elems[ i ], i );
435 if ( callbackInverse !== callbackExpect ) {
436 matches.push( elems[ i ] );
437 }
438 }
439
440 return matches;
441 },
442
443 // arg is for internal usage only
444 map: function( elems, callback, arg ) {
445 var length, value,
446 i = 0,
447 ret = [];
448
449 // Go through the array, translating each of the items to their new values
450 if ( isArrayLike( elems ) ) {
451 length = elems.length;
452 for ( ; i < length; i++ ) {
453 value = callback( elems[ i ], i, arg );
454
455 if ( value != null ) {
456 ret.push( value );
457 }
458 }
459
460 // Go through every key on the object,
461 } else {
462 for ( i in elems ) {
463 value = callback( elems[ i ], i, arg );
464
465 if ( value != null ) {
466 ret.push( value );
467 }
468 }
469 }
470
471 // Flatten any nested arrays
472 return concat.apply( [], ret );
473 },
474
475 // A global GUID counter for objects
476 guid: 1,
477
478 // Bind a function to a context, optionally partially applying any
479 // arguments.
480 proxy: function( fn, context ) {
481 var tmp, args, proxy;
482
483 if ( typeof context === "string" ) {
484 tmp = fn[ context ];
485 context = fn;
486 fn = tmp;
487 }
488
489 // Quick check to determine if target is callable, in the spec
490 // this throws a TypeError, but we will just return undefined.
491 if ( !jQuery.isFunction( fn ) ) {
492 return undefined;
493 }
494
495 // Simulated bind
496 args = slice.call( arguments, 2 );
497 proxy = function() {
498 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
499 };
500
501 // Set the guid of unique handler to the same of original handler, so it can be removed
502 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
503
504 return proxy;
505 },
506
507 now: Date.now,
508
509 // jQuery.support is not used in Core but other projects attach their
510 // properties to it so it needs to exist.
511 support: support
512} );
513
514// JSHint would error on this code due to the Symbol not being defined in ES5.
515// Defining this global in .jshintrc would create a danger of using the global
516// unguarded in another place, it seems safer to just disable JSHint for these
517// three lines.
518/* jshint ignore: start */
519if ( typeof Symbol === "function" ) {
520 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
521}
522/* jshint ignore: end */
523
524// Populate the class2type map
525jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
526function( i, name ) {
527 class2type[ "[object " + name + "]" ] = name.toLowerCase();
528} );
529
530function isArrayLike( obj ) {
531
532 // Support: iOS 8.2 (not reproducible in simulator)
533 // `in` check used to prevent JIT error (gh-2145)
534 // hasOwn isn't used here due to false negatives
535 // regarding Nodelist length in IE
536 var length = !!obj && "length" in obj && obj.length,
537 type = jQuery.type( obj );
538
539 if ( type === "function" || jQuery.isWindow( obj ) ) {
540 return false;
541 }
542
543 return type === "array" || length === 0 ||
544 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
545}
546var Sizzle =
547/*!
548 * Sizzle CSS Selector Engine v2.2.1
549 * http://sizzlejs.com/
550 *
551 * Copyright jQuery Foundation and other contributors
552 * Released under the MIT license
553 * http://jquery.org/license
554 *
555 * Date: 2015-10-17
556 */
557(function( window ) {
558
559var i,
560 support,
561 Expr,
562 getText,
563 isXML,
564 tokenize,
565 compile,
566 select,
567 outermostContext,
568 sortInput,
569 hasDuplicate,
570
571 // Local document vars
572 setDocument,
573 document,
574 docElem,
575 documentIsHTML,
576 rbuggyQSA,
577 rbuggyMatches,
578 matches,
579 contains,
580
581 // Instance-specific data
582 expando = "sizzle" + 1 * new Date(),
583 preferredDoc = window.document,
584 dirruns = 0,
585 done = 0,
586 classCache = createCache(),
587 tokenCache = createCache(),
588 compilerCache = createCache(),
589 sortOrder = function( a, b ) {
590 if ( a === b ) {
591 hasDuplicate = true;
592 }
593 return 0;
594 },
595
596 // General-purpose constants
597 MAX_NEGATIVE = 1 << 31,
598
599 // Instance methods
600 hasOwn = ({}).hasOwnProperty,
601 arr = [],
602 pop = arr.pop,
603 push_native = arr.push,
604 push = arr.push,
605 slice = arr.slice,
606 // Use a stripped-down indexOf as it's faster than native
607 // http://jsperf.com/thor-indexof-vs-for/5
608 indexOf = function( list, elem ) {
609 var i = 0,
610 len = list.length;
611 for ( ; i < len; i++ ) {
612 if ( list[i] === elem ) {
613 return i;
614 }
615 }
616 return -1;
617 },
618
619 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
620
621 // Regular expressions
622
623 // http://www.w3.org/TR/css3-selectors/#whitespace
624 whitespace = "[\\x20\\t\\r\\n\\f]",
625
626 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
627 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
628
629 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
630 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
631 // Operator (capture 2)
632 "*([*^$|!~]?=)" + whitespace +
633 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
634 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
635 "*\\]",
636
637 pseudos = ":(" + identifier + ")(?:\\((" +
638 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
639 // 1. quoted (capture 3; capture 4 or capture 5)
640 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
641 // 2. simple (capture 6)
642 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
643 // 3. anything else (capture 2)
644 ".*" +
645 ")\\)|)",
646
647 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
648 rwhitespace = new RegExp( whitespace + "+", "g" ),
649 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
650
651 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
652 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
653
654 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
655
656 rpseudo = new RegExp( pseudos ),
657 ridentifier = new RegExp( "^" + identifier + "$" ),
658
659 matchExpr = {
660 "ID": new RegExp( "^#(" + identifier + ")" ),
661 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
662 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
663 "ATTR": new RegExp( "^" + attributes ),
664 "PSEUDO": new RegExp( "^" + pseudos ),
665 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
666 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
667 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
668 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
669 // For use in libraries implementing .is()
670 // We use this for POS matching in `select`
671 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
672 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
673 },
674
675 rinputs = /^(?:input|select|textarea|button)$/i,
676 rheader = /^h\d$/i,
677
678 rnative = /^[^{]+\{\s*\[native \w/,
679
680 // Easily-parseable/retrievable ID or TAG or CLASS selectors
681 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
682
683 rsibling = /[+~]/,
684 rescape = /'|\\/g,
685
686 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
687 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
688 funescape = function( _, escaped, escapedWhitespace ) {
689 var high = "0x" + escaped - 0x10000;
690 // NaN means non-codepoint
691 // Support: Firefox<24
692 // Workaround erroneous numeric interpretation of +"0x"
693 return high !== high || escapedWhitespace ?
694 escaped :
695 high < 0 ?
696 // BMP codepoint
697 String.fromCharCode( high + 0x10000 ) :
698 // Supplemental Plane codepoint (surrogate pair)
699 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
700 },
701
702 // Used for iframes
703 // See setDocument()
704 // Removing the function wrapper causes a "Permission Denied"
705 // error in IE
706 unloadHandler = function() {
707 setDocument();
708 };
709
710// Optimize for push.apply( _, NodeList )
711try {
712 push.apply(
713 (arr = slice.call( preferredDoc.childNodes )),
714 preferredDoc.childNodes
715 );
716 // Support: Android<4.0
717 // Detect silently failing push.apply
718 arr[ preferredDoc.childNodes.length ].nodeType;
719} catch ( e ) {
720 push = { apply: arr.length ?
721
722 // Leverage slice if possible
723 function( target, els ) {
724 push_native.apply( target, slice.call(els) );
725 } :
726
727 // Support: IE<9
728 // Otherwise append directly
729 function( target, els ) {
730 var j = target.length,
731 i = 0;
732 // Can't trust NodeList.length
733 while ( (target[j++] = els[i++]) ) {}
734 target.length = j - 1;
735 }
736 };
737}
738
739function Sizzle( selector, context, results, seed ) {
740 var m, i, elem, nid, nidselect, match, groups, newSelector,
741 newContext = context && context.ownerDocument,
742
743 // nodeType defaults to 9, since context defaults to document
744 nodeType = context ? context.nodeType : 9;
745
746 results = results || [];
747
748 // Return early from calls with invalid selector or context
749 if ( typeof selector !== "string" || !selector ||
750 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
751
752 return results;
753 }
754
755 // Try to shortcut find operations (as opposed to filters) in HTML documents
756 if ( !seed ) {
757
758 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
759 setDocument( context );
760 }
761 context = context || document;
762
763 if ( documentIsHTML ) {
764
765 // If the selector is sufficiently simple, try using a "get*By*" DOM method
766 // (excepting DocumentFragment context, where the methods don't exist)
767 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
768
769 // ID selector
770 if ( (m = match[1]) ) {
771
772 // Document context
773 if ( nodeType === 9 ) {
774 if ( (elem = context.getElementById( m )) ) {
775
776 // Support: IE, Opera, Webkit
777 // TODO: identify versions
778 // getElementById can match elements by name instead of ID
779 if ( elem.id === m ) {
780 results.push( elem );
781 return results;
782 }
783 } else {
784 return results;
785 }
786
787 // Element context
788 } else {
789
790 // Support: IE, Opera, Webkit
791 // TODO: identify versions
792 // getElementById can match elements by name instead of ID
793 if ( newContext && (elem = newContext.getElementById( m )) &&
794 contains( context, elem ) &&
795 elem.id === m ) {
796
797 results.push( elem );
798 return results;
799 }
800 }
801
802 // Type selector
803 } else if ( match[2] ) {
804 push.apply( results, context.getElementsByTagName( selector ) );
805 return results;
806
807 // Class selector
808 } else if ( (m = match[3]) && support.getElementsByClassName &&
809 context.getElementsByClassName ) {
810
811 push.apply( results, context.getElementsByClassName( m ) );
812 return results;
813 }
814 }
815
816 // Take advantage of querySelectorAll
817 if ( support.qsa &&
818 !compilerCache[ selector + " " ] &&
819 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
820
821 if ( nodeType !== 1 ) {
822 newContext = context;
823 newSelector = selector;
824
825 // qSA looks outside Element context, which is not what we want
826 // Thanks to Andrew Dupont for this workaround technique
827 // Support: IE <=8
828 // Exclude object elements
829 } else if ( context.nodeName.toLowerCase() !== "object" ) {
830
831 // Capture the context ID, setting it first if necessary
832 if ( (nid = context.getAttribute( "id" )) ) {
833 nid = nid.replace( rescape, "\\$&" );
834 } else {
835 context.setAttribute( "id", (nid = expando) );
836 }
837
838 // Prefix every selector in the list
839 groups = tokenize( selector );
840 i = groups.length;
841 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
842 while ( i-- ) {
843 groups[i] = nidselect + " " + toSelector( groups[i] );
844 }
845 newSelector = groups.join( "," );
846
847 // Expand context for sibling selectors
848 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
849 context;
850 }
851
852 if ( newSelector ) {
853 try {
854 push.apply( results,
855 newContext.querySelectorAll( newSelector )
856 );
857 return results;
858 } catch ( qsaError ) {
859 } finally {
860 if ( nid === expando ) {
861 context.removeAttribute( "id" );
862 }
863 }
864 }
865 }
866 }
867 }
868
869 // All others
870 return select( selector.replace( rtrim, "$1" ), context, results, seed );
871}
872
873/**
874 * Create key-value caches of limited size
875 * @returns {function(string, object)} Returns the Object data after storing it on itself with
876 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
877 * deleting the oldest entry
878 */
879function createCache() {
880 var keys = [];
881
882 function cache( key, value ) {
883 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
884 if ( keys.push( key + " " ) > Expr.cacheLength ) {
885 // Only keep the most recent entries
886 delete cache[ keys.shift() ];
887 }
888 return (cache[ key + " " ] = value);
889 }
890 return cache;
891}
892
893/**
894 * Mark a function for special use by Sizzle
895 * @param {Function} fn The function to mark
896 */
897function markFunction( fn ) {
898 fn[ expando ] = true;
899 return fn;
900}
901
902/**
903 * Support testing using an element
904 * @param {Function} fn Passed the created div and expects a boolean result
905 */
906function assert( fn ) {
907 var div = document.createElement("div");
908
909 try {
910 return !!fn( div );
911 } catch (e) {
912 return false;
913 } finally {
914 // Remove from its parent by default
915 if ( div.parentNode ) {
916 div.parentNode.removeChild( div );
917 }
918 // release memory in IE
919 div = null;
920 }
921}
922
923/**
924 * Adds the same handler for all of the specified attrs
925 * @param {String} attrs Pipe-separated list of attributes
926 * @param {Function} handler The method that will be applied
927 */
928function addHandle( attrs, handler ) {
929 var arr = attrs.split("|"),
930 i = arr.length;
931
932 while ( i-- ) {
933 Expr.attrHandle[ arr[i] ] = handler;
934 }
935}
936
937/**
938 * Checks document order of two siblings
939 * @param {Element} a
940 * @param {Element} b
941 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
942 */
943function siblingCheck( a, b ) {
944 var cur = b && a,
945 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
946 ( ~b.sourceIndex || MAX_NEGATIVE ) -
947 ( ~a.sourceIndex || MAX_NEGATIVE );
948
949 // Use IE sourceIndex if available on both nodes
950 if ( diff ) {
951 return diff;
952 }
953
954 // Check if b follows a
955 if ( cur ) {
956 while ( (cur = cur.nextSibling) ) {
957 if ( cur === b ) {
958 return -1;
959 }
960 }
961 }
962
963 return a ? 1 : -1;
964}
965
966/**
967 * Returns a function to use in pseudos for input types
968 * @param {String} type
969 */
970function createInputPseudo( type ) {
971 return function( elem ) {
972 var name = elem.nodeName.toLowerCase();
973 return name === "input" && elem.type === type;
974 };
975}
976
977/**
978 * Returns a function to use in pseudos for buttons
979 * @param {String} type
980 */
981function createButtonPseudo( type ) {
982 return function( elem ) {
983 var name = elem.nodeName.toLowerCase();
984 return (name === "input" || name === "button") && elem.type === type;
985 };
986}
987
988/**
989 * Returns a function to use in pseudos for positionals
990 * @param {Function} fn
991 */
992function createPositionalPseudo( fn ) {
993 return markFunction(function( argument ) {
994 argument = +argument;
995 return markFunction(function( seed, matches ) {
996 var j,
997 matchIndexes = fn( [], seed.length, argument ),
998 i = matchIndexes.length;
999
1000 // Match elements found at the specified indexes
1001 while ( i-- ) {
1002 if ( seed[ (j = matchIndexes[i]) ] ) {
1003 seed[j] = !(matches[j] = seed[j]);
1004 }
1005 }
1006 });
1007 });
1008}
1009
1010/**
1011 * Checks a node for validity as a Sizzle context
1012 * @param {Element|Object=} context
1013 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1014 */
1015function testContext( context ) {
1016 return context && typeof context.getElementsByTagName !== "undefined" && context;
1017}
1018
1019// Expose support vars for convenience
1020support = Sizzle.support = {};
1021
1022/**
1023 * Detects XML nodes
1024 * @param {Element|Object} elem An element or a document
1025 * @returns {Boolean} True iff elem is a non-HTML XML node
1026 */
1027isXML = Sizzle.isXML = function( elem ) {
1028 // documentElement is verified for cases where it doesn't yet exist
1029 // (such as loading iframes in IE - #4833)
1030 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1031 return documentElement ? documentElement.nodeName !== "HTML" : false;
1032};
1033
1034/**
1035 * Sets document-related variables once based on the current document
1036 * @param {Element|Object} [doc] An element or document object to use to set the document
1037 * @returns {Object} Returns the current document
1038 */
1039setDocument = Sizzle.setDocument = function( node ) {
1040 var hasCompare, parent,
1041 doc = node ? node.ownerDocument || node : preferredDoc;
1042
1043 // Return early if doc is invalid or already selected
1044 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1045 return document;
1046 }
1047
1048 // Update global variables
1049 document = doc;
1050 docElem = document.documentElement;
1051 documentIsHTML = !isXML( document );
1052
1053 // Support: IE 9-11, Edge
1054 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1055 if ( (parent = document.defaultView) && parent.top !== parent ) {
1056 // Support: IE 11
1057 if ( parent.addEventListener ) {
1058 parent.addEventListener( "unload", unloadHandler, false );
1059
1060 // Support: IE 9 - 10 only
1061 } else if ( parent.attachEvent ) {
1062 parent.attachEvent( "onunload", unloadHandler );
1063 }
1064 }
1065
1066 /* Attributes
1067 ---------------------------------------------------------------------- */
1068
1069 // Support: IE<8
1070 // Verify that getAttribute really returns attributes and not properties
1071 // (excepting IE8 booleans)
1072 support.attributes = assert(function( div ) {
1073 div.className = "i";
1074 return !div.getAttribute("className");
1075 });
1076
1077 /* getElement(s)By*
1078 ---------------------------------------------------------------------- */
1079
1080 // Check if getElementsByTagName("*") returns only elements
1081 support.getElementsByTagName = assert(function( div ) {
1082 div.appendChild( document.createComment("") );
1083 return !div.getElementsByTagName("*").length;
1084 });
1085
1086 // Support: IE<9
1087 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1088
1089 // Support: IE<10
1090 // Check if getElementById returns elements by name
1091 // The broken getElementById methods don't pick up programatically-set names,
1092 // so use a roundabout getElementsByName test
1093 support.getById = assert(function( div ) {
1094 docElem.appendChild( div ).id = expando;
1095 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1096 });
1097
1098 // ID find and filter
1099 if ( support.getById ) {
1100 Expr.find["ID"] = function( id, context ) {
1101 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1102 var m = context.getElementById( id );
1103 return m ? [ m ] : [];
1104 }
1105 };
1106 Expr.filter["ID"] = function( id ) {
1107 var attrId = id.replace( runescape, funescape );
1108 return function( elem ) {
1109 return elem.getAttribute("id") === attrId;
1110 };
1111 };
1112 } else {
1113 // Support: IE6/7
1114 // getElementById is not reliable as a find shortcut
1115 delete Expr.find["ID"];
1116
1117 Expr.filter["ID"] = function( id ) {
1118 var attrId = id.replace( runescape, funescape );
1119 return function( elem ) {
1120 var node = typeof elem.getAttributeNode !== "undefined" &&
1121 elem.getAttributeNode("id");
1122 return node && node.value === attrId;
1123 };
1124 };
1125 }
1126
1127 // Tag
1128 Expr.find["TAG"] = support.getElementsByTagName ?
1129 function( tag, context ) {
1130 if ( typeof context.getElementsByTagName !== "undefined" ) {
1131 return context.getElementsByTagName( tag );
1132
1133 // DocumentFragment nodes don't have gEBTN
1134 } else if ( support.qsa ) {
1135 return context.querySelectorAll( tag );
1136 }
1137 } :
1138
1139 function( tag, context ) {
1140 var elem,
1141 tmp = [],
1142 i = 0,
1143 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1144 results = context.getElementsByTagName( tag );
1145
1146 // Filter out possible comments
1147 if ( tag === "*" ) {
1148 while ( (elem = results[i++]) ) {
1149 if ( elem.nodeType === 1 ) {
1150 tmp.push( elem );
1151 }
1152 }
1153
1154 return tmp;
1155 }
1156 return results;
1157 };
1158
1159 // Class
1160 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1161 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1162 return context.getElementsByClassName( className );
1163 }
1164 };
1165
1166 /* QSA/matchesSelector
1167 ---------------------------------------------------------------------- */
1168
1169 // QSA and matchesSelector support
1170
1171 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1172 rbuggyMatches = [];
1173
1174 // qSa(:focus) reports false when true (Chrome 21)
1175 // We allow this because of a bug in IE8/9 that throws an error
1176 // whenever `document.activeElement` is accessed on an iframe
1177 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1178 // See http://bugs.jquery.com/ticket/13378
1179 rbuggyQSA = [];
1180
1181 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1182 // Build QSA regex
1183 // Regex strategy adopted from Diego Perini
1184 assert(function( div ) {
1185 // Select is set to empty string on purpose
1186 // This is to test IE's treatment of not explicitly
1187 // setting a boolean content attribute,
1188 // since its presence should be enough
1189 // http://bugs.jquery.com/ticket/12359
1190 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
1191 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1192 "<option selected=''></option></select>";
1193
1194 // Support: IE8, Opera 11-12.16
1195 // Nothing should be selected when empty strings follow ^= or $= or *=
1196 // The test attribute must be unknown in Opera but "safe" for WinRT
1197 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1198 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
1199 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1200 }
1201
1202 // Support: IE8
1203 // Boolean attributes and "value" are not treated correctly
1204 if ( !div.querySelectorAll("[selected]").length ) {
1205 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1206 }
1207
1208 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1209 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1210 rbuggyQSA.push("~=");
1211 }
1212
1213 // Webkit/Opera - :checked should return selected option elements
1214 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1215 // IE8 throws error here and will not see later tests
1216 if ( !div.querySelectorAll(":checked").length ) {
1217 rbuggyQSA.push(":checked");
1218 }
1219
1220 // Support: Safari 8+, iOS 8+
1221 // https://bugs.webkit.org/show_bug.cgi?id=136851
1222 // In-page `selector#id sibing-combinator selector` fails
1223 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
1224 rbuggyQSA.push(".#.+[+~]");
1225 }
1226 });
1227
1228 assert(function( div ) {
1229 // Support: Windows 8 Native Apps
1230 // The type and name attributes are restricted during .innerHTML assignment
1231 var input = document.createElement("input");
1232 input.setAttribute( "type", "hidden" );
1233 div.appendChild( input ).setAttribute( "name", "D" );
1234
1235 // Support: IE8
1236 // Enforce case-sensitivity of name attribute
1237 if ( div.querySelectorAll("[name=d]").length ) {
1238 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1239 }
1240
1241 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1242 // IE8 throws error here and will not see later tests
1243 if ( !div.querySelectorAll(":enabled").length ) {
1244 rbuggyQSA.push( ":enabled", ":disabled" );
1245 }
1246
1247 // Opera 10-11 does not throw on post-comma invalid pseudos
1248 div.querySelectorAll("*,:x");
1249 rbuggyQSA.push(",.*:");
1250 });
1251 }
1252
1253 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1254 docElem.webkitMatchesSelector ||
1255 docElem.mozMatchesSelector ||
1256 docElem.oMatchesSelector ||
1257 docElem.msMatchesSelector) )) ) {
1258
1259 assert(function( div ) {
1260 // Check to see if it's possible to do matchesSelector
1261 // on a disconnected node (IE 9)
1262 support.disconnectedMatch = matches.call( div, "div" );
1263
1264 // This should fail with an exception
1265 // Gecko does not error, returns false instead
1266 matches.call( div, "[s!='']:x" );
1267 rbuggyMatches.push( "!=", pseudos );
1268 });
1269 }
1270
1271 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1272 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1273
1274 /* Contains
1275 ---------------------------------------------------------------------- */
1276 hasCompare = rnative.test( docElem.compareDocumentPosition );
1277
1278 // Element contains another
1279 // Purposefully self-exclusive
1280 // As in, an element does not contain itself
1281 contains = hasCompare || rnative.test( docElem.contains ) ?
1282 function( a, b ) {
1283 var adown = a.nodeType === 9 ? a.documentElement : a,
1284 bup = b && b.parentNode;
1285 return a === bup || !!( bup && bup.nodeType === 1 && (
1286 adown.contains ?
1287 adown.contains( bup ) :
1288 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1289 ));
1290 } :
1291 function( a, b ) {
1292 if ( b ) {
1293 while ( (b = b.parentNode) ) {
1294 if ( b === a ) {
1295 return true;
1296 }
1297 }
1298 }
1299 return false;
1300 };
1301
1302 /* Sorting
1303 ---------------------------------------------------------------------- */
1304
1305 // Document order sorting
1306 sortOrder = hasCompare ?
1307 function( a, b ) {
1308
1309 // Flag for duplicate removal
1310 if ( a === b ) {
1311 hasDuplicate = true;
1312 return 0;
1313 }
1314
1315 // Sort on method existence if only one input has compareDocumentPosition
1316 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1317 if ( compare ) {
1318 return compare;
1319 }
1320
1321 // Calculate position if both inputs belong to the same document
1322 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1323 a.compareDocumentPosition( b ) :
1324
1325 // Otherwise we know they are disconnected
1326 1;
1327
1328 // Disconnected nodes
1329 if ( compare & 1 ||
1330 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1331
1332 // Choose the first element that is related to our preferred document
1333 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1334 return -1;
1335 }
1336 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1337 return 1;
1338 }
1339
1340 // Maintain original order
1341 return sortInput ?
1342 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1343 0;
1344 }
1345
1346 return compare & 4 ? -1 : 1;
1347 } :
1348 function( a, b ) {
1349 // Exit early if the nodes are identical
1350 if ( a === b ) {
1351 hasDuplicate = true;
1352 return 0;
1353 }
1354
1355 var cur,
1356 i = 0,
1357 aup = a.parentNode,
1358 bup = b.parentNode,
1359 ap = [ a ],
1360 bp = [ b ];
1361
1362 // Parentless nodes are either documents or disconnected
1363 if ( !aup || !bup ) {
1364 return a === document ? -1 :
1365 b === document ? 1 :
1366 aup ? -1 :
1367 bup ? 1 :
1368 sortInput ?
1369 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1370 0;
1371
1372 // If the nodes are siblings, we can do a quick check
1373 } else if ( aup === bup ) {
1374 return siblingCheck( a, b );
1375 }
1376
1377 // Otherwise we need full lists of their ancestors for comparison
1378 cur = a;
1379 while ( (cur = cur.parentNode) ) {
1380 ap.unshift( cur );
1381 }
1382 cur = b;
1383 while ( (cur = cur.parentNode) ) {
1384 bp.unshift( cur );
1385 }
1386
1387 // Walk down the tree looking for a discrepancy
1388 while ( ap[i] === bp[i] ) {
1389 i++;
1390 }
1391
1392 return i ?
1393 // Do a sibling check if the nodes have a common ancestor
1394 siblingCheck( ap[i], bp[i] ) :
1395
1396 // Otherwise nodes in our document sort first
1397 ap[i] === preferredDoc ? -1 :
1398 bp[i] === preferredDoc ? 1 :
1399 0;
1400 };
1401
1402 return document;
1403};
1404
1405Sizzle.matches = function( expr, elements ) {
1406 return Sizzle( expr, null, null, elements );
1407};
1408
1409Sizzle.matchesSelector = function( elem, expr ) {
1410 // Set document vars if needed
1411 if ( ( elem.ownerDocument || elem ) !== document ) {
1412 setDocument( elem );
1413 }
1414
1415 // Make sure that attribute selectors are quoted
1416 expr = expr.replace( rattributeQuotes, "='$1']" );
1417
1418 if ( support.matchesSelector && documentIsHTML &&
1419 !compilerCache[ expr + " " ] &&
1420 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1421 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1422
1423 try {
1424 var ret = matches.call( elem, expr );
1425
1426 // IE 9's matchesSelector returns false on disconnected nodes
1427 if ( ret || support.disconnectedMatch ||
1428 // As well, disconnected nodes are said to be in a document
1429 // fragment in IE 9
1430 elem.document && elem.document.nodeType !== 11 ) {
1431 return ret;
1432 }
1433 } catch (e) {}
1434 }
1435
1436 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1437};
1438
1439Sizzle.contains = function( context, elem ) {
1440 // Set document vars if needed
1441 if ( ( context.ownerDocument || context ) !== document ) {
1442 setDocument( context );
1443 }
1444 return contains( context, elem );
1445};
1446
1447Sizzle.attr = function( elem, name ) {
1448 // Set document vars if needed
1449 if ( ( elem.ownerDocument || elem ) !== document ) {
1450 setDocument( elem );
1451 }
1452
1453 var fn = Expr.attrHandle[ name.toLowerCase() ],
1454 // Don't get fooled by Object.prototype properties (jQuery #13807)
1455 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1456 fn( elem, name, !documentIsHTML ) :
1457 undefined;
1458
1459 return val !== undefined ?
1460 val :
1461 support.attributes || !documentIsHTML ?
1462 elem.getAttribute( name ) :
1463 (val = elem.getAttributeNode(name)) && val.specified ?
1464 val.value :
1465 null;
1466};
1467
1468Sizzle.error = function( msg ) {
1469 throw new Error( "Syntax error, unrecognized expression: " + msg );
1470};
1471
1472/**
1473 * Document sorting and removing duplicates
1474 * @param {ArrayLike} results
1475 */
1476Sizzle.uniqueSort = function( results ) {
1477 var elem,
1478 duplicates = [],
1479 j = 0,
1480 i = 0;
1481
1482 // Unless we *know* we can detect duplicates, assume their presence
1483 hasDuplicate = !support.detectDuplicates;
1484 sortInput = !support.sortStable && results.slice( 0 );
1485 results.sort( sortOrder );
1486
1487 if ( hasDuplicate ) {
1488 while ( (elem = results[i++]) ) {
1489 if ( elem === results[ i ] ) {
1490 j = duplicates.push( i );
1491 }
1492 }
1493 while ( j-- ) {
1494 results.splice( duplicates[ j ], 1 );
1495 }
1496 }
1497
1498 // Clear input after sorting to release objects
1499 // See https://github.com/jquery/sizzle/pull/225
1500 sortInput = null;
1501
1502 return results;
1503};
1504
1505/**
1506 * Utility function for retrieving the text value of an array of DOM nodes
1507 * @param {Array|Element} elem
1508 */
1509getText = Sizzle.getText = function( elem ) {
1510 var node,
1511 ret = "",
1512 i = 0,
1513 nodeType = elem.nodeType;
1514
1515 if ( !nodeType ) {
1516 // If no nodeType, this is expected to be an array
1517 while ( (node = elem[i++]) ) {
1518 // Do not traverse comment nodes
1519 ret += getText( node );
1520 }
1521 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1522 // Use textContent for elements
1523 // innerText usage removed for consistency of new lines (jQuery #11153)
1524 if ( typeof elem.textContent === "string" ) {
1525 return elem.textContent;
1526 } else {
1527 // Traverse its children
1528 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1529 ret += getText( elem );
1530 }
1531 }
1532 } else if ( nodeType === 3 || nodeType === 4 ) {
1533 return elem.nodeValue;
1534 }
1535 // Do not include comment or processing instruction nodes
1536
1537 return ret;
1538};
1539
1540Expr = Sizzle.selectors = {
1541
1542 // Can be adjusted by the user
1543 cacheLength: 50,
1544
1545 createPseudo: markFunction,
1546
1547 match: matchExpr,
1548
1549 attrHandle: {},
1550
1551 find: {},
1552
1553 relative: {
1554 ">": { dir: "parentNode", first: true },
1555 " ": { dir: "parentNode" },
1556 "+": { dir: "previousSibling", first: true },
1557 "~": { dir: "previousSibling" }
1558 },
1559
1560 preFilter: {
1561 "ATTR": function( match ) {
1562 match[1] = match[1].replace( runescape, funescape );
1563
1564 // Move the given value to match[3] whether quoted or unquoted
1565 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1566
1567 if ( match[2] === "~=" ) {
1568 match[3] = " " + match[3] + " ";
1569 }
1570
1571 return match.slice( 0, 4 );
1572 },
1573
1574 "CHILD": function( match ) {
1575 /* matches from matchExpr["CHILD"]
1576 1 type (only|nth|...)
1577 2 what (child|of-type)
1578 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1579 4 xn-component of xn+y argument ([+-]?\d*n|)
1580 5 sign of xn-component
1581 6 x of xn-component
1582 7 sign of y-component
1583 8 y of y-component
1584 */
1585 match[1] = match[1].toLowerCase();
1586
1587 if ( match[1].slice( 0, 3 ) === "nth" ) {
1588 // nth-* requires argument
1589 if ( !match[3] ) {
1590 Sizzle.error( match[0] );
1591 }
1592
1593 // numeric x and y parameters for Expr.filter.CHILD
1594 // remember that false/true cast respectively to 0/1
1595 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1596 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1597
1598 // other types prohibit arguments
1599 } else if ( match[3] ) {
1600 Sizzle.error( match[0] );
1601 }
1602
1603 return match;
1604 },
1605
1606 "PSEUDO": function( match ) {
1607 var excess,
1608 unquoted = !match[6] && match[2];
1609
1610 if ( matchExpr["CHILD"].test( match[0] ) ) {
1611 return null;
1612 }
1613
1614 // Accept quoted arguments as-is
1615 if ( match[3] ) {
1616 match[2] = match[4] || match[5] || "";
1617
1618 // Strip excess characters from unquoted arguments
1619 } else if ( unquoted && rpseudo.test( unquoted ) &&
1620 // Get excess from tokenize (recursively)
1621 (excess = tokenize( unquoted, true )) &&
1622 // advance to the next closing parenthesis
1623 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1624
1625 // excess is a negative index
1626 match[0] = match[0].slice( 0, excess );
1627 match[2] = unquoted.slice( 0, excess );
1628 }
1629
1630 // Return only captures needed by the pseudo filter method (type and argument)
1631 return match.slice( 0, 3 );
1632 }
1633 },
1634
1635 filter: {
1636
1637 "TAG": function( nodeNameSelector ) {
1638 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1639 return nodeNameSelector === "*" ?
1640 function() { return true; } :
1641 function( elem ) {
1642 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1643 };
1644 },
1645
1646 "CLASS": function( className ) {
1647 var pattern = classCache[ className + " " ];
1648
1649 return pattern ||
1650 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1651 classCache( className, function( elem ) {
1652 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1653 });
1654 },
1655
1656 "ATTR": function( name, operator, check ) {
1657 return function( elem ) {
1658 var result = Sizzle.attr( elem, name );
1659
1660 if ( result == null ) {
1661 return operator === "!=";
1662 }
1663 if ( !operator ) {
1664 return true;
1665 }
1666
1667 result += "";
1668
1669 return operator === "=" ? result === check :
1670 operator === "!=" ? result !== check :
1671 operator === "^=" ? check && result.indexOf( check ) === 0 :
1672 operator === "*=" ? check && result.indexOf( check ) > -1 :
1673 operator === "$=" ? check && result.slice( -check.length ) === check :
1674 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1675 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1676 false;
1677 };
1678 },
1679
1680 "CHILD": function( type, what, argument, first, last ) {
1681 var simple = type.slice( 0, 3 ) !== "nth",
1682 forward = type.slice( -4 ) !== "last",
1683 ofType = what === "of-type";
1684
1685 return first === 1 && last === 0 ?
1686
1687 // Shortcut for :nth-*(n)
1688 function( elem ) {
1689 return !!elem.parentNode;
1690 } :
1691
1692 function( elem, context, xml ) {
1693 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1694 dir = simple !== forward ? "nextSibling" : "previousSibling",
1695 parent = elem.parentNode,
1696 name = ofType && elem.nodeName.toLowerCase(),
1697 useCache = !xml && !ofType,
1698 diff = false;
1699
1700 if ( parent ) {
1701
1702 // :(first|last|only)-(child|of-type)
1703 if ( simple ) {
1704 while ( dir ) {
1705 node = elem;
1706 while ( (node = node[ dir ]) ) {
1707 if ( ofType ?
1708 node.nodeName.toLowerCase() === name :
1709 node.nodeType === 1 ) {
1710
1711 return false;
1712 }
1713 }
1714 // Reverse direction for :only-* (if we haven't yet done so)
1715 start = dir = type === "only" && !start && "nextSibling";
1716 }
1717 return true;
1718 }
1719
1720 start = [ forward ? parent.firstChild : parent.lastChild ];
1721
1722 // non-xml :nth-child(...) stores cache data on `parent`
1723 if ( forward && useCache ) {
1724
1725 // Seek `elem` from a previously-cached index
1726
1727 // ...in a gzip-friendly way
1728 node = parent;
1729 outerCache = node[ expando ] || (node[ expando ] = {});
1730
1731 // Support: IE <9 only
1732 // Defend against cloned attroperties (jQuery gh-1709)
1733 uniqueCache = outerCache[ node.uniqueID ] ||
1734 (outerCache[ node.uniqueID ] = {});
1735
1736 cache = uniqueCache[ type ] || [];
1737 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1738 diff = nodeIndex && cache[ 2 ];
1739 node = nodeIndex && parent.childNodes[ nodeIndex ];
1740
1741 while ( (node = ++nodeIndex && node && node[ dir ] ||
1742
1743 // Fallback to seeking `elem` from the start
1744 (diff = nodeIndex = 0) || start.pop()) ) {
1745
1746 // When found, cache indexes on `parent` and break
1747 if ( node.nodeType === 1 && ++diff && node === elem ) {
1748 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1749 break;
1750 }
1751 }
1752
1753 } else {
1754 // Use previously-cached element index if available
1755 if ( useCache ) {
1756 // ...in a gzip-friendly way
1757 node = elem;
1758 outerCache = node[ expando ] || (node[ expando ] = {});
1759
1760 // Support: IE <9 only
1761 // Defend against cloned attroperties (jQuery gh-1709)
1762 uniqueCache = outerCache[ node.uniqueID ] ||
1763 (outerCache[ node.uniqueID ] = {});
1764
1765 cache = uniqueCache[ type ] || [];
1766 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1767 diff = nodeIndex;
1768 }
1769
1770 // xml :nth-child(...)
1771 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1772 if ( diff === false ) {
1773 // Use the same loop as above to seek `elem` from the start
1774 while ( (node = ++nodeIndex && node && node[ dir ] ||
1775 (diff = nodeIndex = 0) || start.pop()) ) {
1776
1777 if ( ( ofType ?
1778 node.nodeName.toLowerCase() === name :
1779 node.nodeType === 1 ) &&
1780 ++diff ) {
1781
1782 // Cache the index of each encountered element
1783 if ( useCache ) {
1784 outerCache = node[ expando ] || (node[ expando ] = {});
1785
1786 // Support: IE <9 only
1787 // Defend against cloned attroperties (jQuery gh-1709)
1788 uniqueCache = outerCache[ node.uniqueID ] ||
1789 (outerCache[ node.uniqueID ] = {});
1790
1791 uniqueCache[ type ] = [ dirruns, diff ];
1792 }
1793
1794 if ( node === elem ) {
1795 break;
1796 }
1797 }
1798 }
1799 }
1800 }
1801
1802 // Incorporate the offset, then check against cycle size
1803 diff -= last;
1804 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1805 }
1806 };
1807 },
1808
1809 "PSEUDO": function( pseudo, argument ) {
1810 // pseudo-class names are case-insensitive
1811 // http://www.w3.org/TR/selectors/#pseudo-classes
1812 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1813 // Remember that setFilters inherits from pseudos
1814 var args,
1815 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1816 Sizzle.error( "unsupported pseudo: " + pseudo );
1817
1818 // The user may use createPseudo to indicate that
1819 // arguments are needed to create the filter function
1820 // just as Sizzle does
1821 if ( fn[ expando ] ) {
1822 return fn( argument );
1823 }
1824
1825 // But maintain support for old signatures
1826 if ( fn.length > 1 ) {
1827 args = [ pseudo, pseudo, "", argument ];
1828 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1829 markFunction(function( seed, matches ) {
1830 var idx,
1831 matched = fn( seed, argument ),
1832 i = matched.length;
1833 while ( i-- ) {
1834 idx = indexOf( seed, matched[i] );
1835 seed[ idx ] = !( matches[ idx ] = matched[i] );
1836 }
1837 }) :
1838 function( elem ) {
1839 return fn( elem, 0, args );
1840 };
1841 }
1842
1843 return fn;
1844 }
1845 },
1846
1847 pseudos: {
1848 // Potentially complex pseudos
1849 "not": markFunction(function( selector ) {
1850 // Trim the selector passed to compile
1851 // to avoid treating leading and trailing
1852 // spaces as combinators
1853 var input = [],
1854 results = [],
1855 matcher = compile( selector.replace( rtrim, "$1" ) );
1856
1857 return matcher[ expando ] ?
1858 markFunction(function( seed, matches, context, xml ) {
1859 var elem,
1860 unmatched = matcher( seed, null, xml, [] ),
1861 i = seed.length;
1862
1863 // Match elements unmatched by `matcher`
1864 while ( i-- ) {
1865 if ( (elem = unmatched[i]) ) {
1866 seed[i] = !(matches[i] = elem);
1867 }
1868 }
1869 }) :
1870 function( elem, context, xml ) {
1871 input[0] = elem;
1872 matcher( input, null, xml, results );
1873 // Don't keep the element (issue #299)
1874 input[0] = null;
1875 return !results.pop();
1876 };
1877 }),
1878
1879 "has": markFunction(function( selector ) {
1880 return function( elem ) {
1881 return Sizzle( selector, elem ).length > 0;
1882 };
1883 }),
1884
1885 "contains": markFunction(function( text ) {
1886 text = text.replace( runescape, funescape );
1887 return function( elem ) {
1888 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1889 };
1890 }),
1891
1892 // "Whether an element is represented by a :lang() selector
1893 // is based solely on the element's language value
1894 // being equal to the identifier C,
1895 // or beginning with the identifier C immediately followed by "-".
1896 // The matching of C against the element's language value is performed case-insensitively.
1897 // The identifier C does not have to be a valid language name."
1898 // http://www.w3.org/TR/selectors/#lang-pseudo
1899 "lang": markFunction( function( lang ) {
1900 // lang value must be a valid identifier
1901 if ( !ridentifier.test(lang || "") ) {
1902 Sizzle.error( "unsupported lang: " + lang );
1903 }
1904 lang = lang.replace( runescape, funescape ).toLowerCase();
1905 return function( elem ) {
1906 var elemLang;
1907 do {
1908 if ( (elemLang = documentIsHTML ?
1909 elem.lang :
1910 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1911
1912 elemLang = elemLang.toLowerCase();
1913 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1914 }
1915 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1916 return false;
1917 };
1918 }),
1919
1920 // Miscellaneous
1921 "target": function( elem ) {
1922 var hash = window.location && window.location.hash;
1923 return hash && hash.slice( 1 ) === elem.id;
1924 },
1925
1926 "root": function( elem ) {
1927 return elem === docElem;
1928 },
1929
1930 "focus": function( elem ) {
1931 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1932 },
1933
1934 // Boolean properties
1935 "enabled": function( elem ) {
1936 return elem.disabled === false;
1937 },
1938
1939 "disabled": function( elem ) {
1940 return elem.disabled === true;
1941 },
1942
1943 "checked": function( elem ) {
1944 // In CSS3, :checked should return both checked and selected elements
1945 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1946 var nodeName = elem.nodeName.toLowerCase();
1947 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1948 },
1949
1950 "selected": function( elem ) {
1951 // Accessing this property makes selected-by-default
1952 // options in Safari work properly
1953 if ( elem.parentNode ) {
1954 elem.parentNode.selectedIndex;
1955 }
1956
1957 return elem.selected === true;
1958 },
1959
1960 // Contents
1961 "empty": function( elem ) {
1962 // http://www.w3.org/TR/selectors/#empty-pseudo
1963 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1964 // but not by others (comment: 8; processing instruction: 7; etc.)
1965 // nodeType < 6 works because attributes (2) do not appear as children
1966 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1967 if ( elem.nodeType < 6 ) {
1968 return false;
1969 }
1970 }
1971 return true;
1972 },
1973
1974 "parent": function( elem ) {
1975 return !Expr.pseudos["empty"]( elem );
1976 },
1977
1978 // Element/input types
1979 "header": function( elem ) {
1980 return rheader.test( elem.nodeName );
1981 },
1982
1983 "input": function( elem ) {
1984 return rinputs.test( elem.nodeName );
1985 },
1986
1987 "button": function( elem ) {
1988 var name = elem.nodeName.toLowerCase();
1989 return name === "input" && elem.type === "button" || name === "button";
1990 },
1991
1992 "text": function( elem ) {
1993 var attr;
1994 return elem.nodeName.toLowerCase() === "input" &&
1995 elem.type === "text" &&
1996
1997 // Support: IE<8
1998 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1999 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2000 },
2001
2002 // Position-in-collection
2003 "first": createPositionalPseudo(function() {
2004 return [ 0 ];
2005 }),
2006
2007 "last": createPositionalPseudo(function( matchIndexes, length ) {
2008 return [ length - 1 ];
2009 }),
2010
2011 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2012 return [ argument < 0 ? argument + length : argument ];
2013 }),
2014
2015 "even": createPositionalPseudo(function( matchIndexes, length ) {
2016 var i = 0;
2017 for ( ; i < length; i += 2 ) {
2018 matchIndexes.push( i );
2019 }
2020 return matchIndexes;
2021 }),
2022
2023 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2024 var i = 1;
2025 for ( ; i < length; i += 2 ) {
2026 matchIndexes.push( i );
2027 }
2028 return matchIndexes;
2029 }),
2030
2031 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2032 var i = argument < 0 ? argument + length : argument;
2033 for ( ; --i >= 0; ) {
2034 matchIndexes.push( i );
2035 }
2036 return matchIndexes;
2037 }),
2038
2039 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2040 var i = argument < 0 ? argument + length : argument;
2041 for ( ; ++i < length; ) {
2042 matchIndexes.push( i );
2043 }
2044 return matchIndexes;
2045 })
2046 }
2047};
2048
2049Expr.pseudos["nth"] = Expr.pseudos["eq"];
2050
2051// Add button/input type pseudos
2052for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2053 Expr.pseudos[ i ] = createInputPseudo( i );
2054}
2055for ( i in { submit: true, reset: true } ) {
2056 Expr.pseudos[ i ] = createButtonPseudo( i );
2057}
2058
2059// Easy API for creating new setFilters
2060function setFilters() {}
2061setFilters.prototype = Expr.filters = Expr.pseudos;
2062Expr.setFilters = new setFilters();
2063
2064tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2065 var matched, match, tokens, type,
2066 soFar, groups, preFilters,
2067 cached = tokenCache[ selector + " " ];
2068
2069 if ( cached ) {
2070 return parseOnly ? 0 : cached.slice( 0 );
2071 }
2072
2073 soFar = selector;
2074 groups = [];
2075 preFilters = Expr.preFilter;
2076
2077 while ( soFar ) {
2078
2079 // Comma and first run
2080 if ( !matched || (match = rcomma.exec( soFar )) ) {
2081 if ( match ) {
2082 // Don't consume trailing commas as valid
2083 soFar = soFar.slice( match[0].length ) || soFar;
2084 }
2085 groups.push( (tokens = []) );
2086 }
2087
2088 matched = false;
2089
2090 // Combinators
2091 if ( (match = rcombinators.exec( soFar )) ) {
2092 matched = match.shift();
2093 tokens.push({
2094 value: matched,
2095 // Cast descendant combinators to space
2096 type: match[0].replace( rtrim, " " )
2097 });
2098 soFar = soFar.slice( matched.length );
2099 }
2100
2101 // Filters
2102 for ( type in Expr.filter ) {
2103 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2104 (match = preFilters[ type ]( match ))) ) {
2105 matched = match.shift();
2106 tokens.push({
2107 value: matched,
2108 type: type,
2109 matches: match
2110 });
2111 soFar = soFar.slice( matched.length );
2112 }
2113 }
2114
2115 if ( !matched ) {
2116 break;
2117 }
2118 }
2119
2120 // Return the length of the invalid excess
2121 // if we're just parsing
2122 // Otherwise, throw an error or return tokens
2123 return parseOnly ?
2124 soFar.length :
2125 soFar ?
2126 Sizzle.error( selector ) :
2127 // Cache the tokens
2128 tokenCache( selector, groups ).slice( 0 );
2129};
2130
2131function toSelector( tokens ) {
2132 var i = 0,
2133 len = tokens.length,
2134 selector = "";
2135 for ( ; i < len; i++ ) {
2136 selector += tokens[i].value;
2137 }
2138 return selector;
2139}
2140
2141function addCombinator( matcher, combinator, base ) {
2142 var dir = combinator.dir,
2143 checkNonElements = base && dir === "parentNode",
2144 doneName = done++;
2145
2146 return combinator.first ?
2147 // Check against closest ancestor/preceding element
2148 function( elem, context, xml ) {
2149 while ( (elem = elem[ dir ]) ) {
2150 if ( elem.nodeType === 1 || checkNonElements ) {
2151 return matcher( elem, context, xml );
2152 }
2153 }
2154 } :
2155
2156 // Check against all ancestor/preceding elements
2157 function( elem, context, xml ) {
2158 var oldCache, uniqueCache, outerCache,
2159 newCache = [ dirruns, doneName ];
2160
2161 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2162 if ( xml ) {
2163 while ( (elem = elem[ dir ]) ) {
2164 if ( elem.nodeType === 1 || checkNonElements ) {
2165 if ( matcher( elem, context, xml ) ) {
2166 return true;
2167 }
2168 }
2169 }
2170 } else {
2171 while ( (elem = elem[ dir ]) ) {
2172 if ( elem.nodeType === 1 || checkNonElements ) {
2173 outerCache = elem[ expando ] || (elem[ expando ] = {});
2174
2175 // Support: IE <9 only
2176 // Defend against cloned attroperties (jQuery gh-1709)
2177 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2178
2179 if ( (oldCache = uniqueCache[ dir ]) &&
2180 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2181
2182 // Assign to newCache so results back-propagate to previous elements
2183 return (newCache[ 2 ] = oldCache[ 2 ]);
2184 } else {
2185 // Reuse newcache so results back-propagate to previous elements
2186 uniqueCache[ dir ] = newCache;
2187
2188 // A match means we're done; a fail means we have to keep checking
2189 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2190 return true;
2191 }
2192 }
2193 }
2194 }
2195 }
2196 };
2197}
2198
2199function elementMatcher( matchers ) {
2200 return matchers.length > 1 ?
2201 function( elem, context, xml ) {
2202 var i = matchers.length;
2203 while ( i-- ) {
2204 if ( !matchers[i]( elem, context, xml ) ) {
2205 return false;
2206 }
2207 }
2208 return true;
2209 } :
2210 matchers[0];
2211}
2212
2213function multipleContexts( selector, contexts, results ) {
2214 var i = 0,
2215 len = contexts.length;
2216 for ( ; i < len; i++ ) {
2217 Sizzle( selector, contexts[i], results );
2218 }
2219 return results;
2220}
2221
2222function condense( unmatched, map, filter, context, xml ) {
2223 var elem,
2224 newUnmatched = [],
2225 i = 0,
2226 len = unmatched.length,
2227 mapped = map != null;
2228
2229 for ( ; i < len; i++ ) {
2230 if ( (elem = unmatched[i]) ) {
2231 if ( !filter || filter( elem, context, xml ) ) {
2232 newUnmatched.push( elem );
2233 if ( mapped ) {
2234 map.push( i );
2235 }
2236 }
2237 }
2238 }
2239
2240 return newUnmatched;
2241}
2242
2243function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2244 if ( postFilter && !postFilter[ expando ] ) {
2245 postFilter = setMatcher( postFilter );
2246 }
2247 if ( postFinder && !postFinder[ expando ] ) {
2248 postFinder = setMatcher( postFinder, postSelector );
2249 }
2250 return markFunction(function( seed, results, context, xml ) {
2251 var temp, i, elem,
2252 preMap = [],
2253 postMap = [],
2254 preexisting = results.length,
2255
2256 // Get initial elements from seed or context
2257 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2258
2259 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2260 matcherIn = preFilter && ( seed || !selector ) ?
2261 condense( elems, preMap, preFilter, context, xml ) :
2262 elems,
2263
2264 matcherOut = matcher ?
2265 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2266 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2267
2268 // ...intermediate processing is necessary
2269 [] :
2270
2271 // ...otherwise use results directly
2272 results :
2273 matcherIn;
2274
2275 // Find primary matches
2276 if ( matcher ) {
2277 matcher( matcherIn, matcherOut, context, xml );
2278 }
2279
2280 // Apply postFilter
2281 if ( postFilter ) {
2282 temp = condense( matcherOut, postMap );
2283 postFilter( temp, [], context, xml );
2284
2285 // Un-match failing elements by moving them back to matcherIn
2286 i = temp.length;
2287 while ( i-- ) {
2288 if ( (elem = temp[i]) ) {
2289 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2290 }
2291 }
2292 }
2293
2294 if ( seed ) {
2295 if ( postFinder || preFilter ) {
2296 if ( postFinder ) {
2297 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2298 temp = [];
2299 i = matcherOut.length;
2300 while ( i-- ) {
2301 if ( (elem = matcherOut[i]) ) {
2302 // Restore matcherIn since elem is not yet a final match
2303 temp.push( (matcherIn[i] = elem) );
2304 }
2305 }
2306 postFinder( null, (matcherOut = []), temp, xml );
2307 }
2308
2309 // Move matched elements from seed to results to keep them synchronized
2310 i = matcherOut.length;
2311 while ( i-- ) {
2312 if ( (elem = matcherOut[i]) &&
2313 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2314
2315 seed[temp] = !(results[temp] = elem);
2316 }
2317 }
2318 }
2319
2320 // Add elements to results, through postFinder if defined
2321 } else {
2322 matcherOut = condense(
2323 matcherOut === results ?
2324 matcherOut.splice( preexisting, matcherOut.length ) :
2325 matcherOut
2326 );
2327 if ( postFinder ) {
2328 postFinder( null, results, matcherOut, xml );
2329 } else {
2330 push.apply( results, matcherOut );
2331 }
2332 }
2333 });
2334}
2335
2336function matcherFromTokens( tokens ) {
2337 var checkContext, matcher, j,
2338 len = tokens.length,
2339 leadingRelative = Expr.relative[ tokens[0].type ],
2340 implicitRelative = leadingRelative || Expr.relative[" "],
2341 i = leadingRelative ? 1 : 0,
2342
2343 // The foundational matcher ensures that elements are reachable from top-level context(s)
2344 matchContext = addCombinator( function( elem ) {
2345 return elem === checkContext;
2346 }, implicitRelative, true ),
2347 matchAnyContext = addCombinator( function( elem ) {
2348 return indexOf( checkContext, elem ) > -1;
2349 }, implicitRelative, true ),
2350 matchers = [ function( elem, context, xml ) {
2351 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2352 (checkContext = context).nodeType ?
2353 matchContext( elem, context, xml ) :
2354 matchAnyContext( elem, context, xml ) );
2355 // Avoid hanging onto element (issue #299)
2356 checkContext = null;
2357 return ret;
2358 } ];
2359
2360 for ( ; i < len; i++ ) {
2361 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2362 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2363 } else {
2364 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2365
2366 // Return special upon seeing a positional matcher
2367 if ( matcher[ expando ] ) {
2368 // Find the next relative operator (if any) for proper handling
2369 j = ++i;
2370 for ( ; j < len; j++ ) {
2371 if ( Expr.relative[ tokens[j].type ] ) {
2372 break;
2373 }
2374 }
2375 return setMatcher(
2376 i > 1 && elementMatcher( matchers ),
2377 i > 1 && toSelector(
2378 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2379 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2380 ).replace( rtrim, "$1" ),
2381 matcher,
2382 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2383 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2384 j < len && toSelector( tokens )
2385 );
2386 }
2387 matchers.push( matcher );
2388 }
2389 }
2390
2391 return elementMatcher( matchers );
2392}
2393
2394function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2395 var bySet = setMatchers.length > 0,
2396 byElement = elementMatchers.length > 0,
2397 superMatcher = function( seed, context, xml, results, outermost ) {
2398 var elem, j, matcher,
2399 matchedCount = 0,
2400 i = "0",
2401 unmatched = seed && [],
2402 setMatched = [],
2403 contextBackup = outermostContext,
2404 // We must always have either seed elements or outermost context
2405 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2406 // Use integer dirruns iff this is the outermost matcher
2407 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2408 len = elems.length;
2409
2410 if ( outermost ) {
2411 outermostContext = context === document || context || outermost;
2412 }
2413
2414 // Add elements passing elementMatchers directly to results
2415 // Support: IE<9, Safari
2416 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2417 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2418 if ( byElement && elem ) {
2419 j = 0;
2420 if ( !context && elem.ownerDocument !== document ) {
2421 setDocument( elem );
2422 xml = !documentIsHTML;
2423 }
2424 while ( (matcher = elementMatchers[j++]) ) {
2425 if ( matcher( elem, context || document, xml) ) {
2426 results.push( elem );
2427 break;
2428 }
2429 }
2430 if ( outermost ) {
2431 dirruns = dirrunsUnique;
2432 }
2433 }
2434
2435 // Track unmatched elements for set filters
2436 if ( bySet ) {
2437 // They will have gone through all possible matchers
2438 if ( (elem = !matcher && elem) ) {
2439 matchedCount--;
2440 }
2441
2442 // Lengthen the array for every element, matched or not
2443 if ( seed ) {
2444 unmatched.push( elem );
2445 }
2446 }
2447 }
2448
2449 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2450 // makes the latter nonnegative.
2451 matchedCount += i;
2452
2453 // Apply set filters to unmatched elements
2454 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2455 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2456 // no element matchers and no seed.
2457 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2458 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2459 // numerically zero.
2460 if ( bySet && i !== matchedCount ) {
2461 j = 0;
2462 while ( (matcher = setMatchers[j++]) ) {
2463 matcher( unmatched, setMatched, context, xml );
2464 }
2465
2466 if ( seed ) {
2467 // Reintegrate element matches to eliminate the need for sorting
2468 if ( matchedCount > 0 ) {
2469 while ( i-- ) {
2470 if ( !(unmatched[i] || setMatched[i]) ) {
2471 setMatched[i] = pop.call( results );
2472 }
2473 }
2474 }
2475
2476 // Discard index placeholder values to get only actual matches
2477 setMatched = condense( setMatched );
2478 }
2479
2480 // Add matches to results
2481 push.apply( results, setMatched );
2482
2483 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2484 if ( outermost && !seed && setMatched.length > 0 &&
2485 ( matchedCount + setMatchers.length ) > 1 ) {
2486
2487 Sizzle.uniqueSort( results );
2488 }
2489 }
2490
2491 // Override manipulation of globals by nested matchers
2492 if ( outermost ) {
2493 dirruns = dirrunsUnique;
2494 outermostContext = contextBackup;
2495 }
2496
2497 return unmatched;
2498 };
2499
2500 return bySet ?
2501 markFunction( superMatcher ) :
2502 superMatcher;
2503}
2504
2505compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2506 var i,
2507 setMatchers = [],
2508 elementMatchers = [],
2509 cached = compilerCache[ selector + " " ];
2510
2511 if ( !cached ) {
2512 // Generate a function of recursive functions that can be used to check each element
2513 if ( !match ) {
2514 match = tokenize( selector );
2515 }
2516 i = match.length;
2517 while ( i-- ) {
2518 cached = matcherFromTokens( match[i] );
2519 if ( cached[ expando ] ) {
2520 setMatchers.push( cached );
2521 } else {
2522 elementMatchers.push( cached );
2523 }
2524 }
2525
2526 // Cache the compiled function
2527 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2528
2529 // Save selector and tokenization
2530 cached.selector = selector;
2531 }
2532 return cached;
2533};
2534
2535/**
2536 * A low-level selection function that works with Sizzle's compiled
2537 * selector functions
2538 * @param {String|Function} selector A selector or a pre-compiled
2539 * selector function built with Sizzle.compile
2540 * @param {Element} context
2541 * @param {Array} [results]
2542 * @param {Array} [seed] A set of elements to match against
2543 */
2544select = Sizzle.select = function( selector, context, results, seed ) {
2545 var i, tokens, token, type, find,
2546 compiled = typeof selector === "function" && selector,
2547 match = !seed && tokenize( (selector = compiled.selector || selector) );
2548
2549 results = results || [];
2550
2551 // Try to minimize operations if there is only one selector in the list and no seed
2552 // (the latter of which guarantees us context)
2553 if ( match.length === 1 ) {
2554
2555 // Reduce context if the leading compound selector is an ID
2556 tokens = match[0] = match[0].slice( 0 );
2557 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2558 support.getById && context.nodeType === 9 && documentIsHTML &&
2559 Expr.relative[ tokens[1].type ] ) {
2560
2561 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2562 if ( !context ) {
2563 return results;
2564
2565 // Precompiled matchers will still verify ancestry, so step up a level
2566 } else if ( compiled ) {
2567 context = context.parentNode;
2568 }
2569
2570 selector = selector.slice( tokens.shift().value.length );
2571 }
2572
2573 // Fetch a seed set for right-to-left matching
2574 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2575 while ( i-- ) {
2576 token = tokens[i];
2577
2578 // Abort if we hit a combinator
2579 if ( Expr.relative[ (type = token.type) ] ) {
2580 break;
2581 }
2582 if ( (find = Expr.find[ type ]) ) {
2583 // Search, expanding context for leading sibling combinators
2584 if ( (seed = find(
2585 token.matches[0].replace( runescape, funescape ),
2586 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2587 )) ) {
2588
2589 // If seed is empty or no tokens remain, we can return early
2590 tokens.splice( i, 1 );
2591 selector = seed.length && toSelector( tokens );
2592 if ( !selector ) {
2593 push.apply( results, seed );
2594 return results;
2595 }
2596
2597 break;
2598 }
2599 }
2600 }
2601 }
2602
2603 // Compile and execute a filtering function if one is not provided
2604 // Provide `match` to avoid retokenization if we modified the selector above
2605 ( compiled || compile( selector, match ) )(
2606 seed,
2607 context,
2608 !documentIsHTML,
2609 results,
2610 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2611 );
2612 return results;
2613};
2614
2615// One-time assignments
2616
2617// Sort stability
2618support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2619
2620// Support: Chrome 14-35+
2621// Always assume duplicates if they aren't passed to the comparison function
2622support.detectDuplicates = !!hasDuplicate;
2623
2624// Initialize against the default document
2625setDocument();
2626
2627// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2628// Detached nodes confoundingly follow *each other*
2629support.sortDetached = assert(function( div1 ) {
2630 // Should return 1, but returns 4 (following)
2631 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2632});
2633
2634// Support: IE<8
2635// Prevent attribute/property "interpolation"
2636// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2637if ( !assert(function( div ) {
2638 div.innerHTML = "<a href='#'></a>";
2639 return div.firstChild.getAttribute("href") === "#" ;
2640}) ) {
2641 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2642 if ( !isXML ) {
2643 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2644 }
2645 });
2646}
2647
2648// Support: IE<9
2649// Use defaultValue in place of getAttribute("value")
2650if ( !support.attributes || !assert(function( div ) {
2651 div.innerHTML = "<input/>";
2652 div.firstChild.setAttribute( "value", "" );
2653 return div.firstChild.getAttribute( "value" ) === "";
2654}) ) {
2655 addHandle( "value", function( elem, name, isXML ) {
2656 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2657 return elem.defaultValue;
2658 }
2659 });
2660}
2661
2662// Support: IE<9
2663// Use getAttributeNode to fetch booleans when getAttribute lies
2664if ( !assert(function( div ) {
2665 return div.getAttribute("disabled") == null;
2666}) ) {
2667 addHandle( booleans, function( elem, name, isXML ) {
2668 var val;
2669 if ( !isXML ) {
2670 return elem[ name ] === true ? name.toLowerCase() :
2671 (val = elem.getAttributeNode( name )) && val.specified ?
2672 val.value :
2673 null;
2674 }
2675 });
2676}
2677
2678return Sizzle;
2679
2680})( window );
2681
2682
2683
2684jQuery.find = Sizzle;
2685jQuery.expr = Sizzle.selectors;
2686jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2687jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2688jQuery.text = Sizzle.getText;
2689jQuery.isXMLDoc = Sizzle.isXML;
2690jQuery.contains = Sizzle.contains;
2691
2692
2693
2694var dir = function( elem, dir, until ) {
2695 var matched = [],
2696 truncate = until !== undefined;
2697
2698 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2699 if ( elem.nodeType === 1 ) {
2700 if ( truncate && jQuery( elem ).is( until ) ) {
2701 break;
2702 }
2703 matched.push( elem );
2704 }
2705 }
2706 return matched;
2707};
2708
2709
2710var siblings = function( n, elem ) {
2711 var matched = [];
2712
2713 for ( ; n; n = n.nextSibling ) {
2714 if ( n.nodeType === 1 && n !== elem ) {
2715 matched.push( n );
2716 }
2717 }
2718
2719 return matched;
2720};
2721
2722
2723var rneedsContext = jQuery.expr.match.needsContext;
2724
2725var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
2726
2727
2728
2729var risSimple = /^.[^:#\[\.,]*$/;
2730
2731// Implement the identical functionality for filter and not
2732function winnow( elements, qualifier, not ) {
2733 if ( jQuery.isFunction( qualifier ) ) {
2734 return jQuery.grep( elements, function( elem, i ) {
2735 /* jshint -W018 */
2736 return !!qualifier.call( elem, i, elem ) !== not;
2737 } );
2738
2739 }
2740
2741 if ( qualifier.nodeType ) {
2742 return jQuery.grep( elements, function( elem ) {
2743 return ( elem === qualifier ) !== not;
2744 } );
2745
2746 }
2747
2748 if ( typeof qualifier === "string" ) {
2749 if ( risSimple.test( qualifier ) ) {
2750 return jQuery.filter( qualifier, elements, not );
2751 }
2752
2753 qualifier = jQuery.filter( qualifier, elements );
2754 }
2755
2756 return jQuery.grep( elements, function( elem ) {
2757 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2758 } );
2759}
2760
2761jQuery.filter = function( expr, elems, not ) {
2762 var elem = elems[ 0 ];
2763
2764 if ( not ) {
2765 expr = ":not(" + expr + ")";
2766 }
2767
2768 return elems.length === 1 && elem.nodeType === 1 ?
2769 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2770 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2771 return elem.nodeType === 1;
2772 } ) );
2773};
2774
2775jQuery.fn.extend( {
2776 find: function( selector ) {
2777 var i,
2778 len = this.length,
2779 ret = [],
2780 self = this;
2781
2782 if ( typeof selector !== "string" ) {
2783 return this.pushStack( jQuery( selector ).filter( function() {
2784 for ( i = 0; i < len; i++ ) {
2785 if ( jQuery.contains( self[ i ], this ) ) {
2786 return true;
2787 }
2788 }
2789 } ) );
2790 }
2791
2792 for ( i = 0; i < len; i++ ) {
2793 jQuery.find( selector, self[ i ], ret );
2794 }
2795
2796 // Needed because $( selector, context ) becomes $( context ).find( selector )
2797 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2798 ret.selector = this.selector ? this.selector + " " + selector : selector;
2799 return ret;
2800 },
2801 filter: function( selector ) {
2802 return this.pushStack( winnow( this, selector || [], false ) );
2803 },
2804 not: function( selector ) {
2805 return this.pushStack( winnow( this, selector || [], true ) );
2806 },
2807 is: function( selector ) {
2808 return !!winnow(
2809 this,
2810
2811 // If this is a positional/relative selector, check membership in the returned set
2812 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2813 typeof selector === "string" && rneedsContext.test( selector ) ?
2814 jQuery( selector ) :
2815 selector || [],
2816 false
2817 ).length;
2818 }
2819} );
2820
2821
2822// Initialize a jQuery object
2823
2824
2825// A central reference to the root jQuery(document)
2826var rootjQuery,
2827
2828 // A simple way to check for HTML strings
2829 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2830 // Strict HTML recognition (#11290: must start with <)
2831 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2832
2833 init = jQuery.fn.init = function( selector, context, root ) {
2834 var match, elem;
2835
2836 // HANDLE: $(""), $(null), $(undefined), $(false)
2837 if ( !selector ) {
2838 return this;
2839 }
2840
2841 // Method init() accepts an alternate rootjQuery
2842 // so migrate can support jQuery.sub (gh-2101)
2843 root = root || rootjQuery;
2844
2845 // Handle HTML strings
2846 if ( typeof selector === "string" ) {
2847 if ( selector[ 0 ] === "<" &&
2848 selector[ selector.length - 1 ] === ">" &&
2849 selector.length >= 3 ) {
2850
2851 // Assume that strings that start and end with <> are HTML and skip the regex check
2852 match = [ null, selector, null ];
2853
2854 } else {
2855 match = rquickExpr.exec( selector );
2856 }
2857
2858 // Match html or make sure no context is specified for #id
2859 if ( match && ( match[ 1 ] || !context ) ) {
2860
2861 // HANDLE: $(html) -> $(array)
2862 if ( match[ 1 ] ) {
2863 context = context instanceof jQuery ? context[ 0 ] : context;
2864
2865 // Option to run scripts is true for back-compat
2866 // Intentionally let the error be thrown if parseHTML is not present
2867 jQuery.merge( this, jQuery.parseHTML(
2868 match[ 1 ],
2869 context && context.nodeType ? context.ownerDocument || context : document,
2870 true
2871 ) );
2872
2873 // HANDLE: $(html, props)
2874 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2875 for ( match in context ) {
2876
2877 // Properties of context are called as methods if possible
2878 if ( jQuery.isFunction( this[ match ] ) ) {
2879 this[ match ]( context[ match ] );
2880
2881 // ...and otherwise set as attributes
2882 } else {
2883 this.attr( match, context[ match ] );
2884 }
2885 }
2886 }
2887
2888 return this;
2889
2890 // HANDLE: $(#id)
2891 } else {
2892 elem = document.getElementById( match[ 2 ] );
2893
2894 // Support: Blackberry 4.6
2895 // gEBID returns nodes no longer in the document (#6963)
2896 if ( elem && elem.parentNode ) {
2897
2898 // Inject the element directly into the jQuery object
2899 this.length = 1;
2900 this[ 0 ] = elem;
2901 }
2902
2903 this.context = document;
2904 this.selector = selector;
2905 return this;
2906 }
2907
2908 // HANDLE: $(expr, $(...))
2909 } else if ( !context || context.jquery ) {
2910 return ( context || root ).find( selector );
2911
2912 // HANDLE: $(expr, context)
2913 // (which is just equivalent to: $(context).find(expr)
2914 } else {
2915 return this.constructor( context ).find( selector );
2916 }
2917
2918 // HANDLE: $(DOMElement)
2919 } else if ( selector.nodeType ) {
2920 this.context = this[ 0 ] = selector;
2921 this.length = 1;
2922 return this;
2923
2924 // HANDLE: $(function)
2925 // Shortcut for document ready
2926 } else if ( jQuery.isFunction( selector ) ) {
2927 return root.ready !== undefined ?
2928 root.ready( selector ) :
2929
2930 // Execute immediately if ready is not present
2931 selector( jQuery );
2932 }
2933
2934 if ( selector.selector !== undefined ) {
2935 this.selector = selector.selector;
2936 this.context = selector.context;
2937 }
2938
2939 return jQuery.makeArray( selector, this );
2940 };
2941
2942// Give the init function the jQuery prototype for later instantiation
2943init.prototype = jQuery.fn;
2944
2945// Initialize central reference
2946rootjQuery = jQuery( document );
2947
2948
2949var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2950
2951 // Methods guaranteed to produce a unique set when starting from a unique set
2952 guaranteedUnique = {
2953 children: true,
2954 contents: true,
2955 next: true,
2956 prev: true
2957 };
2958
2959jQuery.fn.extend( {
2960 has: function( target ) {
2961 var targets = jQuery( target, this ),
2962 l = targets.length;
2963
2964 return this.filter( function() {
2965 var i = 0;
2966 for ( ; i < l; i++ ) {
2967 if ( jQuery.contains( this, targets[ i ] ) ) {
2968 return true;
2969 }
2970 }
2971 } );
2972 },
2973
2974 closest: function( selectors, context ) {
2975 var cur,
2976 i = 0,
2977 l = this.length,
2978 matched = [],
2979 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
2980 jQuery( selectors, context || this.context ) :
2981 0;
2982
2983 for ( ; i < l; i++ ) {
2984 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
2985
2986 // Always skip document fragments
2987 if ( cur.nodeType < 11 && ( pos ?
2988 pos.index( cur ) > -1 :
2989
2990 // Don't pass non-elements to Sizzle
2991 cur.nodeType === 1 &&
2992 jQuery.find.matchesSelector( cur, selectors ) ) ) {
2993
2994 matched.push( cur );
2995 break;
2996 }
2997 }
2998 }
2999
3000 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3001 },
3002
3003 // Determine the position of an element within the set
3004 index: function( elem ) {
3005
3006 // No argument, return index in parent
3007 if ( !elem ) {
3008 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3009 }
3010
3011 // Index in selector
3012 if ( typeof elem === "string" ) {
3013 return indexOf.call( jQuery( elem ), this[ 0 ] );
3014 }
3015
3016 // Locate the position of the desired element
3017 return indexOf.call( this,
3018
3019 // If it receives a jQuery object, the first element is used
3020 elem.jquery ? elem[ 0 ] : elem
3021 );
3022 },
3023
3024 add: function( selector, context ) {
3025 return this.pushStack(
3026 jQuery.uniqueSort(
3027 jQuery.merge( this.get(), jQuery( selector, context ) )
3028 )
3029 );
3030 },
3031
3032 addBack: function( selector ) {
3033 return this.add( selector == null ?
3034 this.prevObject : this.prevObject.filter( selector )
3035 );
3036 }
3037} );
3038
3039function sibling( cur, dir ) {
3040 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3041 return cur;
3042}
3043
3044jQuery.each( {
3045 parent: function( elem ) {
3046 var parent = elem.parentNode;
3047 return parent && parent.nodeType !== 11 ? parent : null;
3048 },
3049 parents: function( elem ) {
3050 return dir( elem, "parentNode" );
3051 },
3052 parentsUntil: function( elem, i, until ) {
3053 return dir( elem, "parentNode", until );
3054 },
3055 next: function( elem ) {
3056 return sibling( elem, "nextSibling" );
3057 },
3058 prev: function( elem ) {
3059 return sibling( elem, "previousSibling" );
3060 },
3061 nextAll: function( elem ) {
3062 return dir( elem, "nextSibling" );
3063 },
3064 prevAll: function( elem ) {
3065 return dir( elem, "previousSibling" );
3066 },
3067 nextUntil: function( elem, i, until ) {
3068 return dir( elem, "nextSibling", until );
3069 },
3070 prevUntil: function( elem, i, until ) {
3071 return dir( elem, "previousSibling", until );
3072 },
3073 siblings: function( elem ) {
3074 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3075 },
3076 children: function( elem ) {
3077 return siblings( elem.firstChild );
3078 },
3079 contents: function( elem ) {
3080 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
3081 }
3082}, function( name, fn ) {
3083 jQuery.fn[ name ] = function( until, selector ) {
3084 var matched = jQuery.map( this, fn, until );
3085
3086 if ( name.slice( -5 ) !== "Until" ) {
3087 selector = until;
3088 }
3089
3090 if ( selector && typeof selector === "string" ) {
3091 matched = jQuery.filter( selector, matched );
3092 }
3093
3094 if ( this.length > 1 ) {
3095
3096 // Remove duplicates
3097 if ( !guaranteedUnique[ name ] ) {
3098 jQuery.uniqueSort( matched );
3099 }
3100
3101 // Reverse order for parents* and prev-derivatives
3102 if ( rparentsprev.test( name ) ) {
3103 matched.reverse();
3104 }
3105 }
3106
3107 return this.pushStack( matched );
3108 };
3109} );
3110var rnotwhite = ( /\S+/g );
3111
3112
3113
3114// Convert String-formatted options into Object-formatted ones
3115function createOptions( options ) {
3116 var object = {};
3117 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
3118 object[ flag ] = true;
3119 } );
3120 return object;
3121}
3122
3123/*
3124 * Create a callback list using the following parameters:
3125 *
3126 * options: an optional list of space-separated options that will change how
3127 * the callback list behaves or a more traditional option object
3128 *
3129 * By default a callback list will act like an event callback list and can be
3130 * "fired" multiple times.
3131 *
3132 * Possible options:
3133 *
3134 * once: will ensure the callback list can only be fired once (like a Deferred)
3135 *
3136 * memory: will keep track of previous values and will call any callback added
3137 * after the list has been fired right away with the latest "memorized"
3138 * values (like a Deferred)
3139 *
3140 * unique: will ensure a callback can only be added once (no duplicate in the list)
3141 *
3142 * stopOnFalse: interrupt callings when a callback returns false
3143 *
3144 */
3145jQuery.Callbacks = function( options ) {
3146
3147 // Convert options from String-formatted to Object-formatted if needed
3148 // (we check in cache first)
3149 options = typeof options === "string" ?
3150 createOptions( options ) :
3151 jQuery.extend( {}, options );
3152
3153 var // Flag to know if list is currently firing
3154 firing,
3155
3156 // Last fire value for non-forgettable lists
3157 memory,
3158
3159 // Flag to know if list was already fired
3160 fired,
3161
3162 // Flag to prevent firing
3163 locked,
3164
3165 // Actual callback list
3166 list = [],
3167
3168 // Queue of execution data for repeatable lists
3169 queue = [],
3170
3171 // Index of currently firing callback (modified by add/remove as needed)
3172 firingIndex = -1,
3173
3174 // Fire callbacks
3175 fire = function() {
3176
3177 // Enforce single-firing
3178 locked = options.once;
3179
3180 // Execute callbacks for all pending executions,
3181 // respecting firingIndex overrides and runtime changes
3182 fired = firing = true;
3183 for ( ; queue.length; firingIndex = -1 ) {
3184 memory = queue.shift();
3185 while ( ++firingIndex < list.length ) {
3186
3187 // Run callback and check for early termination
3188 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3189 options.stopOnFalse ) {
3190
3191 // Jump to end and forget the data so .add doesn't re-fire
3192 firingIndex = list.length;
3193 memory = false;
3194 }
3195 }
3196 }
3197
3198 // Forget the data if we're done with it
3199 if ( !options.memory ) {
3200 memory = false;
3201 }
3202
3203 firing = false;
3204
3205 // Clean up if we're done firing for good
3206 if ( locked ) {
3207
3208 // Keep an empty list if we have data for future add calls
3209 if ( memory ) {
3210 list = [];
3211
3212 // Otherwise, this object is spent
3213 } else {
3214 list = "";
3215 }
3216 }
3217 },
3218
3219 // Actual Callbacks object
3220 self = {
3221
3222 // Add a callback or a collection of callbacks to the list
3223 add: function() {
3224 if ( list ) {
3225
3226 // If we have memory from a past run, we should fire after adding
3227 if ( memory && !firing ) {
3228 firingIndex = list.length - 1;
3229 queue.push( memory );
3230 }
3231
3232 ( function add( args ) {
3233 jQuery.each( args, function( _, arg ) {
3234 if ( jQuery.isFunction( arg ) ) {
3235 if ( !options.unique || !self.has( arg ) ) {
3236 list.push( arg );
3237 }
3238 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
3239
3240 // Inspect recursively
3241 add( arg );
3242 }
3243 } );
3244 } )( arguments );
3245
3246 if ( memory && !firing ) {
3247 fire();
3248 }
3249 }
3250 return this;
3251 },
3252
3253 // Remove a callback from the list
3254 remove: function() {
3255 jQuery.each( arguments, function( _, arg ) {
3256 var index;
3257 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3258 list.splice( index, 1 );
3259
3260 // Handle firing indexes
3261 if ( index <= firingIndex ) {
3262 firingIndex--;
3263 }
3264 }
3265 } );
3266 return this;
3267 },
3268
3269 // Check if a given callback is in the list.
3270 // If no argument is given, return whether or not list has callbacks attached.
3271 has: function( fn ) {
3272 return fn ?
3273 jQuery.inArray( fn, list ) > -1 :
3274 list.length > 0;
3275 },
3276
3277 // Remove all callbacks from the list
3278 empty: function() {
3279 if ( list ) {
3280 list = [];
3281 }
3282 return this;
3283 },
3284
3285 // Disable .fire and .add
3286 // Abort any current/pending executions
3287 // Clear all callbacks and values
3288 disable: function() {
3289 locked = queue = [];
3290 list = memory = "";
3291 return this;
3292 },
3293 disabled: function() {
3294 return !list;
3295 },
3296
3297 // Disable .fire
3298 // Also disable .add unless we have memory (since it would have no effect)
3299 // Abort any pending executions
3300 lock: function() {
3301 locked = queue = [];
3302 if ( !memory ) {
3303 list = memory = "";
3304 }
3305 return this;
3306 },
3307 locked: function() {
3308 return !!locked;
3309 },
3310
3311 // Call all callbacks with the given context and arguments
3312 fireWith: function( context, args ) {
3313 if ( !locked ) {
3314 args = args || [];
3315 args = [ context, args.slice ? args.slice() : args ];
3316 queue.push( args );
3317 if ( !firing ) {
3318 fire();
3319 }
3320 }
3321 return this;
3322 },
3323
3324 // Call all the callbacks with the given arguments
3325 fire: function() {
3326 self.fireWith( this, arguments );
3327 return this;
3328 },
3329
3330 // To know if the callbacks have already been called at least once
3331 fired: function() {
3332 return !!fired;
3333 }
3334 };
3335
3336 return self;
3337};
3338
3339
3340jQuery.extend( {
3341
3342 Deferred: function( func ) {
3343 var tuples = [
3344
3345 // action, add listener, listener list, final state
3346 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
3347 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
3348 [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
3349 ],
3350 state = "pending",
3351 promise = {
3352 state: function() {
3353 return state;
3354 },
3355 always: function() {
3356 deferred.done( arguments ).fail( arguments );
3357 return this;
3358 },
3359 then: function( /* fnDone, fnFail, fnProgress */ ) {
3360 var fns = arguments;
3361 return jQuery.Deferred( function( newDefer ) {
3362 jQuery.each( tuples, function( i, tuple ) {
3363 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
3364
3365 // deferred[ done | fail | progress ] for forwarding actions to newDefer
3366 deferred[ tuple[ 1 ] ]( function() {
3367 var returned = fn && fn.apply( this, arguments );
3368 if ( returned && jQuery.isFunction( returned.promise ) ) {
3369 returned.promise()
3370 .progress( newDefer.notify )
3371 .done( newDefer.resolve )
3372 .fail( newDefer.reject );
3373 } else {
3374 newDefer[ tuple[ 0 ] + "With" ](
3375 this === promise ? newDefer.promise() : this,
3376 fn ? [ returned ] : arguments
3377 );
3378 }
3379 } );
3380 } );
3381 fns = null;
3382 } ).promise();
3383 },
3384
3385 // Get a promise for this deferred
3386 // If obj is provided, the promise aspect is added to the object
3387 promise: function( obj ) {
3388 return obj != null ? jQuery.extend( obj, promise ) : promise;
3389 }
3390 },
3391 deferred = {};
3392
3393 // Keep pipe for back-compat
3394 promise.pipe = promise.then;
3395
3396 // Add list-specific methods
3397 jQuery.each( tuples, function( i, tuple ) {
3398 var list = tuple[ 2 ],
3399 stateString = tuple[ 3 ];
3400
3401 // promise[ done | fail | progress ] = list.add
3402 promise[ tuple[ 1 ] ] = list.add;
3403
3404 // Handle state
3405 if ( stateString ) {
3406 list.add( function() {
3407
3408 // state = [ resolved | rejected ]
3409 state = stateString;
3410
3411 // [ reject_list | resolve_list ].disable; progress_list.lock
3412 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
3413 }
3414
3415 // deferred[ resolve | reject | notify ]
3416 deferred[ tuple[ 0 ] ] = function() {
3417 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
3418 return this;
3419 };
3420 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3421 } );
3422
3423 // Make the deferred a promise
3424 promise.promise( deferred );
3425
3426 // Call given func if any
3427 if ( func ) {
3428 func.call( deferred, deferred );
3429 }
3430
3431 // All done!
3432 return deferred;
3433 },
3434
3435 // Deferred helper
3436 when: function( subordinate /* , ..., subordinateN */ ) {
3437 var i = 0,
3438 resolveValues = slice.call( arguments ),
3439 length = resolveValues.length,
3440
3441 // the count of uncompleted subordinates
3442 remaining = length !== 1 ||
3443 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
3444
3445 // the master Deferred.
3446 // If resolveValues consist of only a single Deferred, just use that.
3447 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
3448
3449 // Update function for both resolve and progress values
3450 updateFunc = function( i, contexts, values ) {
3451 return function( value ) {
3452 contexts[ i ] = this;
3453 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3454 if ( values === progressValues ) {
3455 deferred.notifyWith( contexts, values );
3456 } else if ( !( --remaining ) ) {
3457 deferred.resolveWith( contexts, values );
3458 }
3459 };
3460 },
3461
3462 progressValues, progressContexts, resolveContexts;
3463
3464 // Add listeners to Deferred subordinates; treat others as resolved
3465 if ( length > 1 ) {
3466 progressValues = new Array( length );
3467 progressContexts = new Array( length );
3468 resolveContexts = new Array( length );
3469 for ( ; i < length; i++ ) {
3470 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
3471 resolveValues[ i ].promise()
3472 .progress( updateFunc( i, progressContexts, progressValues ) )
3473 .done( updateFunc( i, resolveContexts, resolveValues ) )
3474 .fail( deferred.reject );
3475 } else {
3476 --remaining;
3477 }
3478 }
3479 }
3480
3481 // If we're not waiting on anything, resolve the master
3482 if ( !remaining ) {
3483 deferred.resolveWith( resolveContexts, resolveValues );
3484 }
3485
3486 return deferred.promise();
3487 }
3488} );
3489
3490
3491// The deferred used on DOM ready
3492var readyList;
3493
3494jQuery.fn.ready = function( fn ) {
3495
3496 // Add the callback
3497 jQuery.ready.promise().done( fn );
3498
3499 return this;
3500};
3501
3502jQuery.extend( {
3503
3504 // Is the DOM ready to be used? Set to true once it occurs.
3505 isReady: false,
3506
3507 // A counter to track how many items to wait for before
3508 // the ready event fires. See #6781
3509 readyWait: 1,
3510
3511 // Hold (or release) the ready event
3512 holdReady: function( hold ) {
3513 if ( hold ) {
3514 jQuery.readyWait++;
3515 } else {
3516 jQuery.ready( true );
3517 }
3518 },
3519
3520 // Handle when the DOM is ready
3521 ready: function( wait ) {
3522
3523 // Abort if there are pending holds or we're already ready
3524 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3525 return;
3526 }
3527
3528 // Remember that the DOM is ready
3529 jQuery.isReady = true;
3530
3531 // If a normal DOM Ready event fired, decrement, and wait if need be
3532 if ( wait !== true && --jQuery.readyWait > 0 ) {
3533 return;
3534 }
3535
3536 // If there are functions bound, to execute
3537 readyList.resolveWith( document, [ jQuery ] );
3538
3539 // Trigger any bound ready events
3540 if ( jQuery.fn.triggerHandler ) {
3541 jQuery( document ).triggerHandler( "ready" );
3542 jQuery( document ).off( "ready" );
3543 }
3544 }
3545} );
3546
3547/**
3548 * The ready event handler and self cleanup method
3549 */
3550function completed() {
3551 document.removeEventListener( "DOMContentLoaded", completed );
3552 window.removeEventListener( "load", completed );
3553 jQuery.ready();
3554}
3555
3556jQuery.ready.promise = function( obj ) {
3557 if ( !readyList ) {
3558
3559 readyList = jQuery.Deferred();
3560
3561 // Catch cases where $(document).ready() is called
3562 // after the browser event has already occurred.
3563 // Support: IE9-10 only
3564 // Older IE sometimes signals "interactive" too soon
3565 if ( document.readyState === "complete" ||
3566 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3567
3568 // Handle it asynchronously to allow scripts the opportunity to delay ready
3569 window.setTimeout( jQuery.ready );
3570
3571 } else {
3572
3573 // Use the handy event callback
3574 document.addEventListener( "DOMContentLoaded", completed );
3575
3576 // A fallback to window.onload, that will always work
3577 window.addEventListener( "load", completed );
3578 }
3579 }
3580 return readyList.promise( obj );
3581};
3582
3583// Kick off the DOM ready check even if the user does not
3584jQuery.ready.promise();
3585
3586
3587
3588
3589// Multifunctional method to get and set values of a collection
3590// The value/s can optionally be executed if it's a function
3591var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3592 var i = 0,
3593 len = elems.length,
3594 bulk = key == null;
3595
3596 // Sets many values
3597 if ( jQuery.type( key ) === "object" ) {
3598 chainable = true;
3599 for ( i in key ) {
3600 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3601 }
3602
3603 // Sets one value
3604 } else if ( value !== undefined ) {
3605 chainable = true;
3606
3607 if ( !jQuery.isFunction( value ) ) {
3608 raw = true;
3609 }
3610
3611 if ( bulk ) {
3612
3613 // Bulk operations run against the entire set
3614 if ( raw ) {
3615 fn.call( elems, value );
3616 fn = null;
3617
3618 // ...except when executing function values
3619 } else {
3620 bulk = fn;
3621 fn = function( elem, key, value ) {
3622 return bulk.call( jQuery( elem ), value );
3623 };
3624 }
3625 }
3626
3627 if ( fn ) {
3628 for ( ; i < len; i++ ) {
3629 fn(
3630 elems[ i ], key, raw ?
3631 value :
3632 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3633 );
3634 }
3635 }
3636 }
3637
3638 return chainable ?
3639 elems :
3640
3641 // Gets
3642 bulk ?
3643 fn.call( elems ) :
3644 len ? fn( elems[ 0 ], key ) : emptyGet;
3645};
3646var acceptData = function( owner ) {
3647
3648 // Accepts only:
3649 // - Node
3650 // - Node.ELEMENT_NODE
3651 // - Node.DOCUMENT_NODE
3652 // - Object
3653 // - Any
3654 /* jshint -W018 */
3655 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3656};
3657
3658
3659
3660
3661function Data() {
3662 this.expando = jQuery.expando + Data.uid++;
3663}
3664
3665Data.uid = 1;
3666
3667Data.prototype = {
3668
3669 register: function( owner, initial ) {
3670 var value = initial || {};
3671
3672 // If it is a node unlikely to be stringify-ed or looped over
3673 // use plain assignment
3674 if ( owner.nodeType ) {
3675 owner[ this.expando ] = value;
3676
3677 // Otherwise secure it in a non-enumerable, non-writable property
3678 // configurability must be true to allow the property to be
3679 // deleted with the delete operator
3680 } else {
3681 Object.defineProperty( owner, this.expando, {
3682 value: value,
3683 writable: true,
3684 configurable: true
3685 } );
3686 }
3687 return owner[ this.expando ];
3688 },
3689 cache: function( owner ) {
3690
3691 // We can accept data for non-element nodes in modern browsers,
3692 // but we should not, see #8335.
3693 // Always return an empty object.
3694 if ( !acceptData( owner ) ) {
3695 return {};
3696 }
3697
3698 // Check if the owner object already has a cache
3699 var value = owner[ this.expando ];
3700
3701 // If not, create one
3702 if ( !value ) {
3703 value = {};
3704
3705 // We can accept data for non-element nodes in modern browsers,
3706 // but we should not, see #8335.
3707 // Always return an empty object.
3708 if ( acceptData( owner ) ) {
3709
3710 // If it is a node unlikely to be stringify-ed or looped over
3711 // use plain assignment
3712 if ( owner.nodeType ) {
3713 owner[ this.expando ] = value;
3714
3715 // Otherwise secure it in a non-enumerable property
3716 // configurable must be true to allow the property to be
3717 // deleted when data is removed
3718 } else {
3719 Object.defineProperty( owner, this.expando, {
3720 value: value,
3721 configurable: true
3722 } );
3723 }
3724 }
3725 }
3726
3727 return value;
3728 },
3729 set: function( owner, data, value ) {
3730 var prop,
3731 cache = this.cache( owner );
3732
3733 // Handle: [ owner, key, value ] args
3734 if ( typeof data === "string" ) {
3735 cache[ data ] = value;
3736
3737 // Handle: [ owner, { properties } ] args
3738 } else {
3739
3740 // Copy the properties one-by-one to the cache object
3741 for ( prop in data ) {
3742 cache[ prop ] = data[ prop ];
3743 }
3744 }
3745 return cache;
3746 },
3747 get: function( owner, key ) {
3748 return key === undefined ?
3749 this.cache( owner ) :
3750 owner[ this.expando ] && owner[ this.expando ][ key ];
3751 },
3752 access: function( owner, key, value ) {
3753 var stored;
3754
3755 // In cases where either:
3756 //
3757 // 1. No key was specified
3758 // 2. A string key was specified, but no value provided
3759 //
3760 // Take the "read" path and allow the get method to determine
3761 // which value to return, respectively either:
3762 //
3763 // 1. The entire cache object
3764 // 2. The data stored at the key
3765 //
3766 if ( key === undefined ||
3767 ( ( key && typeof key === "string" ) && value === undefined ) ) {
3768
3769 stored = this.get( owner, key );
3770
3771 return stored !== undefined ?
3772 stored : this.get( owner, jQuery.camelCase( key ) );
3773 }
3774
3775 // When the key is not a string, or both a key and value
3776 // are specified, set or extend (existing objects) with either:
3777 //
3778 // 1. An object of properties
3779 // 2. A key and value
3780 //
3781 this.set( owner, key, value );
3782
3783 // Since the "set" path can have two possible entry points
3784 // return the expected data based on which path was taken[*]
3785 return value !== undefined ? value : key;
3786 },
3787 remove: function( owner, key ) {
3788 var i, name, camel,
3789 cache = owner[ this.expando ];
3790
3791 if ( cache === undefined ) {
3792 return;
3793 }
3794
3795 if ( key === undefined ) {
3796 this.register( owner );
3797
3798 } else {
3799
3800 // Support array or space separated string of keys
3801 if ( jQuery.isArray( key ) ) {
3802
3803 // If "name" is an array of keys...
3804 // When data is initially created, via ("key", "val") signature,
3805 // keys will be converted to camelCase.
3806 // Since there is no way to tell _how_ a key was added, remove
3807 // both plain key and camelCase key. #12786
3808 // This will only penalize the array argument path.
3809 name = key.concat( key.map( jQuery.camelCase ) );
3810 } else {
3811 camel = jQuery.camelCase( key );
3812
3813 // Try the string as a key before any manipulation
3814 if ( key in cache ) {
3815 name = [ key, camel ];
3816 } else {
3817
3818 // If a key with the spaces exists, use it.
3819 // Otherwise, create an array by matching non-whitespace
3820 name = camel;
3821 name = name in cache ?
3822 [ name ] : ( name.match( rnotwhite ) || [] );
3823 }
3824 }
3825
3826 i = name.length;
3827
3828 while ( i-- ) {
3829 delete cache[ name[ i ] ];
3830 }
3831 }
3832
3833 // Remove the expando if there's no more data
3834 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
3835
3836 // Support: Chrome <= 35-45+
3837 // Webkit & Blink performance suffers when deleting properties
3838 // from DOM nodes, so set to undefined instead
3839 // https://code.google.com/p/chromium/issues/detail?id=378607
3840 if ( owner.nodeType ) {
3841 owner[ this.expando ] = undefined;
3842 } else {
3843 delete owner[ this.expando ];
3844 }
3845 }
3846 },
3847 hasData: function( owner ) {
3848 var cache = owner[ this.expando ];
3849 return cache !== undefined && !jQuery.isEmptyObject( cache );
3850 }
3851};
3852var dataPriv = new Data();
3853
3854var dataUser = new Data();
3855
3856
3857
3858// Implementation Summary
3859//
3860// 1. Enforce API surface and semantic compatibility with 1.9.x branch
3861// 2. Improve the module's maintainability by reducing the storage
3862// paths to a single mechanism.
3863// 3. Use the same single mechanism to support "private" and "user" data.
3864// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
3865// 5. Avoid exposing implementation details on user objects (eg. expando properties)
3866// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
3867
3868var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
3869 rmultiDash = /[A-Z]/g;
3870
3871function dataAttr( elem, key, data ) {
3872 var name;
3873
3874 // If nothing was found internally, try to fetch any
3875 // data from the HTML5 data-* attribute
3876 if ( data === undefined && elem.nodeType === 1 ) {
3877 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
3878 data = elem.getAttribute( name );
3879
3880 if ( typeof data === "string" ) {
3881 try {
3882 data = data === "true" ? true :
3883 data === "false" ? false :
3884 data === "null" ? null :
3885
3886 // Only convert to a number if it doesn't change the string
3887 +data + "" === data ? +data :
3888 rbrace.test( data ) ? jQuery.parseJSON( data ) :
3889 data;
3890 } catch ( e ) {}
3891
3892 // Make sure we set the data so it isn't changed later
3893 dataUser.set( elem, key, data );
3894 } else {
3895 data = undefined;
3896 }
3897 }
3898 return data;
3899}
3900
3901jQuery.extend( {
3902 hasData: function( elem ) {
3903 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
3904 },
3905
3906 data: function( elem, name, data ) {
3907 return dataUser.access( elem, name, data );
3908 },
3909
3910 removeData: function( elem, name ) {
3911 dataUser.remove( elem, name );
3912 },
3913
3914 // TODO: Now that all calls to _data and _removeData have been replaced
3915 // with direct calls to dataPriv methods, these can be deprecated.
3916 _data: function( elem, name, data ) {
3917 return dataPriv.access( elem, name, data );
3918 },
3919
3920 _removeData: function( elem, name ) {
3921 dataPriv.remove( elem, name );
3922 }
3923} );
3924
3925jQuery.fn.extend( {
3926 data: function( key, value ) {
3927 var i, name, data,
3928 elem = this[ 0 ],
3929 attrs = elem && elem.attributes;
3930
3931 // Gets all values
3932 if ( key === undefined ) {
3933 if ( this.length ) {
3934 data = dataUser.get( elem );
3935
3936 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
3937 i = attrs.length;
3938 while ( i-- ) {
3939
3940 // Support: IE11+
3941 // The attrs elements can be null (#14894)
3942 if ( attrs[ i ] ) {
3943 name = attrs[ i ].name;
3944 if ( name.indexOf( "data-" ) === 0 ) {
3945 name = jQuery.camelCase( name.slice( 5 ) );
3946 dataAttr( elem, name, data[ name ] );
3947 }
3948 }
3949 }
3950 dataPriv.set( elem, "hasDataAttrs", true );
3951 }
3952 }
3953
3954 return data;
3955 }
3956
3957 // Sets multiple values
3958 if ( typeof key === "object" ) {
3959 return this.each( function() {
3960 dataUser.set( this, key );
3961 } );
3962 }
3963
3964 return access( this, function( value ) {
3965 var data, camelKey;
3966
3967 // The calling jQuery object (element matches) is not empty
3968 // (and therefore has an element appears at this[ 0 ]) and the
3969 // `value` parameter was not undefined. An empty jQuery object
3970 // will result in `undefined` for elem = this[ 0 ] which will
3971 // throw an exception if an attempt to read a data cache is made.
3972 if ( elem && value === undefined ) {
3973
3974 // Attempt to get data from the cache
3975 // with the key as-is
3976 data = dataUser.get( elem, key ) ||
3977
3978 // Try to find dashed key if it exists (gh-2779)
3979 // This is for 2.2.x only
3980 dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() );
3981
3982 if ( data !== undefined ) {
3983 return data;
3984 }
3985
3986 camelKey = jQuery.camelCase( key );
3987
3988 // Attempt to get data from the cache
3989 // with the key camelized
3990 data = dataUser.get( elem, camelKey );
3991 if ( data !== undefined ) {
3992 return data;
3993 }
3994
3995 // Attempt to "discover" the data in
3996 // HTML5 custom data-* attrs
3997 data = dataAttr( elem, camelKey, undefined );
3998 if ( data !== undefined ) {
3999 return data;
4000 }
4001
4002 // We tried really hard, but the data doesn't exist.
4003 return;
4004 }
4005
4006 // Set the data...
4007 camelKey = jQuery.camelCase( key );
4008 this.each( function() {
4009
4010 // First, attempt to store a copy or reference of any
4011 // data that might've been store with a camelCased key.
4012 var data = dataUser.get( this, camelKey );
4013
4014 // For HTML5 data-* attribute interop, we have to
4015 // store property names with dashes in a camelCase form.
4016 // This might not apply to all properties...*
4017 dataUser.set( this, camelKey, value );
4018
4019 // *... In the case of properties that might _actually_
4020 // have dashes, we need to also store a copy of that
4021 // unchanged property.
4022 if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
4023 dataUser.set( this, key, value );
4024 }
4025 } );
4026 }, null, value, arguments.length > 1, null, true );
4027 },
4028
4029 removeData: function( key ) {
4030 return this.each( function() {
4031 dataUser.remove( this, key );
4032 } );
4033 }
4034} );
4035
4036
4037jQuery.extend( {
4038 queue: function( elem, type, data ) {
4039 var queue;
4040
4041 if ( elem ) {
4042 type = ( type || "fx" ) + "queue";
4043 queue = dataPriv.get( elem, type );
4044
4045 // Speed up dequeue by getting out quickly if this is just a lookup
4046 if ( data ) {
4047 if ( !queue || jQuery.isArray( data ) ) {
4048 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4049 } else {
4050 queue.push( data );
4051 }
4052 }
4053 return queue || [];
4054 }
4055 },
4056
4057 dequeue: function( elem, type ) {
4058 type = type || "fx";
4059
4060 var queue = jQuery.queue( elem, type ),
4061 startLength = queue.length,
4062 fn = queue.shift(),
4063 hooks = jQuery._queueHooks( elem, type ),
4064 next = function() {
4065 jQuery.dequeue( elem, type );
4066 };
4067
4068 // If the fx queue is dequeued, always remove the progress sentinel
4069 if ( fn === "inprogress" ) {
4070 fn = queue.shift();
4071 startLength--;
4072 }
4073
4074 if ( fn ) {
4075
4076 // Add a progress sentinel to prevent the fx queue from being
4077 // automatically dequeued
4078 if ( type === "fx" ) {
4079 queue.unshift( "inprogress" );
4080 }
4081
4082 // Clear up the last queue stop function
4083 delete hooks.stop;
4084 fn.call( elem, next, hooks );
4085 }
4086
4087 if ( !startLength && hooks ) {
4088 hooks.empty.fire();
4089 }
4090 },
4091
4092 // Not public - generate a queueHooks object, or return the current one
4093 _queueHooks: function( elem, type ) {
4094 var key = type + "queueHooks";
4095 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4096 empty: jQuery.Callbacks( "once memory" ).add( function() {
4097 dataPriv.remove( elem, [ type + "queue", key ] );
4098 } )
4099 } );
4100 }
4101} );
4102
4103jQuery.fn.extend( {
4104 queue: function( type, data ) {
4105 var setter = 2;
4106
4107 if ( typeof type !== "string" ) {
4108 data = type;
4109 type = "fx";
4110 setter--;
4111 }
4112
4113 if ( arguments.length < setter ) {
4114 return jQuery.queue( this[ 0 ], type );
4115 }
4116
4117 return data === undefined ?
4118 this :
4119 this.each( function() {
4120 var queue = jQuery.queue( this, type, data );
4121
4122 // Ensure a hooks for this queue
4123 jQuery._queueHooks( this, type );
4124
4125 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4126 jQuery.dequeue( this, type );
4127 }
4128 } );
4129 },
4130 dequeue: function( type ) {
4131 return this.each( function() {
4132 jQuery.dequeue( this, type );
4133 } );
4134 },
4135 clearQueue: function( type ) {
4136 return this.queue( type || "fx", [] );
4137 },
4138
4139 // Get a promise resolved when queues of a certain type
4140 // are emptied (fx is the type by default)
4141 promise: function( type, obj ) {
4142 var tmp,
4143 count = 1,
4144 defer = jQuery.Deferred(),
4145 elements = this,
4146 i = this.length,
4147 resolve = function() {
4148 if ( !( --count ) ) {
4149 defer.resolveWith( elements, [ elements ] );
4150 }
4151 };
4152
4153 if ( typeof type !== "string" ) {
4154 obj = type;
4155 type = undefined;
4156 }
4157 type = type || "fx";
4158
4159 while ( i-- ) {
4160 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4161 if ( tmp && tmp.empty ) {
4162 count++;
4163 tmp.empty.add( resolve );
4164 }
4165 }
4166 resolve();
4167 return defer.promise( obj );
4168 }
4169} );
4170var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4171
4172var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4173
4174
4175var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4176
4177var isHidden = function( elem, el ) {
4178
4179 // isHidden might be called from jQuery#filter function;
4180 // in that case, element will be second argument
4181 elem = el || elem;
4182 return jQuery.css( elem, "display" ) === "none" ||
4183 !jQuery.contains( elem.ownerDocument, elem );
4184 };
4185
4186
4187
4188function adjustCSS( elem, prop, valueParts, tween ) {
4189 var adjusted,
4190 scale = 1,
4191 maxIterations = 20,
4192 currentValue = tween ?
4193 function() { return tween.cur(); } :
4194 function() { return jQuery.css( elem, prop, "" ); },
4195 initial = currentValue(),
4196 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4197
4198 // Starting value computation is required for potential unit mismatches
4199 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4200 rcssNum.exec( jQuery.css( elem, prop ) );
4201
4202 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4203
4204 // Trust units reported by jQuery.css
4205 unit = unit || initialInUnit[ 3 ];
4206
4207 // Make sure we update the tween properties later on
4208 valueParts = valueParts || [];
4209
4210 // Iteratively approximate from a nonzero starting point
4211 initialInUnit = +initial || 1;
4212
4213 do {
4214
4215 // If previous iteration zeroed out, double until we get *something*.
4216 // Use string for doubling so we don't accidentally see scale as unchanged below
4217 scale = scale || ".5";
4218
4219 // Adjust and apply
4220 initialInUnit = initialInUnit / scale;
4221 jQuery.style( elem, prop, initialInUnit + unit );
4222
4223 // Update scale, tolerating zero or NaN from tween.cur()
4224 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
4225 } while (
4226 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
4227 );
4228 }
4229
4230 if ( valueParts ) {
4231 initialInUnit = +initialInUnit || +initial || 0;
4232
4233 // Apply relative offset (+=/-=) if specified
4234 adjusted = valueParts[ 1 ] ?
4235 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4236 +valueParts[ 2 ];
4237 if ( tween ) {
4238 tween.unit = unit;
4239 tween.start = initialInUnit;
4240 tween.end = adjusted;
4241 }
4242 }
4243 return adjusted;
4244}
4245var rcheckableType = ( /^(?:checkbox|radio)$/i );
4246
4247var rtagName = ( /<([\w:-]+)/ );
4248
4249var rscriptType = ( /^$|\/(?:java|ecma)script/i );
4250
4251
4252
4253// We have to close these tags to support XHTML (#13200)
4254var wrapMap = {
4255
4256 // Support: IE9
4257 option: [ 1, "<select multiple='multiple'>", "</select>" ],
4258
4259 // XHTML parsers do not magically insert elements in the
4260 // same way that tag soup parsers do. So we cannot shorten
4261 // this by omitting <tbody> or other required elements.
4262 thead: [ 1, "<table>", "</table>" ],
4263 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4264 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4265 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4266
4267 _default: [ 0, "", "" ]
4268};
4269
4270// Support: IE9
4271wrapMap.optgroup = wrapMap.option;
4272
4273wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4274wrapMap.th = wrapMap.td;
4275
4276
4277function getAll( context, tag ) {
4278
4279 // Support: IE9-11+
4280 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4281 var ret = typeof context.getElementsByTagName !== "undefined" ?
4282 context.getElementsByTagName( tag || "*" ) :
4283 typeof context.querySelectorAll !== "undefined" ?
4284 context.querySelectorAll( tag || "*" ) :
4285 [];
4286
4287 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
4288 jQuery.merge( [ context ], ret ) :
4289 ret;
4290}
4291
4292
4293// Mark scripts as having already been evaluated
4294function setGlobalEval( elems, refElements ) {
4295 var i = 0,
4296 l = elems.length;
4297
4298 for ( ; i < l; i++ ) {
4299 dataPriv.set(
4300 elems[ i ],
4301 "globalEval",
4302 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4303 );
4304 }
4305}
4306
4307
4308var rhtml = /<|&#?\w+;/;
4309
4310function buildFragment( elems, context, scripts, selection, ignored ) {
4311 var elem, tmp, tag, wrap, contains, j,
4312 fragment = context.createDocumentFragment(),
4313 nodes = [],
4314 i = 0,
4315 l = elems.length;
4316
4317 for ( ; i < l; i++ ) {
4318 elem = elems[ i ];
4319
4320 if ( elem || elem === 0 ) {
4321
4322 // Add nodes directly
4323 if ( jQuery.type( elem ) === "object" ) {
4324
4325 // Support: Android<4.1, PhantomJS<2
4326 // push.apply(_, arraylike) throws on ancient WebKit
4327 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4328
4329 // Convert non-html into a text node
4330 } else if ( !rhtml.test( elem ) ) {
4331 nodes.push( context.createTextNode( elem ) );
4332
4333 // Convert html into DOM nodes
4334 } else {
4335 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4336
4337 // Deserialize a standard representation
4338 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4339 wrap = wrapMap[ tag ] || wrapMap._default;
4340 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4341
4342 // Descend through wrappers to the right content
4343 j = wrap[ 0 ];
4344 while ( j-- ) {
4345 tmp = tmp.lastChild;
4346 }
4347
4348 // Support: Android<4.1, PhantomJS<2
4349 // push.apply(_, arraylike) throws on ancient WebKit
4350 jQuery.merge( nodes, tmp.childNodes );
4351
4352 // Remember the top-level container
4353 tmp = fragment.firstChild;
4354
4355 // Ensure the created nodes are orphaned (#12392)
4356 tmp.textContent = "";
4357 }
4358 }
4359 }
4360
4361 // Remove wrapper from fragment
4362 fragment.textContent = "";
4363
4364 i = 0;
4365 while ( ( elem = nodes[ i++ ] ) ) {
4366
4367 // Skip elements already in the context collection (trac-4087)
4368 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4369 if ( ignored ) {
4370 ignored.push( elem );
4371 }
4372 continue;
4373 }
4374
4375 contains = jQuery.contains( elem.ownerDocument, elem );
4376
4377 // Append to fragment
4378 tmp = getAll( fragment.appendChild( elem ), "script" );
4379
4380 // Preserve script evaluation history
4381 if ( contains ) {
4382 setGlobalEval( tmp );
4383 }
4384
4385 // Capture executables
4386 if ( scripts ) {
4387 j = 0;
4388 while ( ( elem = tmp[ j++ ] ) ) {
4389 if ( rscriptType.test( elem.type || "" ) ) {
4390 scripts.push( elem );
4391 }
4392 }
4393 }
4394 }
4395
4396 return fragment;
4397}
4398
4399
4400( function() {
4401 var fragment = document.createDocumentFragment(),
4402 div = fragment.appendChild( document.createElement( "div" ) ),
4403 input = document.createElement( "input" );
4404
4405 // Support: Android 4.0-4.3, Safari<=5.1
4406 // Check state lost if the name is set (#11217)
4407 // Support: Windows Web Apps (WWA)
4408 // `name` and `type` must use .setAttribute for WWA (#14901)
4409 input.setAttribute( "type", "radio" );
4410 input.setAttribute( "checked", "checked" );
4411 input.setAttribute( "name", "t" );
4412
4413 div.appendChild( input );
4414
4415 // Support: Safari<=5.1, Android<4.2
4416 // Older WebKit doesn't clone checked state correctly in fragments
4417 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4418
4419 // Support: IE<=11+
4420 // Make sure textarea (and checkbox) defaultValue is properly cloned
4421 div.innerHTML = "<textarea>x</textarea>";
4422 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4423} )();
4424
4425
4426var
4427 rkeyEvent = /^key/,
4428 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4429 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4430
4431function returnTrue() {
4432 return true;
4433}
4434
4435function returnFalse() {
4436 return false;
4437}
4438
4439// Support: IE9
4440// See #13393 for more info
4441function safeActiveElement() {
4442 try {
4443 return document.activeElement;
4444 } catch ( err ) { }
4445}
4446
4447function on( elem, types, selector, data, fn, one ) {
4448 var origFn, type;
4449
4450 // Types can be a map of types/handlers
4451 if ( typeof types === "object" ) {
4452
4453 // ( types-Object, selector, data )
4454 if ( typeof selector !== "string" ) {
4455
4456 // ( types-Object, data )
4457 data = data || selector;
4458 selector = undefined;
4459 }
4460 for ( type in types ) {
4461 on( elem, type, selector, data, types[ type ], one );
4462 }
4463 return elem;
4464 }
4465
4466 if ( data == null && fn == null ) {
4467
4468 // ( types, fn )
4469 fn = selector;
4470 data = selector = undefined;
4471 } else if ( fn == null ) {
4472 if ( typeof selector === "string" ) {
4473
4474 // ( types, selector, fn )
4475 fn = data;
4476 data = undefined;
4477 } else {
4478
4479 // ( types, data, fn )
4480 fn = data;
4481 data = selector;
4482 selector = undefined;
4483 }
4484 }
4485 if ( fn === false ) {
4486 fn = returnFalse;
4487 } else if ( !fn ) {
4488 return elem;
4489 }
4490
4491 if ( one === 1 ) {
4492 origFn = fn;
4493 fn = function( event ) {
4494
4495 // Can use an empty set, since event contains the info
4496 jQuery().off( event );
4497 return origFn.apply( this, arguments );
4498 };
4499
4500 // Use same guid so caller can remove using origFn
4501 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4502 }
4503 return elem.each( function() {
4504 jQuery.event.add( this, types, fn, data, selector );
4505 } );
4506}
4507
4508/*
4509 * Helper functions for managing events -- not part of the public interface.
4510 * Props to Dean Edwards' addEvent library for many of the ideas.
4511 */
4512jQuery.event = {
4513
4514 global: {},
4515
4516 add: function( elem, types, handler, data, selector ) {
4517
4518 var handleObjIn, eventHandle, tmp,
4519 events, t, handleObj,
4520 special, handlers, type, namespaces, origType,
4521 elemData = dataPriv.get( elem );
4522
4523 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4524 if ( !elemData ) {
4525 return;
4526 }
4527
4528 // Caller can pass in an object of custom data in lieu of the handler
4529 if ( handler.handler ) {
4530 handleObjIn = handler;
4531 handler = handleObjIn.handler;
4532 selector = handleObjIn.selector;
4533 }
4534
4535 // Make sure that the handler has a unique ID, used to find/remove it later
4536 if ( !handler.guid ) {
4537 handler.guid = jQuery.guid++;
4538 }
4539
4540 // Init the element's event structure and main handler, if this is the first
4541 if ( !( events = elemData.events ) ) {
4542 events = elemData.events = {};
4543 }
4544 if ( !( eventHandle = elemData.handle ) ) {
4545 eventHandle = elemData.handle = function( e ) {
4546
4547 // Discard the second event of a jQuery.event.trigger() and
4548 // when an event is called after a page has unloaded
4549 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
4550 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4551 };
4552 }
4553
4554 // Handle multiple events separated by a space
4555 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4556 t = types.length;
4557 while ( t-- ) {
4558 tmp = rtypenamespace.exec( types[ t ] ) || [];
4559 type = origType = tmp[ 1 ];
4560 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4561
4562 // There *must* be a type, no attaching namespace-only handlers
4563 if ( !type ) {
4564 continue;
4565 }
4566
4567 // If event changes its type, use the special event handlers for the changed type
4568 special = jQuery.event.special[ type ] || {};
4569
4570 // If selector defined, determine special event api type, otherwise given type
4571 type = ( selector ? special.delegateType : special.bindType ) || type;
4572
4573 // Update special based on newly reset type
4574 special = jQuery.event.special[ type ] || {};
4575
4576 // handleObj is passed to all event handlers
4577 handleObj = jQuery.extend( {
4578 type: type,
4579 origType: origType,
4580 data: data,
4581 handler: handler,
4582 guid: handler.guid,
4583 selector: selector,
4584 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4585 namespace: namespaces.join( "." )
4586 }, handleObjIn );
4587
4588 // Init the event handler queue if we're the first
4589 if ( !( handlers = events[ type ] ) ) {
4590 handlers = events[ type ] = [];
4591 handlers.delegateCount = 0;
4592
4593 // Only use addEventListener if the special events handler returns false
4594 if ( !special.setup ||
4595 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4596
4597 if ( elem.addEventListener ) {
4598 elem.addEventListener( type, eventHandle );
4599 }
4600 }
4601 }
4602
4603 if ( special.add ) {
4604 special.add.call( elem, handleObj );
4605
4606 if ( !handleObj.handler.guid ) {
4607 handleObj.handler.guid = handler.guid;
4608 }
4609 }
4610
4611 // Add to the element's handler list, delegates in front
4612 if ( selector ) {
4613 handlers.splice( handlers.delegateCount++, 0, handleObj );
4614 } else {
4615 handlers.push( handleObj );
4616 }
4617
4618 // Keep track of which events have ever been used, for event optimization
4619 jQuery.event.global[ type ] = true;
4620 }
4621
4622 },
4623
4624 // Detach an event or set of events from an element
4625 remove: function( elem, types, handler, selector, mappedTypes ) {
4626
4627 var j, origCount, tmp,
4628 events, t, handleObj,
4629 special, handlers, type, namespaces, origType,
4630 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
4631
4632 if ( !elemData || !( events = elemData.events ) ) {
4633 return;
4634 }
4635
4636 // Once for each type.namespace in types; type may be omitted
4637 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4638 t = types.length;
4639 while ( t-- ) {
4640 tmp = rtypenamespace.exec( types[ t ] ) || [];
4641 type = origType = tmp[ 1 ];
4642 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4643
4644 // Unbind all events (on this namespace, if provided) for the element
4645 if ( !type ) {
4646 for ( type in events ) {
4647 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4648 }
4649 continue;
4650 }
4651
4652 special = jQuery.event.special[ type ] || {};
4653 type = ( selector ? special.delegateType : special.bindType ) || type;
4654 handlers = events[ type ] || [];
4655 tmp = tmp[ 2 ] &&
4656 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
4657
4658 // Remove matching events
4659 origCount = j = handlers.length;
4660 while ( j-- ) {
4661 handleObj = handlers[ j ];
4662
4663 if ( ( mappedTypes || origType === handleObj.origType ) &&
4664 ( !handler || handler.guid === handleObj.guid ) &&
4665 ( !tmp || tmp.test( handleObj.namespace ) ) &&
4666 ( !selector || selector === handleObj.selector ||
4667 selector === "**" && handleObj.selector ) ) {
4668 handlers.splice( j, 1 );
4669
4670 if ( handleObj.selector ) {
4671 handlers.delegateCount--;
4672 }
4673 if ( special.remove ) {
4674 special.remove.call( elem, handleObj );
4675 }
4676 }
4677 }
4678
4679 // Remove generic event handler if we removed something and no more handlers exist
4680 // (avoids potential for endless recursion during removal of special event handlers)
4681 if ( origCount && !handlers.length ) {
4682 if ( !special.teardown ||
4683 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4684
4685 jQuery.removeEvent( elem, type, elemData.handle );
4686 }
4687
4688 delete events[ type ];
4689 }
4690 }
4691
4692 // Remove data and the expando if it's no longer used
4693 if ( jQuery.isEmptyObject( events ) ) {
4694 dataPriv.remove( elem, "handle events" );
4695 }
4696 },
4697
4698 dispatch: function( event ) {
4699
4700 // Make a writable jQuery.Event from the native event object
4701 event = jQuery.event.fix( event );
4702
4703 var i, j, ret, matched, handleObj,
4704 handlerQueue = [],
4705 args = slice.call( arguments ),
4706 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
4707 special = jQuery.event.special[ event.type ] || {};
4708
4709 // Use the fix-ed jQuery.Event rather than the (read-only) native event
4710 args[ 0 ] = event;
4711 event.delegateTarget = this;
4712
4713 // Call the preDispatch hook for the mapped type, and let it bail if desired
4714 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
4715 return;
4716 }
4717
4718 // Determine handlers
4719 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
4720
4721 // Run delegates first; they may want to stop propagation beneath us
4722 i = 0;
4723 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
4724 event.currentTarget = matched.elem;
4725
4726 j = 0;
4727 while ( ( handleObj = matched.handlers[ j++ ] ) &&
4728 !event.isImmediatePropagationStopped() ) {
4729
4730 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
4731 // a subset or equal to those in the bound event (both can have no namespace).
4732 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
4733
4734 event.handleObj = handleObj;
4735 event.data = handleObj.data;
4736
4737 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
4738 handleObj.handler ).apply( matched.elem, args );
4739
4740 if ( ret !== undefined ) {
4741 if ( ( event.result = ret ) === false ) {
4742 event.preventDefault();
4743 event.stopPropagation();
4744 }
4745 }
4746 }
4747 }
4748 }
4749
4750 // Call the postDispatch hook for the mapped type
4751 if ( special.postDispatch ) {
4752 special.postDispatch.call( this, event );
4753 }
4754
4755 return event.result;
4756 },
4757
4758 handlers: function( event, handlers ) {
4759 var i, matches, sel, handleObj,
4760 handlerQueue = [],
4761 delegateCount = handlers.delegateCount,
4762 cur = event.target;
4763
4764 // Support (at least): Chrome, IE9
4765 // Find delegate handlers
4766 // Black-hole SVG <use> instance trees (#13180)
4767 //
4768 // Support: Firefox<=42+
4769 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
4770 if ( delegateCount && cur.nodeType &&
4771 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
4772
4773 for ( ; cur !== this; cur = cur.parentNode || this ) {
4774
4775 // Don't check non-elements (#13208)
4776 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
4777 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
4778 matches = [];
4779 for ( i = 0; i < delegateCount; i++ ) {
4780 handleObj = handlers[ i ];
4781
4782 // Don't conflict with Object.prototype properties (#13203)
4783 sel = handleObj.selector + " ";
4784
4785 if ( matches[ sel ] === undefined ) {
4786 matches[ sel ] = handleObj.needsContext ?
4787 jQuery( sel, this ).index( cur ) > -1 :
4788 jQuery.find( sel, this, null, [ cur ] ).length;
4789 }
4790 if ( matches[ sel ] ) {
4791 matches.push( handleObj );
4792 }
4793 }
4794 if ( matches.length ) {
4795 handlerQueue.push( { elem: cur, handlers: matches } );
4796 }
4797 }
4798 }
4799 }
4800
4801 // Add the remaining (directly-bound) handlers
4802 if ( delegateCount < handlers.length ) {
4803 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
4804 }
4805
4806 return handlerQueue;
4807 },
4808
4809 // Includes some event props shared by KeyEvent and MouseEvent
4810 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
4811 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
4812
4813 fixHooks: {},
4814
4815 keyHooks: {
4816 props: "char charCode key keyCode".split( " " ),
4817 filter: function( event, original ) {
4818
4819 // Add which for key events
4820 if ( event.which == null ) {
4821 event.which = original.charCode != null ? original.charCode : original.keyCode;
4822 }
4823
4824 return event;
4825 }
4826 },
4827
4828 mouseHooks: {
4829 props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " +
4830 "screenX screenY toElement" ).split( " " ),
4831 filter: function( event, original ) {
4832 var eventDoc, doc, body,
4833 button = original.button;
4834
4835 // Calculate pageX/Y if missing and clientX/Y available
4836 if ( event.pageX == null && original.clientX != null ) {
4837 eventDoc = event.target.ownerDocument || document;
4838 doc = eventDoc.documentElement;
4839 body = eventDoc.body;
4840
4841 event.pageX = original.clientX +
4842 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
4843 ( doc && doc.clientLeft || body && body.clientLeft || 0 );
4844 event.pageY = original.clientY +
4845 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
4846 ( doc && doc.clientTop || body && body.clientTop || 0 );
4847 }
4848
4849 // Add which for click: 1 === left; 2 === middle; 3 === right
4850 // Note: button is not normalized, so don't use it
4851 if ( !event.which && button !== undefined ) {
4852 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
4853 }
4854
4855 return event;
4856 }
4857 },
4858
4859 fix: function( event ) {
4860 if ( event[ jQuery.expando ] ) {
4861 return event;
4862 }
4863
4864 // Create a writable copy of the event object and normalize some properties
4865 var i, prop, copy,
4866 type = event.type,
4867 originalEvent = event,
4868 fixHook = this.fixHooks[ type ];
4869
4870 if ( !fixHook ) {
4871 this.fixHooks[ type ] = fixHook =
4872 rmouseEvent.test( type ) ? this.mouseHooks :
4873 rkeyEvent.test( type ) ? this.keyHooks :
4874 {};
4875 }
4876 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
4877
4878 event = new jQuery.Event( originalEvent );
4879
4880 i = copy.length;
4881 while ( i-- ) {
4882 prop = copy[ i ];
4883 event[ prop ] = originalEvent[ prop ];
4884 }
4885
4886 // Support: Cordova 2.5 (WebKit) (#13255)
4887 // All events should have a target; Cordova deviceready doesn't
4888 if ( !event.target ) {
4889 event.target = document;
4890 }
4891
4892 // Support: Safari 6.0+, Chrome<28
4893 // Target should not be a text node (#504, #13143)
4894 if ( event.target.nodeType === 3 ) {
4895 event.target = event.target.parentNode;
4896 }
4897
4898 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
4899 },
4900
4901 special: {
4902 load: {
4903
4904 // Prevent triggered image.load events from bubbling to window.load
4905 noBubble: true
4906 },
4907 focus: {
4908
4909 // Fire native event if possible so blur/focus sequence is correct
4910 trigger: function() {
4911 if ( this !== safeActiveElement() && this.focus ) {
4912 this.focus();
4913 return false;
4914 }
4915 },
4916 delegateType: "focusin"
4917 },
4918 blur: {
4919 trigger: function() {
4920 if ( this === safeActiveElement() && this.blur ) {
4921 this.blur();
4922 return false;
4923 }
4924 },
4925 delegateType: "focusout"
4926 },
4927 click: {
4928
4929 // For checkbox, fire native event so checked state will be right
4930 trigger: function() {
4931 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
4932 this.click();
4933 return false;
4934 }
4935 },
4936
4937 // For cross-browser consistency, don't fire native .click() on links
4938 _default: function( event ) {
4939 return jQuery.nodeName( event.target, "a" );
4940 }
4941 },
4942
4943 beforeunload: {
4944 postDispatch: function( event ) {
4945
4946 // Support: Firefox 20+
4947 // Firefox doesn't alert if the returnValue field is not set.
4948 if ( event.result !== undefined && event.originalEvent ) {
4949 event.originalEvent.returnValue = event.result;
4950 }
4951 }
4952 }
4953 }
4954};
4955
4956jQuery.removeEvent = function( elem, type, handle ) {
4957
4958 // This "if" is needed for plain objects
4959 if ( elem.removeEventListener ) {
4960 elem.removeEventListener( type, handle );
4961 }
4962};
4963
4964jQuery.Event = function( src, props ) {
4965
4966 // Allow instantiation without the 'new' keyword
4967 if ( !( this instanceof jQuery.Event ) ) {
4968 return new jQuery.Event( src, props );
4969 }
4970
4971 // Event object
4972 if ( src && src.type ) {
4973 this.originalEvent = src;
4974 this.type = src.type;
4975
4976 // Events bubbling up the document may have been marked as prevented
4977 // by a handler lower down the tree; reflect the correct value.
4978 this.isDefaultPrevented = src.defaultPrevented ||
4979 src.defaultPrevented === undefined &&
4980
4981 // Support: Android<4.0
4982 src.returnValue === false ?
4983 returnTrue :
4984 returnFalse;
4985
4986 // Event type
4987 } else {
4988 this.type = src;
4989 }
4990
4991 // Put explicitly provided properties onto the event object
4992 if ( props ) {
4993 jQuery.extend( this, props );
4994 }
4995
4996 // Create a timestamp if incoming event doesn't have one
4997 this.timeStamp = src && src.timeStamp || jQuery.now();
4998
4999 // Mark it as fixed
5000 this[ jQuery.expando ] = true;
5001};
5002
5003// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5004// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5005jQuery.Event.prototype = {
5006 constructor: jQuery.Event,
5007 isDefaultPrevented: returnFalse,
5008 isPropagationStopped: returnFalse,
5009 isImmediatePropagationStopped: returnFalse,
5010 isSimulated: false,
5011
5012 preventDefault: function() {
5013 var e = this.originalEvent;
5014
5015 this.isDefaultPrevented = returnTrue;
5016
5017 if ( e && !this.isSimulated ) {
5018 e.preventDefault();
5019 }
5020 },
5021 stopPropagation: function() {
5022 var e = this.originalEvent;
5023
5024 this.isPropagationStopped = returnTrue;
5025
5026 if ( e && !this.isSimulated ) {
5027 e.stopPropagation();
5028 }
5029 },
5030 stopImmediatePropagation: function() {
5031 var e = this.originalEvent;
5032
5033 this.isImmediatePropagationStopped = returnTrue;
5034
5035 if ( e && !this.isSimulated ) {
5036 e.stopImmediatePropagation();
5037 }
5038
5039 this.stopPropagation();
5040 }
5041};
5042
5043// Create mouseenter/leave events using mouseover/out and event-time checks
5044// so that event delegation works in jQuery.
5045// Do the same for pointerenter/pointerleave and pointerover/pointerout
5046//
5047// Support: Safari 7 only
5048// Safari sends mouseenter too often; see:
5049// https://code.google.com/p/chromium/issues/detail?id=470258
5050// for the description of the bug (it existed in older Chrome versions as well).
5051jQuery.each( {
5052 mouseenter: "mouseover",
5053 mouseleave: "mouseout",
5054 pointerenter: "pointerover",
5055 pointerleave: "pointerout"
5056}, function( orig, fix ) {
5057 jQuery.event.special[ orig ] = {
5058 delegateType: fix,
5059 bindType: fix,
5060
5061 handle: function( event ) {
5062 var ret,
5063 target = this,
5064 related = event.relatedTarget,
5065 handleObj = event.handleObj;
5066
5067 // For mouseenter/leave call the handler if related is outside the target.
5068 // NB: No relatedTarget if the mouse left/entered the browser window
5069 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5070 event.type = handleObj.origType;
5071 ret = handleObj.handler.apply( this, arguments );
5072 event.type = fix;
5073 }
5074 return ret;
5075 }
5076 };
5077} );
5078
5079jQuery.fn.extend( {
5080 on: function( types, selector, data, fn ) {
5081 return on( this, types, selector, data, fn );
5082 },
5083 one: function( types, selector, data, fn ) {
5084 return on( this, types, selector, data, fn, 1 );
5085 },
5086 off: function( types, selector, fn ) {
5087 var handleObj, type;
5088 if ( types && types.preventDefault && types.handleObj ) {
5089
5090 // ( event ) dispatched jQuery.Event
5091 handleObj = types.handleObj;
5092 jQuery( types.delegateTarget ).off(
5093 handleObj.namespace ?
5094 handleObj.origType + "." + handleObj.namespace :
5095 handleObj.origType,
5096 handleObj.selector,
5097 handleObj.handler
5098 );
5099 return this;
5100 }
5101 if ( typeof types === "object" ) {
5102
5103 // ( types-object [, selector] )
5104 for ( type in types ) {
5105 this.off( type, selector, types[ type ] );
5106 }
5107 return this;
5108 }
5109 if ( selector === false || typeof selector === "function" ) {
5110
5111 // ( types [, fn] )
5112 fn = selector;
5113 selector = undefined;
5114 }
5115 if ( fn === false ) {
5116 fn = returnFalse;
5117 }
5118 return this.each( function() {
5119 jQuery.event.remove( this, types, fn, selector );
5120 } );
5121 }
5122} );
5123
5124
5125var
5126 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
5127
5128 // Support: IE 10-11, Edge 10240+
5129 // In IE/Edge using regex groups here causes severe slowdowns.
5130 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5131 rnoInnerhtml = /<script|<style|<link/i,
5132
5133 // checked="checked" or checked
5134 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5135 rscriptTypeMasked = /^true\/(.*)/,
5136 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5137
5138// Manipulating tables requires a tbody
5139function manipulationTarget( elem, content ) {
5140 return jQuery.nodeName( elem, "table" ) &&
5141 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
5142
5143 elem.getElementsByTagName( "tbody" )[ 0 ] ||
5144 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
5145 elem;
5146}
5147
5148// Replace/restore the type attribute of script elements for safe DOM manipulation
5149function disableScript( elem ) {
5150 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5151 return elem;
5152}
5153function restoreScript( elem ) {
5154 var match = rscriptTypeMasked.exec( elem.type );
5155
5156 if ( match ) {
5157 elem.type = match[ 1 ];
5158 } else {
5159 elem.removeAttribute( "type" );
5160 }
5161
5162 return elem;
5163}
5164
5165function cloneCopyEvent( src, dest ) {
5166 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5167
5168 if ( dest.nodeType !== 1 ) {
5169 return;
5170 }
5171
5172 // 1. Copy private data: events, handlers, etc.
5173 if ( dataPriv.hasData( src ) ) {
5174 pdataOld = dataPriv.access( src );
5175 pdataCur = dataPriv.set( dest, pdataOld );
5176 events = pdataOld.events;
5177
5178 if ( events ) {
5179 delete pdataCur.handle;
5180 pdataCur.events = {};
5181
5182 for ( type in events ) {
5183 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5184 jQuery.event.add( dest, type, events[ type ][ i ] );
5185 }
5186 }
5187 }
5188 }
5189
5190 // 2. Copy user data
5191 if ( dataUser.hasData( src ) ) {
5192 udataOld = dataUser.access( src );
5193 udataCur = jQuery.extend( {}, udataOld );
5194
5195 dataUser.set( dest, udataCur );
5196 }
5197}
5198
5199// Fix IE bugs, see support tests
5200function fixInput( src, dest ) {
5201 var nodeName = dest.nodeName.toLowerCase();
5202
5203 // Fails to persist the checked state of a cloned checkbox or radio button.
5204 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5205 dest.checked = src.checked;
5206
5207 // Fails to return the selected option to the default selected state when cloning options
5208 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5209 dest.defaultValue = src.defaultValue;
5210 }
5211}
5212
5213function domManip( collection, args, callback, ignored ) {
5214
5215 // Flatten any nested arrays
5216 args = concat.apply( [], args );
5217
5218 var fragment, first, scripts, hasScripts, node, doc,
5219 i = 0,
5220 l = collection.length,
5221 iNoClone = l - 1,
5222 value = args[ 0 ],
5223 isFunction = jQuery.isFunction( value );
5224
5225 // We can't cloneNode fragments that contain checked, in WebKit
5226 if ( isFunction ||
5227 ( l > 1 && typeof value === "string" &&
5228 !support.checkClone && rchecked.test( value ) ) ) {
5229 return collection.each( function( index ) {
5230 var self = collection.eq( index );
5231 if ( isFunction ) {
5232 args[ 0 ] = value.call( this, index, self.html() );
5233 }
5234 domManip( self, args, callback, ignored );
5235 } );
5236 }
5237
5238 if ( l ) {
5239 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5240 first = fragment.firstChild;
5241
5242 if ( fragment.childNodes.length === 1 ) {
5243 fragment = first;
5244 }
5245
5246 // Require either new content or an interest in ignored elements to invoke the callback
5247 if ( first || ignored ) {
5248 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5249 hasScripts = scripts.length;
5250
5251 // Use the original fragment for the last item
5252 // instead of the first because it can end up
5253 // being emptied incorrectly in certain situations (#8070).
5254 for ( ; i < l; i++ ) {
5255 node = fragment;
5256
5257 if ( i !== iNoClone ) {
5258 node = jQuery.clone( node, true, true );
5259
5260 // Keep references to cloned scripts for later restoration
5261 if ( hasScripts ) {
5262
5263 // Support: Android<4.1, PhantomJS<2
5264 // push.apply(_, arraylike) throws on ancient WebKit
5265 jQuery.merge( scripts, getAll( node, "script" ) );
5266 }
5267 }
5268
5269 callback.call( collection[ i ], node, i );
5270 }
5271
5272 if ( hasScripts ) {
5273 doc = scripts[ scripts.length - 1 ].ownerDocument;
5274
5275 // Reenable scripts
5276 jQuery.map( scripts, restoreScript );
5277
5278 // Evaluate executable scripts on first document insertion
5279 for ( i = 0; i < hasScripts; i++ ) {
5280 node = scripts[ i ];
5281 if ( rscriptType.test( node.type || "" ) &&
5282 !dataPriv.access( node, "globalEval" ) &&
5283 jQuery.contains( doc, node ) ) {
5284
5285 if ( node.src ) {
5286
5287 // Optional AJAX dependency, but won't run scripts if not present
5288 if ( jQuery._evalUrl ) {
5289 jQuery._evalUrl( node.src );
5290 }
5291 } else {
5292 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
5293 }
5294 }
5295 }
5296 }
5297 }
5298 }
5299
5300 return collection;
5301}
5302
5303function remove( elem, selector, keepData ) {
5304 var node,
5305 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5306 i = 0;
5307
5308 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5309 if ( !keepData && node.nodeType === 1 ) {
5310 jQuery.cleanData( getAll( node ) );
5311 }
5312
5313 if ( node.parentNode ) {
5314 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
5315 setGlobalEval( getAll( node, "script" ) );
5316 }
5317 node.parentNode.removeChild( node );
5318 }
5319 }
5320
5321 return elem;
5322}
5323
5324jQuery.extend( {
5325 htmlPrefilter: function( html ) {
5326 return html.replace( rxhtmlTag, "<$1></$2>" );
5327 },
5328
5329 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5330 var i, l, srcElements, destElements,
5331 clone = elem.cloneNode( true ),
5332 inPage = jQuery.contains( elem.ownerDocument, elem );
5333
5334 // Fix IE cloning issues
5335 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5336 !jQuery.isXMLDoc( elem ) ) {
5337
5338 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
5339 destElements = getAll( clone );
5340 srcElements = getAll( elem );
5341
5342 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5343 fixInput( srcElements[ i ], destElements[ i ] );
5344 }
5345 }
5346
5347 // Copy the events from the original to the clone
5348 if ( dataAndEvents ) {
5349 if ( deepDataAndEvents ) {
5350 srcElements = srcElements || getAll( elem );
5351 destElements = destElements || getAll( clone );
5352
5353 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5354 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5355 }
5356 } else {
5357 cloneCopyEvent( elem, clone );
5358 }
5359 }
5360
5361 // Preserve script evaluation history
5362 destElements = getAll( clone, "script" );
5363 if ( destElements.length > 0 ) {
5364 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5365 }
5366
5367 // Return the cloned set
5368 return clone;
5369 },
5370
5371 cleanData: function( elems ) {
5372 var data, elem, type,
5373 special = jQuery.event.special,
5374 i = 0;
5375
5376 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5377 if ( acceptData( elem ) ) {
5378 if ( ( data = elem[ dataPriv.expando ] ) ) {
5379 if ( data.events ) {
5380 for ( type in data.events ) {
5381 if ( special[ type ] ) {
5382 jQuery.event.remove( elem, type );
5383
5384 // This is a shortcut to avoid jQuery.event.remove's overhead
5385 } else {
5386 jQuery.removeEvent( elem, type, data.handle );
5387 }
5388 }
5389 }
5390
5391 // Support: Chrome <= 35-45+
5392 // Assign undefined instead of using delete, see Data#remove
5393 elem[ dataPriv.expando ] = undefined;
5394 }
5395 if ( elem[ dataUser.expando ] ) {
5396
5397 // Support: Chrome <= 35-45+
5398 // Assign undefined instead of using delete, see Data#remove
5399 elem[ dataUser.expando ] = undefined;
5400 }
5401 }
5402 }
5403 }
5404} );
5405
5406jQuery.fn.extend( {
5407
5408 // Keep domManip exposed until 3.0 (gh-2225)
5409 domManip: domManip,
5410
5411 detach: function( selector ) {
5412 return remove( this, selector, true );
5413 },
5414
5415 remove: function( selector ) {
5416 return remove( this, selector );
5417 },
5418
5419 text: function( value ) {
5420 return access( this, function( value ) {
5421 return value === undefined ?
5422 jQuery.text( this ) :
5423 this.empty().each( function() {
5424 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5425 this.textContent = value;
5426 }
5427 } );
5428 }, null, value, arguments.length );
5429 },
5430
5431 append: function() {
5432 return domManip( this, arguments, function( elem ) {
5433 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5434 var target = manipulationTarget( this, elem );
5435 target.appendChild( elem );
5436 }
5437 } );
5438 },
5439
5440 prepend: function() {
5441 return domManip( this, arguments, function( elem ) {
5442 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5443 var target = manipulationTarget( this, elem );
5444 target.insertBefore( elem, target.firstChild );
5445 }
5446 } );
5447 },
5448
5449 before: function() {
5450 return domManip( this, arguments, function( elem ) {
5451 if ( this.parentNode ) {
5452 this.parentNode.insertBefore( elem, this );
5453 }
5454 } );
5455 },
5456
5457 after: function() {
5458 return domManip( this, arguments, function( elem ) {
5459 if ( this.parentNode ) {
5460 this.parentNode.insertBefore( elem, this.nextSibling );
5461 }
5462 } );
5463 },
5464
5465 empty: function() {
5466 var elem,
5467 i = 0;
5468
5469 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5470 if ( elem.nodeType === 1 ) {
5471
5472 // Prevent memory leaks
5473 jQuery.cleanData( getAll( elem, false ) );
5474
5475 // Remove any remaining nodes
5476 elem.textContent = "";
5477 }
5478 }
5479
5480 return this;
5481 },
5482
5483 clone: function( dataAndEvents, deepDataAndEvents ) {
5484 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5485 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5486
5487 return this.map( function() {
5488 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5489 } );
5490 },
5491
5492 html: function( value ) {
5493 return access( this, function( value ) {
5494 var elem = this[ 0 ] || {},
5495 i = 0,
5496 l = this.length;
5497
5498 if ( value === undefined && elem.nodeType === 1 ) {
5499 return elem.innerHTML;
5500 }
5501
5502 // See if we can take a shortcut and just use innerHTML
5503 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5504 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5505
5506 value = jQuery.htmlPrefilter( value );
5507
5508 try {
5509 for ( ; i < l; i++ ) {
5510 elem = this[ i ] || {};
5511
5512 // Remove element nodes and prevent memory leaks
5513 if ( elem.nodeType === 1 ) {
5514 jQuery.cleanData( getAll( elem, false ) );
5515 elem.innerHTML = value;
5516 }
5517 }
5518
5519 elem = 0;
5520
5521 // If using innerHTML throws an exception, use the fallback method
5522 } catch ( e ) {}
5523 }
5524
5525 if ( elem ) {
5526 this.empty().append( value );
5527 }
5528 }, null, value, arguments.length );
5529 },
5530
5531 replaceWith: function() {
5532 var ignored = [];
5533
5534 // Make the changes, replacing each non-ignored context element with the new content
5535 return domManip( this, arguments, function( elem ) {
5536 var parent = this.parentNode;
5537
5538 if ( jQuery.inArray( this, ignored ) < 0 ) {
5539 jQuery.cleanData( getAll( this ) );
5540 if ( parent ) {
5541 parent.replaceChild( elem, this );
5542 }
5543 }
5544
5545 // Force callback invocation
5546 }, ignored );
5547 }
5548} );
5549
5550jQuery.each( {
5551 appendTo: "append",
5552 prependTo: "prepend",
5553 insertBefore: "before",
5554 insertAfter: "after",
5555 replaceAll: "replaceWith"
5556}, function( name, original ) {
5557 jQuery.fn[ name ] = function( selector ) {
5558 var elems,
5559 ret = [],
5560 insert = jQuery( selector ),
5561 last = insert.length - 1,
5562 i = 0;
5563
5564 for ( ; i <= last; i++ ) {
5565 elems = i === last ? this : this.clone( true );
5566 jQuery( insert[ i ] )[ original ]( elems );
5567
5568 // Support: QtWebKit
5569 // .get() because push.apply(_, arraylike) throws
5570 push.apply( ret, elems.get() );
5571 }
5572
5573 return this.pushStack( ret );
5574 };
5575} );
5576
5577
5578var iframe,
5579 elemdisplay = {
5580
5581 // Support: Firefox
5582 // We have to pre-define these values for FF (#10227)
5583 HTML: "block",
5584 BODY: "block"
5585 };
5586
5587/**
5588 * Retrieve the actual display of a element
5589 * @param {String} name nodeName of the element
5590 * @param {Object} doc Document object
5591 */
5592
5593// Called only from within defaultDisplay
5594function actualDisplay( name, doc ) {
5595 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
5596
5597 display = jQuery.css( elem[ 0 ], "display" );
5598
5599 // We don't have any data stored on the element,
5600 // so use "detach" method as fast way to get rid of the element
5601 elem.detach();
5602
5603 return display;
5604}
5605
5606/**
5607 * Try to determine the default display value of an element
5608 * @param {String} nodeName
5609 */
5610function defaultDisplay( nodeName ) {
5611 var doc = document,
5612 display = elemdisplay[ nodeName ];
5613
5614 if ( !display ) {
5615 display = actualDisplay( nodeName, doc );
5616
5617 // If the simple way fails, read from inside an iframe
5618 if ( display === "none" || !display ) {
5619
5620 // Use the already-created iframe if possible
5621 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
5622 .appendTo( doc.documentElement );
5623
5624 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
5625 doc = iframe[ 0 ].contentDocument;
5626
5627 // Support: IE
5628 doc.write();
5629 doc.close();
5630
5631 display = actualDisplay( nodeName, doc );
5632 iframe.detach();
5633 }
5634
5635 // Store the correct default display
5636 elemdisplay[ nodeName ] = display;
5637 }
5638
5639 return display;
5640}
5641var rmargin = ( /^margin/ );
5642
5643var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
5644
5645var getStyles = function( elem ) {
5646
5647 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
5648 // IE throws on elements created in popups
5649 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
5650 var view = elem.ownerDocument.defaultView;
5651
5652 if ( !view || !view.opener ) {
5653 view = window;
5654 }
5655
5656 return view.getComputedStyle( elem );
5657 };
5658
5659var swap = function( elem, options, callback, args ) {
5660 var ret, name,
5661 old = {};
5662
5663 // Remember the old values, and insert the new ones
5664 for ( name in options ) {
5665 old[ name ] = elem.style[ name ];
5666 elem.style[ name ] = options[ name ];
5667 }
5668
5669 ret = callback.apply( elem, args || [] );
5670
5671 // Revert the old values
5672 for ( name in options ) {
5673 elem.style[ name ] = old[ name ];
5674 }
5675
5676 return ret;
5677};
5678
5679
5680var documentElement = document.documentElement;
5681
5682
5683
5684( function() {
5685 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
5686 container = document.createElement( "div" ),
5687 div = document.createElement( "div" );
5688
5689 // Finish early in limited (non-browser) environments
5690 if ( !div.style ) {
5691 return;
5692 }
5693
5694 // Support: IE9-11+
5695 // Style of cloned element affects source element cloned (#8908)
5696 div.style.backgroundClip = "content-box";
5697 div.cloneNode( true ).style.backgroundClip = "";
5698 support.clearCloneStyle = div.style.backgroundClip === "content-box";
5699
5700 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
5701 "padding:0;margin-top:1px;position:absolute";
5702 container.appendChild( div );
5703
5704 // Executing both pixelPosition & boxSizingReliable tests require only one layout
5705 // so they're executed at the same time to save the second computation.
5706 function computeStyleTests() {
5707 div.style.cssText =
5708
5709 // Support: Firefox<29, Android 2.3
5710 // Vendor-prefix box-sizing
5711 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
5712 "position:relative;display:block;" +
5713 "margin:auto;border:1px;padding:1px;" +
5714 "top:1%;width:50%";
5715 div.innerHTML = "";
5716 documentElement.appendChild( container );
5717
5718 var divStyle = window.getComputedStyle( div );
5719 pixelPositionVal = divStyle.top !== "1%";
5720 reliableMarginLeftVal = divStyle.marginLeft === "2px";
5721 boxSizingReliableVal = divStyle.width === "4px";
5722
5723 // Support: Android 4.0 - 4.3 only
5724 // Some styles come back with percentage values, even though they shouldn't
5725 div.style.marginRight = "50%";
5726 pixelMarginRightVal = divStyle.marginRight === "4px";
5727
5728 documentElement.removeChild( container );
5729 }
5730
5731 jQuery.extend( support, {
5732 pixelPosition: function() {
5733
5734 // This test is executed only once but we still do memoizing
5735 // since we can use the boxSizingReliable pre-computing.
5736 // No need to check if the test was already performed, though.
5737 computeStyleTests();
5738 return pixelPositionVal;
5739 },
5740 boxSizingReliable: function() {
5741 if ( boxSizingReliableVal == null ) {
5742 computeStyleTests();
5743 }
5744 return boxSizingReliableVal;
5745 },
5746 pixelMarginRight: function() {
5747
5748 // Support: Android 4.0-4.3
5749 // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
5750 // since that compresses better and they're computed together anyway.
5751 if ( boxSizingReliableVal == null ) {
5752 computeStyleTests();
5753 }
5754 return pixelMarginRightVal;
5755 },
5756 reliableMarginLeft: function() {
5757
5758 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
5759 if ( boxSizingReliableVal == null ) {
5760 computeStyleTests();
5761 }
5762 return reliableMarginLeftVal;
5763 },
5764 reliableMarginRight: function() {
5765
5766 // Support: Android 2.3
5767 // Check if div with explicit width and no margin-right incorrectly
5768 // gets computed margin-right based on width of container. (#3333)
5769 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
5770 // This support function is only executed once so no memoizing is needed.
5771 var ret,
5772 marginDiv = div.appendChild( document.createElement( "div" ) );
5773
5774 // Reset CSS: box-sizing; display; margin; border; padding
5775 marginDiv.style.cssText = div.style.cssText =
5776
5777 // Support: Android 2.3
5778 // Vendor-prefix box-sizing
5779 "-webkit-box-sizing:content-box;box-sizing:content-box;" +
5780 "display:block;margin:0;border:0;padding:0";
5781 marginDiv.style.marginRight = marginDiv.style.width = "0";
5782 div.style.width = "1px";
5783 documentElement.appendChild( container );
5784
5785 ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
5786
5787 documentElement.removeChild( container );
5788 div.removeChild( marginDiv );
5789
5790 return ret;
5791 }
5792 } );
5793} )();
5794
5795
5796function curCSS( elem, name, computed ) {
5797 var width, minWidth, maxWidth, ret,
5798 style = elem.style;
5799
5800 computed = computed || getStyles( elem );
5801 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
5802
5803 // Support: Opera 12.1x only
5804 // Fall back to style even without computed
5805 // computed is undefined for elems on document fragments
5806 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
5807 ret = jQuery.style( elem, name );
5808 }
5809
5810 // Support: IE9
5811 // getPropertyValue is only needed for .css('filter') (#12537)
5812 if ( computed ) {
5813
5814 // A tribute to the "awesome hack by Dean Edwards"
5815 // Android Browser returns percentage for some values,
5816 // but width seems to be reliably pixels.
5817 // This is against the CSSOM draft spec:
5818 // http://dev.w3.org/csswg/cssom/#resolved-values
5819 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
5820
5821 // Remember the original values
5822 width = style.width;
5823 minWidth = style.minWidth;
5824 maxWidth = style.maxWidth;
5825
5826 // Put in the new values to get a computed value out
5827 style.minWidth = style.maxWidth = style.width = ret;
5828 ret = computed.width;
5829
5830 // Revert the changed values
5831 style.width = width;
5832 style.minWidth = minWidth;
5833 style.maxWidth = maxWidth;
5834 }
5835 }
5836
5837 return ret !== undefined ?
5838
5839 // Support: IE9-11+
5840 // IE returns zIndex value as an integer.
5841 ret + "" :
5842 ret;
5843}
5844
5845
5846function addGetHookIf( conditionFn, hookFn ) {
5847
5848 // Define the hook, we'll check on the first run if it's really needed.
5849 return {
5850 get: function() {
5851 if ( conditionFn() ) {
5852
5853 // Hook not needed (or it's not possible to use it due
5854 // to missing dependency), remove it.
5855 delete this.get;
5856 return;
5857 }
5858
5859 // Hook needed; redefine it so that the support test is not executed again.
5860 return ( this.get = hookFn ).apply( this, arguments );
5861 }
5862 };
5863}
5864
5865
5866var
5867
5868 // Swappable if display is none or starts with table
5869 // except "table", "table-cell", or "table-caption"
5870 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
5871 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
5872
5873 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5874 cssNormalTransform = {
5875 letterSpacing: "0",
5876 fontWeight: "400"
5877 },
5878
5879 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
5880 emptyStyle = document.createElement( "div" ).style;
5881
5882// Return a css property mapped to a potentially vendor prefixed property
5883function vendorPropName( name ) {
5884
5885 // Shortcut for names that are not vendor prefixed
5886 if ( name in emptyStyle ) {
5887 return name;
5888 }
5889
5890 // Check for vendor prefixed names
5891 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
5892 i = cssPrefixes.length;
5893
5894 while ( i-- ) {
5895 name = cssPrefixes[ i ] + capName;
5896 if ( name in emptyStyle ) {
5897 return name;
5898 }
5899 }
5900}
5901
5902function setPositiveNumber( elem, value, subtract ) {
5903
5904 // Any relative (+/-) values have already been
5905 // normalized at this point
5906 var matches = rcssNum.exec( value );
5907 return matches ?
5908
5909 // Guard against undefined "subtract", e.g., when used as in cssHooks
5910 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
5911 value;
5912}
5913
5914function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
5915 var i = extra === ( isBorderBox ? "border" : "content" ) ?
5916
5917 // If we already have the right measurement, avoid augmentation
5918 4 :
5919
5920 // Otherwise initialize for horizontal or vertical properties
5921 name === "width" ? 1 : 0,
5922
5923 val = 0;
5924
5925 for ( ; i < 4; i += 2 ) {
5926
5927 // Both box models exclude margin, so add it if we want it
5928 if ( extra === "margin" ) {
5929 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
5930 }
5931
5932 if ( isBorderBox ) {
5933
5934 // border-box includes padding, so remove it if we want content
5935 if ( extra === "content" ) {
5936 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5937 }
5938
5939 // At this point, extra isn't border nor margin, so remove border
5940 if ( extra !== "margin" ) {
5941 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5942 }
5943 } else {
5944
5945 // At this point, extra isn't content, so add padding
5946 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5947
5948 // At this point, extra isn't content nor padding, so add border
5949 if ( extra !== "padding" ) {
5950 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5951 }
5952 }
5953 }
5954
5955 return val;
5956}
5957
5958function getWidthOrHeight( elem, name, extra ) {
5959
5960 // Start with offset property, which is equivalent to the border-box value
5961 var valueIsBorderBox = true,
5962 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
5963 styles = getStyles( elem ),
5964 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
5965
5966 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
5967 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
5968 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
5969 if ( val <= 0 || val == null ) {
5970
5971 // Fall back to computed then uncomputed css if necessary
5972 val = curCSS( elem, name, styles );
5973 if ( val < 0 || val == null ) {
5974 val = elem.style[ name ];
5975 }
5976
5977 // Computed unit is not pixels. Stop here and return.
5978 if ( rnumnonpx.test( val ) ) {
5979 return val;
5980 }
5981
5982 // Check for style in case a browser which returns unreliable values
5983 // for getComputedStyle silently falls back to the reliable elem.style
5984 valueIsBorderBox = isBorderBox &&
5985 ( support.boxSizingReliable() || val === elem.style[ name ] );
5986
5987 // Normalize "", auto, and prepare for extra
5988 val = parseFloat( val ) || 0;
5989 }
5990
5991 // Use the active box-sizing model to add/subtract irrelevant styles
5992 return ( val +
5993 augmentWidthOrHeight(
5994 elem,
5995 name,
5996 extra || ( isBorderBox ? "border" : "content" ),
5997 valueIsBorderBox,
5998 styles
5999 )
6000 ) + "px";
6001}
6002
6003function showHide( elements, show ) {
6004 var display, elem, hidden,
6005 values = [],
6006 index = 0,
6007 length = elements.length;
6008
6009 for ( ; index < length; index++ ) {
6010 elem = elements[ index ];
6011 if ( !elem.style ) {
6012 continue;
6013 }
6014
6015 values[ index ] = dataPriv.get( elem, "olddisplay" );
6016 display = elem.style.display;
6017 if ( show ) {
6018
6019 // Reset the inline display of this element to learn if it is
6020 // being hidden by cascaded rules or not
6021 if ( !values[ index ] && display === "none" ) {
6022 elem.style.display = "";
6023 }
6024
6025 // Set elements which have been overridden with display: none
6026 // in a stylesheet to whatever the default browser style is
6027 // for such an element
6028 if ( elem.style.display === "" && isHidden( elem ) ) {
6029 values[ index ] = dataPriv.access(
6030 elem,
6031 "olddisplay",
6032 defaultDisplay( elem.nodeName )
6033 );
6034 }
6035 } else {
6036 hidden = isHidden( elem );
6037
6038 if ( display !== "none" || !hidden ) {
6039 dataPriv.set(
6040 elem,
6041 "olddisplay",
6042 hidden ? display : jQuery.css( elem, "display" )
6043 );
6044 }
6045 }
6046 }
6047
6048 // Set the display of most of the elements in a second loop
6049 // to avoid the constant reflow
6050 for ( index = 0; index < length; index++ ) {
6051 elem = elements[ index ];
6052 if ( !elem.style ) {
6053 continue;
6054 }
6055 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6056 elem.style.display = show ? values[ index ] || "" : "none";
6057 }
6058 }
6059
6060 return elements;
6061}
6062
6063jQuery.extend( {
6064
6065 // Add in style property hooks for overriding the default
6066 // behavior of getting and setting a style property
6067 cssHooks: {
6068 opacity: {
6069 get: function( elem, computed ) {
6070 if ( computed ) {
6071
6072 // We should always get a number back from opacity
6073 var ret = curCSS( elem, "opacity" );
6074 return ret === "" ? "1" : ret;
6075 }
6076 }
6077 }
6078 },
6079
6080 // Don't automatically add "px" to these possibly-unitless properties
6081 cssNumber: {
6082 "animationIterationCount": true,
6083 "columnCount": true,
6084 "fillOpacity": true,
6085 "flexGrow": true,
6086 "flexShrink": true,
6087 "fontWeight": true,
6088 "lineHeight": true,
6089 "opacity": true,
6090 "order": true,
6091 "orphans": true,
6092 "widows": true,
6093 "zIndex": true,
6094 "zoom": true
6095 },
6096
6097 // Add in properties whose names you wish to fix before
6098 // setting or getting the value
6099 cssProps: {
6100 "float": "cssFloat"
6101 },
6102
6103 // Get and set the style property on a DOM Node
6104 style: function( elem, name, value, extra ) {
6105
6106 // Don't set styles on text and comment nodes
6107 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6108 return;
6109 }
6110
6111 // Make sure that we're working with the right name
6112 var ret, type, hooks,
6113 origName = jQuery.camelCase( name ),
6114 style = elem.style;
6115
6116 name = jQuery.cssProps[ origName ] ||
6117 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6118
6119 // Gets hook for the prefixed version, then unprefixed version
6120 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6121
6122 // Check if we're setting a value
6123 if ( value !== undefined ) {
6124 type = typeof value;
6125
6126 // Convert "+=" or "-=" to relative numbers (#7345)
6127 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6128 value = adjustCSS( elem, name, ret );
6129
6130 // Fixes bug #9237
6131 type = "number";
6132 }
6133
6134 // Make sure that null and NaN values aren't set (#7116)
6135 if ( value == null || value !== value ) {
6136 return;
6137 }
6138
6139 // If a number was passed in, add the unit (except for certain CSS properties)
6140 if ( type === "number" ) {
6141 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6142 }
6143
6144 // Support: IE9-11+
6145 // background-* props affect original clone's values
6146 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6147 style[ name ] = "inherit";
6148 }
6149
6150 // If a hook was provided, use that value, otherwise just set the specified value
6151 if ( !hooks || !( "set" in hooks ) ||
6152 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6153
6154 style[ name ] = value;
6155 }
6156
6157 } else {
6158
6159 // If a hook was provided get the non-computed value from there
6160 if ( hooks && "get" in hooks &&
6161 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6162
6163 return ret;
6164 }
6165
6166 // Otherwise just get the value from the style object
6167 return style[ name ];
6168 }
6169 },
6170
6171 css: function( elem, name, extra, styles ) {
6172 var val, num, hooks,
6173 origName = jQuery.camelCase( name );
6174
6175 // Make sure that we're working with the right name
6176 name = jQuery.cssProps[ origName ] ||
6177 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6178
6179 // Try prefixed name followed by the unprefixed name
6180 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6181
6182 // If a hook was provided get the computed value from there
6183 if ( hooks && "get" in hooks ) {
6184 val = hooks.get( elem, true, extra );
6185 }
6186
6187 // Otherwise, if a way to get the computed value exists, use that
6188 if ( val === undefined ) {
6189 val = curCSS( elem, name, styles );
6190 }
6191
6192 // Convert "normal" to computed value
6193 if ( val === "normal" && name in cssNormalTransform ) {
6194 val = cssNormalTransform[ name ];
6195 }
6196
6197 // Make numeric if forced or a qualifier was provided and val looks numeric
6198 if ( extra === "" || extra ) {
6199 num = parseFloat( val );
6200 return extra === true || isFinite( num ) ? num || 0 : val;
6201 }
6202 return val;
6203 }
6204} );
6205
6206jQuery.each( [ "height", "width" ], function( i, name ) {
6207 jQuery.cssHooks[ name ] = {
6208 get: function( elem, computed, extra ) {
6209 if ( computed ) {
6210
6211 // Certain elements can have dimension info if we invisibly show them
6212 // but it must have a current display style that would benefit
6213 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6214 elem.offsetWidth === 0 ?
6215 swap( elem, cssShow, function() {
6216 return getWidthOrHeight( elem, name, extra );
6217 } ) :
6218 getWidthOrHeight( elem, name, extra );
6219 }
6220 },
6221
6222 set: function( elem, value, extra ) {
6223 var matches,
6224 styles = extra && getStyles( elem ),
6225 subtract = extra && augmentWidthOrHeight(
6226 elem,
6227 name,
6228 extra,
6229 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6230 styles
6231 );
6232
6233 // Convert to pixels if value adjustment is needed
6234 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6235 ( matches[ 3 ] || "px" ) !== "px" ) {
6236
6237 elem.style[ name ] = value;
6238 value = jQuery.css( elem, name );
6239 }
6240
6241 return setPositiveNumber( elem, value, subtract );
6242 }
6243 };
6244} );
6245
6246jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6247 function( elem, computed ) {
6248 if ( computed ) {
6249 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6250 elem.getBoundingClientRect().left -
6251 swap( elem, { marginLeft: 0 }, function() {
6252 return elem.getBoundingClientRect().left;
6253 } )
6254 ) + "px";
6255 }
6256 }
6257);
6258
6259// Support: Android 2.3
6260jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
6261 function( elem, computed ) {
6262 if ( computed ) {
6263 return swap( elem, { "display": "inline-block" },
6264 curCSS, [ elem, "marginRight" ] );
6265 }
6266 }
6267);
6268
6269// These hooks are used by animate to expand properties
6270jQuery.each( {
6271 margin: "",
6272 padding: "",
6273 border: "Width"
6274}, function( prefix, suffix ) {
6275 jQuery.cssHooks[ prefix + suffix ] = {
6276 expand: function( value ) {
6277 var i = 0,
6278 expanded = {},
6279
6280 // Assumes a single number if not a string
6281 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6282
6283 for ( ; i < 4; i++ ) {
6284 expanded[ prefix + cssExpand[ i ] + suffix ] =
6285 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6286 }
6287
6288 return expanded;
6289 }
6290 };
6291
6292 if ( !rmargin.test( prefix ) ) {
6293 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6294 }
6295} );
6296
6297jQuery.fn.extend( {
6298 css: function( name, value ) {
6299 return access( this, function( elem, name, value ) {
6300 var styles, len,
6301 map = {},
6302 i = 0;
6303
6304 if ( jQuery.isArray( name ) ) {
6305 styles = getStyles( elem );
6306 len = name.length;
6307
6308 for ( ; i < len; i++ ) {
6309 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6310 }
6311
6312 return map;
6313 }
6314
6315 return value !== undefined ?
6316 jQuery.style( elem, name, value ) :
6317 jQuery.css( elem, name );
6318 }, name, value, arguments.length > 1 );
6319 },
6320 show: function() {
6321 return showHide( this, true );
6322 },
6323 hide: function() {
6324 return showHide( this );
6325 },
6326 toggle: function( state ) {
6327 if ( typeof state === "boolean" ) {
6328 return state ? this.show() : this.hide();
6329 }
6330
6331 return this.each( function() {
6332 if ( isHidden( this ) ) {
6333 jQuery( this ).show();
6334 } else {
6335 jQuery( this ).hide();
6336 }
6337 } );
6338 }
6339} );
6340
6341
6342function Tween( elem, options, prop, end, easing ) {
6343 return new Tween.prototype.init( elem, options, prop, end, easing );
6344}
6345jQuery.Tween = Tween;
6346
6347Tween.prototype = {
6348 constructor: Tween,
6349 init: function( elem, options, prop, end, easing, unit ) {
6350 this.elem = elem;
6351 this.prop = prop;
6352 this.easing = easing || jQuery.easing._default;
6353 this.options = options;
6354 this.start = this.now = this.cur();
6355 this.end = end;
6356 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6357 },
6358 cur: function() {
6359 var hooks = Tween.propHooks[ this.prop ];
6360
6361 return hooks && hooks.get ?
6362 hooks.get( this ) :
6363 Tween.propHooks._default.get( this );
6364 },
6365 run: function( percent ) {
6366 var eased,
6367 hooks = Tween.propHooks[ this.prop ];
6368
6369 if ( this.options.duration ) {
6370 this.pos = eased = jQuery.easing[ this.easing ](
6371 percent, this.options.duration * percent, 0, 1, this.options.duration
6372 );
6373 } else {
6374 this.pos = eased = percent;
6375 }
6376 this.now = ( this.end - this.start ) * eased + this.start;
6377
6378 if ( this.options.step ) {
6379 this.options.step.call( this.elem, this.now, this );
6380 }
6381
6382 if ( hooks && hooks.set ) {
6383 hooks.set( this );
6384 } else {
6385 Tween.propHooks._default.set( this );
6386 }
6387 return this;
6388 }
6389};
6390
6391Tween.prototype.init.prototype = Tween.prototype;
6392
6393Tween.propHooks = {
6394 _default: {
6395 get: function( tween ) {
6396 var result;
6397
6398 // Use a property on the element directly when it is not a DOM element,
6399 // or when there is no matching style property that exists.
6400 if ( tween.elem.nodeType !== 1 ||
6401 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6402 return tween.elem[ tween.prop ];
6403 }
6404
6405 // Passing an empty string as a 3rd parameter to .css will automatically
6406 // attempt a parseFloat and fallback to a string if the parse fails.
6407 // Simple values such as "10px" are parsed to Float;
6408 // complex values such as "rotate(1rad)" are returned as-is.
6409 result = jQuery.css( tween.elem, tween.prop, "" );
6410
6411 // Empty strings, null, undefined and "auto" are converted to 0.
6412 return !result || result === "auto" ? 0 : result;
6413 },
6414 set: function( tween ) {
6415
6416 // Use step hook for back compat.
6417 // Use cssHook if its there.
6418 // Use .style if available and use plain properties where available.
6419 if ( jQuery.fx.step[ tween.prop ] ) {
6420 jQuery.fx.step[ tween.prop ]( tween );
6421 } else if ( tween.elem.nodeType === 1 &&
6422 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
6423 jQuery.cssHooks[ tween.prop ] ) ) {
6424 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6425 } else {
6426 tween.elem[ tween.prop ] = tween.now;
6427 }
6428 }
6429 }
6430};
6431
6432// Support: IE9
6433// Panic based approach to setting things on disconnected nodes
6434Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6435 set: function( tween ) {
6436 if ( tween.elem.nodeType && tween.elem.parentNode ) {
6437 tween.elem[ tween.prop ] = tween.now;
6438 }
6439 }
6440};
6441
6442jQuery.easing = {
6443 linear: function( p ) {
6444 return p;
6445 },
6446 swing: function( p ) {
6447 return 0.5 - Math.cos( p * Math.PI ) / 2;
6448 },
6449 _default: "swing"
6450};
6451
6452jQuery.fx = Tween.prototype.init;
6453
6454// Back Compat <1.8 extension point
6455jQuery.fx.step = {};
6456
6457
6458
6459
6460var
6461 fxNow, timerId,
6462 rfxtypes = /^(?:toggle|show|hide)$/,
6463 rrun = /queueHooks$/;
6464
6465// Animations created synchronously will run synchronously
6466function createFxNow() {
6467 window.setTimeout( function() {
6468 fxNow = undefined;
6469 } );
6470 return ( fxNow = jQuery.now() );
6471}
6472
6473// Generate parameters to create a standard animation
6474function genFx( type, includeWidth ) {
6475 var which,
6476 i = 0,
6477 attrs = { height: type };
6478
6479 // If we include width, step value is 1 to do all cssExpand values,
6480 // otherwise step value is 2 to skip over Left and Right
6481 includeWidth = includeWidth ? 1 : 0;
6482 for ( ; i < 4 ; i += 2 - includeWidth ) {
6483 which = cssExpand[ i ];
6484 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6485 }
6486
6487 if ( includeWidth ) {
6488 attrs.opacity = attrs.width = type;
6489 }
6490
6491 return attrs;
6492}
6493
6494function createTween( value, prop, animation ) {
6495 var tween,
6496 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6497 index = 0,
6498 length = collection.length;
6499 for ( ; index < length; index++ ) {
6500 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6501
6502 // We're done with this property
6503 return tween;
6504 }
6505 }
6506}
6507
6508function defaultPrefilter( elem, props, opts ) {
6509 /* jshint validthis: true */
6510 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
6511 anim = this,
6512 orig = {},
6513 style = elem.style,
6514 hidden = elem.nodeType && isHidden( elem ),
6515 dataShow = dataPriv.get( elem, "fxshow" );
6516
6517 // Handle queue: false promises
6518 if ( !opts.queue ) {
6519 hooks = jQuery._queueHooks( elem, "fx" );
6520 if ( hooks.unqueued == null ) {
6521 hooks.unqueued = 0;
6522 oldfire = hooks.empty.fire;
6523 hooks.empty.fire = function() {
6524 if ( !hooks.unqueued ) {
6525 oldfire();
6526 }
6527 };
6528 }
6529 hooks.unqueued++;
6530
6531 anim.always( function() {
6532
6533 // Ensure the complete handler is called before this completes
6534 anim.always( function() {
6535 hooks.unqueued--;
6536 if ( !jQuery.queue( elem, "fx" ).length ) {
6537 hooks.empty.fire();
6538 }
6539 } );
6540 } );
6541 }
6542
6543 // Height/width overflow pass
6544 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
6545
6546 // Make sure that nothing sneaks out
6547 // Record all 3 overflow attributes because IE9-10 do not
6548 // change the overflow attribute when overflowX and
6549 // overflowY are set to the same value
6550 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6551
6552 // Set display property to inline-block for height/width
6553 // animations on inline elements that are having width/height animated
6554 display = jQuery.css( elem, "display" );
6555
6556 // Test default display if display is currently "none"
6557 checkDisplay = display === "none" ?
6558 dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
6559
6560 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
6561 style.display = "inline-block";
6562 }
6563 }
6564
6565 if ( opts.overflow ) {
6566 style.overflow = "hidden";
6567 anim.always( function() {
6568 style.overflow = opts.overflow[ 0 ];
6569 style.overflowX = opts.overflow[ 1 ];
6570 style.overflowY = opts.overflow[ 2 ];
6571 } );
6572 }
6573
6574 // show/hide pass
6575 for ( prop in props ) {
6576 value = props[ prop ];
6577 if ( rfxtypes.exec( value ) ) {
6578 delete props[ prop ];
6579 toggle = toggle || value === "toggle";
6580 if ( value === ( hidden ? "hide" : "show" ) ) {
6581
6582 // If there is dataShow left over from a stopped hide or show
6583 // and we are going to proceed with show, we should pretend to be hidden
6584 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6585 hidden = true;
6586 } else {
6587 continue;
6588 }
6589 }
6590 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6591
6592 // Any non-fx value stops us from restoring the original display value
6593 } else {
6594 display = undefined;
6595 }
6596 }
6597
6598 if ( !jQuery.isEmptyObject( orig ) ) {
6599 if ( dataShow ) {
6600 if ( "hidden" in dataShow ) {
6601 hidden = dataShow.hidden;
6602 }
6603 } else {
6604 dataShow = dataPriv.access( elem, "fxshow", {} );
6605 }
6606
6607 // Store state if its toggle - enables .stop().toggle() to "reverse"
6608 if ( toggle ) {
6609 dataShow.hidden = !hidden;
6610 }
6611 if ( hidden ) {
6612 jQuery( elem ).show();
6613 } else {
6614 anim.done( function() {
6615 jQuery( elem ).hide();
6616 } );
6617 }
6618 anim.done( function() {
6619 var prop;
6620
6621 dataPriv.remove( elem, "fxshow" );
6622 for ( prop in orig ) {
6623 jQuery.style( elem, prop, orig[ prop ] );
6624 }
6625 } );
6626 for ( prop in orig ) {
6627 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
6628
6629 if ( !( prop in dataShow ) ) {
6630 dataShow[ prop ] = tween.start;
6631 if ( hidden ) {
6632 tween.end = tween.start;
6633 tween.start = prop === "width" || prop === "height" ? 1 : 0;
6634 }
6635 }
6636 }
6637
6638 // If this is a noop like .hide().hide(), restore an overwritten display value
6639 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
6640 style.display = display;
6641 }
6642}
6643
6644function propFilter( props, specialEasing ) {
6645 var index, name, easing, value, hooks;
6646
6647 // camelCase, specialEasing and expand cssHook pass
6648 for ( index in props ) {
6649 name = jQuery.camelCase( index );
6650 easing = specialEasing[ name ];
6651 value = props[ index ];
6652 if ( jQuery.isArray( value ) ) {
6653 easing = value[ 1 ];
6654 value = props[ index ] = value[ 0 ];
6655 }
6656
6657 if ( index !== name ) {
6658 props[ name ] = value;
6659 delete props[ index ];
6660 }
6661
6662 hooks = jQuery.cssHooks[ name ];
6663 if ( hooks && "expand" in hooks ) {
6664 value = hooks.expand( value );
6665 delete props[ name ];
6666
6667 // Not quite $.extend, this won't overwrite existing keys.
6668 // Reusing 'index' because we have the correct "name"
6669 for ( index in value ) {
6670 if ( !( index in props ) ) {
6671 props[ index ] = value[ index ];
6672 specialEasing[ index ] = easing;
6673 }
6674 }
6675 } else {
6676 specialEasing[ name ] = easing;
6677 }
6678 }
6679}
6680
6681function Animation( elem, properties, options ) {
6682 var result,
6683 stopped,
6684 index = 0,
6685 length = Animation.prefilters.length,
6686 deferred = jQuery.Deferred().always( function() {
6687
6688 // Don't match elem in the :animated selector
6689 delete tick.elem;
6690 } ),
6691 tick = function() {
6692 if ( stopped ) {
6693 return false;
6694 }
6695 var currentTime = fxNow || createFxNow(),
6696 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
6697
6698 // Support: Android 2.3
6699 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
6700 temp = remaining / animation.duration || 0,
6701 percent = 1 - temp,
6702 index = 0,
6703 length = animation.tweens.length;
6704
6705 for ( ; index < length ; index++ ) {
6706 animation.tweens[ index ].run( percent );
6707 }
6708
6709 deferred.notifyWith( elem, [ animation, percent, remaining ] );
6710
6711 if ( percent < 1 && length ) {
6712 return remaining;
6713 } else {
6714 deferred.resolveWith( elem, [ animation ] );
6715 return false;
6716 }
6717 },
6718 animation = deferred.promise( {
6719 elem: elem,
6720 props: jQuery.extend( {}, properties ),
6721 opts: jQuery.extend( true, {
6722 specialEasing: {},
6723 easing: jQuery.easing._default
6724 }, options ),
6725 originalProperties: properties,
6726 originalOptions: options,
6727 startTime: fxNow || createFxNow(),
6728 duration: options.duration,
6729 tweens: [],
6730 createTween: function( prop, end ) {
6731 var tween = jQuery.Tween( elem, animation.opts, prop, end,
6732 animation.opts.specialEasing[ prop ] || animation.opts.easing );
6733 animation.tweens.push( tween );
6734 return tween;
6735 },
6736 stop: function( gotoEnd ) {
6737 var index = 0,
6738
6739 // If we are going to the end, we want to run all the tweens
6740 // otherwise we skip this part
6741 length = gotoEnd ? animation.tweens.length : 0;
6742 if ( stopped ) {
6743 return this;
6744 }
6745 stopped = true;
6746 for ( ; index < length ; index++ ) {
6747 animation.tweens[ index ].run( 1 );
6748 }
6749
6750 // Resolve when we played the last frame; otherwise, reject
6751 if ( gotoEnd ) {
6752 deferred.notifyWith( elem, [ animation, 1, 0 ] );
6753 deferred.resolveWith( elem, [ animation, gotoEnd ] );
6754 } else {
6755 deferred.rejectWith( elem, [ animation, gotoEnd ] );
6756 }
6757 return this;
6758 }
6759 } ),
6760 props = animation.props;
6761
6762 propFilter( props, animation.opts.specialEasing );
6763
6764 for ( ; index < length ; index++ ) {
6765 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
6766 if ( result ) {
6767 if ( jQuery.isFunction( result.stop ) ) {
6768 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
6769 jQuery.proxy( result.stop, result );
6770 }
6771 return result;
6772 }
6773 }
6774
6775 jQuery.map( props, createTween, animation );
6776
6777 if ( jQuery.isFunction( animation.opts.start ) ) {
6778 animation.opts.start.call( elem, animation );
6779 }
6780
6781 jQuery.fx.timer(
6782 jQuery.extend( tick, {
6783 elem: elem,
6784 anim: animation,
6785 queue: animation.opts.queue
6786 } )
6787 );
6788
6789 // attach callbacks from options
6790 return animation.progress( animation.opts.progress )
6791 .done( animation.opts.done, animation.opts.complete )
6792 .fail( animation.opts.fail )
6793 .always( animation.opts.always );
6794}
6795
6796jQuery.Animation = jQuery.extend( Animation, {
6797 tweeners: {
6798 "*": [ function( prop, value ) {
6799 var tween = this.createTween( prop, value );
6800 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
6801 return tween;
6802 } ]
6803 },
6804
6805 tweener: function( props, callback ) {
6806 if ( jQuery.isFunction( props ) ) {
6807 callback = props;
6808 props = [ "*" ];
6809 } else {
6810 props = props.match( rnotwhite );
6811 }
6812
6813 var prop,
6814 index = 0,
6815 length = props.length;
6816
6817 for ( ; index < length ; index++ ) {
6818 prop = props[ index ];
6819 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
6820 Animation.tweeners[ prop ].unshift( callback );
6821 }
6822 },
6823
6824 prefilters: [ defaultPrefilter ],
6825
6826 prefilter: function( callback, prepend ) {
6827 if ( prepend ) {
6828 Animation.prefilters.unshift( callback );
6829 } else {
6830 Animation.prefilters.push( callback );
6831 }
6832 }
6833} );
6834
6835jQuery.speed = function( speed, easing, fn ) {
6836 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
6837 complete: fn || !fn && easing ||
6838 jQuery.isFunction( speed ) && speed,
6839 duration: speed,
6840 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
6841 };
6842
6843 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
6844 opt.duration : opt.duration in jQuery.fx.speeds ?
6845 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
6846
6847 // Normalize opt.queue - true/undefined/null -> "fx"
6848 if ( opt.queue == null || opt.queue === true ) {
6849 opt.queue = "fx";
6850 }
6851
6852 // Queueing
6853 opt.old = opt.complete;
6854
6855 opt.complete = function() {
6856 if ( jQuery.isFunction( opt.old ) ) {
6857 opt.old.call( this );
6858 }
6859
6860 if ( opt.queue ) {
6861 jQuery.dequeue( this, opt.queue );
6862 }
6863 };
6864
6865 return opt;
6866};
6867
6868jQuery.fn.extend( {
6869 fadeTo: function( speed, to, easing, callback ) {
6870
6871 // Show any hidden elements after setting opacity to 0
6872 return this.filter( isHidden ).css( "opacity", 0 ).show()
6873
6874 // Animate to the value specified
6875 .end().animate( { opacity: to }, speed, easing, callback );
6876 },
6877 animate: function( prop, speed, easing, callback ) {
6878 var empty = jQuery.isEmptyObject( prop ),
6879 optall = jQuery.speed( speed, easing, callback ),
6880 doAnimation = function() {
6881
6882 // Operate on a copy of prop so per-property easing won't be lost
6883 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
6884
6885 // Empty animations, or finishing resolves immediately
6886 if ( empty || dataPriv.get( this, "finish" ) ) {
6887 anim.stop( true );
6888 }
6889 };
6890 doAnimation.finish = doAnimation;
6891
6892 return empty || optall.queue === false ?
6893 this.each( doAnimation ) :
6894 this.queue( optall.queue, doAnimation );
6895 },
6896 stop: function( type, clearQueue, gotoEnd ) {
6897 var stopQueue = function( hooks ) {
6898 var stop = hooks.stop;
6899 delete hooks.stop;
6900 stop( gotoEnd );
6901 };
6902
6903 if ( typeof type !== "string" ) {
6904 gotoEnd = clearQueue;
6905 clearQueue = type;
6906 type = undefined;
6907 }
6908 if ( clearQueue && type !== false ) {
6909 this.queue( type || "fx", [] );
6910 }
6911
6912 return this.each( function() {
6913 var dequeue = true,
6914 index = type != null && type + "queueHooks",
6915 timers = jQuery.timers,
6916 data = dataPriv.get( this );
6917
6918 if ( index ) {
6919 if ( data[ index ] && data[ index ].stop ) {
6920 stopQueue( data[ index ] );
6921 }
6922 } else {
6923 for ( index in data ) {
6924 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
6925 stopQueue( data[ index ] );
6926 }
6927 }
6928 }
6929
6930 for ( index = timers.length; index--; ) {
6931 if ( timers[ index ].elem === this &&
6932 ( type == null || timers[ index ].queue === type ) ) {
6933
6934 timers[ index ].anim.stop( gotoEnd );
6935 dequeue = false;
6936 timers.splice( index, 1 );
6937 }
6938 }
6939
6940 // Start the next in the queue if the last step wasn't forced.
6941 // Timers currently will call their complete callbacks, which
6942 // will dequeue but only if they were gotoEnd.
6943 if ( dequeue || !gotoEnd ) {
6944 jQuery.dequeue( this, type );
6945 }
6946 } );
6947 },
6948 finish: function( type ) {
6949 if ( type !== false ) {
6950 type = type || "fx";
6951 }
6952 return this.each( function() {
6953 var index,
6954 data = dataPriv.get( this ),
6955 queue = data[ type + "queue" ],
6956 hooks = data[ type + "queueHooks" ],
6957 timers = jQuery.timers,
6958 length = queue ? queue.length : 0;
6959
6960 // Enable finishing flag on private data
6961 data.finish = true;
6962
6963 // Empty the queue first
6964 jQuery.queue( this, type, [] );
6965
6966 if ( hooks && hooks.stop ) {
6967 hooks.stop.call( this, true );
6968 }
6969
6970 // Look for any active animations, and finish them
6971 for ( index = timers.length; index--; ) {
6972 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
6973 timers[ index ].anim.stop( true );
6974 timers.splice( index, 1 );
6975 }
6976 }
6977
6978 // Look for any animations in the old queue and finish them
6979 for ( index = 0; index < length; index++ ) {
6980 if ( queue[ index ] && queue[ index ].finish ) {
6981 queue[ index ].finish.call( this );
6982 }
6983 }
6984
6985 // Turn off finishing flag
6986 delete data.finish;
6987 } );
6988 }
6989} );
6990
6991jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
6992 var cssFn = jQuery.fn[ name ];
6993 jQuery.fn[ name ] = function( speed, easing, callback ) {
6994 return speed == null || typeof speed === "boolean" ?
6995 cssFn.apply( this, arguments ) :
6996 this.animate( genFx( name, true ), speed, easing, callback );
6997 };
6998} );
6999
7000// Generate shortcuts for custom animations
7001jQuery.each( {
7002 slideDown: genFx( "show" ),
7003 slideUp: genFx( "hide" ),
7004 slideToggle: genFx( "toggle" ),
7005 fadeIn: { opacity: "show" },
7006 fadeOut: { opacity: "hide" },
7007 fadeToggle: { opacity: "toggle" }
7008}, function( name, props ) {
7009 jQuery.fn[ name ] = function( speed, easing, callback ) {
7010 return this.animate( props, speed, easing, callback );
7011 };
7012} );
7013
7014jQuery.timers = [];
7015jQuery.fx.tick = function() {
7016 var timer,
7017 i = 0,
7018 timers = jQuery.timers;
7019
7020 fxNow = jQuery.now();
7021
7022 for ( ; i < timers.length; i++ ) {
7023 timer = timers[ i ];
7024
7025 // Checks the timer has not already been removed
7026 if ( !timer() && timers[ i ] === timer ) {
7027 timers.splice( i--, 1 );
7028 }
7029 }
7030
7031 if ( !timers.length ) {
7032 jQuery.fx.stop();
7033 }
7034 fxNow = undefined;
7035};
7036
7037jQuery.fx.timer = function( timer ) {
7038 jQuery.timers.push( timer );
7039 if ( timer() ) {
7040 jQuery.fx.start();
7041 } else {
7042 jQuery.timers.pop();
7043 }
7044};
7045
7046jQuery.fx.interval = 13;
7047jQuery.fx.start = function() {
7048 if ( !timerId ) {
7049 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
7050 }
7051};
7052
7053jQuery.fx.stop = function() {
7054 window.clearInterval( timerId );
7055
7056 timerId = null;
7057};
7058
7059jQuery.fx.speeds = {
7060 slow: 600,
7061 fast: 200,
7062
7063 // Default speed
7064 _default: 400
7065};
7066
7067
7068// Based off of the plugin by Clint Helfers, with permission.
7069// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7070jQuery.fn.delay = function( time, type ) {
7071 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7072 type = type || "fx";
7073
7074 return this.queue( type, function( next, hooks ) {
7075 var timeout = window.setTimeout( next, time );
7076 hooks.stop = function() {
7077 window.clearTimeout( timeout );
7078 };
7079 } );
7080};
7081
7082
7083( function() {
7084 var input = document.createElement( "input" ),
7085 select = document.createElement( "select" ),
7086 opt = select.appendChild( document.createElement( "option" ) );
7087
7088 input.type = "checkbox";
7089
7090 // Support: iOS<=5.1, Android<=4.2+
7091 // Default value for a checkbox should be "on"
7092 support.checkOn = input.value !== "";
7093
7094 // Support: IE<=11+
7095 // Must access selectedIndex to make default options select
7096 support.optSelected = opt.selected;
7097
7098 // Support: Android<=2.3
7099 // Options inside disabled selects are incorrectly marked as disabled
7100 select.disabled = true;
7101 support.optDisabled = !opt.disabled;
7102
7103 // Support: IE<=11+
7104 // An input loses its value after becoming a radio
7105 input = document.createElement( "input" );
7106 input.value = "t";
7107 input.type = "radio";
7108 support.radioValue = input.value === "t";
7109} )();
7110
7111
7112var boolHook,
7113 attrHandle = jQuery.expr.attrHandle;
7114
7115jQuery.fn.extend( {
7116 attr: function( name, value ) {
7117 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7118 },
7119
7120 removeAttr: function( name ) {
7121 return this.each( function() {
7122 jQuery.removeAttr( this, name );
7123 } );
7124 }
7125} );
7126
7127jQuery.extend( {
7128 attr: function( elem, name, value ) {
7129 var ret, hooks,
7130 nType = elem.nodeType;
7131
7132 // Don't get/set attributes on text, comment and attribute nodes
7133 if ( nType === 3 || nType === 8 || nType === 2 ) {
7134 return;
7135 }
7136
7137 // Fallback to prop when attributes are not supported
7138 if ( typeof elem.getAttribute === "undefined" ) {
7139 return jQuery.prop( elem, name, value );
7140 }
7141
7142 // All attributes are lowercase
7143 // Grab necessary hook if one is defined
7144 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7145 name = name.toLowerCase();
7146 hooks = jQuery.attrHooks[ name ] ||
7147 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7148 }
7149
7150 if ( value !== undefined ) {
7151 if ( value === null ) {
7152 jQuery.removeAttr( elem, name );
7153 return;
7154 }
7155
7156 if ( hooks && "set" in hooks &&
7157 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7158 return ret;
7159 }
7160
7161 elem.setAttribute( name, value + "" );
7162 return value;
7163 }
7164
7165 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7166 return ret;
7167 }
7168
7169 ret = jQuery.find.attr( elem, name );
7170
7171 // Non-existent attributes return null, we normalize to undefined
7172 return ret == null ? undefined : ret;
7173 },
7174
7175 attrHooks: {
7176 type: {
7177 set: function( elem, value ) {
7178 if ( !support.radioValue && value === "radio" &&
7179 jQuery.nodeName( elem, "input" ) ) {
7180 var val = elem.value;
7181 elem.setAttribute( "type", value );
7182 if ( val ) {
7183 elem.value = val;
7184 }
7185 return value;
7186 }
7187 }
7188 }
7189 },
7190
7191 removeAttr: function( elem, value ) {
7192 var name, propName,
7193 i = 0,
7194 attrNames = value && value.match( rnotwhite );
7195
7196 if ( attrNames && elem.nodeType === 1 ) {
7197 while ( ( name = attrNames[ i++ ] ) ) {
7198 propName = jQuery.propFix[ name ] || name;
7199
7200 // Boolean attributes get special treatment (#10870)
7201 if ( jQuery.expr.match.bool.test( name ) ) {
7202
7203 // Set corresponding property to false
7204 elem[ propName ] = false;
7205 }
7206
7207 elem.removeAttribute( name );
7208 }
7209 }
7210 }
7211} );
7212
7213// Hooks for boolean attributes
7214boolHook = {
7215 set: function( elem, value, name ) {
7216 if ( value === false ) {
7217
7218 // Remove boolean attributes when set to false
7219 jQuery.removeAttr( elem, name );
7220 } else {
7221 elem.setAttribute( name, name );
7222 }
7223 return name;
7224 }
7225};
7226jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7227 var getter = attrHandle[ name ] || jQuery.find.attr;
7228
7229 attrHandle[ name ] = function( elem, name, isXML ) {
7230 var ret, handle;
7231 if ( !isXML ) {
7232
7233 // Avoid an infinite loop by temporarily removing this function from the getter
7234 handle = attrHandle[ name ];
7235 attrHandle[ name ] = ret;
7236 ret = getter( elem, name, isXML ) != null ?
7237 name.toLowerCase() :
7238 null;
7239 attrHandle[ name ] = handle;
7240 }
7241 return ret;
7242 };
7243} );
7244
7245
7246
7247
7248var rfocusable = /^(?:input|select|textarea|button)$/i,
7249 rclickable = /^(?:a|area)$/i;
7250
7251jQuery.fn.extend( {
7252 prop: function( name, value ) {
7253 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7254 },
7255
7256 removeProp: function( name ) {
7257 return this.each( function() {
7258 delete this[ jQuery.propFix[ name ] || name ];
7259 } );
7260 }
7261} );
7262
7263jQuery.extend( {
7264 prop: function( elem, name, value ) {
7265 var ret, hooks,
7266 nType = elem.nodeType;
7267
7268 // Don't get/set properties on text, comment and attribute nodes
7269 if ( nType === 3 || nType === 8 || nType === 2 ) {
7270 return;
7271 }
7272
7273 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7274
7275 // Fix name and attach hooks
7276 name = jQuery.propFix[ name ] || name;
7277 hooks = jQuery.propHooks[ name ];
7278 }
7279
7280 if ( value !== undefined ) {
7281 if ( hooks && "set" in hooks &&
7282 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7283 return ret;
7284 }
7285
7286 return ( elem[ name ] = value );
7287 }
7288
7289 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7290 return ret;
7291 }
7292
7293 return elem[ name ];
7294 },
7295
7296 propHooks: {
7297 tabIndex: {
7298 get: function( elem ) {
7299
7300 // elem.tabIndex doesn't always return the
7301 // correct value when it hasn't been explicitly set
7302 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7303 // Use proper attribute retrieval(#12072)
7304 var tabindex = jQuery.find.attr( elem, "tabindex" );
7305
7306 return tabindex ?
7307 parseInt( tabindex, 10 ) :
7308 rfocusable.test( elem.nodeName ) ||
7309 rclickable.test( elem.nodeName ) && elem.href ?
7310 0 :
7311 -1;
7312 }
7313 }
7314 },
7315
7316 propFix: {
7317 "for": "htmlFor",
7318 "class": "className"
7319 }
7320} );
7321
7322// Support: IE <=11 only
7323// Accessing the selectedIndex property
7324// forces the browser to respect setting selected
7325// on the option
7326// The getter ensures a default option is selected
7327// when in an optgroup
7328if ( !support.optSelected ) {
7329 jQuery.propHooks.selected = {
7330 get: function( elem ) {
7331 var parent = elem.parentNode;
7332 if ( parent && parent.parentNode ) {
7333 parent.parentNode.selectedIndex;
7334 }
7335 return null;
7336 },
7337 set: function( elem ) {
7338 var parent = elem.parentNode;
7339 if ( parent ) {
7340 parent.selectedIndex;
7341
7342 if ( parent.parentNode ) {
7343 parent.parentNode.selectedIndex;
7344 }
7345 }
7346 }
7347 };
7348}
7349
7350jQuery.each( [
7351 "tabIndex",
7352 "readOnly",
7353 "maxLength",
7354 "cellSpacing",
7355 "cellPadding",
7356 "rowSpan",
7357 "colSpan",
7358 "useMap",
7359 "frameBorder",
7360 "contentEditable"
7361], function() {
7362 jQuery.propFix[ this.toLowerCase() ] = this;
7363} );
7364
7365
7366
7367
7368var rclass = /[\t\r\n\f]/g;
7369
7370function getClass( elem ) {
7371 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7372}
7373
7374jQuery.fn.extend( {
7375 addClass: function( value ) {
7376 var classes, elem, cur, curValue, clazz, j, finalValue,
7377 i = 0;
7378
7379 if ( jQuery.isFunction( value ) ) {
7380 return this.each( function( j ) {
7381 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7382 } );
7383 }
7384
7385 if ( typeof value === "string" && value ) {
7386 classes = value.match( rnotwhite ) || [];
7387
7388 while ( ( elem = this[ i++ ] ) ) {
7389 curValue = getClass( elem );
7390 cur = elem.nodeType === 1 &&
7391 ( " " + curValue + " " ).replace( rclass, " " );
7392
7393 if ( cur ) {
7394 j = 0;
7395 while ( ( clazz = classes[ j++ ] ) ) {
7396 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7397 cur += clazz + " ";
7398 }
7399 }
7400
7401 // Only assign if different to avoid unneeded rendering.
7402 finalValue = jQuery.trim( cur );
7403 if ( curValue !== finalValue ) {
7404 elem.setAttribute( "class", finalValue );
7405 }
7406 }
7407 }
7408 }
7409
7410 return this;
7411 },
7412
7413 removeClass: function( value ) {
7414 var classes, elem, cur, curValue, clazz, j, finalValue,
7415 i = 0;
7416
7417 if ( jQuery.isFunction( value ) ) {
7418 return this.each( function( j ) {
7419 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7420 } );
7421 }
7422
7423 if ( !arguments.length ) {
7424 return this.attr( "class", "" );
7425 }
7426
7427 if ( typeof value === "string" && value ) {
7428 classes = value.match( rnotwhite ) || [];
7429
7430 while ( ( elem = this[ i++ ] ) ) {
7431 curValue = getClass( elem );
7432
7433 // This expression is here for better compressibility (see addClass)
7434 cur = elem.nodeType === 1 &&
7435 ( " " + curValue + " " ).replace( rclass, " " );
7436
7437 if ( cur ) {
7438 j = 0;
7439 while ( ( clazz = classes[ j++ ] ) ) {
7440
7441 // Remove *all* instances
7442 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7443 cur = cur.replace( " " + clazz + " ", " " );
7444 }
7445 }
7446
7447 // Only assign if different to avoid unneeded rendering.
7448 finalValue = jQuery.trim( cur );
7449 if ( curValue !== finalValue ) {
7450 elem.setAttribute( "class", finalValue );
7451 }
7452 }
7453 }
7454 }
7455
7456 return this;
7457 },
7458
7459 toggleClass: function( value, stateVal ) {
7460 var type = typeof value;
7461
7462 if ( typeof stateVal === "boolean" && type === "string" ) {
7463 return stateVal ? this.addClass( value ) : this.removeClass( value );
7464 }
7465
7466 if ( jQuery.isFunction( value ) ) {
7467 return this.each( function( i ) {
7468 jQuery( this ).toggleClass(
7469 value.call( this, i, getClass( this ), stateVal ),
7470 stateVal
7471 );
7472 } );
7473 }
7474
7475 return this.each( function() {
7476 var className, i, self, classNames;
7477
7478 if ( type === "string" ) {
7479
7480 // Toggle individual class names
7481 i = 0;
7482 self = jQuery( this );
7483 classNames = value.match( rnotwhite ) || [];
7484
7485 while ( ( className = classNames[ i++ ] ) ) {
7486
7487 // Check each className given, space separated list
7488 if ( self.hasClass( className ) ) {
7489 self.removeClass( className );
7490 } else {
7491 self.addClass( className );
7492 }
7493 }
7494
7495 // Toggle whole class name
7496 } else if ( value === undefined || type === "boolean" ) {
7497 className = getClass( this );
7498 if ( className ) {
7499
7500 // Store className if set
7501 dataPriv.set( this, "__className__", className );
7502 }
7503
7504 // If the element has a class name or if we're passed `false`,
7505 // then remove the whole classname (if there was one, the above saved it).
7506 // Otherwise bring back whatever was previously saved (if anything),
7507 // falling back to the empty string if nothing was stored.
7508 if ( this.setAttribute ) {
7509 this.setAttribute( "class",
7510 className || value === false ?
7511 "" :
7512 dataPriv.get( this, "__className__" ) || ""
7513 );
7514 }
7515 }
7516 } );
7517 },
7518
7519 hasClass: function( selector ) {
7520 var className, elem,
7521 i = 0;
7522
7523 className = " " + selector + " ";
7524 while ( ( elem = this[ i++ ] ) ) {
7525 if ( elem.nodeType === 1 &&
7526 ( " " + getClass( elem ) + " " ).replace( rclass, " " )
7527 .indexOf( className ) > -1
7528 ) {
7529 return true;
7530 }
7531 }
7532
7533 return false;
7534 }
7535} );
7536
7537
7538
7539
7540var rreturn = /\r/g,
7541 rspaces = /[\x20\t\r\n\f]+/g;
7542
7543jQuery.fn.extend( {
7544 val: function( value ) {
7545 var hooks, ret, isFunction,
7546 elem = this[ 0 ];
7547
7548 if ( !arguments.length ) {
7549 if ( elem ) {
7550 hooks = jQuery.valHooks[ elem.type ] ||
7551 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7552
7553 if ( hooks &&
7554 "get" in hooks &&
7555 ( ret = hooks.get( elem, "value" ) ) !== undefined
7556 ) {
7557 return ret;
7558 }
7559
7560 ret = elem.value;
7561
7562 return typeof ret === "string" ?
7563
7564 // Handle most common string cases
7565 ret.replace( rreturn, "" ) :
7566
7567 // Handle cases where value is null/undef or number
7568 ret == null ? "" : ret;
7569 }
7570
7571 return;
7572 }
7573
7574 isFunction = jQuery.isFunction( value );
7575
7576 return this.each( function( i ) {
7577 var val;
7578
7579 if ( this.nodeType !== 1 ) {
7580 return;
7581 }
7582
7583 if ( isFunction ) {
7584 val = value.call( this, i, jQuery( this ).val() );
7585 } else {
7586 val = value;
7587 }
7588
7589 // Treat null/undefined as ""; convert numbers to string
7590 if ( val == null ) {
7591 val = "";
7592
7593 } else if ( typeof val === "number" ) {
7594 val += "";
7595
7596 } else if ( jQuery.isArray( val ) ) {
7597 val = jQuery.map( val, function( value ) {
7598 return value == null ? "" : value + "";
7599 } );
7600 }
7601
7602 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7603
7604 // If set returns undefined, fall back to normal setting
7605 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7606 this.value = val;
7607 }
7608 } );
7609 }
7610} );
7611
7612jQuery.extend( {
7613 valHooks: {
7614 option: {
7615 get: function( elem ) {
7616
7617 var val = jQuery.find.attr( elem, "value" );
7618 return val != null ?
7619 val :
7620
7621 // Support: IE10-11+
7622 // option.text throws exceptions (#14686, #14858)
7623 // Strip and collapse whitespace
7624 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
7625 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
7626 }
7627 },
7628 select: {
7629 get: function( elem ) {
7630 var value, option,
7631 options = elem.options,
7632 index = elem.selectedIndex,
7633 one = elem.type === "select-one" || index < 0,
7634 values = one ? null : [],
7635 max = one ? index + 1 : options.length,
7636 i = index < 0 ?
7637 max :
7638 one ? index : 0;
7639
7640 // Loop through all the selected options
7641 for ( ; i < max; i++ ) {
7642 option = options[ i ];
7643
7644 // IE8-9 doesn't update selected after form reset (#2551)
7645 if ( ( option.selected || i === index ) &&
7646
7647 // Don't return options that are disabled or in a disabled optgroup
7648 ( support.optDisabled ?
7649 !option.disabled : option.getAttribute( "disabled" ) === null ) &&
7650 ( !option.parentNode.disabled ||
7651 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
7652
7653 // Get the specific value for the option
7654 value = jQuery( option ).val();
7655
7656 // We don't need an array for one selects
7657 if ( one ) {
7658 return value;
7659 }
7660
7661 // Multi-Selects return an array
7662 values.push( value );
7663 }
7664 }
7665
7666 return values;
7667 },
7668
7669 set: function( elem, value ) {
7670 var optionSet, option,
7671 options = elem.options,
7672 values = jQuery.makeArray( value ),
7673 i = options.length;
7674
7675 while ( i-- ) {
7676 option = options[ i ];
7677 if ( option.selected =
7678 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
7679 ) {
7680 optionSet = true;
7681 }
7682 }
7683
7684 // Force browsers to behave consistently when non-matching value is set
7685 if ( !optionSet ) {
7686 elem.selectedIndex = -1;
7687 }
7688 return values;
7689 }
7690 }
7691 }
7692} );
7693
7694// Radios and checkboxes getter/setter
7695jQuery.each( [ "radio", "checkbox" ], function() {
7696 jQuery.valHooks[ this ] = {
7697 set: function( elem, value ) {
7698 if ( jQuery.isArray( value ) ) {
7699 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
7700 }
7701 }
7702 };
7703 if ( !support.checkOn ) {
7704 jQuery.valHooks[ this ].get = function( elem ) {
7705 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
7706 };
7707 }
7708} );
7709
7710
7711
7712
7713// Return jQuery for attributes-only inclusion
7714
7715
7716var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
7717
7718jQuery.extend( jQuery.event, {
7719
7720 trigger: function( event, data, elem, onlyHandlers ) {
7721
7722 var i, cur, tmp, bubbleType, ontype, handle, special,
7723 eventPath = [ elem || document ],
7724 type = hasOwn.call( event, "type" ) ? event.type : event,
7725 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
7726
7727 cur = tmp = elem = elem || document;
7728
7729 // Don't do events on text and comment nodes
7730 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
7731 return;
7732 }
7733
7734 // focus/blur morphs to focusin/out; ensure we're not firing them right now
7735 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
7736 return;
7737 }
7738
7739 if ( type.indexOf( "." ) > -1 ) {
7740
7741 // Namespaced trigger; create a regexp to match event type in handle()
7742 namespaces = type.split( "." );
7743 type = namespaces.shift();
7744 namespaces.sort();
7745 }
7746 ontype = type.indexOf( ":" ) < 0 && "on" + type;
7747
7748 // Caller can pass in a jQuery.Event object, Object, or just an event type string
7749 event = event[ jQuery.expando ] ?
7750 event :
7751 new jQuery.Event( type, typeof event === "object" && event );
7752
7753 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
7754 event.isTrigger = onlyHandlers ? 2 : 3;
7755 event.namespace = namespaces.join( "." );
7756 event.rnamespace = event.namespace ?
7757 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
7758 null;
7759
7760 // Clean up the event in case it is being reused
7761 event.result = undefined;
7762 if ( !event.target ) {
7763 event.target = elem;
7764 }
7765
7766 // Clone any incoming data and prepend the event, creating the handler arg list
7767 data = data == null ?
7768 [ event ] :
7769 jQuery.makeArray( data, [ event ] );
7770
7771 // Allow special events to draw outside the lines
7772 special = jQuery.event.special[ type ] || {};
7773 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
7774 return;
7775 }
7776
7777 // Determine event propagation path in advance, per W3C events spec (#9951)
7778 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
7779 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
7780
7781 bubbleType = special.delegateType || type;
7782 if ( !rfocusMorph.test( bubbleType + type ) ) {
7783 cur = cur.parentNode;
7784 }
7785 for ( ; cur; cur = cur.parentNode ) {
7786 eventPath.push( cur );
7787 tmp = cur;
7788 }
7789
7790 // Only add window if we got to document (e.g., not plain obj or detached DOM)
7791 if ( tmp === ( elem.ownerDocument || document ) ) {
7792 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
7793 }
7794 }
7795
7796 // Fire handlers on the event path
7797 i = 0;
7798 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
7799
7800 event.type = i > 1 ?
7801 bubbleType :
7802 special.bindType || type;
7803
7804 // jQuery handler
7805 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
7806 dataPriv.get( cur, "handle" );
7807 if ( handle ) {
7808 handle.apply( cur, data );
7809 }
7810
7811 // Native handler
7812 handle = ontype && cur[ ontype ];
7813 if ( handle && handle.apply && acceptData( cur ) ) {
7814 event.result = handle.apply( cur, data );
7815 if ( event.result === false ) {
7816 event.preventDefault();
7817 }
7818 }
7819 }
7820 event.type = type;
7821
7822 // If nobody prevented the default action, do it now
7823 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
7824
7825 if ( ( !special._default ||
7826 special._default.apply( eventPath.pop(), data ) === false ) &&
7827 acceptData( elem ) ) {
7828
7829 // Call a native DOM method on the target with the same name name as the event.
7830 // Don't do default actions on window, that's where global variables be (#6170)
7831 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
7832
7833 // Don't re-trigger an onFOO event when we call its FOO() method
7834 tmp = elem[ ontype ];
7835
7836 if ( tmp ) {
7837 elem[ ontype ] = null;
7838 }
7839
7840 // Prevent re-triggering of the same event, since we already bubbled it above
7841 jQuery.event.triggered = type;
7842 elem[ type ]();
7843 jQuery.event.triggered = undefined;
7844
7845 if ( tmp ) {
7846 elem[ ontype ] = tmp;
7847 }
7848 }
7849 }
7850 }
7851
7852 return event.result;
7853 },
7854
7855 // Piggyback on a donor event to simulate a different one
7856 // Used only for `focus(in | out)` events
7857 simulate: function( type, elem, event ) {
7858 var e = jQuery.extend(
7859 new jQuery.Event(),
7860 event,
7861 {
7862 type: type,
7863 isSimulated: true
7864 }
7865 );
7866
7867 jQuery.event.trigger( e, null, elem );
7868 }
7869
7870} );
7871
7872jQuery.fn.extend( {
7873
7874 trigger: function( type, data ) {
7875 return this.each( function() {
7876 jQuery.event.trigger( type, data, this );
7877 } );
7878 },
7879 triggerHandler: function( type, data ) {
7880 var elem = this[ 0 ];
7881 if ( elem ) {
7882 return jQuery.event.trigger( type, data, elem, true );
7883 }
7884 }
7885} );
7886
7887
7888jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
7889 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
7890 "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
7891 function( i, name ) {
7892
7893 // Handle event binding
7894 jQuery.fn[ name ] = function( data, fn ) {
7895 return arguments.length > 0 ?
7896 this.on( name, null, data, fn ) :
7897 this.trigger( name );
7898 };
7899} );
7900
7901jQuery.fn.extend( {
7902 hover: function( fnOver, fnOut ) {
7903 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
7904 }
7905} );
7906
7907
7908
7909
7910support.focusin = "onfocusin" in window;
7911
7912
7913// Support: Firefox
7914// Firefox doesn't have focus(in | out) events
7915// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
7916//
7917// Support: Chrome, Safari
7918// focus(in | out) events fire after focus & blur events,
7919// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
7920// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
7921if ( !support.focusin ) {
7922 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
7923
7924 // Attach a single capturing handler on the document while someone wants focusin/focusout
7925 var handler = function( event ) {
7926 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
7927 };
7928
7929 jQuery.event.special[ fix ] = {
7930 setup: function() {
7931 var doc = this.ownerDocument || this,
7932 attaches = dataPriv.access( doc, fix );
7933
7934 if ( !attaches ) {
7935 doc.addEventListener( orig, handler, true );
7936 }
7937 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
7938 },
7939 teardown: function() {
7940 var doc = this.ownerDocument || this,
7941 attaches = dataPriv.access( doc, fix ) - 1;
7942
7943 if ( !attaches ) {
7944 doc.removeEventListener( orig, handler, true );
7945 dataPriv.remove( doc, fix );
7946
7947 } else {
7948 dataPriv.access( doc, fix, attaches );
7949 }
7950 }
7951 };
7952 } );
7953}
7954var location = window.location;
7955
7956var nonce = jQuery.now();
7957
7958var rquery = ( /\?/ );
7959
7960
7961
7962// Support: Android 2.3
7963// Workaround failure to string-cast null input
7964jQuery.parseJSON = function( data ) {
7965 return JSON.parse( data + "" );
7966};
7967
7968
7969// Cross-browser xml parsing
7970jQuery.parseXML = function( data ) {
7971 var xml;
7972 if ( !data || typeof data !== "string" ) {
7973 return null;
7974 }
7975
7976 // Support: IE9
7977 try {
7978 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
7979 } catch ( e ) {
7980 xml = undefined;
7981 }
7982
7983 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
7984 jQuery.error( "Invalid XML: " + data );
7985 }
7986 return xml;
7987};
7988
7989
7990var
7991 rhash = /#.*$/,
7992 rts = /([?&])_=[^&]*/,
7993 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
7994
7995 // #7653, #8125, #8152: local protocol detection
7996 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
7997 rnoContent = /^(?:GET|HEAD)$/,
7998 rprotocol = /^\/\//,
7999
8000 /* Prefilters
8001 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8002 * 2) These are called:
8003 * - BEFORE asking for a transport
8004 * - AFTER param serialization (s.data is a string if s.processData is true)
8005 * 3) key is the dataType
8006 * 4) the catchall symbol "*" can be used
8007 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8008 */
8009 prefilters = {},
8010
8011 /* Transports bindings
8012 * 1) key is the dataType
8013 * 2) the catchall symbol "*" can be used
8014 * 3) selection will start with transport dataType and THEN go to "*" if needed
8015 */
8016 transports = {},
8017
8018 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8019 allTypes = "*/".concat( "*" ),
8020
8021 // Anchor tag for parsing the document origin
8022 originAnchor = document.createElement( "a" );
8023 originAnchor.href = location.href;
8024
8025// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8026function addToPrefiltersOrTransports( structure ) {
8027
8028 // dataTypeExpression is optional and defaults to "*"
8029 return function( dataTypeExpression, func ) {
8030
8031 if ( typeof dataTypeExpression !== "string" ) {
8032 func = dataTypeExpression;
8033 dataTypeExpression = "*";
8034 }
8035
8036 var dataType,
8037 i = 0,
8038 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
8039
8040 if ( jQuery.isFunction( func ) ) {
8041
8042 // For each dataType in the dataTypeExpression
8043 while ( ( dataType = dataTypes[ i++ ] ) ) {
8044
8045 // Prepend if requested
8046 if ( dataType[ 0 ] === "+" ) {
8047 dataType = dataType.slice( 1 ) || "*";
8048 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8049
8050 // Otherwise append
8051 } else {
8052 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8053 }
8054 }
8055 }
8056 };
8057}
8058
8059// Base inspection function for prefilters and transports
8060function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8061
8062 var inspected = {},
8063 seekingTransport = ( structure === transports );
8064
8065 function inspect( dataType ) {
8066 var selected;
8067 inspected[ dataType ] = true;
8068 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8069 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8070 if ( typeof dataTypeOrTransport === "string" &&
8071 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8072
8073 options.dataTypes.unshift( dataTypeOrTransport );
8074 inspect( dataTypeOrTransport );
8075 return false;
8076 } else if ( seekingTransport ) {
8077 return !( selected = dataTypeOrTransport );
8078 }
8079 } );
8080 return selected;
8081 }
8082
8083 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8084}
8085
8086// A special extend for ajax options
8087// that takes "flat" options (not to be deep extended)
8088// Fixes #9887
8089function ajaxExtend( target, src ) {
8090 var key, deep,
8091 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8092
8093 for ( key in src ) {
8094 if ( src[ key ] !== undefined ) {
8095 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8096 }
8097 }
8098 if ( deep ) {
8099 jQuery.extend( true, target, deep );
8100 }
8101
8102 return target;
8103}
8104
8105/* Handles responses to an ajax request:
8106 * - finds the right dataType (mediates between content-type and expected dataType)
8107 * - returns the corresponding response
8108 */
8109function ajaxHandleResponses( s, jqXHR, responses ) {
8110
8111 var ct, type, finalDataType, firstDataType,
8112 contents = s.contents,
8113 dataTypes = s.dataTypes;
8114
8115 // Remove auto dataType and get content-type in the process
8116 while ( dataTypes[ 0 ] === "*" ) {
8117 dataTypes.shift();
8118 if ( ct === undefined ) {
8119 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8120 }
8121 }
8122
8123 // Check if we're dealing with a known content-type
8124 if ( ct ) {
8125 for ( type in contents ) {
8126 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8127 dataTypes.unshift( type );
8128 break;
8129 }
8130 }
8131 }
8132
8133 // Check to see if we have a response for the expected dataType
8134 if ( dataTypes[ 0 ] in responses ) {
8135 finalDataType = dataTypes[ 0 ];
8136 } else {
8137
8138 // Try convertible dataTypes
8139 for ( type in responses ) {
8140 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8141 finalDataType = type;
8142 break;
8143 }
8144 if ( !firstDataType ) {
8145 firstDataType = type;
8146 }
8147 }
8148
8149 // Or just use first one
8150 finalDataType = finalDataType || firstDataType;
8151 }
8152
8153 // If we found a dataType
8154 // We add the dataType to the list if needed
8155 // and return the corresponding response
8156 if ( finalDataType ) {
8157 if ( finalDataType !== dataTypes[ 0 ] ) {
8158 dataTypes.unshift( finalDataType );
8159 }
8160 return responses[ finalDataType ];
8161 }
8162}
8163
8164/* Chain conversions given the request and the original response
8165 * Also sets the responseXXX fields on the jqXHR instance
8166 */
8167function ajaxConvert( s, response, jqXHR, isSuccess ) {
8168 var conv2, current, conv, tmp, prev,
8169 converters = {},
8170
8171 // Work with a copy of dataTypes in case we need to modify it for conversion
8172 dataTypes = s.dataTypes.slice();
8173
8174 // Create converters map with lowercased keys
8175 if ( dataTypes[ 1 ] ) {
8176 for ( conv in s.converters ) {
8177 converters[ conv.toLowerCase() ] = s.converters[ conv ];
8178 }
8179 }
8180
8181 current = dataTypes.shift();
8182
8183 // Convert to each sequential dataType
8184 while ( current ) {
8185
8186 if ( s.responseFields[ current ] ) {
8187 jqXHR[ s.responseFields[ current ] ] = response;
8188 }
8189
8190 // Apply the dataFilter if provided
8191 if ( !prev && isSuccess && s.dataFilter ) {
8192 response = s.dataFilter( response, s.dataType );
8193 }
8194
8195 prev = current;
8196 current = dataTypes.shift();
8197
8198 if ( current ) {
8199
8200 // There's only work to do if current dataType is non-auto
8201 if ( current === "*" ) {
8202
8203 current = prev;
8204
8205 // Convert response if prev dataType is non-auto and differs from current
8206 } else if ( prev !== "*" && prev !== current ) {
8207
8208 // Seek a direct converter
8209 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8210
8211 // If none found, seek a pair
8212 if ( !conv ) {
8213 for ( conv2 in converters ) {
8214
8215 // If conv2 outputs current
8216 tmp = conv2.split( " " );
8217 if ( tmp[ 1 ] === current ) {
8218
8219 // If prev can be converted to accepted input
8220 conv = converters[ prev + " " + tmp[ 0 ] ] ||
8221 converters[ "* " + tmp[ 0 ] ];
8222 if ( conv ) {
8223
8224 // Condense equivalence converters
8225 if ( conv === true ) {
8226 conv = converters[ conv2 ];
8227
8228 // Otherwise, insert the intermediate dataType
8229 } else if ( converters[ conv2 ] !== true ) {
8230 current = tmp[ 0 ];
8231 dataTypes.unshift( tmp[ 1 ] );
8232 }
8233 break;
8234 }
8235 }
8236 }
8237 }
8238
8239 // Apply converter (if not an equivalence)
8240 if ( conv !== true ) {
8241
8242 // Unless errors are allowed to bubble, catch and return them
8243 if ( conv && s.throws ) {
8244 response = conv( response );
8245 } else {
8246 try {
8247 response = conv( response );
8248 } catch ( e ) {
8249 return {
8250 state: "parsererror",
8251 error: conv ? e : "No conversion from " + prev + " to " + current
8252 };
8253 }
8254 }
8255 }
8256 }
8257 }
8258 }
8259
8260 return { state: "success", data: response };
8261}
8262
8263jQuery.extend( {
8264
8265 // Counter for holding the number of active queries
8266 active: 0,
8267
8268 // Last-Modified header cache for next request
8269 lastModified: {},
8270 etag: {},
8271
8272 ajaxSettings: {
8273 url: location.href,
8274 type: "GET",
8275 isLocal: rlocalProtocol.test( location.protocol ),
8276 global: true,
8277 processData: true,
8278 async: true,
8279 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8280 /*
8281 timeout: 0,
8282 data: null,
8283 dataType: null,
8284 username: null,
8285 password: null,
8286 cache: null,
8287 throws: false,
8288 traditional: false,
8289 headers: {},
8290 */
8291
8292 accepts: {
8293 "*": allTypes,
8294 text: "text/plain",
8295 html: "text/html",
8296 xml: "application/xml, text/xml",
8297 json: "application/json, text/javascript"
8298 },
8299
8300 contents: {
8301 xml: /\bxml\b/,
8302 html: /\bhtml/,
8303 json: /\bjson\b/
8304 },
8305
8306 responseFields: {
8307 xml: "responseXML",
8308 text: "responseText",
8309 json: "responseJSON"
8310 },
8311
8312 // Data converters
8313 // Keys separate source (or catchall "*") and destination types with a single space
8314 converters: {
8315
8316 // Convert anything to text
8317 "* text": String,
8318
8319 // Text to html (true = no transformation)
8320 "text html": true,
8321
8322 // Evaluate text as a json expression
8323 "text json": jQuery.parseJSON,
8324
8325 // Parse text as xml
8326 "text xml": jQuery.parseXML
8327 },
8328
8329 // For options that shouldn't be deep extended:
8330 // you can add your own custom options here if
8331 // and when you create one that shouldn't be
8332 // deep extended (see ajaxExtend)
8333 flatOptions: {
8334 url: true,
8335 context: true
8336 }
8337 },
8338
8339 // Creates a full fledged settings object into target
8340 // with both ajaxSettings and settings fields.
8341 // If target is omitted, writes into ajaxSettings.
8342 ajaxSetup: function( target, settings ) {
8343 return settings ?
8344
8345 // Building a settings object
8346 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8347
8348 // Extending ajaxSettings
8349 ajaxExtend( jQuery.ajaxSettings, target );
8350 },
8351
8352 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8353 ajaxTransport: addToPrefiltersOrTransports( transports ),
8354
8355 // Main method
8356 ajax: function( url, options ) {
8357
8358 // If url is an object, simulate pre-1.5 signature
8359 if ( typeof url === "object" ) {
8360 options = url;
8361 url = undefined;
8362 }
8363
8364 // Force options to be an object
8365 options = options || {};
8366
8367 var transport,
8368
8369 // URL without anti-cache param
8370 cacheURL,
8371
8372 // Response headers
8373 responseHeadersString,
8374 responseHeaders,
8375
8376 // timeout handle
8377 timeoutTimer,
8378
8379 // Url cleanup var
8380 urlAnchor,
8381
8382 // To know if global events are to be dispatched
8383 fireGlobals,
8384
8385 // Loop variable
8386 i,
8387
8388 // Create the final options object
8389 s = jQuery.ajaxSetup( {}, options ),
8390
8391 // Callbacks context
8392 callbackContext = s.context || s,
8393
8394 // Context for global events is callbackContext if it is a DOM node or jQuery collection
8395 globalEventContext = s.context &&
8396 ( callbackContext.nodeType || callbackContext.jquery ) ?
8397 jQuery( callbackContext ) :
8398 jQuery.event,
8399
8400 // Deferreds
8401 deferred = jQuery.Deferred(),
8402 completeDeferred = jQuery.Callbacks( "once memory" ),
8403
8404 // Status-dependent callbacks
8405 statusCode = s.statusCode || {},
8406
8407 // Headers (they are sent all at once)
8408 requestHeaders = {},
8409 requestHeadersNames = {},
8410
8411 // The jqXHR state
8412 state = 0,
8413
8414 // Default abort message
8415 strAbort = "canceled",
8416
8417 // Fake xhr
8418 jqXHR = {
8419 readyState: 0,
8420
8421 // Builds headers hashtable if needed
8422 getResponseHeader: function( key ) {
8423 var match;
8424 if ( state === 2 ) {
8425 if ( !responseHeaders ) {
8426 responseHeaders = {};
8427 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
8428 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
8429 }
8430 }
8431 match = responseHeaders[ key.toLowerCase() ];
8432 }
8433 return match == null ? null : match;
8434 },
8435
8436 // Raw string
8437 getAllResponseHeaders: function() {
8438 return state === 2 ? responseHeadersString : null;
8439 },
8440
8441 // Caches the header
8442 setRequestHeader: function( name, value ) {
8443 var lname = name.toLowerCase();
8444 if ( !state ) {
8445 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
8446 requestHeaders[ name ] = value;
8447 }
8448 return this;
8449 },
8450
8451 // Overrides response content-type header
8452 overrideMimeType: function( type ) {
8453 if ( !state ) {
8454 s.mimeType = type;
8455 }
8456 return this;
8457 },
8458
8459 // Status-dependent callbacks
8460 statusCode: function( map ) {
8461 var code;
8462 if ( map ) {
8463 if ( state < 2 ) {
8464 for ( code in map ) {
8465
8466 // Lazy-add the new callback in a way that preserves old ones
8467 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
8468 }
8469 } else {
8470
8471 // Execute the appropriate callbacks
8472 jqXHR.always( map[ jqXHR.status ] );
8473 }
8474 }
8475 return this;
8476 },
8477
8478 // Cancel the request
8479 abort: function( statusText ) {
8480 var finalText = statusText || strAbort;
8481 if ( transport ) {
8482 transport.abort( finalText );
8483 }
8484 done( 0, finalText );
8485 return this;
8486 }
8487 };
8488
8489 // Attach deferreds
8490 deferred.promise( jqXHR ).complete = completeDeferred.add;
8491 jqXHR.success = jqXHR.done;
8492 jqXHR.error = jqXHR.fail;
8493
8494 // Remove hash character (#7531: and string promotion)
8495 // Add protocol if not provided (prefilters might expect it)
8496 // Handle falsy url in the settings object (#10093: consistency with old signature)
8497 // We also use the url parameter if available
8498 s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
8499 .replace( rprotocol, location.protocol + "//" );
8500
8501 // Alias method option to type as per ticket #12004
8502 s.type = options.method || options.type || s.method || s.type;
8503
8504 // Extract dataTypes list
8505 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
8506
8507 // A cross-domain request is in order when the origin doesn't match the current origin.
8508 if ( s.crossDomain == null ) {
8509 urlAnchor = document.createElement( "a" );
8510
8511 // Support: IE8-11+
8512 // IE throws exception if url is malformed, e.g. http://example.com:80x/
8513 try {
8514 urlAnchor.href = s.url;
8515
8516 // Support: IE8-11+
8517 // Anchor's host property isn't correctly set when s.url is relative
8518 urlAnchor.href = urlAnchor.href;
8519 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
8520 urlAnchor.protocol + "//" + urlAnchor.host;
8521 } catch ( e ) {
8522
8523 // If there is an error parsing the URL, assume it is crossDomain,
8524 // it can be rejected by the transport if it is invalid
8525 s.crossDomain = true;
8526 }
8527 }
8528
8529 // Convert data if not already a string
8530 if ( s.data && s.processData && typeof s.data !== "string" ) {
8531 s.data = jQuery.param( s.data, s.traditional );
8532 }
8533
8534 // Apply prefilters
8535 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
8536
8537 // If request was aborted inside a prefilter, stop there
8538 if ( state === 2 ) {
8539 return jqXHR;
8540 }
8541
8542 // We can fire global events as of now if asked to
8543 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
8544 fireGlobals = jQuery.event && s.global;
8545
8546 // Watch for a new set of requests
8547 if ( fireGlobals && jQuery.active++ === 0 ) {
8548 jQuery.event.trigger( "ajaxStart" );
8549 }
8550
8551 // Uppercase the type
8552 s.type = s.type.toUpperCase();
8553
8554 // Determine if request has content
8555 s.hasContent = !rnoContent.test( s.type );
8556
8557 // Save the URL in case we're toying with the If-Modified-Since
8558 // and/or If-None-Match header later on
8559 cacheURL = s.url;
8560
8561 // More options handling for requests with no content
8562 if ( !s.hasContent ) {
8563
8564 // If data is available, append data to url
8565 if ( s.data ) {
8566 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
8567
8568 // #9682: remove data so that it's not used in an eventual retry
8569 delete s.data;
8570 }
8571
8572 // Add anti-cache in url if needed
8573 if ( s.cache === false ) {
8574 s.url = rts.test( cacheURL ) ?
8575
8576 // If there is already a '_' parameter, set its value
8577 cacheURL.replace( rts, "$1_=" + nonce++ ) :
8578
8579 // Otherwise add one to the end
8580 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
8581 }
8582 }
8583
8584 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8585 if ( s.ifModified ) {
8586 if ( jQuery.lastModified[ cacheURL ] ) {
8587 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
8588 }
8589 if ( jQuery.etag[ cacheURL ] ) {
8590 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
8591 }
8592 }
8593
8594 // Set the correct header, if data is being sent
8595 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
8596 jqXHR.setRequestHeader( "Content-Type", s.contentType );
8597 }
8598
8599 // Set the Accepts header for the server, depending on the dataType
8600 jqXHR.setRequestHeader(
8601 "Accept",
8602 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
8603 s.accepts[ s.dataTypes[ 0 ] ] +
8604 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
8605 s.accepts[ "*" ]
8606 );
8607
8608 // Check for headers option
8609 for ( i in s.headers ) {
8610 jqXHR.setRequestHeader( i, s.headers[ i ] );
8611 }
8612
8613 // Allow custom headers/mimetypes and early abort
8614 if ( s.beforeSend &&
8615 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
8616
8617 // Abort if not done already and return
8618 return jqXHR.abort();
8619 }
8620
8621 // Aborting is no longer a cancellation
8622 strAbort = "abort";
8623
8624 // Install callbacks on deferreds
8625 for ( i in { success: 1, error: 1, complete: 1 } ) {
8626 jqXHR[ i ]( s[ i ] );
8627 }
8628
8629 // Get transport
8630 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
8631
8632 // If no transport, we auto-abort
8633 if ( !transport ) {
8634 done( -1, "No Transport" );
8635 } else {
8636 jqXHR.readyState = 1;
8637
8638 // Send global event
8639 if ( fireGlobals ) {
8640 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
8641 }
8642
8643 // If request was aborted inside ajaxSend, stop there
8644 if ( state === 2 ) {
8645 return jqXHR;
8646 }
8647
8648 // Timeout
8649 if ( s.async && s.timeout > 0 ) {
8650 timeoutTimer = window.setTimeout( function() {
8651 jqXHR.abort( "timeout" );
8652 }, s.timeout );
8653 }
8654
8655 try {
8656 state = 1;
8657 transport.send( requestHeaders, done );
8658 } catch ( e ) {
8659
8660 // Propagate exception as error if not done
8661 if ( state < 2 ) {
8662 done( -1, e );
8663
8664 // Simply rethrow otherwise
8665 } else {
8666 throw e;
8667 }
8668 }
8669 }
8670
8671 // Callback for when everything is done
8672 function done( status, nativeStatusText, responses, headers ) {
8673 var isSuccess, success, error, response, modified,
8674 statusText = nativeStatusText;
8675
8676 // Called once
8677 if ( state === 2 ) {
8678 return;
8679 }
8680
8681 // State is "done" now
8682 state = 2;
8683
8684 // Clear timeout if it exists
8685 if ( timeoutTimer ) {
8686 window.clearTimeout( timeoutTimer );
8687 }
8688
8689 // Dereference transport for early garbage collection
8690 // (no matter how long the jqXHR object will be used)
8691 transport = undefined;
8692
8693 // Cache response headers
8694 responseHeadersString = headers || "";
8695
8696 // Set readyState
8697 jqXHR.readyState = status > 0 ? 4 : 0;
8698
8699 // Determine if successful
8700 isSuccess = status >= 200 && status < 300 || status === 304;
8701
8702 // Get response data
8703 if ( responses ) {
8704 response = ajaxHandleResponses( s, jqXHR, responses );
8705 }
8706
8707 // Convert no matter what (that way responseXXX fields are always set)
8708 response = ajaxConvert( s, response, jqXHR, isSuccess );
8709
8710 // If successful, handle type chaining
8711 if ( isSuccess ) {
8712
8713 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8714 if ( s.ifModified ) {
8715 modified = jqXHR.getResponseHeader( "Last-Modified" );
8716 if ( modified ) {
8717 jQuery.lastModified[ cacheURL ] = modified;
8718 }
8719 modified = jqXHR.getResponseHeader( "etag" );
8720 if ( modified ) {
8721 jQuery.etag[ cacheURL ] = modified;
8722 }
8723 }
8724
8725 // if no content
8726 if ( status === 204 || s.type === "HEAD" ) {
8727 statusText = "nocontent";
8728
8729 // if not modified
8730 } else if ( status === 304 ) {
8731 statusText = "notmodified";
8732
8733 // If we have data, let's convert it
8734 } else {
8735 statusText = response.state;
8736 success = response.data;
8737 error = response.error;
8738 isSuccess = !error;
8739 }
8740 } else {
8741
8742 // Extract error from statusText and normalize for non-aborts
8743 error = statusText;
8744 if ( status || !statusText ) {
8745 statusText = "error";
8746 if ( status < 0 ) {
8747 status = 0;
8748 }
8749 }
8750 }
8751
8752 // Set data for the fake xhr object
8753 jqXHR.status = status;
8754 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
8755
8756 // Success/Error
8757 if ( isSuccess ) {
8758 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
8759 } else {
8760 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
8761 }
8762
8763 // Status-dependent callbacks
8764 jqXHR.statusCode( statusCode );
8765 statusCode = undefined;
8766
8767 if ( fireGlobals ) {
8768 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
8769 [ jqXHR, s, isSuccess ? success : error ] );
8770 }
8771
8772 // Complete
8773 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
8774
8775 if ( fireGlobals ) {
8776 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
8777
8778 // Handle the global AJAX counter
8779 if ( !( --jQuery.active ) ) {
8780 jQuery.event.trigger( "ajaxStop" );
8781 }
8782 }
8783 }
8784
8785 return jqXHR;
8786 },
8787
8788 getJSON: function( url, data, callback ) {
8789 return jQuery.get( url, data, callback, "json" );
8790 },
8791
8792 getScript: function( url, callback ) {
8793 return jQuery.get( url, undefined, callback, "script" );
8794 }
8795} );
8796
8797jQuery.each( [ "get", "post" ], function( i, method ) {
8798 jQuery[ method ] = function( url, data, callback, type ) {
8799
8800 // Shift arguments if data argument was omitted
8801 if ( jQuery.isFunction( data ) ) {
8802 type = type || callback;
8803 callback = data;
8804 data = undefined;
8805 }
8806
8807 // The url can be an options object (which then must have .url)
8808 return jQuery.ajax( jQuery.extend( {
8809 url: url,
8810 type: method,
8811 dataType: type,
8812 data: data,
8813 success: callback
8814 }, jQuery.isPlainObject( url ) && url ) );
8815 };
8816} );
8817
8818
8819jQuery._evalUrl = function( url ) {
8820 return jQuery.ajax( {
8821 url: url,
8822
8823 // Make this explicit, since user can override this through ajaxSetup (#11264)
8824 type: "GET",
8825 dataType: "script",
8826 async: false,
8827 global: false,
8828 "throws": true
8829 } );
8830};
8831
8832
8833jQuery.fn.extend( {
8834 wrapAll: function( html ) {
8835 var wrap;
8836
8837 if ( jQuery.isFunction( html ) ) {
8838 return this.each( function( i ) {
8839 jQuery( this ).wrapAll( html.call( this, i ) );
8840 } );
8841 }
8842
8843 if ( this[ 0 ] ) {
8844
8845 // The elements to wrap the target around
8846 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
8847
8848 if ( this[ 0 ].parentNode ) {
8849 wrap.insertBefore( this[ 0 ] );
8850 }
8851
8852 wrap.map( function() {
8853 var elem = this;
8854
8855 while ( elem.firstElementChild ) {
8856 elem = elem.firstElementChild;
8857 }
8858
8859 return elem;
8860 } ).append( this );
8861 }
8862
8863 return this;
8864 },
8865
8866 wrapInner: function( html ) {
8867 if ( jQuery.isFunction( html ) ) {
8868 return this.each( function( i ) {
8869 jQuery( this ).wrapInner( html.call( this, i ) );
8870 } );
8871 }
8872
8873 return this.each( function() {
8874 var self = jQuery( this ),
8875 contents = self.contents();
8876
8877 if ( contents.length ) {
8878 contents.wrapAll( html );
8879
8880 } else {
8881 self.append( html );
8882 }
8883 } );
8884 },
8885
8886 wrap: function( html ) {
8887 var isFunction = jQuery.isFunction( html );
8888
8889 return this.each( function( i ) {
8890 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
8891 } );
8892 },
8893
8894 unwrap: function() {
8895 return this.parent().each( function() {
8896 if ( !jQuery.nodeName( this, "body" ) ) {
8897 jQuery( this ).replaceWith( this.childNodes );
8898 }
8899 } ).end();
8900 }
8901} );
8902
8903
8904jQuery.expr.filters.hidden = function( elem ) {
8905 return !jQuery.expr.filters.visible( elem );
8906};
8907jQuery.expr.filters.visible = function( elem ) {
8908
8909 // Support: Opera <= 12.12
8910 // Opera reports offsetWidths and offsetHeights less than zero on some elements
8911 // Use OR instead of AND as the element is not visible if either is true
8912 // See tickets #10406 and #13132
8913 return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
8914};
8915
8916
8917
8918
8919var r20 = /%20/g,
8920 rbracket = /\[\]$/,
8921 rCRLF = /\r?\n/g,
8922 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8923 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8924
8925function buildParams( prefix, obj, traditional, add ) {
8926 var name;
8927
8928 if ( jQuery.isArray( obj ) ) {
8929
8930 // Serialize array item.
8931 jQuery.each( obj, function( i, v ) {
8932 if ( traditional || rbracket.test( prefix ) ) {
8933
8934 // Treat each array item as a scalar.
8935 add( prefix, v );
8936
8937 } else {
8938
8939 // Item is non-scalar (array or object), encode its numeric index.
8940 buildParams(
8941 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8942 v,
8943 traditional,
8944 add
8945 );
8946 }
8947 } );
8948
8949 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8950
8951 // Serialize object item.
8952 for ( name in obj ) {
8953 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8954 }
8955
8956 } else {
8957
8958 // Serialize scalar item.
8959 add( prefix, obj );
8960 }
8961}
8962
8963// Serialize an array of form elements or a set of
8964// key/values into a query string
8965jQuery.param = function( a, traditional ) {
8966 var prefix,
8967 s = [],
8968 add = function( key, value ) {
8969
8970 // If value is a function, invoke it and return its value
8971 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
8972 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
8973 };
8974
8975 // Set traditional to true for jQuery <= 1.3.2 behavior.
8976 if ( traditional === undefined ) {
8977 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
8978 }
8979
8980 // If an array was passed in, assume that it is an array of form elements.
8981 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8982
8983 // Serialize the form elements
8984 jQuery.each( a, function() {
8985 add( this.name, this.value );
8986 } );
8987
8988 } else {
8989
8990 // If traditional, encode the "old" way (the way 1.3.2 or older
8991 // did it), otherwise encode params recursively.
8992 for ( prefix in a ) {
8993 buildParams( prefix, a[ prefix ], traditional, add );
8994 }
8995 }
8996
8997 // Return the resulting serialization
8998 return s.join( "&" ).replace( r20, "+" );
8999};
9000
9001jQuery.fn.extend( {
9002 serialize: function() {
9003 return jQuery.param( this.serializeArray() );
9004 },
9005 serializeArray: function() {
9006 return this.map( function() {
9007
9008 // Can add propHook for "elements" to filter or add form elements
9009 var elements = jQuery.prop( this, "elements" );
9010 return elements ? jQuery.makeArray( elements ) : this;
9011 } )
9012 .filter( function() {
9013 var type = this.type;
9014
9015 // Use .is( ":disabled" ) so that fieldset[disabled] works
9016 return this.name && !jQuery( this ).is( ":disabled" ) &&
9017 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
9018 ( this.checked || !rcheckableType.test( type ) );
9019 } )
9020 .map( function( i, elem ) {
9021 var val = jQuery( this ).val();
9022
9023 return val == null ?
9024 null :
9025 jQuery.isArray( val ) ?
9026 jQuery.map( val, function( val ) {
9027 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9028 } ) :
9029 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
9030 } ).get();
9031 }
9032} );
9033
9034
9035jQuery.ajaxSettings.xhr = function() {
9036 try {
9037 return new window.XMLHttpRequest();
9038 } catch ( e ) {}
9039};
9040
9041var xhrSuccessStatus = {
9042
9043 // File protocol always yields status code 0, assume 200
9044 0: 200,
9045
9046 // Support: IE9
9047 // #1450: sometimes IE returns 1223 when it should be 204
9048 1223: 204
9049 },
9050 xhrSupported = jQuery.ajaxSettings.xhr();
9051
9052support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9053support.ajax = xhrSupported = !!xhrSupported;
9054
9055jQuery.ajaxTransport( function( options ) {
9056 var callback, errorCallback;
9057
9058 // Cross domain only allowed if supported through XMLHttpRequest
9059 if ( support.cors || xhrSupported && !options.crossDomain ) {
9060 return {
9061 send: function( headers, complete ) {
9062 var i,
9063 xhr = options.xhr();
9064
9065 xhr.open(
9066 options.type,
9067 options.url,
9068 options.async,
9069 options.username,
9070 options.password
9071 );
9072
9073 // Apply custom fields if provided
9074 if ( options.xhrFields ) {
9075 for ( i in options.xhrFields ) {
9076 xhr[ i ] = options.xhrFields[ i ];
9077 }
9078 }
9079
9080 // Override mime type if needed
9081 if ( options.mimeType && xhr.overrideMimeType ) {
9082 xhr.overrideMimeType( options.mimeType );
9083 }
9084
9085 // X-Requested-With header
9086 // For cross-domain requests, seeing as conditions for a preflight are
9087 // akin to a jigsaw puzzle, we simply never set it to be sure.
9088 // (it can always be set on a per-request basis or even using ajaxSetup)
9089 // For same-domain requests, won't change header if already provided.
9090 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9091 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9092 }
9093
9094 // Set headers
9095 for ( i in headers ) {
9096 xhr.setRequestHeader( i, headers[ i ] );
9097 }
9098
9099 // Callback
9100 callback = function( type ) {
9101 return function() {
9102 if ( callback ) {
9103 callback = errorCallback = xhr.onload =
9104 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
9105
9106 if ( type === "abort" ) {
9107 xhr.abort();
9108 } else if ( type === "error" ) {
9109
9110 // Support: IE9
9111 // On a manual native abort, IE9 throws
9112 // errors on any property access that is not readyState
9113 if ( typeof xhr.status !== "number" ) {
9114 complete( 0, "error" );
9115 } else {
9116 complete(
9117
9118 // File: protocol always yields status 0; see #8605, #14207
9119 xhr.status,
9120 xhr.statusText
9121 );
9122 }
9123 } else {
9124 complete(
9125 xhrSuccessStatus[ xhr.status ] || xhr.status,
9126 xhr.statusText,
9127
9128 // Support: IE9 only
9129 // IE9 has no XHR2 but throws on binary (trac-11426)
9130 // For XHR2 non-text, let the caller handle it (gh-2498)
9131 ( xhr.responseType || "text" ) !== "text" ||
9132 typeof xhr.responseText !== "string" ?
9133 { binary: xhr.response } :
9134 { text: xhr.responseText },
9135 xhr.getAllResponseHeaders()
9136 );
9137 }
9138 }
9139 };
9140 };
9141
9142 // Listen to events
9143 xhr.onload = callback();
9144 errorCallback = xhr.onerror = callback( "error" );
9145
9146 // Support: IE9
9147 // Use onreadystatechange to replace onabort
9148 // to handle uncaught aborts
9149 if ( xhr.onabort !== undefined ) {
9150 xhr.onabort = errorCallback;
9151 } else {
9152 xhr.onreadystatechange = function() {
9153
9154 // Check readyState before timeout as it changes
9155 if ( xhr.readyState === 4 ) {
9156
9157 // Allow onerror to be called first,
9158 // but that will not handle a native abort
9159 // Also, save errorCallback to a variable
9160 // as xhr.onerror cannot be accessed
9161 window.setTimeout( function() {
9162 if ( callback ) {
9163 errorCallback();
9164 }
9165 } );
9166 }
9167 };
9168 }
9169
9170 // Create the abort callback
9171 callback = callback( "abort" );
9172
9173 try {
9174
9175 // Do send the request (this may raise an exception)
9176 xhr.send( options.hasContent && options.data || null );
9177 } catch ( e ) {
9178
9179 // #14683: Only rethrow if this hasn't been notified as an error yet
9180 if ( callback ) {
9181 throw e;
9182 }
9183 }
9184 },
9185
9186 abort: function() {
9187 if ( callback ) {
9188 callback();
9189 }
9190 }
9191 };
9192 }
9193} );
9194
9195
9196
9197
9198// Install script dataType
9199jQuery.ajaxSetup( {
9200 accepts: {
9201 script: "text/javascript, application/javascript, " +
9202 "application/ecmascript, application/x-ecmascript"
9203 },
9204 contents: {
9205 script: /\b(?:java|ecma)script\b/
9206 },
9207 converters: {
9208 "text script": function( text ) {
9209 jQuery.globalEval( text );
9210 return text;
9211 }
9212 }
9213} );
9214
9215// Handle cache's special case and crossDomain
9216jQuery.ajaxPrefilter( "script", function( s ) {
9217 if ( s.cache === undefined ) {
9218 s.cache = false;
9219 }
9220 if ( s.crossDomain ) {
9221 s.type = "GET";
9222 }
9223} );
9224
9225// Bind script tag hack transport
9226jQuery.ajaxTransport( "script", function( s ) {
9227
9228 // This transport only deals with cross domain requests
9229 if ( s.crossDomain ) {
9230 var script, callback;
9231 return {
9232 send: function( _, complete ) {
9233 script = jQuery( "<script>" ).prop( {
9234 charset: s.scriptCharset,
9235 src: s.url
9236 } ).on(
9237 "load error",
9238 callback = function( evt ) {
9239 script.remove();
9240 callback = null;
9241 if ( evt ) {
9242 complete( evt.type === "error" ? 404 : 200, evt.type );
9243 }
9244 }
9245 );
9246
9247 // Use native DOM manipulation to avoid our domManip AJAX trickery
9248 document.head.appendChild( script[ 0 ] );
9249 },
9250 abort: function() {
9251 if ( callback ) {
9252 callback();
9253 }
9254 }
9255 };
9256 }
9257} );
9258
9259
9260
9261
9262var oldCallbacks = [],
9263 rjsonp = /(=)\?(?=&|$)|\?\?/;
9264
9265// Default jsonp settings
9266jQuery.ajaxSetup( {
9267 jsonp: "callback",
9268 jsonpCallback: function() {
9269 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9270 this[ callback ] = true;
9271 return callback;
9272 }
9273} );
9274
9275// Detect, normalize options and install callbacks for jsonp requests
9276jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9277
9278 var callbackName, overwritten, responseContainer,
9279 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9280 "url" :
9281 typeof s.data === "string" &&
9282 ( s.contentType || "" )
9283 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
9284 rjsonp.test( s.data ) && "data"
9285 );
9286
9287 // Handle iff the expected data type is "jsonp" or we have a parameter to set
9288 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9289
9290 // Get callback name, remembering preexisting value associated with it
9291 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9292 s.jsonpCallback() :
9293 s.jsonpCallback;
9294
9295 // Insert callback into url or form data
9296 if ( jsonProp ) {
9297 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9298 } else if ( s.jsonp !== false ) {
9299 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9300 }
9301
9302 // Use data converter to retrieve json after script execution
9303 s.converters[ "script json" ] = function() {
9304 if ( !responseContainer ) {
9305 jQuery.error( callbackName + " was not called" );
9306 }
9307 return responseContainer[ 0 ];
9308 };
9309
9310 // Force json dataType
9311 s.dataTypes[ 0 ] = "json";
9312
9313 // Install callback
9314 overwritten = window[ callbackName ];
9315 window[ callbackName ] = function() {
9316 responseContainer = arguments;
9317 };
9318
9319 // Clean-up function (fires after converters)
9320 jqXHR.always( function() {
9321
9322 // If previous value didn't exist - remove it
9323 if ( overwritten === undefined ) {
9324 jQuery( window ).removeProp( callbackName );
9325
9326 // Otherwise restore preexisting value
9327 } else {
9328 window[ callbackName ] = overwritten;
9329 }
9330
9331 // Save back as free
9332 if ( s[ callbackName ] ) {
9333
9334 // Make sure that re-using the options doesn't screw things around
9335 s.jsonpCallback = originalSettings.jsonpCallback;
9336
9337 // Save the callback name for future use
9338 oldCallbacks.push( callbackName );
9339 }
9340
9341 // Call if it was a function and we have a response
9342 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9343 overwritten( responseContainer[ 0 ] );
9344 }
9345
9346 responseContainer = overwritten = undefined;
9347 } );
9348
9349 // Delegate to script
9350 return "script";
9351 }
9352} );
9353
9354
9355
9356
9357// Argument "data" should be string of html
9358// context (optional): If specified, the fragment will be created in this context,
9359// defaults to document
9360// keepScripts (optional): If true, will include scripts passed in the html string
9361jQuery.parseHTML = function( data, context, keepScripts ) {
9362 if ( !data || typeof data !== "string" ) {
9363 return null;
9364 }
9365 if ( typeof context === "boolean" ) {
9366 keepScripts = context;
9367 context = false;
9368 }
9369 context = context || document;
9370
9371 var parsed = rsingleTag.exec( data ),
9372 scripts = !keepScripts && [];
9373
9374 // Single tag
9375 if ( parsed ) {
9376 return [ context.createElement( parsed[ 1 ] ) ];
9377 }
9378
9379 parsed = buildFragment( [ data ], context, scripts );
9380
9381 if ( scripts && scripts.length ) {
9382 jQuery( scripts ).remove();
9383 }
9384
9385 return jQuery.merge( [], parsed.childNodes );
9386};
9387
9388
9389// Keep a copy of the old load method
9390var _load = jQuery.fn.load;
9391
9392/**
9393 * Load a url into a page
9394 */
9395jQuery.fn.load = function( url, params, callback ) {
9396 if ( typeof url !== "string" && _load ) {
9397 return _load.apply( this, arguments );
9398 }
9399
9400 var selector, type, response,
9401 self = this,
9402 off = url.indexOf( " " );
9403
9404 if ( off > -1 ) {
9405 selector = jQuery.trim( url.slice( off ) );
9406 url = url.slice( 0, off );
9407 }
9408
9409 // If it's a function
9410 if ( jQuery.isFunction( params ) ) {
9411
9412 // We assume that it's the callback
9413 callback = params;
9414 params = undefined;
9415
9416 // Otherwise, build a param string
9417 } else if ( params && typeof params === "object" ) {
9418 type = "POST";
9419 }
9420
9421 // If we have elements to modify, make the request
9422 if ( self.length > 0 ) {
9423 jQuery.ajax( {
9424 url: url,
9425
9426 // If "type" variable is undefined, then "GET" method will be used.
9427 // Make value of this field explicit since
9428 // user can override it through ajaxSetup method
9429 type: type || "GET",
9430 dataType: "html",
9431 data: params
9432 } ).done( function( responseText ) {
9433
9434 // Save response for use in complete callback
9435 response = arguments;
9436
9437 self.html( selector ?
9438
9439 // If a selector was specified, locate the right elements in a dummy div
9440 // Exclude scripts to avoid IE 'Permission Denied' errors
9441 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9442
9443 // Otherwise use the full result
9444 responseText );
9445
9446 // If the request succeeds, this function gets "data", "status", "jqXHR"
9447 // but they are ignored because response was set above.
9448 // If it fails, this function gets "jqXHR", "status", "error"
9449 } ).always( callback && function( jqXHR, status ) {
9450 self.each( function() {
9451 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9452 } );
9453 } );
9454 }
9455
9456 return this;
9457};
9458
9459
9460
9461
9462// Attach a bunch of functions for handling common AJAX events
9463jQuery.each( [
9464 "ajaxStart",
9465 "ajaxStop",
9466 "ajaxComplete",
9467 "ajaxError",
9468 "ajaxSuccess",
9469 "ajaxSend"
9470], function( i, type ) {
9471 jQuery.fn[ type ] = function( fn ) {
9472 return this.on( type, fn );
9473 };
9474} );
9475
9476
9477
9478
9479jQuery.expr.filters.animated = function( elem ) {
9480 return jQuery.grep( jQuery.timers, function( fn ) {
9481 return elem === fn.elem;
9482 } ).length;
9483};
9484
9485
9486
9487
9488/**
9489 * Gets a window from an element
9490 */
9491function getWindow( elem ) {
9492 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
9493}
9494
9495jQuery.offset = {
9496 setOffset: function( elem, options, i ) {
9497 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
9498 position = jQuery.css( elem, "position" ),
9499 curElem = jQuery( elem ),
9500 props = {};
9501
9502 // Set position first, in-case top/left are set even on static elem
9503 if ( position === "static" ) {
9504 elem.style.position = "relative";
9505 }
9506
9507 curOffset = curElem.offset();
9508 curCSSTop = jQuery.css( elem, "top" );
9509 curCSSLeft = jQuery.css( elem, "left" );
9510 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
9511 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
9512
9513 // Need to be able to calculate position if either
9514 // top or left is auto and position is either absolute or fixed
9515 if ( calculatePosition ) {
9516 curPosition = curElem.position();
9517 curTop = curPosition.top;
9518 curLeft = curPosition.left;
9519
9520 } else {
9521 curTop = parseFloat( curCSSTop ) || 0;
9522 curLeft = parseFloat( curCSSLeft ) || 0;
9523 }
9524
9525 if ( jQuery.isFunction( options ) ) {
9526
9527 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
9528 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
9529 }
9530
9531 if ( options.top != null ) {
9532 props.top = ( options.top - curOffset.top ) + curTop;
9533 }
9534 if ( options.left != null ) {
9535 props.left = ( options.left - curOffset.left ) + curLeft;
9536 }
9537
9538 if ( "using" in options ) {
9539 options.using.call( elem, props );
9540
9541 } else {
9542 curElem.css( props );
9543 }
9544 }
9545};
9546
9547jQuery.fn.extend( {
9548 offset: function( options ) {
9549 if ( arguments.length ) {
9550 return options === undefined ?
9551 this :
9552 this.each( function( i ) {
9553 jQuery.offset.setOffset( this, options, i );
9554 } );
9555 }
9556
9557 var docElem, win,
9558 elem = this[ 0 ],
9559 box = { top: 0, left: 0 },
9560 doc = elem && elem.ownerDocument;
9561
9562 if ( !doc ) {
9563 return;
9564 }
9565
9566 docElem = doc.documentElement;
9567
9568 // Make sure it's not a disconnected DOM node
9569 if ( !jQuery.contains( docElem, elem ) ) {
9570 return box;
9571 }
9572
9573 box = elem.getBoundingClientRect();
9574 win = getWindow( doc );
9575 return {
9576 top: box.top + win.pageYOffset - docElem.clientTop,
9577 left: box.left + win.pageXOffset - docElem.clientLeft
9578 };
9579 },
9580
9581 position: function() {
9582 if ( !this[ 0 ] ) {
9583 return;
9584 }
9585
9586 var offsetParent, offset,
9587 elem = this[ 0 ],
9588 parentOffset = { top: 0, left: 0 };
9589
9590 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
9591 // because it is its only offset parent
9592 if ( jQuery.css( elem, "position" ) === "fixed" ) {
9593
9594 // Assume getBoundingClientRect is there when computed position is fixed
9595 offset = elem.getBoundingClientRect();
9596
9597 } else {
9598
9599 // Get *real* offsetParent
9600 offsetParent = this.offsetParent();
9601
9602 // Get correct offsets
9603 offset = this.offset();
9604 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
9605 parentOffset = offsetParent.offset();
9606 }
9607
9608 // Add offsetParent borders
9609 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
9610 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
9611 }
9612
9613 // Subtract parent offsets and element margins
9614 return {
9615 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
9616 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
9617 };
9618 },
9619
9620 // This method will return documentElement in the following cases:
9621 // 1) For the element inside the iframe without offsetParent, this method will return
9622 // documentElement of the parent window
9623 // 2) For the hidden or detached element
9624 // 3) For body or html element, i.e. in case of the html node - it will return itself
9625 //
9626 // but those exceptions were never presented as a real life use-cases
9627 // and might be considered as more preferable results.
9628 //
9629 // This logic, however, is not guaranteed and can change at any point in the future
9630 offsetParent: function() {
9631 return this.map( function() {
9632 var offsetParent = this.offsetParent;
9633
9634 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
9635 offsetParent = offsetParent.offsetParent;
9636 }
9637
9638 return offsetParent || documentElement;
9639 } );
9640 }
9641} );
9642
9643// Create scrollLeft and scrollTop methods
9644jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
9645 var top = "pageYOffset" === prop;
9646
9647 jQuery.fn[ method ] = function( val ) {
9648 return access( this, function( elem, method, val ) {
9649 var win = getWindow( elem );
9650
9651 if ( val === undefined ) {
9652 return win ? win[ prop ] : elem[ method ];
9653 }
9654
9655 if ( win ) {
9656 win.scrollTo(
9657 !top ? val : win.pageXOffset,
9658 top ? val : win.pageYOffset
9659 );
9660
9661 } else {
9662 elem[ method ] = val;
9663 }
9664 }, method, val, arguments.length );
9665 };
9666} );
9667
9668// Support: Safari<7-8+, Chrome<37-44+
9669// Add the top/left cssHooks using jQuery.fn.position
9670// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
9671// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
9672// getComputedStyle returns percent when specified for top/left/bottom/right;
9673// rather than make the css module depend on the offset module, just check for it here
9674jQuery.each( [ "top", "left" ], function( i, prop ) {
9675 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
9676 function( elem, computed ) {
9677 if ( computed ) {
9678 computed = curCSS( elem, prop );
9679
9680 // If curCSS returns percentage, fallback to offset
9681 return rnumnonpx.test( computed ) ?
9682 jQuery( elem ).position()[ prop ] + "px" :
9683 computed;
9684 }
9685 }
9686 );
9687} );
9688
9689
9690// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9691jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9692 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
9693 function( defaultExtra, funcName ) {
9694
9695 // Margin is only for outerHeight, outerWidth
9696 jQuery.fn[ funcName ] = function( margin, value ) {
9697 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9698 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9699
9700 return access( this, function( elem, type, value ) {
9701 var doc;
9702
9703 if ( jQuery.isWindow( elem ) ) {
9704
9705 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9706 // isn't a whole lot we can do. See pull request at this URL for discussion:
9707 // https://github.com/jquery/jquery/pull/764
9708 return elem.document.documentElement[ "client" + name ];
9709 }
9710
9711 // Get document width or height
9712 if ( elem.nodeType === 9 ) {
9713 doc = elem.documentElement;
9714
9715 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
9716 // whichever is greatest
9717 return Math.max(
9718 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9719 elem.body[ "offset" + name ], doc[ "offset" + name ],
9720 doc[ "client" + name ]
9721 );
9722 }
9723
9724 return value === undefined ?
9725
9726 // Get width or height on the element, requesting but not forcing parseFloat
9727 jQuery.css( elem, type, extra ) :
9728
9729 // Set width or height on the element
9730 jQuery.style( elem, type, value, extra );
9731 }, type, chainable ? margin : undefined, chainable, null );
9732 };
9733 } );
9734} );
9735
9736
9737jQuery.fn.extend( {
9738
9739 bind: function( types, data, fn ) {
9740 return this.on( types, null, data, fn );
9741 },
9742 unbind: function( types, fn ) {
9743 return this.off( types, null, fn );
9744 },
9745
9746 delegate: function( selector, types, data, fn ) {
9747 return this.on( types, selector, data, fn );
9748 },
9749 undelegate: function( selector, types, fn ) {
9750
9751 // ( namespace ) or ( selector, types [, fn] )
9752 return arguments.length === 1 ?
9753 this.off( selector, "**" ) :
9754 this.off( types, selector || "**", fn );
9755 },
9756 size: function() {
9757 return this.length;
9758 }
9759} );
9760
9761jQuery.fn.andSelf = jQuery.fn.addBack;
9762
9763
9764
9765
9766// Register as a named AMD module, since jQuery can be concatenated with other
9767// files that may use define, but not via a proper concatenation script that
9768// understands anonymous AMD modules. A named AMD is safest and most robust
9769// way to register. Lowercase jquery is used because AMD module names are
9770// derived from file names, and jQuery is normally delivered in a lowercase
9771// file name. Do this after creating the global so that if an AMD module wants
9772// to call noConflict to hide this version of jQuery, it will work.
9773
9774// Note that for maximum portability, libraries that are not jQuery should
9775// declare themselves as anonymous modules, and avoid setting a global if an
9776// AMD loader is present. jQuery is a special case. For more information, see
9777// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
9778
9779if ( typeof define === "function" && define.amd ) {
9780 define( "jquery", [], function() {
9781 return jQuery;
9782 } );
9783}
9784
9785
9786
9787var
9788
9789 // Map over jQuery in case of overwrite
9790 _jQuery = window.jQuery,
9791
9792 // Map over the $ in case of overwrite
9793 _$ = window.$;
9794
9795jQuery.noConflict = function( deep ) {
9796 if ( window.$ === jQuery ) {
9797 window.$ = _$;
9798 }
9799
9800 if ( deep && window.jQuery === jQuery ) {
9801 window.jQuery = _jQuery;
9802 }
9803
9804 return jQuery;
9805};
9806
9807// Expose jQuery and $ identifiers, even in AMD
9808// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
9809// and CommonJS for browser emulators (#13566)
9810if ( !noGlobal ) {
9811 window.jQuery = window.$ = jQuery;
9812}
9813
9814return jQuery;
9815}));
9816
9817},{}],2:[function(require,module,exports){
9818/*
9819 _ _ _ _
9820 ___| (_) ___| | __ (_)___
9821/ __| | |/ __| |/ / | / __|
9822\__ \ | | (__| < _ | \__ \
9823|___/_|_|\___|_|\_(_)/ |___/
9824 |__/
9825
9826 Version: 1.5.9
9827 Author: Ken Wheeler
9828 Website: http://kenwheeler.github.io
9829 Docs: http://kenwheeler.github.io/slick
9830 Repo: http://github.com/kenwheeler/slick
9831 Issues: http://github.com/kenwheeler/slick/issues
9832
9833 */
9834/* global window, document, define, jQuery, setInterval, clearInterval */
9835(function(factory) {
9836 'use strict';
9837 if (typeof define === 'function' && define.amd) {
9838 define(['jquery'], factory);
9839 } else if (typeof exports !== 'undefined') {
9840 module.exports = factory(require('jquery'));
9841 } else {
9842 factory(jQuery);
9843 }
9844
9845}(function($) {
9846 'use strict';
9847 var Slick = window.Slick || {};
9848
9849 Slick = (function() {
9850
9851 var instanceUid = 0;
9852
9853 function Slick(element, settings) {
9854
9855 var _ = this, dataSettings;
9856
9857 _.defaults = {
9858 accessibility: true,
9859 adaptiveHeight: false,
9860 appendArrows: $(element),
9861 appendDots: $(element),
9862 arrows: true,
9863 asNavFor: null,
9864 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',
9865 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',
9866 autoplay: false,
9867 autoplaySpeed: 3000,
9868 centerMode: false,
9869 centerPadding: '50px',
9870 cssEase: 'ease',
9871 customPaging: function(slider, i) {
9872 return $('<button type="button" data-role="none" role="button" aria-required="false" tabindex="0" />').text(i + 1);
9873 },
9874 dots: false,
9875 dotsClass: 'slick-dots',
9876 draggable: true,
9877 easing: 'linear',
9878 edgeFriction: 0.35,
9879 fade: false,
9880 focusOnSelect: false,
9881 infinite: true,
9882 initialSlide: 0,
9883 lazyLoad: 'ondemand',
9884 mobileFirst: false,
9885 pauseOnHover: true,
9886 pauseOnDotsHover: false,
9887 respondTo: 'window',
9888 responsive: null,
9889 rows: 1,
9890 rtl: false,
9891 slide: '',
9892 slidesPerRow: 1,
9893 slidesToShow: 1,
9894 slidesToScroll: 1,
9895 speed: 500,
9896 swipe: true,
9897 swipeToSlide: false,
9898 touchMove: true,
9899 touchThreshold: 5,
9900 useCSS: true,
9901 useTransform: true,
9902 variableWidth: false,
9903 vertical: false,
9904 verticalSwiping: false,
9905 waitForAnimate: true,
9906 zIndex: 1000
9907 };
9908
9909 _.initials = {
9910 animating: false,
9911 dragging: false,
9912 autoPlayTimer: null,
9913 currentDirection: 0,
9914 currentLeft: null,
9915 currentSlide: 0,
9916 direction: 1,
9917 $dots: null,
9918 listWidth: null,
9919 listHeight: null,
9920 loadIndex: 0,
9921 $nextArrow: null,
9922 $prevArrow: null,
9923 slideCount: null,
9924 slideWidth: null,
9925 $slideTrack: null,
9926 $slides: null,
9927 sliding: false,
9928 slideOffset: 0,
9929 swipeLeft: null,
9930 $list: null,
9931 touchObject: {},
9932 transformsEnabled: false,
9933 unslicked: false
9934 };
9935
9936 $.extend(_, _.initials);
9937
9938 _.activeBreakpoint = null;
9939 _.animType = null;
9940 _.animProp = null;
9941 _.breakpoints = [];
9942 _.breakpointSettings = [];
9943 _.cssTransitions = false;
9944 _.hidden = 'hidden';
9945 _.paused = false;
9946 _.positionProp = null;
9947 _.respondTo = null;
9948 _.rowCount = 1;
9949 _.shouldClick = true;
9950 _.$slider = $(element);
9951 _.$slidesCache = null;
9952 _.transformType = null;
9953 _.transitionType = null;
9954 _.visibilityChange = 'visibilitychange';
9955 _.windowWidth = 0;
9956 _.windowTimer = null;
9957
9958 dataSettings = $(element).data('slick') || {};
9959
9960 _.options = $.extend({}, _.defaults, settings, dataSettings);
9961
9962 _.currentSlide = _.options.initialSlide;
9963
9964 _.originalSettings = _.options;
9965
9966 if (typeof document.mozHidden !== 'undefined') {
9967 _.hidden = 'mozHidden';
9968 _.visibilityChange = 'mozvisibilitychange';
9969 } else if (typeof document.webkitHidden !== 'undefined') {
9970 _.hidden = 'webkitHidden';
9971 _.visibilityChange = 'webkitvisibilitychange';
9972 }
9973
9974 _.autoPlay = $.proxy(_.autoPlay, _);
9975 _.autoPlayClear = $.proxy(_.autoPlayClear, _);
9976 _.changeSlide = $.proxy(_.changeSlide, _);
9977 _.clickHandler = $.proxy(_.clickHandler, _);
9978 _.selectHandler = $.proxy(_.selectHandler, _);
9979 _.setPosition = $.proxy(_.setPosition, _);
9980 _.swipeHandler = $.proxy(_.swipeHandler, _);
9981 _.dragHandler = $.proxy(_.dragHandler, _);
9982 _.keyHandler = $.proxy(_.keyHandler, _);
9983 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
9984
9985 _.instanceUid = instanceUid++;
9986
9987 // A simple way to check for HTML strings
9988 // Strict HTML recognition (must start with <)
9989 // Extracted from jQuery v1.11 source
9990 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
9991
9992
9993 _.registerBreakpoints();
9994 _.init(true);
9995 _.checkResponsive(true);
9996
9997 }
9998
9999 return Slick;
10000
10001 }());
10002
10003 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
10004
10005 var _ = this;
10006
10007 if (typeof(index) === 'boolean') {
10008 addBefore = index;
10009 index = null;
10010 } else if (index < 0 || (index >= _.slideCount)) {
10011 return false;
10012 }
10013
10014 _.unload();
10015
10016 if (typeof(index) === 'number') {
10017 if (index === 0 && _.$slides.length === 0) {
10018 $(markup).appendTo(_.$slideTrack);
10019 } else if (addBefore) {
10020 $(markup).insertBefore(_.$slides.eq(index));
10021 } else {
10022 $(markup).insertAfter(_.$slides.eq(index));
10023 }
10024 } else {
10025 if (addBefore === true) {
10026 $(markup).prependTo(_.$slideTrack);
10027 } else {
10028 $(markup).appendTo(_.$slideTrack);
10029 }
10030 }
10031
10032 _.$slides = _.$slideTrack.children(this.options.slide);
10033
10034 _.$slideTrack.children(this.options.slide).detach();
10035
10036 _.$slideTrack.append(_.$slides);
10037
10038 _.$slides.each(function(index, element) {
10039 $(element).attr('data-slick-index', index);
10040 });
10041
10042 _.$slidesCache = _.$slides;
10043
10044 _.reinit();
10045
10046 };
10047
10048 Slick.prototype.animateHeight = function() {
10049 var _ = this;
10050 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
10051 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
10052 _.$list.animate({
10053 height: targetHeight
10054 }, _.options.speed);
10055 }
10056 };
10057
10058 Slick.prototype.animateSlide = function(targetLeft, callback) {
10059
10060 var animProps = {},
10061 _ = this;
10062
10063 _.animateHeight();
10064
10065 if (_.options.rtl === true && _.options.vertical === false) {
10066 targetLeft = -targetLeft;
10067 }
10068 if (_.transformsEnabled === false) {
10069 if (_.options.vertical === false) {
10070 _.$slideTrack.animate({
10071 left: targetLeft
10072 }, _.options.speed, _.options.easing, callback);
10073 } else {
10074 _.$slideTrack.animate({
10075 top: targetLeft
10076 }, _.options.speed, _.options.easing, callback);
10077 }
10078
10079 } else {
10080
10081 if (_.cssTransitions === false) {
10082 if (_.options.rtl === true) {
10083 _.currentLeft = -(_.currentLeft);
10084 }
10085 $({
10086 animStart: _.currentLeft
10087 }).animate({
10088 animStart: targetLeft
10089 }, {
10090 duration: _.options.speed,
10091 easing: _.options.easing,
10092 step: function(now) {
10093 now = Math.ceil(now);
10094 if (_.options.vertical === false) {
10095 animProps[_.animType] = 'translate(' +
10096 now + 'px, 0px)';
10097 _.$slideTrack.css(animProps);
10098 } else {
10099 animProps[_.animType] = 'translate(0px,' +
10100 now + 'px)';
10101 _.$slideTrack.css(animProps);
10102 }
10103 },
10104 complete: function() {
10105 if (callback) {
10106 callback.call();
10107 }
10108 }
10109 });
10110
10111 } else {
10112
10113 _.applyTransition();
10114 targetLeft = Math.ceil(targetLeft);
10115
10116 if (_.options.vertical === false) {
10117 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
10118 } else {
10119 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
10120 }
10121 _.$slideTrack.css(animProps);
10122
10123 if (callback) {
10124 setTimeout(function() {
10125
10126 _.disableTransition();
10127
10128 callback.call();
10129 }, _.options.speed);
10130 }
10131
10132 }
10133
10134 }
10135
10136 };
10137
10138 Slick.prototype.getNavTarget = function() {
10139
10140 var _ = this,
10141 asNavFor = _.options.asNavFor;
10142
10143 if ( asNavFor && asNavFor !== null ) {
10144 asNavFor = $(asNavFor).not(_.$slider);
10145 }
10146
10147 return asNavFor;
10148
10149 };
10150
10151 Slick.prototype.asNavFor = function(index) {
10152
10153 var _ = this,
10154 asNavFor = _.getNavTarget();
10155
10156 if ( asNavFor !== null && typeof asNavFor === 'object' ) {
10157 asNavFor.each(function() {
10158 var target = $(this).slick('getSlick');
10159 if(!target.unslicked) {
10160 target.slideHandler(index, true);
10161 }
10162 });
10163 }
10164
10165 };
10166
10167 Slick.prototype.applyTransition = function(slide) {
10168
10169 var _ = this,
10170 transition = {};
10171
10172 if (_.options.fade === false) {
10173 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
10174 } else {
10175 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
10176 }
10177
10178 if (_.options.fade === false) {
10179 _.$slideTrack.css(transition);
10180 } else {
10181 _.$slides.eq(slide).css(transition);
10182 }
10183
10184 };
10185
10186 Slick.prototype.autoPlay = function() {
10187
10188 var _ = this;
10189
10190 if (_.autoPlayTimer) {
10191 clearInterval(_.autoPlayTimer);
10192 }
10193
10194 if (_.slideCount > _.options.slidesToShow && _.paused !== true) {
10195 _.autoPlayTimer = setInterval(_.autoPlayIterator,
10196 _.options.autoplaySpeed);
10197 }
10198
10199 };
10200
10201 Slick.prototype.autoPlayClear = function() {
10202
10203 var _ = this;
10204 if (_.autoPlayTimer) {
10205 clearInterval(_.autoPlayTimer);
10206 }
10207
10208 };
10209
10210 Slick.prototype.autoPlayIterator = function() {
10211
10212 var _ = this;
10213
10214 if (_.options.infinite === false) {
10215
10216 if (_.direction === 1) {
10217
10218 if ((_.currentSlide + 1) === _.slideCount -
10219 1) {
10220 _.direction = 0;
10221 }
10222
10223 _.slideHandler(_.currentSlide + _.options.slidesToScroll);
10224
10225 } else {
10226
10227 if ((_.currentSlide - 1 === 0)) {
10228
10229 _.direction = 1;
10230
10231 }
10232
10233 _.slideHandler(_.currentSlide - _.options.slidesToScroll);
10234
10235 }
10236
10237 } else {
10238
10239 _.slideHandler(_.currentSlide + _.options.slidesToScroll);
10240
10241 }
10242
10243 };
10244
10245 Slick.prototype.buildArrows = function() {
10246
10247 var _ = this;
10248
10249 if (_.options.arrows === true ) {
10250
10251 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
10252 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
10253
10254 if( _.slideCount > _.options.slidesToShow ) {
10255
10256 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
10257 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
10258
10259 if (_.htmlExpr.test(_.options.prevArrow)) {
10260 _.$prevArrow.prependTo(_.options.appendArrows);
10261 }
10262
10263 if (_.htmlExpr.test(_.options.nextArrow)) {
10264 _.$nextArrow.appendTo(_.options.appendArrows);
10265 }
10266
10267 if (_.options.infinite !== true) {
10268 _.$prevArrow
10269 .addClass('slick-disabled')
10270 .attr('aria-disabled', 'true');
10271 }
10272
10273 } else {
10274
10275 _.$prevArrow.add( _.$nextArrow )
10276
10277 .addClass('slick-hidden')
10278 .attr({
10279 'aria-disabled': 'true',
10280 'tabindex': '-1'
10281 });
10282
10283 }
10284
10285 }
10286
10287 };
10288
10289 Slick.prototype.buildDots = function() {
10290
10291 var _ = this,
10292 i, dot;
10293
10294 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
10295
10296 dot = $('<ul />').addClass(_.options.dotsClass);
10297
10298 for (i = 0; i <= _.getDotCount(); i += 1) {
10299 dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
10300 }
10301
10302 _.$dots = dot.appendTo(_.options.appendDots);
10303
10304 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
10305
10306 }
10307
10308 };
10309
10310 Slick.prototype.buildOut = function() {
10311
10312 var _ = this;
10313
10314 _.$slides =
10315 _.$slider
10316 .children( _.options.slide + ':not(.slick-cloned)')
10317 .addClass('slick-slide');
10318
10319 _.slideCount = _.$slides.length;
10320
10321 _.$slides.each(function(index, element) {
10322 $(element)
10323 .attr('data-slick-index', index)
10324 .data('originalStyling', $(element).attr('style') || '');
10325 });
10326
10327 _.$slider.addClass('slick-slider');
10328
10329 _.$slideTrack = (_.slideCount === 0) ?
10330 $('<div class="slick-track"/>').appendTo(_.$slider) :
10331 _.$slides.wrapAll('<div class="slick-track"/>').parent();
10332
10333 _.$list = _.$slideTrack.wrap(
10334 '<div aria-live="polite" class="slick-list"/>').parent();
10335 _.$slideTrack.css('opacity', 0);
10336
10337 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
10338 _.options.slidesToScroll = 1;
10339 }
10340
10341 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
10342
10343 _.setupInfinite();
10344
10345 _.buildArrows();
10346
10347 _.buildDots();
10348
10349 _.updateDots();
10350
10351
10352 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
10353
10354 if (_.options.draggable === true) {
10355 _.$list.addClass('draggable');
10356 }
10357
10358 };
10359
10360 Slick.prototype.buildRows = function() {
10361
10362 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
10363
10364 newSlides = document.createDocumentFragment();
10365 originalSlides = _.$slider.children();
10366
10367 if(_.options.rows > 1) {
10368
10369 slidesPerSection = _.options.slidesPerRow * _.options.rows;
10370 numOfSlides = Math.ceil(
10371 originalSlides.length / slidesPerSection
10372 );
10373
10374 for(a = 0; a < numOfSlides; a++){
10375 var slide = document.createElement('div');
10376 for(b = 0; b < _.options.rows; b++) {
10377 var row = document.createElement('div');
10378 for(c = 0; c < _.options.slidesPerRow; c++) {
10379 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
10380 if (originalSlides.get(target)) {
10381 row.appendChild(originalSlides.get(target));
10382 }
10383 }
10384 slide.appendChild(row);
10385 }
10386 newSlides.appendChild(slide);
10387 }
10388
10389 _.$slider.empty().append(newSlides);
10390 _.$slider.children().children().children()
10391 .css({
10392 'width':(100 / _.options.slidesPerRow) + '%',
10393 'display': 'inline-block'
10394 });
10395
10396 }
10397
10398 };
10399
10400 Slick.prototype.checkResponsive = function(initial, forceUpdate) {
10401
10402 var _ = this,
10403 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
10404 var sliderWidth = _.$slider.width();
10405 var windowWidth = window.innerWidth || $(window).width();
10406
10407 if (_.respondTo === 'window') {
10408 respondToWidth = windowWidth;
10409 } else if (_.respondTo === 'slider') {
10410 respondToWidth = sliderWidth;
10411 } else if (_.respondTo === 'min') {
10412 respondToWidth = Math.min(windowWidth, sliderWidth);
10413 }
10414
10415 if ( _.options.responsive &&
10416 _.options.responsive.length &&
10417 _.options.responsive !== null) {
10418
10419 targetBreakpoint = null;
10420
10421 for (breakpoint in _.breakpoints) {
10422 if (_.breakpoints.hasOwnProperty(breakpoint)) {
10423 if (_.originalSettings.mobileFirst === false) {
10424 if (respondToWidth < _.breakpoints[breakpoint]) {
10425 targetBreakpoint = _.breakpoints[breakpoint];
10426 }
10427 } else {
10428 if (respondToWidth > _.breakpoints[breakpoint]) {
10429 targetBreakpoint = _.breakpoints[breakpoint];
10430 }
10431 }
10432 }
10433 }
10434
10435 if (targetBreakpoint !== null) {
10436 if (_.activeBreakpoint !== null) {
10437 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
10438 _.activeBreakpoint =
10439 targetBreakpoint;
10440 if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
10441 _.unslick(targetBreakpoint);
10442 } else {
10443 _.options = $.extend({}, _.originalSettings,
10444 _.breakpointSettings[
10445 targetBreakpoint]);
10446 if (initial === true) {
10447 _.currentSlide = _.options.initialSlide;
10448 }
10449 _.refresh(initial);
10450 }
10451 triggerBreakpoint = targetBreakpoint;
10452 }
10453 } else {
10454 _.activeBreakpoint = targetBreakpoint;
10455 if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
10456 _.unslick(targetBreakpoint);
10457 } else {
10458 _.options = $.extend({}, _.originalSettings,
10459 _.breakpointSettings[
10460 targetBreakpoint]);
10461 if (initial === true) {
10462 _.currentSlide = _.options.initialSlide;
10463 }
10464 _.refresh(initial);
10465 }
10466 triggerBreakpoint = targetBreakpoint;
10467 }
10468 } else {
10469 if (_.activeBreakpoint !== null) {
10470 _.activeBreakpoint = null;
10471 _.options = _.originalSettings;
10472 if (initial === true) {
10473 _.currentSlide = _.options.initialSlide;
10474 }
10475 _.refresh(initial);
10476 triggerBreakpoint = targetBreakpoint;
10477 }
10478 }
10479
10480 // only trigger breakpoints during an actual break. not on initialize.
10481 if( !initial && triggerBreakpoint !== false ) {
10482 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
10483 }
10484 }
10485
10486 };
10487
10488 Slick.prototype.changeSlide = function(event, dontAnimate) {
10489
10490 var _ = this,
10491 $target = $(event.target),
10492 indexOffset, slideOffset, unevenOffset;
10493
10494 // If target is a link, prevent default action.
10495 if($target.is('a')) {
10496 event.preventDefault();
10497 }
10498
10499 // If target is not the <li> element (ie: a child), find the <li>.
10500 if(!$target.is('li')) {
10501 $target = $target.closest('li');
10502 }
10503
10504 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
10505 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
10506
10507 switch (event.data.message) {
10508
10509 case 'previous':
10510 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
10511 if (_.slideCount > _.options.slidesToShow) {
10512 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
10513 }
10514 break;
10515
10516 case 'next':
10517 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
10518 if (_.slideCount > _.options.slidesToShow) {
10519 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
10520 }
10521 break;
10522
10523 case 'index':
10524 var index = event.data.index === 0 ? 0 :
10525 event.data.index || $target.index() * _.options.slidesToScroll;
10526
10527 _.slideHandler(_.checkNavigable(index), false, dontAnimate);
10528 $target.children().trigger('focus');
10529 break;
10530
10531 default:
10532 return;
10533 }
10534
10535 };
10536
10537 Slick.prototype.checkNavigable = function(index) {
10538
10539 var _ = this,
10540 navigables, prevNavigable;
10541
10542 navigables = _.getNavigableIndexes();
10543 prevNavigable = 0;
10544 if (index > navigables[navigables.length - 1]) {
10545 index = navigables[navigables.length - 1];
10546 } else {
10547 for (var n in navigables) {
10548 if (index < navigables[n]) {
10549 index = prevNavigable;
10550 break;
10551 }
10552 prevNavigable = navigables[n];
10553 }
10554 }
10555
10556 return index;
10557 };
10558
10559 Slick.prototype.cleanUpEvents = function() {
10560
10561 var _ = this;
10562
10563 if (_.options.dots && _.$dots !== null) {
10564
10565 $('li', _.$dots).off('click.slick', _.changeSlide);
10566
10567 if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) {
10568
10569 $('li', _.$dots)
10570 .off('mouseenter.slick', $.proxy(_.setPaused, _, true))
10571 .off('mouseleave.slick', $.proxy(_.setPaused, _, false));
10572
10573 }
10574
10575 }
10576
10577 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
10578 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
10579 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
10580 }
10581
10582 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
10583 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
10584 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
10585 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
10586
10587 _.$list.off('click.slick', _.clickHandler);
10588
10589 $(document).off(_.visibilityChange, _.visibility);
10590
10591 _.$list.off('mouseenter.slick', $.proxy(_.setPaused, _, true));
10592 _.$list.off('mouseleave.slick', $.proxy(_.setPaused, _, false));
10593
10594 if (_.options.accessibility === true) {
10595 _.$list.off('keydown.slick', _.keyHandler);
10596 }
10597
10598 if (_.options.focusOnSelect === true) {
10599 $(_.$slideTrack).children().off('click.slick', _.selectHandler);
10600 }
10601
10602 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
10603
10604 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
10605
10606 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
10607
10608 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
10609 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
10610 };
10611
10612 Slick.prototype.cleanUpRows = function() {
10613
10614 var _ = this, originalSlides;
10615
10616 if(_.options.rows > 1) {
10617 originalSlides = _.$slides.children().children();
10618 originalSlides.removeAttr('style');
10619 _.$slider.empty().append(originalSlides);
10620 }
10621
10622 };
10623
10624 Slick.prototype.clickHandler = function(event) {
10625
10626 var _ = this;
10627
10628 if (_.shouldClick === false) {
10629 event.stopImmediatePropagation();
10630 event.stopPropagation();
10631 event.preventDefault();
10632 }
10633
10634 };
10635
10636 Slick.prototype.destroy = function(refresh) {
10637
10638 var _ = this;
10639
10640 _.autoPlayClear();
10641
10642 _.touchObject = {};
10643
10644 _.cleanUpEvents();
10645
10646 $('.slick-cloned', _.$slider).detach();
10647
10648 if (_.$dots) {
10649 _.$dots.remove();
10650 }
10651
10652
10653 if ( _.$prevArrow && _.$prevArrow.length ) {
10654
10655 _.$prevArrow
10656 .removeClass('slick-disabled slick-arrow slick-hidden')
10657 .removeAttr('aria-hidden aria-disabled tabindex')
10658 .css("display","");
10659
10660 if ( _.htmlExpr.test( _.options.prevArrow )) {
10661 _.$prevArrow.remove();
10662 }
10663 }
10664
10665 if ( _.$nextArrow && _.$nextArrow.length ) {
10666
10667 _.$nextArrow
10668 .removeClass('slick-disabled slick-arrow slick-hidden')
10669 .removeAttr('aria-hidden aria-disabled tabindex')
10670 .css("display","");
10671
10672 if ( _.htmlExpr.test( _.options.nextArrow )) {
10673 _.$nextArrow.remove();
10674 }
10675
10676 }
10677
10678
10679 if (_.$slides) {
10680
10681 _.$slides
10682 .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
10683 .removeAttr('aria-hidden')
10684 .removeAttr('data-slick-index')
10685 .each(function(){
10686 $(this).attr('style', $(this).data('originalStyling'));
10687 });
10688
10689 _.$slideTrack.children(this.options.slide).detach();
10690
10691 _.$slideTrack.detach();
10692
10693 _.$list.detach();
10694
10695 _.$slider.append(_.$slides);
10696 }
10697
10698 _.cleanUpRows();
10699
10700 _.$slider.removeClass('slick-slider');
10701 _.$slider.removeClass('slick-initialized');
10702
10703 _.unslicked = true;
10704
10705 if(!refresh) {
10706 _.$slider.trigger('destroy', [_]);
10707 }
10708
10709 };
10710
10711 Slick.prototype.disableTransition = function(slide) {
10712
10713 var _ = this,
10714 transition = {};
10715
10716 transition[_.transitionType] = '';
10717
10718 if (_.options.fade === false) {
10719 _.$slideTrack.css(transition);
10720 } else {
10721 _.$slides.eq(slide).css(transition);
10722 }
10723
10724 };
10725
10726 Slick.prototype.fadeSlide = function(slideIndex, callback) {
10727
10728 var _ = this;
10729
10730 if (_.cssTransitions === false) {
10731
10732 _.$slides.eq(slideIndex).css({
10733 zIndex: _.options.zIndex
10734 });
10735
10736 _.$slides.eq(slideIndex).animate({
10737 opacity: 1
10738 }, _.options.speed, _.options.easing, callback);
10739
10740 } else {
10741
10742 _.applyTransition(slideIndex);
10743
10744 _.$slides.eq(slideIndex).css({
10745 opacity: 1,
10746 zIndex: _.options.zIndex
10747 });
10748
10749 if (callback) {
10750 setTimeout(function() {
10751
10752 _.disableTransition(slideIndex);
10753
10754 callback.call();
10755 }, _.options.speed);
10756 }
10757
10758 }
10759
10760 };
10761
10762 Slick.prototype.fadeSlideOut = function(slideIndex) {
10763
10764 var _ = this;
10765
10766 if (_.cssTransitions === false) {
10767
10768 _.$slides.eq(slideIndex).animate({
10769 opacity: 0,
10770 zIndex: _.options.zIndex - 2
10771 }, _.options.speed, _.options.easing);
10772
10773 } else {
10774
10775 _.applyTransition(slideIndex);
10776
10777 _.$slides.eq(slideIndex).css({
10778 opacity: 0,
10779 zIndex: _.options.zIndex - 2
10780 });
10781
10782 }
10783
10784 };
10785
10786 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
10787
10788 var _ = this;
10789
10790 if (filter !== null) {
10791
10792 _.$slidesCache = _.$slides;
10793
10794 _.unload();
10795
10796 _.$slideTrack.children(this.options.slide).detach();
10797
10798 _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
10799
10800 _.reinit();
10801
10802 }
10803
10804 };
10805
10806 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
10807
10808 var _ = this;
10809 return _.currentSlide;
10810
10811 };
10812
10813 Slick.prototype.getDotCount = function() {
10814
10815 var _ = this;
10816
10817 var breakPoint = 0;
10818 var counter = 0;
10819 var pagerQty = 0;
10820
10821 if (_.options.infinite === true) {
10822 while (breakPoint < _.slideCount) {
10823 ++pagerQty;
10824 breakPoint = counter + _.options.slidesToScroll;
10825 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
10826 }
10827 } else if (_.options.centerMode === true) {
10828 pagerQty = _.slideCount;
10829 } else {
10830 counter = _.slideCount % _.options.slidesToShow == 0 ? counter : counter + 1;
10831 while (breakPoint < _.slideCount) {
10832 ++pagerQty;
10833 breakPoint = counter + _.options.slidesToScroll;
10834 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
10835 }
10836 }
10837
10838 return pagerQty - 1;
10839
10840 };
10841
10842 Slick.prototype.getLeft = function(slideIndex) {
10843
10844 var _ = this,
10845 targetLeft,
10846 verticalHeight,
10847 verticalOffset = 0,
10848 targetSlide;
10849
10850 _.slideOffset = 0;
10851 verticalHeight = _.$slides.first().outerHeight(true);
10852
10853 if (_.options.infinite === true) {
10854 if (_.slideCount > _.options.slidesToShow) {
10855 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
10856 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
10857 }
10858 if (_.slideCount % _.options.slidesToScroll !== 0) {
10859 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
10860 if (slideIndex > _.slideCount) {
10861 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
10862 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
10863 } else {
10864 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
10865 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
10866 }
10867 }
10868 }
10869 } else {
10870 if (slideIndex + _.options.slidesToShow > _.slideCount) {
10871 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
10872 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
10873 }
10874 }
10875
10876 if (_.slideCount <= _.options.slidesToShow) {
10877 _.slideOffset = 0;
10878 verticalOffset = 0;
10879 }
10880
10881 if (_.options.centerMode === true && _.options.infinite === true) {
10882 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
10883 } else if (_.options.centerMode === true) {
10884 _.slideOffset = 0;
10885 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
10886 }
10887
10888 if (_.options.vertical === false) {
10889 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
10890 } else {
10891 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
10892 }
10893
10894 if (_.options.variableWidth === true) {
10895
10896 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
10897 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
10898 } else {
10899 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
10900 }
10901
10902 if (_.options.rtl === true) {
10903 if (targetSlide[0]) {
10904 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
10905 } else {
10906 targetLeft = 0;
10907 }
10908 } else {
10909 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
10910 }
10911
10912 if (_.options.centerMode === true) {
10913 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
10914 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
10915 } else {
10916 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
10917 }
10918
10919 if (_.options.rtl === true) {
10920 if (targetSlide[0]) {
10921 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
10922 } else {
10923 targetLeft = 0;
10924 }
10925 } else {
10926 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
10927 }
10928
10929 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
10930 }
10931 }
10932
10933 return targetLeft;
10934
10935 };
10936
10937 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
10938
10939 var _ = this;
10940
10941 return _.options[option];
10942
10943 };
10944
10945 Slick.prototype.getNavigableIndexes = function() {
10946
10947 var _ = this,
10948 breakPoint = 0,
10949 counter = 0,
10950 indexes = [],
10951 max;
10952
10953 if (_.options.infinite === false) {
10954 max = _.slideCount;
10955 } else {
10956 breakPoint = _.options.slidesToScroll * -1;
10957 counter = _.options.slidesToScroll * -1;
10958 max = _.slideCount * 2;
10959 }
10960
10961 while (breakPoint < max) {
10962 indexes.push(breakPoint);
10963 breakPoint = counter + _.options.slidesToScroll;
10964 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
10965 }
10966
10967 return indexes;
10968
10969 };
10970
10971 Slick.prototype.getSlick = function() {
10972
10973 return this;
10974
10975 };
10976
10977 Slick.prototype.getSlideCount = function() {
10978
10979 var _ = this,
10980 slidesTraversed, swipedSlide, centerOffset;
10981
10982 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
10983
10984 if (_.options.swipeToSlide === true) {
10985 _.$slideTrack.find('.slick-slide').each(function(index, slide) {
10986 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
10987 swipedSlide = slide;
10988 return false;
10989 }
10990 });
10991
10992 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
10993
10994 return slidesTraversed;
10995
10996 } else {
10997 return _.options.slidesToScroll;
10998 }
10999
11000 };
11001
11002 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
11003
11004 var _ = this;
11005
11006 _.changeSlide({
11007 data: {
11008 message: 'index',
11009 index: parseInt(slide)
11010 }
11011 }, dontAnimate);
11012
11013 };
11014
11015 Slick.prototype.init = function(creation) {
11016
11017 var _ = this;
11018
11019 if (!$(_.$slider).hasClass('slick-initialized')) {
11020
11021 $(_.$slider).addClass('slick-initialized');
11022
11023 _.buildRows();
11024 _.buildOut();
11025 _.setProps();
11026 _.startLoad();
11027 _.loadSlider();
11028 _.initializeEvents();
11029 _.updateArrows();
11030 _.updateDots();
11031
11032 }
11033
11034 if (creation) {
11035 _.$slider.trigger('init', [_]);
11036 }
11037
11038 if (_.options.accessibility === true) {
11039 _.initADA();
11040 }
11041
11042 };
11043
11044 Slick.prototype.initArrowEvents = function() {
11045
11046 var _ = this;
11047
11048 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
11049 _.$prevArrow.on('click.slick', {
11050 message: 'previous'
11051 }, _.changeSlide);
11052 _.$nextArrow.on('click.slick', {
11053 message: 'next'
11054 }, _.changeSlide);
11055 }
11056
11057 };
11058
11059 Slick.prototype.initDotEvents = function() {
11060
11061 var _ = this;
11062
11063 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
11064 $('li', _.$dots).on('click.slick', {
11065 message: 'index'
11066 }, _.changeSlide);
11067 }
11068
11069 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
11070 $('li', _.$dots)
11071 .on('mouseenter.slick', $.proxy(_.setPaused, _, true))
11072 .on('mouseleave.slick', $.proxy(_.setPaused, _, false));
11073 }
11074
11075 };
11076
11077 Slick.prototype.initializeEvents = function() {
11078
11079 var _ = this;
11080
11081 _.initArrowEvents();
11082
11083 _.initDotEvents();
11084
11085 _.$list.on('touchstart.slick mousedown.slick', {
11086 action: 'start'
11087 }, _.swipeHandler);
11088 _.$list.on('touchmove.slick mousemove.slick', {
11089 action: 'move'
11090 }, _.swipeHandler);
11091 _.$list.on('touchend.slick mouseup.slick', {
11092 action: 'end'
11093 }, _.swipeHandler);
11094 _.$list.on('touchcancel.slick mouseleave.slick', {
11095 action: 'end'
11096 }, _.swipeHandler);
11097
11098 _.$list.on('click.slick', _.clickHandler);
11099
11100 $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
11101
11102 _.$list.on('mouseenter.slick', $.proxy(_.setPaused, _, true));
11103 _.$list.on('mouseleave.slick', $.proxy(_.setPaused, _, false));
11104
11105 if (_.options.accessibility === true) {
11106 _.$list.on('keydown.slick', _.keyHandler);
11107 }
11108
11109 if (_.options.focusOnSelect === true) {
11110 $(_.$slideTrack).children().on('click.slick', _.selectHandler);
11111 }
11112
11113 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
11114
11115 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
11116
11117 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
11118
11119 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
11120 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
11121
11122 };
11123
11124 Slick.prototype.initUI = function() {
11125
11126 var _ = this;
11127
11128 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
11129
11130 _.$prevArrow.show();
11131 _.$nextArrow.show();
11132
11133 }
11134
11135 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
11136
11137 _.$dots.show();
11138
11139 }
11140
11141 if (_.options.autoplay === true) {
11142
11143 _.autoPlay();
11144
11145 }
11146
11147 };
11148
11149 Slick.prototype.keyHandler = function(event) {
11150
11151 var _ = this;
11152 //Dont slide if the cursor is inside the form fields and arrow keys are pressed
11153 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
11154 if (event.keyCode === 37 && _.options.accessibility === true) {
11155 _.changeSlide({
11156 data: {
11157 message: 'previous'
11158 }
11159 });
11160 } else if (event.keyCode === 39 && _.options.accessibility === true) {
11161 _.changeSlide({
11162 data: {
11163 message: 'next'
11164 }
11165 });
11166 }
11167 }
11168
11169 };
11170
11171 Slick.prototype.lazyLoad = function() {
11172
11173 var _ = this,
11174 loadRange, cloneRange, rangeStart, rangeEnd;
11175
11176 function loadImages(imagesScope) {
11177 $('img[data-lazy]', imagesScope).each(function() {
11178
11179 var image = $(this),
11180 imageSource = $(this).attr('data-lazy'),
11181 imageToLoad = document.createElement('img');
11182
11183 imageToLoad.onload = function() {
11184 image
11185 .animate({ opacity: 0 }, 100, function() {
11186 image
11187 .attr('src', imageSource)
11188 .animate({ opacity: 1 }, 200, function() {
11189 image
11190 .removeAttr('data-lazy')
11191 .removeClass('slick-loading');
11192 });
11193 });
11194 };
11195
11196 imageToLoad.src = imageSource;
11197
11198 });
11199 }
11200
11201 if (_.options.centerMode === true) {
11202 if (_.options.infinite === true) {
11203 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
11204 rangeEnd = rangeStart + _.options.slidesToShow + 2;
11205 } else {
11206 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
11207 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
11208 }
11209 } else {
11210 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
11211 rangeEnd = rangeStart + _.options.slidesToShow;
11212 if (_.options.fade === true) {
11213 if (rangeStart > 0) rangeStart--;
11214 if (rangeEnd <= _.slideCount) rangeEnd++;
11215 }
11216 }
11217
11218 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
11219 loadImages(loadRange);
11220
11221 if (_.slideCount <= _.options.slidesToShow) {
11222 cloneRange = _.$slider.find('.slick-slide');
11223 loadImages(cloneRange);
11224 } else
11225 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
11226 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
11227 loadImages(cloneRange);
11228 } else if (_.currentSlide === 0) {
11229 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
11230 loadImages(cloneRange);
11231 }
11232
11233 };
11234
11235 Slick.prototype.loadSlider = function() {
11236
11237 var _ = this;
11238
11239 _.setPosition();
11240
11241 _.$slideTrack.css({
11242 opacity: 1
11243 });
11244
11245 _.$slider.removeClass('slick-loading');
11246
11247 _.initUI();
11248
11249 if (_.options.lazyLoad === 'progressive') {
11250 _.progressiveLazyLoad();
11251 }
11252
11253 };
11254
11255 Slick.prototype.next = Slick.prototype.slickNext = function() {
11256
11257 var _ = this;
11258
11259 _.changeSlide({
11260 data: {
11261 message: 'next'
11262 }
11263 });
11264
11265 };
11266
11267 Slick.prototype.orientationChange = function() {
11268
11269 var _ = this;
11270
11271 _.checkResponsive();
11272 _.setPosition();
11273
11274 };
11275
11276 Slick.prototype.pause = Slick.prototype.slickPause = function() {
11277
11278 var _ = this;
11279
11280 _.autoPlayClear();
11281 _.paused = true;
11282
11283 };
11284
11285 Slick.prototype.play = Slick.prototype.slickPlay = function() {
11286
11287 var _ = this;
11288
11289 _.paused = false;
11290 _.options.autoplay = true;
11291 _.autoPlay();
11292
11293 };
11294
11295 Slick.prototype.postSlide = function(index) {
11296
11297 var _ = this;
11298
11299 _.$slider.trigger('afterChange', [_, index]);
11300
11301 _.animating = false;
11302
11303 _.setPosition();
11304
11305 _.swipeLeft = null;
11306
11307 if (_.options.autoplay === true && _.paused === false) {
11308 _.autoPlay();
11309 }
11310 if (_.options.accessibility === true) {
11311 _.initADA();
11312 }
11313
11314 };
11315
11316 Slick.prototype.prev = Slick.prototype.slickPrev = function() {
11317
11318 var _ = this;
11319
11320 _.changeSlide({
11321 data: {
11322 message: 'previous'
11323 }
11324 });
11325
11326 };
11327
11328 Slick.prototype.preventDefault = function(event) {
11329 event.preventDefault();
11330 };
11331
11332 Slick.prototype.progressiveLazyLoad = function() {
11333
11334 var _ = this,
11335 imgCount, targetImage;
11336
11337 imgCount = $('img[data-lazy]', _.$slider).length;
11338
11339 if (imgCount > 0) {
11340 targetImage = $('img[data-lazy]', _.$slider).first();
11341 targetImage.attr('src', null);
11342 targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
11343 targetImage.removeAttr('data-lazy');
11344 _.progressiveLazyLoad();
11345
11346 if (_.options.adaptiveHeight === true) {
11347 _.setPosition();
11348 }
11349 })
11350 .error(function() {
11351 targetImage.removeAttr('data-lazy');
11352 _.progressiveLazyLoad();
11353 });
11354 }
11355
11356 };
11357
11358 Slick.prototype.refresh = function( initializing ) {
11359
11360 var _ = this, currentSlide, firstVisible;
11361
11362 firstVisible = _.slideCount - _.options.slidesToShow;
11363
11364 // check that the new breakpoint can actually accept the
11365 // "current slide" as the current slide, otherwise we need
11366 // to set it to the closest possible value.
11367 if ( !_.options.infinite ) {
11368 if ( _.slideCount <= _.options.slidesToShow ) {
11369 _.currentSlide = 0;
11370 } else if ( _.currentSlide > firstVisible ) {
11371 _.currentSlide = firstVisible;
11372 }
11373 }
11374
11375 currentSlide = _.currentSlide;
11376
11377 _.destroy(true);
11378
11379 $.extend(_, _.initials, { currentSlide: currentSlide });
11380
11381 _.init();
11382
11383 if( !initializing ) {
11384
11385 _.changeSlide({
11386 data: {
11387 message: 'index',
11388 index: currentSlide
11389 }
11390 }, false);
11391
11392 }
11393
11394 };
11395
11396 Slick.prototype.registerBreakpoints = function() {
11397
11398 var _ = this, breakpoint, currentBreakpoint, l,
11399 responsiveSettings = _.options.responsive || null;
11400
11401 if ( $.type(responsiveSettings) === "array" && responsiveSettings.length ) {
11402
11403 _.respondTo = _.options.respondTo || 'window';
11404
11405 for ( breakpoint in responsiveSettings ) {
11406
11407 l = _.breakpoints.length-1;
11408 currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
11409
11410 if (responsiveSettings.hasOwnProperty(breakpoint)) {
11411
11412 // loop through the breakpoints and cut out any existing
11413 // ones with the same breakpoint number, we don't want dupes.
11414 while( l >= 0 ) {
11415 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
11416 _.breakpoints.splice(l,1);
11417 }
11418 l--;
11419 }
11420
11421 _.breakpoints.push(currentBreakpoint);
11422 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
11423
11424 }
11425
11426 }
11427
11428 _.breakpoints.sort(function(a, b) {
11429 return ( _.options.mobileFirst ) ? a-b : b-a;
11430 });
11431
11432 }
11433
11434 };
11435
11436 Slick.prototype.reinit = function() {
11437
11438 var _ = this;
11439
11440 _.$slides =
11441 _.$slideTrack
11442 .children(_.options.slide)
11443 .addClass('slick-slide');
11444
11445 _.slideCount = _.$slides.length;
11446
11447 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
11448 _.currentSlide = _.currentSlide - _.options.slidesToScroll;
11449 }
11450
11451 if (_.slideCount <= _.options.slidesToShow) {
11452 _.currentSlide = 0;
11453 }
11454
11455 _.registerBreakpoints();
11456
11457 _.setProps();
11458 _.setupInfinite();
11459 _.buildArrows();
11460 _.updateArrows();
11461 _.initArrowEvents();
11462 _.buildDots();
11463 _.updateDots();
11464 _.initDotEvents();
11465
11466 _.checkResponsive(false, true);
11467
11468 if (_.options.focusOnSelect === true) {
11469 $(_.$slideTrack).children().on('click.slick', _.selectHandler);
11470 }
11471
11472 _.setSlideClasses(0);
11473
11474 _.setPosition();
11475
11476 _.$slider.trigger('reInit', [_]);
11477
11478 if (_.options.autoplay === true) {
11479 _.focusHandler();
11480 }
11481
11482 };
11483
11484 Slick.prototype.resize = function() {
11485
11486 var _ = this;
11487
11488 if ($(window).width() !== _.windowWidth) {
11489 clearTimeout(_.windowDelay);
11490 _.windowDelay = window.setTimeout(function() {
11491 _.windowWidth = $(window).width();
11492 _.checkResponsive();
11493 if( !_.unslicked ) { _.setPosition(); }
11494 }, 50);
11495 }
11496 };
11497
11498 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
11499
11500 var _ = this;
11501
11502 if (typeof(index) === 'boolean') {
11503 removeBefore = index;
11504 index = removeBefore === true ? 0 : _.slideCount - 1;
11505 } else {
11506 index = removeBefore === true ? --index : index;
11507 }
11508
11509 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
11510 return false;
11511 }
11512
11513 _.unload();
11514
11515 if (removeAll === true) {
11516 _.$slideTrack.children().remove();
11517 } else {
11518 _.$slideTrack.children(this.options.slide).eq(index).remove();
11519 }
11520
11521 _.$slides = _.$slideTrack.children(this.options.slide);
11522
11523 _.$slideTrack.children(this.options.slide).detach();
11524
11525 _.$slideTrack.append(_.$slides);
11526
11527 _.$slidesCache = _.$slides;
11528
11529 _.reinit();
11530
11531 };
11532
11533 Slick.prototype.setCSS = function(position) {
11534
11535 var _ = this,
11536 positionProps = {},
11537 x, y;
11538
11539 if (_.options.rtl === true) {
11540 position = -position;
11541 }
11542 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
11543 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
11544
11545 positionProps[_.positionProp] = position;
11546
11547 if (_.transformsEnabled === false) {
11548 _.$slideTrack.css(positionProps);
11549 } else {
11550 positionProps = {};
11551 if (_.cssTransitions === false) {
11552 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
11553 _.$slideTrack.css(positionProps);
11554 } else {
11555 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
11556 _.$slideTrack.css(positionProps);
11557 }
11558 }
11559
11560 };
11561
11562 Slick.prototype.setDimensions = function() {
11563
11564 var _ = this;
11565
11566 if (_.options.vertical === false) {
11567 if (_.options.centerMode === true) {
11568 _.$list.css({
11569 padding: ('0px ' + _.options.centerPadding)
11570 });
11571 }
11572 } else {
11573 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
11574 if (_.options.centerMode === true) {
11575 _.$list.css({
11576 padding: (_.options.centerPadding + ' 0px')
11577 });
11578 }
11579 }
11580
11581 _.listWidth = _.$list.width();
11582 _.listHeight = _.$list.height();
11583
11584
11585 if (_.options.vertical === false && _.options.variableWidth === false) {
11586 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
11587 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
11588
11589 } else if (_.options.variableWidth === true) {
11590 _.$slideTrack.width(5000 * _.slideCount);
11591 } else {
11592 _.slideWidth = Math.ceil(_.listWidth);
11593 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
11594 }
11595
11596 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
11597 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
11598
11599 };
11600
11601 Slick.prototype.setFade = function() {
11602
11603 var _ = this,
11604 targetLeft;
11605
11606 _.$slides.each(function(index, element) {
11607 targetLeft = (_.slideWidth * index) * -1;
11608 if (_.options.rtl === true) {
11609 $(element).css({
11610 position: 'relative',
11611 right: targetLeft,
11612 top: 0,
11613 zIndex: _.options.zIndex - 2,
11614 opacity: 0
11615 });
11616 } else {
11617 $(element).css({
11618 position: 'relative',
11619 left: targetLeft,
11620 top: 0,
11621 zIndex: _.options.zIndex - 2,
11622 opacity: 0
11623 });
11624 }
11625 });
11626
11627 _.$slides.eq(_.currentSlide).css({
11628 zIndex: _.options.zIndex - 1,
11629 opacity: 1
11630 });
11631
11632 };
11633
11634 Slick.prototype.setHeight = function() {
11635
11636 var _ = this;
11637
11638 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
11639 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
11640 _.$list.css('height', targetHeight);
11641 }
11642
11643 };
11644
11645 Slick.prototype.setOption = Slick.prototype.slickSetOption = function(option, value, refresh) {
11646
11647 var _ = this, l, item;
11648
11649 if( option === "responsive" && $.type(value) === "array" ) {
11650 for ( item in value ) {
11651 if( $.type( _.options.responsive ) !== "array" ) {
11652 _.options.responsive = [ value[item] ];
11653 } else {
11654 l = _.options.responsive.length-1;
11655 // loop through the responsive object and splice out duplicates.
11656 while( l >= 0 ) {
11657 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
11658 _.options.responsive.splice(l,1);
11659 }
11660 l--;
11661 }
11662 _.options.responsive.push( value[item] );
11663 }
11664 }
11665 } else {
11666 _.options[option] = value;
11667 }
11668
11669 if (refresh === true) {
11670 _.unload();
11671 _.reinit();
11672 }
11673
11674 };
11675
11676 Slick.prototype.setPosition = function() {
11677
11678 var _ = this;
11679
11680 _.setDimensions();
11681
11682 _.setHeight();
11683
11684 if (_.options.fade === false) {
11685 _.setCSS(_.getLeft(_.currentSlide));
11686 } else {
11687 _.setFade();
11688 }
11689
11690 _.$slider.trigger('setPosition', [_]);
11691
11692 };
11693
11694 Slick.prototype.setProps = function() {
11695
11696 var _ = this,
11697 bodyStyle = document.body.style;
11698
11699 _.positionProp = _.options.vertical === true ? 'top' : 'left';
11700
11701 if (_.positionProp === 'top') {
11702 _.$slider.addClass('slick-vertical');
11703 } else {
11704 _.$slider.removeClass('slick-vertical');
11705 }
11706
11707 if (bodyStyle.WebkitTransition !== undefined ||
11708 bodyStyle.MozTransition !== undefined ||
11709 bodyStyle.msTransition !== undefined) {
11710 if (_.options.useCSS === true) {
11711 _.cssTransitions = true;
11712 }
11713 }
11714
11715 if ( _.options.fade ) {
11716 if ( typeof _.options.zIndex === 'number' ) {
11717 if( _.options.zIndex < 3 ) {
11718 _.options.zIndex = 3;
11719 }
11720 } else {
11721 _.options.zIndex = _.defaults.zIndex;
11722 }
11723 }
11724
11725 if (bodyStyle.OTransform !== undefined) {
11726 _.animType = 'OTransform';
11727 _.transformType = '-o-transform';
11728 _.transitionType = 'OTransition';
11729 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
11730 }
11731 if (bodyStyle.MozTransform !== undefined) {
11732 _.animType = 'MozTransform';
11733 _.transformType = '-moz-transform';
11734 _.transitionType = 'MozTransition';
11735 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
11736 }
11737 if (bodyStyle.webkitTransform !== undefined) {
11738 _.animType = 'webkitTransform';
11739 _.transformType = '-webkit-transform';
11740 _.transitionType = 'webkitTransition';
11741 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
11742 }
11743 if (bodyStyle.msTransform !== undefined) {
11744 _.animType = 'msTransform';
11745 _.transformType = '-ms-transform';
11746 _.transitionType = 'msTransition';
11747 if (bodyStyle.msTransform === undefined) _.animType = false;
11748 }
11749 if (bodyStyle.transform !== undefined && _.animType !== false) {
11750 _.animType = 'transform';
11751 _.transformType = 'transform';
11752 _.transitionType = 'transition';
11753 }
11754 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
11755 };
11756
11757
11758 Slick.prototype.setSlideClasses = function(index) {
11759
11760 var _ = this,
11761 centerOffset, allSlides, indexOffset, remainder;
11762
11763 allSlides = _.$slider
11764 .find('.slick-slide')
11765 .removeClass('slick-active slick-center slick-current')
11766 .attr('aria-hidden', 'true');
11767
11768 _.$slides
11769 .eq(index)
11770 .addClass('slick-current');
11771
11772 if (_.options.centerMode === true) {
11773
11774 centerOffset = Math.floor(_.options.slidesToShow / 2);
11775
11776 if (_.options.infinite === true) {
11777
11778 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
11779
11780 _.$slides
11781 .slice(index - centerOffset, index + centerOffset + 1)
11782 .addClass('slick-active')
11783 .attr('aria-hidden', 'false');
11784
11785 } else {
11786
11787 indexOffset = _.options.slidesToShow + index;
11788 allSlides
11789 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
11790 .addClass('slick-active')
11791 .attr('aria-hidden', 'false');
11792
11793 }
11794
11795 if (index === 0) {
11796
11797 allSlides
11798 .eq(allSlides.length - 1 - _.options.slidesToShow)
11799 .addClass('slick-center');
11800
11801 } else if (index === _.slideCount - 1) {
11802
11803 allSlides
11804 .eq(_.options.slidesToShow)
11805 .addClass('slick-center');
11806
11807 }
11808
11809 }
11810
11811 _.$slides
11812 .eq(index)
11813 .addClass('slick-center');
11814
11815 } else {
11816
11817 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
11818
11819 _.$slides
11820 .slice(index, index + _.options.slidesToShow)
11821 .addClass('slick-active')
11822 .attr('aria-hidden', 'false');
11823
11824 } else if (allSlides.length <= _.options.slidesToShow) {
11825
11826 allSlides
11827 .addClass('slick-active')
11828 .attr('aria-hidden', 'false');
11829
11830 } else {
11831
11832 remainder = _.slideCount % _.options.slidesToShow;
11833 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
11834
11835 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
11836
11837 allSlides
11838 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
11839 .addClass('slick-active')
11840 .attr('aria-hidden', 'false');
11841
11842 } else {
11843
11844 allSlides
11845 .slice(indexOffset, indexOffset + _.options.slidesToShow)
11846 .addClass('slick-active')
11847 .attr('aria-hidden', 'false');
11848
11849 }
11850
11851 }
11852
11853 }
11854
11855 if (_.options.lazyLoad === 'ondemand') {
11856 _.lazyLoad();
11857 }
11858
11859 };
11860
11861 Slick.prototype.setupInfinite = function() {
11862
11863 var _ = this,
11864 i, slideIndex, infiniteCount;
11865
11866 if (_.options.fade === true) {
11867 _.options.centerMode = false;
11868 }
11869
11870 if (_.options.infinite === true && _.options.fade === false) {
11871
11872 slideIndex = null;
11873
11874 if (_.slideCount > _.options.slidesToShow) {
11875
11876 if (_.options.centerMode === true) {
11877 infiniteCount = _.options.slidesToShow + 1;
11878 } else {
11879 infiniteCount = _.options.slidesToShow;
11880 }
11881
11882 for (i = _.slideCount; i > (_.slideCount -
11883 infiniteCount); i -= 1) {
11884 slideIndex = i - 1;
11885 $(_.$slides[slideIndex]).clone(true).attr('id', '')
11886 .attr('data-slick-index', slideIndex - _.slideCount)
11887 .prependTo(_.$slideTrack).addClass('slick-cloned');
11888 }
11889 for (i = 0; i < infiniteCount; i += 1) {
11890 slideIndex = i;
11891 $(_.$slides[slideIndex]).clone(true).attr('id', '')
11892 .attr('data-slick-index', slideIndex + _.slideCount)
11893 .appendTo(_.$slideTrack).addClass('slick-cloned');
11894 }
11895 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
11896 $(this).attr('id', '');
11897 });
11898
11899 }
11900
11901 }
11902
11903 };
11904
11905 Slick.prototype.setPaused = function(paused) {
11906
11907 var _ = this;
11908
11909 if ( _.options.autoplay === true && _.options.pauseOnHover === true ) {
11910 _.paused = paused;
11911 if (!paused) {
11912 _.autoPlay();
11913 } else {
11914 _.autoPlayClear();
11915 }
11916 }
11917 };
11918
11919 Slick.prototype.selectHandler = function(event) {
11920
11921 var _ = this;
11922
11923 var targetElement =
11924 $(event.target).is('.slick-slide') ?
11925 $(event.target) :
11926 $(event.target).parents('.slick-slide');
11927
11928 var index = parseInt(targetElement.attr('data-slick-index'));
11929
11930 if (!index) index = 0;
11931
11932 if (_.slideCount <= _.options.slidesToShow) {
11933
11934 _.setSlideClasses(index);
11935 _.asNavFor(index);
11936 return;
11937
11938 }
11939
11940 _.slideHandler(index);
11941
11942 };
11943
11944 Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
11945
11946 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
11947 _ = this, navTarget;
11948
11949 sync = sync || false;
11950
11951 if (_.animating === true && _.options.waitForAnimate === true) {
11952 return;
11953 }
11954
11955 if (_.options.fade === true && _.currentSlide === index) {
11956 return;
11957 }
11958
11959 if (_.slideCount <= _.options.slidesToShow) {
11960 return;
11961 }
11962
11963 if (sync === false) {
11964 _.asNavFor(index);
11965 }
11966
11967 targetSlide = index;
11968 targetLeft = _.getLeft(targetSlide);
11969 slideLeft = _.getLeft(_.currentSlide);
11970
11971 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
11972
11973 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
11974 if (_.options.fade === false) {
11975 targetSlide = _.currentSlide;
11976 if (dontAnimate !== true) {
11977 _.animateSlide(slideLeft, function() {
11978 _.postSlide(targetSlide);
11979 });
11980 } else {
11981 _.postSlide(targetSlide);
11982 }
11983 }
11984 return;
11985 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
11986 if (_.options.fade === false) {
11987 targetSlide = _.currentSlide;
11988 if (dontAnimate !== true) {
11989 _.animateSlide(slideLeft, function() {
11990 _.postSlide(targetSlide);
11991 });
11992 } else {
11993 _.postSlide(targetSlide);
11994 }
11995 }
11996 return;
11997 }
11998
11999 if (_.options.autoplay === true) {
12000 clearInterval(_.autoPlayTimer);
12001 }
12002
12003 if (targetSlide < 0) {
12004 if (_.slideCount % _.options.slidesToScroll !== 0) {
12005 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
12006 } else {
12007 animSlide = _.slideCount + targetSlide;
12008 }
12009 } else if (targetSlide >= _.slideCount) {
12010 if (_.slideCount % _.options.slidesToScroll !== 0) {
12011 animSlide = 0;
12012 } else {
12013 animSlide = targetSlide - _.slideCount;
12014 }
12015 } else {
12016 animSlide = targetSlide;
12017 }
12018
12019 _.animating = true;
12020
12021 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
12022
12023 oldSlide = _.currentSlide;
12024 _.currentSlide = animSlide;
12025
12026 _.setSlideClasses(_.currentSlide);
12027
12028 if ( _.options.asNavFor ) {
12029
12030 navTarget = _.getNavTarget();
12031 navTarget = navTarget.slick('getSlick');
12032
12033 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
12034 navTarget.setSlideClasses(_.currentSlide);
12035 }
12036
12037 }
12038
12039 _.updateDots();
12040 _.updateArrows();
12041
12042 if (_.options.fade === true) {
12043 if (dontAnimate !== true) {
12044
12045 _.fadeSlideOut(oldSlide);
12046
12047 _.fadeSlide(animSlide, function() {
12048 _.postSlide(animSlide);
12049 });
12050
12051 } else {
12052 _.postSlide(animSlide);
12053 }
12054 _.animateHeight();
12055 return;
12056 }
12057
12058 if (dontAnimate !== true) {
12059 _.animateSlide(targetLeft, function() {
12060 _.postSlide(animSlide);
12061 });
12062 } else {
12063 _.postSlide(animSlide);
12064 }
12065
12066 };
12067
12068 Slick.prototype.startLoad = function() {
12069
12070 var _ = this;
12071
12072 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
12073
12074 _.$prevArrow.hide();
12075 _.$nextArrow.hide();
12076
12077 }
12078
12079 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
12080
12081 _.$dots.hide();
12082
12083 }
12084
12085 _.$slider.addClass('slick-loading');
12086
12087 };
12088
12089 Slick.prototype.swipeDirection = function() {
12090
12091 var xDist, yDist, r, swipeAngle, _ = this;
12092
12093 xDist = _.touchObject.startX - _.touchObject.curX;
12094 yDist = _.touchObject.startY - _.touchObject.curY;
12095 r = Math.atan2(yDist, xDist);
12096
12097 swipeAngle = Math.round(r * 180 / Math.PI);
12098 if (swipeAngle < 0) {
12099 swipeAngle = 360 - Math.abs(swipeAngle);
12100 }
12101
12102 if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
12103 return (_.options.rtl === false ? 'left' : 'right');
12104 }
12105 if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
12106 return (_.options.rtl === false ? 'left' : 'right');
12107 }
12108 if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
12109 return (_.options.rtl === false ? 'right' : 'left');
12110 }
12111 if (_.options.verticalSwiping === true) {
12112 if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
12113 return 'left';
12114 } else {
12115 return 'right';
12116 }
12117 }
12118
12119 return 'vertical';
12120
12121 };
12122
12123 Slick.prototype.swipeEnd = function(event) {
12124
12125 var _ = this,
12126 slideCount;
12127
12128 _.dragging = false;
12129
12130 _.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;
12131
12132 if (_.touchObject.curX === undefined) {
12133 return false;
12134 }
12135
12136 if (_.touchObject.edgeHit === true) {
12137 _.$slider.trigger('edge', [_, _.swipeDirection()]);
12138 }
12139
12140 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
12141
12142 switch (_.swipeDirection()) {
12143 case 'left':
12144 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount();
12145 _.slideHandler(slideCount);
12146 _.currentDirection = 0;
12147 _.touchObject = {};
12148 _.$slider.trigger('swipe', [_, 'left']);
12149 break;
12150
12151 case 'right':
12152 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount();
12153 _.slideHandler(slideCount);
12154 _.currentDirection = 1;
12155 _.touchObject = {};
12156 _.$slider.trigger('swipe', [_, 'right']);
12157 break;
12158 }
12159 } else {
12160 if (_.touchObject.startX !== _.touchObject.curX) {
12161 _.slideHandler(_.currentSlide);
12162 _.touchObject = {};
12163 }
12164 }
12165
12166 };
12167
12168 Slick.prototype.swipeHandler = function(event) {
12169
12170 var _ = this;
12171
12172 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
12173 return;
12174 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
12175 return;
12176 }
12177
12178 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
12179 event.originalEvent.touches.length : 1;
12180
12181 _.touchObject.minSwipe = _.listWidth / _.options
12182 .touchThreshold;
12183
12184 if (_.options.verticalSwiping === true) {
12185 _.touchObject.minSwipe = _.listHeight / _.options
12186 .touchThreshold;
12187 }
12188
12189 switch (event.data.action) {
12190
12191 case 'start':
12192 _.swipeStart(event);
12193 break;
12194
12195 case 'move':
12196 _.swipeMove(event);
12197 break;
12198
12199 case 'end':
12200 _.swipeEnd(event);
12201 break;
12202
12203 }
12204
12205 };
12206
12207 Slick.prototype.swipeMove = function(event) {
12208
12209 var _ = this,
12210 edgeWasHit = false,
12211 curLeft, swipeDirection, swipeLength, positionOffset, touches;
12212
12213 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
12214
12215 if (!_.dragging || touches && touches.length !== 1) {
12216 return false;
12217 }
12218
12219 curLeft = _.getLeft(_.currentSlide);
12220
12221 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
12222 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
12223
12224 _.touchObject.swipeLength = Math.round(Math.sqrt(
12225 Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
12226
12227 if (_.options.verticalSwiping === true) {
12228 _.touchObject.swipeLength = Math.round(Math.sqrt(
12229 Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
12230 }
12231
12232 swipeDirection = _.swipeDirection();
12233
12234 if (swipeDirection === 'vertical') {
12235 return;
12236 }
12237
12238 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
12239 event.preventDefault();
12240 }
12241
12242 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
12243 if (_.options.verticalSwiping === true) {
12244 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
12245 }
12246
12247
12248 swipeLength = _.touchObject.swipeLength;
12249
12250 _.touchObject.edgeHit = false;
12251
12252 if (_.options.infinite === false) {
12253 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
12254 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
12255 _.touchObject.edgeHit = true;
12256 }
12257 }
12258
12259 if (_.options.vertical === false) {
12260 _.swipeLeft = curLeft + swipeLength * positionOffset;
12261 } else {
12262 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
12263 }
12264 if (_.options.verticalSwiping === true) {
12265 _.swipeLeft = curLeft + swipeLength * positionOffset;
12266 }
12267
12268 if (_.options.fade === true || _.options.touchMove === false) {
12269 return false;
12270 }
12271
12272 if (_.animating === true) {
12273 _.swipeLeft = null;
12274 return false;
12275 }
12276
12277 _.setCSS(_.swipeLeft);
12278
12279 };
12280
12281 Slick.prototype.swipeStart = function(event) {
12282
12283 var _ = this,
12284 touches;
12285
12286 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
12287 _.touchObject = {};
12288 return false;
12289 }
12290
12291 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
12292 touches = event.originalEvent.touches[0];
12293 }
12294
12295 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
12296 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
12297
12298 _.dragging = true;
12299
12300 };
12301
12302 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
12303
12304 var _ = this;
12305
12306 if (_.$slidesCache !== null) {
12307
12308 _.unload();
12309
12310 _.$slideTrack.children(this.options.slide).detach();
12311
12312 _.$slidesCache.appendTo(_.$slideTrack);
12313
12314 _.reinit();
12315
12316 }
12317
12318 };
12319
12320 Slick.prototype.unload = function() {
12321
12322 var _ = this;
12323
12324 $('.slick-cloned', _.$slider).remove();
12325
12326 if (_.$dots) {
12327 _.$dots.remove();
12328 }
12329
12330 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
12331 _.$prevArrow.remove();
12332 }
12333
12334 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
12335 _.$nextArrow.remove();
12336 }
12337
12338 _.$slides
12339 .removeClass('slick-slide slick-active slick-visible slick-current')
12340 .attr('aria-hidden', 'true')
12341 .css('width', '');
12342
12343 };
12344
12345 Slick.prototype.unslick = function(fromBreakpoint) {
12346
12347 var _ = this;
12348 _.$slider.trigger('unslick', [_, fromBreakpoint]);
12349 _.destroy();
12350
12351 };
12352
12353 Slick.prototype.updateArrows = function() {
12354
12355 var _ = this,
12356 centerOffset;
12357
12358 centerOffset = Math.floor(_.options.slidesToShow / 2);
12359
12360 if ( _.options.arrows === true &&
12361 _.slideCount > _.options.slidesToShow &&
12362 !_.options.infinite ) {
12363
12364 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
12365 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
12366
12367 if (_.currentSlide === 0) {
12368
12369 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
12370 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
12371
12372 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
12373
12374 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
12375 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
12376
12377 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
12378
12379 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
12380 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
12381
12382 }
12383
12384 }
12385
12386 };
12387
12388 Slick.prototype.updateDots = function() {
12389
12390 var _ = this;
12391
12392 if (_.$dots !== null) {
12393
12394 _.$dots
12395 .find('li')
12396 .removeClass('slick-active')
12397 .attr('aria-hidden', 'true');
12398
12399 _.$dots
12400 .find('li')
12401 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
12402 .addClass('slick-active')
12403 .attr('aria-hidden', 'false');
12404
12405 }
12406
12407 };
12408
12409 Slick.prototype.visibility = function() {
12410
12411 var _ = this;
12412
12413 if (document[_.hidden]) {
12414 _.paused = true;
12415 _.autoPlayClear();
12416 } else {
12417 if (_.options.autoplay === true) {
12418 _.paused = false;
12419 _.autoPlay();
12420 }
12421 }
12422
12423 };
12424 Slick.prototype.initADA = function() {
12425 var _ = this;
12426 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
12427 'aria-hidden': 'true',
12428 'tabindex': '-1'
12429 }).find('a, input, button, select').attr({
12430 'tabindex': '-1'
12431 });
12432
12433 _.$slideTrack.attr('role', 'listbox');
12434
12435 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
12436 $(this).attr({
12437 'role': 'option',
12438 'aria-describedby': 'slick-slide' + _.instanceUid + i + ''
12439 });
12440 });
12441
12442 if (_.$dots !== null) {
12443 _.$dots.attr('role', 'tablist').find('li').each(function(i) {
12444 $(this).attr({
12445 'role': 'presentation',
12446 'aria-selected': 'false',
12447 'aria-controls': 'navigation' + _.instanceUid + i + '',
12448 'id': 'slick-slide' + _.instanceUid + i + ''
12449 });
12450 })
12451 .first().attr('aria-selected', 'true').end()
12452 .find('button').attr('role', 'button').end()
12453 .closest('div').attr('role', 'toolbar');
12454 }
12455 _.activateADA();
12456
12457 };
12458
12459 Slick.prototype.activateADA = function() {
12460 var _ = this;
12461
12462 _.$slideTrack.find('.slick-active').attr({
12463 'aria-hidden': 'false'
12464 }).find('a, input, button, select').attr({
12465 'tabindex': '0'
12466 });
12467
12468 };
12469
12470 Slick.prototype.focusHandler = function() {
12471 var _ = this;
12472 _.$slider.on('focus.slick blur.slick', '*', function(event) {
12473 event.stopImmediatePropagation();
12474 var sf = $(this);
12475 setTimeout(function() {
12476 if (_.isPlay) {
12477 if (sf.is(':focus')) {
12478 _.autoPlayClear();
12479 _.paused = true;
12480 } else {
12481 _.paused = false;
12482 _.autoPlay();
12483 }
12484 }
12485 }, 0);
12486 });
12487 };
12488
12489 $.fn.slick = function() {
12490 var _ = this,
12491 opt = arguments[0],
12492 args = Array.prototype.slice.call(arguments, 1),
12493 l = _.length,
12494 i,
12495 ret;
12496 for (i = 0; i < l; i++) {
12497 if (typeof opt == 'object' || typeof opt == 'undefined')
12498 _[i].slick = new Slick(_[i], opt);
12499 else
12500 ret = _[i].slick[opt].apply(_[i].slick, args);
12501 if (typeof ret != 'undefined') return ret;
12502 }
12503 return _;
12504 };
12505
12506 return function () {
12507 var args = Array.prototype.slice.call(arguments);
12508 $.fn.slick.apply(args[0], args.slice(1));
12509 };
12510
12511}));
12512
12513},{"jquery":1}],3:[function(require,module,exports){
12514//import "babel-polyfill"
12515var slick = require('slick-carousel-browserify');
12516slick($('#slide_tweet .section_content'))
12517//import './header';
12518//import './twitter';
12519//import './pages_slide';
12520////import './modernizr';
12521////import './main';
12522//import './home';
12523//import './tombstone';
12524//import './tombstones_filter';
12525//import './toggle';
12526
12527},{"slick-carousel-browserify":2}]},{},[3]);