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