1(self["webpackChunkgulp_pug_starter"] = self["webpackChunkgulp_pug_starter"] || []).push([["vendor"],{ 2
vendor: 290,253 bytes, lines 3-10922
3/***/ "./node_modules/jquery/dist/jquery.js": 4/*!********************************************!*\ 5 !*** ./node_modules/jquery/dist/jquery.js ***! 6 \********************************************/ 7/***/ (function(module, exports) { 8 9var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 10 * jQuery JavaScript Library v3.6.1 11 * https://jquery.com/ 12 * 13 * Includes Sizzle.js 14 * https://sizzlejs.com/ 15 * 16 * Copyright OpenJS Foundation and other contributors 17 * Released under the MIT license 18 * https://jquery.org/license 19 * 20 * Date: 2022-08-26T17:52Z 21 */ 22( function( global, factory ) { 23 24 "use strict"; 25 26 if ( true && typeof module.exports === "object" ) { 27 28 // For CommonJS and CommonJS-like environments where a proper `window` 29 // is present, execute the factory and get jQuery. 30 // For environments that do not have a `window` with a `document` 31 // (such as Node.js), expose a factory as module.exports. 32 // This accentuates the need for the creation of a real `window`. 33 // e.g. var jQuery = require("jquery")(window); 34 // See ticket trac-14549 for more info. 35 module.exports = global.document ? 36 factory( global, true ) : 37 function( w ) { 38 if ( !w.document ) { 39 throw new Error( "jQuery requires a window with a document" ); 40 } 41 return factory( w ); 42 }; 43 } else { 44 factory( global ); 45 } 46 47// Pass this if window is not defined yet 48} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 49 50// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 51// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 52// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 53// enough that all such attempts are guarded in a try block. 54"use strict"; 55 56var arr = []; 57 58var getProto = Object.getPrototypeOf; 59 60var slice = arr.slice; 61 62var flat = arr.flat ? function( array ) { 63 return arr.flat.call( array ); 64} : function( array ) { 65 return arr.concat.apply( [], array ); 66}; 67 68 69var push = arr.push; 70 71var indexOf = arr.indexOf; 72 73var class2type = {}; 74 75var toString = class2type.toString; 76 77var hasOwn = class2type.hasOwnProperty; 78 79var fnToString = hasOwn.toString; 80 81var ObjectFunctionString = fnToString.call( Object ); 82 83var support = {}; 84 85var isFunction = function isFunction( obj ) { 86 87 // Support: Chrome <=57, Firefox <=52 88 // In some browsers, typeof returns "function" for HTML <object> elements 89 // (i.e., `typeof document.createElement( "object" ) === "function"`). 90 // We don't want to classify *any* DOM node as a function. 91 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 92 // Plus for old WebKit, typeof returns "function" for HTML collections 93 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 94 return typeof obj === "function" && typeof obj.nodeType !== "number" && 95 typeof obj.item !== "function"; 96 }; 97 98 99var isWindow = function isWindow( obj ) { 100 return obj != null && obj === obj.window; 101 }; 102 103 104var document = window.document; 105 106 107 108 var preservedScriptAttributes = { 109 type: true, 110 src: true, 111 nonce: true, 112 noModule: true 113 }; 114 115 function DOMEval( code, node, doc ) { 116 doc = doc || document; 117 118 var i, val, 119 script = doc.createElement( "script" ); 120 121 script.text = code; 122 if ( node ) { 123 for ( i in preservedScriptAttributes ) { 124 125 // Support: Firefox 64+, Edge 18+ 126 // Some browsers don't support the "nonce" property on scripts. 127 // On the other hand, just using `getAttribute` is not enough as 128 // the `nonce` attribute is reset to an empty string whenever it 129 // becomes browsing-context connected. 130 // See https://github.com/whatwg/html/issues/2369 131 // See https://html.spec.whatwg.org/#nonce-attributes 132 // The `node.getAttribute` check was added for the sake of 133 // `jQuery.globalEval` so that it can fake a nonce-containing node 134 // via an object. 135 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 136 if ( val ) { 137 script.setAttribute( i, val ); 138 } 139 } 140 } 141 doc.head.appendChild( script ).parentNode.removeChild( script ); 142 } 143 144 145function toType( obj ) { 146 if ( obj == null ) { 147 return obj + ""; 148 } 149 150 // Support: Android <=2.3 only (functionish RegExp) 151 return typeof obj === "object" || typeof obj === "function" ? 152 class2type[ toString.call( obj ) ] || "object" : 153 typeof obj; 154} 155/* global Symbol */ 156// Defining this global in .eslintrc.json would create a danger of using the global 157// unguarded in another place, it seems safer to define global only for this module 158 159 160 161var 162 version = "3.6.1", 163 164 // Define a local copy of jQuery 165 jQuery = function( selector, context ) { 166 167 // The jQuery object is actually just the init constructor 'enhanced' 168 // Need init if jQuery is called (just allow error to be thrown if not included) 169 return new jQuery.fn.init( selector, context ); 170 }; 171 172jQuery.fn = jQuery.prototype = { 173 174 // The current version of jQuery being used 175 jquery: version, 176 177 constructor: jQuery, 178 179 // The default length of a jQuery object is 0 180 length: 0, 181 182 toArray: function() { 183 return slice.call( this ); 184 }, 185 186 // Get the Nth element in the matched element set OR 187 // Get the whole matched element set as a clean array 188 get: function( num ) { 189 190 // Return all the elements in a clean array 191 if ( num == null ) { 192 return slice.call( this ); 193 } 194 195 // Return just the one element from the set 196 return num < 0 ? this[ num + this.length ] : this[ num ]; 197 }, 198 199 // Take an array of elements and push it onto the stack 200 // (returning the new matched element set) 201 pushStack: function( elems ) { 202 203 // Build a new jQuery matched element set 204 var ret = jQuery.merge( this.constructor(), elems ); 205 206 // Add the old object onto the stack (as a reference) 207 ret.prevObject = this; 208 209 // Return the newly-formed element set 210 return ret; 211 }, 212 213 // Execute a callback for every element in the matched set. 214 each: function( callback ) { 215 return jQuery.each( this, callback ); 216 }, 217 218 map: function( callback ) { 219 return this.pushStack( jQuery.map( this, function( elem, i ) { 220 return callback.call( elem, i, elem ); 221 } ) ); 222 }, 223 224 slice: function() { 225 return this.pushStack( slice.apply( this, arguments ) ); 226 }, 227 228 first: function() { 229 return this.eq( 0 ); 230 }, 231 232 last: function() { 233 return this.eq( -1 ); 234 }, 235 236 even: function() { 237 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 238 return ( i + 1 ) % 2; 239 } ) ); 240 }, 241 242 odd: function() { 243 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 244 return i % 2; 245 } ) ); 246 }, 247 248 eq: function( i ) { 249 var len = this.length, 250 j = +i + ( i < 0 ? len : 0 ); 251 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 252 }, 253 254 end: function() { 255 return this.prevObject || this.constructor(); 256 }, 257 258 // For internal use only. 259 // Behaves like an Array's method, not like a jQuery method. 260 push: push, 261 sort: arr.sort, 262 splice: arr.splice 263}; 264 265jQuery.extend = jQuery.fn.extend = function() { 266 var options, name, src, copy, copyIsArray, clone, 267 target = arguments[ 0 ] || {}, 268 i = 1, 269 length = arguments.length, 270 deep = false; 271 272 // Handle a deep copy situation 273 if ( typeof target === "boolean" ) { 274 deep = target; 275 276 // Skip the boolean and the target 277 target = arguments[ i ] || {}; 278 i++; 279 } 280 281 // Handle case when target is a string or something (possible in deep copy) 282 if ( typeof target !== "object" && !isFunction( target ) ) { 283 target = {}; 284 } 285 286 // Extend jQuery itself if only one argument is passed 287 if ( i === length ) { 288 target = this; 289 i--; 290 } 291 292 for ( ; i < length; i++ ) { 293 294 // Only deal with non-null/undefined values 295 if ( ( options = arguments[ i ] ) != null ) { 296 297 // Extend the base object 298 for ( name in options ) { 299 copy = options[ name ]; 300 301 // Prevent Object.prototype pollution 302 // Prevent never-ending loop 303 if ( name === "__proto__" || target === copy ) { 304 continue; 305 } 306 307 // Recurse if we're merging plain objects or arrays 308 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 309 ( copyIsArray = Array.isArray( copy ) ) ) ) { 310 src = target[ name ]; 311 312 // Ensure proper type for the source value 313 if ( copyIsArray && !Array.isArray( src ) ) { 314 clone = []; 315 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 316 clone = {}; 317 } else { 318 clone = src; 319 } 320 copyIsArray = false; 321 322 // Never move original objects, clone them 323 target[ name ] = jQuery.extend( deep, clone, copy ); 324 325 // Don't bring in undefined values 326 } else if ( copy !== undefined ) { 327 target[ name ] = copy; 328 } 329 } 330 } 331 } 332 333 // Return the modified object 334 return target; 335}; 336 337jQuery.extend( { 338 339 // Unique for each copy of jQuery on the page 340 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 341 342 // Assume jQuery is ready without the ready module 343 isReady: true, 344 345 error: function( msg ) { 346 throw new Error( msg ); 347 }, 348 349 noop: function() {}, 350 351 isPlainObject: function( obj ) { 352 var proto, Ctor; 353 354 // Detect obvious negatives 355 // Use toString instead of jQuery.type to catch host objects 356 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 357 return false; 358 } 359 360 proto = getProto( obj ); 361 362 // Objects with no prototype (e.g., `Object.create( null )`) are plain 363 if ( !proto ) { 364 return true; 365 } 366 367 // Objects with prototype are plain iff they were constructed by a global Object function 368 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 369 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 370 }, 371 372 isEmptyObject: function( obj ) { 373 var name; 374 375 for ( name in obj ) { 376 return false; 377 } 378 return true; 379 }, 380 381 // Evaluates a script in a provided context; falls back to the global one 382 // if not specified. 383 globalEval: function( code, options, doc ) { 384 DOMEval( code, { nonce: options && options.nonce }, doc ); 385 }, 386 387 each: function( obj, callback ) { 388 var length, i = 0; 389 390 if ( isArrayLike( obj ) ) { 391 length = obj.length; 392 for ( ; i < length; i++ ) { 393 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 394 break; 395 } 396 } 397 } else { 398 for ( i in obj ) { 399 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 400 break; 401 } 402 } 403 } 404 405 return obj; 406 }, 407 408 // results is for internal usage only 409 makeArray: function( arr, results ) { 410 var ret = results || []; 411 412 if ( arr != null ) { 413 if ( isArrayLike( Object( arr ) ) ) { 414 jQuery.merge( ret, 415 typeof arr === "string" ? 416 [ arr ] : arr 417 ); 418 } else { 419 push.call( ret, arr ); 420 } 421 } 422 423 return ret; 424 }, 425 426 inArray: function( elem, arr, i ) { 427 return arr == null ? -1 : indexOf.call( arr, elem, i ); 428 }, 429 430 // Support: Android <=4.0 only, PhantomJS 1 only 431 // push.apply(_, arraylike) throws on ancient WebKit 432 merge: function( first, second ) { 433 var len = +second.length, 434 j = 0, 435 i = first.length; 436 437 for ( ; j < len; j++ ) { 438 first[ i++ ] = second[ j ]; 439 } 440 441 first.length = i; 442 443 return first; 444 }, 445 446 grep: function( elems, callback, invert ) { 447 var callbackInverse, 448 matches = [], 449 i = 0, 450 length = elems.length, 451 callbackExpect = !invert; 452 453 // Go through the array, only saving the items 454 // that pass the validator function 455 for ( ; i < length; i++ ) { 456 callbackInverse = !callback( elems[ i ], i ); 457 if ( callbackInverse !== callbackExpect ) { 458 matches.push( elems[ i ] ); 459 } 460 } 461 462 return matches; 463 }, 464 465 // arg is for internal usage only 466 map: function( elems, callback, arg ) { 467 var length, value, 468 i = 0, 469 ret = []; 470 471 // Go through the array, translating each of the items to their new values 472 if ( isArrayLike( elems ) ) { 473 length = elems.length; 474 for ( ; i < length; i++ ) { 475 value = callback( elems[ i ], i, arg ); 476 477 if ( value != null ) { 478 ret.push( value ); 479 } 480 } 481 482 // Go through every key on the object, 483 } else { 484 for ( i in elems ) { 485 value = callback( elems[ i ], i, arg ); 486 487 if ( value != null ) { 488 ret.push( value ); 489 } 490 } 491 } 492 493 // Flatten any nested arrays 494 return flat( ret ); 495 }, 496 497 // A global GUID counter for objects 498 guid: 1, 499 500 // jQuery.support is not used in Core but other projects attach their 501 // properties to it so it needs to exist. 502 support: support 503} ); 504 505if ( typeof Symbol === "function" ) { 506 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 507} 508 509// Populate the class2type map 510jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 511 function( _i, name ) { 512 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 513 } ); 514 515function isArrayLike( obj ) { 516 517 // Support: real iOS 8.2 only (not reproducible in simulator) 518 // `in` check used to prevent JIT error (gh-2145) 519 // hasOwn isn't used here due to false negatives 520 // regarding Nodelist length in IE 521 var length = !!obj && "length" in obj && obj.length, 522 type = toType( obj ); 523 524 if ( isFunction( obj ) || isWindow( obj ) ) { 525 return false; 526 } 527 528 return type === "array" || length === 0 || 529 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 530} 531var Sizzle = 532/*! 533 * Sizzle CSS Selector Engine v2.3.6 534 * https://sizzlejs.com/ 535 * 536 * Copyright JS Foundation and other contributors 537 * Released under the MIT license 538 * https://js.foundation/ 539 * 540 * Date: 2021-02-16 541 */ 542( function( window ) { 543var i, 544 support, 545 Expr, 546 getText, 547 isXML, 548 tokenize, 549 compile, 550 select, 551 outermostContext, 552 sortInput, 553 hasDuplicate, 554 555 // Local document vars 556 setDocument, 557 document, 558 docElem, 559 documentIsHTML, 560 rbuggyQSA, 561 rbuggyMatches, 562 matches, 563 contains, 564 565 // Instance-specific data 566 expando = "sizzle" + 1 * new Date(), 567 preferredDoc = window.document, 568 dirruns = 0, 569 done = 0, 570 classCache = createCache(), 571 tokenCache = createCache(), 572 compilerCache = createCache(), 573 nonnativeSelectorCache = createCache(), 574 sortOrder = function( a, b ) { 575 if ( a === b ) { 576 hasDuplicate = true; 577 } 578 return 0; 579 }, 580 581 // Instance methods 582 hasOwn = ( {} ).hasOwnProperty, 583 arr = [], 584 pop = arr.pop, 585 pushNative = arr.push, 586 push = arr.push, 587 slice = arr.slice, 588 589 // Use a stripped-down indexOf as it's faster than native 590 // https://jsperf.com/thor-indexof-vs-for/5 591 indexOf = function( list, elem ) { 592 var i = 0, 593 len = list.length; 594 for ( ; i < len; i++ ) { 595 if ( list[ i ] === elem ) { 596 return i; 597 } 598 } 599 return -1; 600 }, 601 602 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 603 "ismap|loop|multiple|open|readonly|required|scoped", 604 605 // Regular expressions 606 607 // http://www.w3.org/TR/css3-selectors/#whitespace 608 whitespace = "[\\x20\\t\\r\\n\\f]", 609 610 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 611 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 612 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 613 614 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 615 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 616 617 // Operator (capture 2) 618 "*([*^$|!~]?=)" + whitespace + 619 620 // "Attribute values must be CSS identifiers [capture 5] 621 // or strings [capture 3 or capture 4]" 622 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 623 whitespace + "*\\]", 624 625 pseudos = ":(" + identifier + ")(?:\\((" + 626 627 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 628 // 1. quoted (capture 3; capture 4 or capture 5) 629 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 630 631 // 2. simple (capture 6) 632 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 633 634 // 3. anything else (capture 2) 635 ".*" + 636 ")\\)|)", 637 638 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 639 rwhitespace = new RegExp( whitespace + "+", "g" ), 640 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 641 whitespace + "+$", "g" ), 642 643 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 644 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 645 "*" ), 646 rdescend = new RegExp( whitespace + "|>" ), 647 648 rpseudo = new RegExp( pseudos ), 649 ridentifier = new RegExp( "^" + identifier + "$" ), 650 651 matchExpr = { 652 "ID": new RegExp( "^#(" + identifier + ")" ), 653 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 654 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 655 "ATTR": new RegExp( "^" + attributes ), 656 "PSEUDO": new RegExp( "^" + pseudos ), 657 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 658 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 659 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 660 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 661 662 // For use in libraries implementing .is() 663 // We use this for POS matching in `select` 664 "needsContext": new RegExp( "^" + whitespace + 665 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 666 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 667 }, 668 669 rhtml = /HTML$/i, 670 rinputs = /^(?:input|select|textarea|button)$/i, 671 rheader = /^h\d$/i, 672 673 rnative = /^[^{]+\{\s*\[native \w/, 674 675 // Easily-parseable/retrievable ID or TAG or CLASS selectors 676 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 677 678 rsibling = /[+~]/, 679 680 // CSS escapes 681 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 682 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 683 funescape = function( escape, nonHex ) { 684 var high = "0x" + escape.slice( 1 ) - 0x10000; 685 686 return nonHex ? 687 688 // Strip the backslash prefix from a non-hex escape sequence 689 nonHex : 690 691 // Replace a hexadecimal escape sequence with the encoded Unicode code point 692 // Support: IE <=11+ 693 // For values outside the Basic Multilingual Plane (BMP), manually construct a 694 // surrogate pair 695 high < 0 ? 696 String.fromCharCode( high + 0x10000 ) : 697 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 698 }, 699 700 // CSS string/identifier serialization 701 // https://drafts.csswg.org/cssom/#common-serializing-idioms 702 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 703 fcssescape = function( ch, asCodePoint ) { 704 if ( asCodePoint ) { 705 706 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 707 if ( ch === "\0" ) { 708 return "\uFFFD"; 709 } 710 711 // Control characters and (dependent upon position) numbers get escaped as code points 712 return ch.slice( 0, -1 ) + "\\" + 713 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 714 } 715 716 // Other potentially-special ASCII characters get backslash-escaped 717 return "\\" + ch; 718 }, 719 720 // Used for iframes 721 // See setDocument() 722 // Removing the function wrapper causes a "Permission Denied" 723 // error in IE 724 unloadHandler = function() { 725 setDocument(); 726 }, 727 728 inDisabledFieldset = addCombinator( 729 function( elem ) { 730 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 731 }, 732 { dir: "parentNode", next: "legend" } 733 ); 734 735// Optimize for push.apply( _, NodeList ) 736try { 737 push.apply( 738 ( arr = slice.call( preferredDoc.childNodes ) ), 739 preferredDoc.childNodes 740 ); 741 742 // Support: Android<4.0 743 // Detect silently failing push.apply 744 // eslint-disable-next-line no-unused-expressions 745 arr[ preferredDoc.childNodes.length ].nodeType; 746} catch ( e ) { 747 push = { apply: arr.length ? 748 749 // Leverage slice if possible 750 function( target, els ) { 751 pushNative.apply( target, slice.call( els ) ); 752 } : 753 754 // Support: IE<9 755 // Otherwise append directly 756 function( target, els ) { 757 var j = target.length, 758 i = 0; 759 760 // Can't trust NodeList.length 761 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 762 target.length = j - 1; 763 } 764 }; 765} 766 767function Sizzle( selector, context, results, seed ) { 768 var m, i, elem, nid, match, groups, newSelector, 769 newContext = context && context.ownerDocument, 770 771 // nodeType defaults to 9, since context defaults to document 772 nodeType = context ? context.nodeType : 9; 773 774 results = results || []; 775 776 // Return early from calls with invalid selector or context 777 if ( typeof selector !== "string" || !selector || 778 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 779 780 return results; 781 } 782 783 // Try to shortcut find operations (as opposed to filters) in HTML documents 784 if ( !seed ) { 785 setDocument( context ); 786 context = context || document; 787 788 if ( documentIsHTML ) { 789 790 // If the selector is sufficiently simple, try using a "get*By*" DOM method 791 // (excepting DocumentFragment context, where the methods don't exist) 792 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 793 794 // ID selector 795 if ( ( m = match[ 1 ] ) ) { 796 797 // Document context 798 if ( nodeType === 9 ) { 799 if ( ( elem = context.getElementById( m ) ) ) { 800 801 // Support: IE, Opera, Webkit 802 // TODO: identify versions 803 // getElementById can match elements by name instead of ID 804 if ( elem.id === m ) { 805 results.push( elem ); 806 return results; 807 } 808 } else { 809 return results; 810 } 811 812 // Element context 813 } else { 814 815 // Support: IE, Opera, Webkit 816 // TODO: identify versions 817 // getElementById can match elements by name instead of ID 818 if ( newContext && ( elem = newContext.getElementById( m ) ) && 819 contains( context, elem ) && 820 elem.id === m ) { 821 822 results.push( elem ); 823 return results; 824 } 825 } 826 827 // Type selector 828 } else if ( match[ 2 ] ) { 829 push.apply( results, context.getElementsByTagName( selector ) ); 830 return results; 831 832 // Class selector 833 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 834 context.getElementsByClassName ) { 835 836 push.apply( results, context.getElementsByClassName( m ) ); 837 return results; 838 } 839 } 840 841 // Take advantage of querySelectorAll 842 if ( support.qsa && 843 !nonnativeSelectorCache[ selector + " " ] && 844 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 845 846 // Support: IE 8 only 847 // Exclude object elements 848 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 849 850 newSelector = selector; 851 newContext = context; 852 853 // qSA considers elements outside a scoping root when evaluating child or 854 // descendant combinators, which is not what we want. 855 // In such cases, we work around the behavior by prefixing every selector in the 856 // list with an ID selector referencing the scope context. 857 // The technique has to be used as well when a leading combinator is used 858 // as such selectors are not recognized by querySelectorAll. 859 // Thanks to Andrew Dupont for this technique. 860 if ( nodeType === 1 && 861 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { 862 863 // Expand context for sibling selectors 864 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 865 context; 866 867 // We can use :scope instead of the ID hack if the browser 868 // supports it & if we're not changing the context. 869 if ( newContext !== context || !support.scope ) { 870 871 // Capture the context ID, setting it first if necessary 872 if ( ( nid = context.getAttribute( "id" ) ) ) { 873 nid = nid.replace( rcssescape, fcssescape ); 874 } else { 875 context.setAttribute( "id", ( nid = expando ) ); 876 } 877 } 878 879 // Prefix every selector in the list 880 groups = tokenize( selector ); 881 i = groups.length; 882 while ( i-- ) { 883 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 884 toSelector( groups[ i ] ); 885 } 886 newSelector = groups.join( "," ); 887 } 888 889 try { 890 push.apply( results, 891 newContext.querySelectorAll( newSelector ) 892 ); 893 return results; 894 } catch ( qsaError ) { 895 nonnativeSelectorCache( selector, true ); 896 } finally { 897 if ( nid === expando ) { 898 context.removeAttribute( "id" ); 899 } 900 } 901 } 902 } 903 } 904 905 // All others 906 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 907} 908 909/** 910 * Create key-value caches of limited size 911 * @returns {function(string, object)} Returns the Object data after storing it on itself with 912 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 913 * deleting the oldest entry 914 */ 915function createCache() { 916 var keys = []; 917 918 function cache( key, value ) { 919 920 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 921 if ( keys.push( key + " " ) > Expr.cacheLength ) { 922 923 // Only keep the most recent entries 924 delete cache[ keys.shift() ]; 925 } 926 return ( cache[ key + " " ] = value ); 927 } 928 return cache; 929} 930 931/** 932 * Mark a function for special use by Sizzle 933 * @param {Function} fn The function to mark 934 */ 935function markFunction( fn ) { 936 fn[ expando ] = true; 937 return fn; 938} 939 940/** 941 * Support testing using an element 942 * @param {Function} fn Passed the created element and returns a boolean result 943 */ 944function assert( fn ) { 945 var el = document.createElement( "fieldset" ); 946 947 try { 948 return !!fn( el ); 949 } catch ( e ) { 950 return false; 951 } finally { 952 953 // Remove from its parent by default 954 if ( el.parentNode ) { 955 el.parentNode.removeChild( el ); 956 } 957 958 // release memory in IE 959 el = null; 960 } 961} 962 963/** 964 * Adds the same handler for all of the specified attrs 965 * @param {String} attrs Pipe-separated list of attributes 966 * @param {Function} handler The method that will be applied 967 */ 968function addHandle( attrs, handler ) { 969 var arr = attrs.split( "|" ), 970 i = arr.length; 971 972 while ( i-- ) { 973 Expr.attrHandle[ arr[ i ] ] = handler; 974 } 975} 976 977/** 978 * Checks document order of two siblings 979 * @param {Element} a 980 * @param {Element} b 981 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 982 */ 983function siblingCheck( a, b ) { 984 var cur = b && a, 985 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 986 a.sourceIndex - b.sourceIndex; 987 988 // Use IE sourceIndex if available on both nodes 989 if ( diff ) { 990 return diff; 991 } 992 993 // Check if b follows a 994 if ( cur ) { 995 while ( ( cur = cur.nextSibling ) ) { 996 if ( cur === b ) { 997 return -1; 998 } 999 } 1000 } 1001 1002 return a ? 1 : -1; 1003} 1004 1005/** 1006 * Returns a function to use in pseudos for input types 1007 * @param {String} type 1008 */ 1009function createInputPseudo( type ) { 1010 return function( elem ) { 1011 var name = elem.nodeName.toLowerCase(); 1012 return name === "input" && elem.type === type; 1013 }; 1014} 1015 1016/** 1017 * Returns a function to use in pseudos for buttons 1018 * @param {String} type 1019 */ 1020function createButtonPseudo( type ) { 1021 return function( elem ) { 1022 var name = elem.nodeName.toLowerCase(); 1023 return ( name === "input" || name === "button" ) && elem.type === type; 1024 }; 1025} 1026 1027/** 1028 * Returns a function to use in pseudos for :enabled/:disabled 1029 * @param {Boolean} disabled true for :disabled; false for :enabled 1030 */ 1031function createDisabledPseudo( disabled ) { 1032 1033 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1034 return function( elem ) { 1035 1036 // Only certain elements can match :enabled or :disabled 1037 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1038 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1039 if ( "form" in elem ) { 1040 1041 // Check for inherited disabledness on relevant non-disabled elements: 1042 // * listed form-associated elements in a disabled fieldset 1043 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1044 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1045 // * option elements in a disabled optgroup 1046 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1047 // All such elements have a "form" property. 1048 if ( elem.parentNode && elem.disabled === false ) { 1049 1050 // Option elements defer to a parent optgroup if present 1051 if ( "label" in elem ) { 1052 if ( "label" in elem.parentNode ) { 1053 return elem.parentNode.disabled === disabled; 1054 } else { 1055 return elem.disabled === disabled; 1056 } 1057 } 1058 1059 // Support: IE 6 - 11 1060 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1061 return elem.isDisabled === disabled || 1062 1063 // Where there is no isDisabled, check manually 1064 /* jshint -W018 */ 1065 elem.isDisabled !== !disabled && 1066 inDisabledFieldset( elem ) === disabled; 1067 } 1068 1069 return elem.disabled === disabled; 1070 1071 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1072 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1073 // even exist on them, let alone have a boolean value. 1074 } else if ( "label" in elem ) { 1075 return elem.disabled === disabled; 1076 } 1077 1078 // Remaining elements are neither :enabled nor :disabled 1079 return false; 1080 }; 1081} 1082 1083/** 1084 * Returns a function to use in pseudos for positionals 1085 * @param {Function} fn 1086 */ 1087function createPositionalPseudo( fn ) { 1088 return markFunction( function( argument ) { 1089 argument = +argument; 1090 return markFunction( function( seed, matches ) { 1091 var j, 1092 matchIndexes = fn( [], seed.length, argument ), 1093 i = matchIndexes.length; 1094 1095 // Match elements found at the specified indexes 1096 while ( i-- ) { 1097 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1098 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1099 } 1100 } 1101 } ); 1102 } ); 1103} 1104 1105/** 1106 * Checks a node for validity as a Sizzle context 1107 * @param {Element|Object=} context 1108 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1109 */ 1110function testContext( context ) { 1111 return context && typeof context.getElementsByTagName !== "undefined" && context; 1112} 1113 1114// Expose support vars for convenience 1115support = Sizzle.support = {}; 1116 1117/** 1118 * Detects XML nodes 1119 * @param {Element|Object} elem An element or a document 1120 * @returns {Boolean} True iff elem is a non-HTML XML node 1121 */ 1122isXML = Sizzle.isXML = function( elem ) { 1123 var namespace = elem && elem.namespaceURI, 1124 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 1125 1126 // Support: IE <=8 1127 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1128 // https://bugs.jquery.com/ticket/4833 1129 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 1130}; 1131 1132/** 1133 * Sets document-related variables once based on the current document 1134 * @param {Element|Object} [doc] An element or document object to use to set the document 1135 * @returns {Object} Returns the current document 1136 */ 1137setDocument = Sizzle.setDocument = function( node ) { 1138 var hasCompare, subWindow, 1139 doc = node ? node.ownerDocument || node : preferredDoc; 1140 1141 // Return early if doc is invalid or already selected 1142 // Support: IE 11+, Edge 17 - 18+ 1143 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1144 // two documents; shallow comparisons work. 1145 // eslint-disable-next-line eqeqeq 1146 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1147 return document; 1148 } 1149 1150 // Update global variables 1151 document = doc; 1152 docElem = document.documentElement; 1153 documentIsHTML = !isXML( document ); 1154 1155 // Support: IE 9 - 11+, Edge 12 - 18+ 1156 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1157 // Support: IE 11+, Edge 17 - 18+ 1158 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1159 // two documents; shallow comparisons work. 1160 // eslint-disable-next-line eqeqeq 1161 if ( preferredDoc != document && 1162 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1163 1164 // Support: IE 11, Edge 1165 if ( subWindow.addEventListener ) { 1166 subWindow.addEventListener( "unload", unloadHandler, false ); 1167 1168 // Support: IE 9 - 10 only 1169 } else if ( subWindow.attachEvent ) { 1170 subWindow.attachEvent( "onunload", unloadHandler ); 1171 } 1172 } 1173 1174 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 1175 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 1176 // IE/Edge & older browsers don't support the :scope pseudo-class. 1177 // Support: Safari 6.0 only 1178 // Safari 6.0 supports :scope but it's an alias of :root there. 1179 support.scope = assert( function( el ) { 1180 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 1181 return typeof el.querySelectorAll !== "undefined" && 1182 !el.querySelectorAll( ":scope fieldset div" ).length; 1183 } ); 1184 1185 /* Attributes 1186 ---------------------------------------------------------------------- */ 1187 1188 // Support: IE<8 1189 // Verify that getAttribute really returns attributes and not properties 1190 // (excepting IE8 booleans) 1191 support.attributes = assert( function( el ) { 1192 el.className = "i"; 1193 return !el.getAttribute( "className" ); 1194 } ); 1195 1196 /* getElement(s)By* 1197 ---------------------------------------------------------------------- */ 1198 1199 // Check if getElementsByTagName("*") returns only elements 1200 support.getElementsByTagName = assert( function( el ) { 1201 el.appendChild( document.createComment( "" ) ); 1202 return !el.getElementsByTagName( "*" ).length; 1203 } ); 1204 1205 // Support: IE<9 1206 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1207 1208 // Support: IE<10 1209 // Check if getElementById returns elements by name 1210 // The broken getElementById methods don't pick up programmatically-set names, 1211 // so use a roundabout getElementsByName test 1212 support.getById = assert( function( el ) { 1213 docElem.appendChild( el ).id = expando; 1214 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1215 } ); 1216 1217 // ID filter and find 1218 if ( support.getById ) { 1219 Expr.filter[ "ID" ] = function( id ) { 1220 var attrId = id.replace( runescape, funescape ); 1221 return function( elem ) { 1222 return elem.getAttribute( "id" ) === attrId; 1223 }; 1224 }; 1225 Expr.find[ "ID" ] = function( id, context ) { 1226 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1227 var elem = context.getElementById( id ); 1228 return elem ? [ elem ] : []; 1229 } 1230 }; 1231 } else { 1232 Expr.filter[ "ID" ] = function( id ) { 1233 var attrId = id.replace( runescape, funescape ); 1234 return function( elem ) { 1235 var node = typeof elem.getAttributeNode !== "undefined" && 1236 elem.getAttributeNode( "id" ); 1237 return node && node.value === attrId; 1238 }; 1239 }; 1240 1241 // Support: IE 6 - 7 only 1242 // getElementById is not reliable as a find shortcut 1243 Expr.find[ "ID" ] = function( id, context ) { 1244 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1245 var node, i, elems, 1246 elem = context.getElementById( id ); 1247 1248 if ( elem ) { 1249 1250 // Verify the id attribute 1251 node = elem.getAttributeNode( "id" ); 1252 if ( node && node.value === id ) { 1253 return [ elem ]; 1254 } 1255 1256 // Fall back on getElementsByName 1257 elems = context.getElementsByName( id ); 1258 i = 0; 1259 while ( ( elem = elems[ i++ ] ) ) { 1260 node = elem.getAttributeNode( "id" ); 1261 if ( node && node.value === id ) { 1262 return [ elem ]; 1263 } 1264 } 1265 } 1266 1267 return []; 1268 } 1269 }; 1270 } 1271 1272 // Tag 1273 Expr.find[ "TAG" ] = support.getElementsByTagName ? 1274 function( tag, context ) { 1275 if ( typeof context.getElementsByTagName !== "undefined" ) { 1276 return context.getElementsByTagName( tag ); 1277 1278 // DocumentFragment nodes don't have gEBTN 1279 } else if ( support.qsa ) { 1280 return context.querySelectorAll( tag ); 1281 } 1282 } : 1283 1284 function( tag, context ) { 1285 var elem, 1286 tmp = [], 1287 i = 0, 1288 1289 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1290 results = context.getElementsByTagName( tag ); 1291 1292 // Filter out possible comments 1293 if ( tag === "*" ) { 1294 while ( ( elem = results[ i++ ] ) ) { 1295 if ( elem.nodeType === 1 ) { 1296 tmp.push( elem ); 1297 } 1298 } 1299 1300 return tmp; 1301 } 1302 return results; 1303 }; 1304 1305 // Class 1306 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 1307 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1308 return context.getElementsByClassName( className ); 1309 } 1310 }; 1311 1312 /* QSA/matchesSelector 1313 ---------------------------------------------------------------------- */ 1314 1315 // QSA and matchesSelector support 1316 1317 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1318 rbuggyMatches = []; 1319 1320 // qSa(:focus) reports false when true (Chrome 21) 1321 // We allow this because of a bug in IE8/9 that throws an error 1322 // whenever `document.activeElement` is accessed on an iframe 1323 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1324 // See https://bugs.jquery.com/ticket/13378 1325 rbuggyQSA = []; 1326 1327 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 1328 1329 // Build QSA regex 1330 // Regex strategy adopted from Diego Perini 1331 assert( function( el ) { 1332 1333 var input; 1334 1335 // Select is set to empty string on purpose 1336 // This is to test IE's treatment of not explicitly 1337 // setting a boolean content attribute, 1338 // since its presence should be enough 1339 // https://bugs.jquery.com/ticket/12359 1340 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1341 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1342 "<option selected=''></option></select>"; 1343 1344 // Support: IE8, Opera 11-12.16 1345 // Nothing should be selected when empty strings follow ^= or $= or *= 1346 // The test attribute must be unknown in Opera but "safe" for WinRT 1347 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1348 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 1349 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1350 } 1351 1352 // Support: IE8 1353 // Boolean attributes and "value" are not treated correctly 1354 if ( !el.querySelectorAll( "[selected]" ).length ) { 1355 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1356 } 1357 1358 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1359 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1360 rbuggyQSA.push( "~=" ); 1361 } 1362 1363 // Support: IE 11+, Edge 15 - 18+ 1364 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1365 // Adding a temporary attribute to the document before the selection works 1366 // around the issue. 1367 // Interestingly, IE 10 & older don't seem to have the issue. 1368 input = document.createElement( "input" ); 1369 input.setAttribute( "name", "" ); 1370 el.appendChild( input ); 1371 if ( !el.querySelectorAll( "[name='']" ).length ) { 1372 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1373 whitespace + "*(?:''|\"\")" ); 1374 } 1375 1376 // Webkit/Opera - :checked should return selected option elements 1377 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1378 // IE8 throws error here and will not see later tests 1379 if ( !el.querySelectorAll( ":checked" ).length ) { 1380 rbuggyQSA.push( ":checked" ); 1381 } 1382 1383 // Support: Safari 8+, iOS 8+ 1384 // https://bugs.webkit.org/show_bug.cgi?id=136851 1385 // In-page `selector#id sibling-combinator selector` fails 1386 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1387 rbuggyQSA.push( ".#.+[+~]" ); 1388 } 1389 1390 // Support: Firefox <=3.6 - 5 only 1391 // Old Firefox doesn't throw on a badly-escaped identifier. 1392 el.querySelectorAll( "\\\f" ); 1393 rbuggyQSA.push( "[\\r\\n\\f]" ); 1394 } ); 1395 1396 assert( function( el ) { 1397 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1398 "<select disabled='disabled'><option/></select>"; 1399 1400 // Support: Windows 8 Native Apps 1401 // The type and name attributes are restricted during .innerHTML assignment 1402 var input = document.createElement( "input" ); 1403 input.setAttribute( "type", "hidden" ); 1404 el.appendChild( input ).setAttribute( "name", "D" ); 1405 1406 // Support: IE8 1407 // Enforce case-sensitivity of name attribute 1408 if ( el.querySelectorAll( "[name=d]" ).length ) { 1409 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1410 } 1411 1412 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1413 // IE8 throws error here and will not see later tests 1414 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 1415 rbuggyQSA.push( ":enabled", ":disabled" ); 1416 } 1417 1418 // Support: IE9-11+ 1419 // IE's :disabled selector does not pick up the children of disabled fieldsets 1420 docElem.appendChild( el ).disabled = true; 1421 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1422 rbuggyQSA.push( ":enabled", ":disabled" ); 1423 } 1424 1425 // Support: Opera 10 - 11 only 1426 // Opera 10-11 does not throw on post-comma invalid pseudos 1427 el.querySelectorAll( "*,:x" ); 1428 rbuggyQSA.push( ",.*:" ); 1429 } ); 1430 } 1431 1432 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 1433 docElem.webkitMatchesSelector || 1434 docElem.mozMatchesSelector || 1435 docElem.oMatchesSelector || 1436 docElem.msMatchesSelector ) ) ) ) { 1437 1438 assert( function( el ) { 1439 1440 // Check to see if it's possible to do matchesSelector 1441 // on a disconnected node (IE 9) 1442 support.disconnectedMatch = matches.call( el, "*" ); 1443 1444 // This should fail with an exception 1445 // Gecko does not error, returns false instead 1446 matches.call( el, "[s!='']:x" ); 1447 rbuggyMatches.push( "!=", pseudos ); 1448 } ); 1449 } 1450 1451 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1452 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 1453 1454 /* Contains 1455 ---------------------------------------------------------------------- */ 1456 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1457 1458 // Element contains another 1459 // Purposefully self-exclusive 1460 // As in, an element does not contain itself 1461 contains = hasCompare || rnative.test( docElem.contains ) ? 1462 function( a, b ) { 1463 var adown = a.nodeType === 9 ? a.documentElement : a, 1464 bup = b && b.parentNode; 1465 return a === bup || !!( bup && bup.nodeType === 1 && ( 1466 adown.contains ? 1467 adown.contains( bup ) : 1468 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1469 ) ); 1470 } : 1471 function( a, b ) { 1472 if ( b ) { 1473 while ( ( b = b.parentNode ) ) { 1474 if ( b === a ) { 1475 return true; 1476 } 1477 } 1478 } 1479 return false; 1480 }; 1481 1482 /* Sorting 1483 ---------------------------------------------------------------------- */ 1484 1485 // Document order sorting 1486 sortOrder = hasCompare ? 1487 function( a, b ) { 1488 1489 // Flag for duplicate removal 1490 if ( a === b ) { 1491 hasDuplicate = true; 1492 return 0; 1493 } 1494 1495 // Sort on method existence if only one input has compareDocumentPosition 1496 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1497 if ( compare ) { 1498 return compare; 1499 } 1500 1501 // Calculate position if both inputs belong to the same document 1502 // Support: IE 11+, Edge 17 - 18+ 1503 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1504 // two documents; shallow comparisons work. 1505 // eslint-disable-next-line eqeqeq 1506 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1507 a.compareDocumentPosition( b ) : 1508 1509 // Otherwise we know they are disconnected 1510 1; 1511 1512 // Disconnected nodes 1513 if ( compare & 1 || 1514 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1515 1516 // Choose the first element that is related to our preferred document 1517 // Support: IE 11+, Edge 17 - 18+ 1518 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1519 // two documents; shallow comparisons work. 1520 // eslint-disable-next-line eqeqeq 1521 if ( a == document || a.ownerDocument == preferredDoc && 1522 contains( preferredDoc, a ) ) { 1523 return -1; 1524 } 1525 1526 // Support: IE 11+, Edge 17 - 18+ 1527 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1528 // two documents; shallow comparisons work. 1529 // eslint-disable-next-line eqeqeq 1530 if ( b == document || b.ownerDocument == preferredDoc && 1531 contains( preferredDoc, b ) ) { 1532 return 1; 1533 } 1534 1535 // Maintain original order 1536 return sortInput ? 1537 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1538 0; 1539 } 1540 1541 return compare & 4 ? -1 : 1; 1542 } : 1543 function( a, b ) { 1544 1545 // Exit early if the nodes are identical 1546 if ( a === b ) { 1547 hasDuplicate = true; 1548 return 0; 1549 } 1550 1551 var cur, 1552 i = 0, 1553 aup = a.parentNode, 1554 bup = b.parentNode, 1555 ap = [ a ], 1556 bp = [ b ]; 1557 1558 // Parentless nodes are either documents or disconnected 1559 if ( !aup || !bup ) { 1560 1561 // Support: IE 11+, Edge 17 - 18+ 1562 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1563 // two documents; shallow comparisons work. 1564 /* eslint-disable eqeqeq */ 1565 return a == document ? -1 : 1566 b == document ? 1 : 1567 /* eslint-enable eqeqeq */ 1568 aup ? -1 : 1569 bup ? 1 : 1570 sortInput ? 1571 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1572 0; 1573 1574 // If the nodes are siblings, we can do a quick check 1575 } else if ( aup === bup ) { 1576 return siblingCheck( a, b ); 1577 } 1578 1579 // Otherwise we need full lists of their ancestors for comparison 1580 cur = a; 1581 while ( ( cur = cur.parentNode ) ) { 1582 ap.unshift( cur ); 1583 } 1584 cur = b; 1585 while ( ( cur = cur.parentNode ) ) { 1586 bp.unshift( cur ); 1587 } 1588 1589 // Walk down the tree looking for a discrepancy 1590 while ( ap[ i ] === bp[ i ] ) { 1591 i++; 1592 } 1593 1594 return i ? 1595 1596 // Do a sibling check if the nodes have a common ancestor 1597 siblingCheck( ap[ i ], bp[ i ] ) : 1598 1599 // Otherwise nodes in our document sort first 1600 // Support: IE 11+, Edge 17 - 18+ 1601 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1602 // two documents; shallow comparisons work. 1603 /* eslint-disable eqeqeq */ 1604 ap[ i ] == preferredDoc ? -1 : 1605 bp[ i ] == preferredDoc ? 1 : 1606 /* eslint-enable eqeqeq */ 1607 0; 1608 }; 1609 1610 return document; 1611}; 1612 1613Sizzle.matches = function( expr, elements ) { 1614 return Sizzle( expr, null, null, elements ); 1615}; 1616 1617Sizzle.matchesSelector = function( elem, expr ) { 1618 setDocument( elem ); 1619 1620 if ( support.matchesSelector && documentIsHTML && 1621 !nonnativeSelectorCache[ expr + " " ] && 1622 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1623 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1624 1625 try { 1626 var ret = matches.call( elem, expr ); 1627 1628 // IE 9's matchesSelector returns false on disconnected nodes 1629 if ( ret || support.disconnectedMatch || 1630 1631 // As well, disconnected nodes are said to be in a document 1632 // fragment in IE 9 1633 elem.document && elem.document.nodeType !== 11 ) { 1634 return ret; 1635 } 1636 } catch ( e ) { 1637 nonnativeSelectorCache( expr, true ); 1638 } 1639 } 1640 1641 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1642}; 1643 1644Sizzle.contains = function( context, elem ) { 1645 1646 // Set document vars if needed 1647 // Support: IE 11+, Edge 17 - 18+ 1648 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1649 // two documents; shallow comparisons work. 1650 // eslint-disable-next-line eqeqeq 1651 if ( ( context.ownerDocument || context ) != document ) { 1652 setDocument( context ); 1653 } 1654 return contains( context, elem ); 1655}; 1656 1657Sizzle.attr = function( elem, name ) { 1658 1659 // Set document vars if needed 1660 // Support: IE 11+, Edge 17 - 18+ 1661 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1662 // two documents; shallow comparisons work. 1663 // eslint-disable-next-line eqeqeq 1664 if ( ( elem.ownerDocument || elem ) != document ) { 1665 setDocument( elem ); 1666 } 1667 1668 var fn = Expr.attrHandle[ name.toLowerCase() ], 1669 1670 // Don't get fooled by Object.prototype properties (jQuery #13807) 1671 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1672 fn( elem, name, !documentIsHTML ) : 1673 undefined; 1674 1675 return val !== undefined ? 1676 val : 1677 support.attributes || !documentIsHTML ? 1678 elem.getAttribute( name ) : 1679 ( val = elem.getAttributeNode( name ) ) && val.specified ? 1680 val.value : 1681 null; 1682}; 1683 1684Sizzle.escape = function( sel ) { 1685 return ( sel + "" ).replace( rcssescape, fcssescape ); 1686}; 1687 1688Sizzle.error = function( msg ) { 1689 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1690}; 1691 1692/** 1693 * Document sorting and removing duplicates 1694 * @param {ArrayLike} results 1695 */ 1696Sizzle.uniqueSort = function( results ) { 1697 var elem, 1698 duplicates = [], 1699 j = 0, 1700 i = 0; 1701 1702 // Unless we *know* we can detect duplicates, assume their presence 1703 hasDuplicate = !support.detectDuplicates; 1704 sortInput = !support.sortStable && results.slice( 0 ); 1705 results.sort( sortOrder ); 1706 1707 if ( hasDuplicate ) { 1708 while ( ( elem = results[ i++ ] ) ) { 1709 if ( elem === results[ i ] ) { 1710 j = duplicates.push( i ); 1711 } 1712 } 1713 while ( j-- ) { 1714 results.splice( duplicates[ j ], 1 ); 1715 } 1716 } 1717 1718 // Clear input after sorting to release objects 1719 // See https://github.com/jquery/sizzle/pull/225 1720 sortInput = null; 1721 1722 return results; 1723}; 1724 1725/** 1726 * Utility function for retrieving the text value of an array of DOM nodes 1727 * @param {Array|Element} elem 1728 */ 1729getText = Sizzle.getText = function( elem ) { 1730 var node, 1731 ret = "", 1732 i = 0, 1733 nodeType = elem.nodeType; 1734 1735 if ( !nodeType ) { 1736 1737 // If no nodeType, this is expected to be an array 1738 while ( ( node = elem[ i++ ] ) ) { 1739 1740 // Do not traverse comment nodes 1741 ret += getText( node ); 1742 } 1743 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1744 1745 // Use textContent for elements 1746 // innerText usage removed for consistency of new lines (jQuery #11153) 1747 if ( typeof elem.textContent === "string" ) { 1748 return elem.textContent; 1749 } else { 1750 1751 // Traverse its children 1752 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1753 ret += getText( elem ); 1754 } 1755 } 1756 } else if ( nodeType === 3 || nodeType === 4 ) { 1757 return elem.nodeValue; 1758 } 1759 1760 // Do not include comment or processing instruction nodes 1761 1762 return ret; 1763}; 1764 1765Expr = Sizzle.selectors = { 1766 1767 // Can be adjusted by the user 1768 cacheLength: 50, 1769 1770 createPseudo: markFunction, 1771 1772 match: matchExpr, 1773 1774 attrHandle: {}, 1775 1776 find: {}, 1777 1778 relative: { 1779 ">": { dir: "parentNode", first: true }, 1780 " ": { dir: "parentNode" }, 1781 "+": { dir: "previousSibling", first: true }, 1782 "~": { dir: "previousSibling" } 1783 }, 1784 1785 preFilter: { 1786 "ATTR": function( match ) { 1787 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1788 1789 // Move the given value to match[3] whether quoted or unquoted 1790 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 1791 match[ 5 ] || "" ).replace( runescape, funescape ); 1792 1793 if ( match[ 2 ] === "~=" ) { 1794 match[ 3 ] = " " + match[ 3 ] + " "; 1795 } 1796 1797 return match.slice( 0, 4 ); 1798 }, 1799 1800 "CHILD": function( match ) { 1801 1802 /* matches from matchExpr["CHILD"] 1803 1 type (only|nth|...) 1804 2 what (child|of-type) 1805 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1806 4 xn-component of xn+y argument ([+-]?\d*n|) 1807 5 sign of xn-component 1808 6 x of xn-component 1809 7 sign of y-component 1810 8 y of y-component 1811 */ 1812 match[ 1 ] = match[ 1 ].toLowerCase(); 1813 1814 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1815 1816 // nth-* requires argument 1817 if ( !match[ 3 ] ) { 1818 Sizzle.error( match[ 0 ] ); 1819 } 1820 1821 // numeric x and y parameters for Expr.filter.CHILD 1822 // remember that false/true cast respectively to 0/1 1823 match[ 4 ] = +( match[ 4 ] ? 1824 match[ 5 ] + ( match[ 6 ] || 1 ) : 1825 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 1826 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1827 1828 // other types prohibit arguments 1829 } else if ( match[ 3 ] ) { 1830 Sizzle.error( match[ 0 ] ); 1831 } 1832 1833 return match; 1834 }, 1835 1836 "PSEUDO": function( match ) { 1837 var excess, 1838 unquoted = !match[ 6 ] && match[ 2 ]; 1839 1840 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 1841 return null; 1842 } 1843 1844 // Accept quoted arguments as-is 1845 if ( match[ 3 ] ) { 1846 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1847 1848 // Strip excess characters from unquoted arguments 1849 } else if ( unquoted && rpseudo.test( unquoted ) && 1850 1851 // Get excess from tokenize (recursively) 1852 ( excess = tokenize( unquoted, true ) ) && 1853 1854 // advance to the next closing parenthesis 1855 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1856 1857 // excess is a negative index 1858 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1859 match[ 2 ] = unquoted.slice( 0, excess ); 1860 } 1861 1862 // Return only captures needed by the pseudo filter method (type and argument) 1863 return match.slice( 0, 3 ); 1864 } 1865 }, 1866 1867 filter: { 1868 1869 "TAG": function( nodeNameSelector ) { 1870 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1871 return nodeNameSelector === "*" ? 1872 function() { 1873 return true; 1874 } : 1875 function( elem ) { 1876 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1877 }; 1878 }, 1879 1880 "CLASS": function( className ) { 1881 var pattern = classCache[ className + " " ]; 1882 1883 return pattern || 1884 ( pattern = new RegExp( "(^|" + whitespace + 1885 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 1886 className, function( elem ) { 1887 return pattern.test( 1888 typeof elem.className === "string" && elem.className || 1889 typeof elem.getAttribute !== "undefined" && 1890 elem.getAttribute( "class" ) || 1891 "" 1892 ); 1893 } ); 1894 }, 1895 1896 "ATTR": function( name, operator, check ) { 1897 return function( elem ) { 1898 var result = Sizzle.attr( elem, name ); 1899 1900 if ( result == null ) { 1901 return operator === "!="; 1902 } 1903 if ( !operator ) { 1904 return true; 1905 } 1906 1907 result += ""; 1908 1909 /* eslint-disable max-len */ 1910 1911 return operator === "=" ? result === check : 1912 operator === "!=" ? result !== check : 1913 operator === "^=" ? check && result.indexOf( check ) === 0 : 1914 operator === "*=" ? check && result.indexOf( check ) > -1 : 1915 operator === "$=" ? check && result.slice( -check.length ) === check : 1916 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1917 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1918 false; 1919 /* eslint-enable max-len */ 1920 1921 }; 1922 }, 1923 1924 "CHILD": function( type, what, _argument, first, last ) { 1925 var simple = type.slice( 0, 3 ) !== "nth", 1926 forward = type.slice( -4 ) !== "last", 1927 ofType = what === "of-type"; 1928 1929 return first === 1 && last === 0 ? 1930 1931 // Shortcut for :nth-*(n) 1932 function( elem ) { 1933 return !!elem.parentNode; 1934 } : 1935 1936 function( elem, _context, xml ) { 1937 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1938 dir = simple !== forward ? "nextSibling" : "previousSibling", 1939 parent = elem.parentNode, 1940 name = ofType && elem.nodeName.toLowerCase(), 1941 useCache = !xml && !ofType, 1942 diff = false; 1943 1944 if ( parent ) { 1945 1946 // :(first|last|only)-(child|of-type) 1947 if ( simple ) { 1948 while ( dir ) { 1949 node = elem; 1950 while ( ( node = node[ dir ] ) ) { 1951 if ( ofType ? 1952 node.nodeName.toLowerCase() === name : 1953 node.nodeType === 1 ) { 1954 1955 return false; 1956 } 1957 } 1958 1959 // Reverse direction for :only-* (if we haven't yet done so) 1960 start = dir = type === "only" && !start && "nextSibling"; 1961 } 1962 return true; 1963 } 1964 1965 start = [ forward ? parent.firstChild : parent.lastChild ]; 1966 1967 // non-xml :nth-child(...) stores cache data on `parent` 1968 if ( forward && useCache ) { 1969 1970 // Seek `elem` from a previously-cached index 1971 1972 // ...in a gzip-friendly way 1973 node = parent; 1974 outerCache = node[ expando ] || ( node[ expando ] = {} ); 1975 1976 // Support: IE <9 only 1977 // Defend against cloned attroperties (jQuery gh-1709) 1978 uniqueCache = outerCache[ node.uniqueID ] || 1979 ( outerCache[ node.uniqueID ] = {} ); 1980 1981 cache = uniqueCache[ type ] || []; 1982 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1983 diff = nodeIndex && cache[ 2 ]; 1984 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1985 1986 while ( ( node = ++nodeIndex && node && node[ dir ] || 1987 1988 // Fallback to seeking `elem` from the start 1989 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1990 1991 // When found, cache indexes on `parent` and break 1992 if ( node.nodeType === 1 && ++diff && node === elem ) { 1993 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1994 break; 1995 } 1996 } 1997 1998 } else { 1999 2000 // Use previously-cached element index if available 2001 if ( useCache ) { 2002 2003 // ...in a gzip-friendly way 2004 node = elem; 2005 outerCache = node[ expando ] || ( node[ expando ] = {} ); 2006 2007 // Support: IE <9 only 2008 // Defend against cloned attroperties (jQuery gh-1709) 2009 uniqueCache = outerCache[ node.uniqueID ] || 2010 ( outerCache[ node.uniqueID ] = {} ); 2011 2012 cache = uniqueCache[ type ] || []; 2013 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2014 diff = nodeIndex; 2015 } 2016 2017 // xml :nth-child(...) 2018 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2019 if ( diff === false ) { 2020 2021 // Use the same loop as above to seek `elem` from the start 2022 while ( ( node = ++nodeIndex && node && node[ dir ] || 2023 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 2024 2025 if ( ( ofType ? 2026 node.nodeName.toLowerCase() === name : 2027 node.nodeType === 1 ) && 2028 ++diff ) { 2029 2030 // Cache the index of each encountered element 2031 if ( useCache ) { 2032 outerCache = node[ expando ] || 2033 ( node[ expando ] = {} ); 2034 2035 // Support: IE <9 only 2036 // Defend against cloned attroperties (jQuery gh-1709) 2037 uniqueCache = outerCache[ node.uniqueID ] || 2038 ( outerCache[ node.uniqueID ] = {} ); 2039 2040 uniqueCache[ type ] = [ dirruns, diff ]; 2041 } 2042 2043 if ( node === elem ) { 2044 break; 2045 } 2046 } 2047 } 2048 } 2049 } 2050 2051 // Incorporate the offset, then check against cycle size 2052 diff -= last; 2053 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 2054 } 2055 }; 2056 }, 2057 2058 "PSEUDO": function( pseudo, argument ) { 2059 2060 // pseudo-class names are case-insensitive 2061 // http://www.w3.org/TR/selectors/#pseudo-classes 2062 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2063 // Remember that setFilters inherits from pseudos 2064 var args, 2065 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 2066 Sizzle.error( "unsupported pseudo: " + pseudo ); 2067 2068 // The user may use createPseudo to indicate that 2069 // arguments are needed to create the filter function 2070 // just as Sizzle does 2071 if ( fn[ expando ] ) { 2072 return fn( argument ); 2073 } 2074 2075 // But maintain support for old signatures 2076 if ( fn.length > 1 ) { 2077 args = [ pseudo, pseudo, "", argument ]; 2078 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 2079 markFunction( function( seed, matches ) { 2080 var idx, 2081 matched = fn( seed, argument ), 2082 i = matched.length; 2083 while ( i-- ) { 2084 idx = indexOf( seed, matched[ i ] ); 2085 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 2086 } 2087 } ) : 2088 function( elem ) { 2089 return fn( elem, 0, args ); 2090 }; 2091 } 2092 2093 return fn; 2094 } 2095 }, 2096 2097 pseudos: { 2098 2099 // Potentially complex pseudos 2100 "not": markFunction( function( selector ) { 2101 2102 // Trim the selector passed to compile 2103 // to avoid treating leading and trailing 2104 // spaces as combinators 2105 var input = [], 2106 results = [], 2107 matcher = compile( selector.replace( rtrim, "$1" ) ); 2108 2109 return matcher[ expando ] ? 2110 markFunction( function( seed, matches, _context, xml ) { 2111 var elem, 2112 unmatched = matcher( seed, null, xml, [] ), 2113 i = seed.length; 2114 2115 // Match elements unmatched by `matcher` 2116 while ( i-- ) { 2117 if ( ( elem = unmatched[ i ] ) ) { 2118 seed[ i ] = !( matches[ i ] = elem ); 2119 } 2120 } 2121 } ) : 2122 function( elem, _context, xml ) { 2123 input[ 0 ] = elem; 2124 matcher( input, null, xml, results ); 2125 2126 // Don't keep the element (issue #299) 2127 input[ 0 ] = null; 2128 return !results.pop(); 2129 }; 2130 } ), 2131 2132 "has": markFunction( function( selector ) { 2133 return function( elem ) { 2134 return Sizzle( selector, elem ).length > 0; 2135 }; 2136 } ), 2137 2138 "contains": markFunction( function( text ) { 2139 text = text.replace( runescape, funescape ); 2140 return function( elem ) { 2141 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 2142 }; 2143 } ), 2144 2145 // "Whether an element is represented by a :lang() selector 2146 // is based solely on the element's language value 2147 // being equal to the identifier C, 2148 // or beginning with the identifier C immediately followed by "-". 2149 // The matching of C against the element's language value is performed case-insensitively. 2150 // The identifier C does not have to be a valid language name." 2151 // http://www.w3.org/TR/selectors/#lang-pseudo 2152 "lang": markFunction( function( lang ) { 2153 2154 // lang value must be a valid identifier 2155 if ( !ridentifier.test( lang || "" ) ) { 2156 Sizzle.error( "unsupported lang: " + lang ); 2157 } 2158 lang = lang.replace( runescape, funescape ).toLowerCase(); 2159 return function( elem ) { 2160 var elemLang; 2161 do { 2162 if ( ( elemLang = documentIsHTML ? 2163 elem.lang : 2164 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 2165 2166 elemLang = elemLang.toLowerCase(); 2167 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2168 } 2169 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 2170 return false; 2171 }; 2172 } ), 2173 2174 // Miscellaneous 2175 "target": function( elem ) { 2176 var hash = window.location && window.location.hash; 2177 return hash && hash.slice( 1 ) === elem.id; 2178 }, 2179 2180 "root": function( elem ) { 2181 return elem === docElem; 2182 }, 2183 2184 "focus": function( elem ) { 2185 return elem === document.activeElement && 2186 ( !document.hasFocus || document.hasFocus() ) && 2187 !!( elem.type || elem.href || ~elem.tabIndex ); 2188 }, 2189 2190 // Boolean properties 2191 "enabled": createDisabledPseudo( false ), 2192 "disabled": createDisabledPseudo( true ), 2193 2194 "checked": function( elem ) { 2195 2196 // In CSS3, :checked should return both checked and selected elements 2197 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2198 var nodeName = elem.nodeName.toLowerCase(); 2199 return ( nodeName === "input" && !!elem.checked ) || 2200 ( nodeName === "option" && !!elem.selected ); 2201 }, 2202 2203 "selected": function( elem ) { 2204 2205 // Accessing this property makes selected-by-default 2206 // options in Safari work properly 2207 if ( elem.parentNode ) { 2208 // eslint-disable-next-line no-unused-expressions 2209 elem.parentNode.selectedIndex; 2210 } 2211 2212 return elem.selected === true; 2213 }, 2214 2215 // Contents 2216 "empty": function( elem ) { 2217 2218 // http://www.w3.org/TR/selectors/#empty-pseudo 2219 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2220 // but not by others (comment: 8; processing instruction: 7; etc.) 2221 // nodeType < 6 works because attributes (2) do not appear as children 2222 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2223 if ( elem.nodeType < 6 ) { 2224 return false; 2225 } 2226 } 2227 return true; 2228 }, 2229 2230 "parent": function( elem ) { 2231 return !Expr.pseudos[ "empty" ]( elem ); 2232 }, 2233 2234 // Element/input types 2235 "header": function( elem ) { 2236 return rheader.test( elem.nodeName ); 2237 }, 2238 2239 "input": function( elem ) { 2240 return rinputs.test( elem.nodeName ); 2241 }, 2242 2243 "button": function( elem ) { 2244 var name = elem.nodeName.toLowerCase(); 2245 return name === "input" && elem.type === "button" || name === "button"; 2246 }, 2247 2248 "text": function( elem ) { 2249 var attr; 2250 return elem.nodeName.toLowerCase() === "input" && 2251 elem.type === "text" && 2252 2253 // Support: IE<8 2254 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2255 ( ( attr = elem.getAttribute( "type" ) ) == null || 2256 attr.toLowerCase() === "text" ); 2257 }, 2258 2259 // Position-in-collection 2260 "first": createPositionalPseudo( function() { 2261 return [ 0 ]; 2262 } ), 2263 2264 "last": createPositionalPseudo( function( _matchIndexes, length ) { 2265 return [ length - 1 ]; 2266 } ), 2267 2268 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 2269 return [ argument < 0 ? argument + length : argument ]; 2270 } ), 2271 2272 "even": createPositionalPseudo( function( matchIndexes, length ) { 2273 var i = 0; 2274 for ( ; i < length; i += 2 ) { 2275 matchIndexes.push( i ); 2276 } 2277 return matchIndexes; 2278 } ), 2279 2280 "odd": createPositionalPseudo( function( matchIndexes, length ) { 2281 var i = 1; 2282 for ( ; i < length; i += 2 ) { 2283 matchIndexes.push( i ); 2284 } 2285 return matchIndexes; 2286 } ), 2287 2288 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2289 var i = argument < 0 ? 2290 argument + length : 2291 argument > length ? 2292 length : 2293 argument; 2294 for ( ; --i >= 0; ) { 2295 matchIndexes.push( i ); 2296 } 2297 return matchIndexes; 2298 } ), 2299 2300 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2301 var i = argument < 0 ? argument + length : argument; 2302 for ( ; ++i < length; ) { 2303 matchIndexes.push( i ); 2304 } 2305 return matchIndexes; 2306 } ) 2307 } 2308}; 2309 2310Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 2311 2312// Add button/input type pseudos 2313for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2314 Expr.pseudos[ i ] = createInputPseudo( i ); 2315} 2316for ( i in { submit: true, reset: true } ) { 2317 Expr.pseudos[ i ] = createButtonPseudo( i ); 2318} 2319 2320// Easy API for creating new setFilters 2321function setFilters() {} 2322setFilters.prototype = Expr.filters = Expr.pseudos; 2323Expr.setFilters = new setFilters(); 2324 2325tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2326 var matched, match, tokens, type, 2327 soFar, groups, preFilters, 2328 cached = tokenCache[ selector + " " ]; 2329 2330 if ( cached ) { 2331 return parseOnly ? 0 : cached.slice( 0 ); 2332 } 2333 2334 soFar = selector; 2335 groups = []; 2336 preFilters = Expr.preFilter; 2337 2338 while ( soFar ) { 2339 2340 // Comma and first run 2341 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2342 if ( match ) { 2343 2344 // Don't consume trailing commas as valid 2345 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2346 } 2347 groups.push( ( tokens = [] ) ); 2348 } 2349 2350 matched = false; 2351 2352 // Combinators 2353 if ( ( match = rcombinators.exec( soFar ) ) ) { 2354 matched = match.shift(); 2355 tokens.push( { 2356 value: matched, 2357 2358 // Cast descendant combinators to space 2359 type: match[ 0 ].replace( rtrim, " " ) 2360 } ); 2361 soFar = soFar.slice( matched.length ); 2362 } 2363 2364 // Filters 2365 for ( type in Expr.filter ) { 2366 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2367 ( match = preFilters[ type ]( match ) ) ) ) { 2368 matched = match.shift(); 2369 tokens.push( { 2370 value: matched, 2371 type: type, 2372 matches: match 2373 } ); 2374 soFar = soFar.slice( matched.length ); 2375 } 2376 } 2377 2378 if ( !matched ) { 2379 break; 2380 } 2381 } 2382 2383 // Return the length of the invalid excess 2384 // if we're just parsing 2385 // Otherwise, throw an error or return tokens 2386 return parseOnly ? 2387 soFar.length : 2388 soFar ? 2389 Sizzle.error( selector ) : 2390 2391 // Cache the tokens 2392 tokenCache( selector, groups ).slice( 0 ); 2393}; 2394 2395function toSelector( tokens ) { 2396 var i = 0, 2397 len = tokens.length, 2398 selector = ""; 2399 for ( ; i < len; i++ ) { 2400 selector += tokens[ i ].value; 2401 } 2402 return selector; 2403} 2404 2405function addCombinator( matcher, combinator, base ) { 2406 var dir = combinator.dir, 2407 skip = combinator.next, 2408 key = skip || dir, 2409 checkNonElements = base && key === "parentNode", 2410 doneName = done++; 2411 2412 return combinator.first ? 2413 2414 // Check against closest ancestor/preceding element 2415 function( elem, context, xml ) { 2416 while ( ( elem = elem[ dir ] ) ) { 2417 if ( elem.nodeType === 1 || checkNonElements ) { 2418 return matcher( elem, context, xml ); 2419 } 2420 } 2421 return false; 2422 } : 2423 2424 // Check against all ancestor/preceding elements 2425 function( elem, context, xml ) { 2426 var oldCache, uniqueCache, outerCache, 2427 newCache = [ dirruns, doneName ]; 2428 2429 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2430 if ( xml ) { 2431 while ( ( elem = elem[ dir ] ) ) { 2432 if ( elem.nodeType === 1 || checkNonElements ) { 2433 if ( matcher( elem, context, xml ) ) { 2434 return true; 2435 } 2436 } 2437 } 2438 } else { 2439 while ( ( elem = elem[ dir ] ) ) { 2440 if ( elem.nodeType === 1 || checkNonElements ) { 2441 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2442 2443 // Support: IE <9 only 2444 // Defend against cloned attroperties (jQuery gh-1709) 2445 uniqueCache = outerCache[ elem.uniqueID ] || 2446 ( outerCache[ elem.uniqueID ] = {} ); 2447 2448 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2449 elem = elem[ dir ] || elem; 2450 } else if ( ( oldCache = uniqueCache[ key ] ) && 2451 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2452 2453 // Assign to newCache so results back-propagate to previous elements 2454 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2455 } else { 2456 2457 // Reuse newcache so results back-propagate to previous elements 2458 uniqueCache[ key ] = newCache; 2459 2460 // A match means we're done; a fail means we have to keep checking 2461 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2462 return true; 2463 } 2464 } 2465 } 2466 } 2467 } 2468 return false; 2469 }; 2470} 2471 2472function elementMatcher( matchers ) { 2473 return matchers.length > 1 ? 2474 function( elem, context, xml ) { 2475 var i = matchers.length; 2476 while ( i-- ) { 2477 if ( !matchers[ i ]( elem, context, xml ) ) { 2478 return false; 2479 } 2480 } 2481 return true; 2482 } : 2483 matchers[ 0 ]; 2484} 2485 2486function multipleContexts( selector, contexts, results ) { 2487 var i = 0, 2488 len = contexts.length; 2489 for ( ; i < len; i++ ) { 2490 Sizzle( selector, contexts[ i ], results ); 2491 } 2492 return results; 2493} 2494 2495function condense( unmatched, map, filter, context, xml ) { 2496 var elem, 2497 newUnmatched = [], 2498 i = 0, 2499 len = unmatched.length, 2500 mapped = map != null; 2501 2502 for ( ; i < len; i++ ) { 2503 if ( ( elem = unmatched[ i ] ) ) { 2504 if ( !filter || filter( elem, context, xml ) ) { 2505 newUnmatched.push( elem ); 2506 if ( mapped ) { 2507 map.push( i ); 2508 } 2509 } 2510 } 2511 } 2512 2513 return newUnmatched; 2514} 2515 2516function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2517 if ( postFilter && !postFilter[ expando ] ) { 2518 postFilter = setMatcher( postFilter ); 2519 } 2520 if ( postFinder && !postFinder[ expando ] ) { 2521 postFinder = setMatcher( postFinder, postSelector ); 2522 } 2523 return markFunction( function( seed, results, context, xml ) { 2524 var temp, i, elem, 2525 preMap = [], 2526 postMap = [], 2527 preexisting = results.length, 2528 2529 // Get initial elements from seed or context 2530 elems = seed || multipleContexts( 2531 selector || "*", 2532 context.nodeType ? [ context ] : context, 2533 [] 2534 ), 2535 2536 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2537 matcherIn = preFilter && ( seed || !selector ) ? 2538 condense( elems, preMap, preFilter, context, xml ) : 2539 elems, 2540 2541 matcherOut = matcher ? 2542 2543 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2544 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2545 2546 // ...intermediate processing is necessary 2547 [] : 2548 2549 // ...otherwise use results directly 2550 results : 2551 matcherIn; 2552 2553 // Find primary matches 2554 if ( matcher ) { 2555 matcher( matcherIn, matcherOut, context, xml ); 2556 } 2557 2558 // Apply postFilter 2559 if ( postFilter ) { 2560 temp = condense( matcherOut, postMap ); 2561 postFilter( temp, [], context, xml ); 2562 2563 // Un-match failing elements by moving them back to matcherIn 2564 i = temp.length; 2565 while ( i-- ) { 2566 if ( ( elem = temp[ i ] ) ) { 2567 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2568 } 2569 } 2570 } 2571 2572 if ( seed ) { 2573 if ( postFinder || preFilter ) { 2574 if ( postFinder ) { 2575 2576 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2577 temp = []; 2578 i = matcherOut.length; 2579 while ( i-- ) { 2580 if ( ( elem = matcherOut[ i ] ) ) { 2581 2582 // Restore matcherIn since elem is not yet a final match 2583 temp.push( ( matcherIn[ i ] = elem ) ); 2584 } 2585 } 2586 postFinder( null, ( matcherOut = [] ), temp, xml ); 2587 } 2588 2589 // Move matched elements from seed to results to keep them synchronized 2590 i = matcherOut.length; 2591 while ( i-- ) { 2592 if ( ( elem = matcherOut[ i ] ) && 2593 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 2594 2595 seed[ temp ] = !( results[ temp ] = elem ); 2596 } 2597 } 2598 } 2599 2600 // Add elements to results, through postFinder if defined 2601 } else { 2602 matcherOut = condense( 2603 matcherOut === results ? 2604 matcherOut.splice( preexisting, matcherOut.length ) : 2605 matcherOut 2606 ); 2607 if ( postFinder ) { 2608 postFinder( null, results, matcherOut, xml ); 2609 } else { 2610 push.apply( results, matcherOut ); 2611 } 2612 } 2613 } ); 2614} 2615 2616function matcherFromTokens( tokens ) { 2617 var checkContext, matcher, j, 2618 len = tokens.length, 2619 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2620 implicitRelative = leadingRelative || Expr.relative[ " " ], 2621 i = leadingRelative ? 1 : 0, 2622 2623 // The foundational matcher ensures that elements are reachable from top-level context(s) 2624 matchContext = addCombinator( function( elem ) { 2625 return elem === checkContext; 2626 }, implicitRelative, true ), 2627 matchAnyContext = addCombinator( function( elem ) { 2628 return indexOf( checkContext, elem ) > -1; 2629 }, implicitRelative, true ), 2630 matchers = [ function( elem, context, xml ) { 2631 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2632 ( checkContext = context ).nodeType ? 2633 matchContext( elem, context, xml ) : 2634 matchAnyContext( elem, context, xml ) ); 2635 2636 // Avoid hanging onto element (issue #299) 2637 checkContext = null; 2638 return ret; 2639 } ]; 2640 2641 for ( ; i < len; i++ ) { 2642 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2643 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2644 } else { 2645 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2646 2647 // Return special upon seeing a positional matcher 2648 if ( matcher[ expando ] ) { 2649 2650 // Find the next relative operator (if any) for proper handling 2651 j = ++i; 2652 for ( ; j < len; j++ ) { 2653 if ( Expr.relative[ tokens[ j ].type ] ) { 2654 break; 2655 } 2656 } 2657 return setMatcher( 2658 i > 1 && elementMatcher( matchers ), 2659 i > 1 && toSelector( 2660 2661 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2662 tokens 2663 .slice( 0, i - 1 ) 2664 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2665 ).replace( rtrim, "$1" ), 2666 matcher, 2667 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2668 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2669 j < len && toSelector( tokens ) 2670 ); 2671 } 2672 matchers.push( matcher ); 2673 } 2674 } 2675 2676 return elementMatcher( matchers ); 2677} 2678 2679function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2680 var bySet = setMatchers.length > 0, 2681 byElement = elementMatchers.length > 0, 2682 superMatcher = function( seed, context, xml, results, outermost ) { 2683 var elem, j, matcher, 2684 matchedCount = 0, 2685 i = "0", 2686 unmatched = seed && [], 2687 setMatched = [], 2688 contextBackup = outermostContext, 2689 2690 // We must always have either seed elements or outermost context 2691 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 2692 2693 // Use integer dirruns iff this is the outermost matcher 2694 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2695 len = elems.length; 2696 2697 if ( outermost ) { 2698 2699 // Support: IE 11+, Edge 17 - 18+ 2700 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2701 // two documents; shallow comparisons work. 2702 // eslint-disable-next-line eqeqeq 2703 outermostContext = context == document || context || outermost; 2704 } 2705 2706 // Add elements passing elementMatchers directly to results 2707 // Support: IE<9, Safari 2708 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2709 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2710 if ( byElement && elem ) { 2711 j = 0; 2712 2713 // Support: IE 11+, Edge 17 - 18+ 2714 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2715 // two documents; shallow comparisons work. 2716 // eslint-disable-next-line eqeqeq 2717 if ( !context && elem.ownerDocument != document ) { 2718 setDocument( elem ); 2719 xml = !documentIsHTML; 2720 } 2721 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2722 if ( matcher( elem, context || document, xml ) ) { 2723 results.push( elem ); 2724 break; 2725 } 2726 } 2727 if ( outermost ) { 2728 dirruns = dirrunsUnique; 2729 } 2730 } 2731 2732 // Track unmatched elements for set filters 2733 if ( bySet ) { 2734 2735 // They will have gone through all possible matchers 2736 if ( ( elem = !matcher && elem ) ) { 2737 matchedCount--; 2738 } 2739 2740 // Lengthen the array for every element, matched or not 2741 if ( seed ) { 2742 unmatched.push( elem ); 2743 } 2744 } 2745 } 2746 2747 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2748 // makes the latter nonnegative. 2749 matchedCount += i; 2750 2751 // Apply set filters to unmatched elements 2752 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2753 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2754 // no element matchers and no seed. 2755 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2756 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2757 // numerically zero. 2758 if ( bySet && i !== matchedCount ) { 2759 j = 0; 2760 while ( ( matcher = setMatchers[ j++ ] ) ) { 2761 matcher( unmatched, setMatched, context, xml ); 2762 } 2763 2764 if ( seed ) { 2765 2766 // Reintegrate element matches to eliminate the need for sorting 2767 if ( matchedCount > 0 ) { 2768 while ( i-- ) { 2769 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2770 setMatched[ i ] = pop.call( results ); 2771 } 2772 } 2773 } 2774 2775 // Discard index placeholder values to get only actual matches 2776 setMatched = condense( setMatched ); 2777 } 2778 2779 // Add matches to results 2780 push.apply( results, setMatched ); 2781 2782 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2783 if ( outermost && !seed && setMatched.length > 0 && 2784 ( matchedCount + setMatchers.length ) > 1 ) { 2785 2786 Sizzle.uniqueSort( results ); 2787 } 2788 } 2789 2790 // Override manipulation of globals by nested matchers 2791 if ( outermost ) { 2792 dirruns = dirrunsUnique; 2793 outermostContext = contextBackup; 2794 } 2795 2796 return unmatched; 2797 }; 2798 2799 return bySet ? 2800 markFunction( superMatcher ) : 2801 superMatcher; 2802} 2803 2804compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2805 var i, 2806 setMatchers = [], 2807 elementMatchers = [], 2808 cached = compilerCache[ selector + " " ]; 2809 2810 if ( !cached ) { 2811 2812 // Generate a function of recursive functions that can be used to check each element 2813 if ( !match ) { 2814 match = tokenize( selector ); 2815 } 2816 i = match.length; 2817 while ( i-- ) { 2818 cached = matcherFromTokens( match[ i ] ); 2819 if ( cached[ expando ] ) { 2820 setMatchers.push( cached ); 2821 } else { 2822 elementMatchers.push( cached ); 2823 } 2824 } 2825 2826 // Cache the compiled function 2827 cached = compilerCache( 2828 selector, 2829 matcherFromGroupMatchers( elementMatchers, setMatchers ) 2830 ); 2831 2832 // Save selector and tokenization 2833 cached.selector = selector; 2834 } 2835 return cached; 2836}; 2837 2838/** 2839 * A low-level selection function that works with Sizzle's compiled 2840 * selector functions 2841 * @param {String|Function} selector A selector or a pre-compiled 2842 * selector function built with Sizzle.compile 2843 * @param {Element} context 2844 * @param {Array} [results] 2845 * @param {Array} [seed] A set of elements to match against 2846 */ 2847select = Sizzle.select = function( selector, context, results, seed ) { 2848 var i, tokens, token, type, find, 2849 compiled = typeof selector === "function" && selector, 2850 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2851 2852 results = results || []; 2853 2854 // Try to minimize operations if there is only one selector in the list and no seed 2855 // (the latter of which guarantees us context) 2856 if ( match.length === 1 ) { 2857 2858 // Reduce context if the leading compound selector is an ID 2859 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2860 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2861 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2862 2863 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 2864 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 2865 if ( !context ) { 2866 return results; 2867 2868 // Precompiled matchers will still verify ancestry, so step up a level 2869 } else if ( compiled ) { 2870 context = context.parentNode; 2871 } 2872 2873 selector = selector.slice( tokens.shift().value.length ); 2874 } 2875 2876 // Fetch a seed set for right-to-left matching 2877 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 2878 while ( i-- ) { 2879 token = tokens[ i ]; 2880 2881 // Abort if we hit a combinator 2882 if ( Expr.relative[ ( type = token.type ) ] ) { 2883 break; 2884 } 2885 if ( ( find = Expr.find[ type ] ) ) { 2886 2887 // Search, expanding context for leading sibling combinators 2888 if ( ( seed = find( 2889 token.matches[ 0 ].replace( runescape, funescape ), 2890 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 2891 context 2892 ) ) ) { 2893 2894 // If seed is empty or no tokens remain, we can return early 2895 tokens.splice( i, 1 ); 2896 selector = seed.length && toSelector( tokens ); 2897 if ( !selector ) { 2898 push.apply( results, seed ); 2899 return results; 2900 } 2901 2902 break; 2903 } 2904 } 2905 } 2906 } 2907 2908 // Compile and execute a filtering function if one is not provided 2909 // Provide `match` to avoid retokenization if we modified the selector above 2910 ( compiled || compile( selector, match ) )( 2911 seed, 2912 context, 2913 !documentIsHTML, 2914 results, 2915 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2916 ); 2917 return results; 2918}; 2919 2920// One-time assignments 2921 2922// Sort stability 2923support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2924 2925// Support: Chrome 14-35+ 2926// Always assume duplicates if they aren't passed to the comparison function 2927support.detectDuplicates = !!hasDuplicate; 2928 2929// Initialize against the default document 2930setDocument(); 2931 2932// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2933// Detached nodes confoundingly follow *each other* 2934support.sortDetached = assert( function( el ) { 2935 2936 // Should return 1, but returns 4 (following) 2937 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2938} ); 2939 2940// Support: IE<8 2941// Prevent attribute/property "interpolation" 2942// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2943if ( !assert( function( el ) { 2944 el.innerHTML = "<a href='#'></a>"; 2945 return el.firstChild.getAttribute( "href" ) === "#"; 2946} ) ) { 2947 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2948 if ( !isXML ) { 2949 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2950 } 2951 } ); 2952} 2953 2954// Support: IE<9 2955// Use defaultValue in place of getAttribute("value") 2956if ( !support.attributes || !assert( function( el ) { 2957 el.innerHTML = "<input/>"; 2958 el.firstChild.setAttribute( "value", "" ); 2959 return el.firstChild.getAttribute( "value" ) === ""; 2960} ) ) { 2961 addHandle( "value", function( elem, _name, isXML ) { 2962 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2963 return elem.defaultValue; 2964 } 2965 } ); 2966} 2967 2968// Support: IE<9 2969// Use getAttributeNode to fetch booleans when getAttribute lies 2970if ( !assert( function( el ) { 2971 return el.getAttribute( "disabled" ) == null; 2972} ) ) { 2973 addHandle( booleans, function( elem, name, isXML ) { 2974 var val; 2975 if ( !isXML ) { 2976 return elem[ name ] === true ? name.toLowerCase() : 2977 ( val = elem.getAttributeNode( name ) ) && val.specified ? 2978 val.value : 2979 null; 2980 } 2981 } ); 2982} 2983 2984return Sizzle; 2985 2986} )( window ); 2987 2988 2989 2990jQuery.find = Sizzle; 2991jQuery.expr = Sizzle.selectors; 2992 2993// Deprecated 2994jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2995jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2996jQuery.text = Sizzle.getText; 2997jQuery.isXMLDoc = Sizzle.isXML; 2998jQuery.contains = Sizzle.contains; 2999jQuery.escapeSelector = Sizzle.escape; 3000 3001 3002 3003 3004var dir = function( elem, dir, until ) { 3005 var matched = [], 3006 truncate = until !== undefined; 3007 3008 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 3009 if ( elem.nodeType === 1 ) { 3010 if ( truncate && jQuery( elem ).is( until ) ) { 3011 break; 3012 } 3013 matched.push( elem ); 3014 } 3015 } 3016 return matched; 3017}; 3018 3019 3020var siblings = function( n, elem ) { 3021 var matched = []; 3022 3023 for ( ; n; n = n.nextSibling ) { 3024 if ( n.nodeType === 1 && n !== elem ) { 3025 matched.push( n ); 3026 } 3027 } 3028 3029 return matched; 3030}; 3031 3032 3033var rneedsContext = jQuery.expr.match.needsContext; 3034 3035 3036 3037function nodeName( elem, name ) { 3038 3039 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3040 3041} 3042var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 3043 3044 3045 3046// Implement the identical functionality for filter and not 3047function winnow( elements, qualifier, not ) { 3048 if ( isFunction( qualifier ) ) { 3049 return jQuery.grep( elements, function( elem, i ) { 3050 return !!qualifier.call( elem, i, elem ) !== not; 3051 } ); 3052 } 3053 3054 // Single element 3055 if ( qualifier.nodeType ) { 3056 return jQuery.grep( elements, function( elem ) { 3057 return ( elem === qualifier ) !== not; 3058 } ); 3059 } 3060 3061 // Arraylike of elements (jQuery, arguments, Array) 3062 if ( typeof qualifier !== "string" ) { 3063 return jQuery.grep( elements, function( elem ) { 3064 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 3065 } ); 3066 } 3067 3068 // Filtered directly for both simple and complex selectors 3069 return jQuery.filter( qualifier, elements, not ); 3070} 3071 3072jQuery.filter = function( expr, elems, not ) { 3073 var elem = elems[ 0 ]; 3074 3075 if ( not ) { 3076 expr = ":not(" + expr + ")"; 3077 } 3078 3079 if ( elems.length === 1 && elem.nodeType === 1 ) { 3080 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 3081 } 3082 3083 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 3084 return elem.nodeType === 1; 3085 } ) ); 3086}; 3087 3088jQuery.fn.extend( { 3089 find: function( selector ) { 3090 var i, ret, 3091 len = this.length, 3092 self = this; 3093 3094 if ( typeof selector !== "string" ) { 3095 return this.pushStack( jQuery( selector ).filter( function() { 3096 for ( i = 0; i < len; i++ ) { 3097 if ( jQuery.contains( self[ i ], this ) ) { 3098 return true; 3099 } 3100 } 3101 } ) ); 3102 } 3103 3104 ret = this.pushStack( [] ); 3105 3106 for ( i = 0; i < len; i++ ) { 3107 jQuery.find( selector, self[ i ], ret ); 3108 } 3109 3110 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 3111 }, 3112 filter: function( selector ) { 3113 return this.pushStack( winnow( this, selector || [], false ) ); 3114 }, 3115 not: function( selector ) { 3116 return this.pushStack( winnow( this, selector || [], true ) ); 3117 }, 3118 is: function( selector ) { 3119 return !!winnow( 3120 this, 3121 3122 // If this is a positional/relative selector, check membership in the returned set 3123 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3124 typeof selector === "string" && rneedsContext.test( selector ) ? 3125 jQuery( selector ) : 3126 selector || [], 3127 false 3128 ).length; 3129 } 3130} ); 3131 3132 3133// Initialize a jQuery object 3134 3135 3136// A central reference to the root jQuery(document) 3137var rootjQuery, 3138 3139 // A simple way to check for HTML strings 3140 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 3141 // Strict HTML recognition (trac-11290: must start with <) 3142 // Shortcut simple #id case for speed 3143 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3144 3145 init = jQuery.fn.init = function( selector, context, root ) { 3146 var match, elem; 3147 3148 // HANDLE: $(""), $(null), $(undefined), $(false) 3149 if ( !selector ) { 3150 return this; 3151 } 3152 3153 // Method init() accepts an alternate rootjQuery 3154 // so migrate can support jQuery.sub (gh-2101) 3155 root = root || rootjQuery; 3156 3157 // Handle HTML strings 3158 if ( typeof selector === "string" ) { 3159 if ( selector[ 0 ] === "<" && 3160 selector[ selector.length - 1 ] === ">" && 3161 selector.length >= 3 ) { 3162 3163 // Assume that strings that start and end with <> are HTML and skip the regex check 3164 match = [ null, selector, null ]; 3165 3166 } else { 3167 match = rquickExpr.exec( selector ); 3168 } 3169 3170 // Match html or make sure no context is specified for #id 3171 if ( match && ( match[ 1 ] || !context ) ) { 3172 3173 // HANDLE: $(html) -> $(array) 3174 if ( match[ 1 ] ) { 3175 context = context instanceof jQuery ? context[ 0 ] : context; 3176 3177 // Option to run scripts is true for back-compat 3178 // Intentionally let the error be thrown if parseHTML is not present 3179 jQuery.merge( this, jQuery.parseHTML( 3180 match[ 1 ], 3181 context && context.nodeType ? context.ownerDocument || context : document, 3182 true 3183 ) ); 3184 3185 // HANDLE: $(html, props) 3186 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 3187 for ( match in context ) { 3188 3189 // Properties of context are called as methods if possible 3190 if ( isFunction( this[ match ] ) ) { 3191 this[ match ]( context[ match ] ); 3192 3193 // ...and otherwise set as attributes 3194 } else { 3195 this.attr( match, context[ match ] ); 3196 } 3197 } 3198 } 3199 3200 return this; 3201 3202 // HANDLE: $(#id) 3203 } else { 3204 elem = document.getElementById( match[ 2 ] ); 3205 3206 if ( elem ) { 3207 3208 // Inject the element directly into the jQuery object 3209 this[ 0 ] = elem; 3210 this.length = 1; 3211 } 3212 return this; 3213 } 3214 3215 // HANDLE: $(expr, $(...)) 3216 } else if ( !context || context.jquery ) { 3217 return ( context || root ).find( selector ); 3218 3219 // HANDLE: $(expr, context) 3220 // (which is just equivalent to: $(context).find(expr) 3221 } else { 3222 return this.constructor( context ).find( selector ); 3223 } 3224 3225 // HANDLE: $(DOMElement) 3226 } else if ( selector.nodeType ) { 3227 this[ 0 ] = selector; 3228 this.length = 1; 3229 return this; 3230 3231 // HANDLE: $(function) 3232 // Shortcut for document ready 3233 } else if ( isFunction( selector ) ) { 3234 return root.ready !== undefined ? 3235 root.ready( selector ) : 3236 3237 // Execute immediately if ready is not present 3238 selector( jQuery ); 3239 } 3240 3241 return jQuery.makeArray( selector, this ); 3242 }; 3243 3244// Give the init function the jQuery prototype for later instantiation 3245init.prototype = jQuery.fn; 3246 3247// Initialize central reference 3248rootjQuery = jQuery( document ); 3249 3250 3251var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3252 3253 // Methods guaranteed to produce a unique set when starting from a unique set 3254 guaranteedUnique = { 3255 children: true, 3256 contents: true, 3257 next: true, 3258 prev: true 3259 }; 3260 3261jQuery.fn.extend( { 3262 has: function( target ) { 3263 var targets = jQuery( target, this ), 3264 l = targets.length; 3265 3266 return this.filter( function() { 3267 var i = 0; 3268 for ( ; i < l; i++ ) { 3269 if ( jQuery.contains( this, targets[ i ] ) ) { 3270 return true; 3271 } 3272 } 3273 } ); 3274 }, 3275 3276 closest: function( selectors, context ) { 3277 var cur, 3278 i = 0, 3279 l = this.length, 3280 matched = [], 3281 targets = typeof selectors !== "string" && jQuery( selectors ); 3282 3283 // Positional selectors never match, since there's no _selection_ context 3284 if ( !rneedsContext.test( selectors ) ) { 3285 for ( ; i < l; i++ ) { 3286 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3287 3288 // Always skip document fragments 3289 if ( cur.nodeType < 11 && ( targets ? 3290 targets.index( cur ) > -1 : 3291 3292 // Don't pass non-elements to Sizzle 3293 cur.nodeType === 1 && 3294 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3295 3296 matched.push( cur ); 3297 break; 3298 } 3299 } 3300 } 3301 } 3302 3303 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3304 }, 3305 3306 // Determine the position of an element within the set 3307 index: function( elem ) { 3308 3309 // No argument, return index in parent 3310 if ( !elem ) { 3311 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3312 } 3313 3314 // Index in selector 3315 if ( typeof elem === "string" ) { 3316 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3317 } 3318 3319 // Locate the position of the desired element 3320 return indexOf.call( this, 3321 3322 // If it receives a jQuery object, the first element is used 3323 elem.jquery ? elem[ 0 ] : elem 3324 ); 3325 }, 3326 3327 add: function( selector, context ) { 3328 return this.pushStack( 3329 jQuery.uniqueSort( 3330 jQuery.merge( this.get(), jQuery( selector, context ) ) 3331 ) 3332 ); 3333 }, 3334 3335 addBack: function( selector ) { 3336 return this.add( selector == null ? 3337 this.prevObject : this.prevObject.filter( selector ) 3338 ); 3339 } 3340} ); 3341 3342function sibling( cur, dir ) { 3343 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3344 return cur; 3345} 3346 3347jQuery.each( { 3348 parent: function( elem ) { 3349 var parent = elem.parentNode; 3350 return parent && parent.nodeType !== 11 ? parent : null; 3351 }, 3352 parents: function( elem ) { 3353 return dir( elem, "parentNode" ); 3354 }, 3355 parentsUntil: function( elem, _i, until ) { 3356 return dir( elem, "parentNode", until ); 3357 }, 3358 next: function( elem ) { 3359 return sibling( elem, "nextSibling" ); 3360 }, 3361 prev: function( elem ) { 3362 return sibling( elem, "previousSibling" ); 3363 }, 3364 nextAll: function( elem ) { 3365 return dir( elem, "nextSibling" ); 3366 }, 3367 prevAll: function( elem ) { 3368 return dir( elem, "previousSibling" ); 3369 }, 3370 nextUntil: function( elem, _i, until ) { 3371 return dir( elem, "nextSibling", until ); 3372 }, 3373 prevUntil: function( elem, _i, until ) { 3374 return dir( elem, "previousSibling", until ); 3375 }, 3376 siblings: function( elem ) { 3377 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3378 }, 3379 children: function( elem ) { 3380 return siblings( elem.firstChild ); 3381 }, 3382 contents: function( elem ) { 3383 if ( elem.contentDocument != null && 3384 3385 // Support: IE 11+ 3386 // <object> elements with no `data` attribute has an object 3387 // `contentDocument` with a `null` prototype. 3388 getProto( elem.contentDocument ) ) { 3389 3390 return elem.contentDocument; 3391 } 3392 3393 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3394 // Treat the template element as a regular one in browsers that 3395 // don't support it. 3396 if ( nodeName( elem, "template" ) ) { 3397 elem = elem.content || elem; 3398 } 3399 3400 return jQuery.merge( [], elem.childNodes ); 3401 } 3402}, function( name, fn ) { 3403 jQuery.fn[ name ] = function( until, selector ) { 3404 var matched = jQuery.map( this, fn, until ); 3405 3406 if ( name.slice( -5 ) !== "Until" ) { 3407 selector = until; 3408 } 3409 3410 if ( selector && typeof selector === "string" ) { 3411 matched = jQuery.filter( selector, matched ); 3412 } 3413 3414 if ( this.length > 1 ) { 3415 3416 // Remove duplicates 3417 if ( !guaranteedUnique[ name ] ) { 3418 jQuery.uniqueSort( matched ); 3419 } 3420 3421 // Reverse order for parents* and prev-derivatives 3422 if ( rparentsprev.test( name ) ) { 3423 matched.reverse(); 3424 } 3425 } 3426 3427 return this.pushStack( matched ); 3428 }; 3429} ); 3430var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3431 3432 3433 3434// Convert String-formatted options into Object-formatted ones 3435function createOptions( options ) { 3436 var object = {}; 3437 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3438 object[ flag ] = true; 3439 } ); 3440 return object; 3441} 3442 3443/* 3444 * Create a callback list using the following parameters: 3445 * 3446 * options: an optional list of space-separated options that will change how 3447 * the callback list behaves or a more traditional option object 3448 * 3449 * By default a callback list will act like an event callback list and can be 3450 * "fired" multiple times. 3451 * 3452 * Possible options: 3453 * 3454 * once: will ensure the callback list can only be fired once (like a Deferred) 3455 * 3456 * memory: will keep track of previous values and will call any callback added 3457 * after the list has been fired right away with the latest "memorized" 3458 * values (like a Deferred) 3459 * 3460 * unique: will ensure a callback can only be added once (no duplicate in the list) 3461 * 3462 * stopOnFalse: interrupt callings when a callback returns false 3463 * 3464 */ 3465jQuery.Callbacks = function( options ) { 3466 3467 // Convert options from String-formatted to Object-formatted if needed 3468 // (we check in cache first) 3469 options = typeof options === "string" ? 3470 createOptions( options ) : 3471 jQuery.extend( {}, options ); 3472 3473 var // Flag to know if list is currently firing 3474 firing, 3475 3476 // Last fire value for non-forgettable lists 3477 memory, 3478 3479 // Flag to know if list was already fired 3480 fired, 3481 3482 // Flag to prevent firing 3483 locked, 3484 3485 // Actual callback list 3486 list = [], 3487 3488 // Queue of execution data for repeatable lists 3489 queue = [], 3490 3491 // Index of currently firing callback (modified by add/remove as needed) 3492 firingIndex = -1, 3493 3494 // Fire callbacks 3495 fire = function() { 3496 3497 // Enforce single-firing 3498 locked = locked || options.once; 3499 3500 // Execute callbacks for all pending executions, 3501 // respecting firingIndex overrides and runtime changes 3502 fired = firing = true; 3503 for ( ; queue.length; firingIndex = -1 ) { 3504 memory = queue.shift(); 3505 while ( ++firingIndex < list.length ) { 3506 3507 // Run callback and check for early termination 3508 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3509 options.stopOnFalse ) { 3510 3511 // Jump to end and forget the data so .add doesn't re-fire 3512 firingIndex = list.length; 3513 memory = false; 3514 } 3515 } 3516 } 3517 3518 // Forget the data if we're done with it 3519 if ( !options.memory ) { 3520 memory = false; 3521 } 3522 3523 firing = false; 3524 3525 // Clean up if we're done firing for good 3526 if ( locked ) { 3527 3528 // Keep an empty list if we have data for future add calls 3529 if ( memory ) { 3530 list = []; 3531 3532 // Otherwise, this object is spent 3533 } else { 3534 list = ""; 3535 } 3536 } 3537 }, 3538 3539 // Actual Callbacks object 3540 self = { 3541 3542 // Add a callback or a collection of callbacks to the list 3543 add: function() { 3544 if ( list ) { 3545 3546 // If we have memory from a past run, we should fire after adding 3547 if ( memory && !firing ) { 3548 firingIndex = list.length - 1; 3549 queue.push( memory ); 3550 } 3551 3552 ( function add( args ) { 3553 jQuery.each( args, function( _, arg ) { 3554 if ( isFunction( arg ) ) { 3555 if ( !options.unique || !self.has( arg ) ) { 3556 list.push( arg ); 3557 } 3558 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3559 3560 // Inspect recursively 3561 add( arg ); 3562 } 3563 } ); 3564 } )( arguments ); 3565 3566 if ( memory && !firing ) { 3567 fire(); 3568 } 3569 } 3570 return this; 3571 }, 3572 3573 // Remove a callback from the list 3574 remove: function() { 3575 jQuery.each( arguments, function( _, arg ) { 3576 var index; 3577 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3578 list.splice( index, 1 ); 3579 3580 // Handle firing indexes 3581 if ( index <= firingIndex ) { 3582 firingIndex--; 3583 } 3584 } 3585 } ); 3586 return this; 3587 }, 3588 3589 // Check if a given callback is in the list. 3590 // If no argument is given, return whether or not list has callbacks attached. 3591 has: function( fn ) { 3592 return fn ? 3593 jQuery.inArray( fn, list ) > -1 : 3594 list.length > 0; 3595 }, 3596 3597 // Remove all callbacks from the list 3598 empty: function() { 3599 if ( list ) { 3600 list = []; 3601 } 3602 return this; 3603 }, 3604 3605 // Disable .fire and .add 3606 // Abort any current/pending executions 3607 // Clear all callbacks and values 3608 disable: function() { 3609 locked = queue = []; 3610 list = memory = ""; 3611 return this; 3612 }, 3613 disabled: function() { 3614 return !list; 3615 }, 3616 3617 // Disable .fire 3618 // Also disable .add unless we have memory (since it would have no effect) 3619 // Abort any pending executions 3620 lock: function() { 3621 locked = queue = []; 3622 if ( !memory && !firing ) { 3623 list = memory = ""; 3624 } 3625 return this; 3626 }, 3627 locked: function() { 3628 return !!locked; 3629 }, 3630 3631 // Call all callbacks with the given context and arguments 3632 fireWith: function( context, args ) { 3633 if ( !locked ) { 3634 args = args || []; 3635 args = [ context, args.slice ? args.slice() : args ]; 3636 queue.push( args ); 3637 if ( !firing ) { 3638 fire(); 3639 } 3640 } 3641 return this; 3642 }, 3643 3644 // Call all the callbacks with the given arguments 3645 fire: function() { 3646 self.fireWith( this, arguments ); 3647 return this; 3648 }, 3649 3650 // To know if the callbacks have already been called at least once 3651 fired: function() { 3652 return !!fired; 3653 } 3654 }; 3655 3656 return self; 3657}; 3658 3659 3660function Identity( v ) { 3661 return v; 3662} 3663function Thrower( ex ) { 3664 throw ex; 3665} 3666 3667function adoptValue( value, resolve, reject, noValue ) { 3668 var method; 3669 3670 try { 3671 3672 // Check for promise aspect first to privilege synchronous behavior 3673 if ( value && isFunction( ( method = value.promise ) ) ) { 3674 method.call( value ).done( resolve ).fail( reject ); 3675 3676 // Other thenables 3677 } else if ( value && isFunction( ( method = value.then ) ) ) { 3678 method.call( value, resolve, reject ); 3679 3680 // Other non-thenables 3681 } else { 3682 3683 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3684 // * false: [ value ].slice( 0 ) => resolve( value ) 3685 // * true: [ value ].slice( 1 ) => resolve() 3686 resolve.apply( undefined, [ value ].slice( noValue ) ); 3687 } 3688 3689 // For Promises/A+, convert exceptions into rejections 3690 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3691 // Deferred#then to conditionally suppress rejection. 3692 } catch ( value ) { 3693 3694 // Support: Android 4.0 only 3695 // Strict mode functions invoked without .call/.apply get global-object context 3696 reject.apply( undefined, [ value ] ); 3697 } 3698} 3699 3700jQuery.extend( { 3701 3702 Deferred: function( func ) { 3703 var tuples = [ 3704 3705 // action, add listener, callbacks, 3706 // ... .then handlers, argument index, [final state] 3707 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3708 jQuery.Callbacks( "memory" ), 2 ], 3709 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3710 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3711 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3712 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3713 ], 3714 state = "pending", 3715 promise = { 3716 state: function() { 3717 return state; 3718 }, 3719 always: function() { 3720 deferred.done( arguments ).fail( arguments ); 3721 return this; 3722 }, 3723 "catch": function( fn ) { 3724 return promise.then( null, fn ); 3725 }, 3726 3727 // Keep pipe for back-compat 3728 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3729 var fns = arguments; 3730 3731 return jQuery.Deferred( function( newDefer ) { 3732 jQuery.each( tuples, function( _i, tuple ) { 3733 3734 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3735 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3736 3737 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3738 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3739 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3740 deferred[ tuple[ 1 ] ]( function() { 3741 var returned = fn && fn.apply( this, arguments ); 3742 if ( returned && isFunction( returned.promise ) ) { 3743 returned.promise() 3744 .progress( newDefer.notify ) 3745 .done( newDefer.resolve ) 3746 .fail( newDefer.reject ); 3747 } else { 3748 newDefer[ tuple[ 0 ] + "With" ]( 3749 this, 3750 fn ? [ returned ] : arguments 3751 ); 3752 } 3753 } ); 3754 } ); 3755 fns = null; 3756 } ).promise(); 3757 }, 3758 then: function( onFulfilled, onRejected, onProgress ) { 3759 var maxDepth = 0; 3760 function resolve( depth, deferred, handler, special ) { 3761 return function() { 3762 var that = this, 3763 args = arguments, 3764 mightThrow = function() { 3765 var returned, then; 3766 3767 // Support: Promises/A+ section 2.3.3.3.3 3768 // https://promisesaplus.com/#point-59 3769 // Ignore double-resolution attempts 3770 if ( depth < maxDepth ) { 3771 return; 3772 } 3773 3774 returned = handler.apply( that, args ); 3775 3776 // Support: Promises/A+ section 2.3.1 3777 // https://promisesaplus.com/#point-48 3778 if ( returned === deferred.promise() ) { 3779 throw new TypeError( "Thenable self-resolution" ); 3780 } 3781 3782 // Support: Promises/A+ sections 2.3.3.1, 3.5 3783 // https://promisesaplus.com/#point-54 3784 // https://promisesaplus.com/#point-75 3785 // Retrieve `then` only once 3786 then = returned && 3787 3788 // Support: Promises/A+ section 2.3.4 3789 // https://promisesaplus.com/#point-64 3790 // Only check objects and functions for thenability 3791 ( typeof returned === "object" || 3792 typeof returned === "function" ) && 3793 returned.then; 3794 3795 // Handle a returned thenable 3796 if ( isFunction( then ) ) { 3797 3798 // Special processors (notify) just wait for resolution 3799 if ( special ) { 3800 then.call( 3801 returned, 3802 resolve( maxDepth, deferred, Identity, special ), 3803 resolve( maxDepth, deferred, Thrower, special ) 3804 ); 3805 3806 // Normal processors (resolve) also hook into progress 3807 } else { 3808 3809 // ...and disregard older resolution values 3810 maxDepth++; 3811 3812 then.call( 3813 returned, 3814 resolve( maxDepth, deferred, Identity, special ), 3815 resolve( maxDepth, deferred, Thrower, special ), 3816 resolve( maxDepth, deferred, Identity, 3817 deferred.notifyWith ) 3818 ); 3819 } 3820 3821 // Handle all other returned values 3822 } else { 3823 3824 // Only substitute handlers pass on context 3825 // and multiple values (non-spec behavior) 3826 if ( handler !== Identity ) { 3827 that = undefined; 3828 args = [ returned ]; 3829 } 3830 3831 // Process the value(s) 3832 // Default process is resolve 3833 ( special || deferred.resolveWith )( that, args ); 3834 } 3835 }, 3836 3837 // Only normal processors (resolve) catch and reject exceptions 3838 process = special ? 3839 mightThrow : 3840 function() { 3841 try { 3842 mightThrow(); 3843 } catch ( e ) { 3844 3845 if ( jQuery.Deferred.exceptionHook ) { 3846 jQuery.Deferred.exceptionHook( e, 3847 process.stackTrace ); 3848 } 3849 3850 // Support: Promises/A+ section 2.3.3.3.4.1 3851 // https://promisesaplus.com/#point-61 3852 // Ignore post-resolution exceptions 3853 if ( depth + 1 >= maxDepth ) { 3854 3855 // Only substitute handlers pass on context 3856 // and multiple values (non-spec behavior) 3857 if ( handler !== Thrower ) { 3858 that = undefined; 3859 args = [ e ]; 3860 } 3861 3862 deferred.rejectWith( that, args ); 3863 } 3864 } 3865 }; 3866 3867 // Support: Promises/A+ section 2.3.3.3.1 3868 // https://promisesaplus.com/#point-57 3869 // Re-resolve promises immediately to dodge false rejection from 3870 // subsequent errors 3871 if ( depth ) { 3872 process(); 3873 } else { 3874 3875 // Call an optional hook to record the stack, in case of exception 3876 // since it's otherwise lost when execution goes async 3877 if ( jQuery.Deferred.getStackHook ) { 3878 process.stackTrace = jQuery.Deferred.getStackHook(); 3879 } 3880 window.setTimeout( process ); 3881 } 3882 }; 3883 } 3884 3885 return jQuery.Deferred( function( newDefer ) { 3886 3887 // progress_handlers.add( ... ) 3888 tuples[ 0 ][ 3 ].add( 3889 resolve( 3890 0, 3891 newDefer, 3892 isFunction( onProgress ) ? 3893 onProgress : 3894 Identity, 3895 newDefer.notifyWith 3896 ) 3897 ); 3898 3899 // fulfilled_handlers.add( ... ) 3900 tuples[ 1 ][ 3 ].add( 3901 resolve( 3902 0, 3903 newDefer, 3904 isFunction( onFulfilled ) ? 3905 onFulfilled : 3906 Identity 3907 ) 3908 ); 3909 3910 // rejected_handlers.add( ... ) 3911 tuples[ 2 ][ 3 ].add( 3912 resolve( 3913 0, 3914 newDefer, 3915 isFunction( onRejected ) ? 3916 onRejected : 3917 Thrower 3918 ) 3919 ); 3920 } ).promise(); 3921 }, 3922 3923 // Get a promise for this deferred 3924 // If obj is provided, the promise aspect is added to the object 3925 promise: function( obj ) { 3926 return obj != null ? jQuery.extend( obj, promise ) : promise; 3927 } 3928 }, 3929 deferred = {}; 3930 3931 // Add list-specific methods 3932 jQuery.each( tuples, function( i, tuple ) { 3933 var list = tuple[ 2 ], 3934 stateString = tuple[ 5 ]; 3935 3936 // promise.progress = list.add 3937 // promise.done = list.add 3938 // promise.fail = list.add 3939 promise[ tuple[ 1 ] ] = list.add; 3940 3941 // Handle state 3942 if ( stateString ) { 3943 list.add( 3944 function() { 3945 3946 // state = "resolved" (i.e., fulfilled) 3947 // state = "rejected" 3948 state = stateString; 3949 }, 3950 3951 // rejected_callbacks.disable 3952 // fulfilled_callbacks.disable 3953 tuples[ 3 - i ][ 2 ].disable, 3954 3955 // rejected_handlers.disable 3956 // fulfilled_handlers.disable 3957 tuples[ 3 - i ][ 3 ].disable, 3958 3959 // progress_callbacks.lock 3960 tuples[ 0 ][ 2 ].lock, 3961 3962 // progress_handlers.lock 3963 tuples[ 0 ][ 3 ].lock 3964 ); 3965 } 3966 3967 // progress_handlers.fire 3968 // fulfilled_handlers.fire 3969 // rejected_handlers.fire 3970 list.add( tuple[ 3 ].fire ); 3971 3972 // deferred.notify = function() { deferred.notifyWith(...) } 3973 // deferred.resolve = function() { deferred.resolveWith(...) } 3974 // deferred.reject = function() { deferred.rejectWith(...) } 3975 deferred[ tuple[ 0 ] ] = function() { 3976 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3977 return this; 3978 }; 3979 3980 // deferred.notifyWith = list.fireWith 3981 // deferred.resolveWith = list.fireWith 3982 // deferred.rejectWith = list.fireWith 3983 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3984 } ); 3985 3986 // Make the deferred a promise 3987 promise.promise( deferred ); 3988 3989 // Call given func if any 3990 if ( func ) { 3991 func.call( deferred, deferred ); 3992 } 3993 3994 // All done! 3995 return deferred; 3996 }, 3997 3998 // Deferred helper 3999 when: function( singleValue ) { 4000 var 4001 4002 // count of uncompleted subordinates 4003 remaining = arguments.length, 4004 4005 // count of unprocessed arguments 4006 i = remaining, 4007 4008 // subordinate fulfillment data 4009 resolveContexts = Array( i ), 4010 resolveValues = slice.call( arguments ), 4011 4012 // the primary Deferred 4013 primary = jQuery.Deferred(), 4014 4015 // subordinate callback factory 4016 updateFunc = function( i ) { 4017 return function( value ) { 4018 resolveContexts[ i ] = this; 4019 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 4020 if ( !( --remaining ) ) { 4021 primary.resolveWith( resolveContexts, resolveValues ); 4022 } 4023 }; 4024 }; 4025 4026 // Single- and empty arguments are adopted like Promise.resolve 4027 if ( remaining <= 1 ) { 4028 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 4029 !remaining ); 4030 4031 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4032 if ( primary.state() === "pending" || 4033 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 4034 4035 return primary.then(); 4036 } 4037 } 4038 4039 // Multiple arguments are aggregated like Promise.all array elements 4040 while ( i-- ) { 4041 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 4042 } 4043 4044 return primary.promise(); 4045 } 4046} ); 4047 4048 4049// These usually indicate a programmer mistake during development, 4050// warn about them ASAP rather than swallowing them by default. 4051var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4052 4053jQuery.Deferred.exceptionHook = function( error, stack ) { 4054 4055 // Support: IE 8 - 9 only 4056 // Console exists when dev tools are open, which can happen at any time 4057 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 4058 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 4059 } 4060}; 4061 4062 4063 4064 4065jQuery.readyException = function( error ) { 4066 window.setTimeout( function() { 4067 throw error; 4068 } ); 4069}; 4070 4071 4072 4073 4074// The deferred used on DOM ready 4075var readyList = jQuery.Deferred(); 4076 4077jQuery.fn.ready = function( fn ) { 4078 4079 readyList 4080 .then( fn ) 4081 4082 // Wrap jQuery.readyException in a function so that the lookup 4083 // happens at the time of error handling instead of callback 4084 // registration. 4085 .catch( function( error ) { 4086 jQuery.readyException( error ); 4087 } ); 4088 4089 return this; 4090}; 4091 4092jQuery.extend( { 4093 4094 // Is the DOM ready to be used? Set to true once it occurs. 4095 isReady: false, 4096 4097 // A counter to track how many items to wait for before 4098 // the ready event fires. See trac-6781 4099 readyWait: 1, 4100 4101 // Handle when the DOM is ready 4102 ready: function( wait ) { 4103 4104 // Abort if there are pending holds or we're already ready 4105 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 4106 return; 4107 } 4108 4109 // Remember that the DOM is ready 4110 jQuery.isReady = true; 4111 4112 // If a normal DOM Ready event fired, decrement, and wait if need be 4113 if ( wait !== true && --jQuery.readyWait > 0 ) { 4114 return; 4115 } 4116 4117 // If there are functions bound, to execute 4118 readyList.resolveWith( document, [ jQuery ] ); 4119 } 4120} ); 4121 4122jQuery.ready.then = readyList.then; 4123 4124// The ready event handler and self cleanup method 4125function completed() { 4126 document.removeEventListener( "DOMContentLoaded", completed ); 4127 window.removeEventListener( "load", completed ); 4128 jQuery.ready(); 4129} 4130 4131// Catch cases where $(document).ready() is called 4132// after the browser event has already occurred. 4133// Support: IE <=9 - 10 only 4134// Older IE sometimes signals "interactive" too soon 4135if ( document.readyState === "complete" || 4136 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 4137 4138 // Handle it asynchronously to allow scripts the opportunity to delay ready 4139 window.setTimeout( jQuery.ready ); 4140 4141} else { 4142 4143 // Use the handy event callback 4144 document.addEventListener( "DOMContentLoaded", completed ); 4145 4146 // A fallback to window.onload, that will always work 4147 window.addEventListener( "load", completed ); 4148} 4149 4150 4151 4152 4153// Multifunctional method to get and set values of a collection 4154// The value/s can optionally be executed if it's a function 4155var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4156 var i = 0, 4157 len = elems.length, 4158 bulk = key == null; 4159 4160 // Sets many values 4161 if ( toType( key ) === "object" ) { 4162 chainable = true; 4163 for ( i in key ) { 4164 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4165 } 4166 4167 // Sets one value 4168 } else if ( value !== undefined ) { 4169 chainable = true; 4170 4171 if ( !isFunction( value ) ) { 4172 raw = true; 4173 } 4174 4175 if ( bulk ) { 4176 4177 // Bulk operations run against the entire set 4178 if ( raw ) { 4179 fn.call( elems, value ); 4180 fn = null; 4181 4182 // ...except when executing function values 4183 } else { 4184 bulk = fn; 4185 fn = function( elem, _key, value ) { 4186 return bulk.call( jQuery( elem ), value ); 4187 }; 4188 } 4189 } 4190 4191 if ( fn ) { 4192 for ( ; i < len; i++ ) { 4193 fn( 4194 elems[ i ], key, raw ? 4195 value : 4196 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4197 ); 4198 } 4199 } 4200 } 4201 4202 if ( chainable ) { 4203 return elems; 4204 } 4205 4206 // Gets 4207 if ( bulk ) { 4208 return fn.call( elems ); 4209 } 4210 4211 return len ? fn( elems[ 0 ], key ) : emptyGet; 4212}; 4213 4214 4215// Matches dashed string for camelizing 4216var rmsPrefix = /^-ms-/, 4217 rdashAlpha = /-([a-z])/g; 4218 4219// Used by camelCase as callback to replace() 4220function fcamelCase( _all, letter ) { 4221 return letter.toUpperCase(); 4222} 4223 4224// Convert dashed to camelCase; used by the css and data modules 4225// Support: IE <=9 - 11, Edge 12 - 15 4226// Microsoft forgot to hump their vendor prefix (trac-9572) 4227function camelCase( string ) { 4228 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4229} 4230var acceptData = function( owner ) { 4231 4232 // Accepts only: 4233 // - Node 4234 // - Node.ELEMENT_NODE 4235 // - Node.DOCUMENT_NODE 4236 // - Object 4237 // - Any 4238 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4239}; 4240 4241 4242 4243 4244function Data() { 4245 this.expando = jQuery.expando + Data.uid++; 4246} 4247 4248Data.uid = 1; 4249 4250Data.prototype = { 4251 4252 cache: function( owner ) { 4253 4254 // Check if the owner object already has a cache 4255 var value = owner[ this.expando ]; 4256 4257 // If not, create one 4258 if ( !value ) { 4259 value = {}; 4260 4261 // We can accept data for non-element nodes in modern browsers, 4262 // but we should not, see trac-8335. 4263 // Always return an empty object. 4264 if ( acceptData( owner ) ) { 4265 4266 // If it is a node unlikely to be stringify-ed or looped over 4267 // use plain assignment 4268 if ( owner.nodeType ) { 4269 owner[ this.expando ] = value; 4270 4271 // Otherwise secure it in a non-enumerable property 4272 // configurable must be true to allow the property to be 4273 // deleted when data is removed 4274 } else { 4275 Object.defineProperty( owner, this.expando, { 4276 value: value, 4277 configurable: true 4278 } ); 4279 } 4280 } 4281 } 4282 4283 return value; 4284 }, 4285 set: function( owner, data, value ) { 4286 var prop, 4287 cache = this.cache( owner ); 4288 4289 // Handle: [ owner, key, value ] args 4290 // Always use camelCase key (gh-2257) 4291 if ( typeof data === "string" ) { 4292 cache[ camelCase( data ) ] = value; 4293 4294 // Handle: [ owner, { properties } ] args 4295 } else { 4296 4297 // Copy the properties one-by-one to the cache object 4298 for ( prop in data ) { 4299 cache[ camelCase( prop ) ] = data[ prop ]; 4300 } 4301 } 4302 return cache; 4303 }, 4304 get: function( owner, key ) { 4305 return key === undefined ? 4306 this.cache( owner ) : 4307 4308 // Always use camelCase key (gh-2257) 4309 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4310 }, 4311 access: function( owner, key, value ) { 4312 4313 // In cases where either: 4314 // 4315 // 1. No key was specified 4316 // 2. A string key was specified, but no value provided 4317 // 4318 // Take the "read" path and allow the get method to determine 4319 // which value to return, respectively either: 4320 // 4321 // 1. The entire cache object 4322 // 2. The data stored at the key 4323 // 4324 if ( key === undefined || 4325 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4326 4327 return this.get( owner, key ); 4328 } 4329 4330 // When the key is not a string, or both a key and value 4331 // are specified, set or extend (existing objects) with either: 4332 // 4333 // 1. An object of properties 4334 // 2. A key and value 4335 // 4336 this.set( owner, key, value ); 4337 4338 // Since the "set" path can have two possible entry points 4339 // return the expected data based on which path was taken[*] 4340 return value !== undefined ? value : key; 4341 }, 4342 remove: function( owner, key ) { 4343 var i, 4344 cache = owner[ this.expando ]; 4345 4346 if ( cache === undefined ) { 4347 return; 4348 } 4349 4350 if ( key !== undefined ) { 4351 4352 // Support array or space separated string of keys 4353 if ( Array.isArray( key ) ) { 4354 4355 // If key is an array of keys... 4356 // We always set camelCase keys, so remove that. 4357 key = key.map( camelCase ); 4358 } else { 4359 key = camelCase( key ); 4360 4361 // If a key with the spaces exists, use it. 4362 // Otherwise, create an array by matching non-whitespace 4363 key = key in cache ? 4364 [ key ] : 4365 ( key.match( rnothtmlwhite ) || [] ); 4366 } 4367 4368 i = key.length; 4369 4370 while ( i-- ) { 4371 delete cache[ key[ i ] ]; 4372 } 4373 } 4374 4375 // Remove the expando if there's no more data 4376 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4377 4378 // Support: Chrome <=35 - 45 4379 // Webkit & Blink performance suffers when deleting properties 4380 // from DOM nodes, so set to undefined instead 4381 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4382 if ( owner.nodeType ) { 4383 owner[ this.expando ] = undefined; 4384 } else { 4385 delete owner[ this.expando ]; 4386 } 4387 } 4388 }, 4389 hasData: function( owner ) { 4390 var cache = owner[ this.expando ]; 4391 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4392 } 4393}; 4394var dataPriv = new Data(); 4395 4396var dataUser = new Data(); 4397 4398 4399 4400// Implementation Summary 4401// 4402// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4403// 2. Improve the module's maintainability by reducing the storage 4404// paths to a single mechanism. 4405// 3. Use the same single mechanism to support "private" and "user" data. 4406// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4407// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4408// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4409 4410var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4411 rmultiDash = /[A-Z]/g; 4412 4413function getData( data ) { 4414 if ( data === "true" ) { 4415 return true; 4416 } 4417 4418 if ( data === "false" ) { 4419 return false; 4420 } 4421 4422 if ( data === "null" ) { 4423 return null; 4424 } 4425 4426 // Only convert to a number if it doesn't change the string 4427 if ( data === +data + "" ) { 4428 return +data; 4429 } 4430 4431 if ( rbrace.test( data ) ) { 4432 return JSON.parse( data ); 4433 } 4434 4435 return data; 4436} 4437 4438function dataAttr( elem, key, data ) { 4439 var name; 4440 4441 // If nothing was found internally, try to fetch any 4442 // data from the HTML5 data-* attribute 4443 if ( data === undefined && elem.nodeType === 1 ) { 4444 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4445 data = elem.getAttribute( name ); 4446 4447 if ( typeof data === "string" ) { 4448 try { 4449 data = getData( data ); 4450 } catch ( e ) {} 4451 4452 // Make sure we set the data so it isn't changed later 4453 dataUser.set( elem, key, data ); 4454 } else { 4455 data = undefined; 4456 } 4457 } 4458 return data; 4459} 4460 4461jQuery.extend( { 4462 hasData: function( elem ) { 4463 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4464 }, 4465 4466 data: function( elem, name, data ) { 4467 return dataUser.access( elem, name, data ); 4468 }, 4469 4470 removeData: function( elem, name ) { 4471 dataUser.remove( elem, name ); 4472 }, 4473 4474 // TODO: Now that all calls to _data and _removeData have been replaced 4475 // with direct calls to dataPriv methods, these can be deprecated. 4476 _data: function( elem, name, data ) { 4477 return dataPriv.access( elem, name, data ); 4478 }, 4479 4480 _removeData: function( elem, name ) { 4481 dataPriv.remove( elem, name ); 4482 } 4483} ); 4484 4485jQuery.fn.extend( { 4486 data: function( key, value ) { 4487 var i, name, data, 4488 elem = this[ 0 ], 4489 attrs = elem && elem.attributes; 4490 4491 // Gets all values 4492 if ( key === undefined ) { 4493 if ( this.length ) { 4494 data = dataUser.get( elem ); 4495 4496 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4497 i = attrs.length; 4498 while ( i-- ) { 4499 4500 // Support: IE 11 only 4501 // The attrs elements can be null (trac-14894) 4502 if ( attrs[ i ] ) { 4503 name = attrs[ i ].name; 4504 if ( name.indexOf( "data-" ) === 0 ) { 4505 name = camelCase( name.slice( 5 ) ); 4506 dataAttr( elem, name, data[ name ] ); 4507 } 4508 } 4509 } 4510 dataPriv.set( elem, "hasDataAttrs", true ); 4511 } 4512 } 4513 4514 return data; 4515 } 4516 4517 // Sets multiple values 4518 if ( typeof key === "object" ) { 4519 return this.each( function() { 4520 dataUser.set( this, key ); 4521 } ); 4522 } 4523 4524 return access( this, function( value ) { 4525 var data; 4526 4527 // The calling jQuery object (element matches) is not empty 4528 // (and therefore has an element appears at this[ 0 ]) and the 4529 // `value` parameter was not undefined. An empty jQuery object 4530 // will result in `undefined` for elem = this[ 0 ] which will 4531 // throw an exception if an attempt to read a data cache is made. 4532 if ( elem && value === undefined ) { 4533 4534 // Attempt to get data from the cache 4535 // The key will always be camelCased in Data 4536 data = dataUser.get( elem, key ); 4537 if ( data !== undefined ) { 4538 return data; 4539 } 4540 4541 // Attempt to "discover" the data in 4542 // HTML5 custom data-* attrs 4543 data = dataAttr( elem, key ); 4544 if ( data !== undefined ) { 4545 return data; 4546 } 4547 4548 // We tried really hard, but the data doesn't exist. 4549 return; 4550 } 4551 4552 // Set the data... 4553 this.each( function() { 4554 4555 // We always store the camelCased key 4556 dataUser.set( this, key, value ); 4557 } ); 4558 }, null, value, arguments.length > 1, null, true ); 4559 }, 4560 4561 removeData: function( key ) { 4562 return this.each( function() { 4563 dataUser.remove( this, key ); 4564 } ); 4565 } 4566} ); 4567 4568 4569jQuery.extend( { 4570 queue: function( elem, type, data ) { 4571 var queue; 4572 4573 if ( elem ) { 4574 type = ( type || "fx" ) + "queue"; 4575 queue = dataPriv.get( elem, type ); 4576 4577 // Speed up dequeue by getting out quickly if this is just a lookup 4578 if ( data ) { 4579 if ( !queue || Array.isArray( data ) ) { 4580 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4581 } else { 4582 queue.push( data ); 4583 } 4584 } 4585 return queue || []; 4586 } 4587 }, 4588 4589 dequeue: function( elem, type ) { 4590 type = type || "fx"; 4591 4592 var queue = jQuery.queue( elem, type ), 4593 startLength = queue.length, 4594 fn = queue.shift(), 4595 hooks = jQuery._queueHooks( elem, type ), 4596 next = function() { 4597 jQuery.dequeue( elem, type ); 4598 }; 4599 4600 // If the fx queue is dequeued, always remove the progress sentinel 4601 if ( fn === "inprogress" ) { 4602 fn = queue.shift(); 4603 startLength--; 4604 } 4605 4606 if ( fn ) { 4607 4608 // Add a progress sentinel to prevent the fx queue from being 4609 // automatically dequeued 4610 if ( type === "fx" ) { 4611 queue.unshift( "inprogress" ); 4612 } 4613 4614 // Clear up the last queue stop function 4615 delete hooks.stop; 4616 fn.call( elem, next, hooks ); 4617 } 4618 4619 if ( !startLength && hooks ) { 4620 hooks.empty.fire(); 4621 } 4622 }, 4623 4624 // Not public - generate a queueHooks object, or return the current one 4625 _queueHooks: function( elem, type ) { 4626 var key = type + "queueHooks"; 4627 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4628 empty: jQuery.Callbacks( "once memory" ).add( function() { 4629 dataPriv.remove( elem, [ type + "queue", key ] ); 4630 } ) 4631 } ); 4632 } 4633} ); 4634 4635jQuery.fn.extend( { 4636 queue: function( type, data ) { 4637 var setter = 2; 4638 4639 if ( typeof type !== "string" ) { 4640 data = type; 4641 type = "fx"; 4642 setter--; 4643 } 4644 4645 if ( arguments.length < setter ) { 4646 return jQuery.queue( this[ 0 ], type ); 4647 } 4648 4649 return data === undefined ? 4650 this : 4651 this.each( function() { 4652 var queue = jQuery.queue( this, type, data ); 4653 4654 // Ensure a hooks for this queue 4655 jQuery._queueHooks( this, type ); 4656 4657 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4658 jQuery.dequeue( this, type ); 4659 } 4660 } ); 4661 }, 4662 dequeue: function( type ) { 4663 return this.each( function() { 4664 jQuery.dequeue( this, type ); 4665 } ); 4666 }, 4667 clearQueue: function( type ) { 4668 return this.queue( type || "fx", [] ); 4669 }, 4670 4671 // Get a promise resolved when queues of a certain type 4672 // are emptied (fx is the type by default) 4673 promise: function( type, obj ) { 4674 var tmp, 4675 count = 1, 4676 defer = jQuery.Deferred(), 4677 elements = this, 4678 i = this.length, 4679 resolve = function() { 4680 if ( !( --count ) ) { 4681 defer.resolveWith( elements, [ elements ] ); 4682 } 4683 }; 4684 4685 if ( typeof type !== "string" ) { 4686 obj = type; 4687 type = undefined; 4688 } 4689 type = type || "fx"; 4690 4691 while ( i-- ) { 4692 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4693 if ( tmp && tmp.empty ) { 4694 count++; 4695 tmp.empty.add( resolve ); 4696 } 4697 } 4698 resolve(); 4699 return defer.promise( obj ); 4700 } 4701} ); 4702var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4703 4704var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4705 4706 4707var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4708 4709var documentElement = document.documentElement; 4710 4711 4712 4713 var isAttached = function( elem ) { 4714 return jQuery.contains( elem.ownerDocument, elem ); 4715 }, 4716 composed = { composed: true }; 4717 4718 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4719 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4720 // Support: iOS 10.0-10.2 only 4721 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4722 // leading to errors. We need to check for `getRootNode`. 4723 if ( documentElement.getRootNode ) { 4724 isAttached = function( elem ) { 4725 return jQuery.contains( elem.ownerDocument, elem ) || 4726 elem.getRootNode( composed ) === elem.ownerDocument; 4727 }; 4728 } 4729var isHiddenWithinTree = function( elem, el ) { 4730 4731 // isHiddenWithinTree might be called from jQuery#filter function; 4732 // in that case, element will be second argument 4733 elem = el || elem; 4734 4735 // Inline style trumps all 4736 return elem.style.display === "none" || 4737 elem.style.display === "" && 4738 4739 // Otherwise, check computed style 4740 // Support: Firefox <=43 - 45 4741 // Disconnected elements can have computed display: none, so first confirm that elem is 4742 // in the document. 4743 isAttached( elem ) && 4744 4745 jQuery.css( elem, "display" ) === "none"; 4746 }; 4747 4748 4749 4750function adjustCSS( elem, prop, valueParts, tween ) { 4751 var adjusted, scale, 4752 maxIterations = 20, 4753 currentValue = tween ? 4754 function() { 4755 return tween.cur(); 4756 } : 4757 function() { 4758 return jQuery.css( elem, prop, "" ); 4759 }, 4760 initial = currentValue(), 4761 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4762 4763 // Starting value computation is required for potential unit mismatches 4764 initialInUnit = elem.nodeType && 4765 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4766 rcssNum.exec( jQuery.css( elem, prop ) ); 4767 4768 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4769 4770 // Support: Firefox <=54 4771 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4772 initial = initial / 2; 4773 4774 // Trust units reported by jQuery.css 4775 unit = unit || initialInUnit[ 3 ]; 4776 4777 // Iteratively approximate from a nonzero starting point 4778 initialInUnit = +initial || 1; 4779 4780 while ( maxIterations-- ) { 4781 4782 // Evaluate and update our best guess (doubling guesses that zero out). 4783 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4784 jQuery.style( elem, prop, initialInUnit + unit ); 4785 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4786 maxIterations = 0; 4787 } 4788 initialInUnit = initialInUnit / scale; 4789 4790 } 4791 4792 initialInUnit = initialInUnit * 2; 4793 jQuery.style( elem, prop, initialInUnit + unit ); 4794 4795 // Make sure we update the tween properties later on 4796 valueParts = valueParts || []; 4797 } 4798 4799 if ( valueParts ) { 4800 initialInUnit = +initialInUnit || +initial || 0; 4801 4802 // Apply relative offset (+=/-=) if specified 4803 adjusted = valueParts[ 1 ] ? 4804 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4805 +valueParts[ 2 ]; 4806 if ( tween ) { 4807 tween.unit = unit; 4808 tween.start = initialInUnit; 4809 tween.end = adjusted; 4810 } 4811 } 4812 return adjusted; 4813} 4814 4815 4816var defaultDisplayMap = {}; 4817 4818function getDefaultDisplay( elem ) { 4819 var temp, 4820 doc = elem.ownerDocument, 4821 nodeName = elem.nodeName, 4822 display = defaultDisplayMap[ nodeName ]; 4823 4824 if ( display ) { 4825 return display; 4826 } 4827 4828 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4829 display = jQuery.css( temp, "display" ); 4830 4831 temp.parentNode.removeChild( temp ); 4832 4833 if ( display === "none" ) { 4834 display = "block"; 4835 } 4836 defaultDisplayMap[ nodeName ] = display; 4837 4838 return display; 4839} 4840 4841function showHide( elements, show ) { 4842 var display, elem, 4843 values = [], 4844 index = 0, 4845 length = elements.length; 4846 4847 // Determine new display value for elements that need to change 4848 for ( ; index < length; index++ ) { 4849 elem = elements[ index ]; 4850 if ( !elem.style ) { 4851 continue; 4852 } 4853 4854 display = elem.style.display; 4855 if ( show ) { 4856 4857 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4858 // check is required in this first loop unless we have a nonempty display value (either 4859 // inline or about-to-be-restored) 4860 if ( display === "none" ) { 4861 values[ index ] = dataPriv.get( elem, "display" ) || null; 4862 if ( !values[ index ] ) { 4863 elem.style.display = ""; 4864 } 4865 } 4866 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4867 values[ index ] = getDefaultDisplay( elem ); 4868 } 4869 } else { 4870 if ( display !== "none" ) { 4871 values[ index ] = "none"; 4872 4873 // Remember what we're overwriting 4874 dataPriv.set( elem, "display", display ); 4875 } 4876 } 4877 } 4878 4879 // Set the display of the elements in a second loop to avoid constant reflow 4880 for ( index = 0; index < length; index++ ) { 4881 if ( values[ index ] != null ) { 4882 elements[ index ].style.display = values[ index ]; 4883 } 4884 } 4885 4886 return elements; 4887} 4888 4889jQuery.fn.extend( { 4890 show: function() { 4891 return showHide( this, true ); 4892 }, 4893 hide: function() { 4894 return showHide( this ); 4895 }, 4896 toggle: function( state ) { 4897 if ( typeof state === "boolean" ) { 4898 return state ? this.show() : this.hide(); 4899 } 4900 4901 return this.each( function() { 4902 if ( isHiddenWithinTree( this ) ) { 4903 jQuery( this ).show(); 4904 } else { 4905 jQuery( this ).hide(); 4906 } 4907 } ); 4908 } 4909} ); 4910var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4911 4912var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4913 4914var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4915 4916 4917 4918( function() { 4919 var fragment = document.createDocumentFragment(), 4920 div = fragment.appendChild( document.createElement( "div" ) ), 4921 input = document.createElement( "input" ); 4922 4923 // Support: Android 4.0 - 4.3 only 4924 // Check state lost if the name is set (trac-11217) 4925 // Support: Windows Web Apps (WWA) 4926 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4927 input.setAttribute( "type", "radio" ); 4928 input.setAttribute( "checked", "checked" ); 4929 input.setAttribute( "name", "t" ); 4930 4931 div.appendChild( input ); 4932 4933 // Support: Android <=4.1 only 4934 // Older WebKit doesn't clone checked state correctly in fragments 4935 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4936 4937 // Support: IE <=11 only 4938 // Make sure textarea (and checkbox) defaultValue is properly cloned 4939 div.innerHTML = "<textarea>x</textarea>"; 4940 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4941 4942 // Support: IE <=9 only 4943 // IE <=9 replaces <option> tags with their contents when inserted outside of 4944 // the select element. 4945 div.innerHTML = "<option></option>"; 4946 support.option = !!div.lastChild; 4947} )(); 4948 4949 4950// We have to close these tags to support XHTML (trac-13200) 4951var wrapMap = { 4952 4953 // XHTML parsers do not magically insert elements in the 4954 // same way that tag soup parsers do. So we cannot shorten 4955 // this by omitting <tbody> or other required elements. 4956 thead: [ 1, "<table>", "</table>" ], 4957 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4958 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4959 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4960 4961 _default: [ 0, "", "" ] 4962}; 4963 4964wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4965wrapMap.th = wrapMap.td; 4966 4967// Support: IE <=9 only 4968if ( !support.option ) { 4969 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4970} 4971 4972 4973function getAll( context, tag ) { 4974 4975 // Support: IE <=9 - 11 only 4976 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4977 var ret; 4978 4979 if ( typeof context.getElementsByTagName !== "undefined" ) { 4980 ret = context.getElementsByTagName( tag || "*" ); 4981 4982 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4983 ret = context.querySelectorAll( tag || "*" ); 4984 4985 } else { 4986 ret = []; 4987 } 4988 4989 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4990 return jQuery.merge( [ context ], ret ); 4991 } 4992 4993 return ret; 4994} 4995 4996 4997// Mark scripts as having already been evaluated 4998function setGlobalEval( elems, refElements ) { 4999 var i = 0, 5000 l = elems.length; 5001 5002 for ( ; i < l; i++ ) { 5003 dataPriv.set( 5004 elems[ i ], 5005 "globalEval", 5006 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 5007 ); 5008 } 5009} 5010 5011 5012var rhtml = /<|&#?\w+;/; 5013 5014function buildFragment( elems, context, scripts, selection, ignored ) { 5015 var elem, tmp, tag, wrap, attached, j, 5016 fragment = context.createDocumentFragment(), 5017 nodes = [], 5018 i = 0, 5019 l = elems.length; 5020 5021 for ( ; i < l; i++ ) { 5022 elem = elems[ i ]; 5023 5024 if ( elem || elem === 0 ) { 5025 5026 // Add nodes directly 5027 if ( toType( elem ) === "object" ) { 5028 5029 // Support: Android <=4.0 only, PhantomJS 1 only 5030 // push.apply(_, arraylike) throws on ancient WebKit 5031 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5032 5033 // Convert non-html into a text node 5034 } else if ( !rhtml.test( elem ) ) { 5035 nodes.push( context.createTextNode( elem ) ); 5036 5037 // Convert html into DOM nodes 5038 } else { 5039 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 5040 5041 // Deserialize a standard representation 5042 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 5043 wrap = wrapMap[ tag ] || wrapMap._default; 5044 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 5045 5046 // Descend through wrappers to the right content 5047 j = wrap[ 0 ]; 5048 while ( j-- ) { 5049 tmp = tmp.lastChild; 5050 } 5051 5052 // Support: Android <=4.0 only, PhantomJS 1 only 5053 // push.apply(_, arraylike) throws on ancient WebKit 5054 jQuery.merge( nodes, tmp.childNodes ); 5055 5056 // Remember the top-level container 5057 tmp = fragment.firstChild; 5058 5059 // Ensure the created nodes are orphaned (trac-12392) 5060 tmp.textContent = ""; 5061 } 5062 } 5063 } 5064 5065 // Remove wrapper from fragment 5066 fragment.textContent = ""; 5067 5068 i = 0; 5069 while ( ( elem = nodes[ i++ ] ) ) { 5070 5071 // Skip elements already in the context collection (trac-4087) 5072 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 5073 if ( ignored ) { 5074 ignored.push( elem ); 5075 } 5076 continue; 5077 } 5078 5079 attached = isAttached( elem ); 5080 5081 // Append to fragment 5082 tmp = getAll( fragment.appendChild( elem ), "script" ); 5083 5084 // Preserve script evaluation history 5085 if ( attached ) { 5086 setGlobalEval( tmp ); 5087 } 5088 5089 // Capture executables 5090 if ( scripts ) { 5091 j = 0; 5092 while ( ( elem = tmp[ j++ ] ) ) { 5093 if ( rscriptType.test( elem.type || "" ) ) { 5094 scripts.push( elem ); 5095 } 5096 } 5097 } 5098 } 5099 5100 return fragment; 5101} 5102 5103 5104var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5105 5106function returnTrue() { 5107 return true; 5108} 5109 5110function returnFalse() { 5111 return false; 5112} 5113 5114// Support: IE <=9 - 11+ 5115// focus() and blur() are asynchronous, except when they are no-op. 5116// So expect focus to be synchronous when the element is already active, 5117// and blur to be synchronous when the element is not already active. 5118// (focus and blur are always synchronous in other supported browsers, 5119// this just defines when we can count on it). 5120function expectSync( elem, type ) { 5121 return ( elem === safeActiveElement() ) === ( type === "focus" ); 5122} 5123 5124// Support: IE <=9 only 5125// Accessing document.activeElement can throw unexpectedly 5126// https://bugs.jquery.com/ticket/13393 5127function safeActiveElement() { 5128 try { 5129 return document.activeElement; 5130 } catch ( err ) { } 5131} 5132 5133function on( elem, types, selector, data, fn, one ) { 5134 var origFn, type; 5135 5136 // Types can be a map of types/handlers 5137 if ( typeof types === "object" ) { 5138 5139 // ( types-Object, selector, data ) 5140 if ( typeof selector !== "string" ) { 5141 5142 // ( types-Object, data ) 5143 data = data || selector; 5144 selector = undefined; 5145 } 5146 for ( type in types ) { 5147 on( elem, type, selector, data, types[ type ], one ); 5148 } 5149 return elem; 5150 } 5151 5152 if ( data == null && fn == null ) { 5153 5154 // ( types, fn ) 5155 fn = selector; 5156 data = selector = undefined; 5157 } else if ( fn == null ) { 5158 if ( typeof selector === "string" ) { 5159 5160 // ( types, selector, fn ) 5161 fn = data; 5162 data = undefined; 5163 } else { 5164 5165 // ( types, data, fn ) 5166 fn = data; 5167 data = selector; 5168 selector = undefined; 5169 } 5170 } 5171 if ( fn === false ) { 5172 fn = returnFalse; 5173 } else if ( !fn ) { 5174 return elem; 5175 } 5176 5177 if ( one === 1 ) { 5178 origFn = fn; 5179 fn = function( event ) { 5180 5181 // Can use an empty set, since event contains the info 5182 jQuery().off( event ); 5183 return origFn.apply( this, arguments ); 5184 }; 5185 5186 // Use same guid so caller can remove using origFn 5187 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5188 } 5189 return elem.each( function() { 5190 jQuery.event.add( this, types, fn, data, selector ); 5191 } ); 5192} 5193 5194/* 5195 * Helper functions for managing events -- not part of the public interface. 5196 * Props to Dean Edwards' addEvent library for many of the ideas. 5197 */ 5198jQuery.event = { 5199 5200 global: {}, 5201 5202 add: function( elem, types, handler, data, selector ) { 5203 5204 var handleObjIn, eventHandle, tmp, 5205 events, t, handleObj, 5206 special, handlers, type, namespaces, origType, 5207 elemData = dataPriv.get( elem ); 5208 5209 // Only attach events to objects that accept data 5210 if ( !acceptData( elem ) ) { 5211 return; 5212 } 5213 5214 // Caller can pass in an object of custom data in lieu of the handler 5215 if ( handler.handler ) { 5216 handleObjIn = handler; 5217 handler = handleObjIn.handler; 5218 selector = handleObjIn.selector; 5219 } 5220 5221 // Ensure that invalid selectors throw exceptions at attach time 5222 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5223 if ( selector ) { 5224 jQuery.find.matchesSelector( documentElement, selector ); 5225 } 5226 5227 // Make sure that the handler has a unique ID, used to find/remove it later 5228 if ( !handler.guid ) { 5229 handler.guid = jQuery.guid++; 5230 } 5231 5232 // Init the element's event structure and main handler, if this is the first 5233 if ( !( events = elemData.events ) ) { 5234 events = elemData.events = Object.create( null ); 5235 } 5236 if ( !( eventHandle = elemData.handle ) ) { 5237 eventHandle = elemData.handle = function( e ) { 5238 5239 // Discard the second event of a jQuery.event.trigger() and 5240 // when an event is called after a page has unloaded 5241 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5242 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5243 }; 5244 } 5245 5246 // Handle multiple events separated by a space 5247 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5248 t = types.length; 5249 while ( t-- ) { 5250 tmp = rtypenamespace.exec( types[ t ] ) || []; 5251 type = origType = tmp[ 1 ]; 5252 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5253 5254 // There *must* be a type, no attaching namespace-only handlers 5255 if ( !type ) { 5256 continue; 5257 } 5258 5259 // If event changes its type, use the special event handlers for the changed type 5260 special = jQuery.event.special[ type ] || {}; 5261 5262 // If selector defined, determine special event api type, otherwise given type 5263 type = ( selector ? special.delegateType : special.bindType ) || type; 5264 5265 // Update special based on newly reset type 5266 special = jQuery.event.special[ type ] || {}; 5267 5268 // handleObj is passed to all event handlers 5269 handleObj = jQuery.extend( { 5270 type: type, 5271 origType: origType, 5272 data: data, 5273 handler: handler, 5274 guid: handler.guid, 5275 selector: selector, 5276 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5277 namespace: namespaces.join( "." ) 5278 }, handleObjIn ); 5279 5280 // Init the event handler queue if we're the first 5281 if ( !( handlers = events[ type ] ) ) { 5282 handlers = events[ type ] = []; 5283 handlers.delegateCount = 0; 5284 5285 // Only use addEventListener if the special events handler returns false 5286 if ( !special.setup || 5287 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5288 5289 if ( elem.addEventListener ) { 5290 elem.addEventListener( type, eventHandle ); 5291 } 5292 } 5293 } 5294 5295 if ( special.add ) { 5296 special.add.call( elem, handleObj ); 5297 5298 if ( !handleObj.handler.guid ) { 5299 handleObj.handler.guid = handler.guid; 5300 } 5301 } 5302 5303 // Add to the element's handler list, delegates in front 5304 if ( selector ) { 5305 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5306 } else { 5307 handlers.push( handleObj ); 5308 } 5309 5310 // Keep track of which events have ever been used, for event optimization 5311 jQuery.event.global[ type ] = true; 5312 } 5313 5314 }, 5315 5316 // Detach an event or set of events from an element 5317 remove: function( elem, types, handler, selector, mappedTypes ) { 5318 5319 var j, origCount, tmp, 5320 events, t, handleObj, 5321 special, handlers, type, namespaces, origType, 5322 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5323 5324 if ( !elemData || !( events = elemData.events ) ) { 5325 return; 5326 } 5327 5328 // Once for each type.namespace in types; type may be omitted 5329 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5330 t = types.length; 5331 while ( t-- ) { 5332 tmp = rtypenamespace.exec( types[ t ] ) || []; 5333 type = origType = tmp[ 1 ]; 5334 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5335 5336 // Unbind all events (on this namespace, if provided) for the element 5337 if ( !type ) { 5338 for ( type in events ) { 5339 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5340 } 5341 continue; 5342 } 5343 5344 special = jQuery.event.special[ type ] || {}; 5345 type = ( selector ? special.delegateType : special.bindType ) || type; 5346 handlers = events[ type ] || []; 5347 tmp = tmp[ 2 ] && 5348 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5349 5350 // Remove matching events 5351 origCount = j = handlers.length; 5352 while ( j-- ) { 5353 handleObj = handlers[ j ]; 5354 5355 if ( ( mappedTypes || origType === handleObj.origType ) && 5356 ( !handler || handler.guid === handleObj.guid ) && 5357 ( !tmp || tmp.test( handleObj.namespace ) ) && 5358 ( !selector || selector === handleObj.selector || 5359 selector === "**" && handleObj.selector ) ) { 5360 handlers.splice( j, 1 ); 5361 5362 if ( handleObj.selector ) { 5363 handlers.delegateCount--; 5364 } 5365 if ( special.remove ) { 5366 special.remove.call( elem, handleObj ); 5367 } 5368 } 5369 } 5370 5371 // Remove generic event handler if we removed something and no more handlers exist 5372 // (avoids potential for endless recursion during removal of special event handlers) 5373 if ( origCount && !handlers.length ) { 5374 if ( !special.teardown || 5375 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5376 5377 jQuery.removeEvent( elem, type, elemData.handle ); 5378 } 5379 5380 delete events[ type ]; 5381 } 5382 } 5383 5384 // Remove data and the expando if it's no longer used 5385 if ( jQuery.isEmptyObject( events ) ) { 5386 dataPriv.remove( elem, "handle events" ); 5387 } 5388 }, 5389 5390 dispatch: function( nativeEvent ) { 5391 5392 var i, j, ret, matched, handleObj, handlerQueue, 5393 args = new Array( arguments.length ), 5394 5395 // Make a writable jQuery.Event from the native event object 5396 event = jQuery.event.fix( nativeEvent ), 5397 5398 handlers = ( 5399 dataPriv.get( this, "events" ) || Object.create( null ) 5400 )[ event.type ] || [], 5401 special = jQuery.event.special[ event.type ] || {}; 5402 5403 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5404 args[ 0 ] = event; 5405 5406 for ( i = 1; i < arguments.length; i++ ) { 5407 args[ i ] = arguments[ i ]; 5408 } 5409 5410 event.delegateTarget = this; 5411 5412 // Call the preDispatch hook for the mapped type, and let it bail if desired 5413 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5414 return; 5415 } 5416 5417 // Determine handlers 5418 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5419 5420 // Run delegates first; they may want to stop propagation beneath us 5421 i = 0; 5422 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5423 event.currentTarget = matched.elem; 5424 5425 j = 0; 5426 while ( ( handleObj = matched.handlers[ j++ ] ) && 5427 !event.isImmediatePropagationStopped() ) { 5428 5429 // If the event is namespaced, then each handler is only invoked if it is 5430 // specially universal or its namespaces are a superset of the event's. 5431 if ( !event.rnamespace || handleObj.namespace === false || 5432 event.rnamespace.test( handleObj.namespace ) ) { 5433 5434 event.handleObj = handleObj; 5435 event.data = handleObj.data; 5436 5437 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5438 handleObj.handler ).apply( matched.elem, args ); 5439 5440 if ( ret !== undefined ) { 5441 if ( ( event.result = ret ) === false ) { 5442 event.preventDefault(); 5443 event.stopPropagation(); 5444 } 5445 } 5446 } 5447 } 5448 } 5449 5450 // Call the postDispatch hook for the mapped type 5451 if ( special.postDispatch ) { 5452 special.postDispatch.call( this, event ); 5453 } 5454 5455 return event.result; 5456 }, 5457 5458 handlers: function( event, handlers ) { 5459 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5460 handlerQueue = [], 5461 delegateCount = handlers.delegateCount, 5462 cur = event.target; 5463 5464 // Find delegate handlers 5465 if ( delegateCount && 5466 5467 // Support: IE <=9 5468 // Black-hole SVG <use> instance trees (trac-13180) 5469 cur.nodeType && 5470 5471 // Support: Firefox <=42 5472 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5473 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5474 // Support: IE 11 only 5475 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5476 !( event.type === "click" && event.button >= 1 ) ) { 5477 5478 for ( ; cur !== this; cur = cur.parentNode || this ) { 5479 5480 // Don't check non-elements (trac-13208) 5481 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5482 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5483 matchedHandlers = []; 5484 matchedSelectors = {}; 5485 for ( i = 0; i < delegateCount; i++ ) { 5486 handleObj = handlers[ i ]; 5487 5488 // Don't conflict with Object.prototype properties (trac-13203) 5489 sel = handleObj.selector + " "; 5490 5491 if ( matchedSelectors[ sel ] === undefined ) { 5492 matchedSelectors[ sel ] = handleObj.needsContext ? 5493 jQuery( sel, this ).index( cur ) > -1 : 5494 jQuery.find( sel, this, null, [ cur ] ).length; 5495 } 5496 if ( matchedSelectors[ sel ] ) { 5497 matchedHandlers.push( handleObj ); 5498 } 5499 } 5500 if ( matchedHandlers.length ) { 5501 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5502 } 5503 } 5504 } 5505 } 5506 5507 // Add the remaining (directly-bound) handlers 5508 cur = this; 5509 if ( delegateCount < handlers.length ) { 5510 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5511 } 5512 5513 return handlerQueue; 5514 }, 5515 5516 addProp: function( name, hook ) { 5517 Object.defineProperty( jQuery.Event.prototype, name, { 5518 enumerable: true, 5519 configurable: true, 5520 5521 get: isFunction( hook ) ? 5522 function() { 5523 if ( this.originalEvent ) { 5524 return hook( this.originalEvent ); 5525 } 5526 } : 5527 function() { 5528 if ( this.originalEvent ) { 5529 return this.originalEvent[ name ]; 5530 } 5531 }, 5532 5533 set: function( value ) { 5534 Object.defineProperty( this, name, { 5535 enumerable: true, 5536 configurable: true, 5537 writable: true, 5538 value: value 5539 } ); 5540 } 5541 } ); 5542 }, 5543 5544 fix: function( originalEvent ) { 5545 return originalEvent[ jQuery.expando ] ? 5546 originalEvent : 5547 new jQuery.Event( originalEvent ); 5548 }, 5549 5550 special: { 5551 load: { 5552 5553 // Prevent triggered image.load events from bubbling to window.load 5554 noBubble: true 5555 }, 5556 click: { 5557 5558 // Utilize native event to ensure correct state for checkable inputs 5559 setup: function( data ) { 5560 5561 // For mutual compressibility with _default, replace `this` access with a local var. 5562 // `|| data` is dead code meant only to preserve the variable through minification. 5563 var el = this || data; 5564 5565 // Claim the first handler 5566 if ( rcheckableType.test( el.type ) && 5567 el.click && nodeName( el, "input" ) ) { 5568 5569 // dataPriv.set( el, "click", ... ) 5570 leverageNative( el, "click", returnTrue ); 5571 } 5572 5573 // Return false to allow normal processing in the caller 5574 return false; 5575 }, 5576 trigger: function( data ) { 5577 5578 // For mutual compressibility with _default, replace `this` access with a local var. 5579 // `|| data` is dead code meant only to preserve the variable through minification. 5580 var el = this || data; 5581 5582 // Force setup before triggering a click 5583 if ( rcheckableType.test( el.type ) && 5584 el.click && nodeName( el, "input" ) ) { 5585 5586 leverageNative( el, "click" ); 5587 } 5588 5589 // Return non-false to allow normal event-path propagation 5590 return true; 5591 }, 5592 5593 // For cross-browser consistency, suppress native .click() on links 5594 // Also prevent it if we're currently inside a leveraged native-event stack 5595 _default: function( event ) { 5596 var target = event.target; 5597 return rcheckableType.test( target.type ) && 5598 target.click && nodeName( target, "input" ) && 5599 dataPriv.get( target, "click" ) || 5600 nodeName( target, "a" ); 5601 } 5602 }, 5603 5604 beforeunload: { 5605 postDispatch: function( event ) { 5606 5607 // Support: Firefox 20+ 5608 // Firefox doesn't alert if the returnValue field is not set. 5609 if ( event.result !== undefined && event.originalEvent ) { 5610 event.originalEvent.returnValue = event.result; 5611 } 5612 } 5613 } 5614 } 5615}; 5616 5617// Ensure the presence of an event listener that handles manually-triggered 5618// synthetic events by interrupting progress until reinvoked in response to 5619// *native* events that it fires directly, ensuring that state changes have 5620// already occurred before other listeners are invoked. 5621function leverageNative( el, type, expectSync ) { 5622 5623 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5624 if ( !expectSync ) { 5625 if ( dataPriv.get( el, type ) === undefined ) { 5626 jQuery.event.add( el, type, returnTrue ); 5627 } 5628 return; 5629 } 5630 5631 // Register the controller as a special universal handler for all event namespaces 5632 dataPriv.set( el, type, false ); 5633 jQuery.event.add( el, type, { 5634 namespace: false, 5635 handler: function( event ) { 5636 var notAsync, result, 5637 saved = dataPriv.get( this, type ); 5638 5639 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5640 5641 // Interrupt processing of the outer synthetic .trigger()ed event 5642 // Saved data should be false in such cases, but might be a leftover capture object 5643 // from an async native handler (gh-4350) 5644 if ( !saved.length ) { 5645 5646 // Store arguments for use when handling the inner native event 5647 // There will always be at least one argument (an event object), so this array 5648 // will not be confused with a leftover capture object. 5649 saved = slice.call( arguments ); 5650 dataPriv.set( this, type, saved ); 5651 5652 // Trigger the native event and capture its result 5653 // Support: IE <=9 - 11+ 5654 // focus() and blur() are asynchronous 5655 notAsync = expectSync( this, type ); 5656 this[ type ](); 5657 result = dataPriv.get( this, type ); 5658 if ( saved !== result || notAsync ) { 5659 dataPriv.set( this, type, false ); 5660 } else { 5661 result = {}; 5662 } 5663 if ( saved !== result ) { 5664 5665 // Cancel the outer synthetic event 5666 event.stopImmediatePropagation(); 5667 event.preventDefault(); 5668 5669 // Support: Chrome 86+ 5670 // In Chrome, if an element having a focusout handler is blurred by 5671 // clicking outside of it, it invokes the handler synchronously. If 5672 // that handler calls `.remove()` on the element, the data is cleared, 5673 // leaving `result` undefined. We need to guard against this. 5674 return result && result.value; 5675 } 5676 5677 // If this is an inner synthetic event for an event with a bubbling surrogate 5678 // (focus or blur), assume that the surrogate already propagated from triggering the 5679 // native event and prevent that from happening again here. 5680 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5681 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5682 // less bad than duplication. 5683 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5684 event.stopPropagation(); 5685 } 5686 5687 // If this is a native event triggered above, everything is now in order 5688 // Fire an inner synthetic event with the original arguments 5689 } else if ( saved.length ) { 5690 5691 // ...and capture the result 5692 dataPriv.set( this, type, { 5693 value: jQuery.event.trigger( 5694 5695 // Support: IE <=9 - 11+ 5696 // Extend with the prototype to reset the above stopImmediatePropagation() 5697 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 5698 saved.slice( 1 ), 5699 this 5700 ) 5701 } ); 5702 5703 // Abort handling of the native event 5704 event.stopImmediatePropagation(); 5705 } 5706 } 5707 } ); 5708} 5709 5710jQuery.removeEvent = function( elem, type, handle ) { 5711 5712 // This "if" is needed for plain objects 5713 if ( elem.removeEventListener ) { 5714 elem.removeEventListener( type, handle ); 5715 } 5716}; 5717 5718jQuery.Event = function( src, props ) { 5719 5720 // Allow instantiation without the 'new' keyword 5721 if ( !( this instanceof jQuery.Event ) ) { 5722 return new jQuery.Event( src, props ); 5723 } 5724 5725 // Event object 5726 if ( src && src.type ) { 5727 this.originalEvent = src; 5728 this.type = src.type; 5729 5730 // Events bubbling up the document may have been marked as prevented 5731 // by a handler lower down the tree; reflect the correct value. 5732 this.isDefaultPrevented = src.defaultPrevented || 5733 src.defaultPrevented === undefined && 5734 5735 // Support: Android <=2.3 only 5736 src.returnValue === false ? 5737 returnTrue : 5738 returnFalse; 5739 5740 // Create target properties 5741 // Support: Safari <=6 - 7 only 5742 // Target should not be a text node (trac-504, trac-13143) 5743 this.target = ( src.target && src.target.nodeType === 3 ) ? 5744 src.target.parentNode : 5745 src.target; 5746 5747 this.currentTarget = src.currentTarget; 5748 this.relatedTarget = src.relatedTarget; 5749 5750 // Event type 5751 } else { 5752 this.type = src; 5753 } 5754 5755 // Put explicitly provided properties onto the event object 5756 if ( props ) { 5757 jQuery.extend( this, props ); 5758 } 5759 5760 // Create a timestamp if incoming event doesn't have one 5761 this.timeStamp = src && src.timeStamp || Date.now(); 5762 5763 // Mark it as fixed 5764 this[ jQuery.expando ] = true; 5765}; 5766 5767// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5768// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5769jQuery.Event.prototype = { 5770 constructor: jQuery.Event, 5771 isDefaultPrevented: returnFalse, 5772 isPropagationStopped: returnFalse, 5773 isImmediatePropagationStopped: returnFalse, 5774 isSimulated: false, 5775 5776 preventDefault: function() { 5777 var e = this.originalEvent; 5778 5779 this.isDefaultPrevented = returnTrue; 5780 5781 if ( e && !this.isSimulated ) { 5782 e.preventDefault(); 5783 } 5784 }, 5785 stopPropagation: function() { 5786 var e = this.originalEvent; 5787 5788 this.isPropagationStopped = returnTrue; 5789 5790 if ( e && !this.isSimulated ) { 5791 e.stopPropagation(); 5792 } 5793 }, 5794 stopImmediatePropagation: function() { 5795 var e = this.originalEvent; 5796 5797 this.isImmediatePropagationStopped = returnTrue; 5798 5799 if ( e && !this.isSimulated ) { 5800 e.stopImmediatePropagation(); 5801 } 5802 5803 this.stopPropagation(); 5804 } 5805}; 5806 5807// Includes all common event props including KeyEvent and MouseEvent specific props 5808jQuery.each( { 5809 altKey: true, 5810 bubbles: true, 5811 cancelable: true, 5812 changedTouches: true, 5813 ctrlKey: true, 5814 detail: true, 5815 eventPhase: true, 5816 metaKey: true, 5817 pageX: true, 5818 pageY: true, 5819 shiftKey: true, 5820 view: true, 5821 "char": true, 5822 code: true, 5823 charCode: true, 5824 key: true, 5825 keyCode: true, 5826 button: true, 5827 buttons: true, 5828 clientX: true, 5829 clientY: true, 5830 offsetX: true, 5831 offsetY: true, 5832 pointerId: true, 5833 pointerType: true, 5834 screenX: true, 5835 screenY: true, 5836 targetTouches: true, 5837 toElement: true, 5838 touches: true, 5839 which: true 5840}, jQuery.event.addProp ); 5841 5842jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5843 jQuery.event.special[ type ] = { 5844 5845 // Utilize native event if possible so blur/focus sequence is correct 5846 setup: function() { 5847 5848 // Claim the first handler 5849 // dataPriv.set( this, "focus", ... ) 5850 // dataPriv.set( this, "blur", ... ) 5851 leverageNative( this, type, expectSync ); 5852 5853 // Return false to allow normal processing in the caller 5854 return false; 5855 }, 5856 trigger: function() { 5857 5858 // Force setup before trigger 5859 leverageNative( this, type ); 5860 5861 // Return non-false to allow normal event-path propagation 5862 return true; 5863 }, 5864 5865 // Suppress native focus or blur if we're currently inside 5866 // a leveraged native-event stack 5867 _default: function( event ) { 5868 return dataPriv.get( event.target, type ); 5869 }, 5870 5871 delegateType: delegateType 5872 }; 5873} ); 5874 5875// Create mouseenter/leave events using mouseover/out and event-time checks 5876// so that event delegation works in jQuery. 5877// Do the same for pointerenter/pointerleave and pointerover/pointerout 5878// 5879// Support: Safari 7 only 5880// Safari sends mouseenter too often; see: 5881// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5882// for the description of the bug (it existed in older Chrome versions as well). 5883jQuery.each( { 5884 mouseenter: "mouseover", 5885 mouseleave: "mouseout", 5886 pointerenter: "pointerover", 5887 pointerleave: "pointerout" 5888}, function( orig, fix ) { 5889 jQuery.event.special[ orig ] = { 5890 delegateType: fix, 5891 bindType: fix, 5892 5893 handle: function( event ) { 5894 var ret, 5895 target = this, 5896 related = event.relatedTarget, 5897 handleObj = event.handleObj; 5898 5899 // For mouseenter/leave call the handler if related is outside the target. 5900 // NB: No relatedTarget if the mouse left/entered the browser window 5901 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5902 event.type = handleObj.origType; 5903 ret = handleObj.handler.apply( this, arguments ); 5904 event.type = fix; 5905 } 5906 return ret; 5907 } 5908 }; 5909} ); 5910 5911jQuery.fn.extend( { 5912 5913 on: function( types, selector, data, fn ) { 5914 return on( this, types, selector, data, fn ); 5915 }, 5916 one: function( types, selector, data, fn ) { 5917 return on( this, types, selector, data, fn, 1 ); 5918 }, 5919 off: function( types, selector, fn ) { 5920 var handleObj, type; 5921 if ( types && types.preventDefault && types.handleObj ) { 5922 5923 // ( event ) dispatched jQuery.Event 5924 handleObj = types.handleObj; 5925 jQuery( types.delegateTarget ).off( 5926 handleObj.namespace ? 5927 handleObj.origType + "." + handleObj.namespace : 5928 handleObj.origType, 5929 handleObj.selector, 5930 handleObj.handler 5931 ); 5932 return this; 5933 } 5934 if ( typeof types === "object" ) { 5935 5936 // ( types-object [, selector] ) 5937 for ( type in types ) { 5938 this.off( type, selector, types[ type ] ); 5939 } 5940 return this; 5941 } 5942 if ( selector === false || typeof selector === "function" ) { 5943 5944 // ( types [, fn] ) 5945 fn = selector; 5946 selector = undefined; 5947 } 5948 if ( fn === false ) { 5949 fn = returnFalse; 5950 } 5951 return this.each( function() { 5952 jQuery.event.remove( this, types, fn, selector ); 5953 } ); 5954 } 5955} ); 5956 5957 5958var 5959 5960 // Support: IE <=10 - 11, Edge 12 - 13 only 5961 // In IE/Edge using regex groups here causes severe slowdowns. 5962 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5963 rnoInnerhtml = /<script|<style|<link/i, 5964 5965 // checked="checked" or checked 5966 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5967 5968 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 5969 5970// Prefer a tbody over its parent table for containing new rows 5971function manipulationTarget( elem, content ) { 5972 if ( nodeName( elem, "table" ) && 5973 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5974 5975 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5976 } 5977 5978 return elem; 5979} 5980 5981// Replace/restore the type attribute of script elements for safe DOM manipulation 5982function disableScript( elem ) { 5983 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5984 return elem; 5985} 5986function restoreScript( elem ) { 5987 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5988 elem.type = elem.type.slice( 5 ); 5989 } else { 5990 elem.removeAttribute( "type" ); 5991 } 5992 5993 return elem; 5994} 5995 5996function cloneCopyEvent( src, dest ) { 5997 var i, l, type, pdataOld, udataOld, udataCur, events; 5998 5999 if ( dest.nodeType !== 1 ) { 6000 return; 6001 } 6002 6003 // 1. Copy private data: events, handlers, etc. 6004 if ( dataPriv.hasData( src ) ) { 6005 pdataOld = dataPriv.get( src ); 6006 events = pdataOld.events; 6007 6008 if ( events ) { 6009 dataPriv.remove( dest, "handle events" ); 6010 6011 for ( type in events ) { 6012 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6013 jQuery.event.add( dest, type, events[ type ][ i ] ); 6014 } 6015 } 6016 } 6017 } 6018 6019 // 2. Copy user data 6020 if ( dataUser.hasData( src ) ) { 6021 udataOld = dataUser.access( src ); 6022 udataCur = jQuery.extend( {}, udataOld ); 6023 6024 dataUser.set( dest, udataCur ); 6025 } 6026} 6027 6028// Fix IE bugs, see support tests 6029function fixInput( src, dest ) { 6030 var nodeName = dest.nodeName.toLowerCase(); 6031 6032 // Fails to persist the checked state of a cloned checkbox or radio button. 6033 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 6034 dest.checked = src.checked; 6035 6036 // Fails to return the selected option to the default selected state when cloning options 6037 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6038 dest.defaultValue = src.defaultValue; 6039 } 6040} 6041 6042function domManip( collection, args, callback, ignored ) { 6043 6044 // Flatten any nested arrays 6045 args = flat( args ); 6046 6047 var fragment, first, scripts, hasScripts, node, doc, 6048 i = 0, 6049 l = collection.length, 6050 iNoClone = l - 1, 6051 value = args[ 0 ], 6052 valueIsFunction = isFunction( value ); 6053 6054 // We can't cloneNode fragments that contain checked, in WebKit 6055 if ( valueIsFunction || 6056 ( l > 1 && typeof value === "string" && 6057 !support.checkClone && rchecked.test( value ) ) ) { 6058 return collection.each( function( index ) { 6059 var self = collection.eq( index ); 6060 if ( valueIsFunction ) { 6061 args[ 0 ] = value.call( this, index, self.html() ); 6062 } 6063 domManip( self, args, callback, ignored ); 6064 } ); 6065 } 6066 6067 if ( l ) { 6068 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6069 first = fragment.firstChild; 6070 6071 if ( fragment.childNodes.length === 1 ) { 6072 fragment = first; 6073 } 6074 6075 // Require either new content or an interest in ignored elements to invoke the callback 6076 if ( first || ignored ) { 6077 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6078 hasScripts = scripts.length; 6079 6080 // Use the original fragment for the last item 6081 // instead of the first because it can end up 6082 // being emptied incorrectly in certain situations (trac-8070). 6083 for ( ; i < l; i++ ) { 6084 node = fragment; 6085 6086 if ( i !== iNoClone ) { 6087 node = jQuery.clone( node, true, true ); 6088 6089 // Keep references to cloned scripts for later restoration 6090 if ( hasScripts ) { 6091 6092 // Support: Android <=4.0 only, PhantomJS 1 only 6093 // push.apply(_, arraylike) throws on ancient WebKit 6094 jQuery.merge( scripts, getAll( node, "script" ) ); 6095 } 6096 } 6097 6098 callback.call( collection[ i ], node, i ); 6099 } 6100 6101 if ( hasScripts ) { 6102 doc = scripts[ scripts.length - 1 ].ownerDocument; 6103 6104 // Reenable scripts 6105 jQuery.map( scripts, restoreScript ); 6106 6107 // Evaluate executable scripts on first document insertion 6108 for ( i = 0; i < hasScripts; i++ ) { 6109 node = scripts[ i ]; 6110 if ( rscriptType.test( node.type || "" ) && 6111 !dataPriv.access( node, "globalEval" ) && 6112 jQuery.contains( doc, node ) ) { 6113 6114 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6115 6116 // Optional AJAX dependency, but won't run scripts if not present 6117 if ( jQuery._evalUrl && !node.noModule ) { 6118 jQuery._evalUrl( node.src, { 6119 nonce: node.nonce || node.getAttribute( "nonce" ) 6120 }, doc ); 6121 } 6122 } else { 6123 6124 // Unwrap a CDATA section containing script contents. This shouldn't be 6125 // needed as in XML documents they're already not visible when 6126 // inspecting element contents and in HTML documents they have no 6127 // meaning but we're preserving that logic for backwards compatibility. 6128 // This will be removed completely in 4.0. See gh-4904. 6129 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6130 } 6131 } 6132 } 6133 } 6134 } 6135 } 6136 6137 return collection; 6138} 6139 6140function remove( elem, selector, keepData ) { 6141 var node, 6142 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6143 i = 0; 6144 6145 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6146 if ( !keepData && node.nodeType === 1 ) { 6147 jQuery.cleanData( getAll( node ) ); 6148 } 6149 6150 if ( node.parentNode ) { 6151 if ( keepData && isAttached( node ) ) { 6152 setGlobalEval( getAll( node, "script" ) ); 6153 } 6154 node.parentNode.removeChild( node ); 6155 } 6156 } 6157 6158 return elem; 6159} 6160 6161jQuery.extend( { 6162 htmlPrefilter: function( html ) { 6163 return html; 6164 }, 6165 6166 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6167 var i, l, srcElements, destElements, 6168 clone = elem.cloneNode( true ), 6169 inPage = isAttached( elem ); 6170 6171 // Fix IE cloning issues 6172 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6173 !jQuery.isXMLDoc( elem ) ) { 6174 6175 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 6176 destElements = getAll( clone ); 6177 srcElements = getAll( elem ); 6178 6179 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6180 fixInput( srcElements[ i ], destElements[ i ] ); 6181 } 6182 } 6183 6184 // Copy the events from the original to the clone 6185 if ( dataAndEvents ) { 6186 if ( deepDataAndEvents ) { 6187 srcElements = srcElements || getAll( elem ); 6188 destElements = destElements || getAll( clone ); 6189 6190 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6191 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6192 } 6193 } else { 6194 cloneCopyEvent( elem, clone ); 6195 } 6196 } 6197 6198 // Preserve script evaluation history 6199 destElements = getAll( clone, "script" ); 6200 if ( destElements.length > 0 ) { 6201 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6202 } 6203 6204 // Return the cloned set 6205 return clone; 6206 }, 6207 6208 cleanData: function( elems ) { 6209 var data, elem, type, 6210 special = jQuery.event.special, 6211 i = 0; 6212 6213 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6214 if ( acceptData( elem ) ) { 6215 if ( ( data = elem[ dataPriv.expando ] ) ) { 6216 if ( data.events ) { 6217 for ( type in data.events ) { 6218 if ( special[ type ] ) { 6219 jQuery.event.remove( elem, type ); 6220 6221 // This is a shortcut to avoid jQuery.event.remove's overhead 6222 } else { 6223 jQuery.removeEvent( elem, type, data.handle ); 6224 } 6225 } 6226 } 6227 6228 // Support: Chrome <=35 - 45+ 6229 // Assign undefined instead of using delete, see Data#remove 6230 elem[ dataPriv.expando ] = undefined; 6231 } 6232 if ( elem[ dataUser.expando ] ) { 6233 6234 // Support: Chrome <=35 - 45+ 6235 // Assign undefined instead of using delete, see Data#remove 6236 elem[ dataUser.expando ] = undefined; 6237 } 6238 } 6239 } 6240 } 6241} ); 6242 6243jQuery.fn.extend( { 6244 detach: function( selector ) { 6245 return remove( this, selector, true ); 6246 }, 6247 6248 remove: function( selector ) { 6249 return remove( this, selector ); 6250 }, 6251 6252 text: function( value ) { 6253 return access( this, function( value ) { 6254 return value === undefined ? 6255 jQuery.text( this ) : 6256 this.empty().each( function() { 6257 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6258 this.textContent = value; 6259 } 6260 } ); 6261 }, null, value, arguments.length ); 6262 }, 6263 6264 append: function() { 6265 return domManip( this, arguments, function( elem ) { 6266 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6267 var target = manipulationTarget( this, elem ); 6268 target.appendChild( elem ); 6269 } 6270 } ); 6271 }, 6272 6273 prepend: function() { 6274 return domManip( this, arguments, function( elem ) { 6275 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6276 var target = manipulationTarget( this, elem ); 6277 target.insertBefore( elem, target.firstChild ); 6278 } 6279 } ); 6280 }, 6281 6282 before: function() { 6283 return domManip( this, arguments, function( elem ) { 6284 if ( this.parentNode ) { 6285 this.parentNode.insertBefore( elem, this ); 6286 } 6287 } ); 6288 }, 6289 6290 after: function() { 6291 return domManip( this, arguments, function( elem ) { 6292 if ( this.parentNode ) { 6293 this.parentNode.insertBefore( elem, this.nextSibling ); 6294 } 6295 } ); 6296 }, 6297 6298 empty: function() { 6299 var elem, 6300 i = 0; 6301 6302 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6303 if ( elem.nodeType === 1 ) { 6304 6305 // Prevent memory leaks 6306 jQuery.cleanData( getAll( elem, false ) ); 6307 6308 // Remove any remaining nodes 6309 elem.textContent = ""; 6310 } 6311 } 6312 6313 return this; 6314 }, 6315 6316 clone: function( dataAndEvents, deepDataAndEvents ) { 6317 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6318 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6319 6320 return this.map( function() { 6321 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6322 } ); 6323 }, 6324 6325 html: function( value ) { 6326 return access( this, function( value ) { 6327 var elem = this[ 0 ] || {}, 6328 i = 0, 6329 l = this.length; 6330 6331 if ( value === undefined && elem.nodeType === 1 ) { 6332 return elem.innerHTML; 6333 } 6334 6335 // See if we can take a shortcut and just use innerHTML 6336 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6337 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6338 6339 value = jQuery.htmlPrefilter( value ); 6340 6341 try { 6342 for ( ; i < l; i++ ) { 6343 elem = this[ i ] || {}; 6344 6345 // Remove element nodes and prevent memory leaks 6346 if ( elem.nodeType === 1 ) { 6347 jQuery.cleanData( getAll( elem, false ) ); 6348 elem.innerHTML = value; 6349 } 6350 } 6351 6352 elem = 0; 6353 6354 // If using innerHTML throws an exception, use the fallback method 6355 } catch ( e ) {} 6356 } 6357 6358 if ( elem ) { 6359 this.empty().append( value ); 6360 } 6361 }, null, value, arguments.length ); 6362 }, 6363 6364 replaceWith: function() { 6365 var ignored = []; 6366 6367 // Make the changes, replacing each non-ignored context element with the new content 6368 return domManip( this, arguments, function( elem ) { 6369 var parent = this.parentNode; 6370 6371 if ( jQuery.inArray( this, ignored ) < 0 ) { 6372 jQuery.cleanData( getAll( this ) ); 6373 if ( parent ) { 6374 parent.replaceChild( elem, this ); 6375 } 6376 } 6377 6378 // Force callback invocation 6379 }, ignored ); 6380 } 6381} ); 6382 6383jQuery.each( { 6384 appendTo: "append", 6385 prependTo: "prepend", 6386 insertBefore: "before", 6387 insertAfter: "after", 6388 replaceAll: "replaceWith" 6389}, function( name, original ) { 6390 jQuery.fn[ name ] = function( selector ) { 6391 var elems, 6392 ret = [], 6393 insert = jQuery( selector ), 6394 last = insert.length - 1, 6395 i = 0; 6396 6397 for ( ; i <= last; i++ ) { 6398 elems = i === last ? this : this.clone( true ); 6399 jQuery( insert[ i ] )[ original ]( elems ); 6400 6401 // Support: Android <=4.0 only, PhantomJS 1 only 6402 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6403 push.apply( ret, elems.get() ); 6404 } 6405 6406 return this.pushStack( ret ); 6407 }; 6408} ); 6409var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6410 6411var rcustomProp = /^--/; 6412 6413 6414var getStyles = function( elem ) { 6415 6416 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6417 // IE throws on elements created in popups 6418 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6419 var view = elem.ownerDocument.defaultView; 6420 6421 if ( !view || !view.opener ) { 6422 view = window; 6423 } 6424 6425 return view.getComputedStyle( elem ); 6426 }; 6427 6428var swap = function( elem, options, callback ) { 6429 var ret, name, 6430 old = {}; 6431 6432 // Remember the old values, and insert the new ones 6433 for ( name in options ) { 6434 old[ name ] = elem.style[ name ]; 6435 elem.style[ name ] = options[ name ]; 6436 } 6437 6438 ret = callback.call( elem ); 6439 6440 // Revert the old values 6441 for ( name in options ) { 6442 elem.style[ name ] = old[ name ]; 6443 } 6444 6445 return ret; 6446}; 6447 6448 6449var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6450 6451var whitespace = "[\\x20\\t\\r\\n\\f]"; 6452 6453 6454var rtrimCSS = new RegExp( 6455 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 6456 "g" 6457); 6458 6459 6460 6461 6462( function() { 6463 6464 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6465 // so they're executed at the same time to save the second computation. 6466 function computeStyleTests() { 6467 6468 // This is a singleton, we need to execute it only once 6469 if ( !div ) { 6470 return; 6471 } 6472 6473 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6474 "margin-top:1px;padding:0;border:0"; 6475 div.style.cssText = 6476 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6477 "margin:auto;border:1px;padding:1px;" + 6478 "width:60%;top:1%"; 6479 documentElement.appendChild( container ).appendChild( div ); 6480 6481 var divStyle = window.getComputedStyle( div ); 6482 pixelPositionVal = divStyle.top !== "1%"; 6483 6484 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6485 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6486 6487 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6488 // Some styles come back with percentage values, even though they shouldn't 6489 div.style.right = "60%"; 6490 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6491 6492 // Support: IE 9 - 11 only 6493 // Detect misreporting of content dimensions for box-sizing:border-box elements 6494 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6495 6496 // Support: IE 9 only 6497 // Detect overflow:scroll screwiness (gh-3699) 6498 // Support: Chrome <=64 6499 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6500 div.style.position = "absolute"; 6501 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6502 6503 documentElement.removeChild( container ); 6504 6505 // Nullify the div so it wouldn't be stored in the memory and 6506 // it will also be a sign that checks already performed 6507 div = null; 6508 } 6509 6510 function roundPixelMeasures( measure ) { 6511 return Math.round( parseFloat( measure ) ); 6512 } 6513 6514 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6515 reliableTrDimensionsVal, reliableMarginLeftVal, 6516 container = document.createElement( "div" ), 6517 div = document.createElement( "div" ); 6518 6519 // Finish early in limited (non-browser) environments 6520 if ( !div.style ) { 6521 return; 6522 } 6523 6524 // Support: IE <=9 - 11 only 6525 // Style of cloned element affects source element cloned (trac-8908) 6526 div.style.backgroundClip = "content-box"; 6527 div.cloneNode( true ).style.backgroundClip = ""; 6528 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6529 6530 jQuery.extend( support, { 6531 boxSizingReliable: function() { 6532 computeStyleTests(); 6533 return boxSizingReliableVal; 6534 }, 6535 pixelBoxStyles: function() { 6536 computeStyleTests(); 6537 return pixelBoxStylesVal; 6538 }, 6539 pixelPosition: function() { 6540 computeStyleTests(); 6541 return pixelPositionVal; 6542 }, 6543 reliableMarginLeft: function() { 6544 computeStyleTests(); 6545 return reliableMarginLeftVal; 6546 }, 6547 scrollboxSize: function() { 6548 computeStyleTests(); 6549 return scrollboxSizeVal; 6550 }, 6551 6552 // Support: IE 9 - 11+, Edge 15 - 18+ 6553 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6554 // set in CSS while `offset*` properties report correct values. 6555 // Behavior in IE 9 is more subtle than in newer versions & it passes 6556 // some versions of this test; make sure not to make it pass there! 6557 // 6558 // Support: Firefox 70+ 6559 // Only Firefox includes border widths 6560 // in computed dimensions. (gh-4529) 6561 reliableTrDimensions: function() { 6562 var table, tr, trChild, trStyle; 6563 if ( reliableTrDimensionsVal == null ) { 6564 table = document.createElement( "table" ); 6565 tr = document.createElement( "tr" ); 6566 trChild = document.createElement( "div" ); 6567 6568 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6569 tr.style.cssText = "border:1px solid"; 6570 6571 // Support: Chrome 86+ 6572 // Height set through cssText does not get applied. 6573 // Computed height then comes back as 0. 6574 tr.style.height = "1px"; 6575 trChild.style.height = "9px"; 6576 6577 // Support: Android 8 Chrome 86+ 6578 // In our bodyBackground.html iframe, 6579 // display for all div elements is set to "inline", 6580 // which causes a problem only in Android 8 Chrome 86. 6581 // Ensuring the div is display: block 6582 // gets around this issue. 6583 trChild.style.display = "block"; 6584 6585 documentElement 6586 .appendChild( table ) 6587 .appendChild( tr ) 6588 .appendChild( trChild ); 6589 6590 trStyle = window.getComputedStyle( tr ); 6591 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6592 parseInt( trStyle.borderTopWidth, 10 ) + 6593 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6594 6595 documentElement.removeChild( table ); 6596 } 6597 return reliableTrDimensionsVal; 6598 } 6599 } ); 6600} )(); 6601 6602 6603function curCSS( elem, name, computed ) { 6604 var width, minWidth, maxWidth, ret, 6605 isCustomProp = rcustomProp.test( name ), 6606 6607 // Support: Firefox 51+ 6608 // Retrieving style before computed somehow 6609 // fixes an issue with getting wrong values 6610 // on detached elements 6611 style = elem.style; 6612 6613 computed = computed || getStyles( elem ); 6614 6615 // getPropertyValue is needed for: 6616 // .css('filter') (IE 9 only, trac-12537) 6617 // .css('--customProperty) (gh-3144) 6618 if ( computed ) { 6619 ret = computed.getPropertyValue( name ) || computed[ name ]; 6620 6621 // trim whitespace for custom property (issue gh-4926) 6622 if ( isCustomProp ) { 6623 6624 // rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6625 // as whitespace while CSS does not, but this is not a problem 6626 // because CSS preprocessing replaces them with U+000A LINE FEED 6627 // (which *is* CSS whitespace) 6628 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6629 ret = ret.replace( rtrimCSS, "$1" ); 6630 } 6631 6632 if ( ret === "" && !isAttached( elem ) ) { 6633 ret = jQuery.style( elem, name ); 6634 } 6635 6636 // A tribute to the "awesome hack by Dean Edwards" 6637 // Android Browser returns percentage for some values, 6638 // but width seems to be reliably pixels. 6639 // This is against the CSSOM draft spec: 6640 // https://drafts.csswg.org/cssom/#resolved-values 6641 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6642 6643 // Remember the original values 6644 width = style.width; 6645 minWidth = style.minWidth; 6646 maxWidth = style.maxWidth; 6647 6648 // Put in the new values to get a computed value out 6649 style.minWidth = style.maxWidth = style.width = ret; 6650 ret = computed.width; 6651 6652 // Revert the changed values 6653 style.width = width; 6654 style.minWidth = minWidth; 6655 style.maxWidth = maxWidth; 6656 } 6657 } 6658 6659 return ret !== undefined ? 6660 6661 // Support: IE <=9 - 11 only 6662 // IE returns zIndex value as an integer. 6663 ret + "" : 6664 ret; 6665} 6666 6667 6668function addGetHookIf( conditionFn, hookFn ) { 6669 6670 // Define the hook, we'll check on the first run if it's really needed. 6671 return { 6672 get: function() { 6673 if ( conditionFn() ) { 6674 6675 // Hook not needed (or it's not possible to use it due 6676 // to missing dependency), remove it. 6677 delete this.get; 6678 return; 6679 } 6680 6681 // Hook needed; redefine it so that the support test is not executed again. 6682 return ( this.get = hookFn ).apply( this, arguments ); 6683 } 6684 }; 6685} 6686 6687 6688var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6689 emptyStyle = document.createElement( "div" ).style, 6690 vendorProps = {}; 6691 6692// Return a vendor-prefixed property or undefined 6693function vendorPropName( name ) { 6694 6695 // Check for vendor prefixed names 6696 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6697 i = cssPrefixes.length; 6698 6699 while ( i-- ) { 6700 name = cssPrefixes[ i ] + capName; 6701 if ( name in emptyStyle ) { 6702 return name; 6703 } 6704 } 6705} 6706 6707// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6708function finalPropName( name ) { 6709 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6710 6711 if ( final ) { 6712 return final; 6713 } 6714 if ( name in emptyStyle ) { 6715 return name; 6716 } 6717 return vendorProps[ name ] = vendorPropName( name ) || name; 6718} 6719 6720 6721var 6722 6723 // Swappable if display is none or starts with table 6724 // except "table", "table-cell", or "table-caption" 6725 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6726 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6727 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6728 cssNormalTransform = { 6729 letterSpacing: "0", 6730 fontWeight: "400" 6731 }; 6732 6733function setPositiveNumber( _elem, value, subtract ) { 6734 6735 // Any relative (+/-) values have already been 6736 // normalized at this point 6737 var matches = rcssNum.exec( value ); 6738 return matches ? 6739 6740 // Guard against undefined "subtract", e.g., when used as in cssHooks 6741 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6742 value; 6743} 6744 6745function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6746 var i = dimension === "width" ? 1 : 0, 6747 extra = 0, 6748 delta = 0; 6749 6750 // Adjustment may not be necessary 6751 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6752 return 0; 6753 } 6754 6755 for ( ; i < 4; i += 2 ) { 6756 6757 // Both box models exclude margin 6758 if ( box === "margin" ) { 6759 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6760 } 6761 6762 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6763 if ( !isBorderBox ) { 6764 6765 // Add padding 6766 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6767 6768 // For "border" or "margin", add border 6769 if ( box !== "padding" ) { 6770 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6771 6772 // But still keep track of it otherwise 6773 } else { 6774 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6775 } 6776 6777 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6778 // "padding" or "margin" 6779 } else { 6780 6781 // For "content", subtract padding 6782 if ( box === "content" ) { 6783 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6784 } 6785 6786 // For "content" or "padding", subtract border 6787 if ( box !== "margin" ) { 6788 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6789 } 6790 } 6791 } 6792 6793 // Account for positive content-box scroll gutter when requested by providing computedVal 6794 if ( !isBorderBox && computedVal >= 0 ) { 6795 6796 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6797 // Assuming integer scroll gutter, subtract the rest and round down 6798 delta += Math.max( 0, Math.ceil( 6799 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6800 computedVal - 6801 delta - 6802 extra - 6803 0.5 6804 6805 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6806 // Use an explicit zero to avoid NaN (gh-3964) 6807 ) ) || 0; 6808 } 6809 6810 return delta; 6811} 6812 6813function getWidthOrHeight( elem, dimension, extra ) { 6814 6815 // Start with computed style 6816 var styles = getStyles( elem ), 6817 6818 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6819 // Fake content-box until we know it's needed to know the true value. 6820 boxSizingNeeded = !support.boxSizingReliable() || extra, 6821 isBorderBox = boxSizingNeeded && 6822 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6823 valueIsBorderBox = isBorderBox, 6824 6825 val = curCSS( elem, dimension, styles ), 6826 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6827 6828 // Support: Firefox <=54 6829 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6830 if ( rnumnonpx.test( val ) ) { 6831 if ( !extra ) { 6832 return val; 6833 } 6834 val = "auto"; 6835 } 6836 6837 6838 // Support: IE 9 - 11 only 6839 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6840 // In those cases, the computed value can be trusted to be border-box. 6841 if ( ( !support.boxSizingReliable() && isBorderBox || 6842 6843 // Support: IE 10 - 11+, Edge 15 - 18+ 6844 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6845 // set in CSS while `offset*` properties report correct values. 6846 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6847 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6848 6849 // Fall back to offsetWidth/offsetHeight when value is "auto" 6850 // This happens for inline elements with no explicit setting (gh-3571) 6851 val === "auto" || 6852 6853 // Support: Android <=4.1 - 4.3 only 6854 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6855 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6856 6857 // Make sure the element is visible & connected 6858 elem.getClientRects().length ) { 6859 6860 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6861 6862 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6863 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6864 // retrieved value as a content box dimension. 6865 valueIsBorderBox = offsetProp in elem; 6866 if ( valueIsBorderBox ) { 6867 val = elem[ offsetProp ]; 6868 } 6869 } 6870 6871 // Normalize "" and auto 6872 val = parseFloat( val ) || 0; 6873 6874 // Adjust for the element's box model 6875 return ( val + 6876 boxModelAdjustment( 6877 elem, 6878 dimension, 6879 extra || ( isBorderBox ? "border" : "content" ), 6880 valueIsBorderBox, 6881 styles, 6882 6883 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6884 val 6885 ) 6886 ) + "px"; 6887} 6888 6889jQuery.extend( { 6890 6891 // Add in style property hooks for overriding the default 6892 // behavior of getting and setting a style property 6893 cssHooks: { 6894 opacity: { 6895 get: function( elem, computed ) { 6896 if ( computed ) { 6897 6898 // We should always get a number back from opacity 6899 var ret = curCSS( elem, "opacity" ); 6900 return ret === "" ? "1" : ret; 6901 } 6902 } 6903 } 6904 }, 6905 6906 // Don't automatically add "px" to these possibly-unitless properties 6907 cssNumber: { 6908 "animationIterationCount": true, 6909 "columnCount": true, 6910 "fillOpacity": true, 6911 "flexGrow": true, 6912 "flexShrink": true, 6913 "fontWeight": true, 6914 "gridArea": true, 6915 "gridColumn": true, 6916 "gridColumnEnd": true, 6917 "gridColumnStart": true, 6918 "gridRow": true, 6919 "gridRowEnd": true, 6920 "gridRowStart": true, 6921 "lineHeight": true, 6922 "opacity": true, 6923 "order": true, 6924 "orphans": true, 6925 "widows": true, 6926 "zIndex": true, 6927 "zoom": true 6928 }, 6929 6930 // Add in properties whose names you wish to fix before 6931 // setting or getting the value 6932 cssProps: {}, 6933 6934 // Get and set the style property on a DOM Node 6935 style: function( elem, name, value, extra ) { 6936 6937 // Don't set styles on text and comment nodes 6938 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6939 return; 6940 } 6941 6942 // Make sure that we're working with the right name 6943 var ret, type, hooks, 6944 origName = camelCase( name ), 6945 isCustomProp = rcustomProp.test( name ), 6946 style = elem.style; 6947 6948 // Make sure that we're working with the right name. We don't 6949 // want to query the value if it is a CSS custom property 6950 // since they are user-defined. 6951 if ( !isCustomProp ) { 6952 name = finalPropName( origName ); 6953 } 6954 6955 // Gets hook for the prefixed version, then unprefixed version 6956 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6957 6958 // Check if we're setting a value 6959 if ( value !== undefined ) { 6960 type = typeof value; 6961 6962 // Convert "+=" or "-=" to relative numbers (trac-7345) 6963 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6964 value = adjustCSS( elem, name, ret ); 6965 6966 // Fixes bug trac-9237 6967 type = "number"; 6968 } 6969 6970 // Make sure that null and NaN values aren't set (trac-7116) 6971 if ( value == null || value !== value ) { 6972 return; 6973 } 6974 6975 // If a number was passed in, add the unit (except for certain CSS properties) 6976 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6977 // "px" to a few hardcoded values. 6978 if ( type === "number" && !isCustomProp ) { 6979 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6980 } 6981 6982 // background-* props affect original clone's values 6983 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6984 style[ name ] = "inherit"; 6985 } 6986 6987 // If a hook was provided, use that value, otherwise just set the specified value 6988 if ( !hooks || !( "set" in hooks ) || 6989 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6990 6991 if ( isCustomProp ) { 6992 style.setProperty( name, value ); 6993 } else { 6994 style[ name ] = value; 6995 } 6996 } 6997 6998 } else { 6999 7000 // If a hook was provided get the non-computed value from there 7001 if ( hooks && "get" in hooks && 7002 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7003 7004 return ret; 7005 } 7006 7007 // Otherwise just get the value from the style object 7008 return style[ name ]; 7009 } 7010 }, 7011 7012 css: function( elem, name, extra, styles ) { 7013 var val, num, hooks, 7014 origName = camelCase( name ), 7015 isCustomProp = rcustomProp.test( name ); 7016 7017 // Make sure that we're working with the right name. We don't 7018 // want to modify the value if it is a CSS custom property 7019 // since they are user-defined. 7020 if ( !isCustomProp ) { 7021 name = finalPropName( origName ); 7022 } 7023 7024 // Try prefixed name followed by the unprefixed name 7025 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7026 7027 // If a hook was provided get the computed value from there 7028 if ( hooks && "get" in hooks ) { 7029 val = hooks.get( elem, true, extra ); 7030 } 7031 7032 // Otherwise, if a way to get the computed value exists, use that 7033 if ( val === undefined ) { 7034 val = curCSS( elem, name, styles ); 7035 } 7036 7037 // Convert "normal" to computed value 7038 if ( val === "normal" && name in cssNormalTransform ) { 7039 val = cssNormalTransform[ name ]; 7040 } 7041 7042 // Make numeric if forced or a qualifier was provided and val looks numeric 7043 if ( extra === "" || extra ) { 7044 num = parseFloat( val ); 7045 return extra === true || isFinite( num ) ? num || 0 : val; 7046 } 7047 7048 return val; 7049 } 7050} ); 7051 7052jQuery.each( [ "height", "width" ], function( _i, dimension ) { 7053 jQuery.cssHooks[ dimension ] = { 7054 get: function( elem, computed, extra ) { 7055 if ( computed ) { 7056 7057 // Certain elements can have dimension info if we invisibly show them 7058 // but it must have a current display style that would benefit 7059 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7060 7061 // Support: Safari 8+ 7062 // Table columns in Safari have non-zero offsetWidth & zero 7063 // getBoundingClientRect().width unless display is changed. 7064 // Support: IE <=11 only 7065 // Running getBoundingClientRect on a disconnected node 7066 // in IE throws an error. 7067 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7068 swap( elem, cssShow, function() { 7069 return getWidthOrHeight( elem, dimension, extra ); 7070 } ) : 7071 getWidthOrHeight( elem, dimension, extra ); 7072 } 7073 }, 7074 7075 set: function( elem, value, extra ) { 7076 var matches, 7077 styles = getStyles( elem ), 7078 7079 // Only read styles.position if the test has a chance to fail 7080 // to avoid forcing a reflow. 7081 scrollboxSizeBuggy = !support.scrollboxSize() && 7082 styles.position === "absolute", 7083 7084 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7085 boxSizingNeeded = scrollboxSizeBuggy || extra, 7086 isBorderBox = boxSizingNeeded && 7087 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7088 subtract = extra ? 7089 boxModelAdjustment( 7090 elem, 7091 dimension, 7092 extra, 7093 isBorderBox, 7094 styles 7095 ) : 7096 0; 7097 7098 // Account for unreliable border-box dimensions by comparing offset* to computed and 7099 // faking a content-box to get border and padding (gh-3699) 7100 if ( isBorderBox && scrollboxSizeBuggy ) { 7101 subtract -= Math.ceil( 7102 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7103 parseFloat( styles[ dimension ] ) - 7104 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7105 0.5 7106 ); 7107 } 7108 7109 // Convert to pixels if value adjustment is needed 7110 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7111 ( matches[ 3 ] || "px" ) !== "px" ) { 7112 7113 elem.style[ dimension ] = value; 7114 value = jQuery.css( elem, dimension ); 7115 } 7116 7117 return setPositiveNumber( elem, value, subtract ); 7118 } 7119 }; 7120} ); 7121 7122jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7123 function( elem, computed ) { 7124 if ( computed ) { 7125 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7126 elem.getBoundingClientRect().left - 7127 swap( elem, { marginLeft: 0 }, function() { 7128 return elem.getBoundingClientRect().left; 7129 } ) 7130 ) + "px"; 7131 } 7132 } 7133); 7134 7135// These hooks are used by animate to expand properties 7136jQuery.each( { 7137 margin: "", 7138 padding: "", 7139 border: "Width" 7140}, function( prefix, suffix ) { 7141 jQuery.cssHooks[ prefix + suffix ] = { 7142 expand: function( value ) { 7143 var i = 0, 7144 expanded = {}, 7145 7146 // Assumes a single number if not a string 7147 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7148 7149 for ( ; i < 4; i++ ) { 7150 expanded[ prefix + cssExpand[ i ] + suffix ] = 7151 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7152 } 7153 7154 return expanded; 7155 } 7156 }; 7157 7158 if ( prefix !== "margin" ) { 7159 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7160 } 7161} ); 7162 7163jQuery.fn.extend( { 7164 css: function( name, value ) { 7165 return access( this, function( elem, name, value ) { 7166 var styles, len, 7167 map = {}, 7168 i = 0; 7169 7170 if ( Array.isArray( name ) ) { 7171 styles = getStyles( elem ); 7172 len = name.length; 7173 7174 for ( ; i < len; i++ ) { 7175 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7176 } 7177 7178 return map; 7179 } 7180 7181 return value !== undefined ? 7182 jQuery.style( elem, name, value ) : 7183 jQuery.css( elem, name ); 7184 }, name, value, arguments.length > 1 ); 7185 } 7186} ); 7187 7188 7189function Tween( elem, options, prop, end, easing ) { 7190 return new Tween.prototype.init( elem, options, prop, end, easing ); 7191} 7192jQuery.Tween = Tween; 7193 7194Tween.prototype = { 7195 constructor: Tween, 7196 init: function( elem, options, prop, end, easing, unit ) { 7197 this.elem = elem; 7198 this.prop = prop; 7199 this.easing = easing || jQuery.easing._default; 7200 this.options = options; 7201 this.start = this.now = this.cur(); 7202 this.end = end; 7203 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7204 }, 7205 cur: function() { 7206 var hooks = Tween.propHooks[ this.prop ]; 7207 7208 return hooks && hooks.get ? 7209 hooks.get( this ) : 7210 Tween.propHooks._default.get( this ); 7211 }, 7212 run: function( percent ) { 7213 var eased, 7214 hooks = Tween.propHooks[ this.prop ]; 7215 7216 if ( this.options.duration ) { 7217 this.pos = eased = jQuery.easing[ this.easing ]( 7218 percent, this.options.duration * percent, 0, 1, this.options.duration 7219 ); 7220 } else { 7221 this.pos = eased = percent; 7222 } 7223 this.now = ( this.end - this.start ) * eased + this.start; 7224 7225 if ( this.options.step ) { 7226 this.options.step.call( this.elem, this.now, this ); 7227 } 7228 7229 if ( hooks && hooks.set ) { 7230 hooks.set( this ); 7231 } else { 7232 Tween.propHooks._default.set( this ); 7233 } 7234 return this; 7235 } 7236}; 7237 7238Tween.prototype.init.prototype = Tween.prototype; 7239 7240Tween.propHooks = { 7241 _default: { 7242 get: function( tween ) { 7243 var result; 7244 7245 // Use a property on the element directly when it is not a DOM element, 7246 // or when there is no matching style property that exists. 7247 if ( tween.elem.nodeType !== 1 || 7248 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7249 return tween.elem[ tween.prop ]; 7250 } 7251 7252 // Passing an empty string as a 3rd parameter to .css will automatically 7253 // attempt a parseFloat and fallback to a string if the parse fails. 7254 // Simple values such as "10px" are parsed to Float; 7255 // complex values such as "rotate(1rad)" are returned as-is. 7256 result = jQuery.css( tween.elem, tween.prop, "" ); 7257 7258 // Empty strings, null, undefined and "auto" are converted to 0. 7259 return !result || result === "auto" ? 0 : result; 7260 }, 7261 set: function( tween ) { 7262 7263 // Use step hook for back compat. 7264 // Use cssHook if its there. 7265 // Use .style if available and use plain properties where available. 7266 if ( jQuery.fx.step[ tween.prop ] ) { 7267 jQuery.fx.step[ tween.prop ]( tween ); 7268 } else if ( tween.elem.nodeType === 1 && ( 7269 jQuery.cssHooks[ tween.prop ] || 7270 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7271 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7272 } else { 7273 tween.elem[ tween.prop ] = tween.now; 7274 } 7275 } 7276 } 7277}; 7278 7279// Support: IE <=9 only 7280// Panic based approach to setting things on disconnected nodes 7281Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7282 set: function( tween ) { 7283 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7284 tween.elem[ tween.prop ] = tween.now; 7285 } 7286 } 7287}; 7288 7289jQuery.easing = { 7290 linear: function( p ) { 7291 return p; 7292 }, 7293 swing: function( p ) { 7294 return 0.5 - Math.cos( p * Math.PI ) / 2; 7295 }, 7296 _default: "swing" 7297}; 7298 7299jQuery.fx = Tween.prototype.init; 7300 7301// Back compat <1.8 extension point 7302jQuery.fx.step = {}; 7303 7304 7305 7306 7307var 7308 fxNow, inProgress, 7309 rfxtypes = /^(?:toggle|show|hide)$/, 7310 rrun = /queueHooks$/; 7311 7312function schedule() { 7313 if ( inProgress ) { 7314 if ( document.hidden === false && window.requestAnimationFrame ) { 7315 window.requestAnimationFrame( schedule ); 7316 } else { 7317 window.setTimeout( schedule, jQuery.fx.interval ); 7318 } 7319 7320 jQuery.fx.tick(); 7321 } 7322} 7323 7324// Animations created synchronously will run synchronously 7325function createFxNow() { 7326 window.setTimeout( function() { 7327 fxNow = undefined; 7328 } ); 7329 return ( fxNow = Date.now() ); 7330} 7331 7332// Generate parameters to create a standard animation 7333function genFx( type, includeWidth ) { 7334 var which, 7335 i = 0, 7336 attrs = { height: type }; 7337 7338 // If we include width, step value is 1 to do all cssExpand values, 7339 // otherwise step value is 2 to skip over Left and Right 7340 includeWidth = includeWidth ? 1 : 0; 7341 for ( ; i < 4; i += 2 - includeWidth ) { 7342 which = cssExpand[ i ]; 7343 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7344 } 7345 7346 if ( includeWidth ) { 7347 attrs.opacity = attrs.width = type; 7348 } 7349 7350 return attrs; 7351} 7352 7353function createTween( value, prop, animation ) { 7354 var tween, 7355 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7356 index = 0, 7357 length = collection.length; 7358 for ( ; index < length; index++ ) { 7359 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7360 7361 // We're done with this property 7362 return tween; 7363 } 7364 } 7365} 7366 7367function defaultPrefilter( elem, props, opts ) { 7368 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7369 isBox = "width" in props || "height" in props, 7370 anim = this, 7371 orig = {}, 7372 style = elem.style, 7373 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7374 dataShow = dataPriv.get( elem, "fxshow" ); 7375 7376 // Queue-skipping animations hijack the fx hooks 7377 if ( !opts.queue ) { 7378 hooks = jQuery._queueHooks( elem, "fx" ); 7379 if ( hooks.unqueued == null ) { 7380 hooks.unqueued = 0; 7381 oldfire = hooks.empty.fire; 7382 hooks.empty.fire = function() { 7383 if ( !hooks.unqueued ) { 7384 oldfire(); 7385 } 7386 }; 7387 } 7388 hooks.unqueued++; 7389 7390 anim.always( function() { 7391 7392 // Ensure the complete handler is called before this completes 7393 anim.always( function() { 7394 hooks.unqueued--; 7395 if ( !jQuery.queue( elem, "fx" ).length ) { 7396 hooks.empty.fire(); 7397 } 7398 } ); 7399 } ); 7400 } 7401 7402 // Detect show/hide animations 7403 for ( prop in props ) { 7404 value = props[ prop ]; 7405 if ( rfxtypes.test( value ) ) { 7406 delete props[ prop ]; 7407 toggle = toggle || value === "toggle"; 7408 if ( value === ( hidden ? "hide" : "show" ) ) { 7409 7410 // Pretend to be hidden if this is a "show" and 7411 // there is still data from a stopped show/hide 7412 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7413 hidden = true; 7414 7415 // Ignore all other no-op show/hide data 7416 } else { 7417 continue; 7418 } 7419 } 7420 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7421 } 7422 } 7423 7424 // Bail out if this is a no-op like .hide().hide() 7425 propTween = !jQuery.isEmptyObject( props ); 7426 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7427 return; 7428 } 7429 7430 // Restrict "overflow" and "display" styles during box animations 7431 if ( isBox && elem.nodeType === 1 ) { 7432 7433 // Support: IE <=9 - 11, Edge 12 - 15 7434 // Record all 3 overflow attributes because IE does not infer the shorthand 7435 // from identically-valued overflowX and overflowY and Edge just mirrors 7436 // the overflowX value there. 7437 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7438 7439 // Identify a display type, preferring old show/hide data over the CSS cascade 7440 restoreDisplay = dataShow && dataShow.display; 7441 if ( restoreDisplay == null ) { 7442 restoreDisplay = dataPriv.get( elem, "display" ); 7443 } 7444 display = jQuery.css( elem, "display" ); 7445 if ( display === "none" ) { 7446 if ( restoreDisplay ) { 7447 display = restoreDisplay; 7448 } else { 7449 7450 // Get nonempty value(s) by temporarily forcing visibility 7451 showHide( [ elem ], true ); 7452 restoreDisplay = elem.style.display || restoreDisplay; 7453 display = jQuery.css( elem, "display" ); 7454 showHide( [ elem ] ); 7455 } 7456 } 7457 7458 // Animate inline elements as inline-block 7459 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7460 if ( jQuery.css( elem, "float" ) === "none" ) { 7461 7462 // Restore the original display value at the end of pure show/hide animations 7463 if ( !propTween ) { 7464 anim.done( function() { 7465 style.display = restoreDisplay; 7466 } ); 7467 if ( restoreDisplay == null ) { 7468 display = style.display; 7469 restoreDisplay = display === "none" ? "" : display; 7470 } 7471 } 7472 style.display = "inline-block"; 7473 } 7474 } 7475 } 7476 7477 if ( opts.overflow ) { 7478 style.overflow = "hidden"; 7479 anim.always( function() { 7480 style.overflow = opts.overflow[ 0 ]; 7481 style.overflowX = opts.overflow[ 1 ]; 7482 style.overflowY = opts.overflow[ 2 ]; 7483 } ); 7484 } 7485 7486 // Implement show/hide animations 7487 propTween = false; 7488 for ( prop in orig ) { 7489 7490 // General show/hide setup for this element animation 7491 if ( !propTween ) { 7492 if ( dataShow ) { 7493 if ( "hidden" in dataShow ) { 7494 hidden = dataShow.hidden; 7495 } 7496 } else { 7497 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7498 } 7499 7500 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7501 if ( toggle ) { 7502 dataShow.hidden = !hidden; 7503 } 7504 7505 // Show elements before animating them 7506 if ( hidden ) { 7507 showHide( [ elem ], true ); 7508 } 7509 7510 /* eslint-disable no-loop-func */ 7511 7512 anim.done( function() { 7513 7514 /* eslint-enable no-loop-func */ 7515 7516 // The final step of a "hide" animation is actually hiding the element 7517 if ( !hidden ) { 7518 showHide( [ elem ] ); 7519 } 7520 dataPriv.remove( elem, "fxshow" ); 7521 for ( prop in orig ) { 7522 jQuery.style( elem, prop, orig[ prop ] ); 7523 } 7524 } ); 7525 } 7526 7527 // Per-property setup 7528 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7529 if ( !( prop in dataShow ) ) { 7530 dataShow[ prop ] = propTween.start; 7531 if ( hidden ) { 7532 propTween.end = propTween.start; 7533 propTween.start = 0; 7534 } 7535 } 7536 } 7537} 7538 7539function propFilter( props, specialEasing ) { 7540 var index, name, easing, value, hooks; 7541 7542 // camelCase, specialEasing and expand cssHook pass 7543 for ( index in props ) { 7544 name = camelCase( index ); 7545 easing = specialEasing[ name ]; 7546 value = props[ index ]; 7547 if ( Array.isArray( value ) ) { 7548 easing = value[ 1 ]; 7549 value = props[ index ] = value[ 0 ]; 7550 } 7551 7552 if ( index !== name ) { 7553 props[ name ] = value; 7554 delete props[ index ]; 7555 } 7556 7557 hooks = jQuery.cssHooks[ name ]; 7558 if ( hooks && "expand" in hooks ) { 7559 value = hooks.expand( value ); 7560 delete props[ name ]; 7561 7562 // Not quite $.extend, this won't overwrite existing keys. 7563 // Reusing 'index' because we have the correct "name" 7564 for ( index in value ) { 7565 if ( !( index in props ) ) { 7566 props[ index ] = value[ index ]; 7567 specialEasing[ index ] = easing; 7568 } 7569 } 7570 } else { 7571 specialEasing[ name ] = easing; 7572 } 7573 } 7574} 7575 7576function Animation( elem, properties, options ) { 7577 var result, 7578 stopped, 7579 index = 0, 7580 length = Animation.prefilters.length, 7581 deferred = jQuery.Deferred().always( function() { 7582 7583 // Don't match elem in the :animated selector 7584 delete tick.elem; 7585 } ), 7586 tick = function() { 7587 if ( stopped ) { 7588 return false; 7589 } 7590 var currentTime = fxNow || createFxNow(), 7591 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7592 7593 // Support: Android 2.3 only 7594 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7595 temp = remaining / animation.duration || 0, 7596 percent = 1 - temp, 7597 index = 0, 7598 length = animation.tweens.length; 7599 7600 for ( ; index < length; index++ ) { 7601 animation.tweens[ index ].run( percent ); 7602 } 7603 7604 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7605 7606 // If there's more to do, yield 7607 if ( percent < 1 && length ) { 7608 return remaining; 7609 } 7610 7611 // If this was an empty animation, synthesize a final progress notification 7612 if ( !length ) { 7613 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7614 } 7615 7616 // Resolve the animation and report its conclusion 7617 deferred.resolveWith( elem, [ animation ] ); 7618 return false; 7619 }, 7620 animation = deferred.promise( { 7621 elem: elem, 7622 props: jQuery.extend( {}, properties ), 7623 opts: jQuery.extend( true, { 7624 specialEasing: {}, 7625 easing: jQuery.easing._default 7626 }, options ), 7627 originalProperties: properties, 7628 originalOptions: options, 7629 startTime: fxNow || createFxNow(), 7630 duration: options.duration, 7631 tweens: [], 7632 createTween: function( prop, end ) { 7633 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7634 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7635 animation.tweens.push( tween ); 7636 return tween; 7637 }, 7638 stop: function( gotoEnd ) { 7639 var index = 0, 7640 7641 // If we are going to the end, we want to run all the tweens 7642 // otherwise we skip this part 7643 length = gotoEnd ? animation.tweens.length : 0; 7644 if ( stopped ) { 7645 return this; 7646 } 7647 stopped = true; 7648 for ( ; index < length; index++ ) { 7649 animation.tweens[ index ].run( 1 ); 7650 } 7651 7652 // Resolve when we played the last frame; otherwise, reject 7653 if ( gotoEnd ) { 7654 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7655 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7656 } else { 7657 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7658 } 7659 return this; 7660 } 7661 } ), 7662 props = animation.props; 7663 7664 propFilter( props, animation.opts.specialEasing ); 7665 7666 for ( ; index < length; index++ ) { 7667 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7668 if ( result ) { 7669 if ( isFunction( result.stop ) ) { 7670 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7671 result.stop.bind( result ); 7672 } 7673 return result; 7674 } 7675 } 7676 7677 jQuery.map( props, createTween, animation ); 7678 7679 if ( isFunction( animation.opts.start ) ) { 7680 animation.opts.start.call( elem, animation ); 7681 } 7682 7683 // Attach callbacks from options 7684 animation 7685 .progress( animation.opts.progress ) 7686 .done( animation.opts.done, animation.opts.complete ) 7687 .fail( animation.opts.fail ) 7688 .always( animation.opts.always ); 7689 7690 jQuery.fx.timer( 7691 jQuery.extend( tick, { 7692 elem: elem, 7693 anim: animation, 7694 queue: animation.opts.queue 7695 } ) 7696 ); 7697 7698 return animation; 7699} 7700 7701jQuery.Animation = jQuery.extend( Animation, { 7702 7703 tweeners: { 7704 "*": [ function( prop, value ) { 7705 var tween = this.createTween( prop, value ); 7706 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7707 return tween; 7708 } ] 7709 }, 7710 7711 tweener: function( props, callback ) { 7712 if ( isFunction( props ) ) { 7713 callback = props; 7714 props = [ "*" ]; 7715 } else { 7716 props = props.match( rnothtmlwhite ); 7717 } 7718 7719 var prop, 7720 index = 0, 7721 length = props.length; 7722 7723 for ( ; index < length; index++ ) { 7724 prop = props[ index ]; 7725 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7726 Animation.tweeners[ prop ].unshift( callback ); 7727 } 7728 }, 7729 7730 prefilters: [ defaultPrefilter ], 7731 7732 prefilter: function( callback, prepend ) { 7733 if ( prepend ) { 7734 Animation.prefilters.unshift( callback ); 7735 } else { 7736 Animation.prefilters.push( callback ); 7737 } 7738 } 7739} ); 7740 7741jQuery.speed = function( speed, easing, fn ) { 7742 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7743 complete: fn || !fn && easing || 7744 isFunction( speed ) && speed, 7745 duration: speed, 7746 easing: fn && easing || easing && !isFunction( easing ) && easing 7747 }; 7748 7749 // Go to the end state if fx are off 7750 if ( jQuery.fx.off ) { 7751 opt.duration = 0; 7752 7753 } else { 7754 if ( typeof opt.duration !== "number" ) { 7755 if ( opt.duration in jQuery.fx.speeds ) { 7756 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7757 7758 } else { 7759 opt.duration = jQuery.fx.speeds._default; 7760 } 7761 } 7762 } 7763 7764 // Normalize opt.queue - true/undefined/null -> "fx" 7765 if ( opt.queue == null || opt.queue === true ) { 7766 opt.queue = "fx"; 7767 } 7768 7769 // Queueing 7770 opt.old = opt.complete; 7771 7772 opt.complete = function() { 7773 if ( isFunction( opt.old ) ) { 7774 opt.old.call( this ); 7775 } 7776 7777 if ( opt.queue ) { 7778 jQuery.dequeue( this, opt.queue ); 7779 } 7780 }; 7781 7782 return opt; 7783}; 7784 7785jQuery.fn.extend( { 7786 fadeTo: function( speed, to, easing, callback ) { 7787 7788 // Show any hidden elements after setting opacity to 0 7789 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7790 7791 // Animate to the value specified 7792 .end().animate( { opacity: to }, speed, easing, callback ); 7793 }, 7794 animate: function( prop, speed, easing, callback ) { 7795 var empty = jQuery.isEmptyObject( prop ), 7796 optall = jQuery.speed( speed, easing, callback ), 7797 doAnimation = function() { 7798 7799 // Operate on a copy of prop so per-property easing won't be lost 7800 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7801 7802 // Empty animations, or finishing resolves immediately 7803 if ( empty || dataPriv.get( this, "finish" ) ) { 7804 anim.stop( true ); 7805 } 7806 }; 7807 7808 doAnimation.finish = doAnimation; 7809 7810 return empty || optall.queue === false ? 7811 this.each( doAnimation ) : 7812 this.queue( optall.queue, doAnimation ); 7813 }, 7814 stop: function( type, clearQueue, gotoEnd ) { 7815 var stopQueue = function( hooks ) { 7816 var stop = hooks.stop; 7817 delete hooks.stop; 7818 stop( gotoEnd ); 7819 }; 7820 7821 if ( typeof type !== "string" ) { 7822 gotoEnd = clearQueue; 7823 clearQueue = type; 7824 type = undefined; 7825 } 7826 if ( clearQueue ) { 7827 this.queue( type || "fx", [] ); 7828 } 7829 7830 return this.each( function() { 7831 var dequeue = true, 7832 index = type != null && type + "queueHooks", 7833 timers = jQuery.timers, 7834 data = dataPriv.get( this ); 7835 7836 if ( index ) { 7837 if ( data[ index ] && data[ index ].stop ) { 7838 stopQueue( data[ index ] ); 7839 } 7840 } else { 7841 for ( index in data ) { 7842 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7843 stopQueue( data[ index ] ); 7844 } 7845 } 7846 } 7847 7848 for ( index = timers.length; index--; ) { 7849 if ( timers[ index ].elem === this && 7850 ( type == null || timers[ index ].queue === type ) ) { 7851 7852 timers[ index ].anim.stop( gotoEnd ); 7853 dequeue = false; 7854 timers.splice( index, 1 ); 7855 } 7856 } 7857 7858 // Start the next in the queue if the last step wasn't forced. 7859 // Timers currently will call their complete callbacks, which 7860 // will dequeue but only if they were gotoEnd. 7861 if ( dequeue || !gotoEnd ) { 7862 jQuery.dequeue( this, type ); 7863 } 7864 } ); 7865 }, 7866 finish: function( type ) { 7867 if ( type !== false ) { 7868 type = type || "fx"; 7869 } 7870 return this.each( function() { 7871 var index, 7872 data = dataPriv.get( this ), 7873 queue = data[ type + "queue" ], 7874 hooks = data[ type + "queueHooks" ], 7875 timers = jQuery.timers, 7876 length = queue ? queue.length : 0; 7877 7878 // Enable finishing flag on private data 7879 data.finish = true; 7880 7881 // Empty the queue first 7882 jQuery.queue( this, type, [] ); 7883 7884 if ( hooks && hooks.stop ) { 7885 hooks.stop.call( this, true ); 7886 } 7887 7888 // Look for any active animations, and finish them 7889 for ( index = timers.length; index--; ) { 7890 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7891 timers[ index ].anim.stop( true ); 7892 timers.splice( index, 1 ); 7893 } 7894 } 7895 7896 // Look for any animations in the old queue and finish them 7897 for ( index = 0; index < length; index++ ) { 7898 if ( queue[ index ] && queue[ index ].finish ) { 7899 queue[ index ].finish.call( this ); 7900 } 7901 } 7902 7903 // Turn off finishing flag 7904 delete data.finish; 7905 } ); 7906 } 7907} ); 7908 7909jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7910 var cssFn = jQuery.fn[ name ]; 7911 jQuery.fn[ name ] = function( speed, easing, callback ) { 7912 return speed == null || typeof speed === "boolean" ? 7913 cssFn.apply( this, arguments ) : 7914 this.animate( genFx( name, true ), speed, easing, callback ); 7915 }; 7916} ); 7917 7918// Generate shortcuts for custom animations 7919jQuery.each( { 7920 slideDown: genFx( "show" ), 7921 slideUp: genFx( "hide" ), 7922 slideToggle: genFx( "toggle" ), 7923 fadeIn: { opacity: "show" }, 7924 fadeOut: { opacity: "hide" }, 7925 fadeToggle: { opacity: "toggle" } 7926}, function( name, props ) { 7927 jQuery.fn[ name ] = function( speed, easing, callback ) { 7928 return this.animate( props, speed, easing, callback ); 7929 }; 7930} ); 7931 7932jQuery.timers = []; 7933jQuery.fx.tick = function() { 7934 var timer, 7935 i = 0, 7936 timers = jQuery.timers; 7937 7938 fxNow = Date.now(); 7939 7940 for ( ; i < timers.length; i++ ) { 7941 timer = timers[ i ]; 7942 7943 // Run the timer and safely remove it when done (allowing for external removal) 7944 if ( !timer() && timers[ i ] === timer ) { 7945 timers.splice( i--, 1 ); 7946 } 7947 } 7948 7949 if ( !timers.length ) { 7950 jQuery.fx.stop(); 7951 } 7952 fxNow = undefined; 7953}; 7954 7955jQuery.fx.timer = function( timer ) { 7956 jQuery.timers.push( timer ); 7957 jQuery.fx.start(); 7958}; 7959 7960jQuery.fx.interval = 13; 7961jQuery.fx.start = function() { 7962 if ( inProgress ) { 7963 return; 7964 } 7965 7966 inProgress = true; 7967 schedule(); 7968}; 7969 7970jQuery.fx.stop = function() { 7971 inProgress = null; 7972}; 7973 7974jQuery.fx.speeds = { 7975 slow: 600, 7976 fast: 200, 7977 7978 // Default speed 7979 _default: 400 7980}; 7981 7982 7983// Based off of the plugin by Clint Helfers, with permission. 7984jQuery.fn.delay = function( time, type ) { 7985 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7986 type = type || "fx"; 7987 7988 return this.queue( type, function( next, hooks ) { 7989 var timeout = window.setTimeout( next, time ); 7990 hooks.stop = function() { 7991 window.clearTimeout( timeout ); 7992 }; 7993 } ); 7994}; 7995 7996 7997( function() { 7998 var input = document.createElement( "input" ), 7999 select = document.createElement( "select" ), 8000 opt = select.appendChild( document.createElement( "option" ) ); 8001 8002 input.type = "checkbox"; 8003 8004 // Support: Android <=4.3 only 8005 // Default value for a checkbox should be "on" 8006 support.checkOn = input.value !== ""; 8007 8008 // Support: IE <=11 only 8009 // Must access selectedIndex to make default options select 8010 support.optSelected = opt.selected; 8011 8012 // Support: IE <=11 only 8013 // An input loses its value after becoming a radio 8014 input = document.createElement( "input" ); 8015 input.value = "t"; 8016 input.type = "radio"; 8017 support.radioValue = input.value === "t"; 8018} )(); 8019 8020 8021var boolHook, 8022 attrHandle = jQuery.expr.attrHandle; 8023 8024jQuery.fn.extend( { 8025 attr: function( name, value ) { 8026 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8027 }, 8028 8029 removeAttr: function( name ) { 8030 return this.each( function() { 8031 jQuery.removeAttr( this, name ); 8032 } ); 8033 } 8034} ); 8035 8036jQuery.extend( { 8037 attr: function( elem, name, value ) { 8038 var ret, hooks, 8039 nType = elem.nodeType; 8040 8041 // Don't get/set attributes on text, comment and attribute nodes 8042 if ( nType === 3 || nType === 8 || nType === 2 ) { 8043 return; 8044 } 8045 8046 // Fallback to prop when attributes are not supported 8047 if ( typeof elem.getAttribute === "undefined" ) { 8048 return jQuery.prop( elem, name, value ); 8049 } 8050 8051 // Attribute hooks are determined by the lowercase version 8052 // Grab necessary hook if one is defined 8053 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8054 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 8055 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 8056 } 8057 8058 if ( value !== undefined ) { 8059 if ( value === null ) { 8060 jQuery.removeAttr( elem, name ); 8061 return; 8062 } 8063 8064 if ( hooks && "set" in hooks && 8065 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8066 return ret; 8067 } 8068 8069 elem.setAttribute( name, value + "" ); 8070 return value; 8071 } 8072 8073 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8074 return ret; 8075 } 8076 8077 ret = jQuery.find.attr( elem, name ); 8078 8079 // Non-existent attributes return null, we normalize to undefined 8080 return ret == null ? undefined : ret; 8081 }, 8082 8083 attrHooks: { 8084 type: { 8085 set: function( elem, value ) { 8086 if ( !support.radioValue && value === "radio" && 8087 nodeName( elem, "input" ) ) { 8088 var val = elem.value; 8089 elem.setAttribute( "type", value ); 8090 if ( val ) { 8091 elem.value = val; 8092 } 8093 return value; 8094 } 8095 } 8096 } 8097 }, 8098 8099 removeAttr: function( elem, value ) { 8100 var name, 8101 i = 0, 8102 8103 // Attribute names can contain non-HTML whitespace characters 8104 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8105 attrNames = value && value.match( rnothtmlwhite ); 8106 8107 if ( attrNames && elem.nodeType === 1 ) { 8108 while ( ( name = attrNames[ i++ ] ) ) { 8109 elem.removeAttribute( name ); 8110 } 8111 } 8112 } 8113} ); 8114 8115// Hooks for boolean attributes 8116boolHook = { 8117 set: function( elem, value, name ) { 8118 if ( value === false ) { 8119 8120 // Remove boolean attributes when set to false 8121 jQuery.removeAttr( elem, name ); 8122 } else { 8123 elem.setAttribute( name, name ); 8124 } 8125 return name; 8126 } 8127}; 8128 8129jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8130 var getter = attrHandle[ name ] || jQuery.find.attr; 8131 8132 attrHandle[ name ] = function( elem, name, isXML ) { 8133 var ret, handle, 8134 lowercaseName = name.toLowerCase(); 8135 8136 if ( !isXML ) { 8137 8138 // Avoid an infinite loop by temporarily removing this function from the getter 8139 handle = attrHandle[ lowercaseName ]; 8140 attrHandle[ lowercaseName ] = ret; 8141 ret = getter( elem, name, isXML ) != null ? 8142 lowercaseName : 8143 null; 8144 attrHandle[ lowercaseName ] = handle; 8145 } 8146 return ret; 8147 }; 8148} ); 8149 8150 8151 8152 8153var rfocusable = /^(?:input|select|textarea|button)$/i, 8154 rclickable = /^(?:a|area)$/i; 8155 8156jQuery.fn.extend( { 8157 prop: function( name, value ) { 8158 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8159 }, 8160 8161 removeProp: function( name ) { 8162 return this.each( function() { 8163 delete this[ jQuery.propFix[ name ] || name ]; 8164 } ); 8165 } 8166} ); 8167 8168jQuery.extend( { 8169 prop: function( elem, name, value ) { 8170 var ret, hooks, 8171 nType = elem.nodeType; 8172 8173 // Don't get/set properties on text, comment and attribute nodes 8174 if ( nType === 3 || nType === 8 || nType === 2 ) { 8175 return; 8176 } 8177 8178 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8179 8180 // Fix name and attach hooks 8181 name = jQuery.propFix[ name ] || name; 8182 hooks = jQuery.propHooks[ name ]; 8183 } 8184 8185 if ( value !== undefined ) { 8186 if ( hooks && "set" in hooks && 8187 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8188 return ret; 8189 } 8190 8191 return ( elem[ name ] = value ); 8192 } 8193 8194 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8195 return ret; 8196 } 8197 8198 return elem[ name ]; 8199 }, 8200 8201 propHooks: { 8202 tabIndex: { 8203 get: function( elem ) { 8204 8205 // Support: IE <=9 - 11 only 8206 // elem.tabIndex doesn't always return the 8207 // correct value when it hasn't been explicitly set 8208 // Use proper attribute retrieval (trac-12072) 8209 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8210 8211 if ( tabindex ) { 8212 return parseInt( tabindex, 10 ); 8213 } 8214 8215 if ( 8216 rfocusable.test( elem.nodeName ) || 8217 rclickable.test( elem.nodeName ) && 8218 elem.href 8219 ) { 8220 return 0; 8221 } 8222 8223 return -1; 8224 } 8225 } 8226 }, 8227 8228 propFix: { 8229 "for": "htmlFor", 8230 "class": "className" 8231 } 8232} ); 8233 8234// Support: IE <=11 only 8235// Accessing the selectedIndex property 8236// forces the browser to respect setting selected 8237// on the option 8238// The getter ensures a default option is selected 8239// when in an optgroup 8240// eslint rule "no-unused-expressions" is disabled for this code 8241// since it considers such accessions noop 8242if ( !support.optSelected ) { 8243 jQuery.propHooks.selected = { 8244 get: function( elem ) { 8245 8246 /* eslint no-unused-expressions: "off" */ 8247 8248 var parent = elem.parentNode; 8249 if ( parent && parent.parentNode ) { 8250 parent.parentNode.selectedIndex; 8251 } 8252 return null; 8253 }, 8254 set: function( elem ) { 8255 8256 /* eslint no-unused-expressions: "off" */ 8257 8258 var parent = elem.parentNode; 8259 if ( parent ) { 8260 parent.selectedIndex; 8261 8262 if ( parent.parentNode ) { 8263 parent.parentNode.selectedIndex; 8264 } 8265 } 8266 } 8267 }; 8268} 8269 8270jQuery.each( [ 8271 "tabIndex", 8272 "readOnly", 8273 "maxLength", 8274 "cellSpacing", 8275 "cellPadding", 8276 "rowSpan", 8277 "colSpan", 8278 "useMap", 8279 "frameBorder", 8280 "contentEditable" 8281], function() { 8282 jQuery.propFix[ this.toLowerCase() ] = this; 8283} ); 8284 8285 8286 8287 8288 // Strip and collapse whitespace according to HTML spec 8289 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8290 function stripAndCollapse( value ) { 8291 var tokens = value.match( rnothtmlwhite ) || []; 8292 return tokens.join( " " ); 8293 } 8294 8295 8296function getClass( elem ) { 8297 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8298} 8299 8300function classesToArray( value ) { 8301 if ( Array.isArray( value ) ) { 8302 return value; 8303 } 8304 if ( typeof value === "string" ) { 8305 return value.match( rnothtmlwhite ) || []; 8306 } 8307 return []; 8308} 8309 8310jQuery.fn.extend( { 8311 addClass: function( value ) { 8312 var classNames, cur, curValue, className, i, finalValue; 8313 8314 if ( isFunction( value ) ) { 8315 return this.each( function( j ) { 8316 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8317 } ); 8318 } 8319 8320 classNames = classesToArray( value ); 8321 8322 if ( classNames.length ) { 8323 return this.each( function() { 8324 curValue = getClass( this ); 8325 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8326 8327 if ( cur ) { 8328 for ( i = 0; i < classNames.length; i++ ) { 8329 className = classNames[ i ]; 8330 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8331 cur += className + " "; 8332 } 8333 } 8334 8335 // Only assign if different to avoid unneeded rendering. 8336 finalValue = stripAndCollapse( cur ); 8337 if ( curValue !== finalValue ) { 8338 this.setAttribute( "class", finalValue ); 8339 } 8340 } 8341 } ); 8342 } 8343 8344 return this; 8345 }, 8346 8347 removeClass: function( value ) { 8348 var classNames, cur, curValue, className, i, finalValue; 8349 8350 if ( isFunction( value ) ) { 8351 return this.each( function( j ) { 8352 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8353 } ); 8354 } 8355 8356 if ( !arguments.length ) { 8357 return this.attr( "class", "" ); 8358 } 8359 8360 classNames = classesToArray( value ); 8361 8362 if ( classNames.length ) { 8363 return this.each( function() { 8364 curValue = getClass( this ); 8365 8366 // This expression is here for better compressibility (see addClass) 8367 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8368 8369 if ( cur ) { 8370 for ( i = 0; i < classNames.length; i++ ) { 8371 className = classNames[ i ]; 8372 8373 // Remove *all* instances 8374 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8375 cur = cur.replace( " " + className + " ", " " ); 8376 } 8377 } 8378 8379 // Only assign if different to avoid unneeded rendering. 8380 finalValue = stripAndCollapse( cur ); 8381 if ( curValue !== finalValue ) { 8382 this.setAttribute( "class", finalValue ); 8383 } 8384 } 8385 } ); 8386 } 8387 8388 return this; 8389 }, 8390 8391 toggleClass: function( value, stateVal ) { 8392 var classNames, className, i, self, 8393 type = typeof value, 8394 isValidValue = type === "string" || Array.isArray( value ); 8395 8396 if ( isFunction( value ) ) { 8397 return this.each( function( i ) { 8398 jQuery( this ).toggleClass( 8399 value.call( this, i, getClass( this ), stateVal ), 8400 stateVal 8401 ); 8402 } ); 8403 } 8404 8405 if ( typeof stateVal === "boolean" && isValidValue ) { 8406 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8407 } 8408 8409 classNames = classesToArray( value ); 8410 8411 return this.each( function() { 8412 if ( isValidValue ) { 8413 8414 // Toggle individual class names 8415 self = jQuery( this ); 8416 8417 for ( i = 0; i < classNames.length; i++ ) { 8418 className = classNames[ i ]; 8419 8420 // Check each className given, space separated list 8421 if ( self.hasClass( className ) ) { 8422 self.removeClass( className ); 8423 } else { 8424 self.addClass( className ); 8425 } 8426 } 8427 8428 // Toggle whole class name 8429 } else if ( value === undefined || type === "boolean" ) { 8430 className = getClass( this ); 8431 if ( className ) { 8432 8433 // Store className if set 8434 dataPriv.set( this, "__className__", className ); 8435 } 8436 8437 // If the element has a class name or if we're passed `false`, 8438 // then remove the whole classname (if there was one, the above saved it). 8439 // Otherwise bring back whatever was previously saved (if anything), 8440 // falling back to the empty string if nothing was stored. 8441 if ( this.setAttribute ) { 8442 this.setAttribute( "class", 8443 className || value === false ? 8444 "" : 8445 dataPriv.get( this, "__className__" ) || "" 8446 ); 8447 } 8448 } 8449 } ); 8450 }, 8451 8452 hasClass: function( selector ) { 8453 var className, elem, 8454 i = 0; 8455 8456 className = " " + selector + " "; 8457 while ( ( elem = this[ i++ ] ) ) { 8458 if ( elem.nodeType === 1 && 8459 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8460 return true; 8461 } 8462 } 8463 8464 return false; 8465 } 8466} ); 8467 8468 8469 8470 8471var rreturn = /\r/g; 8472 8473jQuery.fn.extend( { 8474 val: function( value ) { 8475 var hooks, ret, valueIsFunction, 8476 elem = this[ 0 ]; 8477 8478 if ( !arguments.length ) { 8479 if ( elem ) { 8480 hooks = jQuery.valHooks[ elem.type ] || 8481 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8482 8483 if ( hooks && 8484 "get" in hooks && 8485 ( ret = hooks.get( elem, "value" ) ) !== undefined 8486 ) { 8487 return ret; 8488 } 8489 8490 ret = elem.value; 8491 8492 // Handle most common string cases 8493 if ( typeof ret === "string" ) { 8494 return ret.replace( rreturn, "" ); 8495 } 8496 8497 // Handle cases where value is null/undef or number 8498 return ret == null ? "" : ret; 8499 } 8500 8501 return; 8502 } 8503 8504 valueIsFunction = isFunction( value ); 8505 8506 return this.each( function( i ) { 8507 var val; 8508 8509 if ( this.nodeType !== 1 ) { 8510 return; 8511 } 8512 8513 if ( valueIsFunction ) { 8514 val = value.call( this, i, jQuery( this ).val() ); 8515 } else { 8516 val = value; 8517 } 8518 8519 // Treat null/undefined as ""; convert numbers to string 8520 if ( val == null ) { 8521 val = ""; 8522 8523 } else if ( typeof val === "number" ) { 8524 val += ""; 8525 8526 } else if ( Array.isArray( val ) ) { 8527 val = jQuery.map( val, function( value ) { 8528 return value == null ? "" : value + ""; 8529 } ); 8530 } 8531 8532 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8533 8534 // If set returns undefined, fall back to normal setting 8535 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8536 this.value = val; 8537 } 8538 } ); 8539 } 8540} ); 8541 8542jQuery.extend( { 8543 valHooks: { 8544 option: { 8545 get: function( elem ) { 8546 8547 var val = jQuery.find.attr( elem, "value" ); 8548 return val != null ? 8549 val : 8550 8551 // Support: IE <=10 - 11 only 8552 // option.text throws exceptions (trac-14686, trac-14858) 8553 // Strip and collapse whitespace 8554 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8555 stripAndCollapse( jQuery.text( elem ) ); 8556 } 8557 }, 8558 select: { 8559 get: function( elem ) { 8560 var value, option, i, 8561 options = elem.options, 8562 index = elem.selectedIndex, 8563 one = elem.type === "select-one", 8564 values = one ? null : [], 8565 max = one ? index + 1 : options.length; 8566 8567 if ( index < 0 ) { 8568 i = max; 8569 8570 } else { 8571 i = one ? index : 0; 8572 } 8573 8574 // Loop through all the selected options 8575 for ( ; i < max; i++ ) { 8576 option = options[ i ]; 8577 8578 // Support: IE <=9 only 8579 // IE8-9 doesn't update selected after form reset (trac-2551) 8580 if ( ( option.selected || i === index ) && 8581 8582 // Don't return options that are disabled or in a disabled optgroup 8583 !option.disabled && 8584 ( !option.parentNode.disabled || 8585 !nodeName( option.parentNode, "optgroup" ) ) ) { 8586 8587 // Get the specific value for the option 8588 value = jQuery( option ).val(); 8589 8590 // We don't need an array for one selects 8591 if ( one ) { 8592 return value; 8593 } 8594 8595 // Multi-Selects return an array 8596 values.push( value ); 8597 } 8598 } 8599 8600 return values; 8601 }, 8602 8603 set: function( elem, value ) { 8604 var optionSet, option, 8605 options = elem.options, 8606 values = jQuery.makeArray( value ), 8607 i = options.length; 8608 8609 while ( i-- ) { 8610 option = options[ i ]; 8611 8612 /* eslint-disable no-cond-assign */ 8613 8614 if ( option.selected = 8615 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8616 ) { 8617 optionSet = true; 8618 } 8619 8620 /* eslint-enable no-cond-assign */ 8621 } 8622 8623 // Force browsers to behave consistently when non-matching value is set 8624 if ( !optionSet ) { 8625 elem.selectedIndex = -1; 8626 } 8627 return values; 8628 } 8629 } 8630 } 8631} ); 8632 8633// Radios and checkboxes getter/setter 8634jQuery.each( [ "radio", "checkbox" ], function() { 8635 jQuery.valHooks[ this ] = { 8636 set: function( elem, value ) { 8637 if ( Array.isArray( value ) ) { 8638 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8639 } 8640 } 8641 }; 8642 if ( !support.checkOn ) { 8643 jQuery.valHooks[ this ].get = function( elem ) { 8644 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8645 }; 8646 } 8647} ); 8648 8649 8650 8651 8652// Return jQuery for attributes-only inclusion 8653 8654 8655support.focusin = "onfocusin" in window; 8656 8657 8658var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8659 stopPropagationCallback = function( e ) { 8660 e.stopPropagation(); 8661 }; 8662 8663jQuery.extend( jQuery.event, { 8664 8665 trigger: function( event, data, elem, onlyHandlers ) { 8666 8667 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8668 eventPath = [ elem || document ], 8669 type = hasOwn.call( event, "type" ) ? event.type : event, 8670 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8671 8672 cur = lastElement = tmp = elem = elem || document; 8673 8674 // Don't do events on text and comment nodes 8675 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8676 return; 8677 } 8678 8679 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8680 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8681 return; 8682 } 8683 8684 if ( type.indexOf( "." ) > -1 ) { 8685 8686 // Namespaced trigger; create a regexp to match event type in handle() 8687 namespaces = type.split( "." ); 8688 type = namespaces.shift(); 8689 namespaces.sort(); 8690 } 8691 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8692 8693 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8694 event = event[ jQuery.expando ] ? 8695 event : 8696 new jQuery.Event( type, typeof event === "object" && event ); 8697 8698 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8699 event.isTrigger = onlyHandlers ? 2 : 3; 8700 event.namespace = namespaces.join( "." ); 8701 event.rnamespace = event.namespace ? 8702 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8703 null; 8704 8705 // Clean up the event in case it is being reused 8706 event.result = undefined; 8707 if ( !event.target ) { 8708 event.target = elem; 8709 } 8710 8711 // Clone any incoming data and prepend the event, creating the handler arg list 8712 data = data == null ? 8713 [ event ] : 8714 jQuery.makeArray( data, [ event ] ); 8715 8716 // Allow special events to draw outside the lines 8717 special = jQuery.event.special[ type ] || {}; 8718 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8719 return; 8720 } 8721 8722 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8723 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8724 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8725 8726 bubbleType = special.delegateType || type; 8727 if ( !rfocusMorph.test( bubbleType + type ) ) { 8728 cur = cur.parentNode; 8729 } 8730 for ( ; cur; cur = cur.parentNode ) { 8731 eventPath.push( cur ); 8732 tmp = cur; 8733 } 8734 8735 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8736 if ( tmp === ( elem.ownerDocument || document ) ) { 8737 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8738 } 8739 } 8740 8741 // Fire handlers on the event path 8742 i = 0; 8743 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8744 lastElement = cur; 8745 event.type = i > 1 ? 8746 bubbleType : 8747 special.bindType || type; 8748 8749 // jQuery handler 8750 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8751 dataPriv.get( cur, "handle" ); 8752 if ( handle ) { 8753 handle.apply( cur, data ); 8754 } 8755 8756 // Native handler 8757 handle = ontype && cur[ ontype ]; 8758 if ( handle && handle.apply && acceptData( cur ) ) { 8759 event.result = handle.apply( cur, data ); 8760 if ( event.result === false ) { 8761 event.preventDefault(); 8762 } 8763 } 8764 } 8765 event.type = type; 8766 8767 // If nobody prevented the default action, do it now 8768 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8769 8770 if ( ( !special._default || 8771 special._default.apply( eventPath.pop(), data ) === false ) && 8772 acceptData( elem ) ) { 8773 8774 // Call a native DOM method on the target with the same name as the event. 8775 // Don't do default actions on window, that's where global variables be (trac-6170) 8776 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8777 8778 // Don't re-trigger an onFOO event when we call its FOO() method 8779 tmp = elem[ ontype ]; 8780 8781 if ( tmp ) { 8782 elem[ ontype ] = null; 8783 } 8784 8785 // Prevent re-triggering of the same event, since we already bubbled it above 8786 jQuery.event.triggered = type; 8787 8788 if ( event.isPropagationStopped() ) { 8789 lastElement.addEventListener( type, stopPropagationCallback ); 8790 } 8791 8792 elem[ type ](); 8793 8794 if ( event.isPropagationStopped() ) { 8795 lastElement.removeEventListener( type, stopPropagationCallback ); 8796 } 8797 8798 jQuery.event.triggered = undefined; 8799 8800 if ( tmp ) { 8801 elem[ ontype ] = tmp; 8802 } 8803 } 8804 } 8805 } 8806 8807 return event.result; 8808 }, 8809 8810 // Piggyback on a donor event to simulate a different one 8811 // Used only for `focus(in | out)` events 8812 simulate: function( type, elem, event ) { 8813 var e = jQuery.extend( 8814 new jQuery.Event(), 8815 event, 8816 { 8817 type: type, 8818 isSimulated: true 8819 } 8820 ); 8821 8822 jQuery.event.trigger( e, null, elem ); 8823 } 8824 8825} ); 8826 8827jQuery.fn.extend( { 8828 8829 trigger: function( type, data ) { 8830 return this.each( function() { 8831 jQuery.event.trigger( type, data, this ); 8832 } ); 8833 }, 8834 triggerHandler: function( type, data ) { 8835 var elem = this[ 0 ]; 8836 if ( elem ) { 8837 return jQuery.event.trigger( type, data, elem, true ); 8838 } 8839 } 8840} ); 8841 8842 8843// Support: Firefox <=44 8844// Firefox doesn't have focus(in | out) events 8845// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8846// 8847// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8848// focus(in | out) events fire after focus & blur events, 8849// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8850// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8851if ( !support.focusin ) { 8852 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8853 8854 // Attach a single capturing handler on the document while someone wants focusin/focusout 8855 var handler = function( event ) { 8856 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8857 }; 8858 8859 jQuery.event.special[ fix ] = { 8860 setup: function() { 8861 8862 // Handle: regular nodes (via `this.ownerDocument`), window 8863 // (via `this.document`) & document (via `this`). 8864 var doc = this.ownerDocument || this.document || this, 8865 attaches = dataPriv.access( doc, fix ); 8866 8867 if ( !attaches ) { 8868 doc.addEventListener( orig, handler, true ); 8869 } 8870 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8871 }, 8872 teardown: function() { 8873 var doc = this.ownerDocument || this.document || this, 8874 attaches = dataPriv.access( doc, fix ) - 1; 8875 8876 if ( !attaches ) { 8877 doc.removeEventListener( orig, handler, true ); 8878 dataPriv.remove( doc, fix ); 8879 8880 } else { 8881 dataPriv.access( doc, fix, attaches ); 8882 } 8883 } 8884 }; 8885 } ); 8886} 8887var location = window.location; 8888 8889var nonce = { guid: Date.now() }; 8890 8891var rquery = ( /\?/ ); 8892 8893 8894 8895// Cross-browser xml parsing 8896jQuery.parseXML = function( data ) { 8897 var xml, parserErrorElem; 8898 if ( !data || typeof data !== "string" ) { 8899 return null; 8900 } 8901 8902 // Support: IE 9 - 11 only 8903 // IE throws on parseFromString with invalid input. 8904 try { 8905 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8906 } catch ( e ) {} 8907 8908 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8909 if ( !xml || parserErrorElem ) { 8910 jQuery.error( "Invalid XML: " + ( 8911 parserErrorElem ? 8912 jQuery.map( parserErrorElem.childNodes, function( el ) { 8913 return el.textContent; 8914 } ).join( "\n" ) : 8915 data 8916 ) ); 8917 } 8918 return xml; 8919}; 8920 8921 8922var 8923 rbracket = /\[\]$/, 8924 rCRLF = /\r?\n/g, 8925 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8926 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8927 8928function buildParams( prefix, obj, traditional, add ) { 8929 var name; 8930 8931 if ( Array.isArray( obj ) ) { 8932 8933 // Serialize array item. 8934 jQuery.each( obj, function( i, v ) { 8935 if ( traditional || rbracket.test( prefix ) ) { 8936 8937 // Treat each array item as a scalar. 8938 add( prefix, v ); 8939 8940 } else { 8941 8942 // Item is non-scalar (array or object), encode its numeric index. 8943 buildParams( 8944 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8945 v, 8946 traditional, 8947 add 8948 ); 8949 } 8950 } ); 8951 8952 } else if ( !traditional && toType( obj ) === "object" ) { 8953 8954 // Serialize object item. 8955 for ( name in obj ) { 8956 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8957 } 8958 8959 } else { 8960 8961 // Serialize scalar item. 8962 add( prefix, obj ); 8963 } 8964} 8965 8966// Serialize an array of form elements or a set of 8967// key/values into a query string 8968jQuery.param = function( a, traditional ) { 8969 var prefix, 8970 s = [], 8971 add = function( key, valueOrFunction ) { 8972 8973 // If value is a function, invoke it and use its return value 8974 var value = isFunction( valueOrFunction ) ? 8975 valueOrFunction() : 8976 valueOrFunction; 8977 8978 s[ s.length ] = encodeURIComponent( key ) + "=" + 8979 encodeURIComponent( value == null ? "" : value ); 8980 }; 8981 8982 if ( a == null ) { 8983 return ""; 8984 } 8985 8986 // If an array was passed in, assume that it is an array of form elements. 8987 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8988 8989 // Serialize the form elements 8990 jQuery.each( a, function() { 8991 add( this.name, this.value ); 8992 } ); 8993 8994 } else { 8995 8996 // If traditional, encode the "old" way (the way 1.3.2 or older 8997 // did it), otherwise encode params recursively. 8998 for ( prefix in a ) { 8999 buildParams( prefix, a[ prefix ], traditional, add ); 9000 } 9001 } 9002 9003 // Return the resulting serialization 9004 return s.join( "&" ); 9005}; 9006 9007jQuery.fn.extend( { 9008 serialize: function() { 9009 return jQuery.param( this.serializeArray() ); 9010 }, 9011 serializeArray: function() { 9012 return this.map( function() { 9013 9014 // Can add propHook for "elements" to filter or add form elements 9015 var elements = jQuery.prop( this, "elements" ); 9016 return elements ? jQuery.makeArray( elements ) : this; 9017 } ).filter( function() { 9018 var type = this.type; 9019 9020 // Use .is( ":disabled" ) so that fieldset[disabled] works 9021 return this.name && !jQuery( this ).is( ":disabled" ) && 9022 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 9023 ( this.checked || !rcheckableType.test( type ) ); 9024 } ).map( function( _i, elem ) { 9025 var val = jQuery( this ).val(); 9026 9027 if ( val == null ) { 9028 return null; 9029 } 9030 9031 if ( Array.isArray( val ) ) { 9032 return jQuery.map( val, function( val ) { 9033 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9034 } ); 9035 } 9036 9037 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9038 } ).get(); 9039 } 9040} ); 9041 9042 9043var 9044 r20 = /%20/g, 9045 rhash = /#.*$/, 9046 rantiCache = /([?&])_=[^&]*/, 9047 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9048 9049 // trac-7653, trac-8125, trac-8152: local protocol detection 9050 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9051 rnoContent = /^(?:GET|HEAD)$/, 9052 rprotocol = /^\/\//, 9053 9054 /* Prefilters 9055 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9056 * 2) These are called: 9057 * - BEFORE asking for a transport 9058 * - AFTER param serialization (s.data is a string if s.processData is true) 9059 * 3) key is the dataType 9060 * 4) the catchall symbol "*" can be used 9061 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9062 */ 9063 prefilters = {}, 9064 9065 /* Transports bindings 9066 * 1) key is the dataType 9067 * 2) the catchall symbol "*" can be used 9068 * 3) selection will start with transport dataType and THEN go to "*" if needed 9069 */ 9070 transports = {}, 9071 9072 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 9073 allTypes = "*/".concat( "*" ), 9074 9075 // Anchor tag for parsing the document origin 9076 originAnchor = document.createElement( "a" ); 9077 9078originAnchor.href = location.href; 9079 9080// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9081function addToPrefiltersOrTransports( structure ) { 9082 9083 // dataTypeExpression is optional and defaults to "*" 9084 return function( dataTypeExpression, func ) { 9085 9086 if ( typeof dataTypeExpression !== "string" ) { 9087 func = dataTypeExpression; 9088 dataTypeExpression = "*"; 9089 } 9090 9091 var dataType, 9092 i = 0, 9093 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 9094 9095 if ( isFunction( func ) ) { 9096 9097 // For each dataType in the dataTypeExpression 9098 while ( ( dataType = dataTypes[ i++ ] ) ) { 9099 9100 // Prepend if requested 9101 if ( dataType[ 0 ] === "+" ) { 9102 dataType = dataType.slice( 1 ) || "*"; 9103 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9104 9105 // Otherwise append 9106 } else { 9107 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9108 } 9109 } 9110 } 9111 }; 9112} 9113 9114// Base inspection function for prefilters and transports 9115function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9116 9117 var inspected = {}, 9118 seekingTransport = ( structure === transports ); 9119 9120 function inspect( dataType ) { 9121 var selected; 9122 inspected[ dataType ] = true; 9123 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9124 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9125 if ( typeof dataTypeOrTransport === "string" && 9126 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9127 9128 options.dataTypes.unshift( dataTypeOrTransport ); 9129 inspect( dataTypeOrTransport ); 9130 return false; 9131 } else if ( seekingTransport ) { 9132 return !( selected = dataTypeOrTransport ); 9133 } 9134 } ); 9135 return selected; 9136 } 9137 9138 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9139} 9140 9141// A special extend for ajax options 9142// that takes "flat" options (not to be deep extended) 9143// Fixes trac-9887 9144function ajaxExtend( target, src ) { 9145 var key, deep, 9146 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9147 9148 for ( key in src ) { 9149 if ( src[ key ] !== undefined ) { 9150 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9151 } 9152 } 9153 if ( deep ) { 9154 jQuery.extend( true, target, deep ); 9155 } 9156 9157 return target; 9158} 9159 9160/* Handles responses to an ajax request: 9161 * - finds the right dataType (mediates between content-type and expected dataType) 9162 * - returns the corresponding response 9163 */ 9164function ajaxHandleResponses( s, jqXHR, responses ) { 9165 9166 var ct, type, finalDataType, firstDataType, 9167 contents = s.contents, 9168 dataTypes = s.dataTypes; 9169 9170 // Remove auto dataType and get content-type in the process 9171 while ( dataTypes[ 0 ] === "*" ) { 9172 dataTypes.shift(); 9173 if ( ct === undefined ) { 9174 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9175 } 9176 } 9177 9178 // Check if we're dealing with a known content-type 9179 if ( ct ) { 9180 for ( type in contents ) { 9181 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9182 dataTypes.unshift( type ); 9183 break; 9184 } 9185 } 9186 } 9187 9188 // Check to see if we have a response for the expected dataType 9189 if ( dataTypes[ 0 ] in responses ) { 9190 finalDataType = dataTypes[ 0 ]; 9191 } else { 9192 9193 // Try convertible dataTypes 9194 for ( type in responses ) { 9195 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9196 finalDataType = type; 9197 break; 9198 } 9199 if ( !firstDataType ) { 9200 firstDataType = type; 9201 } 9202 } 9203 9204 // Or just use first one 9205 finalDataType = finalDataType || firstDataType; 9206 } 9207 9208 // If we found a dataType 9209 // We add the dataType to the list if needed 9210 // and return the corresponding response 9211 if ( finalDataType ) { 9212 if ( finalDataType !== dataTypes[ 0 ] ) { 9213 dataTypes.unshift( finalDataType ); 9214 } 9215 return responses[ finalDataType ]; 9216 } 9217} 9218 9219/* Chain conversions given the request and the original response 9220 * Also sets the responseXXX fields on the jqXHR instance 9221 */ 9222function ajaxConvert( s, response, jqXHR, isSuccess ) { 9223 var conv2, current, conv, tmp, prev, 9224 converters = {}, 9225 9226 // Work with a copy of dataTypes in case we need to modify it for conversion 9227 dataTypes = s.dataTypes.slice(); 9228 9229 // Create converters map with lowercased keys 9230 if ( dataTypes[ 1 ] ) { 9231 for ( conv in s.converters ) { 9232 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9233 } 9234 } 9235 9236 current = dataTypes.shift(); 9237 9238 // Convert to each sequential dataType 9239 while ( current ) { 9240 9241 if ( s.responseFields[ current ] ) { 9242 jqXHR[ s.responseFields[ current ] ] = response; 9243 } 9244 9245 // Apply the dataFilter if provided 9246 if ( !prev && isSuccess && s.dataFilter ) { 9247 response = s.dataFilter( response, s.dataType ); 9248 } 9249 9250 prev = current; 9251 current = dataTypes.shift(); 9252 9253 if ( current ) { 9254 9255 // There's only work to do if current dataType is non-auto 9256 if ( current === "*" ) { 9257 9258 current = prev; 9259 9260 // Convert response if prev dataType is non-auto and differs from current 9261 } else if ( prev !== "*" && prev !== current ) { 9262 9263 // Seek a direct converter 9264 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9265 9266 // If none found, seek a pair 9267 if ( !conv ) { 9268 for ( conv2 in converters ) { 9269 9270 // If conv2 outputs current 9271 tmp = conv2.split( " " ); 9272 if ( tmp[ 1 ] === current ) { 9273 9274 // If prev can be converted to accepted input 9275 conv = converters[ prev + " " + tmp[ 0 ] ] || 9276 converters[ "* " + tmp[ 0 ] ]; 9277 if ( conv ) { 9278 9279 // Condense equivalence converters 9280 if ( conv === true ) { 9281 conv = converters[ conv2 ]; 9282 9283 // Otherwise, insert the intermediate dataType 9284 } else if ( converters[ conv2 ] !== true ) { 9285 current = tmp[ 0 ]; 9286 dataTypes.unshift( tmp[ 1 ] ); 9287 } 9288 break; 9289 } 9290 } 9291 } 9292 } 9293 9294 // Apply converter (if not an equivalence) 9295 if ( conv !== true ) { 9296 9297 // Unless errors are allowed to bubble, catch and return them 9298 if ( conv && s.throws ) { 9299 response = conv( response ); 9300 } else { 9301 try { 9302 response = conv( response ); 9303 } catch ( e ) { 9304 return { 9305 state: "parsererror", 9306 error: conv ? e : "No conversion from " + prev + " to " + current 9307 }; 9308 } 9309 } 9310 } 9311 } 9312 } 9313 } 9314 9315 return { state: "success", data: response }; 9316} 9317 9318jQuery.extend( { 9319 9320 // Counter for holding the number of active queries 9321 active: 0, 9322 9323 // Last-Modified header cache for next request 9324 lastModified: {}, 9325 etag: {}, 9326 9327 ajaxSettings: { 9328 url: location.href, 9329 type: "GET", 9330 isLocal: rlocalProtocol.test( location.protocol ), 9331 global: true, 9332 processData: true, 9333 async: true, 9334 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9335 9336 /* 9337 timeout: 0, 9338 data: null, 9339 dataType: null, 9340 username: null, 9341 password: null, 9342 cache: null, 9343 throws: false, 9344 traditional: false, 9345 headers: {}, 9346 */ 9347 9348 accepts: { 9349 "*": allTypes, 9350 text: "text/plain", 9351 html: "text/html", 9352 xml: "application/xml, text/xml", 9353 json: "application/json, text/javascript" 9354 }, 9355 9356 contents: { 9357 xml: /\bxml\b/, 9358 html: /\bhtml/, 9359 json: /\bjson\b/ 9360 }, 9361 9362 responseFields: { 9363 xml: "responseXML", 9364 text: "responseText", 9365 json: "responseJSON" 9366 }, 9367 9368 // Data converters 9369 // Keys separate source (or catchall "*") and destination types with a single space 9370 converters: { 9371 9372 // Convert anything to text 9373 "* text": String, 9374 9375 // Text to html (true = no transformation) 9376 "text html": true, 9377 9378 // Evaluate text as a json expression 9379 "text json": JSON.parse, 9380 9381 // Parse text as xml 9382 "text xml": jQuery.parseXML 9383 }, 9384 9385 // For options that shouldn't be deep extended: 9386 // you can add your own custom options here if 9387 // and when you create one that shouldn't be 9388 // deep extended (see ajaxExtend) 9389 flatOptions: { 9390 url: true, 9391 context: true 9392 } 9393 }, 9394 9395 // Creates a full fledged settings object into target 9396 // with both ajaxSettings and settings fields. 9397 // If target is omitted, writes into ajaxSettings. 9398 ajaxSetup: function( target, settings ) { 9399 return settings ? 9400 9401 // Building a settings object 9402 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9403 9404 // Extending ajaxSettings 9405 ajaxExtend( jQuery.ajaxSettings, target ); 9406 }, 9407 9408 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9409 ajaxTransport: addToPrefiltersOrTransports( transports ), 9410 9411 // Main method 9412 ajax: function( url, options ) { 9413 9414 // If url is an object, simulate pre-1.5 signature 9415 if ( typeof url === "object" ) { 9416 options = url; 9417 url = undefined; 9418 } 9419 9420 // Force options to be an object 9421 options = options || {}; 9422 9423 var transport, 9424 9425 // URL without anti-cache param 9426 cacheURL, 9427 9428 // Response headers 9429 responseHeadersString, 9430 responseHeaders, 9431 9432 // timeout handle 9433 timeoutTimer, 9434 9435 // Url cleanup var 9436 urlAnchor, 9437 9438 // Request state (becomes false upon send and true upon completion) 9439 completed, 9440 9441 // To know if global events are to be dispatched 9442 fireGlobals, 9443 9444 // Loop variable 9445 i, 9446 9447 // uncached part of the url 9448 uncached, 9449 9450 // Create the final options object 9451 s = jQuery.ajaxSetup( {}, options ), 9452 9453 // Callbacks context 9454 callbackContext = s.context || s, 9455 9456 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9457 globalEventContext = s.context && 9458 ( callbackContext.nodeType || callbackContext.jquery ) ? 9459 jQuery( callbackContext ) : 9460 jQuery.event, 9461 9462 // Deferreds 9463 deferred = jQuery.Deferred(), 9464 completeDeferred = jQuery.Callbacks( "once memory" ), 9465 9466 // Status-dependent callbacks 9467 statusCode = s.statusCode || {}, 9468 9469 // Headers (they are sent all at once) 9470 requestHeaders = {}, 9471 requestHeadersNames = {}, 9472 9473 // Default abort message 9474 strAbort = "canceled", 9475 9476 // Fake xhr 9477 jqXHR = { 9478 readyState: 0, 9479 9480 // Builds headers hashtable if needed 9481 getResponseHeader: function( key ) { 9482 var match; 9483 if ( completed ) { 9484 if ( !responseHeaders ) { 9485 responseHeaders = {}; 9486 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9487 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9488 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9489 .concat( match[ 2 ] ); 9490 } 9491 } 9492 match = responseHeaders[ key.toLowerCase() + " " ]; 9493 } 9494 return match == null ? null : match.join( ", " ); 9495 }, 9496 9497 // Raw string 9498 getAllResponseHeaders: function() { 9499 return completed ? responseHeadersString : null; 9500 }, 9501 9502 // Caches the header 9503 setRequestHeader: function( name, value ) { 9504 if ( completed == null ) { 9505 name = requestHeadersNames[ name.toLowerCase() ] = 9506 requestHeadersNames[ name.toLowerCase() ] || name; 9507 requestHeaders[ name ] = value; 9508 } 9509 return this; 9510 }, 9511 9512 // Overrides response content-type header 9513 overrideMimeType: function( type ) { 9514 if ( completed == null ) { 9515 s.mimeType = type; 9516 } 9517 return this; 9518 }, 9519 9520 // Status-dependent callbacks 9521 statusCode: function( map ) { 9522 var code; 9523 if ( map ) { 9524 if ( completed ) { 9525 9526 // Execute the appropriate callbacks 9527 jqXHR.always( map[ jqXHR.status ] ); 9528 } else { 9529 9530 // Lazy-add the new callbacks in a way that preserves old ones 9531 for ( code in map ) { 9532 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9533 } 9534 } 9535 } 9536 return this; 9537 }, 9538 9539 // Cancel the request 9540 abort: function( statusText ) { 9541 var finalText = statusText || strAbort; 9542 if ( transport ) { 9543 transport.abort( finalText ); 9544 } 9545 done( 0, finalText ); 9546 return this; 9547 } 9548 }; 9549 9550 // Attach deferreds 9551 deferred.promise( jqXHR ); 9552 9553 // Add protocol if not provided (prefilters might expect it) 9554 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9555 // We also use the url parameter if available 9556 s.url = ( ( url || s.url || location.href ) + "" ) 9557 .replace( rprotocol, location.protocol + "//" ); 9558 9559 // Alias method option to type as per ticket trac-12004 9560 s.type = options.method || options.type || s.method || s.type; 9561 9562 // Extract dataTypes list 9563 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9564 9565 // A cross-domain request is in order when the origin doesn't match the current origin. 9566 if ( s.crossDomain == null ) { 9567 urlAnchor = document.createElement( "a" ); 9568 9569 // Support: IE <=8 - 11, Edge 12 - 15 9570 // IE throws exception on accessing the href property if url is malformed, 9571 // e.g. http://example.com:80x/ 9572 try { 9573 urlAnchor.href = s.url; 9574 9575 // Support: IE <=8 - 11 only 9576 // Anchor's host property isn't correctly set when s.url is relative 9577 urlAnchor.href = urlAnchor.href; 9578 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9579 urlAnchor.protocol + "//" + urlAnchor.host; 9580 } catch ( e ) { 9581 9582 // If there is an error parsing the URL, assume it is crossDomain, 9583 // it can be rejected by the transport if it is invalid 9584 s.crossDomain = true; 9585 } 9586 } 9587 9588 // Convert data if not already a string 9589 if ( s.data && s.processData && typeof s.data !== "string" ) { 9590 s.data = jQuery.param( s.data, s.traditional ); 9591 } 9592 9593 // Apply prefilters 9594 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9595 9596 // If request was aborted inside a prefilter, stop there 9597 if ( completed ) { 9598 return jqXHR; 9599 } 9600 9601 // We can fire global events as of now if asked to 9602 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9603 fireGlobals = jQuery.event && s.global; 9604 9605 // Watch for a new set of requests 9606 if ( fireGlobals && jQuery.active++ === 0 ) { 9607 jQuery.event.trigger( "ajaxStart" ); 9608 } 9609 9610 // Uppercase the type 9611 s.type = s.type.toUpperCase(); 9612 9613 // Determine if request has content 9614 s.hasContent = !rnoContent.test( s.type ); 9615 9616 // Save the URL in case we're toying with the If-Modified-Since 9617 // and/or If-None-Match header later on 9618 // Remove hash to simplify url manipulation 9619 cacheURL = s.url.replace( rhash, "" ); 9620 9621 // More options handling for requests with no content 9622 if ( !s.hasContent ) { 9623 9624 // Remember the hash so we can put it back 9625 uncached = s.url.slice( cacheURL.length ); 9626 9627 // If data is available and should be processed, append data to url 9628 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9629 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9630 9631 // trac-9682: remove data so that it's not used in an eventual retry 9632 delete s.data; 9633 } 9634 9635 // Add or update anti-cache param if needed 9636 if ( s.cache === false ) { 9637 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9638 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9639 uncached; 9640 } 9641 9642 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9643 s.url = cacheURL + uncached; 9644 9645 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9646 } else if ( s.data && s.processData && 9647 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9648 s.data = s.data.replace( r20, "+" ); 9649 } 9650 9651 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9652 if ( s.ifModified ) { 9653 if ( jQuery.lastModified[ cacheURL ] ) { 9654 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9655 } 9656 if ( jQuery.etag[ cacheURL ] ) { 9657 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9658 } 9659 } 9660 9661 // Set the correct header, if data is being sent 9662 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9663 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9664 } 9665 9666 // Set the Accepts header for the server, depending on the dataType 9667 jqXHR.setRequestHeader( 9668 "Accept", 9669 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9670 s.accepts[ s.dataTypes[ 0 ] ] + 9671 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9672 s.accepts[ "*" ] 9673 ); 9674 9675 // Check for headers option 9676 for ( i in s.headers ) { 9677 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9678 } 9679 9680 // Allow custom headers/mimetypes and early abort 9681 if ( s.beforeSend && 9682 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9683 9684 // Abort if not done already and return 9685 return jqXHR.abort(); 9686 } 9687 9688 // Aborting is no longer a cancellation 9689 strAbort = "abort"; 9690 9691 // Install callbacks on deferreds 9692 completeDeferred.add( s.complete ); 9693 jqXHR.done( s.success ); 9694 jqXHR.fail( s.error ); 9695 9696 // Get transport 9697 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9698 9699 // If no transport, we auto-abort 9700 if ( !transport ) { 9701 done( -1, "No Transport" ); 9702 } else { 9703 jqXHR.readyState = 1; 9704 9705 // Send global event 9706 if ( fireGlobals ) { 9707 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9708 } 9709 9710 // If request was aborted inside ajaxSend, stop there 9711 if ( completed ) { 9712 return jqXHR; 9713 } 9714 9715 // Timeout 9716 if ( s.async && s.timeout > 0 ) { 9717 timeoutTimer = window.setTimeout( function() { 9718 jqXHR.abort( "timeout" ); 9719 }, s.timeout ); 9720 } 9721 9722 try { 9723 completed = false; 9724 transport.send( requestHeaders, done ); 9725 } catch ( e ) { 9726 9727 // Rethrow post-completion exceptions 9728 if ( completed ) { 9729 throw e; 9730 } 9731 9732 // Propagate others as results 9733 done( -1, e ); 9734 } 9735 } 9736 9737 // Callback for when everything is done 9738 function done( status, nativeStatusText, responses, headers ) { 9739 var isSuccess, success, error, response, modified, 9740 statusText = nativeStatusText; 9741 9742 // Ignore repeat invocations 9743 if ( completed ) { 9744 return; 9745 } 9746 9747 completed = true; 9748 9749 // Clear timeout if it exists 9750 if ( timeoutTimer ) { 9751 window.clearTimeout( timeoutTimer ); 9752 } 9753 9754 // Dereference transport for early garbage collection 9755 // (no matter how long the jqXHR object will be used) 9756 transport = undefined; 9757 9758 // Cache response headers 9759 responseHeadersString = headers || ""; 9760 9761 // Set readyState 9762 jqXHR.readyState = status > 0 ? 4 : 0; 9763 9764 // Determine if successful 9765 isSuccess = status >= 200 && status < 300 || status === 304; 9766 9767 // Get response data 9768 if ( responses ) { 9769 response = ajaxHandleResponses( s, jqXHR, responses ); 9770 } 9771 9772 // Use a noop converter for missing script but not if jsonp 9773 if ( !isSuccess && 9774 jQuery.inArray( "script", s.dataTypes ) > -1 && 9775 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9776 s.converters[ "text script" ] = function() {}; 9777 } 9778 9779 // Convert no matter what (that way responseXXX fields are always set) 9780 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9781 9782 // If successful, handle type chaining 9783 if ( isSuccess ) { 9784 9785 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9786 if ( s.ifModified ) { 9787 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9788 if ( modified ) { 9789 jQuery.lastModified[ cacheURL ] = modified; 9790 } 9791 modified = jqXHR.getResponseHeader( "etag" ); 9792 if ( modified ) { 9793 jQuery.etag[ cacheURL ] = modified; 9794 } 9795 } 9796 9797 // if no content 9798 if ( status === 204 || s.type === "HEAD" ) { 9799 statusText = "nocontent"; 9800 9801 // if not modified 9802 } else if ( status === 304 ) { 9803 statusText = "notmodified"; 9804 9805 // If we have data, let's convert it 9806 } else { 9807 statusText = response.state; 9808 success = response.data; 9809 error = response.error; 9810 isSuccess = !error; 9811 } 9812 } else { 9813 9814 // Extract error from statusText and normalize for non-aborts 9815 error = statusText; 9816 if ( status || !statusText ) { 9817 statusText = "error"; 9818 if ( status < 0 ) { 9819 status = 0; 9820 } 9821 } 9822 } 9823 9824 // Set data for the fake xhr object 9825 jqXHR.status = status; 9826 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9827 9828 // Success/Error 9829 if ( isSuccess ) { 9830 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9831 } else { 9832 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9833 } 9834 9835 // Status-dependent callbacks 9836 jqXHR.statusCode( statusCode ); 9837 statusCode = undefined; 9838 9839 if ( fireGlobals ) { 9840 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9841 [ jqXHR, s, isSuccess ? success : error ] ); 9842 } 9843 9844 // Complete 9845 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9846 9847 if ( fireGlobals ) { 9848 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9849 9850 // Handle the global AJAX counter 9851 if ( !( --jQuery.active ) ) { 9852 jQuery.event.trigger( "ajaxStop" ); 9853 } 9854 } 9855 } 9856 9857 return jqXHR; 9858 }, 9859 9860 getJSON: function( url, data, callback ) { 9861 return jQuery.get( url, data, callback, "json" ); 9862 }, 9863 9864 getScript: function( url, callback ) { 9865 return jQuery.get( url, undefined, callback, "script" ); 9866 } 9867} ); 9868 9869jQuery.each( [ "get", "post" ], function( _i, method ) { 9870 jQuery[ method ] = function( url, data, callback, type ) { 9871 9872 // Shift arguments if data argument was omitted 9873 if ( isFunction( data ) ) { 9874 type = type || callback; 9875 callback = data; 9876 data = undefined; 9877 } 9878 9879 // The url can be an options object (which then must have .url) 9880 return jQuery.ajax( jQuery.extend( { 9881 url: url, 9882 type: method, 9883 dataType: type, 9884 data: data, 9885 success: callback 9886 }, jQuery.isPlainObject( url ) && url ) ); 9887 }; 9888} ); 9889 9890jQuery.ajaxPrefilter( function( s ) { 9891 var i; 9892 for ( i in s.headers ) { 9893 if ( i.toLowerCase() === "content-type" ) { 9894 s.contentType = s.headers[ i ] || ""; 9895 } 9896 } 9897} ); 9898 9899 9900jQuery._evalUrl = function( url, options, doc ) { 9901 return jQuery.ajax( { 9902 url: url, 9903 9904 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9905 type: "GET", 9906 dataType: "script", 9907 cache: true, 9908 async: false, 9909 global: false, 9910 9911 // Only evaluate the response if it is successful (gh-4126) 9912 // dataFilter is not invoked for failure responses, so using it instead 9913 // of the default converter is kludgy but it works. 9914 converters: { 9915 "text script": function() {} 9916 }, 9917 dataFilter: function( response ) { 9918 jQuery.globalEval( response, options, doc ); 9919 } 9920 } ); 9921}; 9922 9923 9924jQuery.fn.extend( { 9925 wrapAll: function( html ) { 9926 var wrap; 9927 9928 if ( this[ 0 ] ) { 9929 if ( isFunction( html ) ) { 9930 html = html.call( this[ 0 ] ); 9931 } 9932 9933 // The elements to wrap the target around 9934 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9935 9936 if ( this[ 0 ].parentNode ) { 9937 wrap.insertBefore( this[ 0 ] ); 9938 } 9939 9940 wrap.map( function() { 9941 var elem = this; 9942 9943 while ( elem.firstElementChild ) { 9944 elem = elem.firstElementChild; 9945 } 9946 9947 return elem; 9948 } ).append( this ); 9949 } 9950 9951 return this; 9952 }, 9953 9954 wrapInner: function( html ) { 9955 if ( isFunction( html ) ) { 9956 return this.each( function( i ) { 9957 jQuery( this ).wrapInner( html.call( this, i ) ); 9958 } ); 9959 } 9960 9961 return this.each( function() { 9962 var self = jQuery( this ), 9963 contents = self.contents(); 9964 9965 if ( contents.length ) { 9966 contents.wrapAll( html ); 9967 9968 } else { 9969 self.append( html ); 9970 } 9971 } ); 9972 }, 9973 9974 wrap: function( html ) { 9975 var htmlIsFunction = isFunction( html ); 9976 9977 return this.each( function( i ) { 9978 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9979 } ); 9980 }, 9981 9982 unwrap: function( selector ) { 9983 this.parent( selector ).not( "body" ).each( function() { 9984 jQuery( this ).replaceWith( this.childNodes ); 9985 } ); 9986 return this; 9987 } 9988} ); 9989 9990 9991jQuery.expr.pseudos.hidden = function( elem ) { 9992 return !jQuery.expr.pseudos.visible( elem ); 9993}; 9994jQuery.expr.pseudos.visible = function( elem ) { 9995 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9996}; 9997 9998 9999 10000 10001jQuery.ajaxSettings.xhr = function() { 10002 try { 10003 return new window.XMLHttpRequest(); 10004 } catch ( e ) {} 10005}; 10006 10007var xhrSuccessStatus = { 10008 10009 // File protocol always yields status code 0, assume 200 10010 0: 200, 10011 10012 // Support: IE <=9 only 10013 // trac-1450: sometimes IE returns 1223 when it should be 204 10014 1223: 204 10015 }, 10016 xhrSupported = jQuery.ajaxSettings.xhr(); 10017 10018support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10019support.ajax = xhrSupported = !!xhrSupported; 10020 10021jQuery.ajaxTransport( function( options ) { 10022 var callback, errorCallback; 10023 10024 // Cross domain only allowed if supported through XMLHttpRequest 10025 if ( support.cors || xhrSupported && !options.crossDomain ) { 10026 return { 10027 send: function( headers, complete ) { 10028 var i, 10029 xhr = options.xhr(); 10030 10031 xhr.open( 10032 options.type, 10033 options.url, 10034 options.async, 10035 options.username, 10036 options.password 10037 ); 10038 10039 // Apply custom fields if provided 10040 if ( options.xhrFields ) { 10041 for ( i in options.xhrFields ) { 10042 xhr[ i ] = options.xhrFields[ i ]; 10043 } 10044 } 10045 10046 // Override mime type if needed 10047 if ( options.mimeType && xhr.overrideMimeType ) { 10048 xhr.overrideMimeType( options.mimeType ); 10049 } 10050 10051 // X-Requested-With header 10052 // For cross-domain requests, seeing as conditions for a preflight are 10053 // akin to a jigsaw puzzle, we simply never set it to be sure. 10054 // (it can always be set on a per-request basis or even using ajaxSetup) 10055 // For same-domain requests, won't change header if already provided. 10056 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10057 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10058 } 10059 10060 // Set headers 10061 for ( i in headers ) { 10062 xhr.setRequestHeader( i, headers[ i ] ); 10063 } 10064 10065 // Callback 10066 callback = function( type ) { 10067 return function() { 10068 if ( callback ) { 10069 callback = errorCallback = xhr.onload = 10070 xhr.onerror = xhr.onabort = xhr.ontimeout = 10071 xhr.onreadystatechange = null; 10072 10073 if ( type === "abort" ) { 10074 xhr.abort(); 10075 } else if ( type === "error" ) { 10076 10077 // Support: IE <=9 only 10078 // On a manual native abort, IE9 throws 10079 // errors on any property access that is not readyState 10080 if ( typeof xhr.status !== "number" ) { 10081 complete( 0, "error" ); 10082 } else { 10083 complete( 10084 10085 // File: protocol always yields status 0; see trac-8605, trac-14207 10086 xhr.status, 10087 xhr.statusText 10088 ); 10089 } 10090 } else { 10091 complete( 10092 xhrSuccessStatus[ xhr.status ] || xhr.status, 10093 xhr.statusText, 10094 10095 // Support: IE <=9 only 10096 // IE9 has no XHR2 but throws on binary (trac-11426) 10097 // For XHR2 non-text, let the caller handle it (gh-2498) 10098 ( xhr.responseType || "text" ) !== "text" || 10099 typeof xhr.responseText !== "string" ? 10100 { binary: xhr.response } : 10101 { text: xhr.responseText }, 10102 xhr.getAllResponseHeaders() 10103 ); 10104 } 10105 } 10106 }; 10107 }; 10108 10109 // Listen to events 10110 xhr.onload = callback(); 10111 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10112 10113 // Support: IE 9 only 10114 // Use onreadystatechange to replace onabort 10115 // to handle uncaught aborts 10116 if ( xhr.onabort !== undefined ) { 10117 xhr.onabort = errorCallback; 10118 } else { 10119 xhr.onreadystatechange = function() { 10120 10121 // Check readyState before timeout as it changes 10122 if ( xhr.readyState === 4 ) { 10123 10124 // Allow onerror to be called first, 10125 // but that will not handle a native abort 10126 // Also, save errorCallback to a variable 10127 // as xhr.onerror cannot be accessed 10128 window.setTimeout( function() { 10129 if ( callback ) { 10130 errorCallback(); 10131 } 10132 } ); 10133 } 10134 }; 10135 } 10136 10137 // Create the abort callback 10138 callback = callback( "abort" ); 10139 10140 try { 10141 10142 // Do send the request (this may raise an exception) 10143 xhr.send( options.hasContent && options.data || null ); 10144 } catch ( e ) { 10145 10146 // trac-14683: Only rethrow if this hasn't been notified as an error yet 10147 if ( callback ) { 10148 throw e; 10149 } 10150 } 10151 }, 10152 10153 abort: function() { 10154 if ( callback ) { 10155 callback(); 10156 } 10157 } 10158 }; 10159 } 10160} ); 10161 10162 10163 10164 10165// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10166jQuery.ajaxPrefilter( function( s ) { 10167 if ( s.crossDomain ) { 10168 s.contents.script = false; 10169 } 10170} ); 10171 10172// Install script dataType 10173jQuery.ajaxSetup( { 10174 accepts: { 10175 script: "text/javascript, application/javascript, " + 10176 "application/ecmascript, application/x-ecmascript" 10177 }, 10178 contents: { 10179 script: /\b(?:java|ecma)script\b/ 10180 }, 10181 converters: { 10182 "text script": function( text ) { 10183 jQuery.globalEval( text ); 10184 return text; 10185 } 10186 } 10187} ); 10188 10189// Handle cache's special case and crossDomain 10190jQuery.ajaxPrefilter( "script", function( s ) { 10191 if ( s.cache === undefined ) { 10192 s.cache = false; 10193 } 10194 if ( s.crossDomain ) { 10195 s.type = "GET"; 10196 } 10197} ); 10198 10199// Bind script tag hack transport 10200jQuery.ajaxTransport( "script", function( s ) { 10201 10202 // This transport only deals with cross domain or forced-by-attrs requests 10203 if ( s.crossDomain || s.scriptAttrs ) { 10204 var script, callback; 10205 return { 10206 send: function( _, complete ) { 10207 script = jQuery( "<script>" ) 10208 .attr( s.scriptAttrs || {} ) 10209 .prop( { charset: s.scriptCharset, src: s.url } ) 10210 .on( "load error", callback = function( evt ) { 10211 script.remove(); 10212 callback = null; 10213 if ( evt ) { 10214 complete( evt.type === "error" ? 404 : 200, evt.type ); 10215 } 10216 } ); 10217 10218 // Use native DOM manipulation to avoid our domManip AJAX trickery 10219 document.head.appendChild( script[ 0 ] ); 10220 }, 10221 abort: function() { 10222 if ( callback ) { 10223 callback(); 10224 } 10225 } 10226 }; 10227 } 10228} ); 10229 10230 10231 10232 10233var oldCallbacks = [], 10234 rjsonp = /(=)\?(?=&|$)|\?\?/; 10235 10236// Default jsonp settings 10237jQuery.ajaxSetup( { 10238 jsonp: "callback", 10239 jsonpCallback: function() { 10240 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10241 this[ callback ] = true; 10242 return callback; 10243 } 10244} ); 10245 10246// Detect, normalize options and install callbacks for jsonp requests 10247jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10248 10249 var callbackName, overwritten, responseContainer, 10250 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10251 "url" : 10252 typeof s.data === "string" && 10253 ( s.contentType || "" ) 10254 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10255 rjsonp.test( s.data ) && "data" 10256 ); 10257 10258 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10259 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10260 10261 // Get callback name, remembering preexisting value associated with it 10262 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10263 s.jsonpCallback() : 10264 s.jsonpCallback; 10265 10266 // Insert callback into url or form data 10267 if ( jsonProp ) { 10268 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10269 } else if ( s.jsonp !== false ) { 10270 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10271 } 10272 10273 // Use data converter to retrieve json after script execution 10274 s.converters[ "script json" ] = function() { 10275 if ( !responseContainer ) { 10276 jQuery.error( callbackName + " was not called" ); 10277 } 10278 return responseContainer[ 0 ]; 10279 }; 10280 10281 // Force json dataType 10282 s.dataTypes[ 0 ] = "json"; 10283 10284 // Install callback 10285 overwritten = window[ callbackName ]; 10286 window[ callbackName ] = function() { 10287 responseContainer = arguments; 10288 }; 10289 10290 // Clean-up function (fires after converters) 10291 jqXHR.always( function() { 10292 10293 // If previous value didn't exist - remove it 10294 if ( overwritten === undefined ) { 10295 jQuery( window ).removeProp( callbackName ); 10296 10297 // Otherwise restore preexisting value 10298 } else { 10299 window[ callbackName ] = overwritten; 10300 } 10301 10302 // Save back as free 10303 if ( s[ callbackName ] ) { 10304 10305 // Make sure that re-using the options doesn't screw things around 10306 s.jsonpCallback = originalSettings.jsonpCallback; 10307 10308 // Save the callback name for future use 10309 oldCallbacks.push( callbackName ); 10310 } 10311 10312 // Call if it was a function and we have a response 10313 if ( responseContainer && isFunction( overwritten ) ) { 10314 overwritten( responseContainer[ 0 ] ); 10315 } 10316 10317 responseContainer = overwritten = undefined; 10318 } ); 10319 10320 // Delegate to script 10321 return "script"; 10322 } 10323} ); 10324 10325 10326 10327 10328// Support: Safari 8 only 10329// In Safari 8 documents created via document.implementation.createHTMLDocument 10330// collapse sibling forms: the second one becomes a child of the first one. 10331// Because of that, this security measure has to be disabled in Safari 8. 10332// https://bugs.webkit.org/show_bug.cgi?id=137337 10333support.createHTMLDocument = ( function() { 10334 var body = document.implementation.createHTMLDocument( "" ).body; 10335 body.innerHTML = "<form></form><form></form>"; 10336 return body.childNodes.length === 2; 10337} )(); 10338 10339 10340// Argument "data" should be string of html 10341// context (optional): If specified, the fragment will be created in this context, 10342// defaults to document 10343// keepScripts (optional): If true, will include scripts passed in the html string 10344jQuery.parseHTML = function( data, context, keepScripts ) { 10345 if ( typeof data !== "string" ) { 10346 return []; 10347 } 10348 if ( typeof context === "boolean" ) { 10349 keepScripts = context; 10350 context = false; 10351 } 10352 10353 var base, parsed, scripts; 10354 10355 if ( !context ) { 10356 10357 // Stop scripts or inline event handlers from being executed immediately 10358 // by using document.implementation 10359 if ( support.createHTMLDocument ) { 10360 context = document.implementation.createHTMLDocument( "" ); 10361 10362 // Set the base href for the created document 10363 // so any parsed elements with URLs 10364 // are based on the document's URL (gh-2965) 10365 base = context.createElement( "base" ); 10366 base.href = document.location.href; 10367 context.head.appendChild( base ); 10368 } else { 10369 context = document; 10370 } 10371 } 10372 10373 parsed = rsingleTag.exec( data ); 10374 scripts = !keepScripts && []; 10375 10376 // Single tag 10377 if ( parsed ) { 10378 return [ context.createElement( parsed[ 1 ] ) ]; 10379 } 10380 10381 parsed = buildFragment( [ data ], context, scripts ); 10382 10383 if ( scripts && scripts.length ) { 10384 jQuery( scripts ).remove(); 10385 } 10386 10387 return jQuery.merge( [], parsed.childNodes ); 10388}; 10389 10390 10391/** 10392 * Load a url into a page 10393 */ 10394jQuery.fn.load = function( url, params, callback ) { 10395 var selector, type, response, 10396 self = this, 10397 off = url.indexOf( " " ); 10398 10399 if ( off > -1 ) { 10400 selector = stripAndCollapse( url.slice( off ) ); 10401 url = url.slice( 0, off ); 10402 } 10403 10404 // If it's a function 10405 if ( isFunction( params ) ) { 10406 10407 // We assume that it's the callback 10408 callback = params; 10409 params = undefined; 10410 10411 // Otherwise, build a param string 10412 } else if ( params && typeof params === "object" ) { 10413 type = "POST"; 10414 } 10415 10416 // If we have elements to modify, make the request 10417 if ( self.length > 0 ) { 10418 jQuery.ajax( { 10419 url: url, 10420 10421 // If "type" variable is undefined, then "GET" method will be used. 10422 // Make value of this field explicit since 10423 // user can override it through ajaxSetup method 10424 type: type || "GET", 10425 dataType: "html", 10426 data: params 10427 } ).done( function( responseText ) { 10428 10429 // Save response for use in complete callback 10430 response = arguments; 10431 10432 self.html( selector ? 10433 10434 // If a selector was specified, locate the right elements in a dummy div 10435 // Exclude scripts to avoid IE 'Permission Denied' errors 10436 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10437 10438 // Otherwise use the full result 10439 responseText ); 10440 10441 // If the request succeeds, this function gets "data", "status", "jqXHR" 10442 // but they are ignored because response was set above. 10443 // If it fails, this function gets "jqXHR", "status", "error" 10444 } ).always( callback && function( jqXHR, status ) { 10445 self.each( function() { 10446 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10447 } ); 10448 } ); 10449 } 10450 10451 return this; 10452}; 10453 10454 10455 10456 10457jQuery.expr.pseudos.animated = function( elem ) { 10458 return jQuery.grep( jQuery.timers, function( fn ) { 10459 return elem === fn.elem; 10460 } ).length; 10461}; 10462 10463 10464 10465 10466jQuery.offset = { 10467 setOffset: function( elem, options, i ) { 10468 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10469 position = jQuery.css( elem, "position" ), 10470 curElem = jQuery( elem ), 10471 props = {}; 10472 10473 // Set position first, in-case top/left are set even on static elem 10474 if ( position === "static" ) { 10475 elem.style.position = "relative"; 10476 } 10477 10478 curOffset = curElem.offset(); 10479 curCSSTop = jQuery.css( elem, "top" ); 10480 curCSSLeft = jQuery.css( elem, "left" ); 10481 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10482 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10483 10484 // Need to be able to calculate position if either 10485 // top or left is auto and position is either absolute or fixed 10486 if ( calculatePosition ) { 10487 curPosition = curElem.position(); 10488 curTop = curPosition.top; 10489 curLeft = curPosition.left; 10490 10491 } else { 10492 curTop = parseFloat( curCSSTop ) || 0; 10493 curLeft = parseFloat( curCSSLeft ) || 0; 10494 } 10495 10496 if ( isFunction( options ) ) { 10497 10498 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10499 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10500 } 10501 10502 if ( options.top != null ) { 10503 props.top = ( options.top - curOffset.top ) + curTop; 10504 } 10505 if ( options.left != null ) { 10506 props.left = ( options.left - curOffset.left ) + curLeft; 10507 } 10508 10509 if ( "using" in options ) { 10510 options.using.call( elem, props ); 10511 10512 } else { 10513 curElem.css( props ); 10514 } 10515 } 10516}; 10517 10518jQuery.fn.extend( { 10519 10520 // offset() relates an element's border box to the document origin 10521 offset: function( options ) { 10522 10523 // Preserve chaining for setter 10524 if ( arguments.length ) { 10525 return options === undefined ? 10526 this : 10527 this.each( function( i ) { 10528 jQuery.offset.setOffset( this, options, i ); 10529 } ); 10530 } 10531 10532 var rect, win, 10533 elem = this[ 0 ]; 10534 10535 if ( !elem ) { 10536 return; 10537 } 10538 10539 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10540 // Support: IE <=11 only 10541 // Running getBoundingClientRect on a 10542 // disconnected node in IE throws an error 10543 if ( !elem.getClientRects().length ) { 10544 return { top: 0, left: 0 }; 10545 } 10546 10547 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10548 rect = elem.getBoundingClientRect(); 10549 win = elem.ownerDocument.defaultView; 10550 return { 10551 top: rect.top + win.pageYOffset, 10552 left: rect.left + win.pageXOffset 10553 }; 10554 }, 10555 10556 // position() relates an element's margin box to its offset parent's padding box 10557 // This corresponds to the behavior of CSS absolute positioning 10558 position: function() { 10559 if ( !this[ 0 ] ) { 10560 return; 10561 } 10562 10563 var offsetParent, offset, doc, 10564 elem = this[ 0 ], 10565 parentOffset = { top: 0, left: 0 }; 10566 10567 // position:fixed elements are offset from the viewport, which itself always has zero offset 10568 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10569 10570 // Assume position:fixed implies availability of getBoundingClientRect 10571 offset = elem.getBoundingClientRect(); 10572 10573 } else { 10574 offset = this.offset(); 10575 10576 // Account for the *real* offset parent, which can be the document or its root element 10577 // when a statically positioned element is identified 10578 doc = elem.ownerDocument; 10579 offsetParent = elem.offsetParent || doc.documentElement; 10580 while ( offsetParent && 10581 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10582 jQuery.css( offsetParent, "position" ) === "static" ) { 10583 10584 offsetParent = offsetParent.parentNode; 10585 } 10586 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10587 10588 // Incorporate borders into its offset, since they are outside its content origin 10589 parentOffset = jQuery( offsetParent ).offset(); 10590 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10591 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10592 } 10593 } 10594 10595 // Subtract parent offsets and element margins 10596 return { 10597 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10598 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10599 }; 10600 }, 10601 10602 // This method will return documentElement in the following cases: 10603 // 1) For the element inside the iframe without offsetParent, this method will return 10604 // documentElement of the parent window 10605 // 2) For the hidden or detached element 10606 // 3) For body or html element, i.e. in case of the html node - it will return itself 10607 // 10608 // but those exceptions were never presented as a real life use-cases 10609 // and might be considered as more preferable results. 10610 // 10611 // This logic, however, is not guaranteed and can change at any point in the future 10612 offsetParent: function() { 10613 return this.map( function() { 10614 var offsetParent = this.offsetParent; 10615 10616 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10617 offsetParent = offsetParent.offsetParent; 10618 } 10619 10620 return offsetParent || documentElement; 10621 } ); 10622 } 10623} ); 10624 10625// Create scrollLeft and scrollTop methods 10626jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10627 var top = "pageYOffset" === prop; 10628 10629 jQuery.fn[ method ] = function( val ) { 10630 return access( this, function( elem, method, val ) { 10631 10632 // Coalesce documents and windows 10633 var win; 10634 if ( isWindow( elem ) ) { 10635 win = elem; 10636 } else if ( elem.nodeType === 9 ) { 10637 win = elem.defaultView; 10638 } 10639 10640 if ( val === undefined ) { 10641 return win ? win[ prop ] : elem[ method ]; 10642 } 10643 10644 if ( win ) { 10645 win.scrollTo( 10646 !top ? val : win.pageXOffset, 10647 top ? val : win.pageYOffset 10648 ); 10649 10650 } else { 10651 elem[ method ] = val; 10652 } 10653 }, method, val, arguments.length ); 10654 }; 10655} ); 10656 10657// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10658// Add the top/left cssHooks using jQuery.fn.position 10659// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10660// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10661// getComputedStyle returns percent when specified for top/left/bottom/right; 10662// rather than make the css module depend on the offset module, just check for it here 10663jQuery.each( [ "top", "left" ], function( _i, prop ) { 10664 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10665 function( elem, computed ) { 10666 if ( computed ) { 10667 computed = curCSS( elem, prop ); 10668 10669 // If curCSS returns percentage, fallback to offset 10670 return rnumnonpx.test( computed ) ? 10671 jQuery( elem ).position()[ prop ] + "px" : 10672 computed; 10673 } 10674 } 10675 ); 10676} ); 10677 10678 10679// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10680jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10681 jQuery.each( { 10682 padding: "inner" + name, 10683 content: type, 10684 "": "outer" + name 10685 }, function( defaultExtra, funcName ) { 10686 10687 // Margin is only for outerHeight, outerWidth 10688 jQuery.fn[ funcName ] = function( margin, value ) { 10689 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10690 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10691 10692 return access( this, function( elem, type, value ) { 10693 var doc; 10694 10695 if ( isWindow( elem ) ) { 10696 10697 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10698 return funcName.indexOf( "outer" ) === 0 ? 10699 elem[ "inner" + name ] : 10700 elem.document.documentElement[ "client" + name ]; 10701 } 10702 10703 // Get document width or height 10704 if ( elem.nodeType === 9 ) { 10705 doc = elem.documentElement; 10706 10707 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10708 // whichever is greatest 10709 return Math.max( 10710 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10711 elem.body[ "offset" + name ], doc[ "offset" + name ], 10712 doc[ "client" + name ] 10713 ); 10714 } 10715 10716 return value === undefined ? 10717 10718 // Get width or height on the element, requesting but not forcing parseFloat 10719 jQuery.css( elem, type, extra ) : 10720 10721 // Set width or height on the element 10722 jQuery.style( elem, type, value, extra ); 10723 }, type, chainable ? margin : undefined, chainable ); 10724 }; 10725 } ); 10726} ); 10727 10728 10729jQuery.each( [ 10730 "ajaxStart", 10731 "ajaxStop", 10732 "ajaxComplete", 10733 "ajaxError", 10734 "ajaxSuccess", 10735 "ajaxSend" 10736], function( _i, type ) { 10737 jQuery.fn[ type ] = function( fn ) { 10738 return this.on( type, fn ); 10739 }; 10740} ); 10741 10742 10743 10744 10745jQuery.fn.extend( { 10746 10747 bind: function( types, data, fn ) { 10748 return this.on( types, null, data, fn ); 10749 }, 10750 unbind: function( types, fn ) { 10751 return this.off( types, null, fn ); 10752 }, 10753 10754 delegate: function( selector, types, data, fn ) { 10755 return this.on( types, selector, data, fn ); 10756 }, 10757 undelegate: function( selector, types, fn ) { 10758 10759 // ( namespace ) or ( selector, types [, fn] ) 10760 return arguments.length === 1 ? 10761 this.off( selector, "**" ) : 10762 this.off( types, selector || "**", fn ); 10763 }, 10764 10765 hover: function( fnOver, fnOut ) { 10766 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10767 } 10768} ); 10769 10770jQuery.each( 10771 ( "blur focus focusin focusout resize scroll click dblclick " + 10772 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10773 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10774 function( _i, name ) { 10775 10776 // Handle event binding 10777 jQuery.fn[ name ] = function( data, fn ) { 10778 return arguments.length > 0 ? 10779 this.on( name, null, data, fn ) : 10780 this.trigger( name ); 10781 }; 10782 } 10783); 10784 10785 10786 10787 10788// Support: Android <=4.0 only 10789// Make sure we trim BOM and NBSP 10790// Require that the "whitespace run" starts from a non-whitespace 10791// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10792var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10793 10794// Bind a function to a context, optionally partially applying any 10795// arguments. 10796// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10797// However, it is not slated for removal any time soon 10798jQuery.proxy = function( fn, context ) { 10799 var tmp, args, proxy; 10800 10801 if ( typeof context === "string" ) { 10802 tmp = fn[ context ]; 10803 context = fn; 10804 fn = tmp; 10805 } 10806 10807 // Quick check to determine if target is callable, in the spec 10808 // this throws a TypeError, but we will just return undefined. 10809 if ( !isFunction( fn ) ) { 10810 return undefined; 10811 } 10812 10813 // Simulated bind 10814 args = slice.call( arguments, 2 ); 10815 proxy = function() { 10816 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10817 }; 10818 10819 // Set the guid of unique handler to the same of original handler, so it can be removed 10820 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10821 10822 return proxy; 10823}; 10824 10825jQuery.holdReady = function( hold ) { 10826 if ( hold ) { 10827 jQuery.readyWait++; 10828 } else { 10829 jQuery.ready( true ); 10830 } 10831}; 10832jQuery.isArray = Array.isArray; 10833jQuery.parseJSON = JSON.parse; 10834jQuery.nodeName = nodeName; 10835jQuery.isFunction = isFunction; 10836jQuery.isWindow = isWindow; 10837jQuery.camelCase = camelCase; 10838jQuery.type = toType; 10839 10840jQuery.now = Date.now; 10841 10842jQuery.isNumeric = function( obj ) { 10843 10844 // As of jQuery 3.0, isNumeric is limited to 10845 // strings and numbers (primitives or objects) 10846 // that can be coerced to finite numbers (gh-2662) 10847 var type = jQuery.type( obj ); 10848 return ( type === "number" || type === "string" ) && 10849 10850 // parseFloat NaNs numeric-cast false positives ("") 10851 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10852 // subtraction forces infinities to NaN 10853 !isNaN( obj - parseFloat( obj ) ); 10854}; 10855 10856jQuery.trim = function( text ) { 10857 return text == null ? 10858 "" : 10859 ( text + "" ).replace( rtrim, "$1" ); 10860}; 10861 10862 10863 10864// Register as a named AMD module, since jQuery can be concatenated with other 10865// files that may use define, but not via a proper concatenation script that 10866// understands anonymous AMD modules. A named AMD is safest and most robust 10867// way to register. Lowercase jquery is used because AMD module names are 10868// derived from file names, and jQuery is normally delivered in a lowercase 10869// file name. Do this after creating the global so that if an AMD module wants 10870// to call noConflict to hide this version of jQuery, it will work. 10871 10872// Note that for maximum portability, libraries that are not jQuery should 10873// declare themselves as anonymous modules, and avoid setting a global if an 10874// AMD loader is present. jQuery is a special case. For more information, see 10875// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10876 10877if ( true ) { 10878 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 10879 return jQuery; 10880 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 10881 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 10882} 10883 10884 10885 10886 10887var 10888 10889 // Map over jQuery in case of overwrite 10890 _jQuery = window.jQuery, 10891 10892 // Map over the $ in case of overwrite 10893 _$ = window.$; 10894 10895jQuery.noConflict = function( deep ) { 10896 if ( window.$ === jQuery ) { 10897 window.$ = _$; 10898 } 10899 10900 if ( deep && window.jQuery === jQuery ) { 10901 window.jQuery = _jQuery; 10902 } 10903 10904 return jQuery; 10905}; 10906 10907// Expose jQuery and $ identifiers, even in AMD 10908// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10909// and CommonJS for browser emulators (trac-13566) 10910if ( typeof noGlobal === "undefined" ) { 10911 window.jQuery = window.$ = jQuery; 10912} 10913 10914 10915 10916 10917return jQuery; 10918} ); 10919 10920 10921/***/ }), 10922
vendor: 89,605 bytes, lines 10923-13941
10923/***/ "./node_modules/slick-carousel/slick/slick.js": 10924/*!****************************************************!*\ 10925 !*** ./node_modules/slick-carousel/slick/slick.js ***! 10926 \****************************************************/ 10927/***/ (function(module, exports, __webpack_require__) { 10928 10929var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 10930 _ _ _ _ 10931 ___| (_) ___| | __ (_)___ 10932/ __| | |/ __| |/ / | / __| 10933\__ \ | | (__| < _ | \__ \ 10934|___/_|_|\___|_|\_(_)/ |___/ 10935 |__/ 10936 10937 Version: 1.8.1 10938 Author: Ken Wheeler 10939 Website: http://kenwheeler.github.io 10940 Docs: http://kenwheeler.github.io/slick 10941 Repo: http://github.com/kenwheeler/slick 10942 Issues: http://github.com/kenwheeler/slick/issues 10943 10944 */ 10945/* global window, document, define, jQuery, setInterval, clearInterval */ 10946;(function(factory) { 10947 'use strict'; 10948 if (true) { 10949 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 10950 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 10951 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 10952 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 10953 } else {} 10954 10955}(function($) { 10956 'use strict'; 10957 var Slick = window.Slick || {}; 10958 10959 Slick = (function() { 10960 10961 var instanceUid = 0; 10962 10963 function Slick(element, settings) { 10964 10965 var _ = this, dataSettings; 10966 10967 _.defaults = { 10968 accessibility: true, 10969 adaptiveHeight: false, 10970 appendArrows: $(element), 10971 appendDots: $(element), 10972 arrows: true, 10973 asNavFor: null, 10974 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 10975 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 10976 autoplay: false, 10977 autoplaySpeed: 3000, 10978 centerMode: false, 10979 centerPadding: '50px', 10980 cssEase: 'ease', 10981 customPaging: function(slider, i) { 10982 return $('<button type="button" />').text(i + 1); 10983 }, 10984 dots: false, 10985 dotsClass: 'slick-dots', 10986 draggable: true, 10987 easing: 'linear', 10988 edgeFriction: 0.35, 10989 fade: false, 10990 focusOnSelect: false, 10991 focusOnChange: false, 10992 infinite: true, 10993 initialSlide: 0, 10994 lazyLoad: 'ondemand', 10995 mobileFirst: false, 10996 pauseOnHover: true, 10997 pauseOnFocus: true, 10998 pauseOnDotsHover: false, 10999 respondTo: 'window', 11000 responsive: null, 11001 rows: 1, 11002 rtl: false, 11003 slide: '', 11004 slidesPerRow: 1, 11005 slidesToShow: 1, 11006 slidesToScroll: 1, 11007 speed: 500, 11008 swipe: true, 11009 swipeToSlide: false, 11010 touchMove: true, 11011 touchThreshold: 5, 11012 useCSS: true, 11013 useTransform: true, 11014 variableWidth: false, 11015 vertical: false, 11016 verticalSwiping: false, 11017 waitForAnimate: true, 11018 zIndex: 1000 11019 }; 11020 11021 _.initials = { 11022 animating: false, 11023 dragging: false, 11024 autoPlayTimer: null, 11025 currentDirection: 0, 11026 currentLeft: null, 11027 currentSlide: 0, 11028 direction: 1, 11029 $dots: null, 11030 listWidth: null, 11031 listHeight: null, 11032 loadIndex: 0, 11033 $nextArrow: null, 11034 $prevArrow: null, 11035 scrolling: false, 11036 slideCount: null, 11037 slideWidth: null, 11038 $slideTrack: null, 11039 $slides: null, 11040 sliding: false, 11041 slideOffset: 0, 11042 swipeLeft: null, 11043 swiping: false, 11044 $list: null, 11045 touchObject: {}, 11046 transformsEnabled: false, 11047 unslicked: false 11048 }; 11049 11050 $.extend(_, _.initials); 11051 11052 _.activeBreakpoint = null; 11053 _.animType = null; 11054 _.animProp = null; 11055 _.breakpoints = []; 11056 _.breakpointSettings = []; 11057 _.cssTransitions = false; 11058 _.focussed = false; 11059 _.interrupted = false; 11060 _.hidden = 'hidden'; 11061 _.paused = true; 11062 _.positionProp = null; 11063 _.respondTo = null; 11064 _.rowCount = 1; 11065 _.shouldClick = true; 11066 _.$slider = $(element); 11067 _.$slidesCache = null; 11068 _.transformType = null; 11069 _.transitionType = null; 11070 _.visibilityChange = 'visibilitychange'; 11071 _.windowWidth = 0; 11072 _.windowTimer = null; 11073 11074 dataSettings = $(element).data('slick') || {}; 11075 11076 _.options = $.extend({}, _.defaults, settings, dataSettings); 11077 11078 _.currentSlide = _.options.initialSlide; 11079 11080 _.originalSettings = _.options; 11081 11082 if (typeof document.mozHidden !== 'undefined') { 11083 _.hidden = 'mozHidden'; 11084 _.visibilityChange = 'mozvisibilitychange'; 11085 } else if (typeof document.webkitHidden !== 'undefined') { 11086 _.hidden = 'webkitHidden'; 11087 _.visibilityChange = 'webkitvisibilitychange'; 11088 } 11089 11090 _.autoPlay = $.proxy(_.autoPlay, _); 11091 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 11092 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 11093 _.changeSlide = $.proxy(_.changeSlide, _); 11094 _.clickHandler = $.proxy(_.clickHandler, _); 11095 _.selectHandler = $.proxy(_.selectHandler, _); 11096 _.setPosition = $.proxy(_.setPosition, _); 11097 _.swipeHandler = $.proxy(_.swipeHandler, _); 11098 _.dragHandler = $.proxy(_.dragHandler, _); 11099 _.keyHandler = $.proxy(_.keyHandler, _); 11100 11101 _.instanceUid = instanceUid++; 11102 11103 // A simple way to check for HTML strings 11104 // Strict HTML recognition (must start with <) 11105 // Extracted from jQuery v1.11 source 11106 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 11107 11108 11109 _.registerBreakpoints(); 11110 _.init(true); 11111 11112 } 11113 11114 return Slick; 11115 11116 }()); 11117 11118 Slick.prototype.activateADA = function() { 11119 var _ = this; 11120 11121 _.$slideTrack.find('.slick-active').attr({ 11122 'aria-hidden': 'false' 11123 }).find('a, input, button, select').attr({ 11124 'tabindex': '0' 11125 }); 11126 11127 }; 11128 11129 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 11130 11131 var _ = this; 11132 11133 if (typeof(index) === 'boolean') { 11134 addBefore = index; 11135 index = null; 11136 } else if (index < 0 || (index >= _.slideCount)) { 11137 return false; 11138 } 11139 11140 _.unload(); 11141 11142 if (typeof(index) === 'number') { 11143 if (index === 0 && _.$slides.length === 0) { 11144 $(markup).appendTo(_.$slideTrack); 11145 } else if (addBefore) { 11146 $(markup).insertBefore(_.$slides.eq(index)); 11147 } else { 11148 $(markup).insertAfter(_.$slides.eq(index)); 11149 } 11150 } else { 11151 if (addBefore === true) { 11152 $(markup).prependTo(_.$slideTrack); 11153 } else { 11154 $(markup).appendTo(_.$slideTrack); 11155 } 11156 } 11157 11158 _.$slides = _.$slideTrack.children(this.options.slide); 11159 11160 _.$slideTrack.children(this.options.slide).detach(); 11161 11162 _.$slideTrack.append(_.$slides); 11163 11164 _.$slides.each(function(index, element) { 11165 $(element).attr('data-slick-index', index); 11166 }); 11167 11168 _.$slidesCache = _.$slides; 11169 11170 _.reinit(); 11171 11172 }; 11173 11174 Slick.prototype.animateHeight = function() { 11175 var _ = this; 11176 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 11177 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 11178 _.$list.animate({ 11179 height: targetHeight 11180 }, _.options.speed); 11181 } 11182 }; 11183 11184 Slick.prototype.animateSlide = function(targetLeft, callback) { 11185 11186 var animProps = {}, 11187 _ = this; 11188 11189 _.animateHeight(); 11190 11191 if (_.options.rtl === true && _.options.vertical === false) { 11192 targetLeft = -targetLeft; 11193 } 11194 if (_.transformsEnabled === false) { 11195 if (_.options.vertical === false) { 11196 _.$slideTrack.animate({ 11197 left: targetLeft 11198 }, _.options.speed, _.options.easing, callback); 11199 } else { 11200 _.$slideTrack.animate({ 11201 top: targetLeft 11202 }, _.options.speed, _.options.easing, callback); 11203 } 11204 11205 } else { 11206 11207 if (_.cssTransitions === false) { 11208 if (_.options.rtl === true) { 11209 _.currentLeft = -(_.currentLeft); 11210 } 11211 $({ 11212 animStart: _.currentLeft 11213 }).animate({ 11214 animStart: targetLeft 11215 }, { 11216 duration: _.options.speed, 11217 easing: _.options.easing, 11218 step: function(now) { 11219 now = Math.ceil(now); 11220 if (_.options.vertical === false) { 11221 animProps[_.animType] = 'translate(' + 11222 now + 'px, 0px)'; 11223 _.$slideTrack.css(animProps); 11224 } else { 11225 animProps[_.animType] = 'translate(0px,' + 11226 now + 'px)'; 11227 _.$slideTrack.css(animProps); 11228 } 11229 }, 11230 complete: function() { 11231 if (callback) { 11232 callback.call(); 11233 } 11234 } 11235 }); 11236 11237 } else { 11238 11239 _.applyTransition(); 11240 targetLeft = Math.ceil(targetLeft); 11241 11242 if (_.options.vertical === false) { 11243 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 11244 } else { 11245 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 11246 } 11247 _.$slideTrack.css(animProps); 11248 11249 if (callback) { 11250 setTimeout(function() { 11251 11252 _.disableTransition(); 11253 11254 callback.call(); 11255 }, _.options.speed); 11256 } 11257 11258 } 11259 11260 } 11261 11262 }; 11263 11264 Slick.prototype.getNavTarget = function() { 11265 11266 var _ = this, 11267 asNavFor = _.options.asNavFor; 11268 11269 if ( asNavFor && asNavFor !== null ) { 11270 asNavFor = $(asNavFor).not(_.$slider); 11271 } 11272 11273 return asNavFor; 11274 11275 }; 11276 11277 Slick.prototype.asNavFor = function(index) { 11278 11279 var _ = this, 11280 asNavFor = _.getNavTarget(); 11281 11282 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 11283 asNavFor.each(function() { 11284 var target = $(this).slick('getSlick'); 11285 if(!target.unslicked) { 11286 target.slideHandler(index, true); 11287 } 11288 }); 11289 } 11290 11291 }; 11292 11293 Slick.prototype.applyTransition = function(slide) { 11294 11295 var _ = this, 11296 transition = {}; 11297 11298 if (_.options.fade === false) { 11299 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 11300 } else { 11301 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 11302 } 11303 11304 if (_.options.fade === false) { 11305 _.$slideTrack.css(transition); 11306 } else { 11307 _.$slides.eq(slide).css(transition); 11308 } 11309 11310 }; 11311 11312 Slick.prototype.autoPlay = function() { 11313 11314 var _ = this; 11315 11316 _.autoPlayClear(); 11317 11318 if ( _.slideCount > _.options.slidesToShow ) { 11319 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 11320 } 11321 11322 }; 11323 11324 Slick.prototype.autoPlayClear = function() { 11325 11326 var _ = this; 11327 11328 if (_.autoPlayTimer) { 11329 clearInterval(_.autoPlayTimer); 11330 } 11331 11332 }; 11333 11334 Slick.prototype.autoPlayIterator = function() { 11335 11336 var _ = this, 11337 slideTo = _.currentSlide + _.options.slidesToScroll; 11338 11339 if ( !_.paused && !_.interrupted && !_.focussed ) { 11340 11341 if ( _.options.infinite === false ) { 11342 11343 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 11344 _.direction = 0; 11345 } 11346 11347 else if ( _.direction === 0 ) { 11348 11349 slideTo = _.currentSlide - _.options.slidesToScroll; 11350 11351 if ( _.currentSlide - 1 === 0 ) { 11352 _.direction = 1; 11353 } 11354 11355 } 11356 11357 } 11358 11359 _.slideHandler( slideTo ); 11360 11361 } 11362 11363 }; 11364 11365 Slick.prototype.buildArrows = function() { 11366 11367 var _ = this; 11368 11369 if (_.options.arrows === true ) { 11370 11371 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 11372 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 11373 11374 if( _.slideCount > _.options.slidesToShow ) { 11375 11376 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 11377 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 11378 11379 if (_.htmlExpr.test(_.options.prevArrow)) { 11380 _.$prevArrow.prependTo(_.options.appendArrows); 11381 } 11382 11383 if (_.htmlExpr.test(_.options.nextArrow)) { 11384 _.$nextArrow.appendTo(_.options.appendArrows); 11385 } 11386 11387 if (_.options.infinite !== true) { 11388 _.$prevArrow 11389 .addClass('slick-disabled') 11390 .attr('aria-disabled', 'true'); 11391 } 11392 11393 } else { 11394 11395 _.$prevArrow.add( _.$nextArrow ) 11396 11397 .addClass('slick-hidden') 11398 .attr({ 11399 'aria-disabled': 'true', 11400 'tabindex': '-1' 11401 }); 11402 11403 } 11404 11405 } 11406 11407 }; 11408 11409 Slick.prototype.buildDots = function() { 11410 11411 var _ = this, 11412 i, dot; 11413 11414 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 11415 11416 _.$slider.addClass('slick-dotted'); 11417 11418 dot = $('<ul />').addClass(_.options.dotsClass); 11419 11420 for (i = 0; i <= _.getDotCount(); i += 1) { 11421 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 11422 } 11423 11424 _.$dots = dot.appendTo(_.options.appendDots); 11425 11426 _.$dots.find('li').first().addClass('slick-active'); 11427 11428 } 11429 11430 }; 11431 11432 Slick.prototype.buildOut = function() { 11433 11434 var _ = this; 11435 11436 _.$slides = 11437 _.$slider 11438 .children( _.options.slide + ':not(.slick-cloned)') 11439 .addClass('slick-slide'); 11440 11441 _.slideCount = _.$slides.length; 11442 11443 _.$slides.each(function(index, element) { 11444 $(element) 11445 .attr('data-slick-index', index) 11446 .data('originalStyling', $(element).attr('style') || ''); 11447 }); 11448 11449 _.$slider.addClass('slick-slider'); 11450 11451 _.$slideTrack = (_.slideCount === 0) ? 11452 $('<div class="slick-track"/>').appendTo(_.$slider) : 11453 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 11454 11455 _.$list = _.$slideTrack.wrap( 11456 '<div class="slick-list"/>').parent(); 11457 _.$slideTrack.css('opacity', 0); 11458 11459 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 11460 _.options.slidesToScroll = 1; 11461 } 11462 11463 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 11464 11465 _.setupInfinite(); 11466 11467 _.buildArrows(); 11468 11469 _.buildDots(); 11470 11471 _.updateDots(); 11472 11473 11474 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 11475 11476 if (_.options.draggable === true) { 11477 _.$list.addClass('draggable'); 11478 } 11479 11480 }; 11481 11482 Slick.prototype.buildRows = function() { 11483 11484 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 11485 11486 newSlides = document.createDocumentFragment(); 11487 originalSlides = _.$slider.children(); 11488 11489 if(_.options.rows > 0) { 11490 11491 slidesPerSection = _.options.slidesPerRow * _.options.rows; 11492 numOfSlides = Math.ceil( 11493 originalSlides.length / slidesPerSection 11494 ); 11495 11496 for(a = 0; a < numOfSlides; a++){ 11497 var slide = document.createElement('div'); 11498 for(b = 0; b < _.options.rows; b++) { 11499 var row = document.createElement('div'); 11500 for(c = 0; c < _.options.slidesPerRow; c++) { 11501 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 11502 if (originalSlides.get(target)) { 11503 row.appendChild(originalSlides.get(target)); 11504 } 11505 } 11506 slide.appendChild(row); 11507 } 11508 newSlides.appendChild(slide); 11509 } 11510 11511 _.$slider.empty().append(newSlides); 11512 _.$slider.children().children().children() 11513 .css({ 11514 'width':(100 / _.options.slidesPerRow) + '%', 11515 'display': 'inline-block' 11516 }); 11517 11518 } 11519 11520 }; 11521 11522 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 11523 11524 var _ = this, 11525 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 11526 var sliderWidth = _.$slider.width(); 11527 var windowWidth = window.innerWidth || $(window).width(); 11528 11529 if (_.respondTo === 'window') { 11530 respondToWidth = windowWidth; 11531 } else if (_.respondTo === 'slider') { 11532 respondToWidth = sliderWidth; 11533 } else if (_.respondTo === 'min') { 11534 respondToWidth = Math.min(windowWidth, sliderWidth); 11535 } 11536 11537 if ( _.options.responsive && 11538 _.options.responsive.length && 11539 _.options.responsive !== null) { 11540 11541 targetBreakpoint = null; 11542 11543 for (breakpoint in _.breakpoints) { 11544 if (_.breakpoints.hasOwnProperty(breakpoint)) { 11545 if (_.originalSettings.mobileFirst === false) { 11546 if (respondToWidth < _.breakpoints[breakpoint]) { 11547 targetBreakpoint = _.breakpoints[breakpoint]; 11548 } 11549 } else { 11550 if (respondToWidth > _.breakpoints[breakpoint]) { 11551 targetBreakpoint = _.breakpoints[breakpoint]; 11552 } 11553 } 11554 } 11555 } 11556 11557 if (targetBreakpoint !== null) { 11558 if (_.activeBreakpoint !== null) { 11559 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 11560 _.activeBreakpoint = 11561 targetBreakpoint; 11562 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 11563 _.unslick(targetBreakpoint); 11564 } else { 11565 _.options = $.extend({}, _.originalSettings, 11566 _.breakpointSettings[ 11567 targetBreakpoint]); 11568 if (initial === true) { 11569 _.currentSlide = _.options.initialSlide; 11570 } 11571 _.refresh(initial); 11572 } 11573 triggerBreakpoint = targetBreakpoint; 11574 } 11575 } else { 11576 _.activeBreakpoint = targetBreakpoint; 11577 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 11578 _.unslick(targetBreakpoint); 11579 } else { 11580 _.options = $.extend({}, _.originalSettings, 11581 _.breakpointSettings[ 11582 targetBreakpoint]); 11583 if (initial === true) { 11584 _.currentSlide = _.options.initialSlide; 11585 } 11586 _.refresh(initial); 11587 } 11588 triggerBreakpoint = targetBreakpoint; 11589 } 11590 } else { 11591 if (_.activeBreakpoint !== null) { 11592 _.activeBreakpoint = null; 11593 _.options = _.originalSettings; 11594 if (initial === true) { 11595 _.currentSlide = _.options.initialSlide; 11596 } 11597 _.refresh(initial); 11598 triggerBreakpoint = targetBreakpoint; 11599 } 11600 } 11601 11602 // only trigger breakpoints during an actual break. not on initialize. 11603 if( !initial && triggerBreakpoint !== false ) { 11604 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 11605 } 11606 } 11607 11608 }; 11609 11610 Slick.prototype.changeSlide = function(event, dontAnimate) { 11611 11612 var _ = this, 11613 $target = $(event.currentTarget), 11614 indexOffset, slideOffset, unevenOffset; 11615 11616 // If target is a link, prevent default action. 11617 if($target.is('a')) { 11618 event.preventDefault(); 11619 } 11620 11621 // If target is not the <li> element (ie: a child), find the <li>. 11622 if(!$target.is('li')) { 11623 $target = $target.closest('li'); 11624 } 11625 11626 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 11627 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 11628 11629 switch (event.data.message) { 11630 11631 case 'previous': 11632 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 11633 if (_.slideCount > _.options.slidesToShow) { 11634 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 11635 } 11636 break; 11637 11638 case 'next': 11639 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 11640 if (_.slideCount > _.options.slidesToShow) { 11641 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 11642 } 11643 break; 11644 11645 case 'index': 11646 var index = event.data.index === 0 ? 0 : 11647 event.data.index || $target.index() * _.options.slidesToScroll; 11648 11649 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 11650 $target.children().trigger('focus'); 11651 break; 11652 11653 default: 11654 return; 11655 } 11656 11657 }; 11658 11659 Slick.prototype.checkNavigable = function(index) { 11660 11661 var _ = this, 11662 navigables, prevNavigable; 11663 11664 navigables = _.getNavigableIndexes(); 11665 prevNavigable = 0; 11666 if (index > navigables[navigables.length - 1]) { 11667 index = navigables[navigables.length - 1]; 11668 } else { 11669 for (var n in navigables) { 11670 if (index < navigables[n]) { 11671 index = prevNavigable; 11672 break; 11673 } 11674 prevNavigable = navigables[n]; 11675 } 11676 } 11677 11678 return index; 11679 }; 11680 11681 Slick.prototype.cleanUpEvents = function() { 11682 11683 var _ = this; 11684 11685 if (_.options.dots && _.$dots !== null) { 11686 11687 $('li', _.$dots) 11688 .off('click.slick', _.changeSlide) 11689 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 11690 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 11691 11692 if (_.options.accessibility === true) { 11693 _.$dots.off('keydown.slick', _.keyHandler); 11694 } 11695 } 11696 11697 _.$slider.off('focus.slick blur.slick'); 11698 11699 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 11700 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 11701 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 11702 11703 if (_.options.accessibility === true) { 11704 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 11705 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 11706 } 11707 } 11708 11709 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 11710 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 11711 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 11712 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 11713 11714 _.$list.off('click.slick', _.clickHandler); 11715 11716 $(document).off(_.visibilityChange, _.visibility); 11717 11718 _.cleanUpSlideEvents(); 11719 11720 if (_.options.accessibility === true) { 11721 _.$list.off('keydown.slick', _.keyHandler); 11722 } 11723 11724 if (_.options.focusOnSelect === true) { 11725 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 11726 } 11727 11728 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 11729 11730 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 11731 11732 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 11733 11734 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 11735 11736 }; 11737 11738 Slick.prototype.cleanUpSlideEvents = function() { 11739 11740 var _ = this; 11741 11742 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 11743 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 11744 11745 }; 11746 11747 Slick.prototype.cleanUpRows = function() { 11748 11749 var _ = this, originalSlides; 11750 11751 if(_.options.rows > 0) { 11752 originalSlides = _.$slides.children().children(); 11753 originalSlides.removeAttr('style'); 11754 _.$slider.empty().append(originalSlides); 11755 } 11756 11757 }; 11758 11759 Slick.prototype.clickHandler = function(event) { 11760 11761 var _ = this; 11762 11763 if (_.shouldClick === false) { 11764 event.stopImmediatePropagation(); 11765 event.stopPropagation(); 11766 event.preventDefault(); 11767 } 11768 11769 }; 11770 11771 Slick.prototype.destroy = function(refresh) { 11772 11773 var _ = this; 11774 11775 _.autoPlayClear(); 11776 11777 _.touchObject = {}; 11778 11779 _.cleanUpEvents(); 11780 11781 $('.slick-cloned', _.$slider).detach(); 11782 11783 if (_.$dots) { 11784 _.$dots.remove(); 11785 } 11786 11787 if ( _.$prevArrow && _.$prevArrow.length ) { 11788 11789 _.$prevArrow 11790 .removeClass('slick-disabled slick-arrow slick-hidden') 11791 .removeAttr('aria-hidden aria-disabled tabindex') 11792 .css('display',''); 11793 11794 if ( _.htmlExpr.test( _.options.prevArrow )) { 11795 _.$prevArrow.remove(); 11796 } 11797 } 11798 11799 if ( _.$nextArrow && _.$nextArrow.length ) { 11800 11801 _.$nextArrow 11802 .removeClass('slick-disabled slick-arrow slick-hidden') 11803 .removeAttr('aria-hidden aria-disabled tabindex') 11804 .css('display',''); 11805 11806 if ( _.htmlExpr.test( _.options.nextArrow )) { 11807 _.$nextArrow.remove(); 11808 } 11809 } 11810 11811 11812 if (_.$slides) { 11813 11814 _.$slides 11815 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 11816 .removeAttr('aria-hidden') 11817 .removeAttr('data-slick-index') 11818 .each(function(){ 11819 $(this).attr('style', $(this).data('originalStyling')); 11820 }); 11821 11822 _.$slideTrack.children(this.options.slide).detach(); 11823 11824 _.$slideTrack.detach(); 11825 11826 _.$list.detach(); 11827 11828 _.$slider.append(_.$slides); 11829 } 11830 11831 _.cleanUpRows(); 11832 11833 _.$slider.removeClass('slick-slider'); 11834 _.$slider.removeClass('slick-initialized'); 11835 _.$slider.removeClass('slick-dotted'); 11836 11837 _.unslicked = true; 11838 11839 if(!refresh) { 11840 _.$slider.trigger('destroy', [_]); 11841 } 11842 11843 }; 11844 11845 Slick.prototype.disableTransition = function(slide) { 11846 11847 var _ = this, 11848 transition = {}; 11849 11850 transition[_.transitionType] = ''; 11851 11852 if (_.options.fade === false) { 11853 _.$slideTrack.css(transition); 11854 } else { 11855 _.$slides.eq(slide).css(transition); 11856 } 11857 11858 }; 11859 11860 Slick.prototype.fadeSlide = function(slideIndex, callback) { 11861 11862 var _ = this; 11863 11864 if (_.cssTransitions === false) { 11865 11866 _.$slides.eq(slideIndex).css({ 11867 zIndex: _.options.zIndex 11868 }); 11869 11870 _.$slides.eq(slideIndex).animate({ 11871 opacity: 1 11872 }, _.options.speed, _.options.easing, callback); 11873 11874 } else { 11875 11876 _.applyTransition(slideIndex); 11877 11878 _.$slides.eq(slideIndex).css({ 11879 opacity: 1, 11880 zIndex: _.options.zIndex 11881 }); 11882 11883 if (callback) { 11884 setTimeout(function() { 11885 11886 _.disableTransition(slideIndex); 11887 11888 callback.call(); 11889 }, _.options.speed); 11890 } 11891 11892 } 11893 11894 }; 11895 11896 Slick.prototype.fadeSlideOut = function(slideIndex) { 11897 11898 var _ = this; 11899 11900 if (_.cssTransitions === false) { 11901 11902 _.$slides.eq(slideIndex).animate({ 11903 opacity: 0, 11904 zIndex: _.options.zIndex - 2 11905 }, _.options.speed, _.options.easing); 11906 11907 } else { 11908 11909 _.applyTransition(slideIndex); 11910 11911 _.$slides.eq(slideIndex).css({ 11912 opacity: 0, 11913 zIndex: _.options.zIndex - 2 11914 }); 11915 11916 } 11917 11918 }; 11919 11920 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 11921 11922 var _ = this; 11923 11924 if (filter !== null) { 11925 11926 _.$slidesCache = _.$slides; 11927 11928 _.unload(); 11929 11930 _.$slideTrack.children(this.options.slide).detach(); 11931 11932 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 11933 11934 _.reinit(); 11935 11936 } 11937 11938 }; 11939 11940 Slick.prototype.focusHandler = function() { 11941 11942 var _ = this; 11943 11944 _.$slider 11945 .off('focus.slick blur.slick') 11946 .on('focus.slick blur.slick', '*', function(event) { 11947 11948 event.stopImmediatePropagation(); 11949 var $sf = $(this); 11950 11951 setTimeout(function() { 11952 11953 if( _.options.pauseOnFocus ) { 11954 _.focussed = $sf.is(':focus'); 11955 _.autoPlay(); 11956 } 11957 11958 }, 0); 11959 11960 }); 11961 }; 11962 11963 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 11964 11965 var _ = this; 11966 return _.currentSlide; 11967 11968 }; 11969 11970 Slick.prototype.getDotCount = function() { 11971 11972 var _ = this; 11973 11974 var breakPoint = 0; 11975 var counter = 0; 11976 var pagerQty = 0; 11977 11978 if (_.options.infinite === true) { 11979 if (_.slideCount <= _.options.slidesToShow) { 11980 ++pagerQty; 11981 } else { 11982 while (breakPoint < _.slideCount) { 11983 ++pagerQty; 11984 breakPoint = counter + _.options.slidesToScroll; 11985 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 11986 } 11987 } 11988 } else if (_.options.centerMode === true) { 11989 pagerQty = _.slideCount; 11990 } else if(!_.options.asNavFor) { 11991 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 11992 }else { 11993 while (breakPoint < _.slideCount) { 11994 ++pagerQty; 11995 breakPoint = counter + _.options.slidesToScroll; 11996 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 11997 } 11998 } 11999 12000 return pagerQty - 1; 12001 12002 }; 12003 12004 Slick.prototype.getLeft = function(slideIndex) { 12005 12006 var _ = this, 12007 targetLeft, 12008 verticalHeight, 12009 verticalOffset = 0, 12010 targetSlide, 12011 coef; 12012 12013 _.slideOffset = 0; 12014 verticalHeight = _.$slides.first().outerHeight(true); 12015 12016 if (_.options.infinite === true) { 12017 if (_.slideCount > _.options.slidesToShow) { 12018 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 12019 coef = -1 12020 12021 if (_.options.vertical === true && _.options.centerMode === true) { 12022 if (_.options.slidesToShow === 2) { 12023 coef = -1.5; 12024 } else if (_.options.slidesToShow === 1) { 12025 coef = -2 12026 } 12027 } 12028 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 12029 } 12030 if (_.slideCount % _.options.slidesToScroll !== 0) { 12031 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 12032 if (slideIndex > _.slideCount) { 12033 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 12034 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 12035 } else { 12036 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 12037 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 12038 } 12039 } 12040 } 12041 } else { 12042 if (slideIndex + _.options.slidesToShow > _.slideCount) { 12043 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 12044 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 12045 } 12046 } 12047 12048 if (_.slideCount <= _.options.slidesToShow) { 12049 _.slideOffset = 0; 12050 verticalOffset = 0; 12051 } 12052 12053 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 12054 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 12055 } else if (_.options.centerMode === true && _.options.infinite === true) { 12056 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 12057 } else if (_.options.centerMode === true) { 12058 _.slideOffset = 0; 12059 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 12060 } 12061 12062 if (_.options.vertical === false) { 12063 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 12064 } else { 12065 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 12066 } 12067 12068 if (_.options.variableWidth === true) { 12069 12070 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 12071 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 12072 } else { 12073 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 12074 } 12075 12076 if (_.options.rtl === true) { 12077 if (targetSlide[0]) { 12078 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 12079 } else { 12080 targetLeft = 0; 12081 } 12082 } else { 12083 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 12084 } 12085 12086 if (_.options.centerMode === true) { 12087 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 12088 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 12089 } else { 12090 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 12091 } 12092 12093 if (_.options.rtl === true) { 12094 if (targetSlide[0]) { 12095 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 12096 } else { 12097 targetLeft = 0; 12098 } 12099 } else { 12100 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 12101 } 12102 12103 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 12104 } 12105 } 12106 12107 return targetLeft; 12108 12109 }; 12110 12111 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 12112 12113 var _ = this; 12114 12115 return _.options[option]; 12116 12117 }; 12118 12119 Slick.prototype.getNavigableIndexes = function() { 12120 12121 var _ = this, 12122 breakPoint = 0, 12123 counter = 0, 12124 indexes = [], 12125 max; 12126 12127 if (_.options.infinite === false) { 12128 max = _.slideCount; 12129 } else { 12130 breakPoint = _.options.slidesToScroll * -1; 12131 counter = _.options.slidesToScroll * -1; 12132 max = _.slideCount * 2; 12133 } 12134 12135 while (breakPoint < max) { 12136 indexes.push(breakPoint); 12137 breakPoint = counter + _.options.slidesToScroll; 12138 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 12139 } 12140 12141 return indexes; 12142 12143 }; 12144 12145 Slick.prototype.getSlick = function() { 12146 12147 return this; 12148 12149 }; 12150 12151 Slick.prototype.getSlideCount = function() { 12152 12153 var _ = this, 12154 slidesTraversed, swipedSlide, centerOffset; 12155 12156 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 12157 12158 if (_.options.swipeToSlide === true) { 12159 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 12160 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 12161 swipedSlide = slide; 12162 return false; 12163 } 12164 }); 12165 12166 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 12167 12168 return slidesTraversed; 12169 12170 } else { 12171 return _.options.slidesToScroll; 12172 } 12173 12174 }; 12175 12176 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 12177 12178 var _ = this; 12179 12180 _.changeSlide({ 12181 data: { 12182 message: 'index', 12183 index: parseInt(slide) 12184 } 12185 }, dontAnimate); 12186 12187 }; 12188 12189 Slick.prototype.init = function(creation) { 12190 12191 var _ = this; 12192 12193 if (!$(_.$slider).hasClass('slick-initialized')) { 12194 12195 $(_.$slider).addClass('slick-initialized'); 12196 12197 _.buildRows(); 12198 _.buildOut(); 12199 _.setProps(); 12200 _.startLoad(); 12201 _.loadSlider(); 12202 _.initializeEvents(); 12203 _.updateArrows(); 12204 _.updateDots(); 12205 _.checkResponsive(true); 12206 _.focusHandler(); 12207 12208 } 12209 12210 if (creation) { 12211 _.$slider.trigger('init', [_]); 12212 } 12213 12214 if (_.options.accessibility === true) { 12215 _.initADA(); 12216 } 12217 12218 if ( _.options.autoplay ) { 12219 12220 _.paused = false; 12221 _.autoPlay(); 12222 12223 } 12224 12225 }; 12226 12227 Slick.prototype.initADA = function() { 12228 var _ = this, 12229 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 12230 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 12231 return (val >= 0) && (val < _.slideCount); 12232 }); 12233 12234 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 12235 'aria-hidden': 'true', 12236 'tabindex': '-1' 12237 }).find('a, input, button, select').attr({ 12238 'tabindex': '-1' 12239 }); 12240 12241 if (_.$dots !== null) { 12242 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 12243 var slideControlIndex = tabControlIndexes.indexOf(i); 12244 12245 $(this).attr({ 12246 'role': 'tabpanel', 12247 'id': 'slick-slide' + _.instanceUid + i, 12248 'tabindex': -1 12249 }); 12250 12251 if (slideControlIndex !== -1) { 12252 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 12253 if ($('#' + ariaButtonControl).length) { 12254 $(this).attr({ 12255 'aria-describedby': ariaButtonControl 12256 }); 12257 } 12258 } 12259 }); 12260 12261 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 12262 var mappedSlideIndex = tabControlIndexes[i]; 12263 12264 $(this).attr({ 12265 'role': 'presentation' 12266 }); 12267 12268 $(this).find('button').first().attr({ 12269 'role': 'tab', 12270 'id': 'slick-slide-control' + _.instanceUid + i, 12271 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 12272 'aria-label': (i + 1) + ' of ' + numDotGroups, 12273 'aria-selected': null, 12274 'tabindex': '-1' 12275 }); 12276 12277 }).eq(_.currentSlide).find('button').attr({ 12278 'aria-selected': 'true', 12279 'tabindex': '0' 12280 }).end(); 12281 } 12282 12283 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 12284 if (_.options.focusOnChange) { 12285 _.$slides.eq(i).attr({'tabindex': '0'}); 12286 } else { 12287 _.$slides.eq(i).removeAttr('tabindex'); 12288 } 12289 } 12290 12291 _.activateADA(); 12292 12293 }; 12294 12295 Slick.prototype.initArrowEvents = function() { 12296 12297 var _ = this; 12298 12299 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 12300 _.$prevArrow 12301 .off('click.slick') 12302 .on('click.slick', { 12303 message: 'previous' 12304 }, _.changeSlide); 12305 _.$nextArrow 12306 .off('click.slick') 12307 .on('click.slick', { 12308 message: 'next' 12309 }, _.changeSlide); 12310 12311 if (_.options.accessibility === true) { 12312 _.$prevArrow.on('keydown.slick', _.keyHandler); 12313 _.$nextArrow.on('keydown.slick', _.keyHandler); 12314 } 12315 } 12316 12317 }; 12318 12319 Slick.prototype.initDotEvents = function() { 12320 12321 var _ = this; 12322 12323 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 12324 $('li', _.$dots).on('click.slick', { 12325 message: 'index' 12326 }, _.changeSlide); 12327 12328 if (_.options.accessibility === true) { 12329 _.$dots.on('keydown.slick', _.keyHandler); 12330 } 12331 } 12332 12333 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 12334 12335 $('li', _.$dots) 12336 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 12337 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 12338 12339 } 12340 12341 }; 12342 12343 Slick.prototype.initSlideEvents = function() { 12344 12345 var _ = this; 12346 12347 if ( _.options.pauseOnHover ) { 12348 12349 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 12350 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 12351 12352 } 12353 12354 }; 12355 12356 Slick.prototype.initializeEvents = function() { 12357 12358 var _ = this; 12359 12360 _.initArrowEvents(); 12361 12362 _.initDotEvents(); 12363 _.initSlideEvents(); 12364 12365 _.$list.on('touchstart.slick mousedown.slick', { 12366 action: 'start' 12367 }, _.swipeHandler); 12368 _.$list.on('touchmove.slick mousemove.slick', { 12369 action: 'move' 12370 }, _.swipeHandler); 12371 _.$list.on('touchend.slick mouseup.slick', { 12372 action: 'end' 12373 }, _.swipeHandler); 12374 _.$list.on('touchcancel.slick mouseleave.slick', { 12375 action: 'end' 12376 }, _.swipeHandler); 12377 12378 _.$list.on('click.slick', _.clickHandler); 12379 12380 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 12381 12382 if (_.options.accessibility === true) { 12383 _.$list.on('keydown.slick', _.keyHandler); 12384 } 12385 12386 if (_.options.focusOnSelect === true) { 12387 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 12388 } 12389 12390 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 12391 12392 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 12393 12394 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 12395 12396 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 12397 $(_.setPosition); 12398 12399 }; 12400 12401 Slick.prototype.initUI = function() { 12402 12403 var _ = this; 12404 12405 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 12406 12407 _.$prevArrow.show(); 12408 _.$nextArrow.show(); 12409 12410 } 12411 12412 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 12413 12414 _.$dots.show(); 12415 12416 } 12417 12418 }; 12419 12420 Slick.prototype.keyHandler = function(event) { 12421 12422 var _ = this; 12423 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 12424 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 12425 if (event.keyCode === 37 && _.options.accessibility === true) { 12426 _.changeSlide({ 12427 data: { 12428 message: _.options.rtl === true ? 'next' : 'previous' 12429 } 12430 }); 12431 } else if (event.keyCode === 39 && _.options.accessibility === true) { 12432 _.changeSlide({ 12433 data: { 12434 message: _.options.rtl === true ? 'previous' : 'next' 12435 } 12436 }); 12437 } 12438 } 12439 12440 }; 12441 12442 Slick.prototype.lazyLoad = function() { 12443 12444 var _ = this, 12445 loadRange, cloneRange, rangeStart, rangeEnd; 12446 12447 function loadImages(imagesScope) { 12448 12449 $('img[data-lazy]', imagesScope).each(function() { 12450 12451 var image = $(this), 12452 imageSource = $(this).attr('data-lazy'), 12453 imageSrcSet = $(this).attr('data-srcset'), 12454 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 12455 imageToLoad = document.createElement('img'); 12456 12457 imageToLoad.onload = function() { 12458 12459 image 12460 .animate({ opacity: 0 }, 100, function() { 12461 12462 if (imageSrcSet) { 12463 image 12464 .attr('srcset', imageSrcSet ); 12465 12466 if (imageSizes) { 12467 image 12468 .attr('sizes', imageSizes ); 12469 } 12470 } 12471 12472 image 12473 .attr('src', imageSource) 12474 .animate({ opacity: 1 }, 200, function() { 12475 image 12476 .removeAttr('data-lazy data-srcset data-sizes') 12477 .removeClass('slick-loading'); 12478 }); 12479 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 12480 }); 12481 12482 }; 12483 12484 imageToLoad.onerror = function() { 12485 12486 image 12487 .removeAttr( 'data-lazy' ) 12488 .removeClass( 'slick-loading' ) 12489 .addClass( 'slick-lazyload-error' ); 12490 12491 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 12492 12493 }; 12494 12495 imageToLoad.src = imageSource; 12496 12497 }); 12498 12499 } 12500 12501 if (_.options.centerMode === true) { 12502 if (_.options.infinite === true) { 12503 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 12504 rangeEnd = rangeStart + _.options.slidesToShow + 2; 12505 } else { 12506 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 12507 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 12508 } 12509 } else { 12510 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 12511 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 12512 if (_.options.fade === true) { 12513 if (rangeStart > 0) rangeStart--; 12514 if (rangeEnd <= _.slideCount) rangeEnd++; 12515 } 12516 } 12517 12518 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 12519 12520 if (_.options.lazyLoad === 'anticipated') { 12521 var prevSlide = rangeStart - 1, 12522 nextSlide = rangeEnd, 12523 $slides = _.$slider.find('.slick-slide'); 12524 12525 for (var i = 0; i < _.options.slidesToScroll; i++) { 12526 if (prevSlide < 0) prevSlide = _.slideCount - 1; 12527 loadRange = loadRange.add($slides.eq(prevSlide)); 12528 loadRange = loadRange.add($slides.eq(nextSlide)); 12529 prevSlide--; 12530 nextSlide++; 12531 } 12532 } 12533 12534 loadImages(loadRange); 12535 12536 if (_.slideCount <= _.options.slidesToShow) { 12537 cloneRange = _.$slider.find('.slick-slide'); 12538 loadImages(cloneRange); 12539 } else 12540 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 12541 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 12542 loadImages(cloneRange); 12543 } else if (_.currentSlide === 0) { 12544 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 12545 loadImages(cloneRange); 12546 } 12547 12548 }; 12549 12550 Slick.prototype.loadSlider = function() { 12551 12552 var _ = this; 12553 12554 _.setPosition(); 12555 12556 _.$slideTrack.css({ 12557 opacity: 1 12558 }); 12559 12560 _.$slider.removeClass('slick-loading'); 12561 12562 _.initUI(); 12563 12564 if (_.options.lazyLoad === 'progressive') { 12565 _.progressiveLazyLoad(); 12566 } 12567 12568 }; 12569 12570 Slick.prototype.next = Slick.prototype.slickNext = function() { 12571 12572 var _ = this; 12573 12574 _.changeSlide({ 12575 data: { 12576 message: 'next' 12577 } 12578 }); 12579 12580 }; 12581 12582 Slick.prototype.orientationChange = function() { 12583 12584 var _ = this; 12585 12586 _.checkResponsive(); 12587 _.setPosition(); 12588 12589 }; 12590 12591 Slick.prototype.pause = Slick.prototype.slickPause = function() { 12592 12593 var _ = this; 12594 12595 _.autoPlayClear(); 12596 _.paused = true; 12597 12598 }; 12599 12600 Slick.prototype.play = Slick.prototype.slickPlay = function() { 12601 12602 var _ = this; 12603 12604 _.autoPlay(); 12605 _.options.autoplay = true; 12606 _.paused = false; 12607 _.focussed = false; 12608 _.interrupted = false; 12609 12610 }; 12611 12612 Slick.prototype.postSlide = function(index) { 12613 12614 var _ = this; 12615 12616 if( !_.unslicked ) { 12617 12618 _.$slider.trigger('afterChange', [_, index]); 12619 12620 _.animating = false; 12621 12622 if (_.slideCount > _.options.slidesToShow) { 12623 _.setPosition(); 12624 } 12625 12626 _.swipeLeft = null; 12627 12628 if ( _.options.autoplay ) { 12629 _.autoPlay(); 12630 } 12631 12632 if (_.options.accessibility === true) { 12633 _.initADA(); 12634 12635 if (_.options.focusOnChange) { 12636 var $currentSlide = $(_.$slides.get(_.currentSlide)); 12637 $currentSlide.attr('tabindex', 0).focus(); 12638 } 12639 } 12640 12641 } 12642 12643 }; 12644 12645 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 12646 12647 var _ = this; 12648 12649 _.changeSlide({ 12650 data: { 12651 message: 'previous' 12652 } 12653 }); 12654 12655 }; 12656 12657 Slick.prototype.preventDefault = function(event) { 12658 12659 event.preventDefault(); 12660 12661 }; 12662 12663 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 12664 12665 tryCount = tryCount || 1; 12666 12667 var _ = this, 12668 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 12669 image, 12670 imageSource, 12671 imageSrcSet, 12672 imageSizes, 12673 imageToLoad; 12674 12675 if ( $imgsToLoad.length ) { 12676 12677 image = $imgsToLoad.first(); 12678 imageSource = image.attr('data-lazy'); 12679 imageSrcSet = image.attr('data-srcset'); 12680 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 12681 imageToLoad = document.createElement('img'); 12682 12683 imageToLoad.onload = function() { 12684 12685 if (imageSrcSet) { 12686 image 12687 .attr('srcset', imageSrcSet ); 12688 12689 if (imageSizes) { 12690 image 12691 .attr('sizes', imageSizes ); 12692 } 12693 } 12694 12695 image 12696 .attr( 'src', imageSource ) 12697 .removeAttr('data-lazy data-srcset data-sizes') 12698 .removeClass('slick-loading'); 12699 12700 if ( _.options.adaptiveHeight === true ) { 12701 _.setPosition(); 12702 } 12703 12704 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 12705 _.progressiveLazyLoad(); 12706 12707 }; 12708 12709 imageToLoad.onerror = function() { 12710 12711 if ( tryCount < 3 ) { 12712 12713 /** 12714 * try to load the image 3 times, 12715 * leave a slight delay so we don't get 12716 * servers blocking the request. 12717 */ 12718 setTimeout( function() { 12719 _.progressiveLazyLoad( tryCount + 1 ); 12720 }, 500 ); 12721 12722 } else { 12723 12724 image 12725 .removeAttr( 'data-lazy' ) 12726 .removeClass( 'slick-loading' ) 12727 .addClass( 'slick-lazyload-error' ); 12728 12729 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 12730 12731 _.progressiveLazyLoad(); 12732 12733 } 12734 12735 }; 12736 12737 imageToLoad.src = imageSource; 12738 12739 } else { 12740 12741 _.$slider.trigger('allImagesLoaded', [ _ ]); 12742 12743 } 12744 12745 }; 12746 12747 Slick.prototype.refresh = function( initializing ) { 12748 12749 var _ = this, currentSlide, lastVisibleIndex; 12750 12751 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 12752 12753 // in non-infinite sliders, we don't want to go past the 12754 // last visible index. 12755 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 12756 _.currentSlide = lastVisibleIndex; 12757 } 12758 12759 // if less slides than to show, go to start. 12760 if ( _.slideCount <= _.options.slidesToShow ) { 12761 _.currentSlide = 0; 12762 12763 } 12764 12765 currentSlide = _.currentSlide; 12766 12767 _.destroy(true); 12768 12769 $.extend(_, _.initials, { currentSlide: currentSlide }); 12770 12771 _.init(); 12772 12773 if( !initializing ) { 12774 12775 _.changeSlide({ 12776 data: { 12777 message: 'index', 12778 index: currentSlide 12779 } 12780 }, false); 12781 12782 } 12783 12784 }; 12785 12786 Slick.prototype.registerBreakpoints = function() { 12787 12788 var _ = this, breakpoint, currentBreakpoint, l, 12789 responsiveSettings = _.options.responsive || null; 12790 12791 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 12792 12793 _.respondTo = _.options.respondTo || 'window'; 12794 12795 for ( breakpoint in responsiveSettings ) { 12796 12797 l = _.breakpoints.length-1; 12798 12799 if (responsiveSettings.hasOwnProperty(breakpoint)) { 12800 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 12801 12802 // loop through the breakpoints and cut out any existing 12803 // ones with the same breakpoint number, we don't want dupes. 12804 while( l >= 0 ) { 12805 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 12806 _.breakpoints.splice(l,1); 12807 } 12808 l--; 12809 } 12810 12811 _.breakpoints.push(currentBreakpoint); 12812 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 12813 12814 } 12815 12816 } 12817 12818 _.breakpoints.sort(function(a, b) { 12819 return ( _.options.mobileFirst ) ? a-b : b-a; 12820 }); 12821 12822 } 12823 12824 }; 12825 12826 Slick.prototype.reinit = function() { 12827 12828 var _ = this; 12829 12830 _.$slides = 12831 _.$slideTrack 12832 .children(_.options.slide) 12833 .addClass('slick-slide'); 12834 12835 _.slideCount = _.$slides.length; 12836 12837 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 12838 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 12839 } 12840 12841 if (_.slideCount <= _.options.slidesToShow) { 12842 _.currentSlide = 0; 12843 } 12844 12845 _.registerBreakpoints(); 12846 12847 _.setProps(); 12848 _.setupInfinite(); 12849 _.buildArrows(); 12850 _.updateArrows(); 12851 _.initArrowEvents(); 12852 _.buildDots(); 12853 _.updateDots(); 12854 _.initDotEvents(); 12855 _.cleanUpSlideEvents(); 12856 _.initSlideEvents(); 12857 12858 _.checkResponsive(false, true); 12859 12860 if (_.options.focusOnSelect === true) { 12861 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 12862 } 12863 12864 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 12865 12866 _.setPosition(); 12867 _.focusHandler(); 12868 12869 _.paused = !_.options.autoplay; 12870 _.autoPlay(); 12871 12872 _.$slider.trigger('reInit', [_]); 12873 12874 }; 12875 12876 Slick.prototype.resize = function() { 12877 12878 var _ = this; 12879 12880 if ($(window).width() !== _.windowWidth) { 12881 clearTimeout(_.windowDelay); 12882 _.windowDelay = window.setTimeout(function() { 12883 _.windowWidth = $(window).width(); 12884 _.checkResponsive(); 12885 if( !_.unslicked ) { _.setPosition(); } 12886 }, 50); 12887 } 12888 }; 12889 12890 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 12891 12892 var _ = this; 12893 12894 if (typeof(index) === 'boolean') { 12895 removeBefore = index; 12896 index = removeBefore === true ? 0 : _.slideCount - 1; 12897 } else { 12898 index = removeBefore === true ? --index : index; 12899 } 12900 12901 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 12902 return false; 12903 } 12904 12905 _.unload(); 12906 12907 if (removeAll === true) { 12908 _.$slideTrack.children().remove(); 12909 } else { 12910 _.$slideTrack.children(this.options.slide).eq(index).remove(); 12911 } 12912 12913 _.$slides = _.$slideTrack.children(this.options.slide); 12914 12915 _.$slideTrack.children(this.options.slide).detach(); 12916 12917 _.$slideTrack.append(_.$slides); 12918 12919 _.$slidesCache = _.$slides; 12920 12921 _.reinit(); 12922 12923 }; 12924 12925 Slick.prototype.setCSS = function(position) { 12926 12927 var _ = this, 12928 positionProps = {}, 12929 x, y; 12930 12931 if (_.options.rtl === true) { 12932 position = -position; 12933 } 12934 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 12935 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 12936 12937 positionProps[_.positionProp] = position; 12938 12939 if (_.transformsEnabled === false) { 12940 _.$slideTrack.css(positionProps); 12941 } else { 12942 positionProps = {}; 12943 if (_.cssTransitions === false) { 12944 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 12945 _.$slideTrack.css(positionProps); 12946 } else { 12947 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 12948 _.$slideTrack.css(positionProps); 12949 } 12950 } 12951 12952 }; 12953 12954 Slick.prototype.setDimensions = function() { 12955 12956 var _ = this; 12957 12958 if (_.options.vertical === false) { 12959 if (_.options.centerMode === true) { 12960 _.$list.css({ 12961 padding: ('0px ' + _.options.centerPadding) 12962 }); 12963 } 12964 } else { 12965 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 12966 if (_.options.centerMode === true) { 12967 _.$list.css({ 12968 padding: (_.options.centerPadding + ' 0px') 12969 }); 12970 } 12971 } 12972 12973 _.listWidth = _.$list.width(); 12974 _.listHeight = _.$list.height(); 12975 12976 12977 if (_.options.vertical === false && _.options.variableWidth === false) { 12978 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 12979 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 12980 12981 } else if (_.options.variableWidth === true) { 12982 _.$slideTrack.width(5000 * _.slideCount); 12983 } else { 12984 _.slideWidth = Math.ceil(_.listWidth); 12985 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 12986 } 12987 12988 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 12989 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 12990 12991 }; 12992 12993 Slick.prototype.setFade = function() { 12994 12995 var _ = this, 12996 targetLeft; 12997 12998 _.$slides.each(function(index, element) { 12999 targetLeft = (_.slideWidth * index) * -1; 13000 if (_.options.rtl === true) { 13001 $(element).css({ 13002 position: 'relative', 13003 right: targetLeft, 13004 top: 0, 13005 zIndex: _.options.zIndex - 2, 13006 opacity: 0 13007 }); 13008 } else { 13009 $(element).css({ 13010 position: 'relative', 13011 left: targetLeft, 13012 top: 0, 13013 zIndex: _.options.zIndex - 2, 13014 opacity: 0 13015 }); 13016 } 13017 }); 13018 13019 _.$slides.eq(_.currentSlide).css({ 13020 zIndex: _.options.zIndex - 1, 13021 opacity: 1 13022 }); 13023 13024 }; 13025 13026 Slick.prototype.setHeight = function() { 13027 13028 var _ = this; 13029 13030 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 13031 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 13032 _.$list.css('height', targetHeight); 13033 } 13034 13035 }; 13036 13037 Slick.prototype.setOption = 13038 Slick.prototype.slickSetOption = function() { 13039 13040 /** 13041 * accepts arguments in format of: 13042 * 13043 * - for changing a single option's value: 13044 * .slick("setOption", option, value, refresh ) 13045 * 13046 * - for changing a set of responsive options: 13047 * .slick("setOption", 'responsive', [{}, ...], refresh ) 13048 * 13049 * - for updating multiple values at once (not responsive) 13050 * .slick("setOption", { 'option': value, ... }, refresh ) 13051 */ 13052 13053 var _ = this, l, item, option, value, refresh = false, type; 13054 13055 if( $.type( arguments[0] ) === 'object' ) { 13056 13057 option = arguments[0]; 13058 refresh = arguments[1]; 13059 type = 'multiple'; 13060 13061 } else if ( $.type( arguments[0] ) === 'string' ) { 13062 13063 option = arguments[0]; 13064 value = arguments[1]; 13065 refresh = arguments[2]; 13066 13067 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 13068 13069 type = 'responsive'; 13070 13071 } else if ( typeof arguments[1] !== 'undefined' ) { 13072 13073 type = 'single'; 13074 13075 } 13076 13077 } 13078 13079 if ( type === 'single' ) { 13080 13081 _.options[option] = value; 13082 13083 13084 } else if ( type === 'multiple' ) { 13085 13086 $.each( option , function( opt, val ) { 13087 13088 _.options[opt] = val; 13089 13090 }); 13091 13092 13093 } else if ( type === 'responsive' ) { 13094 13095 for ( item in value ) { 13096 13097 if( $.type( _.options.responsive ) !== 'array' ) { 13098 13099 _.options.responsive = [ value[item] ]; 13100 13101 } else { 13102 13103 l = _.options.responsive.length-1; 13104 13105 // loop through the responsive object and splice out duplicates. 13106 while( l >= 0 ) { 13107 13108 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 13109 13110 _.options.responsive.splice(l,1); 13111 13112 } 13113 13114 l--; 13115 13116 } 13117 13118 _.options.responsive.push( value[item] ); 13119 13120 } 13121 13122 } 13123 13124 } 13125 13126 if ( refresh ) { 13127 13128 _.unload(); 13129 _.reinit(); 13130 13131 } 13132 13133 }; 13134 13135 Slick.prototype.setPosition = function() { 13136 13137 var _ = this; 13138 13139 _.setDimensions(); 13140 13141 _.setHeight(); 13142 13143 if (_.options.fade === false) { 13144 _.setCSS(_.getLeft(_.currentSlide)); 13145 } else { 13146 _.setFade(); 13147 } 13148 13149 _.$slider.trigger('setPosition', [_]); 13150 13151 }; 13152 13153 Slick.prototype.setProps = function() { 13154 13155 var _ = this, 13156 bodyStyle = document.body.style; 13157 13158 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 13159 13160 if (_.positionProp === 'top') { 13161 _.$slider.addClass('slick-vertical'); 13162 } else { 13163 _.$slider.removeClass('slick-vertical'); 13164 } 13165 13166 if (bodyStyle.WebkitTransition !== undefined || 13167 bodyStyle.MozTransition !== undefined || 13168 bodyStyle.msTransition !== undefined) { 13169 if (_.options.useCSS === true) { 13170 _.cssTransitions = true; 13171 } 13172 } 13173 13174 if ( _.options.fade ) { 13175 if ( typeof _.options.zIndex === 'number' ) { 13176 if( _.options.zIndex < 3 ) { 13177 _.options.zIndex = 3; 13178 } 13179 } else { 13180 _.options.zIndex = _.defaults.zIndex; 13181 } 13182 } 13183 13184 if (bodyStyle.OTransform !== undefined) { 13185 _.animType = 'OTransform'; 13186 _.transformType = '-o-transform'; 13187 _.transitionType = 'OTransition'; 13188 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 13189 } 13190 if (bodyStyle.MozTransform !== undefined) { 13191 _.animType = 'MozTransform'; 13192 _.transformType = '-moz-transform'; 13193 _.transitionType = 'MozTransition'; 13194 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 13195 } 13196 if (bodyStyle.webkitTransform !== undefined) { 13197 _.animType = 'webkitTransform'; 13198 _.transformType = '-webkit-transform'; 13199 _.transitionType = 'webkitTransition'; 13200 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 13201 } 13202 if (bodyStyle.msTransform !== undefined) { 13203 _.animType = 'msTransform'; 13204 _.transformType = '-ms-transform'; 13205 _.transitionType = 'msTransition'; 13206 if (bodyStyle.msTransform === undefined) _.animType = false; 13207 } 13208 if (bodyStyle.transform !== undefined && _.animType !== false) { 13209 _.animType = 'transform'; 13210 _.transformType = 'transform'; 13211 _.transitionType = 'transition'; 13212 } 13213 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 13214 }; 13215 13216 13217 Slick.prototype.setSlideClasses = function(index) { 13218 13219 var _ = this, 13220 centerOffset, allSlides, indexOffset, remainder; 13221 13222 allSlides = _.$slider 13223 .find('.slick-slide') 13224 .removeClass('slick-active slick-center slick-current') 13225 .attr('aria-hidden', 'true'); 13226 13227 _.$slides 13228 .eq(index) 13229 .addClass('slick-current'); 13230 13231 if (_.options.centerMode === true) { 13232 13233 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 13234 13235 centerOffset = Math.floor(_.options.slidesToShow / 2); 13236 13237 if (_.options.infinite === true) { 13238 13239 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 13240 _.$slides 13241 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 13242 .addClass('slick-active') 13243 .attr('aria-hidden', 'false'); 13244 13245 } else { 13246 13247 indexOffset = _.options.slidesToShow + index; 13248 allSlides 13249 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 13250 .addClass('slick-active') 13251 .attr('aria-hidden', 'false'); 13252 13253 } 13254 13255 if (index === 0) { 13256 13257 allSlides 13258 .eq(allSlides.length - 1 - _.options.slidesToShow) 13259 .addClass('slick-center'); 13260 13261 } else if (index === _.slideCount - 1) { 13262 13263 allSlides 13264 .eq(_.options.slidesToShow) 13265 .addClass('slick-center'); 13266 13267 } 13268 13269 } 13270 13271 _.$slides 13272 .eq(index) 13273 .addClass('slick-center'); 13274 13275 } else { 13276 13277 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 13278 13279 _.$slides 13280 .slice(index, index + _.options.slidesToShow) 13281 .addClass('slick-active') 13282 .attr('aria-hidden', 'false'); 13283 13284 } else if (allSlides.length <= _.options.slidesToShow) { 13285 13286 allSlides 13287 .addClass('slick-active') 13288 .attr('aria-hidden', 'false'); 13289 13290 } else { 13291 13292 remainder = _.slideCount % _.options.slidesToShow; 13293 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 13294 13295 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 13296 13297 allSlides 13298 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 13299 .addClass('slick-active') 13300 .attr('aria-hidden', 'false'); 13301 13302 } else { 13303 13304 allSlides 13305 .slice(indexOffset, indexOffset + _.options.slidesToShow) 13306 .addClass('slick-active') 13307 .attr('aria-hidden', 'false'); 13308 13309 } 13310 13311 } 13312 13313 } 13314 13315 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 13316 _.lazyLoad(); 13317 } 13318 }; 13319 13320 Slick.prototype.setupInfinite = function() { 13321 13322 var _ = this, 13323 i, slideIndex, infiniteCount; 13324 13325 if (_.options.fade === true) { 13326 _.options.centerMode = false; 13327 } 13328 13329 if (_.options.infinite === true && _.options.fade === false) { 13330 13331 slideIndex = null; 13332 13333 if (_.slideCount > _.options.slidesToShow) { 13334 13335 if (_.options.centerMode === true) { 13336 infiniteCount = _.options.slidesToShow + 1; 13337 } else { 13338 infiniteCount = _.options.slidesToShow; 13339 } 13340 13341 for (i = _.slideCount; i > (_.slideCount - 13342 infiniteCount); i -= 1) { 13343 slideIndex = i - 1; 13344 $(_.$slides[slideIndex]).clone(true).attr('id', '') 13345 .attr('data-slick-index', slideIndex - _.slideCount) 13346 .prependTo(_.$slideTrack).addClass('slick-cloned'); 13347 } 13348 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 13349 slideIndex = i; 13350 $(_.$slides[slideIndex]).clone(true).attr('id', '') 13351 .attr('data-slick-index', slideIndex + _.slideCount) 13352 .appendTo(_.$slideTrack).addClass('slick-cloned'); 13353 } 13354 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 13355 $(this).attr('id', ''); 13356 }); 13357 13358 } 13359 13360 } 13361 13362 }; 13363 13364 Slick.prototype.interrupt = function( toggle ) { 13365 13366 var _ = this; 13367 13368 if( !toggle ) { 13369 _.autoPlay(); 13370 } 13371 _.interrupted = toggle; 13372 13373 }; 13374 13375 Slick.prototype.selectHandler = function(event) { 13376 13377 var _ = this; 13378 13379 var targetElement = 13380 $(event.target).is('.slick-slide') ? 13381 $(event.target) : 13382 $(event.target).parents('.slick-slide'); 13383 13384 var index = parseInt(targetElement.attr('data-slick-index')); 13385 13386 if (!index) index = 0; 13387 13388 if (_.slideCount <= _.options.slidesToShow) { 13389 13390 _.slideHandler(index, false, true); 13391 return; 13392 13393 } 13394 13395 _.slideHandler(index); 13396 13397 }; 13398 13399 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 13400 13401 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 13402 _ = this, navTarget; 13403 13404 sync = sync || false; 13405 13406 if (_.animating === true && _.options.waitForAnimate === true) { 13407 return; 13408 } 13409 13410 if (_.options.fade === true && _.currentSlide === index) { 13411 return; 13412 } 13413 13414 if (sync === false) { 13415 _.asNavFor(index); 13416 } 13417 13418 targetSlide = index; 13419 targetLeft = _.getLeft(targetSlide); 13420 slideLeft = _.getLeft(_.currentSlide); 13421 13422 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 13423 13424 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 13425 if (_.options.fade === false) { 13426 targetSlide = _.currentSlide; 13427 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 13428 _.animateSlide(slideLeft, function() { 13429 _.postSlide(targetSlide); 13430 }); 13431 } else { 13432 _.postSlide(targetSlide); 13433 } 13434 } 13435 return; 13436 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 13437 if (_.options.fade === false) { 13438 targetSlide = _.currentSlide; 13439 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 13440 _.animateSlide(slideLeft, function() { 13441 _.postSlide(targetSlide); 13442 }); 13443 } else { 13444 _.postSlide(targetSlide); 13445 } 13446 } 13447 return; 13448 } 13449 13450 if ( _.options.autoplay ) { 13451 clearInterval(_.autoPlayTimer); 13452 } 13453 13454 if (targetSlide < 0) { 13455 if (_.slideCount % _.options.slidesToScroll !== 0) { 13456 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 13457 } else { 13458 animSlide = _.slideCount + targetSlide; 13459 } 13460 } else if (targetSlide >= _.slideCount) { 13461 if (_.slideCount % _.options.slidesToScroll !== 0) { 13462 animSlide = 0; 13463 } else { 13464 animSlide = targetSlide - _.slideCount; 13465 } 13466 } else { 13467 animSlide = targetSlide; 13468 } 13469 13470 _.animating = true; 13471 13472 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 13473 13474 oldSlide = _.currentSlide; 13475 _.currentSlide = animSlide; 13476 13477 _.setSlideClasses(_.currentSlide); 13478 13479 if ( _.options.asNavFor ) { 13480 13481 navTarget = _.getNavTarget(); 13482 navTarget = navTarget.slick('getSlick'); 13483 13484 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 13485 navTarget.setSlideClasses(_.currentSlide); 13486 } 13487 13488 } 13489 13490 _.updateDots(); 13491 _.updateArrows(); 13492 13493 if (_.options.fade === true) { 13494 if (dontAnimate !== true) { 13495 13496 _.fadeSlideOut(oldSlide); 13497 13498 _.fadeSlide(animSlide, function() { 13499 _.postSlide(animSlide); 13500 }); 13501 13502 } else { 13503 _.postSlide(animSlide); 13504 } 13505 _.animateHeight(); 13506 return; 13507 } 13508 13509 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 13510 _.animateSlide(targetLeft, function() { 13511 _.postSlide(animSlide); 13512 }); 13513 } else { 13514 _.postSlide(animSlide); 13515 } 13516 13517 }; 13518 13519 Slick.prototype.startLoad = function() { 13520 13521 var _ = this; 13522 13523 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 13524 13525 _.$prevArrow.hide(); 13526 _.$nextArrow.hide(); 13527 13528 } 13529 13530 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 13531 13532 _.$dots.hide(); 13533 13534 } 13535 13536 _.$slider.addClass('slick-loading'); 13537 13538 }; 13539 13540 Slick.prototype.swipeDirection = function() { 13541 13542 var xDist, yDist, r, swipeAngle, _ = this; 13543 13544 xDist = _.touchObject.startX - _.touchObject.curX; 13545 yDist = _.touchObject.startY - _.touchObject.curY; 13546 r = Math.atan2(yDist, xDist); 13547 13548 swipeAngle = Math.round(r * 180 / Math.PI); 13549 if (swipeAngle < 0) { 13550 swipeAngle = 360 - Math.abs(swipeAngle); 13551 } 13552 13553 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 13554 return (_.options.rtl === false ? 'left' : 'right'); 13555 } 13556 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 13557 return (_.options.rtl === false ? 'left' : 'right'); 13558 } 13559 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 13560 return (_.options.rtl === false ? 'right' : 'left'); 13561 } 13562 if (_.options.verticalSwiping === true) { 13563 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 13564 return 'down'; 13565 } else { 13566 return 'up'; 13567 } 13568 } 13569 13570 return 'vertical'; 13571 13572 }; 13573 13574 Slick.prototype.swipeEnd = function(event) { 13575 13576 var _ = this, 13577 slideCount, 13578 direction; 13579 13580 _.dragging = false; 13581 _.swiping = false; 13582 13583 if (_.scrolling) { 13584 _.scrolling = false; 13585 return false; 13586 } 13587 13588 _.interrupted = false; 13589 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 13590 13591 if ( _.touchObject.curX === undefined ) { 13592 return false; 13593 } 13594 13595 if ( _.touchObject.edgeHit === true ) { 13596 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 13597 } 13598 13599 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 13600 13601 direction = _.swipeDirection(); 13602 13603 switch ( direction ) { 13604 13605 case 'left': 13606 case 'down': 13607 13608 slideCount = 13609 _.options.swipeToSlide ? 13610 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 13611 _.currentSlide + _.getSlideCount(); 13612 13613 _.currentDirection = 0; 13614 13615 break; 13616 13617 case 'right': 13618 case 'up': 13619 13620 slideCount = 13621 _.options.swipeToSlide ? 13622 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 13623 _.currentSlide - _.getSlideCount(); 13624 13625 _.currentDirection = 1; 13626 13627 break; 13628 13629 default: 13630 13631 13632 } 13633 13634 if( direction != 'vertical' ) { 13635 13636 _.slideHandler( slideCount ); 13637 _.touchObject = {}; 13638 _.$slider.trigger('swipe', [_, direction ]); 13639 13640 } 13641 13642 } else { 13643 13644 if ( _.touchObject.startX !== _.touchObject.curX ) { 13645 13646 _.slideHandler( _.currentSlide ); 13647 _.touchObject = {}; 13648 13649 } 13650 13651 } 13652 13653 }; 13654 13655 Slick.prototype.swipeHandler = function(event) { 13656 13657 var _ = this; 13658 13659 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 13660 return; 13661 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 13662 return; 13663 } 13664 13665 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 13666 event.originalEvent.touches.length : 1; 13667 13668 _.touchObject.minSwipe = _.listWidth / _.options 13669 .touchThreshold; 13670 13671 if (_.options.verticalSwiping === true) { 13672 _.touchObject.minSwipe = _.listHeight / _.options 13673 .touchThreshold; 13674 } 13675 13676 switch (event.data.action) { 13677 13678 case 'start': 13679 _.swipeStart(event); 13680 break; 13681 13682 case 'move': 13683 _.swipeMove(event); 13684 break; 13685 13686 case 'end': 13687 _.swipeEnd(event); 13688 break; 13689 13690 } 13691 13692 }; 13693 13694 Slick.prototype.swipeMove = function(event) { 13695 13696 var _ = this, 13697 edgeWasHit = false, 13698 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 13699 13700 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 13701 13702 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 13703 return false; 13704 } 13705 13706 curLeft = _.getLeft(_.currentSlide); 13707 13708 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 13709 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 13710 13711 _.touchObject.swipeLength = Math.round(Math.sqrt( 13712 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 13713 13714 verticalSwipeLength = Math.round(Math.sqrt( 13715 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 13716 13717 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 13718 _.scrolling = true; 13719 return false; 13720 } 13721 13722 if (_.options.verticalSwiping === true) { 13723 _.touchObject.swipeLength = verticalSwipeLength; 13724 } 13725 13726 swipeDirection = _.swipeDirection(); 13727 13728 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 13729 _.swiping = true; 13730 event.preventDefault(); 13731 } 13732 13733 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 13734 if (_.options.verticalSwiping === true) { 13735 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 13736 } 13737 13738 13739 swipeLength = _.touchObject.swipeLength; 13740 13741 _.touchObject.edgeHit = false; 13742 13743 if (_.options.infinite === false) { 13744 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 13745 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 13746 _.touchObject.edgeHit = true; 13747 } 13748 } 13749 13750 if (_.options.vertical === false) { 13751 _.swipeLeft = curLeft + swipeLength * positionOffset; 13752 } else { 13753 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 13754 } 13755 if (_.options.verticalSwiping === true) { 13756 _.swipeLeft = curLeft + swipeLength * positionOffset; 13757 } 13758 13759 if (_.options.fade === true || _.options.touchMove === false) { 13760 return false; 13761 } 13762 13763 if (_.animating === true) { 13764 _.swipeLeft = null; 13765 return false; 13766 } 13767 13768 _.setCSS(_.swipeLeft); 13769 13770 }; 13771 13772 Slick.prototype.swipeStart = function(event) { 13773 13774 var _ = this, 13775 touches; 13776 13777 _.interrupted = true; 13778 13779 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 13780 _.touchObject = {}; 13781 return false; 13782 } 13783 13784 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 13785 touches = event.originalEvent.touches[0]; 13786 } 13787 13788 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 13789 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 13790 13791 _.dragging = true; 13792 13793 }; 13794 13795 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 13796 13797 var _ = this; 13798 13799 if (_.$slidesCache !== null) { 13800 13801 _.unload(); 13802 13803 _.$slideTrack.children(this.options.slide).detach(); 13804 13805 _.$slidesCache.appendTo(_.$slideTrack); 13806 13807 _.reinit(); 13808 13809 } 13810 13811 }; 13812 13813 Slick.prototype.unload = function() { 13814 13815 var _ = this; 13816 13817 $('.slick-cloned', _.$slider).remove(); 13818 13819 if (_.$dots) { 13820 _.$dots.remove(); 13821 } 13822 13823 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 13824 _.$prevArrow.remove(); 13825 } 13826 13827 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 13828 _.$nextArrow.remove(); 13829 } 13830 13831 _.$slides 13832 .removeClass('slick-slide slick-active slick-visible slick-current') 13833 .attr('aria-hidden', 'true') 13834 .css('width', ''); 13835 13836 }; 13837 13838 Slick.prototype.unslick = function(fromBreakpoint) { 13839 13840 var _ = this; 13841 _.$slider.trigger('unslick', [_, fromBreakpoint]); 13842 _.destroy(); 13843 13844 }; 13845 13846 Slick.prototype.updateArrows = function() { 13847 13848 var _ = this, 13849 centerOffset; 13850 13851 centerOffset = Math.floor(_.options.slidesToShow / 2); 13852 13853 if ( _.options.arrows === true && 13854 _.slideCount > _.options.slidesToShow && 13855 !_.options.infinite ) { 13856 13857 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 13858 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 13859 13860 if (_.currentSlide === 0) { 13861 13862 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 13863 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 13864 13865 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 13866 13867 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 13868 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 13869 13870 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 13871 13872 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 13873 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 13874 13875 } 13876 13877 } 13878 13879 }; 13880 13881 Slick.prototype.updateDots = function() { 13882 13883 var _ = this; 13884 13885 if (_.$dots !== null) { 13886 13887 _.$dots 13888 .find('li') 13889 .removeClass('slick-active') 13890 .end(); 13891 13892 _.$dots 13893 .find('li') 13894 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 13895 .addClass('slick-active'); 13896 13897 } 13898 13899 }; 13900 13901 Slick.prototype.visibility = function() { 13902 13903 var _ = this; 13904 13905 if ( _.options.autoplay ) { 13906 13907 if ( document[_.hidden] ) { 13908 13909 _.interrupted = true; 13910 13911 } else { 13912 13913 _.interrupted = false; 13914 13915 } 13916 13917 } 13918 13919 }; 13920 13921 $.fn.slick = function() { 13922 var _ = this, 13923 opt = arguments[0], 13924 args = Array.prototype.slice.call(arguments, 1), 13925 l = _.length, 13926 i, 13927 ret; 13928 for (i = 0; i < l; i++) { 13929 if (typeof opt == 'object' || typeof opt == 'undefined') 13930 _[i].slick = new Slick(_[i], opt); 13931 else 13932 ret = _[i].slick[opt].apply(_[i].slick, args); 13933 if (typeof ret != 'undefined') return ret; 13934 } 13935 return _; 13936 }; 13937 13938})); 13939 13940 13941/***/ })
13941 13942 13943}]); 13944//# sourceMappingURL=vendor.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.