1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; 2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } 3{ 4 let window = _____WB$wombat$assign$function_____("window"); 5 let self = _____WB$wombat$assign$function_____("self"); 6 let document = _____WB$wombat$assign$function_____("document"); 7 let location = _____WB$wombat$assign$function_____("location"); 8 let top = _____WB$wombat$assign$function_____("top"); 9 let parent = _____WB$wombat$assign$function_____("parent"); 10 let frames = _____WB$wombat$assign$function_____("frames"); 11 let opener = _____WB$wombat$assign$function_____("opener"); 12 13/*! 14 * jQuery JavaScript Library v1.11.1 15 * http://jquery.com/ 16 * 17 * Includes Sizzle.js 18 * http://sizzlejs.com/ 19 * 20 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors 21 * Released under the MIT license 22 * http://jquery.org/license 23 * 24 * Date: 2014-05-01T17:42Z 25 */ 26 27 28(function( global, factory ) { 29 30 if ( typeof module === "object" && typeof module.exports === "object" ) { 31 // For CommonJS and CommonJS-like environments where a proper window is present, 32 // execute the factory and get jQuery 33 // For environments that do not inherently posses a window with a document 34 // (such as Node.js), expose a jQuery-making factory as module.exports 35 // This accentuates the need for the creation of a real window 36 // e.g. var jQuery = require("jquery")(window); 37 // See ticket #14549 for more info 38 module.exports = global.document ? 39 factory( global, true ) : 40 function( w ) { 41 if ( !w.document ) { 42 throw new Error( "jQuery requires a window with a document" ); 43 } 44 return factory( w ); 45 }; 46 } else { 47 factory( global ); 48 } 49 50// Pass this if window is not defined yet 51}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 52 53// Can't do this because several apps including ASP.NET trace 54// the stack via arguments.caller.callee and Firefox dies if 55// you try to trace through "use strict" call chains. (#13335) 56// Support: Firefox 18+ 57// 58 59var deletedIds = []; 60 61var slice = deletedIds.slice; 62 63var concat = deletedIds.concat; 64 65var push = deletedIds.push; 66 67var indexOf = deletedIds.indexOf; 68 69var class2type = {}; 70 71var toString = class2type.toString; 72 73var hasOwn = class2type.hasOwnProperty; 74 75var support = {}; 76 77 78 79var 80 version = "1.11.1", 81 82 // Define a local copy of jQuery 83 jQuery = function( selector, context ) { 84 // The jQuery object is actually just the init constructor 'enhanced' 85 // Need init if jQuery is called (just allow error to be thrown if not included) 86 return new jQuery.fn.init( selector, context ); 87 }, 88 89 // Support: Android<4.1, IE<9 90 // Make sure we trim BOM and NBSP 91 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 92 93 // Matches dashed string for camelizing 94 rmsPrefix = /^-ms-/, 95 rdashAlpha = /-([\da-z])/gi, 96 97 // Used by jQuery.camelCase as callback to replace() 98 fcamelCase = function( all, letter ) { 99 return letter.toUpperCase(); 100 }; 101 102jQuery.fn = jQuery.prototype = { 103 // The current version of jQuery being used 104 jquery: version, 105 106 constructor: jQuery, 107 108 // Start with an empty selector 109 selector: "", 110 111 // The default length of a jQuery object is 0 112 length: 0, 113 114 toArray: function() { 115 return slice.call( this ); 116 }, 117 118 // Get the Nth element in the matched element set OR 119 // Get the whole matched element set as a clean array 120 get: function( num ) { 121 return num != null ? 122 123 // Return just the one element from the set 124 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 125 126 // Return all the elements in a clean array 127 slice.call( this ); 128 }, 129 130 // Take an array of elements and push it onto the stack 131 // (returning the new matched element set) 132 pushStack: function( elems ) { 133 134 // Build a new jQuery matched element set 135 var ret = jQuery.merge( this.constructor(), elems ); 136 137 // Add the old object onto the stack (as a reference) 138 ret.prevObject = this; 139 ret.context = this.context; 140 141 // Return the newly-formed element set 142 return ret; 143 }, 144 145 // Execute a callback for every element in the matched set. 146 // (You can seed the arguments with an array of args, but this is 147 // only used internally.) 148 each: function( callback, args ) { 149 return jQuery.each( this, callback, args ); 150 }, 151 152 map: function( callback ) { 153 return this.pushStack( jQuery.map(this, function( elem, i ) { 154 return callback.call( elem, i, elem ); 155 })); 156 }, 157 158 slice: function() { 159 return this.pushStack( slice.apply( this, arguments ) ); 160 }, 161 162 first: function() { 163 return this.eq( 0 ); 164 }, 165 166 last: function() { 167 return this.eq( -1 ); 168 }, 169 170 eq: function( i ) { 171 var len = this.length, 172 j = +i + ( i < 0 ? len : 0 ); 173 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); 174 }, 175 176 end: function() { 177 return this.prevObject || this.constructor(null); 178 }, 179 180 // For internal use only. 181 // Behaves like an Array's method, not like a jQuery method. 182 push: push, 183 sort: deletedIds.sort, 184 splice: deletedIds.splice 185}; 186 187jQuery.extend = jQuery.fn.extend = function() { 188 var src, copyIsArray, copy, name, options, clone, 189 target = arguments[0] || {}, 190 i = 1, 191 length = arguments.length, 192 deep = false;
193 194 // Handle a deep copy situation 195 if ( typeof target === "boolean" ) { 196 deep = target; 197 198 // skip the boolean and the target 199 target = arguments[ i ] || {}; 200 i++; 201 } 202 203 // Handle case when target is a string or something (possible in deep copy) 204 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 205 target = {}; 206 } 207 208 // extend jQuery itself if only one argument is passed 209 if ( i === length ) { 210 target = this; 211 i--; 212 } 213 214 for ( ; i < length; i++ ) { 215 // Only deal with non-null/undefined values 216 if ( (options = arguments[ i ]) != null ) { 217 // Extend the base object 218 for ( name in options ) { 219 src = target[ name ]; 220 copy = options[ name ]; 221 222 // Prevent never-ending loop 223 if ( target === copy ) { 224 continue; 225 } 226 227 // Recurse if we're merging plain objects or arrays 228 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 229 if ( copyIsArray ) { 230 copyIsArray = false; 231 clone = src && jQuery.isArray(src) ? src : []; 232 233 } else { 234 clone = src && jQuery.isPlainObject(src) ? src : {}; 235 } 236 237 // Never move original objects, clone them 238 target[ name ] = jQuery.extend( deep, clone, copy ); 239 240 // Don't bring in undefined values 241 } else if ( copy !== undefined ) { 242 target[ name ] = copy; 243 } 244 } 245 } 246 } 247 248 // Return the modified object 249 return target; 250}; 251 252jQuery.extend({ 253 // Unique for each copy of jQuery on the page 254 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 255 256 // Assume jQuery is ready without the ready module 257 isReady: true, 258 259 error: function( msg ) { 260 throw new Error( msg ); 261 }, 262 263 noop: function() {}, 264 265 // See test/unit/core.js for details concerning isFunction. 266 // Since version 1.3, DOM methods and functions like alert 267 // aren't supported. They return false on IE (#2968). 268 isFunction: function( obj ) { 269 return jQuery.type(obj) === "function"; 270 }, 271 272 isArray: Array.isArray || function( obj ) { 273 return jQuery.type(obj) === "array"; 274 }, 275 276 isWindow: function( obj ) { 277 /* jshint eqeqeq: false */ 278 return obj != null && obj == obj.window; 279 }, 280 281 isNumeric: function( obj ) { 282 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 283 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 284 // subtraction forces infinities to NaN 285 return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; 286 }, 287 288 isEmptyObject: function( obj ) { 289 var name; 290 for ( name in obj ) { 291 return false; 292 } 293 return true; 294 }, 295 296 isPlainObject: function( obj ) { 297 var key; 298 299 // Must be an Object. 300 // Because of IE, we also have to check the presence of the constructor property. 301 // Make sure that DOM nodes and window objects don't pass through, as well 302 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 303 return false; 304 } 305 306 try { 307 // Not own constructor property must be Object 308 if ( obj.constructor && 309 !hasOwn.call(obj, "constructor") && 310 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 311 return false; 312 } 313 } catch ( e ) { 314 // IE8,9 Will throw exceptions on certain host objects #9897 315 return false; 316 } 317 318 // Support: IE<9 319 // Handle iteration over inherited properties before own properties. 320 if ( support.ownLast ) { 321 for ( key in obj ) { 322 return hasOwn.call( obj, key ); 323 } 324 } 325 326 // Own properties are enumerated firstly, so to speed up, 327 // if last one is own, then all properties are own. 328 for ( key in obj ) {} 329 330 return key === undefined || hasOwn.call( obj, key ); 331 }, 332 333 type: function( obj ) { 334 if ( obj == null ) { 335 return obj + ""; 336 } 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 // Workarounds based on findings by Jim Driscoll 344 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 345 globalEval: function( data ) { 346 if ( data && jQuery.trim( data ) ) { 347 // We use execScript on Internet Explorer 348 // We use an anonymous function so that context is window 349 // rather than jQuery in Firefox 350 ( window.execScript || function( data ) { 351 window[ "eval" ].call( window, data ); 352 } )( data ); 353 } 354 }, 355 356 // Convert dashed to camelCase; used by the css and data modules 357 // Microsoft forgot to hump their vendor prefix (#9572) 358 camelCase: function( string ) { 359 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 360 }, 361
362 nodeName: function( elem, name ) { 363 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 364 }, 365 366 // args is for internal usage only 367 each: function( obj, callback, args ) { 368 var value, 369 i = 0, 370 length = obj.length, 371 isArray = isArraylike( obj ); 372 373 if ( args ) { 374 if ( isArray ) { 375 for ( ; i < length; i++ ) { 376 value = callback.apply( obj[ i ], args ); 377 378 if ( value === false ) { 379 break; 380 } 381 } 382 } else { 383 for ( i in obj ) { 384 value = callback.apply( obj[ i ], args ); 385 386 if ( value === false ) { 387 break; 388 } 389 } 390 } 391 392 // A special, fast, case for the most common use of each 393 } else { 394 if ( isArray ) { 395 for ( ; i < length; i++ ) { 396 value = callback.call( obj[ i ], i, obj[ i ] ); 397 398 if ( value === false ) { 399 break; 400 } 401 } 402 } else { 403 for ( i in obj ) { 404 value = callback.call( obj[ i ], i, obj[ i ] ); 405 406 if ( value === false ) { 407 break; 408 } 409 } 410 } 411 } 412 413 return obj; 414 }, 415 416 // Support: Android<4.1, IE<9 417 trim: function( text ) { 418 return text == null ? 419 "" : 420 ( text + "" ).replace( rtrim, "" ); 421 }, 422 423 // results is for internal usage only 424 makeArray: function( arr, results ) { 425 var ret = results || []; 426 427 if ( arr != null ) { 428 if ( isArraylike( Object(arr) ) ) { 429 jQuery.merge( ret, 430 typeof arr === "string" ? 431 [ arr ] : arr 432 ); 433 } else { 434 push.call( ret, arr ); 435 } 436 } 437 438 return ret; 439 }, 440 441 inArray: function( elem, arr, i ) { 442 var len; 443 444 if ( arr ) { 445 if ( indexOf ) { 446 return indexOf.call( arr, elem, i ); 447 } 448 449 len = arr.length; 450 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 451 452 for ( ; i < len; i++ ) { 453 // Skip accessing in sparse arrays 454 if ( i in arr && arr[ i ] === elem ) { 455 return i; 456 } 457 } 458 } 459 460 return -1; 461 }, 462 463 merge: function( first, second ) { 464 var len = +second.length, 465 j = 0, 466 i = first.length; 467 468 while ( j < len ) { 469 first[ i++ ] = second[ j++ ]; 470 } 471 472 // Support: IE<9 473 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) 474 if ( len !== len ) { 475 while ( second[j] !== undefined ) { 476 first[ i++ ] = second[ j++ ]; 477 } 478 } 479 480 first.length = i; 481 482 return first; 483 }, 484 485 grep: function( elems, callback, invert ) { 486 var callbackInverse, 487 matches = [], 488 i = 0, 489 length = elems.length, 490 callbackExpect = !invert; 491 492 // Go through the array, only saving the items 493 // that pass the validator function 494 for ( ; i < length; i++ ) { 495 callbackInverse = !callback( elems[ i ], i ); 496 if ( callbackInverse !== callbackExpect ) { 497 matches.push( elems[ i ] ); 498 } 499 } 500 501 return matches; 502 }, 503 504 // arg is for internal usage only 505 map: function( elems, callback, arg ) { 506 var value, 507 i = 0, 508 length = elems.length, 509 isArray = isArraylike( elems ), 510 ret = []; 511 512 // Go through the array, translating each of the items to their new values 513 if ( isArray ) { 514 for ( ; i < length; i++ ) { 515 value = callback( elems[ i ], i, arg ); 516 517 if ( value != null ) { 518 ret.push( value ); 519 } 520 } 521 522 // Go through every key on the object, 523 } else { 524 for ( i in elems ) { 525 value = callback( elems[ i ], i, arg ); 526 527 if ( value != null ) { 528 ret.push( value ); 529 } 530 } 531 } 532 533 // Flatten any nested arrays 534 return concat.apply( [], ret ); 535 }, 536 537 // A global GUID counter for objects 538 guid: 1, 539 540 // Bind a function to a context, optionally partially applying any 541 // arguments. 542 proxy: function( fn, context ) { 543 var args, proxy, tmp; 544 545 if ( typeof context === "string" ) { 546 tmp = fn[ context ]; 547 context = fn; 548 fn = tmp; 549 } 550 551 // Quick check to determine if target is callable, in the spec 552 // this throws a TypeError, but we will just return undefined. 553 if ( !jQuery.isFunction( fn ) ) { 554 return undefined; 555 } 556 557 // Simulated bind 558 args = slice.call( arguments, 2 ); 559 proxy = function() { 560 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 561 }; 562 563 // Set the guid of unique handler to the same of original handler, so it can be removed 564 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 565 566 return proxy; 567 }, 568 569 now: function() { 570 return +( new Date() ); 571 }, 572 573 // jQuery.support is not used in Core but other projects attach their 574 // properties to it so it needs to exist. 575 support: support 576}); 577 578// Populate the class2type map 579jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { 580 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 581}); 582 583function isArraylike( obj ) { 584 var length = obj.length, 585 type = jQuery.type( obj ); 586 587 if ( type === "function" || jQuery.isWindow( obj ) ) { 588 return false;
589 } 590 591 if ( obj.nodeType === 1 && length ) { 592 return true; 593 } 594 595 return type === "array" || length === 0 || 596 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 597} 598var Sizzle = 599/*! 600 * Sizzle CSS Selector Engine v1.10.19 601 * http://sizzlejs.com/ 602 * 603 * Copyright 2013 jQuery Foundation, Inc. and other contributors 604 * Released under the MIT license 605 * http://jquery.org/license 606 * 607 * Date: 2014-04-18 608 */ 609(function( window ) { 610 611var i, 612 support, 613 Expr, 614 getText, 615 isXML, 616 tokenize, 617 compile, 618 select, 619 outermostContext, 620 sortInput, 621 hasDuplicate, 622 623 // Local document vars 624 setDocument, 625 document, 626 docElem, 627 documentIsHTML, 628 rbuggyQSA, 629 rbuggyMatches, 630 matches, 631 contains, 632 633 // Instance-specific data 634 expando = "sizzle" + -(new Date()), 635 preferredDoc = window.document, 636 dirruns = 0, 637 done = 0, 638 classCache = createCache(), 639 tokenCache = createCache(), 640 compilerCache = createCache(), 641 sortOrder = function( a, b ) { 642 if ( a === b ) { 643 hasDuplicate = true; 644 } 645 return 0; 646 }, 647 648 // General-purpose constants 649 strundefined = typeof undefined, 650 MAX_NEGATIVE = 1 << 31, 651 652 // Instance methods 653 hasOwn = ({}).hasOwnProperty, 654 arr = [], 655 pop = arr.pop, 656 push_native = arr.push, 657 push = arr.push, 658 slice = arr.slice, 659 // Use a stripped-down indexOf if we can't use a native one 660 indexOf = arr.indexOf || function( elem ) { 661 var i = 0, 662 len = this.length; 663 for ( ; i < len; i++ ) { 664 if ( this[i] === elem ) { 665 return i; 666 } 667 } 668 return -1; 669 }, 670 671 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 672 673 // Regular expressions 674 675 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace 676 whitespace = "[\\x20\\t\\r\\n\\f]", 677 // http://www.w3.org/TR/css3-syntax/#characters 678 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 679 680 // Loosely modeled on CSS identifier characters 681 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors 682 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 683 identifier = characterEncoding.replace( "w", "w#" ), 684 685 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 686 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + 687 // Operator (capture 2) 688 "*([*^$|!~]?=)" + whitespace + 689 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 690 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 691 "*\\]", 692 693 pseudos = ":(" + characterEncoding + ")(?:\\((" + 694 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 695 // 1. quoted (capture 3; capture 4 or capture 5) 696 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 697 // 2. simple (capture 6) 698 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 699 // 3. anything else (capture 2) 700 ".*" + 701 ")\\)|)", 702 703 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 704 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 705 706 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 707 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 708 709 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 710 711 rpseudo = new RegExp( pseudos ), 712 ridentifier = new RegExp( "^" + identifier + "$" ), 713 714 matchExpr = { 715 "ID": new RegExp( "^#(" + characterEncoding + ")" ), 716 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), 717 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), 718 "ATTR": new RegExp( "^" + attributes ), 719 "PSEUDO": new RegExp( "^" + pseudos ), 720 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 721 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 722 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 723 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 724 // For use in libraries implementing .is() 725 // We use this for POS matching in `select` 726 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 727 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 728 }, 729
730 rinputs = /^(?:input|select|textarea|button)$/i, 731 rheader = /^h\d$/i, 732 733 rnative = /^[^{]+\{\s*\[native \w/, 734 735 // Easily-parseable/retrievable ID or TAG or CLASS selectors 736 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 737 738 rsibling = /[+~]/, 739 rescape = /'|\\/g, 740 741 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 742 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 743 funescape = function( _, escaped, escapedWhitespace ) { 744 var high = "0x" + escaped - 0x10000; 745 // NaN means non-codepoint 746 // Support: Firefox<24 747 // Workaround erroneous numeric interpretation of +"0x" 748 return high !== high || escapedWhitespace ? 749 escaped : 750 high < 0 ? 751 // BMP codepoint 752 String.fromCharCode( high + 0x10000 ) : 753 // Supplemental Plane codepoint (surrogate pair) 754 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 755 }; 756 757// Optimize for push.apply( _, NodeList ) 758try { 759 push.apply( 760 (arr = slice.call( preferredDoc.childNodes )), 761 preferredDoc.childNodes 762 ); 763 // Support: Android<4.0 764 // Detect silently failing push.apply 765 arr[ preferredDoc.childNodes.length ].nodeType; 766} catch ( e ) { 767 push = { apply: arr.length ? 768 769 // Leverage slice if possible 770 function( target, els ) { 771 push_native.apply( target, slice.call(els) ); 772 } : 773 774 // Support: IE<9 775 // Otherwise append directly 776 function( target, els ) { 777 var j = target.length, 778 i = 0; 779 // Can't trust NodeList.length 780 while ( (target[j++] = els[i++]) ) {} 781 target.length = j - 1; 782 } 783 }; 784} 785 786function Sizzle( selector, context, results, seed ) { 787 var match, elem, m, nodeType, 788 // QSA vars 789 i, groups, old, nid, newContext, newSelector; 790 791 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 792 setDocument( context ); 793 } 794 795 context = context || document; 796 results = results || []; 797 798 if ( !selector || typeof selector !== "string" ) { 799 return results; 800 } 801 802 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { 803 return []; 804 } 805 806 if ( documentIsHTML && !seed ) { 807 808 // Shortcuts 809 if ( (match = rquickExpr.exec( selector )) ) { 810 // Speed-up: Sizzle("#ID") 811 if ( (m = match[1]) ) { 812 if ( nodeType === 9 ) { 813 elem = context.getElementById( m ); 814 // Check parentNode to catch when Blackberry 4.6 returns 815 // nodes that are no longer in the document (jQuery #6963) 816 if ( elem && elem.parentNode ) { 817 // Handle the case where IE, Opera, and Webkit return items 818 // by name instead of ID 819 if ( elem.id === m ) { 820 results.push( elem ); 821 return results; 822 } 823 } else { 824 return results; 825 } 826 } else { 827 // Context is not a document 828 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && 829 contains( context, elem ) && elem.id === m ) { 830 results.push( elem ); 831 return results; 832 } 833 } 834 835 // Speed-up: Sizzle("TAG") 836 } else if ( match[2] ) { 837 push.apply( results, context.getElementsByTagName( selector ) ); 838 return results; 839 840 // Speed-up: Sizzle(".CLASS") 841 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { 842 push.apply( results, context.getElementsByClassName( m ) ); 843 return results; 844 } 845 } 846 847 // QSA path 848 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 849 nid = old = expando; 850 newContext = context; 851 newSelector = nodeType === 9 && selector; 852 853 // qSA works strangely on Element-rooted queries 854 // We can work around this by specifying an extra ID on the root 855 // and working up from there (Thanks to Andrew Dupont for the technique) 856 // IE 8 doesn't work on object elements 857 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { 858 groups = tokenize( selector ); 859 860 if ( (old = context.getAttribute("id")) ) { 861 nid = old.replace( rescape, "\\$&" ); 862 } else { 863 context.setAttribute( "id", nid ); 864 } 865 nid = "[id='" + nid + "'] "; 866 867 i = groups.length; 868 while ( i-- ) { 869 groups[i] = nid + toSelector( groups[i] ); 870 }
vendor: 4,490 bytes, lines 871-1053
871 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; 872 newSelector = groups.join(","); 873 } 874 875 if ( newSelector ) { 876 try { 877 push.apply( results, 878 newContext.querySelectorAll( newSelector ) 879 ); 880 return results; 881 } catch(qsaError) { 882 } finally { 883 if ( !old ) { 884 context.removeAttribute("id"); 885 } 886 } 887 } 888 } 889 } 890 891 // All others 892 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 893} 894 895/** 896 * Create key-value caches of limited size 897 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with 898 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 899 * deleting the oldest entry 900 */ 901function createCache() { 902 var keys = []; 903 904 function cache( key, value ) { 905 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 906 if ( keys.push( key + " " ) > Expr.cacheLength ) { 907 // Only keep the most recent entries 908 delete cache[ keys.shift() ]; 909 } 910 return (cache[ key + " " ] = value); 911 } 912 return cache; 913} 914 915/** 916 * Mark a function for special use by Sizzle 917 * @param {Function} fn The function to mark 918 */ 919function markFunction( fn ) { 920 fn[ expando ] = true; 921 return fn; 922} 923 924/** 925 * Support testing using an element 926 * @param {Function} fn Passed the created div and expects a boolean result 927 */ 928function assert( fn ) { 929 var div = document.createElement("div"); 930 931 try { 932 return !!fn( div ); 933 } catch (e) { 934 return false; 935 } finally { 936 // Remove from its parent by default 937 if ( div.parentNode ) { 938 div.parentNode.removeChild( div ); 939 } 940 // release memory in IE 941 div = null; 942 } 943} 944 945/** 946 * Adds the same handler for all of the specified attrs 947 * @param {String} attrs Pipe-separated list of attributes 948 * @param {Function} handler The method that will be applied 949 */ 950function addHandle( attrs, handler ) { 951 var arr = attrs.split("|"), 952 i = attrs.length; 953 954 while ( i-- ) { 955 Expr.attrHandle[ arr[i] ] = handler; 956 } 957} 958 959/** 960 * Checks document order of two siblings 961 * @param {Element} a 962 * @param {Element} b 963 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 964 */ 965function siblingCheck( a, b ) { 966 var cur = b && a, 967 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 968 ( ~b.sourceIndex || MAX_NEGATIVE ) - 969 ( ~a.sourceIndex || MAX_NEGATIVE ); 970 971 // Use IE sourceIndex if available on both nodes 972 if ( diff ) { 973 return diff; 974 } 975 976 // Check if b follows a 977 if ( cur ) { 978 while ( (cur = cur.nextSibling) ) { 979 if ( cur === b ) { 980 return -1; 981 } 982 } 983 } 984 985 return a ? 1 : -1; 986} 987 988/** 989 * Returns a function to use in pseudos for input types 990 * @param {String} type 991 */ 992function createInputPseudo( type ) { 993 return function( elem ) { 994 var name = elem.nodeName.toLowerCase(); 995 return name === "input" && elem.type === type; 996 }; 997} 998 999/** 1000 * Returns a function to use in pseudos for buttons 1001 * @param {String} type 1002 */ 1003function createButtonPseudo( type ) { 1004 return function( elem ) { 1005 var name = elem.nodeName.toLowerCase(); 1006 return (name === "input" || name === "button") && elem.type === type; 1007 }; 1008} 1009 1010/** 1011 * Returns a function to use in pseudos for positionals 1012 * @param {Function} fn 1013 */ 1014function createPositionalPseudo( fn ) { 1015 return markFunction(function( argument ) { 1016 argument = +argument; 1017 return markFunction(function( seed, matches ) { 1018 var j, 1019 matchIndexes = fn( [], seed.length, argument ), 1020 i = matchIndexes.length; 1021 1022 // Match elements found at the specified indexes 1023 while ( i-- ) { 1024 if ( seed[ (j = matchIndexes[i]) ] ) { 1025 seed[j] = !(matches[j] = seed[j]); 1026 } 1027 } 1028 }); 1029 }); 1030} 1031 1032/** 1033 * Checks a node for validity as a Sizzle context 1034 * @param {Element|Object=} context 1035 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1036 */ 1037function testContext( context ) { 1038 return context && typeof context.getElementsByTagName !== strundefined && context; 1039} 1040 1041// Expose support vars for convenience 1042support = Sizzle.support = {}; 1043 1044/** 1045 * Detects XML nodes 1046 * @param {Element|Object} elem An element or a document 1047 * @returns {Boolean} True iff elem is a non-HTML XML node 1048 */ 1049isXML = Sizzle.isXML = function( elem ) { 1050 // documentElement is verified for cases where it doesn't yet exist 1051 // (such as loading iframes in IE - #4833) 1052 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1053 return documentElement ? documentElement.nodeName !== "HTML" : false;
1054}; 1055 1056/** 1057 * Sets document-related variables once based on the current document 1058 * @param {Element|Object} [doc] An element or document object to use to set the document 1059 * @returns {Object} Returns the current document 1060 */ 1061setDocument = Sizzle.setDocument = function( node ) { 1062 var hasCompare, 1063 doc = node ? node.ownerDocument || node : preferredDoc, 1064 parent = doc.defaultView; 1065 1066 // If no document and documentElement is available, return 1067 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1068 return document; 1069 } 1070 1071 // Set our document 1072 document = doc; 1073 docElem = doc.documentElement; 1074 1075 // Support tests 1076 documentIsHTML = !isXML( doc ); 1077 1078 // Support: IE>8 1079 // If iframe document is assigned to "document" variable and if iframe has been reloaded, 1080 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 1081 // IE6-8 do not support the defaultView property so parent will be undefined 1082 if ( parent && parent !== parent.top ) { 1083 // IE11 does not have attachEvent, so all must suffer 1084 if ( parent.addEventListener ) { 1085 parent.addEventListener( "unload", function() { 1086 setDocument(); 1087 }, false ); 1088 } else if ( parent.attachEvent ) { 1089 parent.attachEvent( "onunload", function() { 1090 setDocument(); 1091 }); 1092 } 1093 } 1094 1095 /* Attributes 1096 ---------------------------------------------------------------------- */ 1097 1098 // Support: IE<8 1099 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) 1100 support.attributes = assert(function( div ) { 1101 div.className = "i"; 1102 return !div.getAttribute("className"); 1103 }); 1104 1105 /* getElement(s)By* 1106 ---------------------------------------------------------------------- */ 1107 1108 // Check if getElementsByTagName("*") returns only elements 1109 support.getElementsByTagName = assert(function( div ) { 1110 div.appendChild( doc.createComment("") ); 1111 return !div.getElementsByTagName("*").length; 1112 }); 1113 1114 // Check if getElementsByClassName can be trusted 1115 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { 1116 div.innerHTML = "<div class='a'></div><div class='a i'></div>"; 1117 1118 // Support: Safari<4 1119 // Catch class over-caching 1120 div.firstChild.className = "i"; 1121 // Support: Opera<10 1122 // Catch gEBCN failure to find non-leading classes 1123 return div.getElementsByClassName("i").length === 2; 1124 }); 1125 1126 // Support: IE<10 1127 // Check if getElementById returns elements by name 1128 // The broken getElementById methods don't pick up programatically-set names, 1129 // so use a roundabout getElementsByName test 1130 support.getById = assert(function( div ) { 1131 docElem.appendChild( div ).id = expando; 1132 return !doc.getElementsByName || !doc.getElementsByName( expando ).length; 1133 }); 1134 1135 // ID find and filter 1136 if ( support.getById ) { 1137 Expr.find["ID"] = function( id, context ) { 1138 if ( typeof context.getElementById !== strundefined && documentIsHTML ) { 1139 var m = context.getElementById( id ); 1140 // Check parentNode to catch when Blackberry 4.6 returns 1141 // nodes that are no longer in the document #6963 1142 return m && m.parentNode ? [ m ] : []; 1143 } 1144 }; 1145 Expr.filter["ID"] = function( id ) { 1146 var attrId = id.replace( runescape, funescape ); 1147 return function( elem ) { 1148 return elem.getAttribute("id") === attrId; 1149 }; 1150 }; 1151 } else {
vendor: 43,830 bytes, lines 1152-2706
1152 // Support: IE6/7 1153 // getElementById is not reliable as a find shortcut 1154 delete Expr.find["ID"]; 1155 1156 Expr.filter["ID"] = function( id ) { 1157 var attrId = id.replace( runescape, funescape ); 1158 return function( elem ) { 1159 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); 1160 return node && node.value === attrId; 1161 }; 1162 }; 1163 } 1164 1165 // Tag 1166 Expr.find["TAG"] = support.getElementsByTagName ? 1167 function( tag, context ) { 1168 if ( typeof context.getElementsByTagName !== strundefined ) { 1169 return context.getElementsByTagName( tag ); 1170 } 1171 } : 1172 function( tag, context ) { 1173 var elem, 1174 tmp = [], 1175 i = 0, 1176 results = context.getElementsByTagName( tag ); 1177 1178 // Filter out possible comments 1179 if ( tag === "*" ) { 1180 while ( (elem = results[i++]) ) { 1181 if ( elem.nodeType === 1 ) { 1182 tmp.push( elem ); 1183 } 1184 } 1185 1186 return tmp; 1187 } 1188 return results; 1189 }; 1190 1191 // Class 1192 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1193 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { 1194 return context.getElementsByClassName( className ); 1195 } 1196 }; 1197 1198 /* QSA/matchesSelector 1199 ---------------------------------------------------------------------- */ 1200 1201 // QSA and matchesSelector support 1202 1203 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1204 rbuggyMatches = []; 1205 1206 // qSa(:focus) reports false when true (Chrome 21) 1207 // We allow this because of a bug in IE8/9 that throws an error 1208 // whenever `document.activeElement` is accessed on an iframe 1209 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1210 // See http://bugs.jquery.com/ticket/13378 1211 rbuggyQSA = []; 1212 1213 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { 1214 // Build QSA regex 1215 // Regex strategy adopted from Diego Perini 1216 assert(function( div ) { 1217 // Select is set to empty string on purpose 1218 // This is to test IE's treatment of not explicitly 1219 // setting a boolean content attribute, 1220 // since its presence should be enough 1221 // http://bugs.jquery.com/ticket/12359 1222 div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; 1223 1224 // Support: IE8, Opera 11-12.16 1225 // Nothing should be selected when empty strings follow ^= or $= or *= 1226 // The test attribute must be unknown in Opera but "safe" for WinRT 1227 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1228 if ( div.querySelectorAll("[msallowclip^='']").length ) { 1229 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1230 } 1231 1232 // Support: IE8 1233 // Boolean attributes and "value" are not treated correctly 1234 if ( !div.querySelectorAll("[selected]").length ) { 1235 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1236 } 1237 1238 // Webkit/Opera - :checked should return selected option elements 1239 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1240 // IE8 throws error here and will not see later tests 1241 if ( !div.querySelectorAll(":checked").length ) { 1242 rbuggyQSA.push(":checked"); 1243 } 1244 }); 1245 1246 assert(function( div ) { 1247 // Support: Windows 8 Native Apps 1248 // The type and name attributes are restricted during .innerHTML assignment 1249 var input = doc.createElement("input"); 1250 input.setAttribute( "type", "hidden" ); 1251 div.appendChild( input ).setAttribute( "name", "D" ); 1252 1253 // Support: IE8 1254 // Enforce case-sensitivity of name attribute 1255 if ( div.querySelectorAll("[name=d]").length ) { 1256 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1257 } 1258 1259 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1260 // IE8 throws error here and will not see later tests 1261 if ( !div.querySelectorAll(":enabled").length ) { 1262 rbuggyQSA.push( ":enabled", ":disabled" ); 1263 } 1264 1265 // Opera 10-11 does not throw on post-comma invalid pseudos 1266 div.querySelectorAll("*,:x"); 1267 rbuggyQSA.push(",.*:"); 1268 }); 1269 } 1270 1271 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1272 docElem.webkitMatchesSelector || 1273 docElem.mozMatchesSelector || 1274 docElem.oMatchesSelector || 1275 docElem.msMatchesSelector) )) ) { 1276 1277 assert(function( div ) { 1278 // Check to see if it's possible to do matchesSelector 1279 // on a disconnected node (IE 9) 1280 support.disconnectedMatch = matches.call( div, "div" ); 1281 1282 // This should fail with an exception 1283 // Gecko does not error, returns false instead 1284 matches.call( div, "[s!='']:x" ); 1285 rbuggyMatches.push( "!=", pseudos ); 1286 }); 1287 } 1288 1289 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1290 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1291 1292 /* Contains 1293 ---------------------------------------------------------------------- */ 1294 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1295 1296 // Element contains another 1297 // Purposefully does not implement inclusive descendent 1298 // As in, an element does not contain itself 1299 contains = hasCompare || rnative.test( docElem.contains ) ? 1300 function( a, b ) { 1301 var adown = a.nodeType === 9 ? a.documentElement : a, 1302 bup = b && b.parentNode; 1303 return a === bup || !!( bup && bup.nodeType === 1 && ( 1304 adown.contains ? 1305 adown.contains( bup ) : 1306 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1307 )); 1308 } : 1309 function( a, b ) { 1310 if ( b ) { 1311 while ( (b = b.parentNode) ) { 1312 if ( b === a ) { 1313 return true; 1314 } 1315 } 1316 } 1317 return false; 1318 }; 1319 1320 /* Sorting 1321 ---------------------------------------------------------------------- */ 1322 1323 // Document order sorting 1324 sortOrder = hasCompare ? 1325 function( a, b ) { 1326 1327 // Flag for duplicate removal 1328 if ( a === b ) { 1329 hasDuplicate = true; 1330 return 0; 1331 } 1332 1333 // Sort on method existence if only one input has compareDocumentPosition 1334 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1335 if ( compare ) { 1336 return compare; 1337 } 1338 1339 // Calculate position if both inputs belong to the same document 1340 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1341 a.compareDocumentPosition( b ) : 1342 1343 // Otherwise we know they are disconnected 1344 1; 1345 1346 // Disconnected nodes 1347 if ( compare & 1 || 1348 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1349 1350 // Choose the first element that is related to our preferred document 1351 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1352 return -1; 1353 } 1354 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1355 return 1; 1356 } 1357 1358 // Maintain original order 1359 return sortInput ? 1360 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1361 0; 1362 } 1363 1364 return compare & 4 ? -1 : 1; 1365 } : 1366 function( a, b ) { 1367 // Exit early if the nodes are identical 1368 if ( a === b ) { 1369 hasDuplicate = true; 1370 return 0; 1371 } 1372 1373 var cur, 1374 i = 0, 1375 aup = a.parentNode, 1376 bup = b.parentNode, 1377 ap = [ a ], 1378 bp = [ b ]; 1379 1380 // Parentless nodes are either documents or disconnected 1381 if ( !aup || !bup ) { 1382 return a === doc ? -1 : 1383 b === doc ? 1 : 1384 aup ? -1 : 1385 bup ? 1 : 1386 sortInput ? 1387 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1388 0; 1389 1390 // If the nodes are siblings, we can do a quick check 1391 } else if ( aup === bup ) { 1392 return siblingCheck( a, b ); 1393 } 1394 1395 // Otherwise we need full lists of their ancestors for comparison 1396 cur = a; 1397 while ( (cur = cur.parentNode) ) { 1398 ap.unshift( cur ); 1399 } 1400 cur = b; 1401 while ( (cur = cur.parentNode) ) { 1402 bp.unshift( cur ); 1403 } 1404 1405 // Walk down the tree looking for a discrepancy 1406 while ( ap[i] === bp[i] ) { 1407 i++; 1408 } 1409 1410 return i ? 1411 // Do a sibling check if the nodes have a common ancestor 1412 siblingCheck( ap[i], bp[i] ) : 1413 1414 // Otherwise nodes in our document sort first 1415 ap[i] === preferredDoc ? -1 : 1416 bp[i] === preferredDoc ? 1 : 1417 0; 1418 }; 1419 1420 return doc; 1421}; 1422 1423Sizzle.matches = function( expr, elements ) { 1424 return Sizzle( expr, null, null, elements ); 1425}; 1426 1427Sizzle.matchesSelector = function( elem, expr ) { 1428 // Set document vars if needed 1429 if ( ( elem.ownerDocument || elem ) !== document ) { 1430 setDocument( elem ); 1431 } 1432 1433 // Make sure that attribute selectors are quoted 1434 expr = expr.replace( rattributeQuotes, "='$1']" ); 1435 1436 if ( support.matchesSelector && documentIsHTML && 1437 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1438 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1439 1440 try { 1441 var ret = matches.call( elem, expr ); 1442 1443 // IE 9's matchesSelector returns false on disconnected nodes 1444 if ( ret || support.disconnectedMatch || 1445 // As well, disconnected nodes are said to be in a document 1446 // fragment in IE 9 1447 elem.document && elem.document.nodeType !== 11 ) { 1448 return ret; 1449 } 1450 } catch(e) {} 1451 } 1452 1453 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1454}; 1455 1456Sizzle.contains = function( context, elem ) { 1457 // Set document vars if needed 1458 if ( ( context.ownerDocument || context ) !== document ) { 1459 setDocument( context ); 1460 } 1461 return contains( context, elem ); 1462}; 1463 1464Sizzle.attr = function( elem, name ) { 1465 // Set document vars if needed 1466 if ( ( elem.ownerDocument || elem ) !== document ) { 1467 setDocument( elem ); 1468 } 1469 1470 var fn = Expr.attrHandle[ name.toLowerCase() ], 1471 // Don't get fooled by Object.prototype properties (jQuery #13807) 1472 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1473 fn( elem, name, !documentIsHTML ) : 1474 undefined; 1475 1476 return val !== undefined ? 1477 val : 1478 support.attributes || !documentIsHTML ? 1479 elem.getAttribute( name ) : 1480 (val = elem.getAttributeNode(name)) && val.specified ? 1481 val.value : 1482 null; 1483}; 1484 1485Sizzle.error = function( msg ) { 1486 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1487}; 1488 1489/** 1490 * Document sorting and removing duplicates 1491 * @param {ArrayLike} results 1492 */ 1493Sizzle.uniqueSort = function( results ) { 1494 var elem, 1495 duplicates = [], 1496 j = 0, 1497 i = 0; 1498 1499 // Unless we *know* we can detect duplicates, assume their presence 1500 hasDuplicate = !support.detectDuplicates; 1501 sortInput = !support.sortStable && results.slice( 0 ); 1502 results.sort( sortOrder ); 1503 1504 if ( hasDuplicate ) { 1505 while ( (elem = results[i++]) ) { 1506 if ( elem === results[ i ] ) { 1507 j = duplicates.push( i ); 1508 } 1509 } 1510 while ( j-- ) { 1511 results.splice( duplicates[ j ], 1 ); 1512 } 1513 } 1514 1515 // Clear input after sorting to release objects 1516 // See https://github.com/jquery/sizzle/pull/225 1517 sortInput = null; 1518 1519 return results; 1520}; 1521 1522/** 1523 * Utility function for retrieving the text value of an array of DOM nodes 1524 * @param {Array|Element} elem 1525 */ 1526getText = Sizzle.getText = function( elem ) { 1527 var node, 1528 ret = "", 1529 i = 0, 1530 nodeType = elem.nodeType; 1531 1532 if ( !nodeType ) { 1533 // If no nodeType, this is expected to be an array 1534 while ( (node = elem[i++]) ) { 1535 // Do not traverse comment nodes 1536 ret += getText( node ); 1537 } 1538 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1539 // Use textContent for elements 1540 // innerText usage removed for consistency of new lines (jQuery #11153) 1541 if ( typeof elem.textContent === "string" ) { 1542 return elem.textContent; 1543 } else { 1544 // Traverse its children 1545 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1546 ret += getText( elem ); 1547 } 1548 } 1549 } else if ( nodeType === 3 || nodeType === 4 ) { 1550 return elem.nodeValue; 1551 } 1552 // Do not include comment or processing instruction nodes 1553 1554 return ret; 1555}; 1556 1557Expr = Sizzle.selectors = { 1558 1559 // Can be adjusted by the user 1560 cacheLength: 50, 1561 1562 createPseudo: markFunction, 1563 1564 match: matchExpr, 1565 1566 attrHandle: {}, 1567 1568 find: {}, 1569 1570 relative: { 1571 ">": { dir: "parentNode", first: true }, 1572 " ": { dir: "parentNode" }, 1573 "+": { dir: "previousSibling", first: true }, 1574 "~": { dir: "previousSibling" } 1575 }, 1576 1577 preFilter: { 1578 "ATTR": function( match ) { 1579 match[1] = match[1].replace( runescape, funescape ); 1580 1581 // Move the given value to match[3] whether quoted or unquoted 1582 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1583 1584 if ( match[2] === "~=" ) { 1585 match[3] = " " + match[3] + " "; 1586 } 1587 1588 return match.slice( 0, 4 ); 1589 }, 1590 1591 "CHILD": function( match ) { 1592 /* matches from matchExpr["CHILD"] 1593 1 type (only|nth|...) 1594 2 what (child|of-type) 1595 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1596 4 xn-component of xn+y argument ([+-]?\d*n|) 1597 5 sign of xn-component 1598 6 x of xn-component 1599 7 sign of y-component 1600 8 y of y-component 1601 */ 1602 match[1] = match[1].toLowerCase(); 1603 1604 if ( match[1].slice( 0, 3 ) === "nth" ) { 1605 // nth-* requires argument 1606 if ( !match[3] ) { 1607 Sizzle.error( match[0] ); 1608 } 1609 1610 // numeric x and y parameters for Expr.filter.CHILD 1611 // remember that false/true cast respectively to 0/1 1612 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1613 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1614 1615 // other types prohibit arguments 1616 } else if ( match[3] ) { 1617 Sizzle.error( match[0] ); 1618 } 1619 1620 return match; 1621 }, 1622 1623 "PSEUDO": function( match ) { 1624 var excess, 1625 unquoted = !match[6] && match[2]; 1626 1627 if ( matchExpr["CHILD"].test( match[0] ) ) { 1628 return null; 1629 } 1630 1631 // Accept quoted arguments as-is 1632 if ( match[3] ) { 1633 match[2] = match[4] || match[5] || ""; 1634 1635 // Strip excess characters from unquoted arguments 1636 } else if ( unquoted && rpseudo.test( unquoted ) && 1637 // Get excess from tokenize (recursively) 1638 (excess = tokenize( unquoted, true )) && 1639 // advance to the next closing parenthesis 1640 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1641 1642 // excess is a negative index 1643 match[0] = match[0].slice( 0, excess ); 1644 match[2] = unquoted.slice( 0, excess ); 1645 } 1646 1647 // Return only captures needed by the pseudo filter method (type and argument) 1648 return match.slice( 0, 3 ); 1649 } 1650 }, 1651 1652 filter: { 1653 1654 "TAG": function( nodeNameSelector ) { 1655 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1656 return nodeNameSelector === "*" ? 1657 function() { return true; } : 1658 function( elem ) { 1659 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1660 }; 1661 }, 1662 1663 "CLASS": function( className ) { 1664 var pattern = classCache[ className + " " ]; 1665 1666 return pattern || 1667 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1668 classCache( className, function( elem ) { 1669 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); 1670 }); 1671 }, 1672 1673 "ATTR": function( name, operator, check ) { 1674 return function( elem ) { 1675 var result = Sizzle.attr( elem, name ); 1676 1677 if ( result == null ) { 1678 return operator === "!="; 1679 } 1680 if ( !operator ) { 1681 return true; 1682 } 1683 1684 result += ""; 1685 1686 return operator === "=" ? result === check : 1687 operator === "!=" ? result !== check : 1688 operator === "^=" ? check && result.indexOf( check ) === 0 : 1689 operator === "*=" ? check && result.indexOf( check ) > -1 : 1690 operator === "$=" ? check && result.slice( -check.length ) === check : 1691 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : 1692 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1693 false; 1694 }; 1695 }, 1696 1697 "CHILD": function( type, what, argument, first, last ) { 1698 var simple = type.slice( 0, 3 ) !== "nth", 1699 forward = type.slice( -4 ) !== "last", 1700 ofType = what === "of-type"; 1701 1702 return first === 1 && last === 0 ? 1703 1704 // Shortcut for :nth-*(n) 1705 function( elem ) { 1706 return !!elem.parentNode; 1707 } : 1708 1709 function( elem, context, xml ) { 1710 var cache, outerCache, node, diff, nodeIndex, start, 1711 dir = simple !== forward ? "nextSibling" : "previousSibling", 1712 parent = elem.parentNode, 1713 name = ofType && elem.nodeName.toLowerCase(), 1714 useCache = !xml && !ofType; 1715 1716 if ( parent ) { 1717 1718 // :(first|last|only)-(child|of-type) 1719 if ( simple ) { 1720 while ( dir ) { 1721 node = elem; 1722 while ( (node = node[ dir ]) ) { 1723 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { 1724 return false; 1725 } 1726 } 1727 // Reverse direction for :only-* (if we haven't yet done so) 1728 start = dir = type === "only" && !start && "nextSibling"; 1729 } 1730 return true; 1731 } 1732 1733 start = [ forward ? parent.firstChild : parent.lastChild ]; 1734 1735 // non-xml :nth-child(...) stores cache data on `parent` 1736 if ( forward && useCache ) { 1737 // Seek `elem` from a previously-cached index 1738 outerCache = parent[ expando ] || (parent[ expando ] = {}); 1739 cache = outerCache[ type ] || []; 1740 nodeIndex = cache[0] === dirruns && cache[1]; 1741 diff = cache[0] === dirruns && cache[2]; 1742 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1743 1744 while ( (node = ++nodeIndex && node && node[ dir ] || 1745 1746 // Fallback to seeking `elem` from the start 1747 (diff = nodeIndex = 0) || start.pop()) ) { 1748 1749 // When found, cache indexes on `parent` and break 1750 if ( node.nodeType === 1 && ++diff && node === elem ) { 1751 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 1752 break; 1753 } 1754 } 1755 1756 // Use previously-cached element index if available 1757 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { 1758 diff = cache[1]; 1759 1760 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) 1761 } else { 1762 // Use the same loop as above to seek `elem` from the start 1763 while ( (node = ++nodeIndex && node && node[ dir ] || 1764 (diff = nodeIndex = 0) || start.pop()) ) { 1765 1766 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { 1767 // Cache the index of each encountered element 1768 if ( useCache ) { 1769 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; 1770 } 1771 1772 if ( node === elem ) { 1773 break; 1774 } 1775 } 1776 } 1777 } 1778 1779 // Incorporate the offset, then check against cycle size 1780 diff -= last; 1781 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1782 } 1783 }; 1784 }, 1785 1786 "PSEUDO": function( pseudo, argument ) { 1787 // pseudo-class names are case-insensitive 1788 // http://www.w3.org/TR/selectors/#pseudo-classes 1789 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1790 // Remember that setFilters inherits from pseudos 1791 var args, 1792 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1793 Sizzle.error( "unsupported pseudo: " + pseudo ); 1794 1795 // The user may use createPseudo to indicate that 1796 // arguments are needed to create the filter function 1797 // just as Sizzle does 1798 if ( fn[ expando ] ) { 1799 return fn( argument ); 1800 } 1801 1802 // But maintain support for old signatures 1803 if ( fn.length > 1 ) { 1804 args = [ pseudo, pseudo, "", argument ]; 1805 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1806 markFunction(function( seed, matches ) { 1807 var idx, 1808 matched = fn( seed, argument ), 1809 i = matched.length; 1810 while ( i-- ) { 1811 idx = indexOf.call( seed, matched[i] ); 1812 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1813 } 1814 }) : 1815 function( elem ) { 1816 return fn( elem, 0, args ); 1817 }; 1818 } 1819 1820 return fn; 1821 } 1822 }, 1823 1824 pseudos: { 1825 // Potentially complex pseudos 1826 "not": markFunction(function( selector ) { 1827 // Trim the selector passed to compile 1828 // to avoid treating leading and trailing 1829 // spaces as combinators 1830 var input = [], 1831 results = [], 1832 matcher = compile( selector.replace( rtrim, "$1" ) ); 1833 1834 return matcher[ expando ] ? 1835 markFunction(function( seed, matches, context, xml ) { 1836 var elem, 1837 unmatched = matcher( seed, null, xml, [] ), 1838 i = seed.length; 1839 1840 // Match elements unmatched by `matcher` 1841 while ( i-- ) { 1842 if ( (elem = unmatched[i]) ) { 1843 seed[i] = !(matches[i] = elem); 1844 } 1845 } 1846 }) : 1847 function( elem, context, xml ) { 1848 input[0] = elem; 1849 matcher( input, null, xml, results ); 1850 return !results.pop(); 1851 }; 1852 }), 1853 1854 "has": markFunction(function( selector ) { 1855 return function( elem ) { 1856 return Sizzle( selector, elem ).length > 0; 1857 }; 1858 }), 1859 1860 "contains": markFunction(function( text ) { 1861 return function( elem ) { 1862 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1863 }; 1864 }), 1865 1866 // "Whether an element is represented by a :lang() selector 1867 // is based solely on the element's language value 1868 // being equal to the identifier C, 1869 // or beginning with the identifier C immediately followed by "-". 1870 // The matching of C against the element's language value is performed case-insensitively. 1871 // The identifier C does not have to be a valid language name." 1872 // http://www.w3.org/TR/selectors/#lang-pseudo 1873 "lang": markFunction( function( lang ) { 1874 // lang value must be a valid identifier 1875 if ( !ridentifier.test(lang || "") ) { 1876 Sizzle.error( "unsupported lang: " + lang ); 1877 } 1878 lang = lang.replace( runescape, funescape ).toLowerCase(); 1879 return function( elem ) { 1880 var elemLang; 1881 do { 1882 if ( (elemLang = documentIsHTML ? 1883 elem.lang : 1884 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1885 1886 elemLang = elemLang.toLowerCase(); 1887 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1888 } 1889 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1890 return false; 1891 }; 1892 }), 1893 1894 // Miscellaneous 1895 "target": function( elem ) { 1896 var hash = window.location && window.location.hash; 1897 return hash && hash.slice( 1 ) === elem.id; 1898 }, 1899 1900 "root": function( elem ) { 1901 return elem === docElem; 1902 }, 1903 1904 "focus": function( elem ) { 1905 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 1906 }, 1907 1908 // Boolean properties 1909 "enabled": function( elem ) { 1910 return elem.disabled === false; 1911 }, 1912 1913 "disabled": function( elem ) { 1914 return elem.disabled === true; 1915 }, 1916 1917 "checked": function( elem ) { 1918 // In CSS3, :checked should return both checked and selected elements 1919 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1920 var nodeName = elem.nodeName.toLowerCase(); 1921 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 1922 }, 1923 1924 "selected": function( elem ) { 1925 // Accessing this property makes selected-by-default 1926 // options in Safari work properly 1927 if ( elem.parentNode ) { 1928 elem.parentNode.selectedIndex; 1929 } 1930 1931 return elem.selected === true; 1932 }, 1933 1934 // Contents 1935 "empty": function( elem ) { 1936 // http://www.w3.org/TR/selectors/#empty-pseudo 1937 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1938 // but not by others (comment: 8; processing instruction: 7; etc.) 1939 // nodeType < 6 works because attributes (2) do not appear as children 1940 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1941 if ( elem.nodeType < 6 ) { 1942 return false; 1943 } 1944 } 1945 return true; 1946 }, 1947 1948 "parent": function( elem ) { 1949 return !Expr.pseudos["empty"]( elem ); 1950 }, 1951 1952 // Element/input types 1953 "header": function( elem ) { 1954 return rheader.test( elem.nodeName ); 1955 }, 1956 1957 "input": function( elem ) { 1958 return rinputs.test( elem.nodeName ); 1959 }, 1960 1961 "button": function( elem ) { 1962 var name = elem.nodeName.toLowerCase(); 1963 return name === "input" && elem.type === "button" || name === "button"; 1964 }, 1965 1966 "text": function( elem ) { 1967 var attr; 1968 return elem.nodeName.toLowerCase() === "input" && 1969 elem.type === "text" && 1970 1971 // Support: IE<8 1972 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 1973 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 1974 }, 1975 1976 // Position-in-collection 1977 "first": createPositionalPseudo(function() { 1978 return [ 0 ]; 1979 }), 1980 1981 "last": createPositionalPseudo(function( matchIndexes, length ) { 1982 return [ length - 1 ]; 1983 }), 1984 1985 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 1986 return [ argument < 0 ? argument + length : argument ]; 1987 }), 1988 1989 "even": createPositionalPseudo(function( matchIndexes, length ) { 1990 var i = 0; 1991 for ( ; i < length; i += 2 ) { 1992 matchIndexes.push( i ); 1993 } 1994 return matchIndexes; 1995 }), 1996 1997 "odd": createPositionalPseudo(function( matchIndexes, length ) { 1998 var i = 1; 1999 for ( ; i < length; i += 2 ) { 2000 matchIndexes.push( i ); 2001 } 2002 return matchIndexes; 2003 }), 2004 2005 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2006 var i = argument < 0 ? argument + length : argument; 2007 for ( ; --i >= 0; ) { 2008 matchIndexes.push( i ); 2009 } 2010 return matchIndexes; 2011 }), 2012 2013 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2014 var i = argument < 0 ? argument + length : argument; 2015 for ( ; ++i < length; ) { 2016 matchIndexes.push( i ); 2017 } 2018 return matchIndexes; 2019 }) 2020 } 2021}; 2022 2023Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2024 2025// Add button/input type pseudos 2026for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2027 Expr.pseudos[ i ] = createInputPseudo( i ); 2028} 2029for ( i in { submit: true, reset: true } ) { 2030 Expr.pseudos[ i ] = createButtonPseudo( i ); 2031} 2032 2033// Easy API for creating new setFilters 2034function setFilters() {} 2035setFilters.prototype = Expr.filters = Expr.pseudos; 2036Expr.setFilters = new setFilters(); 2037 2038tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2039 var matched, match, tokens, type, 2040 soFar, groups, preFilters, 2041 cached = tokenCache[ selector + " " ]; 2042 2043 if ( cached ) { 2044 return parseOnly ? 0 : cached.slice( 0 ); 2045 } 2046 2047 soFar = selector; 2048 groups = []; 2049 preFilters = Expr.preFilter; 2050 2051 while ( soFar ) { 2052 2053 // Comma and first run 2054 if ( !matched || (match = rcomma.exec( soFar )) ) { 2055 if ( match ) { 2056 // Don't consume trailing commas as valid 2057 soFar = soFar.slice( match[0].length ) || soFar; 2058 } 2059 groups.push( (tokens = []) ); 2060 } 2061 2062 matched = false; 2063 2064 // Combinators 2065 if ( (match = rcombinators.exec( soFar )) ) { 2066 matched = match.shift(); 2067 tokens.push({ 2068 value: matched, 2069 // Cast descendant combinators to space 2070 type: match[0].replace( rtrim, " " ) 2071 }); 2072 soFar = soFar.slice( matched.length ); 2073 } 2074 2075 // Filters 2076 for ( type in Expr.filter ) { 2077 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2078 (match = preFilters[ type ]( match ))) ) { 2079 matched = match.shift(); 2080 tokens.push({ 2081 value: matched, 2082 type: type, 2083 matches: match 2084 }); 2085 soFar = soFar.slice( matched.length ); 2086 } 2087 } 2088 2089 if ( !matched ) { 2090 break; 2091 } 2092 } 2093 2094 // Return the length of the invalid excess 2095 // if we're just parsing 2096 // Otherwise, throw an error or return tokens 2097 return parseOnly ? 2098 soFar.length : 2099 soFar ? 2100 Sizzle.error( selector ) : 2101 // Cache the tokens 2102 tokenCache( selector, groups ).slice( 0 ); 2103}; 2104 2105function toSelector( tokens ) { 2106 var i = 0, 2107 len = tokens.length, 2108 selector = ""; 2109 for ( ; i < len; i++ ) { 2110 selector += tokens[i].value; 2111 } 2112 return selector; 2113} 2114 2115function addCombinator( matcher, combinator, base ) { 2116 var dir = combinator.dir, 2117 checkNonElements = base && dir === "parentNode", 2118 doneName = done++; 2119 2120 return combinator.first ? 2121 // Check against closest ancestor/preceding element 2122 function( elem, context, xml ) { 2123 while ( (elem = elem[ dir ]) ) { 2124 if ( elem.nodeType === 1 || checkNonElements ) { 2125 return matcher( elem, context, xml ); 2126 } 2127 } 2128 } : 2129 2130 // Check against all ancestor/preceding elements 2131 function( elem, context, xml ) { 2132 var oldCache, outerCache, 2133 newCache = [ dirruns, doneName ]; 2134 2135 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching 2136 if ( xml ) { 2137 while ( (elem = elem[ dir ]) ) { 2138 if ( elem.nodeType === 1 || checkNonElements ) { 2139 if ( matcher( elem, context, xml ) ) { 2140 return true; 2141 } 2142 } 2143 } 2144 } else { 2145 while ( (elem = elem[ dir ]) ) { 2146 if ( elem.nodeType === 1 || checkNonElements ) { 2147 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2148 if ( (oldCache = outerCache[ dir ]) && 2149 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2150 2151 // Assign to newCache so results back-propagate to previous elements 2152 return (newCache[ 2 ] = oldCache[ 2 ]); 2153 } else { 2154 // Reuse newcache so results back-propagate to previous elements 2155 outerCache[ dir ] = newCache; 2156 2157 // A match means we're done; a fail means we have to keep checking 2158 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2159 return true; 2160 } 2161 } 2162 } 2163 } 2164 } 2165 }; 2166} 2167 2168function elementMatcher( matchers ) { 2169 return matchers.length > 1 ? 2170 function( elem, context, xml ) { 2171 var i = matchers.length; 2172 while ( i-- ) { 2173 if ( !matchers[i]( elem, context, xml ) ) { 2174 return false; 2175 } 2176 } 2177 return true; 2178 } : 2179 matchers[0]; 2180} 2181 2182function multipleContexts( selector, contexts, results ) { 2183 var i = 0, 2184 len = contexts.length; 2185 for ( ; i < len; i++ ) { 2186 Sizzle( selector, contexts[i], results ); 2187 } 2188 return results; 2189} 2190 2191function condense( unmatched, map, filter, context, xml ) { 2192 var elem, 2193 newUnmatched = [], 2194 i = 0, 2195 len = unmatched.length, 2196 mapped = map != null; 2197 2198 for ( ; i < len; i++ ) { 2199 if ( (elem = unmatched[i]) ) { 2200 if ( !filter || filter( elem, context, xml ) ) { 2201 newUnmatched.push( elem ); 2202 if ( mapped ) { 2203 map.push( i ); 2204 } 2205 } 2206 } 2207 } 2208 2209 return newUnmatched; 2210} 2211 2212function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2213 if ( postFilter && !postFilter[ expando ] ) { 2214 postFilter = setMatcher( postFilter ); 2215 } 2216 if ( postFinder && !postFinder[ expando ] ) { 2217 postFinder = setMatcher( postFinder, postSelector ); 2218 } 2219 return markFunction(function( seed, results, context, xml ) { 2220 var temp, i, elem, 2221 preMap = [], 2222 postMap = [], 2223 preexisting = results.length, 2224 2225 // Get initial elements from seed or context 2226 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2227 2228 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2229 matcherIn = preFilter && ( seed || !selector ) ? 2230 condense( elems, preMap, preFilter, context, xml ) : 2231 elems, 2232 2233 matcherOut = matcher ? 2234 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2235 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2236 2237 // ...intermediate processing is necessary 2238 [] : 2239 2240 // ...otherwise use results directly 2241 results : 2242 matcherIn; 2243 2244 // Find primary matches 2245 if ( matcher ) { 2246 matcher( matcherIn, matcherOut, context, xml ); 2247 } 2248 2249 // Apply postFilter 2250 if ( postFilter ) { 2251 temp = condense( matcherOut, postMap ); 2252 postFilter( temp, [], context, xml ); 2253 2254 // Un-match failing elements by moving them back to matcherIn 2255 i = temp.length; 2256 while ( i-- ) { 2257 if ( (elem = temp[i]) ) { 2258 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2259 } 2260 } 2261 } 2262 2263 if ( seed ) { 2264 if ( postFinder || preFilter ) { 2265 if ( postFinder ) { 2266 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2267 temp = []; 2268 i = matcherOut.length; 2269 while ( i-- ) { 2270 if ( (elem = matcherOut[i]) ) { 2271 // Restore matcherIn since elem is not yet a final match 2272 temp.push( (matcherIn[i] = elem) ); 2273 } 2274 } 2275 postFinder( null, (matcherOut = []), temp, xml ); 2276 } 2277 2278 // Move matched elements from seed to results to keep them synchronized 2279 i = matcherOut.length; 2280 while ( i-- ) { 2281 if ( (elem = matcherOut[i]) && 2282 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { 2283 2284 seed[temp] = !(results[temp] = elem); 2285 } 2286 } 2287 } 2288 2289 // Add elements to results, through postFinder if defined 2290 } else { 2291 matcherOut = condense( 2292 matcherOut === results ? 2293 matcherOut.splice( preexisting, matcherOut.length ) : 2294 matcherOut 2295 ); 2296 if ( postFinder ) { 2297 postFinder( null, results, matcherOut, xml ); 2298 } else { 2299 push.apply( results, matcherOut ); 2300 } 2301 } 2302 }); 2303} 2304 2305function matcherFromTokens( tokens ) { 2306 var checkContext, matcher, j, 2307 len = tokens.length, 2308 leadingRelative = Expr.relative[ tokens[0].type ], 2309 implicitRelative = leadingRelative || Expr.relative[" "], 2310 i = leadingRelative ? 1 : 0, 2311 2312 // The foundational matcher ensures that elements are reachable from top-level context(s) 2313 matchContext = addCombinator( function( elem ) { 2314 return elem === checkContext; 2315 }, implicitRelative, true ), 2316 matchAnyContext = addCombinator( function( elem ) { 2317 return indexOf.call( checkContext, elem ) > -1; 2318 }, implicitRelative, true ), 2319 matchers = [ function( elem, context, xml ) { 2320 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2321 (checkContext = context).nodeType ? 2322 matchContext( elem, context, xml ) : 2323 matchAnyContext( elem, context, xml ) ); 2324 } ]; 2325 2326 for ( ; i < len; i++ ) { 2327 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2328 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2329 } else { 2330 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2331 2332 // Return special upon seeing a positional matcher 2333 if ( matcher[ expando ] ) { 2334 // Find the next relative operator (if any) for proper handling 2335 j = ++i; 2336 for ( ; j < len; j++ ) { 2337 if ( Expr.relative[ tokens[j].type ] ) { 2338 break; 2339 } 2340 } 2341 return setMatcher( 2342 i > 1 && elementMatcher( matchers ), 2343 i > 1 && toSelector( 2344 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2345 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2346 ).replace( rtrim, "$1" ), 2347 matcher, 2348 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2349 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2350 j < len && toSelector( tokens ) 2351 ); 2352 } 2353 matchers.push( matcher ); 2354 } 2355 } 2356 2357 return elementMatcher( matchers ); 2358} 2359 2360function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2361 var bySet = setMatchers.length > 0, 2362 byElement = elementMatchers.length > 0, 2363 superMatcher = function( seed, context, xml, results, outermost ) { 2364 var elem, j, matcher, 2365 matchedCount = 0, 2366 i = "0", 2367 unmatched = seed && [], 2368 setMatched = [], 2369 contextBackup = outermostContext, 2370 // We must always have either seed elements or outermost context 2371 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2372 // Use integer dirruns iff this is the outermost matcher 2373 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2374 len = elems.length; 2375 2376 if ( outermost ) { 2377 outermostContext = context !== document && context; 2378 } 2379 2380 // Add elements passing elementMatchers directly to results 2381 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below 2382 // Support: IE<9, Safari 2383 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2384 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2385 if ( byElement && elem ) { 2386 j = 0; 2387 while ( (matcher = elementMatchers[j++]) ) { 2388 if ( matcher( elem, context, xml ) ) { 2389 results.push( elem ); 2390 break; 2391 } 2392 } 2393 if ( outermost ) { 2394 dirruns = dirrunsUnique; 2395 } 2396 } 2397 2398 // Track unmatched elements for set filters 2399 if ( bySet ) { 2400 // They will have gone through all possible matchers 2401 if ( (elem = !matcher && elem) ) { 2402 matchedCount--; 2403 } 2404 2405 // Lengthen the array for every element, matched or not 2406 if ( seed ) { 2407 unmatched.push( elem ); 2408 } 2409 } 2410 } 2411 2412 // Apply set filters to unmatched elements 2413 matchedCount += i; 2414 if ( bySet && i !== matchedCount ) { 2415 j = 0; 2416 while ( (matcher = setMatchers[j++]) ) { 2417 matcher( unmatched, setMatched, context, xml ); 2418 } 2419 2420 if ( seed ) { 2421 // Reintegrate element matches to eliminate the need for sorting 2422 if ( matchedCount > 0 ) { 2423 while ( i-- ) { 2424 if ( !(unmatched[i] || setMatched[i]) ) { 2425 setMatched[i] = pop.call( results ); 2426 } 2427 } 2428 } 2429 2430 // Discard index placeholder values to get only actual matches 2431 setMatched = condense( setMatched ); 2432 } 2433 2434 // Add matches to results 2435 push.apply( results, setMatched ); 2436 2437 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2438 if ( outermost && !seed && setMatched.length > 0 && 2439 ( matchedCount + setMatchers.length ) > 1 ) { 2440 2441 Sizzle.uniqueSort( results ); 2442 } 2443 } 2444 2445 // Override manipulation of globals by nested matchers 2446 if ( outermost ) { 2447 dirruns = dirrunsUnique; 2448 outermostContext = contextBackup; 2449 } 2450 2451 return unmatched; 2452 }; 2453 2454 return bySet ? 2455 markFunction( superMatcher ) : 2456 superMatcher; 2457} 2458 2459compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2460 var i, 2461 setMatchers = [], 2462 elementMatchers = [], 2463 cached = compilerCache[ selector + " " ]; 2464 2465 if ( !cached ) { 2466 // Generate a function of recursive functions that can be used to check each element 2467 if ( !match ) { 2468 match = tokenize( selector ); 2469 } 2470 i = match.length; 2471 while ( i-- ) { 2472 cached = matcherFromTokens( match[i] ); 2473 if ( cached[ expando ] ) { 2474 setMatchers.push( cached ); 2475 } else { 2476 elementMatchers.push( cached ); 2477 } 2478 } 2479 2480 // Cache the compiled function 2481 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2482 2483 // Save selector and tokenization 2484 cached.selector = selector; 2485 } 2486 return cached; 2487}; 2488 2489/** 2490 * A low-level selection function that works with Sizzle's compiled 2491 * selector functions 2492 * @param {String|Function} selector A selector or a pre-compiled 2493 * selector function built with Sizzle.compile 2494 * @param {Element} context 2495 * @param {Array} [results] 2496 * @param {Array} [seed] A set of elements to match against 2497 */ 2498select = Sizzle.select = function( selector, context, results, seed ) { 2499 var i, tokens, token, type, find, 2500 compiled = typeof selector === "function" && selector, 2501 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2502 2503 results = results || []; 2504 2505 // Try to minimize operations if there is no seed and only one group 2506 if ( match.length === 1 ) { 2507 2508 // Take a shortcut and set the context if the root selector is an ID 2509 tokens = match[0] = match[0].slice( 0 ); 2510 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2511 support.getById && context.nodeType === 9 && documentIsHTML && 2512 Expr.relative[ tokens[1].type ] ) { 2513 2514 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2515 if ( !context ) { 2516 return results; 2517 2518 // Precompiled matchers will still verify ancestry, so step up a level 2519 } else if ( compiled ) { 2520 context = context.parentNode; 2521 } 2522 2523 selector = selector.slice( tokens.shift().value.length ); 2524 } 2525 2526 // Fetch a seed set for right-to-left matching 2527 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2528 while ( i-- ) { 2529 token = tokens[i]; 2530 2531 // Abort if we hit a combinator 2532 if ( Expr.relative[ (type = token.type) ] ) { 2533 break; 2534 } 2535 if ( (find = Expr.find[ type ]) ) { 2536 // Search, expanding context for leading sibling combinators 2537 if ( (seed = find( 2538 token.matches[0].replace( runescape, funescape ), 2539 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2540 )) ) { 2541 2542 // If seed is empty or no tokens remain, we can return early 2543 tokens.splice( i, 1 ); 2544 selector = seed.length && toSelector( tokens ); 2545 if ( !selector ) { 2546 push.apply( results, seed ); 2547 return results; 2548 } 2549 2550 break; 2551 } 2552 } 2553 } 2554 } 2555 2556 // Compile and execute a filtering function if one is not provided 2557 // Provide `match` to avoid retokenization if we modified the selector above 2558 ( compiled || compile( selector, match ) )( 2559 seed, 2560 context, 2561 !documentIsHTML, 2562 results, 2563 rsibling.test( selector ) && testContext( context.parentNode ) || context 2564 ); 2565 return results; 2566}; 2567 2568// One-time assignments 2569 2570// Sort stability 2571support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2572 2573// Support: Chrome<14 2574// Always assume duplicates if they aren't passed to the comparison function 2575support.detectDuplicates = !!hasDuplicate; 2576 2577// Initialize against the default document 2578setDocument(); 2579 2580// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2581// Detached nodes confoundingly follow *each other* 2582support.sortDetached = assert(function( div1 ) { 2583 // Should return 1, but returns 4 (following) 2584 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 2585}); 2586 2587// Support: IE<8 2588// Prevent attribute/property "interpolation" 2589// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2590if ( !assert(function( div ) { 2591 div.innerHTML = "<a href='#'></a>"; 2592 return div.firstChild.getAttribute("href") === "#" ; 2593}) ) { 2594 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2595 if ( !isXML ) { 2596 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2597 } 2598 }); 2599} 2600 2601// Support: IE<9 2602// Use defaultValue in place of getAttribute("value") 2603if ( !support.attributes || !assert(function( div ) { 2604 div.innerHTML = "<input/>"; 2605 div.firstChild.setAttribute( "value", "" ); 2606 return div.firstChild.getAttribute( "value" ) === ""; 2607}) ) { 2608 addHandle( "value", function( elem, name, isXML ) { 2609 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2610 return elem.defaultValue; 2611 } 2612 }); 2613} 2614 2615// Support: IE<9 2616// Use getAttributeNode to fetch booleans when getAttribute lies 2617if ( !assert(function( div ) { 2618 return div.getAttribute("disabled") == null; 2619}) ) { 2620 addHandle( booleans, function( elem, name, isXML ) { 2621 var val; 2622 if ( !isXML ) { 2623 return elem[ name ] === true ? name.toLowerCase() : 2624 (val = elem.getAttributeNode( name )) && val.specified ? 2625 val.value : 2626 null; 2627 } 2628 }); 2629} 2630 2631return Sizzle; 2632 2633})( window ); 2634 2635 2636 2637jQuery.find = Sizzle; 2638jQuery.expr = Sizzle.selectors; 2639jQuery.expr[":"] = jQuery.expr.pseudos; 2640jQuery.unique = Sizzle.uniqueSort; 2641jQuery.text = Sizzle.getText; 2642jQuery.isXMLDoc = Sizzle.isXML; 2643jQuery.contains = Sizzle.contains; 2644 2645 2646 2647var rneedsContext = jQuery.expr.match.needsContext; 2648 2649var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 2650 2651 2652 2653var risSimple = /^.[^:#\[\.,]*$/; 2654 2655// Implement the identical functionality for filter and not 2656function winnow( elements, qualifier, not ) { 2657 if ( jQuery.isFunction( qualifier ) ) { 2658 return jQuery.grep( elements, function( elem, i ) { 2659 /* jshint -W018 */ 2660 return !!qualifier.call( elem, i, elem ) !== not; 2661 }); 2662 2663 } 2664 2665 if ( qualifier.nodeType ) { 2666 return jQuery.grep( elements, function( elem ) { 2667 return ( elem === qualifier ) !== not; 2668 }); 2669 2670 } 2671 2672 if ( typeof qualifier === "string" ) { 2673 if ( risSimple.test( qualifier ) ) { 2674 return jQuery.filter( qualifier, elements, not ); 2675 } 2676 2677 qualifier = jQuery.filter( qualifier, elements ); 2678 } 2679 2680 return jQuery.grep( elements, function( elem ) { 2681 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; 2682 }); 2683} 2684 2685jQuery.filter = function( expr, elems, not ) { 2686 var elem = elems[ 0 ]; 2687 2688 if ( not ) { 2689 expr = ":not(" + expr + ")"; 2690 } 2691 2692 return elems.length === 1 && elem.nodeType === 1 ? 2693 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 2694 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2695 return elem.nodeType === 1; 2696 })); 2697}; 2698 2699jQuery.fn.extend({ 2700 find: function( selector ) { 2701 var i, 2702 ret = [], 2703 self = this, 2704 len = self.length; 2705 2706 if ( typeof selector !== "string" ) {
2707 return this.pushStack( jQuery( selector ).filter(function() { 2708 for ( i = 0; i < len; i++ ) { 2709 if ( jQuery.contains( self[ i ], this ) ) { 2710 return true; 2711 } 2712 } 2713 }) ); 2714 } 2715 2716 for ( i = 0; i < len; i++ ) { 2717 jQuery.find( selector, self[ i ], ret ); 2718 } 2719 2720 // Needed because $( selector, context ) becomes $( context ).find( selector ) 2721 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 2722 ret.selector = this.selector ? this.selector + " " + selector : selector; 2723 return ret; 2724 }, 2725 filter: function( selector ) { 2726 return this.pushStack( winnow(this, selector || [], false) ); 2727 }, 2728 not: function( selector ) { 2729 return this.pushStack( winnow(this, selector || [], true) ); 2730 }, 2731 is: function( selector ) { 2732 return !!winnow( 2733 this, 2734 2735 // If this is a positional/relative selector, check membership in the returned set 2736 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2737 typeof selector === "string" && rneedsContext.test( selector ) ? 2738 jQuery( selector ) : 2739 selector || [], 2740 false 2741 ).length; 2742 } 2743}); 2744 2745 2746// Initialize a jQuery object 2747 2748 2749// A central reference to the root jQuery(document) 2750var rootjQuery, 2751 2752 // Use the correct document accordingly with window argument (sandbox) 2753 document = window.document, 2754 2755 // A simple way to check for HTML strings 2756 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2757 // Strict HTML recognition (#11290: must start with <) 2758 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 2759 2760 init = jQuery.fn.init = function( selector, context ) { 2761 var match, elem; 2762 2763 // HANDLE: $(""), $(null), $(undefined), $(false) 2764 if ( !selector ) { 2765 return this; 2766 } 2767 2768 // Handle HTML strings 2769 if ( typeof selector === "string" ) { 2770 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { 2771 // Assume that strings that start and end with <> are HTML and skip the regex check 2772 match = [ null, selector, null ]; 2773 2774 } else { 2775 match = rquickExpr.exec( selector ); 2776 } 2777 2778 // Match html or make sure no context is specified for #id 2779 if ( match && (match[1] || !context) ) { 2780 2781 // HANDLE: $(html) -> $(array) 2782 if ( match[1] ) { 2783 context = context instanceof jQuery ? context[0] : context; 2784 2785 // scripts is true for back-compat 2786 // Intentionally let the error be thrown if parseHTML is not present 2787 jQuery.merge( this, jQuery.parseHTML( 2788 match[1], 2789 context && context.nodeType ? context.ownerDocument || context : document, 2790 true 2791 ) ); 2792 2793 // HANDLE: $(html, props) 2794 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { 2795 for ( match in context ) { 2796 // Properties of context are called as methods if possible 2797 if ( jQuery.isFunction( this[ match ] ) ) { 2798 this[ match ]( context[ match ] ); 2799 2800 // ...and otherwise set as attributes 2801 } else { 2802 this.attr( match, context[ match ] ); 2803 } 2804 } 2805 } 2806 2807 return this; 2808 2809 // HANDLE: $(#id) 2810 } else { 2811 elem = document.getElementById( match[2] ); 2812 2813 // Check parentNode to catch when Blackberry 4.6 returns 2814 // nodes that are no longer in the document #6963 2815 if ( elem && elem.parentNode ) { 2816 // Handle the case where IE and Opera return items 2817 // by name instead of ID 2818 if ( elem.id !== match[2] ) { 2819 return rootjQuery.find( selector ); 2820 } 2821 2822 // Otherwise, we inject the element directly into the jQuery object 2823 this.length = 1; 2824 this[0] = elem; 2825 } 2826 2827 this.context = document; 2828 this.selector = selector; 2829 return this; 2830 } 2831 2832 // HANDLE: $(expr, $(...)) 2833 } else if ( !context || context.jquery ) { 2834 return ( context || rootjQuery ).find( selector ); 2835 2836 // HANDLE: $(expr, context) 2837 // (which is just equivalent to: $(context).find(expr) 2838 } else { 2839 return this.constructor( context ).find( selector ); 2840 } 2841 2842 // HANDLE: $(DOMElement) 2843 } else if ( selector.nodeType ) { 2844 this.context = this[0] = selector; 2845 this.length = 1; 2846 return this; 2847 2848 // HANDLE: $(function) 2849 // Shortcut for document ready 2850 } else if ( jQuery.isFunction( selector ) ) { 2851 return typeof rootjQuery.ready !== "undefined" ? 2852 rootjQuery.ready( selector ) : 2853 // Execute immediately if ready is not present 2854 selector( jQuery ); 2855 } 2856 2857 if ( selector.selector !== undefined ) { 2858 this.selector = selector.selector; 2859 this.context = selector.context; 2860 } 2861 2862 return jQuery.makeArray( selector, this ); 2863 }; 2864 2865// Give the init function the jQuery prototype for later instantiation 2866init.prototype = jQuery.fn; 2867 2868// Initialize central reference 2869rootjQuery = jQuery( document ); 2870 2871 2872var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2873 // methods guaranteed to produce a unique set when starting from a unique set 2874 guaranteedUnique = { 2875 children: true, 2876 contents: true, 2877 next: true, 2878 prev: true 2879 }; 2880 2881jQuery.extend({ 2882 dir: function( elem, dir, until ) { 2883 var matched = [], 2884 cur = elem[ dir ]; 2885 2886 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { 2887 if ( cur.nodeType === 1 ) { 2888 matched.push( cur ); 2889 } 2890 cur = cur[dir]; 2891 } 2892 return matched; 2893 }, 2894 2895 sibling: function( n, elem ) { 2896 var r = []; 2897 2898 for ( ; n; n = n.nextSibling ) { 2899 if ( n.nodeType === 1 && n !== elem ) { 2900 r.push( n ); 2901 } 2902 } 2903 2904 return r; 2905 } 2906}); 2907 2908jQuery.fn.extend({ 2909 has: function( target ) { 2910 var i, 2911 targets = jQuery( target, this ), 2912 len = targets.length; 2913 2914 return this.filter(function() { 2915 for ( i = 0; i < len; i++ ) { 2916 if ( jQuery.contains( this, targets[i] ) ) { 2917 return true; 2918 } 2919 } 2920 }); 2921 }, 2922 2923 closest: function( selectors, context ) { 2924 var cur, 2925 i = 0, 2926 l = this.length, 2927 matched = [], 2928 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
2929 jQuery( selectors, context || this.context ) : 2930 0; 2931 2932 for ( ; i < l; i++ ) { 2933 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { 2934 // Always skip document fragments 2935 if ( cur.nodeType < 11 && (pos ? 2936 pos.index(cur) > -1 : 2937 2938 // Don't pass non-elements to Sizzle 2939 cur.nodeType === 1 && 2940 jQuery.find.matchesSelector(cur, selectors)) ) { 2941 2942 matched.push( cur ); 2943 break; 2944 } 2945 } 2946 } 2947 2948 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); 2949 }, 2950 2951 // Determine the position of an element within 2952 // the matched set of elements 2953 index: function( elem ) { 2954 2955 // No argument, return index in parent 2956 if ( !elem ) { 2957 return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; 2958 } 2959 2960 // index in selector 2961 if ( typeof elem === "string" ) { 2962 return jQuery.inArray( this[0], jQuery( elem ) ); 2963 } 2964 2965 // Locate the position of the desired element 2966 return jQuery.inArray( 2967 // If it receives a jQuery object, the first element is used 2968 elem.jquery ? elem[0] : elem, this ); 2969 }, 2970 2971 add: function( selector, context ) { 2972 return this.pushStack( 2973 jQuery.unique( 2974 jQuery.merge( this.get(), jQuery( selector, context ) ) 2975 ) 2976 ); 2977 }, 2978 2979 addBack: function( selector ) { 2980 return this.add( selector == null ? 2981 this.prevObject : this.prevObject.filter(selector) 2982 ); 2983 } 2984}); 2985 2986function sibling( cur, dir ) { 2987 do { 2988 cur = cur[ dir ]; 2989 } while ( cur && cur.nodeType !== 1 ); 2990 2991 return cur; 2992} 2993 2994jQuery.each({ 2995 parent: function( elem ) { 2996 var parent = elem.parentNode; 2997 return parent && parent.nodeType !== 11 ? parent : null; 2998 }, 2999 parents: function( elem ) { 3000 return jQuery.dir( elem, "parentNode" ); 3001 }, 3002 parentsUntil: function( elem, i, until ) { 3003 return jQuery.dir( elem, "parentNode", until ); 3004 }, 3005 next: function( elem ) { 3006 return sibling( elem, "nextSibling" ); 3007 }, 3008 prev: function( elem ) { 3009 return sibling( elem, "previousSibling" ); 3010 }, 3011 nextAll: function( elem ) { 3012 return jQuery.dir( elem, "nextSibling" ); 3013 }, 3014 prevAll: function( elem ) { 3015 return jQuery.dir( elem, "previousSibling" ); 3016 }, 3017 nextUntil: function( elem, i, until ) { 3018 return jQuery.dir( elem, "nextSibling", until ); 3019 }, 3020 prevUntil: function( elem, i, until ) { 3021 return jQuery.dir( elem, "previousSibling", until ); 3022 }, 3023 siblings: function( elem ) { 3024 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); 3025 }, 3026 children: function( elem ) { 3027 return jQuery.sibling( elem.firstChild ); 3028 }, 3029 contents: function( elem ) { 3030 return jQuery.nodeName( elem, "iframe" ) ? 3031 elem.contentDocument || elem.contentWindow.document : 3032 jQuery.merge( [], elem.childNodes ); 3033 } 3034}, function( name, fn ) { 3035 jQuery.fn[ name ] = function( until, selector ) { 3036 var ret = jQuery.map( this, fn, until ); 3037 3038 if ( name.slice( -5 ) !== "Until" ) { 3039 selector = until; 3040 } 3041 3042 if ( selector && typeof selector === "string" ) { 3043 ret = jQuery.filter( selector, ret ); 3044 } 3045 3046 if ( this.length > 1 ) { 3047 // Remove duplicates 3048 if ( !guaranteedUnique[ name ] ) { 3049 ret = jQuery.unique( ret ); 3050 } 3051 3052 // Reverse order for parents* and prev-derivatives 3053 if ( rparentsprev.test( name ) ) { 3054 ret = ret.reverse(); 3055 } 3056 } 3057 3058 return this.pushStack( ret ); 3059 }; 3060}); 3061var rnotwhite = (/\S+/g); 3062 3063 3064 3065// String to Object options format cache 3066var optionsCache = {}; 3067 3068// Convert String-formatted options into Object-formatted ones and store in cache 3069function createOptions( options ) { 3070 var object = optionsCache[ options ] = {}; 3071 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 3072 object[ flag ] = true; 3073 }); 3074 return object; 3075} 3076 3077/* 3078 * Create a callback list using the following parameters: 3079 * 3080 * options: an optional list of space-separated options that will change how 3081 * the callback list behaves or a more traditional option object 3082 * 3083 * By default a callback list will act like an event callback list and can be 3084 * "fired" multiple times. 3085 * 3086 * Possible options: 3087 * 3088 * once: will ensure the callback list can only be fired once (like a Deferred) 3089 * 3090 * memory: will keep track of previous values and will call any callback added 3091 * after the list has been fired right away with the latest "memorized" 3092 * values (like a Deferred) 3093 * 3094 * unique: will ensure a callback can only be added once (no duplicate in the list) 3095 * 3096 * stopOnFalse: interrupt callings when a callback returns false 3097 * 3098 */ 3099jQuery.Callbacks = function( options ) { 3100 3101 // Convert options from String-formatted to Object-formatted if needed 3102 // (we check in cache first) 3103 options = typeof options === "string" ? 3104 ( optionsCache[ options ] || createOptions( options ) ) : 3105 jQuery.extend( {}, options ); 3106 3107 var // Flag to know if list is currently firing 3108 firing, 3109 // Last fire value (for non-forgettable lists) 3110 memory, 3111 // Flag to know if list was already fired 3112 fired, 3113 // End of the loop when firing 3114 firingLength, 3115 // Index of currently firing callback (modified by remove if needed) 3116 firingIndex, 3117 // First callback to fire (used internally by add and fireWith) 3118 firingStart, 3119 // Actual callback list 3120 list = [],
vendor: 7,792 bytes, lines 3121-3398
3121 // Stack of fire calls for repeatable lists 3122 stack = !options.once && [], 3123 // Fire callbacks 3124 fire = function( data ) { 3125 memory = options.memory && data; 3126 fired = true; 3127 firingIndex = firingStart || 0; 3128 firingStart = 0; 3129 firingLength = list.length; 3130 firing = true; 3131 for ( ; list && firingIndex < firingLength; firingIndex++ ) { 3132 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { 3133 memory = false; // To prevent further calls using add 3134 break; 3135 } 3136 } 3137 firing = false; 3138 if ( list ) { 3139 if ( stack ) { 3140 if ( stack.length ) { 3141 fire( stack.shift() ); 3142 } 3143 } else if ( memory ) { 3144 list = []; 3145 } else { 3146 self.disable(); 3147 } 3148 } 3149 }, 3150 // Actual Callbacks object 3151 self = { 3152 // Add a callback or a collection of callbacks to the list 3153 add: function() { 3154 if ( list ) { 3155 // First, we save the current length 3156 var start = list.length; 3157 (function add( args ) { 3158 jQuery.each( args, function( _, arg ) { 3159 var type = jQuery.type( arg ); 3160 if ( type === "function" ) { 3161 if ( !options.unique || !self.has( arg ) ) { 3162 list.push( arg ); 3163 } 3164 } else if ( arg && arg.length && type !== "string" ) { 3165 // Inspect recursively 3166 add( arg ); 3167 } 3168 }); 3169 })( arguments ); 3170 // Do we need to add the callbacks to the 3171 // current firing batch? 3172 if ( firing ) { 3173 firingLength = list.length; 3174 // With memory, if we're not firing then 3175 // we should call right away 3176 } else if ( memory ) { 3177 firingStart = start; 3178 fire( memory ); 3179 } 3180 } 3181 return this; 3182 }, 3183 // Remove a callback from the list 3184 remove: function() { 3185 if ( list ) { 3186 jQuery.each( arguments, function( _, arg ) { 3187 var index; 3188 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3189 list.splice( index, 1 ); 3190 // Handle firing indexes 3191 if ( firing ) { 3192 if ( index <= firingLength ) { 3193 firingLength--; 3194 } 3195 if ( index <= firingIndex ) { 3196 firingIndex--; 3197 } 3198 } 3199 } 3200 }); 3201 } 3202 return this; 3203 }, 3204 // Check if a given callback is in the list. 3205 // If no argument is given, return whether or not list has callbacks attached. 3206 has: function( fn ) { 3207 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); 3208 }, 3209 // Remove all callbacks from the list 3210 empty: function() { 3211 list = []; 3212 firingLength = 0; 3213 return this; 3214 }, 3215 // Have the list do nothing anymore 3216 disable: function() { 3217 list = stack = memory = undefined; 3218 return this; 3219 }, 3220 // Is it disabled? 3221 disabled: function() { 3222 return !list; 3223 }, 3224 // Lock the list in its current state 3225 lock: function() { 3226 stack = undefined; 3227 if ( !memory ) { 3228 self.disable(); 3229 } 3230 return this; 3231 }, 3232 // Is it locked? 3233 locked: function() { 3234 return !stack; 3235 }, 3236 // Call all callbacks with the given context and arguments 3237 fireWith: function( context, args ) { 3238 if ( list && ( !fired || stack ) ) { 3239 args = args || []; 3240 args = [ context, args.slice ? args.slice() : args ]; 3241 if ( firing ) { 3242 stack.push( args ); 3243 } else { 3244 fire( args ); 3245 } 3246 } 3247 return this; 3248 }, 3249 // Call all the callbacks with the given arguments 3250 fire: function() { 3251 self.fireWith( this, arguments ); 3252 return this; 3253 }, 3254 // To know if the callbacks have already been called at least once 3255 fired: function() { 3256 return !!fired; 3257 } 3258 }; 3259 3260 return self; 3261}; 3262 3263 3264jQuery.extend({ 3265 3266 Deferred: function( func ) { 3267 var tuples = [ 3268 // action, add listener, listener list, final state 3269 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], 3270 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], 3271 [ "notify", "progress", jQuery.Callbacks("memory") ] 3272 ], 3273 state = "pending", 3274 promise = { 3275 state: function() { 3276 return state; 3277 }, 3278 always: function() { 3279 deferred.done( arguments ).fail( arguments ); 3280 return this; 3281 }, 3282 then: function( /* fnDone, fnFail, fnProgress */ ) { 3283 var fns = arguments; 3284 return jQuery.Deferred(function( newDefer ) { 3285 jQuery.each( tuples, function( i, tuple ) { 3286 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 3287 // deferred[ done | fail | progress ] for forwarding actions to newDefer 3288 deferred[ tuple[1] ](function() { 3289 var returned = fn && fn.apply( this, arguments ); 3290 if ( returned && jQuery.isFunction( returned.promise ) ) { 3291 returned.promise() 3292 .done( newDefer.resolve ) 3293 .fail( newDefer.reject ) 3294 .progress( newDefer.notify ); 3295 } else { 3296 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); 3297 } 3298 }); 3299 }); 3300 fns = null; 3301 }).promise(); 3302 }, 3303 // Get a promise for this deferred 3304 // If obj is provided, the promise aspect is added to the object 3305 promise: function( obj ) { 3306 return obj != null ? jQuery.extend( obj, promise ) : promise; 3307 } 3308 }, 3309 deferred = {}; 3310 3311 // Keep pipe for back-compat 3312 promise.pipe = promise.then; 3313 3314 // Add list-specific methods 3315 jQuery.each( tuples, function( i, tuple ) { 3316 var list = tuple[ 2 ], 3317 stateString = tuple[ 3 ]; 3318 3319 // promise[ done | fail | progress ] = list.add 3320 promise[ tuple[1] ] = list.add; 3321 3322 // Handle state 3323 if ( stateString ) { 3324 list.add(function() { 3325 // state = [ resolved | rejected ] 3326 state = stateString; 3327 3328 // [ reject_list | resolve_list ].disable; progress_list.lock 3329 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 3330 } 3331 3332 // deferred[ resolve | reject | notify ] 3333 deferred[ tuple[0] ] = function() { 3334 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); 3335 return this; 3336 }; 3337 deferred[ tuple[0] + "With" ] = list.fireWith; 3338 }); 3339 3340 // Make the deferred a promise 3341 promise.promise( deferred ); 3342 3343 // Call given func if any 3344 if ( func ) { 3345 func.call( deferred, deferred ); 3346 } 3347 3348 // All done! 3349 return deferred; 3350 }, 3351 3352 // Deferred helper 3353 when: function( subordinate /* , ..., subordinateN */ ) { 3354 var i = 0, 3355 resolveValues = slice.call( arguments ), 3356 length = resolveValues.length, 3357 3358 // the count of uncompleted subordinates 3359 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 3360 3361 // the master Deferred. If resolveValues consist of only a single Deferred, just use that. 3362 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 3363 3364 // Update function for both resolve and progress values 3365 updateFunc = function( i, contexts, values ) { 3366 return function( value ) { 3367 contexts[ i ] = this; 3368 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3369 if ( values === progressValues ) { 3370 deferred.notifyWith( contexts, values ); 3371 3372 } else if ( !(--remaining) ) { 3373 deferred.resolveWith( contexts, values ); 3374 } 3375 }; 3376 }, 3377 3378 progressValues, progressContexts, resolveContexts; 3379 3380 // add listeners to Deferred subordinates; treat others as resolved 3381 if ( length > 1 ) { 3382 progressValues = new Array( length ); 3383 progressContexts = new Array( length ); 3384 resolveContexts = new Array( length ); 3385 for ( ; i < length; i++ ) { 3386 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 3387 resolveValues[ i ].promise() 3388 .done( updateFunc( i, resolveContexts, resolveValues ) ) 3389 .fail( deferred.reject ) 3390 .progress( updateFunc( i, progressContexts, progressValues ) ); 3391 } else { 3392 --remaining; 3393 } 3394 } 3395 } 3396 3397 // if we're not waiting on anything, resolve the master 3398 if ( !remaining ) {
3399 deferred.resolveWith( resolveContexts, resolveValues ); 3400 } 3401 3402 return deferred.promise(); 3403 } 3404}); 3405 3406 3407// The deferred used on DOM ready 3408var readyList; 3409 3410jQuery.fn.ready = function( fn ) { 3411 // Add the callback 3412 jQuery.ready.promise().done( fn ); 3413 3414 return this; 3415}; 3416 3417jQuery.extend({ 3418 // Is the DOM ready to be used? Set to true once it occurs. 3419 isReady: false, 3420 3421 // A counter to track how many items to wait for before 3422 // the ready event fires. See #6781 3423 readyWait: 1, 3424 3425 // Hold (or release) the ready event 3426 holdReady: function( hold ) { 3427 if ( hold ) { 3428 jQuery.readyWait++; 3429 } else { 3430 jQuery.ready( true ); 3431 } 3432 }, 3433 3434 // Handle when the DOM is ready 3435 ready: function( wait ) { 3436 3437 // Abort if there are pending holds or we're already ready 3438 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3439 return; 3440 } 3441 3442 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 3443 if ( !document.body ) { 3444 return setTimeout( jQuery.ready ); 3445 } 3446 3447 // Remember that the DOM is ready 3448 jQuery.isReady = true; 3449 3450 // If a normal DOM Ready event fired, decrement, and wait if need be 3451 if ( wait !== true && --jQuery.readyWait > 0 ) { 3452 return; 3453 } 3454 3455 // If there are functions bound, to execute 3456 readyList.resolveWith( document, [ jQuery ] ); 3457 3458 // Trigger any bound ready events 3459 if ( jQuery.fn.triggerHandler ) { 3460 jQuery( document ).triggerHandler( "ready" ); 3461 jQuery( document ).off( "ready" ); 3462 } 3463 } 3464}); 3465 3466/** 3467 * Clean-up method for dom ready events 3468 */ 3469function detach() { 3470 if ( document.addEventListener ) { 3471 document.removeEventListener( "DOMContentLoaded", completed, false ); 3472 window.removeEventListener( "load", completed, false ); 3473 3474 } else { 3475 document.detachEvent( "onreadystatechange", completed ); 3476 window.detachEvent( "onload", completed ); 3477 } 3478} 3479 3480/** 3481 * The ready event handler and self cleanup method 3482 */ 3483function completed() { 3484 // readyState === "complete" is good enough for us to call the dom ready in oldIE 3485 if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { 3486 detach(); 3487 jQuery.ready(); 3488 } 3489} 3490 3491jQuery.ready.promise = function( obj ) { 3492 if ( !readyList ) { 3493 3494 readyList = jQuery.Deferred(); 3495 3496 // Catch cases where $(document).ready() is called after the browser event has already occurred. 3497 // we once tried to use readyState "interactive" here, but it caused issues like the one 3498 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 3499 if ( document.readyState === "complete" ) { 3500 // Handle it asynchronously to allow scripts the opportunity to delay ready 3501 setTimeout( jQuery.ready ); 3502 3503 // Standards-based browsers support DOMContentLoaded 3504 } else if ( document.addEventListener ) { 3505 // Use the handy event callback 3506 document.addEventListener( "DOMContentLoaded", completed, false ); 3507 3508 // A fallback to window.onload, that will always work 3509 window.addEventListener( "load", completed, false ); 3510 3511 // If IE event model is used 3512 } else { 3513 // Ensure firing before onload, maybe late but safe also for iframes 3514 document.attachEvent( "onreadystatechange", completed ); 3515 3516 // A fallback to window.onload, that will always work 3517 window.attachEvent( "onload", completed ); 3518 3519 // If IE and not a frame 3520 // continually check to see if the document is ready 3521 var top = false; 3522 3523 try { 3524 top = window.frameElement == null && document.documentElement; 3525 } catch(e) {} 3526 3527 if ( top && top.doScroll ) { 3528 (function doScrollCheck() { 3529 if ( !jQuery.isReady ) { 3530 3531 try { 3532 // Use the trick by Diego Perini 3533 // http://javascript.nwbox.com/IEContentLoaded/ 3534 top.doScroll("left"); 3535 } catch(e) { 3536 return setTimeout( doScrollCheck, 50 ); 3537 } 3538 3539 // detach all dom ready events 3540 detach(); 3541 3542 // and execute any waiting functions 3543 jQuery.ready(); 3544 } 3545 })(); 3546 } 3547 } 3548 } 3549 return readyList.promise( obj ); 3550}; 3551 3552 3553var strundefined = typeof undefined; 3554 3555 3556 3557// Support: IE<9 3558// Iteration over object's inherited properties before its own 3559var i; 3560for ( i in jQuery( support ) ) { 3561 break; 3562} 3563support.ownLast = i !== "0"; 3564 3565// Note: most support tests are defined in their respective modules. 3566// false until the test is run 3567support.inlineBlockNeedsLayout = false;
3568 3569// Execute ASAP in case we need to set body.style.zoom 3570jQuery(function() { 3571 // Minified: var a,b,c,d 3572 var val, div, body, container; 3573 3574 body = document.getElementsByTagName( "body" )[ 0 ]; 3575 if ( !body || !body.style ) { 3576 // Return for frameset docs that don't have a body 3577 return; 3578 } 3579 3580 // Setup 3581 div = document.createElement( "div" ); 3582 container = document.createElement( "div" ); 3583 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 3584 body.appendChild( container ).appendChild( div ); 3585 3586 if ( typeof div.style.zoom !== strundefined ) { 3587 // Support: IE<8 3588 // Check if natively block-level elements act like inline-block 3589 // elements when setting their display to 'inline' and giving 3590 // them layout 3591 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; 3592 3593 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; 3594 if ( val ) { 3595 // Prevent IE 6 from affecting layout for positioned elements #11048 3596 // Prevent IE from shrinking the body in IE 7 mode #12869 3597 // Support: IE<8 3598 body.style.zoom = 1; 3599 } 3600 } 3601 3602 body.removeChild( container ); 3603}); 3604 3605 3606 3607 3608(function() { 3609 var div = document.createElement( "div" ); 3610 3611 // Execute the test only if not already executed in another module. 3612 if (support.deleteExpando == null) { 3613 // Support: IE<9 3614 support.deleteExpando = true; 3615 try { 3616 delete div.test; 3617 } catch( e ) { 3618 support.deleteExpando = false; 3619 } 3620 } 3621 3622 // Null elements to avoid leaks in IE. 3623 div = null; 3624})(); 3625 3626 3627/** 3628 * Determines whether an object can have data 3629 */ 3630jQuery.acceptData = function( elem ) { 3631 var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], 3632 nodeType = +elem.nodeType || 1; 3633 3634 // Do not set data on non-element DOM nodes because it will not be cleared (#8335). 3635 return nodeType !== 1 && nodeType !== 9 ? 3636 false : 3637 3638 // Nodes accept data unless otherwise specified; rejection can be conditional 3639 !noData || noData !== true && elem.getAttribute("classid") === noData; 3640}; 3641 3642 3643var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 3644 rmultiDash = /([A-Z])/g; 3645 3646function dataAttr( elem, key, data ) { 3647 // If nothing was found internally, try to fetch any 3648 // data from the HTML5 data-* attribute 3649 if ( data === undefined && elem.nodeType === 1 ) { 3650 3651 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 3652 3653 data = elem.getAttribute( name ); 3654 3655 if ( typeof data === "string" ) { 3656 try { 3657 data = data === "true" ? true : 3658 data === "false" ? false : 3659 data === "null" ? null : 3660 // Only convert to a number if it doesn't change the string 3661 +data + "" === data ? +data : 3662 rbrace.test( data ) ? jQuery.parseJSON( data ) : 3663 data; 3664 } catch( e ) {} 3665 3666 // Make sure we set the data so it isn't changed later 3667 jQuery.data( elem, key, data ); 3668 3669 } else { 3670 data = undefined; 3671 } 3672 } 3673 3674 return data; 3675} 3676 3677// checks a cache object for emptiness 3678function isEmptyDataObject( obj ) { 3679 var name; 3680 for ( name in obj ) { 3681 3682 // if the public data object is empty, the private is still empty 3683 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { 3684 continue; 3685 } 3686 if ( name !== "toJSON" ) { 3687 return false; 3688 } 3689 } 3690 3691 return true; 3692} 3693 3694function internalData( elem, name, data, pvt /* Internal Use Only */ ) { 3695 if ( !jQuery.acceptData( elem ) ) { 3696 return; 3697 } 3698 3699 var ret, thisCache, 3700 internalKey = jQuery.expando, 3701 3702 // We have to handle DOM nodes and JS objects differently because IE6-7 3703 // can't GC object references properly across the DOM-JS boundary 3704 isNode = elem.nodeType, 3705 3706 // Only DOM nodes need the global jQuery cache; JS object data is 3707 // attached directly to the object so GC can occur automatically 3708 cache = isNode ? jQuery.cache : elem, 3709 3710 // Only defining an ID for JS objects if its cache already exists allows 3711 // the code to shortcut on the same path as a DOM node with no cache 3712 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 3713 3714 // Avoid doing any more work than we need to when trying to get data on an 3715 // object that has no data at all 3716 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { 3717 return; 3718 } 3719 3720 if ( !id ) { 3721 // Only DOM nodes need a new unique ID for each element since their data 3722 // ends up in the global cache 3723 if ( isNode ) { 3724 id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; 3725 } else { 3726 id = internalKey; 3727 } 3728 } 3729 3730 if ( !cache[ id ] ) { 3731 // Avoid exposing jQuery metadata on plain JS objects when the object 3732 // is serialized using JSON.stringify 3733 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; 3734 } 3735
3736 // An object can be passed to jQuery.data instead of a key/value pair; this gets 3737 // shallow copied over onto the existing cache 3738 if ( typeof name === "object" || typeof name === "function" ) { 3739 if ( pvt ) { 3740 cache[ id ] = jQuery.extend( cache[ id ], name ); 3741 } else { 3742 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 3743 } 3744 } 3745 3746 thisCache = cache[ id ]; 3747 3748 // jQuery data() is stored in a separate object inside the object's internal data 3749 // cache in order to avoid key collisions between internal data and user-defined 3750 // data. 3751 if ( !pvt ) { 3752 if ( !thisCache.data ) { 3753 thisCache.data = {}; 3754 } 3755 3756 thisCache = thisCache.data; 3757 } 3758 3759 if ( data !== undefined ) { 3760 thisCache[ jQuery.camelCase( name ) ] = data; 3761 } 3762 3763 // Check for both converted-to-camel and non-converted data property names 3764 // If a data property was specified 3765 if ( typeof name === "string" ) { 3766 3767 // First Try to find as-is property data 3768 ret = thisCache[ name ]; 3769 3770 // Test for null|undefined property data 3771 if ( ret == null ) { 3772 3773 // Try to find the camelCased property 3774 ret = thisCache[ jQuery.camelCase( name ) ]; 3775 } 3776 } else { 3777 ret = thisCache; 3778 } 3779 3780 return ret; 3781} 3782 3783function internalRemoveData( elem, name, pvt ) { 3784 if ( !jQuery.acceptData( elem ) ) { 3785 return; 3786 } 3787 3788 var thisCache, i, 3789 isNode = elem.nodeType, 3790 3791 // See jQuery.data for more information 3792 cache = isNode ? jQuery.cache : elem, 3793 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 3794 3795 // If there is already no cache entry for this object, there is no 3796 // purpose in continuing 3797 if ( !cache[ id ] ) { 3798 return; 3799 } 3800 3801 if ( name ) { 3802 3803 thisCache = pvt ? cache[ id ] : cache[ id ].data; 3804 3805 if ( thisCache ) { 3806 3807 // Support array or space separated string names for data keys 3808 if ( !jQuery.isArray( name ) ) { 3809 3810 // try the string as a key before any manipulation 3811 if ( name in thisCache ) { 3812 name = [ name ]; 3813 } else { 3814 3815 // split the camel cased version by spaces unless a key with the spaces exists 3816 name = jQuery.camelCase( name ); 3817 if ( name in thisCache ) { 3818 name = [ name ]; 3819 } else { 3820 name = name.split(" "); 3821 } 3822 } 3823 } else { 3824 // If "name" is an array of keys... 3825 // When data is initially created, via ("key", "val") signature, 3826 // keys will be converted to camelCase. 3827 // Since there is no way to tell _how_ a key was added, remove 3828 // both plain key and camelCase key. #12786 3829 // This will only penalize the array argument path. 3830 name = name.concat( jQuery.map( name, jQuery.camelCase ) ); 3831 } 3832 3833 i = name.length; 3834 while ( i-- ) { 3835 delete thisCache[ name[i] ]; 3836 } 3837 3838 // If there is no data left in the cache, we want to continue 3839 // and let the cache object itself get destroyed 3840 if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { 3841 return; 3842 } 3843 } 3844 } 3845 3846 // See jQuery.data for more information 3847 if ( !pvt ) { 3848 delete cache[ id ].data; 3849 3850 // Don't destroy the parent cache unless the internal data object 3851 // had been the only thing left in it 3852 if ( !isEmptyDataObject( cache[ id ] ) ) { 3853 return; 3854 } 3855 } 3856 3857 // Destroy the cache 3858 if ( isNode ) { 3859 jQuery.cleanData( [ elem ], true ); 3860 3861 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 3862 /* jshint eqeqeq: false */ 3863 } else if ( support.deleteExpando || cache != cache.window ) { 3864 /* jshint eqeqeq: true */ 3865 delete cache[ id ]; 3866 3867 // When all else fails, null 3868 } else { 3869 cache[ id ] = null; 3870 } 3871} 3872 3873jQuery.extend({ 3874 cache: {}, 3875 3876 // The following elements (space-suffixed to avoid Object.prototype collisions) 3877 // throw uncatchable exceptions if you attempt to set expando properties 3878 noData: { 3879 "applet ": true, 3880 "embed ": true, 3881 // ...but Flash objects (which have this classid) *can* handle expandos 3882 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 3883 }, 3884 3885 hasData: function( elem ) { 3886 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; 3887 return !!elem && !isEmptyDataObject( elem ); 3888 }, 3889 3890 data: function( elem, name, data ) { 3891 return internalData( elem, name, data ); 3892 }, 3893 3894 removeData: function( elem, name ) { 3895 return internalRemoveData( elem, name ); 3896 }, 3897 3898 // For internal use only. 3899 _data: function( elem, name, data ) { 3900 return internalData( elem, name, data, true ); 3901 }, 3902 3903 _removeData: function( elem, name ) { 3904 return internalRemoveData( elem, name, true ); 3905 } 3906}); 3907 3908jQuery.fn.extend({ 3909 data: function( key, value ) { 3910 var i, name, data, 3911 elem = this[0], 3912 attrs = elem && elem.attributes; 3913 3914 // Special expections of .data basically thwart jQuery.access, 3915 // so implement the relevant behavior ourselves 3916 3917 // Gets all values 3918 if ( key === undefined ) { 3919 if ( this.length ) { 3920 data = jQuery.data( elem ); 3921 3922 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { 3923 i = attrs.length; 3924 while ( i-- ) { 3925
vendor: 4,161 bytes, lines 3926-4110
3926 // Support: IE11+ 3927 // The attrs elements can be null (#14894) 3928 if ( attrs[ i ] ) { 3929 name = attrs[ i ].name; 3930 if ( name.indexOf( "data-" ) === 0 ) { 3931 name = jQuery.camelCase( name.slice(5) ); 3932 dataAttr( elem, name, data[ name ] ); 3933 } 3934 } 3935 } 3936 jQuery._data( elem, "parsedAttrs", true ); 3937 } 3938 } 3939 3940 return data; 3941 } 3942 3943 // Sets multiple values 3944 if ( typeof key === "object" ) { 3945 return this.each(function() { 3946 jQuery.data( this, key ); 3947 }); 3948 } 3949 3950 return arguments.length > 1 ? 3951 3952 // Sets one value 3953 this.each(function() { 3954 jQuery.data( this, key, value ); 3955 }) : 3956 3957 // Gets one value 3958 // Try to fetch any internally stored data first 3959 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; 3960 }, 3961 3962 removeData: function( key ) { 3963 return this.each(function() { 3964 jQuery.removeData( this, key ); 3965 }); 3966 } 3967}); 3968 3969 3970jQuery.extend({ 3971 queue: function( elem, type, data ) { 3972 var queue; 3973 3974 if ( elem ) { 3975 type = ( type || "fx" ) + "queue"; 3976 queue = jQuery._data( elem, type ); 3977 3978 // Speed up dequeue by getting out quickly if this is just a lookup 3979 if ( data ) { 3980 if ( !queue || jQuery.isArray(data) ) { 3981 queue = jQuery._data( elem, type, jQuery.makeArray(data) ); 3982 } else { 3983 queue.push( data ); 3984 } 3985 } 3986 return queue || []; 3987 } 3988 }, 3989 3990 dequeue: function( elem, type ) { 3991 type = type || "fx"; 3992 3993 var queue = jQuery.queue( elem, type ), 3994 startLength = queue.length, 3995 fn = queue.shift(), 3996 hooks = jQuery._queueHooks( elem, type ), 3997 next = function() { 3998 jQuery.dequeue( elem, type ); 3999 }; 4000 4001 // If the fx queue is dequeued, always remove the progress sentinel 4002 if ( fn === "inprogress" ) { 4003 fn = queue.shift(); 4004 startLength--; 4005 } 4006 4007 if ( fn ) { 4008 4009 // Add a progress sentinel to prevent the fx queue from being 4010 // automatically dequeued 4011 if ( type === "fx" ) { 4012 queue.unshift( "inprogress" ); 4013 } 4014 4015 // clear up the last queue stop function 4016 delete hooks.stop; 4017 fn.call( elem, next, hooks ); 4018 } 4019 4020 if ( !startLength && hooks ) { 4021 hooks.empty.fire(); 4022 } 4023 }, 4024 4025 // not intended for public consumption - generates a queueHooks object, or returns the current one 4026 _queueHooks: function( elem, type ) { 4027 var key = type + "queueHooks"; 4028 return jQuery._data( elem, key ) || jQuery._data( elem, key, { 4029 empty: jQuery.Callbacks("once memory").add(function() { 4030 jQuery._removeData( elem, type + "queue" ); 4031 jQuery._removeData( elem, key ); 4032 }) 4033 }); 4034 } 4035}); 4036 4037jQuery.fn.extend({ 4038 queue: function( type, data ) { 4039 var setter = 2; 4040 4041 if ( typeof type !== "string" ) { 4042 data = type; 4043 type = "fx"; 4044 setter--; 4045 } 4046 4047 if ( arguments.length < setter ) { 4048 return jQuery.queue( this[0], type ); 4049 } 4050 4051 return data === undefined ? 4052 this : 4053 this.each(function() { 4054 var queue = jQuery.queue( this, type, data ); 4055 4056 // ensure a hooks for this queue 4057 jQuery._queueHooks( this, type ); 4058 4059 if ( type === "fx" && queue[0] !== "inprogress" ) { 4060 jQuery.dequeue( this, type ); 4061 } 4062 }); 4063 }, 4064 dequeue: function( type ) { 4065 return this.each(function() { 4066 jQuery.dequeue( this, type ); 4067 }); 4068 }, 4069 clearQueue: function( type ) { 4070 return this.queue( type || "fx", [] ); 4071 }, 4072 // Get a promise resolved when queues of a certain type 4073 // are emptied (fx is the type by default) 4074 promise: function( type, obj ) { 4075 var tmp, 4076 count = 1, 4077 defer = jQuery.Deferred(), 4078 elements = this, 4079 i = this.length, 4080 resolve = function() { 4081 if ( !( --count ) ) { 4082 defer.resolveWith( elements, [ elements ] ); 4083 } 4084 }; 4085 4086 if ( typeof type !== "string" ) { 4087 obj = type; 4088 type = undefined; 4089 } 4090 type = type || "fx"; 4091 4092 while ( i-- ) { 4093 tmp = jQuery._data( elements[ i ], type + "queueHooks" ); 4094 if ( tmp && tmp.empty ) { 4095 count++; 4096 tmp.empty.add( resolve ); 4097 } 4098 } 4099 resolve(); 4100 return defer.promise( obj ); 4101 } 4102}); 4103var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 4104 4105var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4106 4107var isHidden = function( elem, el ) { 4108 // isHidden might be called from jQuery#filter function; 4109 // in that case, element will be second argument 4110 elem = el || elem;
4111 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); 4112 }; 4113 4114 4115 4116// Multifunctional method to get and set values of a collection 4117// The value/s can optionally be executed if it's a function 4118var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4119 var i = 0, 4120 length = elems.length, 4121 bulk = key == null; 4122 4123 // Sets many values 4124 if ( jQuery.type( key ) === "object" ) { 4125 chainable = true; 4126 for ( i in key ) { 4127 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); 4128 } 4129 4130 // Sets one value 4131 } else if ( value !== undefined ) { 4132 chainable = true; 4133 4134 if ( !jQuery.isFunction( value ) ) { 4135 raw = true; 4136 } 4137 4138 if ( bulk ) { 4139 // Bulk operations run against the entire set 4140 if ( raw ) { 4141 fn.call( elems, value ); 4142 fn = null; 4143 4144 // ...except when executing function values 4145 } else { 4146 bulk = fn; 4147 fn = function( elem, key, value ) { 4148 return bulk.call( jQuery( elem ), value ); 4149 }; 4150 } 4151 } 4152 4153 if ( fn ) { 4154 for ( ; i < length; i++ ) { 4155 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); 4156 } 4157 } 4158 } 4159 4160 return chainable ? 4161 elems : 4162 4163 // Gets 4164 bulk ? 4165 fn.call( elems ) : 4166 length ? fn( elems[0], key ) : emptyGet; 4167}; 4168var rcheckableType = (/^(?:checkbox|radio)$/i); 4169 4170 4171 4172(function() { 4173 // Minified: var a,b,c 4174 var input = document.createElement( "input" ), 4175 div = document.createElement( "div" ), 4176 fragment = document.createDocumentFragment(); 4177 4178 // Setup 4179 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 4180 4181 // IE strips leading whitespace when .innerHTML is used 4182 support.leadingWhitespace = div.firstChild.nodeType === 3; 4183 4184 // Make sure that tbody elements aren't automatically inserted 4185 // IE will insert them into empty tables 4186 support.tbody = !div.getElementsByTagName( "tbody" ).length; 4187 4188 // Make sure that link elements get serialized correctly by innerHTML 4189 // This requires a wrapper element in IE 4190 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; 4191 4192 // Makes sure cloning an html5 element does not cause problems 4193 // Where outerHTML is undefined, this still works 4194 support.html5Clone = 4195 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; 4196 4197 // Check if a disconnected checkbox will retain its checked 4198 // value of true after appended to the DOM (IE6/7) 4199 input.type = "checkbox"; 4200 input.checked = true; 4201 fragment.appendChild( input ); 4202 support.appendChecked = input.checked; 4203 4204 // Make sure textarea (and checkbox) defaultValue is properly cloned 4205 // Support: IE6-IE11+ 4206 div.innerHTML = "<textarea>x</textarea>"; 4207 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4208 4209 // #11217 - WebKit loses check when the name is after the checked attribute 4210 fragment.appendChild( div ); 4211 div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; 4212 4213 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 4214 // old WebKit doesn't clone checked state correctly in fragments 4215 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4216 4217 // Support: IE<9 4218 // Opera does not clone events (and typeof div.attachEvent === undefined). 4219 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() 4220 support.noCloneEvent = true; 4221 if ( div.attachEvent ) { 4222 div.attachEvent( "onclick", function() { 4223 support.noCloneEvent = false; 4224 }); 4225 4226 div.cloneNode( true ).click(); 4227 } 4228 4229 // Execute the test only if not already executed in another module. 4230 if (support.deleteExpando == null) { 4231 // Support: IE<9 4232 support.deleteExpando = true; 4233 try { 4234 delete div.test; 4235 } catch( e ) { 4236 support.deleteExpando = false; 4237 } 4238 } 4239})(); 4240 4241 4242(function() { 4243 var i, eventName, 4244 div = document.createElement( "div" ); 4245 4246 // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) 4247 for ( i in { submit: true, change: true, focusin: true }) { 4248 eventName = "on" + i; 4249
4250 if ( !(support[ i + "Bubbles" ] = eventName in window) ) { 4251 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) 4252 div.setAttribute( eventName, "t" ); 4253 support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; 4254 } 4255 } 4256 4257 // Null elements to avoid leaks in IE. 4258 div = null; 4259})(); 4260 4261 4262var rformElems = /^(?:input|select|textarea)$/i, 4263 rkeyEvent = /^key/, 4264 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, 4265 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 4266 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; 4267 4268function returnTrue() { 4269 return true; 4270} 4271 4272function returnFalse() { 4273 return false; 4274} 4275 4276function safeActiveElement() { 4277 try { 4278 return document.activeElement; 4279 } catch ( err ) { } 4280} 4281 4282/* 4283 * Helper functions for managing events -- not part of the public interface. 4284 * Props to Dean Edwards' addEvent library for many of the ideas. 4285 */ 4286jQuery.event = { 4287 4288 global: {}, 4289 4290 add: function( elem, types, handler, data, selector ) { 4291 var tmp, events, t, handleObjIn, 4292 special, eventHandle, handleObj, 4293 handlers, type, namespaces, origType, 4294 elemData = jQuery._data( elem ); 4295 4296 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4297 if ( !elemData ) { 4298 return; 4299 } 4300 4301 // Caller can pass in an object of custom data in lieu of the handler 4302 if ( handler.handler ) { 4303 handleObjIn = handler; 4304 handler = handleObjIn.handler; 4305 selector = handleObjIn.selector; 4306 } 4307 4308 // Make sure that the handler has a unique ID, used to find/remove it later 4309 if ( !handler.guid ) { 4310 handler.guid = jQuery.guid++; 4311 } 4312 4313 // Init the element's event structure and main handler, if this is the first 4314 if ( !(events = elemData.events) ) { 4315 events = elemData.events = {}; 4316 } 4317 if ( !(eventHandle = elemData.handle) ) { 4318 eventHandle = elemData.handle = function( e ) { 4319 // Discard the second event of a jQuery.event.trigger() and 4320 // when an event is called after a page has unloaded 4321 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? 4322 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 4323 undefined; 4324 }; 4325 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 4326 eventHandle.elem = elem; 4327 } 4328 4329 // Handle multiple events separated by a space 4330 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4331 t = types.length; 4332 while ( t-- ) { 4333 tmp = rtypenamespace.exec( types[t] ) || []; 4334 type = origType = tmp[1]; 4335 namespaces = ( tmp[2] || "" ).split( "." ).sort(); 4336 4337 // There *must* be a type, no attaching namespace-only handlers 4338 if ( !type ) { 4339 continue; 4340 } 4341 4342 // If event changes its type, use the special event handlers for the changed type 4343 special = jQuery.event.special[ type ] || {}; 4344 4345 // If selector defined, determine special event api type, otherwise given type 4346 type = ( selector ? special.delegateType : special.bindType ) || type; 4347 4348 // Update special based on newly reset type 4349 special = jQuery.event.special[ type ] || {}; 4350 4351 // handleObj is passed to all event handlers 4352 handleObj = jQuery.extend({ 4353 type: type, 4354 origType: origType, 4355 data: data, 4356 handler: handler, 4357 guid: handler.guid, 4358 selector: selector, 4359 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4360 namespace: namespaces.join(".") 4361 }, handleObjIn ); 4362 4363 // Init the event handler queue if we're the first 4364 if ( !(handlers = events[ type ]) ) { 4365 handlers = events[ type ] = []; 4366 handlers.delegateCount = 0; 4367 4368 // Only use addEventListener/attachEvent if the special events handler returns false 4369 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4370 // Bind the global event handler to the element 4371 if ( elem.addEventListener ) { 4372 elem.addEventListener( type, eventHandle, false ); 4373 4374 } else if ( elem.attachEvent ) { 4375 elem.attachEvent( "on" + type, eventHandle ); 4376 } 4377 } 4378 } 4379 4380 if ( special.add ) { 4381 special.add.call( elem, handleObj ); 4382 4383 if ( !handleObj.handler.guid ) { 4384 handleObj.handler.guid = handler.guid; 4385 } 4386 } 4387 4388 // Add to the element's handler list, delegates in front 4389 if ( selector ) { 4390 handlers.splice( handlers.delegateCount++, 0, handleObj ); 4391 } else { 4392 handlers.push( handleObj ); 4393 } 4394 4395 // Keep track of which events have ever been used, for event optimization 4396 jQuery.event.global[ type ] = true; 4397 } 4398 4399 // Nullify elem to prevent memory leaks in IE 4400 elem = null; 4401 }, 4402 4403 // Detach an event or set of events from an element 4404 remove: function( elem, types, handler, selector, mappedTypes ) { 4405 var j, handleObj, tmp, 4406 origCount, t, events, 4407 special, handlers, type, 4408 namespaces, origType, 4409 elemData = jQuery.hasData( elem ) && jQuery._data( elem ); 4410 4411 if ( !elemData || !(events = elemData.events) ) { 4412 return; 4413 } 4414
vendor: 8,441 bytes, lines 4415-4681
4415 // Once for each type.namespace in types; type may be omitted 4416 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4417 t = types.length; 4418 while ( t-- ) { 4419 tmp = rtypenamespace.exec( types[t] ) || []; 4420 type = origType = tmp[1]; 4421 namespaces = ( tmp[2] || "" ).split( "." ).sort(); 4422 4423 // Unbind all events (on this namespace, if provided) for the element 4424 if ( !type ) { 4425 for ( type in events ) { 4426 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 4427 } 4428 continue; 4429 } 4430 4431 special = jQuery.event.special[ type ] || {}; 4432 type = ( selector ? special.delegateType : special.bindType ) || type; 4433 handlers = events[ type ] || []; 4434 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); 4435 4436 // Remove matching events 4437 origCount = j = handlers.length; 4438 while ( j-- ) { 4439 handleObj = handlers[ j ]; 4440 4441 if ( ( mappedTypes || origType === handleObj.origType ) && 4442 ( !handler || handler.guid === handleObj.guid ) && 4443 ( !tmp || tmp.test( handleObj.namespace ) ) && 4444 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { 4445 handlers.splice( j, 1 ); 4446 4447 if ( handleObj.selector ) { 4448 handlers.delegateCount--; 4449 } 4450 if ( special.remove ) { 4451 special.remove.call( elem, handleObj ); 4452 } 4453 } 4454 } 4455 4456 // Remove generic event handler if we removed something and no more handlers exist 4457 // (avoids potential for endless recursion during removal of special event handlers) 4458 if ( origCount && !handlers.length ) { 4459 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 4460 jQuery.removeEvent( elem, type, elemData.handle ); 4461 } 4462 4463 delete events[ type ]; 4464 } 4465 } 4466 4467 // Remove the expando if it's no longer used 4468 if ( jQuery.isEmptyObject( events ) ) { 4469 delete elemData.handle; 4470 4471 // removeData also checks for emptiness and clears the expando if empty 4472 // so use it instead of delete 4473 jQuery._removeData( elem, "events" ); 4474 } 4475 }, 4476 4477 trigger: function( event, data, elem, onlyHandlers ) { 4478 var handle, ontype, cur, 4479 bubbleType, special, tmp, i, 4480 eventPath = [ elem || document ], 4481 type = hasOwn.call( event, "type" ) ? event.type : event, 4482 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; 4483 4484 cur = tmp = elem = elem || document; 4485 4486 // Don't do events on text and comment nodes 4487 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 4488 return; 4489 } 4490 4491 // focus/blur morphs to focusin/out; ensure we're not firing them right now 4492 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 4493 return; 4494 } 4495 4496 if ( type.indexOf(".") >= 0 ) { 4497 // Namespaced trigger; create a regexp to match event type in handle() 4498 namespaces = type.split("."); 4499 type = namespaces.shift(); 4500 namespaces.sort(); 4501 } 4502 ontype = type.indexOf(":") < 0 && "on" + type; 4503 4504 // Caller can pass in a jQuery.Event object, Object, or just an event type string 4505 event = event[ jQuery.expando ] ? 4506 event : 4507 new jQuery.Event( type, typeof event === "object" && event ); 4508 4509 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 4510 event.isTrigger = onlyHandlers ? 2 : 3; 4511 event.namespace = namespaces.join("."); 4512 event.namespace_re = event.namespace ? 4513 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : 4514 null; 4515 4516 // Clean up the event in case it is being reused 4517 event.result = undefined; 4518 if ( !event.target ) { 4519 event.target = elem; 4520 } 4521 4522 // Clone any incoming data and prepend the event, creating the handler arg list 4523 data = data == null ? 4524 [ event ] : 4525 jQuery.makeArray( data, [ event ] ); 4526 4527 // Allow special events to draw outside the lines 4528 special = jQuery.event.special[ type ] || {}; 4529 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 4530 return; 4531 } 4532 4533 // Determine event propagation path in advance, per W3C events spec (#9951) 4534 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 4535 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 4536 4537 bubbleType = special.delegateType || type; 4538 if ( !rfocusMorph.test( bubbleType + type ) ) { 4539 cur = cur.parentNode; 4540 } 4541 for ( ; cur; cur = cur.parentNode ) { 4542 eventPath.push( cur ); 4543 tmp = cur; 4544 } 4545 4546 // Only add window if we got to document (e.g., not plain obj or detached DOM) 4547 if ( tmp === (elem.ownerDocument || document) ) { 4548 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 4549 } 4550 } 4551 4552 // Fire handlers on the event path 4553 i = 0; 4554 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { 4555 4556 event.type = i > 1 ? 4557 bubbleType : 4558 special.bindType || type; 4559 4560 // jQuery handler 4561 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); 4562 if ( handle ) { 4563 handle.apply( cur, data ); 4564 } 4565 4566 // Native handler 4567 handle = ontype && cur[ ontype ]; 4568 if ( handle && handle.apply && jQuery.acceptData( cur ) ) { 4569 event.result = handle.apply( cur, data ); 4570 if ( event.result === false ) { 4571 event.preventDefault(); 4572 } 4573 } 4574 } 4575 event.type = type; 4576 4577 // If nobody prevented the default action, do it now 4578 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 4579 4580 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && 4581 jQuery.acceptData( elem ) ) { 4582 4583 // Call a native DOM method on the target with the same name name as the event. 4584 // Can't use an .isFunction() check here because IE6/7 fails that test. 4585 // Don't do default actions on window, that's where global variables be (#6170) 4586 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { 4587 4588 // Don't re-trigger an onFOO event when we call its FOO() method 4589 tmp = elem[ ontype ]; 4590 4591 if ( tmp ) { 4592 elem[ ontype ] = null; 4593 } 4594 4595 // Prevent re-triggering of the same event, since we already bubbled it above 4596 jQuery.event.triggered = type; 4597 try { 4598 elem[ type ](); 4599 } catch ( e ) { 4600 // IE<9 dies on focus/blur to hidden element (#1486,#12518) 4601 // only reproducible on winXP IE8 native, not IE9 in IE8 mode 4602 } 4603 jQuery.event.triggered = undefined; 4604 4605 if ( tmp ) { 4606 elem[ ontype ] = tmp; 4607 } 4608 } 4609 } 4610 } 4611 4612 return event.result; 4613 }, 4614 4615 dispatch: function( event ) { 4616 4617 // Make a writable jQuery.Event from the native event object 4618 event = jQuery.event.fix( event ); 4619 4620 var i, ret, handleObj, matched, j, 4621 handlerQueue = [], 4622 args = slice.call( arguments ), 4623 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], 4624 special = jQuery.event.special[ event.type ] || {}; 4625 4626 // Use the fix-ed jQuery.Event rather than the (read-only) native event 4627 args[0] = event; 4628 event.delegateTarget = this; 4629 4630 // Call the preDispatch hook for the mapped type, and let it bail if desired 4631 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 4632 return; 4633 } 4634 4635 // Determine handlers 4636 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 4637 4638 // Run delegates first; they may want to stop propagation beneath us 4639 i = 0; 4640 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { 4641 event.currentTarget = matched.elem; 4642 4643 j = 0; 4644 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { 4645 4646 // Triggered event must either 1) have no namespace, or 4647 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 4648 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { 4649 4650 event.handleObj = handleObj; 4651 event.data = handleObj.data; 4652 4653 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) 4654 .apply( matched.elem, args ); 4655 4656 if ( ret !== undefined ) { 4657 if ( (event.result = ret) === false ) { 4658 event.preventDefault(); 4659 event.stopPropagation(); 4660 } 4661 } 4662 } 4663 } 4664 } 4665 4666 // Call the postDispatch hook for the mapped type 4667 if ( special.postDispatch ) { 4668 special.postDispatch.call( this, event ); 4669 } 4670 4671 return event.result; 4672 }, 4673 4674 handlers: function( event, handlers ) { 4675 var sel, handleObj, matches, i, 4676 handlerQueue = [], 4677 delegateCount = handlers.delegateCount, 4678 cur = event.target; 4679 4680 // Find delegate handlers 4681 // Black-hole SVG <use> instance trees (#13180)
4682 // Avoid non-left-click bubbling in Firefox (#3861) 4683 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { 4684 4685 /* jshint eqeqeq: false */ 4686 for ( ; cur != this; cur = cur.parentNode || this ) { 4687 /* jshint eqeqeq: true */ 4688 4689 // Don't check non-elements (#13208) 4690 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 4691 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { 4692 matches = []; 4693 for ( i = 0; i < delegateCount; i++ ) { 4694 handleObj = handlers[ i ]; 4695 4696 // Don't conflict with Object.prototype properties (#13203) 4697 sel = handleObj.selector + " "; 4698 4699 if ( matches[ sel ] === undefined ) { 4700 matches[ sel ] = handleObj.needsContext ? 4701 jQuery( sel, this ).index( cur ) >= 0 : 4702 jQuery.find( sel, this, null, [ cur ] ).length; 4703 } 4704 if ( matches[ sel ] ) { 4705 matches.push( handleObj ); 4706 } 4707 } 4708 if ( matches.length ) { 4709 handlerQueue.push({ elem: cur, handlers: matches }); 4710 } 4711 } 4712 } 4713 } 4714 4715 // Add the remaining (directly-bound) handlers 4716 if ( delegateCount < handlers.length ) { 4717 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); 4718 } 4719 4720 return handlerQueue; 4721 }, 4722 4723 fix: function( event ) { 4724 if ( event[ jQuery.expando ] ) { 4725 return event; 4726 } 4727 4728 // Create a writable copy of the event object and normalize some properties 4729 var i, prop, copy, 4730 type = event.type, 4731 originalEvent = event, 4732 fixHook = this.fixHooks[ type ]; 4733 4734 if ( !fixHook ) { 4735 this.fixHooks[ type ] = fixHook = 4736 rmouseEvent.test( type ) ? this.mouseHooks : 4737 rkeyEvent.test( type ) ? this.keyHooks : 4738 {}; 4739 } 4740 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 4741 4742 event = new jQuery.Event( originalEvent ); 4743 4744 i = copy.length; 4745 while ( i-- ) { 4746 prop = copy[ i ]; 4747 event[ prop ] = originalEvent[ prop ]; 4748 } 4749 4750 // Support: IE<9 4751 // Fix target property (#1925) 4752 if ( !event.target ) { 4753 event.target = originalEvent.srcElement || document; 4754 } 4755 4756 // Support: Chrome 23+, Safari? 4757 // Target should not be a text node (#504, #13143) 4758 if ( event.target.nodeType === 3 ) { 4759 event.target = event.target.parentNode; 4760 } 4761 4762 // Support: IE<9 4763 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) 4764 event.metaKey = !!event.metaKey; 4765 4766 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 4767 }, 4768 4769 // Includes some event props shared by KeyEvent and MouseEvent 4770 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 4771 4772 fixHooks: {}, 4773 4774 keyHooks: { 4775 props: "char charCode key keyCode".split(" "), 4776 filter: function( event, original ) { 4777 4778 // Add which for key events 4779 if ( event.which == null ) { 4780 event.which = original.charCode != null ? original.charCode : original.keyCode; 4781 } 4782 4783 return event; 4784 } 4785 }, 4786 4787 mouseHooks: { 4788 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 4789 filter: function( event, original ) { 4790 var body, eventDoc, doc, 4791 button = original.button, 4792 fromElement = original.fromElement; 4793 4794 // Calculate pageX/Y if missing and clientX/Y available 4795 if ( event.pageX == null && original.clientX != null ) { 4796 eventDoc = event.target.ownerDocument || document; 4797 doc = eventDoc.documentElement; 4798 body = eventDoc.body; 4799 4800 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 4801 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); 4802 } 4803 4804 // Add relatedTarget, if necessary 4805 if ( !event.relatedTarget && fromElement ) { 4806 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 4807 } 4808 4809 // Add which for click: 1 === left; 2 === middle; 3 === right 4810 // Note: button is not normalized, so don't use it 4811 if ( !event.which && button !== undefined ) { 4812 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 4813 } 4814 4815 return event; 4816 } 4817 }, 4818 4819 special: { 4820 load: { 4821 // Prevent triggered image.load events from bubbling to window.load 4822 noBubble: true 4823 }, 4824 focus: { 4825 // Fire native event if possible so blur/focus sequence is correct 4826 trigger: function() { 4827 if ( this !== safeActiveElement() && this.focus ) { 4828 try { 4829 this.focus(); 4830 return false;
4831 } catch ( e ) { 4832 // Support: IE<9 4833 // If we error on focus to hidden element (#1486, #12518), 4834 // let .trigger() run the handlers 4835 } 4836 } 4837 }, 4838 delegateType: "focusin" 4839 }, 4840 blur: { 4841 trigger: function() { 4842 if ( this === safeActiveElement() && this.blur ) { 4843 this.blur(); 4844 return false; 4845 } 4846 }, 4847 delegateType: "focusout" 4848 }, 4849 click: { 4850 // For checkbox, fire native event so checked state will be right 4851 trigger: function() { 4852 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { 4853 this.click(); 4854 return false; 4855 } 4856 }, 4857 4858 // For cross-browser consistency, don't fire native .click() on links 4859 _default: function( event ) { 4860 return jQuery.nodeName( event.target, "a" ); 4861 } 4862 }, 4863 4864 beforeunload: { 4865 postDispatch: function( event ) { 4866 4867 // Support: Firefox 20+ 4868 // Firefox doesn't alert if the returnValue field is not set. 4869 if ( event.result !== undefined && event.originalEvent ) { 4870 event.originalEvent.returnValue = event.result; 4871 } 4872 } 4873 } 4874 }, 4875 4876 simulate: function( type, elem, event, bubble ) { 4877 // Piggyback on a donor event to simulate a different one. 4878 // Fake originalEvent to avoid donor's stopPropagation, but if the 4879 // simulated event prevents default then we do the same on the donor. 4880 var e = jQuery.extend( 4881 new jQuery.Event(), 4882 event, 4883 { 4884 type: type, 4885 isSimulated: true, 4886 originalEvent: {} 4887 } 4888 ); 4889 if ( bubble ) { 4890 jQuery.event.trigger( e, null, elem ); 4891 } else { 4892 jQuery.event.dispatch.call( elem, e ); 4893 } 4894 if ( e.isDefaultPrevented() ) { 4895 event.preventDefault(); 4896 } 4897 } 4898}; 4899 4900jQuery.removeEvent = document.removeEventListener ? 4901 function( elem, type, handle ) { 4902 if ( elem.removeEventListener ) { 4903 elem.removeEventListener( type, handle, false ); 4904 } 4905 } : 4906 function( elem, type, handle ) { 4907 var name = "on" + type; 4908 4909 if ( elem.detachEvent ) { 4910 4911 // #8545, #7054, preventing memory leaks for custom events in IE6-8 4912 // detachEvent needed property on element, by name of that event, to properly expose it to GC 4913 if ( typeof elem[ name ] === strundefined ) { 4914 elem[ name ] = null; 4915 } 4916 4917 elem.detachEvent( name, handle ); 4918 } 4919 }; 4920 4921jQuery.Event = function( src, props ) { 4922 // Allow instantiation without the 'new' keyword 4923 if ( !(this instanceof jQuery.Event) ) { 4924 return new jQuery.Event( src, props ); 4925 } 4926 4927 // Event object 4928 if ( src && src.type ) { 4929 this.originalEvent = src; 4930 this.type = src.type; 4931 4932 // Events bubbling up the document may have been marked as prevented 4933 // by a handler lower down the tree; reflect the correct value. 4934 this.isDefaultPrevented = src.defaultPrevented || 4935 src.defaultPrevented === undefined && 4936 // Support: IE < 9, Android < 4.0 4937 src.returnValue === false ? 4938 returnTrue : 4939 returnFalse; 4940 4941 // Event type 4942 } else { 4943 this.type = src; 4944 } 4945 4946 // Put explicitly provided properties onto the event object 4947 if ( props ) { 4948 jQuery.extend( this, props ); 4949 } 4950 4951 // Create a timestamp if incoming event doesn't have one 4952 this.timeStamp = src && src.timeStamp || jQuery.now(); 4953 4954 // Mark it as fixed 4955 this[ jQuery.expando ] = true; 4956}; 4957 4958// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 4959// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 4960jQuery.Event.prototype = { 4961 isDefaultPrevented: returnFalse, 4962 isPropagationStopped: returnFalse, 4963 isImmediatePropagationStopped: returnFalse, 4964 4965 preventDefault: function() { 4966 var e = this.originalEvent; 4967 4968 this.isDefaultPrevented = returnTrue; 4969 if ( !e ) { 4970 return; 4971 } 4972 4973 // If preventDefault exists, run it on the original event 4974 if ( e.preventDefault ) { 4975 e.preventDefault(); 4976 4977 // Support: IE 4978 // Otherwise set the returnValue property of the original event to false 4979 } else { 4980 e.returnValue = false; 4981 } 4982 }, 4983 stopPropagation: function() { 4984 var e = this.originalEvent; 4985 4986 this.isPropagationStopped = returnTrue; 4987 if ( !e ) { 4988 return; 4989 } 4990 // If stopPropagation exists, run it on the original event 4991 if ( e.stopPropagation ) { 4992 e.stopPropagation(); 4993 } 4994
vendor: 8,878 bytes, lines 4995-5306
4995 // Support: IE 4996 // Set the cancelBubble property of the original event to true 4997 e.cancelBubble = true; 4998 }, 4999 stopImmediatePropagation: function() { 5000 var e = this.originalEvent; 5001 5002 this.isImmediatePropagationStopped = returnTrue; 5003 5004 if ( e && e.stopImmediatePropagation ) { 5005 e.stopImmediatePropagation(); 5006 } 5007 5008 this.stopPropagation(); 5009 } 5010}; 5011 5012// Create mouseenter/leave events using mouseover/out and event-time checks 5013jQuery.each({ 5014 mouseenter: "mouseover", 5015 mouseleave: "mouseout", 5016 pointerenter: "pointerover", 5017 pointerleave: "pointerout" 5018}, function( orig, fix ) { 5019 jQuery.event.special[ orig ] = { 5020 delegateType: fix, 5021 bindType: fix, 5022 5023 handle: function( event ) { 5024 var ret, 5025 target = this, 5026 related = event.relatedTarget, 5027 handleObj = event.handleObj; 5028 5029 // For mousenter/leave call the handler if related is outside the target. 5030 // NB: No relatedTarget if the mouse left/entered the browser window 5031 if ( !related || (related !== target && !jQuery.contains( target, related )) ) { 5032 event.type = handleObj.origType; 5033 ret = handleObj.handler.apply( this, arguments ); 5034 event.type = fix; 5035 } 5036 return ret; 5037 } 5038 }; 5039}); 5040 5041// IE submit delegation 5042if ( !support.submitBubbles ) { 5043 5044 jQuery.event.special.submit = { 5045 setup: function() { 5046 // Only need this for delegated form submit events 5047 if ( jQuery.nodeName( this, "form" ) ) { 5048 return false; 5049 } 5050 5051 // Lazy-add a submit handler when a descendant form may potentially be submitted 5052 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 5053 // Node name check avoids a VML-related crash in IE (#9807) 5054 var elem = e.target, 5055 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; 5056 if ( form && !jQuery._data( form, "submitBubbles" ) ) { 5057 jQuery.event.add( form, "submit._submit", function( event ) { 5058 event._submit_bubble = true; 5059 }); 5060 jQuery._data( form, "submitBubbles", true ); 5061 } 5062 }); 5063 // return undefined since we don't need an event listener 5064 }, 5065 5066 postDispatch: function( event ) { 5067 // If form was submitted by the user, bubble the event up the tree 5068 if ( event._submit_bubble ) { 5069 delete event._submit_bubble; 5070 if ( this.parentNode && !event.isTrigger ) { 5071 jQuery.event.simulate( "submit", this.parentNode, event, true ); 5072 } 5073 } 5074 }, 5075 5076 teardown: function() { 5077 // Only need this for delegated form submit events 5078 if ( jQuery.nodeName( this, "form" ) ) { 5079 return false; 5080 } 5081 5082 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 5083 jQuery.event.remove( this, "._submit" ); 5084 } 5085 }; 5086} 5087 5088// IE change delegation and checkbox/radio fix 5089if ( !support.changeBubbles ) { 5090 5091 jQuery.event.special.change = { 5092 5093 setup: function() { 5094 5095 if ( rformElems.test( this.nodeName ) ) { 5096 // IE doesn't fire change on a check/radio until blur; trigger it on click 5097 // after a propertychange. Eat the blur-change in special.change.handle. 5098 // This still fires onchange a second time for check/radio after blur. 5099 if ( this.type === "checkbox" || this.type === "radio" ) { 5100 jQuery.event.add( this, "propertychange._change", function( event ) { 5101 if ( event.originalEvent.propertyName === "checked" ) { 5102 this._just_changed = true; 5103 } 5104 }); 5105 jQuery.event.add( this, "click._change", function( event ) { 5106 if ( this._just_changed && !event.isTrigger ) { 5107 this._just_changed = false; 5108 } 5109 // Allow triggered, simulated change events (#11500) 5110 jQuery.event.simulate( "change", this, event, true ); 5111 }); 5112 } 5113 return false; 5114 } 5115 // Delegated event; lazy-add a change handler on descendant inputs 5116 jQuery.event.add( this, "beforeactivate._change", function( e ) { 5117 var elem = e.target; 5118 5119 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { 5120 jQuery.event.add( elem, "change._change", function( event ) { 5121 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 5122 jQuery.event.simulate( "change", this.parentNode, event, true ); 5123 } 5124 }); 5125 jQuery._data( elem, "changeBubbles", true ); 5126 } 5127 }); 5128 }, 5129 5130 handle: function( event ) { 5131 var elem = event.target; 5132 5133 // Swallow native change events from checkbox/radio, we already triggered them above 5134 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { 5135 return event.handleObj.handler.apply( this, arguments ); 5136 } 5137 }, 5138 5139 teardown: function() { 5140 jQuery.event.remove( this, "._change" ); 5141 5142 return !rformElems.test( this.nodeName ); 5143 } 5144 }; 5145} 5146 5147// Create "bubbling" focus and blur events 5148if ( !support.focusinBubbles ) { 5149 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { 5150 5151 // Attach a single capturing handler on the document while someone wants focusin/focusout 5152 var handler = function( event ) { 5153 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); 5154 }; 5155 5156 jQuery.event.special[ fix ] = { 5157 setup: function() { 5158 var doc = this.ownerDocument || this, 5159 attaches = jQuery._data( doc, fix ); 5160 5161 if ( !attaches ) { 5162 doc.addEventListener( orig, handler, true ); 5163 } 5164 jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); 5165 }, 5166 teardown: function() { 5167 var doc = this.ownerDocument || this, 5168 attaches = jQuery._data( doc, fix ) - 1; 5169 5170 if ( !attaches ) { 5171 doc.removeEventListener( orig, handler, true ); 5172 jQuery._removeData( doc, fix ); 5173 } else { 5174 jQuery._data( doc, fix, attaches ); 5175 } 5176 } 5177 }; 5178 }); 5179} 5180 5181jQuery.fn.extend({ 5182 5183 on: function( types, selector, data, fn, /*INTERNAL*/ one ) { 5184 var type, origFn; 5185 5186 // Types can be a map of types/handlers 5187 if ( typeof types === "object" ) { 5188 // ( types-Object, selector, data ) 5189 if ( typeof selector !== "string" ) { 5190 // ( types-Object, data ) 5191 data = data || selector; 5192 selector = undefined; 5193 } 5194 for ( type in types ) { 5195 this.on( type, selector, data, types[ type ], one ); 5196 } 5197 return this; 5198 } 5199 5200 if ( data == null && fn == null ) { 5201 // ( types, fn ) 5202 fn = selector; 5203 data = selector = undefined; 5204 } else if ( fn == null ) { 5205 if ( typeof selector === "string" ) { 5206 // ( types, selector, fn ) 5207 fn = data; 5208 data = undefined; 5209 } else { 5210 // ( types, data, fn ) 5211 fn = data; 5212 data = selector; 5213 selector = undefined; 5214 } 5215 } 5216 if ( fn === false ) { 5217 fn = returnFalse; 5218 } else if ( !fn ) { 5219 return this; 5220 } 5221 5222 if ( one === 1 ) { 5223 origFn = fn; 5224 fn = function( event ) { 5225 // Can use an empty set, since event contains the info 5226 jQuery().off( event ); 5227 return origFn.apply( this, arguments ); 5228 }; 5229 // Use same guid so caller can remove using origFn 5230 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5231 } 5232 return this.each( function() { 5233 jQuery.event.add( this, types, fn, data, selector ); 5234 }); 5235 }, 5236 one: function( types, selector, data, fn ) { 5237 return this.on( types, selector, data, fn, 1 ); 5238 }, 5239 off: function( types, selector, fn ) { 5240 var handleObj, type; 5241 if ( types && types.preventDefault && types.handleObj ) { 5242 // ( event ) dispatched jQuery.Event 5243 handleObj = types.handleObj; 5244 jQuery( types.delegateTarget ).off( 5245 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 5246 handleObj.selector, 5247 handleObj.handler 5248 ); 5249 return this; 5250 } 5251 if ( typeof types === "object" ) { 5252 // ( types-object [, selector] ) 5253 for ( type in types ) { 5254 this.off( type, selector, types[ type ] ); 5255 } 5256 return this; 5257 } 5258 if ( selector === false || typeof selector === "function" ) { 5259 // ( types [, fn] ) 5260 fn = selector; 5261 selector = undefined; 5262 } 5263 if ( fn === false ) { 5264 fn = returnFalse; 5265 } 5266 return this.each(function() { 5267 jQuery.event.remove( this, types, fn, selector ); 5268 }); 5269 }, 5270 5271 trigger: function( type, data ) { 5272 return this.each(function() { 5273 jQuery.event.trigger( type, data, this ); 5274 }); 5275 }, 5276 triggerHandler: function( type, data ) { 5277 var elem = this[0]; 5278 if ( elem ) { 5279 return jQuery.event.trigger( type, data, elem, true ); 5280 } 5281 } 5282}); 5283 5284 5285function createSafeFragment( document ) { 5286 var list = nodeNames.split( "|" ), 5287 safeFrag = document.createDocumentFragment(); 5288 5289 if ( safeFrag.createElement ) { 5290 while ( list.length ) { 5291 safeFrag.createElement( 5292 list.pop() 5293 ); 5294 } 5295 } 5296 return safeFrag; 5297} 5298 5299var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + 5300 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 5301 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 5302 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), 5303 rleadingWhitespace = /^\s+/, 5304 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, 5305 rtagName = /<([\w:]+)/, 5306 rtbody = /<tbody/i,
5307 rhtml = /<|&#?\w+;/, 5308 rnoInnerhtml = /<(?:script|style|link)/i, 5309 // checked="checked" or checked 5310 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5311 rscriptType = /^$|\/(?:java|ecma)script/i, 5312 rscriptTypeMasked = /^true\/(.*)/, 5313 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 5314 5315 // We have to close these tags to support XHTML (#13200) 5316 wrapMap = { 5317 option: [ 1, "<select multiple='multiple'>", "</select>" ], 5318 legend: [ 1, "<fieldset>", "</fieldset>" ], 5319 area: [ 1, "<map>", "</map>" ], 5320 param: [ 1, "<object>", "</object>" ], 5321 thead: [ 1, "<table>", "</table>" ], 5322 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 5323 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 5324 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 5325 5326 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 5327 // unless wrapped in a div with non-breaking characters in front of it. 5328 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] 5329 }, 5330 safeFragment = createSafeFragment( document ), 5331 fragmentDiv = safeFragment.appendChild( document.createElement("div") ); 5332 5333wrapMap.optgroup = wrapMap.option; 5334wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5335wrapMap.th = wrapMap.td; 5336 5337function getAll( context, tag ) { 5338 var elems, elem, 5339 i = 0, 5340 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : 5341 typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : 5342 undefined; 5343 5344 if ( !found ) { 5345 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { 5346 if ( !tag || jQuery.nodeName( elem, tag ) ) { 5347 found.push( elem ); 5348 } else { 5349 jQuery.merge( found, getAll( elem, tag ) ); 5350 } 5351 } 5352 } 5353 5354 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 5355 jQuery.merge( [ context ], found ) : 5356 found; 5357} 5358 5359// Used in buildFragment, fixes the defaultChecked property 5360function fixDefaultChecked( elem ) { 5361 if ( rcheckableType.test( elem.type ) ) { 5362 elem.defaultChecked = elem.checked; 5363 } 5364} 5365 5366// Support: IE<8 5367// Manipulating tables requires a tbody 5368function manipulationTarget( elem, content ) { 5369 return jQuery.nodeName( elem, "table" ) && 5370 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 5371 5372 elem.getElementsByTagName("tbody")[0] || 5373 elem.appendChild( elem.ownerDocument.createElement("tbody") ) : 5374 elem; 5375} 5376 5377// Replace/restore the type attribute of script elements for safe DOM manipulation 5378function disableScript( elem ) { 5379 elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; 5380 return elem; 5381} 5382function restoreScript( elem ) { 5383 var match = rscriptTypeMasked.exec( elem.type ); 5384 if ( match ) { 5385 elem.type = match[1]; 5386 } else { 5387 elem.removeAttribute("type"); 5388 } 5389 return elem; 5390} 5391 5392// Mark scripts as having already been evaluated 5393function setGlobalEval( elems, refElements ) { 5394 var elem, 5395 i = 0; 5396 for ( ; (elem = elems[i]) != null; i++ ) { 5397 jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); 5398 } 5399} 5400 5401function cloneCopyEvent( src, dest ) { 5402 5403 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 5404 return; 5405 } 5406 5407 var type, i, l, 5408 oldData = jQuery._data( src ), 5409 curData = jQuery._data( dest, oldData ), 5410 events = oldData.events; 5411 5412 if ( events ) { 5413 delete curData.handle; 5414 curData.events = {}; 5415 5416 for ( type in events ) { 5417 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5418 jQuery.event.add( dest, type, events[ type ][ i ] ); 5419 } 5420 } 5421 } 5422 5423 // make the cloned public data object a copy from the original 5424 if ( curData.data ) { 5425 curData.data = jQuery.extend( {}, curData.data ); 5426 } 5427} 5428 5429function fixCloneNodeIssues( src, dest ) { 5430 var nodeName, e, data; 5431 5432 // We do not need to do anything for non-Elements 5433 if ( dest.nodeType !== 1 ) { 5434 return; 5435 } 5436 5437 nodeName = dest.nodeName.toLowerCase(); 5438 5439 // IE6-8 copies events bound via attachEvent when using cloneNode. 5440 if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { 5441 data = jQuery._data( dest ); 5442 5443 for ( e in data.events ) { 5444 jQuery.removeEvent( dest, e, data.handle ); 5445 } 5446 5447 // Event data gets referenced instead of copied if the expando gets copied too 5448 dest.removeAttribute( jQuery.expando ); 5449 } 5450 5451 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text 5452 if ( nodeName === "script" && dest.text !== src.text ) { 5453 disableScript( dest ).text = src.text; 5454 restoreScript( dest ); 5455 5456 // IE6-10 improperly clones children of object elements using classid. 5457 // IE10 throws NoModificationAllowedError if parent is null, #12132. 5458 } else if ( nodeName === "object" ) { 5459 if ( dest.parentNode ) { 5460 dest.outerHTML = src.outerHTML; 5461 } 5462 5463 // This path appears unavoidable for IE9. When cloning an object 5464 // element in IE9, the outerHTML strategy above is not sufficient. 5465 // If the src has innerHTML and the destination does not, 5466 // copy the src.innerHTML into the dest.innerHTML. #10324 5467 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { 5468 dest.innerHTML = src.innerHTML; 5469 } 5470 5471 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5472 // IE6-8 fails to persist the checked state of a cloned checkbox 5473 // or radio button. Worse, IE6-7 fail to give the cloned element 5474 // a checked appearance if the defaultChecked value isn't also set 5475 5476 dest.defaultChecked = dest.checked = src.checked; 5477 5478 // IE6-7 get confused and end up setting the value of a cloned 5479 // checkbox/radio button to an empty string instead of "on" 5480 if ( dest.value !== src.value ) { 5481 dest.value = src.value; 5482 } 5483 5484 // IE6-8 fails to return the selected option to the default selected 5485 // state when cloning options 5486 } else if ( nodeName === "option" ) { 5487 dest.defaultSelected = dest.selected = src.defaultSelected; 5488 5489 // IE6-8 fails to set the defaultValue to the correct value when 5490 // cloning other types of input fields 5491 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5492 dest.defaultValue = src.defaultValue; 5493 } 5494} 5495 5496jQuery.extend({ 5497 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5498 var destElements, node, clone, i, srcElements, 5499 inPage = jQuery.contains( elem.ownerDocument, elem ); 5500 5501 if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { 5502 clone = elem.cloneNode( true ); 5503 5504 // IE<=8 does not properly clone detached, unknown element nodes 5505 } else { 5506 fragmentDiv.innerHTML = elem.outerHTML; 5507 fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); 5508 } 5509 5510 if ( (!support.noCloneEvent || !support.noCloneChecked) && 5511 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { 5512 5513 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 5514 destElements = getAll( clone ); 5515 srcElements = getAll( elem ); 5516 5517 // Fix all IE cloning issues 5518 for ( i = 0; (node = srcElements[i]) != null; ++i ) { 5519 // Ensure that the destination node is not null; Fixes #9587 5520 if ( destElements[i] ) {
5521 fixCloneNodeIssues( node, destElements[i] ); 5522 } 5523 } 5524 } 5525 5526 // Copy the events from the original to the clone 5527 if ( dataAndEvents ) { 5528 if ( deepDataAndEvents ) { 5529 srcElements = srcElements || getAll( elem ); 5530 destElements = destElements || getAll( clone ); 5531 5532 for ( i = 0; (node = srcElements[i]) != null; i++ ) { 5533 cloneCopyEvent( node, destElements[i] ); 5534 } 5535 } else { 5536 cloneCopyEvent( elem, clone ); 5537 } 5538 } 5539 5540 // Preserve script evaluation history 5541 destElements = getAll( clone, "script" ); 5542 if ( destElements.length > 0 ) { 5543 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 5544 } 5545 5546 destElements = srcElements = node = null; 5547 5548 // Return the cloned set 5549 return clone; 5550 }, 5551 5552 buildFragment: function( elems, context, scripts, selection ) { 5553 var j, elem, contains, 5554 tmp, tag, tbody, wrap, 5555 l = elems.length, 5556 5557 // Ensure a safe fragment 5558 safe = createSafeFragment( context ), 5559 5560 nodes = [], 5561 i = 0; 5562 5563 for ( ; i < l; i++ ) { 5564 elem = elems[ i ]; 5565 5566 if ( elem || elem === 0 ) { 5567 5568 // Add nodes directly 5569 if ( jQuery.type( elem ) === "object" ) { 5570 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5571 5572 // Convert non-html into a text node 5573 } else if ( !rhtml.test( elem ) ) { 5574 nodes.push( context.createTextNode( elem ) ); 5575 5576 // Convert html into DOM nodes 5577 } else { 5578 tmp = tmp || safe.appendChild( context.createElement("div") ); 5579 5580 // Deserialize a standard representation 5581 tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); 5582 wrap = wrapMap[ tag ] || wrapMap._default; 5583 5584 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; 5585 5586 // Descend through wrappers to the right content 5587 j = wrap[0]; 5588 while ( j-- ) { 5589 tmp = tmp.lastChild; 5590 } 5591 5592 // Manually add leading whitespace removed by IE 5593 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 5594 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); 5595 } 5596 5597 // Remove IE's autoinserted <tbody> from table fragments 5598 if ( !support.tbody ) { 5599 5600 // String was a <table>, *may* have spurious <tbody> 5601 elem = tag === "table" && !rtbody.test( elem ) ? 5602 tmp.firstChild : 5603 5604 // String was a bare <thead> or <tfoot> 5605 wrap[1] === "<table>" && !rtbody.test( elem ) ? 5606 tmp : 5607 0; 5608 5609 j = elem && elem.childNodes.length; 5610 while ( j-- ) { 5611 if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { 5612 elem.removeChild( tbody ); 5613 } 5614 } 5615 } 5616 5617 jQuery.merge( nodes, tmp.childNodes ); 5618 5619 // Fix #12392 for WebKit and IE > 9 5620 tmp.textContent = ""; 5621 5622 // Fix #12392 for oldIE 5623 while ( tmp.firstChild ) { 5624 tmp.removeChild( tmp.firstChild ); 5625 } 5626 5627 // Remember the top-level container for proper cleanup 5628 tmp = safe.lastChild; 5629 } 5630 } 5631 } 5632 5633 // Fix #11356: Clear elements from fragment 5634 if ( tmp ) { 5635 safe.removeChild( tmp ); 5636 } 5637 5638 // Reset defaultChecked for any radios and checkboxes 5639 // about to be appended to the DOM in IE 6/7 (#8060) 5640 if ( !support.appendChecked ) { 5641 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); 5642 } 5643 5644 i = 0; 5645 while ( (elem = nodes[ i++ ]) ) { 5646 5647 // #4087 - If origin and destination elements are the same, and this is 5648 // that element, do not do anything 5649 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { 5650 continue; 5651 } 5652 5653 contains = jQuery.contains( elem.ownerDocument, elem ); 5654 5655 // Append to fragment 5656 tmp = getAll( safe.appendChild( elem ), "script" ); 5657 5658 // Preserve script evaluation history 5659 if ( contains ) { 5660 setGlobalEval( tmp ); 5661 } 5662 5663 // Capture executables 5664 if ( scripts ) { 5665 j = 0; 5666 while ( (elem = tmp[ j++ ]) ) { 5667 if ( rscriptType.test( elem.type || "" ) ) { 5668 scripts.push( elem ); 5669 } 5670 } 5671 } 5672 } 5673 5674 tmp = null; 5675 5676 return safe; 5677 }, 5678 5679 cleanData: function( elems, /* internal */ acceptData ) { 5680 var elem, type, id, data, 5681 i = 0, 5682 internalKey = jQuery.expando, 5683 cache = jQuery.cache, 5684 deleteExpando = support.deleteExpando, 5685 special = jQuery.event.special; 5686 5687 for ( ; (elem = elems[i]) != null; i++ ) { 5688 if ( acceptData || jQuery.acceptData( elem ) ) { 5689 5690 id = elem[ internalKey ];
5691 data = id && cache[ id ]; 5692 5693 if ( data ) { 5694 if ( data.events ) { 5695 for ( type in data.events ) { 5696 if ( special[ type ] ) { 5697 jQuery.event.remove( elem, type ); 5698 5699 // This is a shortcut to avoid jQuery.event.remove's overhead 5700 } else { 5701 jQuery.removeEvent( elem, type, data.handle ); 5702 } 5703 } 5704 } 5705 5706 // Remove cache only if it was not already removed by jQuery.event.remove 5707 if ( cache[ id ] ) { 5708 5709 delete cache[ id ]; 5710 5711 // IE does not allow us to delete expando properties from nodes, 5712 // nor does it have a removeAttribute function on Document nodes; 5713 // we must handle all of these cases 5714 if ( deleteExpando ) { 5715 delete elem[ internalKey ]; 5716 5717 } else if ( typeof elem.removeAttribute !== strundefined ) { 5718 elem.removeAttribute( internalKey ); 5719 5720 } else { 5721 elem[ internalKey ] = null; 5722 } 5723 5724 deletedIds.push( id ); 5725 } 5726 } 5727 } 5728 } 5729 } 5730}); 5731 5732jQuery.fn.extend({ 5733 text: function( value ) { 5734 return access( this, function( value ) { 5735 return value === undefined ? 5736 jQuery.text( this ) : 5737 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); 5738 }, null, value, arguments.length ); 5739 }, 5740 5741 append: function() { 5742 return this.domManip( arguments, function( elem ) { 5743 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5744 var target = manipulationTarget( this, elem ); 5745 target.appendChild( elem ); 5746 } 5747 }); 5748 }, 5749
5750 prepend: function() { 5751 return this.domManip( arguments, function( elem ) { 5752 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5753 var target = manipulationTarget( this, elem ); 5754 target.insertBefore( elem, target.firstChild ); 5755 } 5756 }); 5757 }, 5758 5759 before: function() { 5760 return this.domManip( arguments, function( elem ) { 5761 if ( this.parentNode ) { 5762 this.parentNode.insertBefore( elem, this ); 5763 } 5764 }); 5765 }, 5766 5767 after: function() { 5768 return this.domManip( arguments, function( elem ) { 5769 if ( this.parentNode ) { 5770 this.parentNode.insertBefore( elem, this.nextSibling ); 5771 } 5772 }); 5773 }, 5774 5775 remove: function( selector, keepData /* Internal Use Only */ ) { 5776 var elem, 5777 elems = selector ? jQuery.filter( selector, this ) : this, 5778 i = 0; 5779 5780 for ( ; (elem = elems[i]) != null; i++ ) { 5781 5782 if ( !keepData && elem.nodeType === 1 ) { 5783 jQuery.cleanData( getAll( elem ) ); 5784 } 5785 5786 if ( elem.parentNode ) { 5787 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { 5788 setGlobalEval( getAll( elem, "script" ) ); 5789 } 5790 elem.parentNode.removeChild( elem ); 5791 } 5792 } 5793 5794 return this; 5795 }, 5796 5797 empty: function() { 5798 var elem, 5799 i = 0; 5800 5801 for ( ; (elem = this[i]) != null; i++ ) { 5802 // Remove element nodes and prevent memory leaks 5803 if ( elem.nodeType === 1 ) { 5804 jQuery.cleanData( getAll( elem, false ) ); 5805 } 5806 5807 // Remove any remaining nodes 5808 while ( elem.firstChild ) { 5809 elem.removeChild( elem.firstChild ); 5810 } 5811 5812 // If this is a select, ensure that it displays empty (#12336) 5813 // Support: IE<9 5814 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { 5815 elem.options.length = 0; 5816 } 5817 } 5818 5819 return this; 5820 }, 5821 5822 clone: function( dataAndEvents, deepDataAndEvents ) { 5823 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5824 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5825 5826 return this.map(function() { 5827 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 5828 }); 5829 }, 5830 5831 html: function( value ) { 5832 return access( this, function( value ) { 5833 var elem = this[ 0 ] || {}, 5834 i = 0, 5835 l = this.length; 5836 5837 if ( value === undefined ) { 5838 return elem.nodeType === 1 ? 5839 elem.innerHTML.replace( rinlinejQuery, "" ) : 5840 undefined; 5841 } 5842 5843 // See if we can take a shortcut and just use innerHTML 5844 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 5845 ( support.htmlSerialize || !rnoshimcache.test( value ) ) && 5846 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && 5847 !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { 5848 5849 value = value.replace( rxhtmlTag, "<$1></$2>" ); 5850 5851 try { 5852 for (; i < l; i++ ) { 5853 // Remove element nodes and prevent memory leaks 5854 elem = this[i] || {}; 5855 if ( elem.nodeType === 1 ) { 5856 jQuery.cleanData( getAll( elem, false ) ); 5857 elem.innerHTML = value; 5858 } 5859 } 5860 5861 elem = 0; 5862 5863 // If using innerHTML throws an exception, use the fallback method 5864 } catch(e) {} 5865 } 5866 5867 if ( elem ) { 5868 this.empty().append( value ); 5869 } 5870 }, null, value, arguments.length ); 5871 }, 5872 5873 replaceWith: function() { 5874 var arg = arguments[ 0 ]; 5875 5876 // Make the changes, replacing each context element with the new content 5877 this.domManip( arguments, function( elem ) { 5878 arg = this.parentNode; 5879 5880 jQuery.cleanData( getAll( this ) ); 5881 5882 if ( arg ) { 5883 arg.replaceChild( elem, this ); 5884 } 5885 }); 5886 5887 // Force removal if there was no new content (e.g., from empty arguments) 5888 return arg && (arg.length || arg.nodeType) ? this : this.remove(); 5889 }, 5890 5891 detach: function( selector ) { 5892 return this.remove( selector, true ); 5893 }, 5894 5895 domManip: function( args, callback ) { 5896 5897 // Flatten any nested arrays 5898 args = concat.apply( [], args ); 5899 5900 var first, node, hasScripts, 5901 scripts, doc, fragment, 5902 i = 0, 5903 l = this.length, 5904 set = this, 5905 iNoClone = l - 1, 5906 value = args[0], 5907 isFunction = jQuery.isFunction( value ); 5908 5909 // We can't cloneNode fragments that contain checked, in WebKit 5910 if ( isFunction || 5911 ( l > 1 && typeof value === "string" && 5912 !support.checkClone && rchecked.test( value ) ) ) { 5913 return this.each(function( index ) { 5914 var self = set.eq( index ); 5915 if ( isFunction ) { 5916 args[0] = value.call( this, index, self.html() ); 5917 } 5918 self.domManip( args, callback ); 5919 }); 5920 } 5921 5922 if ( l ) { 5923 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); 5924 first = fragment.firstChild; 5925 5926 if ( fragment.childNodes.length === 1 ) { 5927 fragment = first; 5928 } 5929 5930 if ( first ) { 5931 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5932 hasScripts = scripts.length; 5933 5934 // Use the original fragment for the last item instead of the first because it can end up 5935 // being emptied incorrectly in certain situations (#8070). 5936 for ( ; i < l; i++ ) { 5937 node = fragment; 5938 5939 if ( i !== iNoClone ) { 5940 node = jQuery.clone( node, true, true ); 5941 5942 // Keep references to cloned scripts for later restoration 5943 if ( hasScripts ) { 5944 jQuery.merge( scripts, getAll( node, "script" ) ); 5945 } 5946 } 5947 5948 callback.call( this[i], node, i ); 5949 } 5950 5951 if ( hasScripts ) { 5952 doc = scripts[ scripts.length - 1 ].ownerDocument; 5953 5954 // Reenable scripts 5955 jQuery.map( scripts, restoreScript ); 5956 5957 // Evaluate executable scripts on first document insertion 5958 for ( i = 0; i < hasScripts; i++ ) { 5959 node = scripts[ i ]; 5960 if ( rscriptType.test( node.type || "" ) && 5961 !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { 5962 5963 if ( node.src ) {
5964 // Optional AJAX dependency, but won't run scripts if not present 5965 if ( jQuery._evalUrl ) { 5966 jQuery._evalUrl( node.src ); 5967 } 5968 } else { 5969 jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); 5970 } 5971 } 5972 } 5973 } 5974 5975 // Fix #11809: Avoid leaking memory 5976 fragment = first = null; 5977 } 5978 } 5979 5980 return this; 5981 } 5982}); 5983 5984jQuery.each({ 5985 appendTo: "append", 5986 prependTo: "prepend", 5987 insertBefore: "before", 5988 insertAfter: "after", 5989 replaceAll: "replaceWith" 5990}, function( name, original ) { 5991 jQuery.fn[ name ] = function( selector ) { 5992 var elems, 5993 i = 0, 5994 ret = [], 5995 insert = jQuery( selector ), 5996 last = insert.length - 1; 5997 5998 for ( ; i <= last; i++ ) { 5999 elems = i === last ? this : this.clone(true); 6000 jQuery( insert[i] )[ original ]( elems ); 6001 6002 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() 6003 push.apply( ret, elems.get() ); 6004 } 6005 6006 return this.pushStack( ret ); 6007 }; 6008}); 6009 6010 6011var iframe, 6012 elemdisplay = {}; 6013 6014/** 6015 * Retrieve the actual display of a element 6016 * @param {String} name nodeName of the element 6017 * @param {Object} doc Document object 6018 */ 6019// Called only from within defaultDisplay 6020function actualDisplay( name, doc ) { 6021 var style, 6022 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 6023 6024 // getDefaultComputedStyle might be reliably used only on attached element 6025 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? 6026 6027 // Use of this method is a temporary fix (more like optmization) until something better comes along, 6028 // since it was removed from specification and supported only in FF 6029 style.display : jQuery.css( elem[ 0 ], "display" ); 6030 6031 // We don't have any data stored on the element, 6032 // so use "detach" method as fast way to get rid of the element 6033 elem.detach(); 6034 6035 return display; 6036} 6037 6038/** 6039 * Try to determine the default display value of an element 6040 * @param {String} nodeName 6041 */ 6042function defaultDisplay( nodeName ) { 6043 var doc = document, 6044 display = elemdisplay[ nodeName ]; 6045 6046 if ( !display ) { 6047 display = actualDisplay( nodeName, doc ); 6048 6049 // If the simple way fails, read from inside an iframe 6050 if ( display === "none" || !display ) { 6051 6052 // Use the already-created iframe if possible 6053 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); 6054 6055 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 6056 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; 6057 6058 // Support: IE 6059 doc.write(); 6060 doc.close(); 6061 6062 display = actualDisplay( nodeName, doc ); 6063 iframe.detach(); 6064 } 6065 6066 // Store the correct default display 6067 elemdisplay[ nodeName ] = display; 6068 } 6069 6070 return display; 6071} 6072 6073 6074(function() { 6075 var shrinkWrapBlocksVal; 6076 6077 support.shrinkWrapBlocks = function() { 6078 if ( shrinkWrapBlocksVal != null ) { 6079 return shrinkWrapBlocksVal; 6080 } 6081 6082 // Will be changed later if needed. 6083 shrinkWrapBlocksVal = false;
6084 6085 // Minified: var b,c,d 6086 var div, body, container; 6087 6088 body = document.getElementsByTagName( "body" )[ 0 ]; 6089 if ( !body || !body.style ) { 6090 // Test fired too early or in an unsupported environment, exit. 6091 return; 6092 } 6093 6094 // Setup 6095 div = document.createElement( "div" ); 6096 container = document.createElement( "div" ); 6097 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 6098 body.appendChild( container ).appendChild( div ); 6099 6100 // Support: IE6 6101 // Check if elements with layout shrink-wrap their children 6102 if ( typeof div.style.zoom !== strundefined ) { 6103 // Reset CSS: box-sizing; display; margin; border 6104 div.style.cssText = 6105 // Support: Firefox<29, Android 2.3 6106 // Vendor-prefix box-sizing 6107 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 6108 "box-sizing:content-box;display:block;margin:0;border:0;" + 6109 "padding:1px;width:1px;zoom:1"; 6110 div.appendChild( document.createElement( "div" ) ).style.width = "5px"; 6111 shrinkWrapBlocksVal = div.offsetWidth !== 3; 6112 } 6113 6114 body.removeChild( container ); 6115 6116 return shrinkWrapBlocksVal; 6117 }; 6118 6119})(); 6120var rmargin = (/^margin/); 6121 6122var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6123 6124 6125 6126var getStyles, curCSS, 6127 rposition = /^(top|right|bottom|left)$/; 6128 6129if ( window.getComputedStyle ) { 6130 getStyles = function( elem ) { 6131 return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); 6132 }; 6133 6134 curCSS = function( elem, name, computed ) { 6135 var width, minWidth, maxWidth, ret, 6136 style = elem.style; 6137 6138 computed = computed || getStyles( elem ); 6139 6140 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 6141 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; 6142 6143 if ( computed ) { 6144 6145 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { 6146 ret = jQuery.style( elem, name ); 6147 } 6148 6149 // A tribute to the "awesome hack by Dean Edwards" 6150 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right 6151 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels 6152 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 6153 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { 6154 6155 // Remember the original values 6156 width = style.width; 6157 minWidth = style.minWidth; 6158 maxWidth = style.maxWidth; 6159 6160 // Put in the new values to get a computed value out 6161 style.minWidth = style.maxWidth = style.width = ret; 6162 ret = computed.width; 6163 6164 // Revert the changed values 6165 style.width = width; 6166 style.minWidth = minWidth; 6167 style.maxWidth = maxWidth; 6168 } 6169 } 6170 6171 // Support: IE 6172 // IE returns zIndex value as an integer. 6173 return ret === undefined ? 6174 ret : 6175 ret + ""; 6176 }; 6177} else if ( document.documentElement.currentStyle ) { 6178 getStyles = function( elem ) { 6179 return elem.currentStyle; 6180 }; 6181 6182 curCSS = function( elem, name, computed ) { 6183 var left, rs, rsLeft, ret, 6184 style = elem.style; 6185 6186 computed = computed || getStyles( elem ); 6187 ret = computed ? computed[ name ] : undefined; 6188 6189 // Avoid setting ret to empty string here 6190 // so we don't default to auto 6191 if ( ret == null && style && style[ name ] ) { 6192 ret = style[ name ]; 6193 } 6194 6195 // From the awesome hack by Dean Edwards 6196 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6197 6198 // If we're not dealing with a regular pixel number 6199 // but a number that has a weird ending, we need to convert it to pixels 6200 // but not position css attributes, as those are proportional to the parent element instead 6201 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem 6202 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { 6203 6204 // Remember the original values 6205 left = style.left; 6206 rs = elem.runtimeStyle; 6207 rsLeft = rs && rs.left; 6208 6209 // Put in the new values to get a computed value out 6210 if ( rsLeft ) { 6211 rs.left = elem.currentStyle.left; 6212 } 6213 style.left = name === "fontSize" ? "1em" : ret; 6214 ret = style.pixelLeft + "px"; 6215 6216 // Revert the changed values 6217 style.left = left; 6218 if ( rsLeft ) { 6219 rs.left = rsLeft; 6220 } 6221 } 6222
6223 // Support: IE 6224 // IE returns zIndex value as an integer. 6225 return ret === undefined ? 6226 ret : 6227 ret + "" || "auto"; 6228 }; 6229} 6230 6231 6232 6233 6234function addGetHookIf( conditionFn, hookFn ) { 6235 // Define the hook, we'll check on the first run if it's really needed. 6236 return { 6237 get: function() { 6238 var condition = conditionFn(); 6239 6240 if ( condition == null ) { 6241 // The test was not ready at this point; screw the hook this time 6242 // but check again when needed next time. 6243 return; 6244 } 6245 6246 if ( condition ) { 6247 // Hook not needed (or it's not possible to use it due to missing dependency), 6248 // remove it. 6249 // Since there are no other hooks for marginRight, remove the whole object. 6250 delete this.get; 6251 return; 6252 } 6253 6254 // Hook needed; redefine it so that the support test is not executed again. 6255 6256 return (this.get = hookFn).apply( this, arguments ); 6257 } 6258 }; 6259} 6260 6261 6262(function() { 6263 // Minified: var b,c,d,e,f,g, h,i 6264 var div, style, a, pixelPositionVal, boxSizingReliableVal, 6265 reliableHiddenOffsetsVal, reliableMarginRightVal; 6266 6267 // Setup 6268 div = document.createElement( "div" ); 6269 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 6270 a = div.getElementsByTagName( "a" )[ 0 ]; 6271 style = a && a.style; 6272
6273 // Finish early in limited (non-browser) environments 6274 if ( !style ) { 6275 return; 6276 } 6277 6278 style.cssText = "float:left;opacity:.5"; 6279 6280 // Support: IE<9 6281 // Make sure that element opacity exists (as opposed to filter) 6282 support.opacity = style.opacity === "0.5"; 6283 6284 // Verify style float existence 6285 // (IE uses styleFloat instead of cssFloat) 6286 support.cssFloat = !!style.cssFloat; 6287 6288 div.style.backgroundClip = "content-box"; 6289 div.cloneNode( true ).style.backgroundClip = ""; 6290 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6291 6292 // Support: Firefox<29, Android 2.3 6293 // Vendor-prefix box-sizing 6294 support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || 6295 style.WebkitBoxSizing === ""; 6296 6297 jQuery.extend(support, { 6298 reliableHiddenOffsets: function() { 6299 if ( reliableHiddenOffsetsVal == null ) { 6300 computeStyleTests(); 6301 } 6302 return reliableHiddenOffsetsVal; 6303 }, 6304 6305 boxSizingReliable: function() { 6306 if ( boxSizingReliableVal == null ) { 6307 computeStyleTests(); 6308 } 6309 return boxSizingReliableVal; 6310 }, 6311 6312 pixelPosition: function() { 6313 if ( pixelPositionVal == null ) { 6314 computeStyleTests(); 6315 } 6316 return pixelPositionVal; 6317 }, 6318 6319 // Support: Android 2.3 6320 reliableMarginRight: function() { 6321 if ( reliableMarginRightVal == null ) { 6322 computeStyleTests(); 6323 } 6324 return reliableMarginRightVal; 6325 } 6326 }); 6327 6328 function computeStyleTests() { 6329 // Minified: var b,c,d,j 6330 var div, body, container, contents; 6331 6332 body = document.getElementsByTagName( "body" )[ 0 ]; 6333 if ( !body || !body.style ) { 6334 // Test fired too early or in an unsupported environment, exit. 6335 return; 6336 } 6337 6338 // Setup 6339 div = document.createElement( "div" ); 6340 container = document.createElement( "div" ); 6341 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 6342 body.appendChild( container ).appendChild( div ); 6343 6344 div.style.cssText = 6345 // Support: Firefox<29, Android 2.3 6346 // Vendor-prefix box-sizing 6347 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + 6348 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + 6349 "border:1px;padding:1px;width:4px;position:absolute"; 6350 6351 // Support: IE<9 6352 // Assume reasonable values in the absence of getComputedStyle 6353 pixelPositionVal = boxSizingReliableVal = false; 6354 reliableMarginRightVal = true; 6355 6356 // Check for getComputedStyle so that this code is not run in IE<9. 6357 if ( window.getComputedStyle ) { 6358 pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; 6359 boxSizingReliableVal = 6360 ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; 6361 6362 // Support: Android 2.3 6363 // Div with explicit width and no margin-right incorrectly 6364 // gets computed margin-right based on width of container (#3333) 6365 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6366 contents = div.appendChild( document.createElement( "div" ) ); 6367 6368 // Reset CSS: box-sizing; display; margin; border; padding 6369 contents.style.cssText = div.style.cssText = 6370 // Support: Firefox<29, Android 2.3 6371 // Vendor-prefix box-sizing 6372 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 6373 "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; 6374 contents.style.marginRight = contents.style.width = "0"; 6375 div.style.width = "1px"; 6376 6377 reliableMarginRightVal = 6378 !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); 6379 } 6380 6381 // Support: IE8 6382 // Check if table cells still have offsetWidth/Height when they are set 6383 // to display:none and there are still other visible table cells in a 6384 // table row; if so, offsetWidth/Height are not reliable for use when 6385 // determining if an element has been hidden directly using 6386 // display:none (it is still safe to use offsets if a parent element is 6387 // hidden; don safety goggles and see bug #4512 for more information). 6388 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 6389 contents = div.getElementsByTagName( "td" ); 6390 contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; 6391 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6392 if ( reliableHiddenOffsetsVal ) { 6393 contents[ 0 ].style.display = "";
6394 contents[ 1 ].style.display = "none"; 6395 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6396 } 6397 6398 body.removeChild( container ); 6399 } 6400 6401})(); 6402 6403 6404// A method for quickly swapping in/out CSS properties to get correct calculations. 6405jQuery.swap = function( elem, options, callback, args ) { 6406 var ret, name, 6407 old = {}; 6408 6409 // Remember the old values, and insert the new ones 6410 for ( name in options ) { 6411 old[ name ] = elem.style[ name ]; 6412 elem.style[ name ] = options[ name ]; 6413 } 6414 6415 ret = callback.apply( elem, args || [] ); 6416 6417 // Revert the old values 6418 for ( name in options ) { 6419 elem.style[ name ] = old[ name ]; 6420 } 6421 6422 return ret; 6423}; 6424 6425 6426var 6427 ralpha = /alpha\([^)]*\)/i, 6428 ropacity = /opacity\s*=\s*([^)]*)/, 6429 6430 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" 6431 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6432 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6433 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 6434 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), 6435 6436 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6437 cssNormalTransform = { 6438 letterSpacing: "0", 6439 fontWeight: "400" 6440 }, 6441 6442 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; 6443 6444 6445// return a css property mapped to a potentially vendor prefixed property 6446function vendorPropName( style, name ) { 6447 6448 // shortcut for names that are not vendor prefixed 6449 if ( name in style ) { 6450 return name; 6451 } 6452 6453 // check for vendor prefixed names 6454 var capName = name.charAt(0).toUpperCase() + name.slice(1), 6455 origName = name, 6456 i = cssPrefixes.length; 6457 6458 while ( i-- ) { 6459 name = cssPrefixes[ i ] + capName; 6460 if ( name in style ) { 6461 return name; 6462 } 6463 } 6464 6465 return origName; 6466} 6467 6468function showHide( elements, show ) { 6469 var display, elem, hidden, 6470 values = [], 6471 index = 0, 6472 length = elements.length; 6473 6474 for ( ; index < length; index++ ) { 6475 elem = elements[ index ]; 6476 if ( !elem.style ) { 6477 continue; 6478 } 6479 6480 values[ index ] = jQuery._data( elem, "olddisplay" ); 6481 display = elem.style.display; 6482 if ( show ) { 6483 // Reset the inline display of this element to learn if it is 6484 // being hidden by cascaded rules or not 6485 if ( !values[ index ] && display === "none" ) { 6486 elem.style.display = ""; 6487 } 6488 6489 // Set elements which have been overridden with display: none 6490 // in a stylesheet to whatever the default browser style is 6491 // for such an element 6492 if ( elem.style.display === "" && isHidden( elem ) ) { 6493 values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); 6494 } 6495 } else { 6496 hidden = isHidden( elem ); 6497 6498 if ( display && display !== "none" || !hidden ) { 6499 jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); 6500 } 6501 } 6502 } 6503 6504 // Set the display of most of the elements in a second loop 6505 // to avoid the constant reflow 6506 for ( index = 0; index < length; index++ ) { 6507 elem = elements[ index ]; 6508 if ( !elem.style ) { 6509 continue; 6510 } 6511 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 6512 elem.style.display = show ? values[ index ] || "" : "none"; 6513 } 6514 } 6515 6516 return elements; 6517} 6518 6519function setPositiveNumber( elem, value, subtract ) { 6520 var matches = rnumsplit.exec( value ); 6521 return matches ? 6522 // Guard against undefined "subtract", e.g., when used as in cssHooks 6523 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 6524 value; 6525} 6526 6527function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 6528 var i = extra === ( isBorderBox ? "border" : "content" ) ? 6529 // If we already have the right measurement, avoid augmentation 6530 4 : 6531 // Otherwise initialize for horizontal or vertical properties 6532 name === "width" ? 1 : 0, 6533 6534 val = 0; 6535 6536 for ( ; i < 4; i += 2 ) { 6537 // both box models exclude margin, so add it if we want it 6538 if ( extra === "margin" ) { 6539 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 6540 } 6541 6542 if ( isBorderBox ) { 6543 // border-box includes padding, so remove it if we want content 6544 if ( extra === "content" ) { 6545 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6546 } 6547 6548 // at this point, extra isn't border nor margin, so remove border 6549 if ( extra !== "margin" ) { 6550 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6551 } 6552 } else { 6553 // at this point, extra isn't content, so add padding 6554 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6555 6556 // at this point, extra isn't content nor padding, so add border 6557 if ( extra !== "padding" ) { 6558 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6559 } 6560 } 6561 } 6562 6563 return val; 6564} 6565 6566function getWidthOrHeight( elem, name, extra ) { 6567 6568 // Start with offset property, which is equivalent to the border-box value 6569 var valueIsBorderBox = true, 6570 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6571 styles = getStyles( elem ), 6572 isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6573 6574 // some non-html elements return undefined for offsetWidth, so check for null/undefined 6575 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 6576 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 6577 if ( val <= 0 || val == null ) { 6578 // Fall back to computed then uncomputed css if necessary 6579 val = curCSS( elem, name, styles ); 6580 if ( val < 0 || val == null ) { 6581 val = elem.style[ name ]; 6582 } 6583 6584 // Computed unit is not pixels. Stop here and return. 6585 if ( rnumnonpx.test(val) ) { 6586 return val; 6587 } 6588 6589 // we need the check for style in case a browser which returns unreliable values 6590 // for getComputedStyle silently falls back to the reliable elem.style 6591 valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); 6592 6593 // Normalize "", auto, and prepare for extra 6594 val = parseFloat( val ) || 0; 6595 } 6596 6597 // use the active box-sizing model to add/subtract irrelevant styles 6598 return ( val + 6599 augmentWidthOrHeight( 6600 elem, 6601 name, 6602 extra || ( isBorderBox ? "border" : "content" ), 6603 valueIsBorderBox, 6604 styles 6605 ) 6606 ) + "px"; 6607} 6608 6609jQuery.extend({ 6610 // Add in style property hooks for overriding the default 6611 // behavior of getting and setting a style property 6612 cssHooks: { 6613 opacity: { 6614 get: function( elem, computed ) { 6615 if ( computed ) { 6616 // We should always get a number back from opacity 6617 var ret = curCSS( elem, "opacity" ); 6618 return ret === "" ? "1" : ret; 6619 } 6620 } 6621 } 6622 }, 6623 6624 // Don't automatically add "px" to these possibly-unitless properties 6625 cssNumber: { 6626 "columnCount": true, 6627 "fillOpacity": true, 6628 "flexGrow": true, 6629 "flexShrink": true, 6630 "fontWeight": true, 6631 "lineHeight": true, 6632 "opacity": true, 6633 "order": true, 6634 "orphans": true, 6635 "widows": true, 6636 "zIndex": true, 6637 "zoom": true 6638 }, 6639 6640 // Add in properties whose names you wish to fix before 6641 // setting or getting the value 6642 cssProps: { 6643 // normalize float css property 6644 "float": support.cssFloat ? "cssFloat" : "styleFloat" 6645 }, 6646 6647 // Get and set the style property on a DOM Node 6648 style: function( elem, name, value, extra ) { 6649 // Don't set styles on text and comment nodes 6650 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6651 return; 6652 } 6653 6654 // Make sure that we're working with the right name 6655 var ret, type, hooks, 6656 origName = jQuery.camelCase( name ), 6657 style = elem.style; 6658 6659 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); 6660 6661 // gets hook for the prefixed version 6662 // followed by the unprefixed version 6663 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6664 6665 // Check if we're setting a value 6666 if ( value !== undefined ) { 6667 type = typeof value; 6668 6669 // convert relative number strings (+= or -=) to relative numbers. #7345 6670 if ( type === "string" && (ret = rrelNum.exec( value )) ) { 6671 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); 6672 // Fixes bug #9237 6673 type = "number"; 6674 } 6675 6676 // Make sure that null and NaN values aren't set. See: #7116 6677 if ( value == null || value !== value ) { 6678 return; 6679 } 6680 6681 // If a number was passed in, add 'px' to the (except for certain CSS properties) 6682 if ( type === "number" && !jQuery.cssNumber[ origName ] ) { 6683 value += "px"; 6684 } 6685 6686 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, 6687 // but it would mean to define eight (for every problematic property) identical functions 6688 if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { 6689 style[ name ] = "inherit"; 6690 } 6691 6692 // If a hook was provided, use that value, otherwise just set the specified value 6693 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { 6694
6695 // Support: IE 6696 // Swallow errors from 'invalid' CSS values (#5509) 6697 try { 6698 style[ name ] = value; 6699 } catch(e) {} 6700 } 6701 6702 } else { 6703 // If a hook was provided get the non-computed value from there 6704 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { 6705 return ret; 6706 } 6707 6708 // Otherwise just get the value from the style object 6709 return style[ name ]; 6710 } 6711 }, 6712 6713 css: function( elem, name, extra, styles ) { 6714 var num, val, hooks, 6715 origName = jQuery.camelCase( name ); 6716 6717 // Make sure that we're working with the right name 6718 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); 6719 6720 // gets hook for the prefixed version 6721 // followed by the unprefixed version 6722 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6723 6724 // If a hook was provided get the computed value from there 6725 if ( hooks && "get" in hooks ) { 6726 val = hooks.get( elem, true, extra ); 6727 } 6728 6729 // Otherwise, if a way to get the computed value exists, use that 6730 if ( val === undefined ) { 6731 val = curCSS( elem, name, styles ); 6732 } 6733 6734 //convert "normal" to computed value 6735 if ( val === "normal" && name in cssNormalTransform ) { 6736 val = cssNormalTransform[ name ]; 6737 } 6738 6739 // Return, converting to number if forced or a qualifier was provided and val looks numeric 6740 if ( extra === "" || extra ) { 6741 num = parseFloat( val ); 6742 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; 6743 } 6744 return val; 6745 } 6746}); 6747 6748jQuery.each([ "height", "width" ], function( i, name ) { 6749 jQuery.cssHooks[ name ] = { 6750 get: function( elem, computed, extra ) { 6751 if ( computed ) { 6752 // certain elements can have dimension info if we invisibly show them 6753 // however, it must have a current display style that would benefit from this 6754 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? 6755 jQuery.swap( elem, cssShow, function() { 6756 return getWidthOrHeight( elem, name, extra ); 6757 }) : 6758 getWidthOrHeight( elem, name, extra ); 6759 } 6760 }, 6761 6762 set: function( elem, value, extra ) { 6763 var styles = extra && getStyles( elem ); 6764 return setPositiveNumber( elem, value, extra ? 6765 augmentWidthOrHeight( 6766 elem, 6767 name, 6768 extra, 6769 support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6770 styles 6771 ) : 0 6772 ); 6773 } 6774 }; 6775}); 6776 6777if ( !support.opacity ) { 6778 jQuery.cssHooks.opacity = { 6779 get: function( elem, computed ) { 6780 // IE uses filters for opacity 6781 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? 6782 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : 6783 computed ? "1" : ""; 6784 }, 6785 6786 set: function( elem, value ) { 6787 var style = elem.style, 6788 currentStyle = elem.currentStyle, 6789 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 6790 filter = currentStyle && currentStyle.filter || style.filter || ""; 6791 6792 // IE has trouble with opacity if it does not have layout 6793 // Force it by setting the zoom level 6794 style.zoom = 1; 6795 6796 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 6797 // if value === "", then remove inline opacity #12685 6798 if ( ( value >= 1 || value === "" ) && 6799 jQuery.trim( filter.replace( ralpha, "" ) ) === "" && 6800 style.removeAttribute ) { 6801 6802 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 6803 // if "filter:" is present at all, clearType is disabled, we want to avoid this 6804 // style.removeAttribute is IE Only, but so apparently is this code path... 6805 style.removeAttribute( "filter" ); 6806 6807 // if there is no filter style applied in a css rule or unset inline opacity, we are done 6808 if ( value === "" || currentStyle && !currentStyle.filter ) { 6809 return; 6810 } 6811 } 6812 6813 // otherwise, set new filter values 6814 style.filter = ralpha.test( filter ) ? 6815 filter.replace( ralpha, opacity ) : 6816 filter + " " + opacity; 6817 } 6818 }; 6819} 6820 6821jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 6822 function( elem, computed ) { 6823 if ( computed ) { 6824 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6825 // Work around by temporarily setting element display to inline-block 6826 return jQuery.swap( elem, { "display": "inline-block" }, 6827 curCSS, [ elem, "marginRight" ] ); 6828 } 6829 } 6830); 6831 6832// These hooks are used by animate to expand properties 6833jQuery.each({ 6834 margin: "", 6835 padding: "", 6836 border: "Width" 6837}, function( prefix, suffix ) { 6838 jQuery.cssHooks[ prefix + suffix ] = { 6839 expand: function( value ) { 6840 var i = 0, 6841 expanded = {}, 6842 6843 // assumes a single number if not a string 6844 parts = typeof value === "string" ? value.split(" ") : [ value ]; 6845 6846 for ( ; i < 4; i++ ) { 6847 expanded[ prefix + cssExpand[ i ] + suffix ] = 6848 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6849 } 6850 6851 return expanded; 6852 } 6853 }; 6854 6855 if ( !rmargin.test( prefix ) ) { 6856 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 6857 } 6858}); 6859 6860jQuery.fn.extend({ 6861 css: function( name, value ) { 6862 return access( this, function( elem, name, value ) { 6863 var styles, len, 6864 map = {}, 6865 i = 0; 6866 6867 if ( jQuery.isArray( name ) ) { 6868 styles = getStyles( elem ); 6869 len = name.length; 6870 6871 for ( ; i < len; i++ ) { 6872 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 6873 } 6874 6875 return map; 6876 } 6877 6878 return value !== undefined ? 6879 jQuery.style( elem, name, value ) : 6880 jQuery.css( elem, name ); 6881 }, name, value, arguments.length > 1 ); 6882 }, 6883 show: function() { 6884 return showHide( this, true ); 6885 }, 6886 hide: function() { 6887 return showHide( this ); 6888 }, 6889 toggle: function( state ) { 6890 if ( typeof state === "boolean" ) { 6891 return state ? this.show() : this.hide(); 6892 } 6893 6894 return this.each(function() { 6895 if ( isHidden( this ) ) { 6896 jQuery( this ).show(); 6897 } else { 6898 jQuery( this ).hide(); 6899 } 6900 }); 6901 } 6902}); 6903 6904 6905function Tween( elem, options, prop, end, easing ) { 6906 return new Tween.prototype.init( elem, options, prop, end, easing ); 6907} 6908jQuery.Tween = Tween; 6909
6910Tween.prototype = { 6911 constructor: Tween, 6912 init: function( elem, options, prop, end, easing, unit ) { 6913 this.elem = elem; 6914 this.prop = prop; 6915 this.easing = easing || "swing"; 6916 this.options = options; 6917 this.start = this.now = this.cur(); 6918 this.end = end; 6919 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 6920 }, 6921 cur: function() { 6922 var hooks = Tween.propHooks[ this.prop ]; 6923 6924 return hooks && hooks.get ? 6925 hooks.get( this ) : 6926 Tween.propHooks._default.get( this ); 6927 }, 6928 run: function( percent ) { 6929 var eased, 6930 hooks = Tween.propHooks[ this.prop ]; 6931 6932 if ( this.options.duration ) { 6933 this.pos = eased = jQuery.easing[ this.easing ]( 6934 percent, this.options.duration * percent, 0, 1, this.options.duration 6935 ); 6936 } else { 6937 this.pos = eased = percent; 6938 } 6939 this.now = ( this.end - this.start ) * eased + this.start; 6940 6941 if ( this.options.step ) { 6942 this.options.step.call( this.elem, this.now, this ); 6943 } 6944 6945 if ( hooks && hooks.set ) { 6946 hooks.set( this ); 6947 } else { 6948 Tween.propHooks._default.set( this ); 6949 } 6950 return this; 6951 } 6952}; 6953 6954Tween.prototype.init.prototype = Tween.prototype; 6955 6956Tween.propHooks = { 6957 _default: { 6958 get: function( tween ) { 6959 var result; 6960 6961 if ( tween.elem[ tween.prop ] != null && 6962 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { 6963 return tween.elem[ tween.prop ]; 6964 } 6965 6966 // passing an empty string as a 3rd parameter to .css will automatically 6967 // attempt a parseFloat and fallback to a string if the parse fails 6968 // so, simple values such as "10px" are parsed to Float. 6969 // complex values such as "rotate(1rad)" are returned as is. 6970 result = jQuery.css( tween.elem, tween.prop, "" ); 6971 // Empty strings, null, undefined and "auto" are converted to 0. 6972 return !result || result === "auto" ? 0 : result; 6973 }, 6974 set: function( tween ) { 6975 // use step hook for back compat - use cssHook if its there - use .style if its 6976 // available and use plain properties where available 6977 if ( jQuery.fx.step[ tween.prop ] ) { 6978 jQuery.fx.step[ tween.prop ]( tween ); 6979 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { 6980 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 6981 } else { 6982 tween.elem[ tween.prop ] = tween.now; 6983 } 6984 } 6985 } 6986}; 6987 6988// Support: IE <=9 6989// Panic based approach to setting things on disconnected nodes 6990 6991Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 6992 set: function( tween ) { 6993 if ( tween.elem.nodeType && tween.elem.parentNode ) { 6994 tween.elem[ tween.prop ] = tween.now; 6995 } 6996 } 6997}; 6998 6999jQuery.easing = { 7000 linear: function( p ) { 7001 return p; 7002 }, 7003 swing: function( p ) { 7004 return 0.5 - Math.cos( p * Math.PI ) / 2; 7005 } 7006}; 7007 7008jQuery.fx = Tween.prototype.init; 7009 7010// Back Compat <1.8 extension point 7011jQuery.fx.step = {}; 7012 7013 7014 7015 7016var 7017 fxNow, timerId, 7018 rfxtypes = /^(?:toggle|show|hide)$/, 7019 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), 7020 rrun = /queueHooks$/, 7021 animationPrefilters = [ defaultPrefilter ], 7022 tweeners = { 7023 "*": [ function( prop, value ) { 7024 var tween = this.createTween( prop, value ), 7025 target = tween.cur(), 7026 parts = rfxnum.exec( value ), 7027 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 7028 7029 // Starting value computation is required for potential unit mismatches 7030 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && 7031 rfxnum.exec( jQuery.css( tween.elem, prop ) ), 7032 scale = 1, 7033 maxIterations = 20; 7034 7035 if ( start && start[ 3 ] !== unit ) { 7036 // Trust units reported by jQuery.css 7037 unit = unit || start[ 3 ]; 7038 7039 // Make sure we update the tween properties later on 7040 parts = parts || []; 7041 7042 // Iteratively approximate from a nonzero starting point 7043 start = +target || 1; 7044 7045 do { 7046 // If previous iteration zeroed out, double until we get *something* 7047 // Use a string for doubling factor so we don't accidentally see scale as unchanged below 7048 scale = scale || ".5"; 7049 7050 // Adjust and apply 7051 start = start / scale; 7052 jQuery.style( tween.elem, prop, start + unit ); 7053 7054 // Update scale, tolerating zero or NaN from tween.cur() 7055 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough 7056 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); 7057 } 7058 7059 // Update tween properties 7060 if ( parts ) { 7061 start = tween.start = +start || +target || 0; 7062 tween.unit = unit; 7063 // If a +=/-= token was provided, we're doing a relative animation 7064 tween.end = parts[ 1 ] ? 7065 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : 7066 +parts[ 2 ]; 7067 } 7068 7069 return tween; 7070 } ] 7071 }; 7072 7073// Animations created synchronously will run synchronously 7074function createFxNow() { 7075 setTimeout(function() { 7076 fxNow = undefined; 7077 }); 7078 return ( fxNow = jQuery.now() ); 7079} 7080 7081// Generate parameters to create a standard animation 7082function genFx( type, includeWidth ) { 7083 var which, 7084 attrs = { height: type }, 7085 i = 0; 7086 7087 // if we include width, step value is 1 to do all cssExpand values, 7088 // if we don't include width, step value is 2 to skip over Left and Right 7089 includeWidth = includeWidth ? 1 : 0; 7090 for ( ; i < 4 ; i += 2 - includeWidth ) { 7091 which = cssExpand[ i ]; 7092 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7093 } 7094 7095 if ( includeWidth ) { 7096 attrs.opacity = attrs.width = type; 7097 } 7098 7099 return attrs; 7100} 7101 7102function createTween( value, prop, animation ) { 7103 var tween, 7104 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), 7105 index = 0, 7106 length = collection.length; 7107 for ( ; index < length; index++ ) { 7108 if ( (tween = collection[ index ].call( animation, prop, value )) ) { 7109 7110 // we're done with this property 7111 return tween; 7112 } 7113 } 7114} 7115 7116function defaultPrefilter( elem, props, opts ) { 7117 /* jshint validthis: true */ 7118 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 7119 anim = this, 7120 orig = {}, 7121 style = elem.style, 7122 hidden = elem.nodeType && isHidden( elem ), 7123 dataShow = jQuery._data( elem, "fxshow" ); 7124 7125 // handle queue: false promises 7126 if ( !opts.queue ) { 7127 hooks = jQuery._queueHooks( elem, "fx" ); 7128 if ( hooks.unqueued == null ) { 7129 hooks.unqueued = 0; 7130 oldfire = hooks.empty.fire; 7131 hooks.empty.fire = function() { 7132 if ( !hooks.unqueued ) { 7133 oldfire(); 7134 } 7135 }; 7136 } 7137 hooks.unqueued++; 7138 7139 anim.always(function() { 7140 // doing this makes sure that the complete handler will be called 7141 // before this completes 7142 anim.always(function() { 7143 hooks.unqueued--; 7144 if ( !jQuery.queue( elem, "fx" ).length ) { 7145 hooks.empty.fire(); 7146 } 7147 }); 7148 }); 7149 } 7150 7151 // height/width overflow pass 7152 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 7153 // Make sure that nothing sneaks out 7154 // Record all 3 overflow attributes because IE does not 7155 // change the overflow attribute when overflowX and 7156 // overflowY are set to the same value 7157 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7158 7159 // Set display property to inline-block for height/width 7160 // animations on inline elements that are having width/height animated
7161 display = jQuery.css( elem, "display" ); 7162 7163 // Test default display if display is currently "none" 7164 checkDisplay = display === "none" ? 7165 jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 7166 7167 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 7168 7169 // inline-level elements accept inline-block; 7170 // block-level elements need to be inline with layout 7171 if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { 7172 style.display = "inline-block"; 7173 } else { 7174 style.zoom = 1; 7175 } 7176 } 7177 } 7178 7179 if ( opts.overflow ) { 7180 style.overflow = "hidden"; 7181 if ( !support.shrinkWrapBlocks() ) { 7182 anim.always(function() { 7183 style.overflow = opts.overflow[ 0 ]; 7184 style.overflowX = opts.overflow[ 1 ]; 7185 style.overflowY = opts.overflow[ 2 ]; 7186 }); 7187 } 7188 } 7189 7190 // show/hide pass 7191 for ( prop in props ) { 7192 value = props[ prop ]; 7193 if ( rfxtypes.exec( value ) ) { 7194 delete props[ prop ]; 7195 toggle = toggle || value === "toggle"; 7196 if ( value === ( hidden ? "hide" : "show" ) ) { 7197 7198 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden 7199 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7200 hidden = true; 7201 } else { 7202 continue; 7203 } 7204 } 7205 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7206 7207 // Any non-fx value stops us from restoring the original display value 7208 } else { 7209 display = undefined; 7210 } 7211 } 7212 7213 if ( !jQuery.isEmptyObject( orig ) ) { 7214 if ( dataShow ) { 7215 if ( "hidden" in dataShow ) { 7216 hidden = dataShow.hidden; 7217 } 7218 } else { 7219 dataShow = jQuery._data( elem, "fxshow", {} ); 7220 } 7221 7222 // store state if its toggle - enables .stop().toggle() to "reverse" 7223 if ( toggle ) { 7224 dataShow.hidden = !hidden; 7225 } 7226 if ( hidden ) { 7227 jQuery( elem ).show(); 7228 } else { 7229 anim.done(function() { 7230 jQuery( elem ).hide(); 7231 }); 7232 } 7233 anim.done(function() { 7234 var prop; 7235 jQuery._removeData( elem, "fxshow" ); 7236 for ( prop in orig ) { 7237 jQuery.style( elem, prop, orig[ prop ] ); 7238 } 7239 }); 7240 for ( prop in orig ) { 7241 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7242 7243 if ( !( prop in dataShow ) ) { 7244 dataShow[ prop ] = tween.start; 7245 if ( hidden ) { 7246 tween.end = tween.start; 7247 tween.start = prop === "width" || prop === "height" ? 1 : 0; 7248 } 7249 } 7250 } 7251 7252 // If this is a noop like .hide().hide(), restore an overwritten display value 7253 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { 7254 style.display = display; 7255 } 7256} 7257 7258function propFilter( props, specialEasing ) { 7259 var index, name, easing, value, hooks; 7260 7261 // camelCase, specialEasing and expand cssHook pass 7262 for ( index in props ) { 7263 name = jQuery.camelCase( index ); 7264 easing = specialEasing[ name ]; 7265 value = props[ index ]; 7266 if ( jQuery.isArray( value ) ) { 7267 easing = value[ 1 ]; 7268 value = props[ index ] = value[ 0 ]; 7269 } 7270 7271 if ( index !== name ) { 7272 props[ name ] = value; 7273 delete props[ index ]; 7274 } 7275 7276 hooks = jQuery.cssHooks[ name ]; 7277 if ( hooks && "expand" in hooks ) { 7278 value = hooks.expand( value ); 7279 delete props[ name ]; 7280 7281 // not quite $.extend, this wont overwrite keys already present. 7282 // also - reusing 'index' from above because we have the correct "name" 7283 for ( index in value ) { 7284 if ( !( index in props ) ) { 7285 props[ index ] = value[ index ]; 7286 specialEasing[ index ] = easing; 7287 } 7288 } 7289 } else { 7290 specialEasing[ name ] = easing; 7291 } 7292 } 7293} 7294 7295function Animation( elem, properties, options ) { 7296 var result, 7297 stopped, 7298 index = 0, 7299 length = animationPrefilters.length, 7300 deferred = jQuery.Deferred().always( function() { 7301 // don't match elem in the :animated selector 7302 delete tick.elem; 7303 }), 7304 tick = function() { 7305 if ( stopped ) { 7306 return false; 7307 } 7308 var currentTime = fxNow || createFxNow(), 7309 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7310 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) 7311 temp = remaining / animation.duration || 0, 7312 percent = 1 - temp, 7313 index = 0, 7314 length = animation.tweens.length; 7315 7316 for ( ; index < length ; index++ ) { 7317 animation.tweens[ index ].run( percent ); 7318 } 7319 7320 deferred.notifyWith( elem, [ animation, percent, remaining ]); 7321 7322 if ( percent < 1 && length ) { 7323 return remaining; 7324 } else { 7325 deferred.resolveWith( elem, [ animation ] ); 7326 return false;
vendor: 5,238 bytes, lines 7327-7524
7327 } 7328 }, 7329 animation = deferred.promise({ 7330 elem: elem, 7331 props: jQuery.extend( {}, properties ), 7332 opts: jQuery.extend( true, { specialEasing: {} }, options ), 7333 originalProperties: properties, 7334 originalOptions: options, 7335 startTime: fxNow || createFxNow(), 7336 duration: options.duration, 7337 tweens: [], 7338 createTween: function( prop, end ) { 7339 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7340 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7341 animation.tweens.push( tween ); 7342 return tween; 7343 }, 7344 stop: function( gotoEnd ) { 7345 var index = 0, 7346 // if we are going to the end, we want to run all the tweens 7347 // otherwise we skip this part 7348 length = gotoEnd ? animation.tweens.length : 0; 7349 if ( stopped ) { 7350 return this; 7351 } 7352 stopped = true; 7353 for ( ; index < length ; index++ ) { 7354 animation.tweens[ index ].run( 1 ); 7355 } 7356 7357 // resolve when we played the last frame 7358 // otherwise, reject 7359 if ( gotoEnd ) { 7360 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7361 } else { 7362 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7363 } 7364 return this; 7365 } 7366 }), 7367 props = animation.props; 7368 7369 propFilter( props, animation.opts.specialEasing ); 7370 7371 for ( ; index < length ; index++ ) { 7372 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); 7373 if ( result ) { 7374 return result; 7375 } 7376 } 7377 7378 jQuery.map( props, createTween, animation ); 7379 7380 if ( jQuery.isFunction( animation.opts.start ) ) { 7381 animation.opts.start.call( elem, animation ); 7382 } 7383 7384 jQuery.fx.timer( 7385 jQuery.extend( tick, { 7386 elem: elem, 7387 anim: animation, 7388 queue: animation.opts.queue 7389 }) 7390 ); 7391 7392 // attach callbacks from options 7393 return animation.progress( animation.opts.progress ) 7394 .done( animation.opts.done, animation.opts.complete ) 7395 .fail( animation.opts.fail ) 7396 .always( animation.opts.always ); 7397} 7398 7399jQuery.Animation = jQuery.extend( Animation, { 7400 tweener: function( props, callback ) { 7401 if ( jQuery.isFunction( props ) ) { 7402 callback = props; 7403 props = [ "*" ]; 7404 } else { 7405 props = props.split(" "); 7406 } 7407 7408 var prop, 7409 index = 0, 7410 length = props.length; 7411 7412 for ( ; index < length ; index++ ) { 7413 prop = props[ index ]; 7414 tweeners[ prop ] = tweeners[ prop ] || []; 7415 tweeners[ prop ].unshift( callback ); 7416 } 7417 }, 7418 7419 prefilter: function( callback, prepend ) { 7420 if ( prepend ) { 7421 animationPrefilters.unshift( callback ); 7422 } else { 7423 animationPrefilters.push( callback ); 7424 } 7425 } 7426}); 7427 7428jQuery.speed = function( speed, easing, fn ) { 7429 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7430 complete: fn || !fn && easing || 7431 jQuery.isFunction( speed ) && speed, 7432 duration: speed, 7433 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 7434 }; 7435 7436 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 7437 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 7438 7439 // normalize opt.queue - true/undefined/null -> "fx" 7440 if ( opt.queue == null || opt.queue === true ) { 7441 opt.queue = "fx"; 7442 } 7443 7444 // Queueing 7445 opt.old = opt.complete; 7446 7447 opt.complete = function() { 7448 if ( jQuery.isFunction( opt.old ) ) { 7449 opt.old.call( this ); 7450 } 7451 7452 if ( opt.queue ) { 7453 jQuery.dequeue( this, opt.queue ); 7454 } 7455 }; 7456 7457 return opt; 7458}; 7459 7460jQuery.fn.extend({ 7461 fadeTo: function( speed, to, easing, callback ) { 7462 7463 // show any hidden elements after setting opacity to 0 7464 return this.filter( isHidden ).css( "opacity", 0 ).show() 7465 7466 // animate to the value specified 7467 .end().animate({ opacity: to }, speed, easing, callback ); 7468 }, 7469 animate: function( prop, speed, easing, callback ) { 7470 var empty = jQuery.isEmptyObject( prop ), 7471 optall = jQuery.speed( speed, easing, callback ), 7472 doAnimation = function() { 7473 // Operate on a copy of prop so per-property easing won't be lost 7474 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7475 7476 // Empty animations, or finishing resolves immediately 7477 if ( empty || jQuery._data( this, "finish" ) ) { 7478 anim.stop( true ); 7479 } 7480 }; 7481 doAnimation.finish = doAnimation; 7482 7483 return empty || optall.queue === false ? 7484 this.each( doAnimation ) : 7485 this.queue( optall.queue, doAnimation ); 7486 }, 7487 stop: function( type, clearQueue, gotoEnd ) { 7488 var stopQueue = function( hooks ) { 7489 var stop = hooks.stop; 7490 delete hooks.stop; 7491 stop( gotoEnd ); 7492 }; 7493 7494 if ( typeof type !== "string" ) { 7495 gotoEnd = clearQueue; 7496 clearQueue = type; 7497 type = undefined; 7498 } 7499 if ( clearQueue && type !== false ) { 7500 this.queue( type || "fx", [] ); 7501 } 7502 7503 return this.each(function() { 7504 var dequeue = true, 7505 index = type != null && type + "queueHooks", 7506 timers = jQuery.timers, 7507 data = jQuery._data( this ); 7508 7509 if ( index ) { 7510 if ( data[ index ] && data[ index ].stop ) { 7511 stopQueue( data[ index ] ); 7512 } 7513 } else { 7514 for ( index in data ) { 7515 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7516 stopQueue( data[ index ] ); 7517 } 7518 } 7519 } 7520 7521 for ( index = timers.length; index--; ) { 7522 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { 7523 timers[ index ].anim.stop( gotoEnd ); 7524 dequeue = false;
7525 timers.splice( index, 1 ); 7526 } 7527 } 7528 7529 // start the next in the queue if the last step wasn't forced 7530 // timers currently will call their complete callbacks, which will dequeue 7531 // but only if they were gotoEnd 7532 if ( dequeue || !gotoEnd ) { 7533 jQuery.dequeue( this, type ); 7534 } 7535 }); 7536 }, 7537 finish: function( type ) { 7538 if ( type !== false ) { 7539 type = type || "fx"; 7540 } 7541 return this.each(function() { 7542 var index, 7543 data = jQuery._data( this ), 7544 queue = data[ type + "queue" ], 7545 hooks = data[ type + "queueHooks" ], 7546 timers = jQuery.timers, 7547 length = queue ? queue.length : 0; 7548 7549 // enable finishing flag on private data 7550 data.finish = true; 7551 7552 // empty the queue first 7553 jQuery.queue( this, type, [] ); 7554 7555 if ( hooks && hooks.stop ) { 7556 hooks.stop.call( this, true ); 7557 } 7558 7559 // look for any active animations, and finish them 7560 for ( index = timers.length; index--; ) { 7561 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7562 timers[ index ].anim.stop( true ); 7563 timers.splice( index, 1 ); 7564 } 7565 } 7566 7567 // look for any animations in the old queue and finish them 7568 for ( index = 0; index < length; index++ ) { 7569 if ( queue[ index ] && queue[ index ].finish ) { 7570 queue[ index ].finish.call( this ); 7571 } 7572 } 7573 7574 // turn off finishing flag 7575 delete data.finish; 7576 }); 7577 } 7578}); 7579 7580jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { 7581 var cssFn = jQuery.fn[ name ]; 7582 jQuery.fn[ name ] = function( speed, easing, callback ) { 7583 return speed == null || typeof speed === "boolean" ? 7584 cssFn.apply( this, arguments ) : 7585 this.animate( genFx( name, true ), speed, easing, callback ); 7586 }; 7587}); 7588 7589// Generate shortcuts for custom animations 7590jQuery.each({ 7591 slideDown: genFx("show"), 7592 slideUp: genFx("hide"), 7593 slideToggle: genFx("toggle"), 7594 fadeIn: { opacity: "show" }, 7595 fadeOut: { opacity: "hide" }, 7596 fadeToggle: { opacity: "toggle" } 7597}, function( name, props ) { 7598 jQuery.fn[ name ] = function( speed, easing, callback ) { 7599 return this.animate( props, speed, easing, callback ); 7600 }; 7601}); 7602 7603jQuery.timers = []; 7604jQuery.fx.tick = function() { 7605 var timer, 7606 timers = jQuery.timers, 7607 i = 0; 7608 7609 fxNow = jQuery.now(); 7610 7611 for ( ; i < timers.length; i++ ) { 7612 timer = timers[ i ]; 7613 // Checks the timer has not already been removed 7614 if ( !timer() && timers[ i ] === timer ) { 7615 timers.splice( i--, 1 ); 7616 } 7617 } 7618 7619 if ( !timers.length ) { 7620 jQuery.fx.stop(); 7621 } 7622 fxNow = undefined; 7623}; 7624 7625jQuery.fx.timer = function( timer ) { 7626 jQuery.timers.push( timer ); 7627 if ( timer() ) { 7628 jQuery.fx.start(); 7629 } else { 7630 jQuery.timers.pop(); 7631 } 7632}; 7633 7634jQuery.fx.interval = 13; 7635 7636jQuery.fx.start = function() { 7637 if ( !timerId ) { 7638 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); 7639 } 7640}; 7641 7642jQuery.fx.stop = function() { 7643 clearInterval( timerId ); 7644 timerId = null; 7645}; 7646 7647jQuery.fx.speeds = { 7648 slow: 600, 7649 fast: 200, 7650 // Default speed 7651 _default: 400 7652}; 7653 7654 7655// Based off of the plugin by Clint Helfers, with permission. 7656// http://blindsignals.com/index.php/2009/07/jquery-delay/
7657jQuery.fn.delay = function( time, type ) { 7658 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7659 type = type || "fx"; 7660 7661 return this.queue( type, function( next, hooks ) { 7662 var timeout = setTimeout( next, time ); 7663 hooks.stop = function() { 7664 clearTimeout( timeout ); 7665 }; 7666 }); 7667}; 7668 7669 7670(function() { 7671 // Minified: var a,b,c,d,e 7672 var input, div, select, a, opt; 7673 7674 // Setup 7675 div = document.createElement( "div" ); 7676 div.setAttribute( "className", "t" ); 7677 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 7678 a = div.getElementsByTagName("a")[ 0 ]; 7679 7680 // First batch of tests. 7681 select = document.createElement("select"); 7682 opt = select.appendChild( document.createElement("option") ); 7683 input = div.getElementsByTagName("input")[ 0 ]; 7684 7685 a.style.cssText = "top:1px"; 7686 7687 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 7688 support.getSetAttribute = div.className !== "t"; 7689 7690 // Get the style information from getAttribute 7691 // (IE uses .cssText instead)
7692 support.style = /top/.test( a.getAttribute("style") ); 7693 7694 // Make sure that URLs aren't manipulated 7695 // (IE normalizes it by default) 7696 support.hrefNormalized = a.getAttribute("href") === "/a"; 7697 7698 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) 7699 support.checkOn = !!input.value; 7700 7701 // Make sure that a selected-by-default option has a working selected property. 7702 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 7703 support.optSelected = opt.selected; 7704 7705 // Tests for enctype support on a form (#6743) 7706 support.enctype = !!document.createElement("form").enctype; 7707 7708 // Make sure that the options inside disabled selects aren't marked as disabled 7709 // (WebKit marks them as disabled) 7710 select.disabled = true; 7711 support.optDisabled = !opt.disabled; 7712 7713 // Support: IE8 only 7714 // Check if we can trust getAttribute("value") 7715 input = document.createElement( "input" ); 7716 input.setAttribute( "value", "" ); 7717 support.input = input.getAttribute( "value" ) === ""; 7718 7719 // Check if an input maintains its value after becoming a radio 7720 input.value = "t"; 7721 input.setAttribute( "type", "radio" ); 7722 support.radioValue = input.value === "t"; 7723})(); 7724 7725 7726var rreturn = /\r/g; 7727 7728jQuery.fn.extend({ 7729 val: function( value ) { 7730 var hooks, ret, isFunction, 7731 elem = this[0]; 7732 7733 if ( !arguments.length ) { 7734 if ( elem ) { 7735 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 7736 7737 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { 7738 return ret; 7739 } 7740 7741 ret = elem.value; 7742 7743 return typeof ret === "string" ? 7744 // handle most common string cases 7745 ret.replace(rreturn, "") : 7746 // handle cases where value is null/undef or number 7747 ret == null ? "" : ret; 7748 } 7749 7750 return; 7751 } 7752 7753 isFunction = jQuery.isFunction( value ); 7754 7755 return this.each(function( i ) { 7756 var val; 7757 7758 if ( this.nodeType !== 1 ) { 7759 return; 7760 } 7761 7762 if ( isFunction ) { 7763 val = value.call( this, i, jQuery( this ).val() ); 7764 } else { 7765 val = value; 7766 } 7767 7768 // Treat null/undefined as ""; convert numbers to string 7769 if ( val == null ) { 7770 val = ""; 7771 } else if ( typeof val === "number" ) { 7772 val += ""; 7773 } else if ( jQuery.isArray( val ) ) { 7774 val = jQuery.map( val, function( value ) { 7775 return value == null ? "" : value + ""; 7776 }); 7777 } 7778 7779 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 7780 7781 // If set returns undefined, fall back to normal setting 7782 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { 7783 this.value = val; 7784 } 7785 }); 7786 } 7787}); 7788 7789jQuery.extend({ 7790 valHooks: { 7791 option: { 7792 get: function( elem ) { 7793 var val = jQuery.find.attr( elem, "value" ); 7794 return val != null ? 7795 val : 7796 // Support: IE10-11+ 7797 // option.text throws exceptions (#14686, #14858) 7798 jQuery.trim( jQuery.text( elem ) ); 7799 } 7800 }, 7801 select: { 7802 get: function( elem ) { 7803 var value, option, 7804 options = elem.options, 7805 index = elem.selectedIndex, 7806 one = elem.type === "select-one" || index < 0, 7807 values = one ? null : [], 7808 max = one ? index + 1 : options.length, 7809 i = index < 0 ? 7810 max : 7811 one ? index : 0; 7812 7813 // Loop through all the selected options 7814 for ( ; i < max; i++ ) { 7815 option = options[ i ]; 7816 7817 // oldIE doesn't update selected after form reset (#2551) 7818 if ( ( option.selected || i === index ) && 7819 // Don't return options that are disabled or in a disabled optgroup 7820 ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && 7821 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 7822 7823 // Get the specific value for the option 7824 value = jQuery( option ).val(); 7825 7826 // We don't need an array for one selects 7827 if ( one ) { 7828 return value; 7829 } 7830 7831 // Multi-Selects return an array 7832 values.push( value ); 7833 } 7834 } 7835 7836 return values; 7837 }, 7838 7839 set: function( elem, value ) { 7840 var optionSet, option, 7841 options = elem.options, 7842 values = jQuery.makeArray( value ), 7843 i = options.length; 7844 7845 while ( i-- ) { 7846 option = options[ i ]; 7847 7848 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { 7849
7850 // Support: IE6 7851 // When new option element is added to select box we need to 7852 // force reflow of newly added node in order to workaround delay 7853 // of initialization properties 7854 try { 7855 option.selected = optionSet = true; 7856 7857 } catch ( _ ) { 7858 7859 // Will be executed only in IE6 7860 option.scrollHeight; 7861 } 7862 7863 } else { 7864 option.selected = false; 7865 } 7866 } 7867 7868 // Force browsers to behave consistently when non-matching value is set 7869 if ( !optionSet ) { 7870 elem.selectedIndex = -1; 7871 } 7872 7873 return options; 7874 } 7875 } 7876 } 7877}); 7878 7879// Radios and checkboxes getter/setter 7880jQuery.each([ "radio", "checkbox" ], function() { 7881 jQuery.valHooks[ this ] = { 7882 set: function( elem, value ) { 7883 if ( jQuery.isArray( value ) ) { 7884 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); 7885 } 7886 } 7887 }; 7888 if ( !support.checkOn ) { 7889 jQuery.valHooks[ this ].get = function( elem ) { 7890 // Support: Webkit 7891 // "" is returned instead of "on" if a value isn't specified 7892 return elem.getAttribute("value") === null ? "on" : elem.value; 7893 }; 7894 } 7895}); 7896 7897 7898 7899 7900var nodeHook, boolHook, 7901 attrHandle = jQuery.expr.attrHandle, 7902 ruseDefault = /^(?:checked|selected)$/i, 7903 getSetAttribute = support.getSetAttribute, 7904 getSetInput = support.input; 7905 7906jQuery.fn.extend({ 7907 attr: function( name, value ) { 7908 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7909 }, 7910 7911 removeAttr: function( name ) { 7912 return this.each(function() { 7913 jQuery.removeAttr( this, name ); 7914 }); 7915 } 7916}); 7917 7918jQuery.extend({ 7919 attr: function( elem, name, value ) { 7920 var hooks, ret, 7921 nType = elem.nodeType; 7922 7923 // don't get/set attributes on text, comment and attribute nodes 7924 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 7925 return; 7926 } 7927 7928 // Fallback to prop when attributes are not supported 7929 if ( typeof elem.getAttribute === strundefined ) { 7930 return jQuery.prop( elem, name, value ); 7931 } 7932 7933 // All attributes are lowercase 7934 // Grab necessary hook if one is defined 7935 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7936 name = name.toLowerCase(); 7937 hooks = jQuery.attrHooks[ name ] || 7938 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); 7939 } 7940 7941 if ( value !== undefined ) { 7942 7943 if ( value === null ) { 7944 jQuery.removeAttr( elem, name ); 7945 7946 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { 7947 return ret; 7948 7949 } else { 7950 elem.setAttribute( name, value + "" ); 7951 return value; 7952 } 7953 7954 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { 7955 return ret; 7956 7957 } else { 7958 ret = jQuery.find.attr( elem, name ); 7959 7960 // Non-existent attributes return null, we normalize to undefined 7961 return ret == null ? 7962 undefined : 7963 ret; 7964 } 7965 }, 7966 7967 removeAttr: function( elem, value ) { 7968 var name, propName, 7969 i = 0, 7970 attrNames = value && value.match( rnotwhite ); 7971 7972 if ( attrNames && elem.nodeType === 1 ) { 7973 while ( (name = attrNames[i++]) ) { 7974 propName = jQuery.propFix[ name ] || name; 7975 7976 // Boolean attributes get special treatment (#10870) 7977 if ( jQuery.expr.match.bool.test( name ) ) { 7978 // Set corresponding property to false 7979 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 7980 elem[ propName ] = false; 7981 // Support: IE<9 7982 // Also clear defaultChecked/defaultSelected (if appropriate) 7983 } else { 7984 elem[ jQuery.camelCase( "default-" + name ) ] = 7985 elem[ propName ] = false; 7986 } 7987 7988 // See #9699 for explanation of this approach (setting first, then removal) 7989 } else { 7990 jQuery.attr( elem, name, "" ); 7991 } 7992 7993 elem.removeAttribute( getSetAttribute ? name : propName ); 7994 } 7995 } 7996 }, 7997 7998 attrHooks: { 7999 type: { 8000 set: function( elem, value ) { 8001 if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { 8002 // Setting the type on a radio button after the value resets the value in IE6-9 8003 // Reset value to default in case type is set after value during creation 8004 var val = elem.value; 8005 elem.setAttribute( "type", value ); 8006 if ( val ) { 8007 elem.value = val; 8008 } 8009 return value; 8010 } 8011 } 8012 } 8013 } 8014}); 8015 8016// Hook for boolean attributes 8017boolHook = { 8018 set: function( elem, value, name ) { 8019 if ( value === false ) { 8020 // Remove boolean attributes when set to false 8021 jQuery.removeAttr( elem, name ); 8022 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
8023 // IE<8 needs the *property* name 8024 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); 8025 8026 // Use defaultChecked and defaultSelected for oldIE 8027 } else { 8028 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; 8029 } 8030 8031 return name; 8032 } 8033}; 8034 8035// Retrieve booleans specially 8036jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 8037 8038 var getter = attrHandle[ name ] || jQuery.find.attr; 8039 8040 attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? 8041 function( elem, name, isXML ) { 8042 var ret, handle; 8043 if ( !isXML ) { 8044 // Avoid an infinite loop by temporarily removing this function from the getter 8045 handle = attrHandle[ name ]; 8046 attrHandle[ name ] = ret; 8047 ret = getter( elem, name, isXML ) != null ? 8048 name.toLowerCase() : 8049 null; 8050 attrHandle[ name ] = handle; 8051 } 8052 return ret; 8053 } : 8054 function( elem, name, isXML ) { 8055 if ( !isXML ) { 8056 return elem[ jQuery.camelCase( "default-" + name ) ] ? 8057 name.toLowerCase() : 8058 null; 8059 } 8060 }; 8061}); 8062 8063// fix oldIE attroperties 8064if ( !getSetInput || !getSetAttribute ) { 8065 jQuery.attrHooks.value = { 8066 set: function( elem, value, name ) { 8067 if ( jQuery.nodeName( elem, "input" ) ) { 8068 // Does not return so that setAttribute is also used 8069 elem.defaultValue = value; 8070 } else { 8071 // Use nodeHook if defined (#1954); otherwise setAttribute is fine 8072 return nodeHook && nodeHook.set( elem, value, name ); 8073 } 8074 } 8075 }; 8076} 8077 8078// IE6/7 do not support getting/setting some attributes with get/setAttribute 8079if ( !getSetAttribute ) { 8080 8081 // Use this for any attribute in IE6/7 8082 // This fixes almost every IE6/7 issue 8083 nodeHook = { 8084 set: function( elem, value, name ) { 8085 // Set the existing or create a new attribute node 8086 var ret = elem.getAttributeNode( name ); 8087 if ( !ret ) { 8088 elem.setAttributeNode( 8089 (ret = elem.ownerDocument.createAttribute( name )) 8090 ); 8091 } 8092 8093 ret.value = value += ""; 8094 8095 // Break association with cloned elements by also using setAttribute (#9646) 8096 if ( name === "value" || value === elem.getAttribute( name ) ) { 8097 return value; 8098 } 8099 } 8100 }; 8101 8102 // Some attributes are constructed with empty-string values when not defined 8103 attrHandle.id = attrHandle.name = attrHandle.coords = 8104 function( elem, name, isXML ) { 8105 var ret; 8106 if ( !isXML ) { 8107 return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? 8108 ret.value : 8109 null; 8110 } 8111 }; 8112 8113 // Fixing value retrieval on a button requires this module 8114 jQuery.valHooks.button = { 8115 get: function( elem, name ) { 8116 var ret = elem.getAttributeNode( name ); 8117 if ( ret && ret.specified ) { 8118 return ret.value; 8119 } 8120 }, 8121 set: nodeHook.set 8122 }; 8123 8124 // Set contenteditable to false on removals(#10429) 8125 // Setting to empty string throws an error as an invalid value 8126 jQuery.attrHooks.contenteditable = { 8127 set: function( elem, value, name ) { 8128 nodeHook.set( elem, value === "" ? false : value, name ); 8129 } 8130 }; 8131 8132 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 8133 // This is for removals 8134 jQuery.each([ "width", "height" ], function( i, name ) { 8135 jQuery.attrHooks[ name ] = { 8136 set: function( elem, value ) { 8137 if ( value === "" ) { 8138 elem.setAttribute( name, "auto" ); 8139 return value; 8140 } 8141 } 8142 }; 8143 }); 8144} 8145 8146if ( !support.style ) { 8147 jQuery.attrHooks.style = { 8148 get: function( elem ) { 8149 // Return undefined in the case of empty string 8150 // Note: IE uppercases css property names, but if we were to .toLowerCase() 8151 // .cssText, that would destroy case senstitivity in URL's, like in "background" 8152 return elem.style.cssText || undefined; 8153 }, 8154 set: function( elem, value ) { 8155 return ( elem.style.cssText = value + "" ); 8156 } 8157 }; 8158} 8159 8160 8161 8162 8163var rfocusable = /^(?:input|select|textarea|button|object)$/i, 8164 rclickable = /^(?:a|area)$/i; 8165 8166jQuery.fn.extend({ 8167 prop: function( name, value ) { 8168 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8169 }, 8170 8171 removeProp: function( name ) { 8172 name = jQuery.propFix[ name ] || name; 8173 return this.each(function() { 8174 // try/catch handles cases where IE balks (such as removing a property on window) 8175 try { 8176 this[ name ] = undefined; 8177 delete this[ name ]; 8178 } catch( e ) {} 8179 }); 8180 } 8181}); 8182 8183jQuery.extend({ 8184 propFix: { 8185 "for": "htmlFor", 8186 "class": "className" 8187 }, 8188 8189 prop: function( elem, name, value ) { 8190 var ret, hooks, notxml, 8191 nType = elem.nodeType; 8192 8193 // don't get/set properties on text, comment and attribute nodes 8194 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 8195 return; 8196 } 8197 8198 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 8199 8200 if ( notxml ) { 8201 // Fix name and attach hooks 8202 name = jQuery.propFix[ name ] || name; 8203 hooks = jQuery.propHooks[ name ]; 8204 } 8205 8206 if ( value !== undefined ) { 8207 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? 8208 ret : 8209 ( elem[ name ] = value ); 8210 8211 } else { 8212 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? 8213 ret : 8214 elem[ name ]; 8215 } 8216 }, 8217 8218 propHooks: { 8219 tabIndex: { 8220 get: function( elem ) { 8221 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 8222 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8223 // Use proper attribute retrieval(#12072) 8224 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8225 8226 return tabindex ? 8227 parseInt( tabindex, 10 ) : 8228 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 8229 0 : 8230 -1; 8231 } 8232 } 8233 } 8234}); 8235 8236// Some attributes require a special call on IE
8237// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 8238if ( !support.hrefNormalized ) { 8239 // href/src property should get the full normalized URL (#10299/#12915) 8240 jQuery.each([ "href", "src" ], function( i, name ) { 8241 jQuery.propHooks[ name ] = { 8242 get: function( elem ) { 8243 return elem.getAttribute( name, 4 ); 8244 } 8245 }; 8246 }); 8247} 8248 8249// Support: Safari, IE9+ 8250// mis-reports the default selected property of an option 8251// Accessing the parent's selectedIndex property fixes it 8252if ( !support.optSelected ) { 8253 jQuery.propHooks.selected = { 8254 get: function( elem ) { 8255 var parent = elem.parentNode; 8256 8257 if ( parent ) { 8258 parent.selectedIndex; 8259 8260 // Make sure that it also works with optgroups, see #5701 8261 if ( parent.parentNode ) { 8262 parent.parentNode.selectedIndex; 8263 } 8264 } 8265 return null; 8266 } 8267 }; 8268} 8269 8270jQuery.each([ 8271 "tabIndex", 8272 "readOnly", 8273 "maxLength", 8274 "cellSpacing", 8275 "cellPadding", 8276 "rowSpan", 8277 "colSpan", 8278 "useMap", 8279 "frameBorder", 8280 "contentEditable" 8281], function() { 8282 jQuery.propFix[ this.toLowerCase() ] = this; 8283}); 8284 8285// IE6/7 call enctype encoding 8286if ( !support.enctype ) { 8287 jQuery.propFix.enctype = "encoding"; 8288} 8289 8290 8291 8292 8293var rclass = /[\t\r\n\f]/g; 8294 8295jQuery.fn.extend({ 8296 addClass: function( value ) { 8297 var classes, elem, cur, clazz, j, finalValue, 8298 i = 0, 8299 len = this.length, 8300 proceed = typeof value === "string" && value; 8301 8302 if ( jQuery.isFunction( value ) ) { 8303 return this.each(function( j ) { 8304 jQuery( this ).addClass( value.call( this, j, this.className ) ); 8305 }); 8306 } 8307 8308 if ( proceed ) { 8309 // The disjunction here is for better compressibility (see removeClass) 8310 classes = ( value || "" ).match( rnotwhite ) || []; 8311 8312 for ( ; i < len; i++ ) { 8313 elem = this[ i ]; 8314 cur = elem.nodeType === 1 && ( elem.className ? 8315 ( " " + elem.className + " " ).replace( rclass, " " ) : 8316 " " 8317 ); 8318 8319 if ( cur ) { 8320 j = 0; 8321 while ( (clazz = classes[j++]) ) { 8322 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8323 cur += clazz + " "; 8324 } 8325 } 8326 8327 // only assign if different to avoid unneeded rendering. 8328 finalValue = jQuery.trim( cur ); 8329 if ( elem.className !== finalValue ) { 8330 elem.className = finalValue; 8331 } 8332 } 8333 } 8334 } 8335 8336 return this; 8337 }, 8338 8339 removeClass: function( value ) { 8340 var classes, elem, cur, clazz, j, finalValue, 8341 i = 0, 8342 len = this.length, 8343 proceed = arguments.length === 0 || typeof value === "string" && value; 8344 8345 if ( jQuery.isFunction( value ) ) { 8346 return this.each(function( j ) { 8347 jQuery( this ).removeClass( value.call( this, j, this.className ) ); 8348 }); 8349 } 8350 if ( proceed ) { 8351 classes = ( value || "" ).match( rnotwhite ) || []; 8352 8353 for ( ; i < len; i++ ) { 8354 elem = this[ i ]; 8355 // This expression is here for better compressibility (see addClass) 8356 cur = elem.nodeType === 1 && ( elem.className ? 8357 ( " " + elem.className + " " ).replace( rclass, " " ) : 8358 "" 8359 ); 8360 8361 if ( cur ) { 8362 j = 0; 8363 while ( (clazz = classes[j++]) ) { 8364 // Remove *all* instances 8365 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { 8366 cur = cur.replace( " " + clazz + " ", " " ); 8367 } 8368 } 8369 8370 // only assign if different to avoid unneeded rendering. 8371 finalValue = value ? jQuery.trim( cur ) : ""; 8372 if ( elem.className !== finalValue ) { 8373 elem.className = finalValue; 8374 } 8375 } 8376 } 8377 } 8378 8379 return this; 8380 }, 8381 8382 toggleClass: function( value, stateVal ) { 8383 var type = typeof value; 8384 8385 if ( typeof stateVal === "boolean" && type === "string" ) { 8386 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8387 } 8388 8389 if ( jQuery.isFunction( value ) ) { 8390 return this.each(function( i ) { 8391 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); 8392 }); 8393 } 8394 8395 return this.each(function() { 8396 if ( type === "string" ) { 8397 // toggle individual class names 8398 var className, 8399 i = 0, 8400 self = jQuery( this ), 8401 classNames = value.match( rnotwhite ) || []; 8402 8403 while ( (className = classNames[ i++ ]) ) { 8404 // check each className given, space separated list 8405 if ( self.hasClass( className ) ) { 8406 self.removeClass( className ); 8407 } else { 8408 self.addClass( className ); 8409 } 8410 } 8411 8412 // Toggle whole class name 8413 } else if ( type === strundefined || type === "boolean" ) { 8414 if ( this.className ) { 8415 // store className if set 8416 jQuery._data( this, "__className__", this.className ); 8417 } 8418 8419 // If the element has a class name or if we're passed "false", 8420 // then remove the whole classname (if there was one, the above saved it). 8421 // Otherwise bring back whatever was previously saved (if anything), 8422 // falling back to the empty string if nothing was stored. 8423 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; 8424 } 8425 }); 8426 }, 8427 8428 hasClass: function( selector ) { 8429 var className = " " + selector + " ", 8430 i = 0, 8431 l = this.length; 8432 for ( ; i < l; i++ ) { 8433 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { 8434 return true; 8435 } 8436 } 8437 8438 return false;
8439 } 8440}); 8441 8442 8443 8444 8445// Return jQuery for attributes-only inclusion 8446 8447 8448jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 8449 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8450 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 8451 8452 // Handle event binding 8453 jQuery.fn[ name ] = function( data, fn ) { 8454 return arguments.length > 0 ? 8455 this.on( name, null, data, fn ) : 8456 this.trigger( name ); 8457 }; 8458}); 8459 8460jQuery.fn.extend({ 8461 hover: function( fnOver, fnOut ) { 8462 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 8463 }, 8464 8465 bind: function( types, data, fn ) { 8466 return this.on( types, null, data, fn ); 8467 }, 8468 unbind: function( types, fn ) { 8469 return this.off( types, null, fn ); 8470 }, 8471 8472 delegate: function( selector, types, data, fn ) { 8473 return this.on( types, selector, data, fn ); 8474 }, 8475 undelegate: function( selector, types, fn ) { 8476 // ( namespace ) or ( selector, types [, fn] ) 8477 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); 8478 } 8479}); 8480 8481 8482var nonce = jQuery.now(); 8483 8484var rquery = (/\?/); 8485 8486 8487 8488var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; 8489 8490jQuery.parseJSON = function( data ) { 8491 // Attempt to parse using the native JSON parser first 8492 if ( window.JSON && window.JSON.parse ) { 8493 // Support: Android 2.3 8494 // Workaround failure to string-cast null input 8495 return window.JSON.parse( data + "" ); 8496 } 8497 8498 var requireNonComma, 8499 depth = null, 8500 str = jQuery.trim( data + "" ); 8501 8502 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains 8503 // after removing valid tokens 8504 return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { 8505 8506 // Force termination if we see a misplaced comma 8507 if ( requireNonComma && comma ) { 8508 depth = 0; 8509 } 8510 8511 // Perform no more replacements after returning to outermost depth 8512 if ( depth === 0 ) { 8513 return token; 8514 } 8515 8516 // Commas must not follow "[", "{", or "," 8517 requireNonComma = open || comma; 8518 8519 // Determine new depth 8520 // array/object open ("[" or "{"): depth += true - false (increment) 8521 // array/object close ("]" or "}"): depth += false - true (decrement) 8522 // other cases ("," or primitive): depth += true - true (numeric cast) 8523 depth += !close - !open; 8524 8525 // Remove this token 8526 return ""; 8527 }) ) ? 8528 ( Function( "return " + str ) )() : 8529 jQuery.error( "Invalid JSON: " + data ); 8530}; 8531 8532 8533// Cross-browser xml parsing 8534jQuery.parseXML = function( data ) { 8535 var xml, tmp; 8536 if ( !data || typeof data !== "string" ) { 8537 return null; 8538 } 8539 try { 8540 if ( window.DOMParser ) { // Standard 8541 tmp = new DOMParser(); 8542 xml = tmp.parseFromString( data, "text/xml" ); 8543 } else { // IE 8544 xml = new ActiveXObject( "Microsoft.XMLDOM" ); 8545 xml.async = "false"; 8546 xml.loadXML( data ); 8547 } 8548 } catch( e ) { 8549 xml = undefined; 8550 } 8551 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 8552 jQuery.error( "Invalid XML: " + data ); 8553 } 8554 return xml; 8555}; 8556 8557 8558var 8559 // Document location 8560 ajaxLocParts, 8561 ajaxLocation, 8562 8563 rhash = /#.*$/, 8564 rts = /([?&])_=[^&]*/, 8565 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 8566 // #7653, #8125, #8152: local protocol detection 8567 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8568 rnoContent = /^(?:GET|HEAD)$/, 8569 rprotocol = /^\/\//, 8570 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 8571 8572 /* Prefilters 8573 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8574 * 2) These are called: 8575 * - BEFORE asking for a transport 8576 * - AFTER param serialization (s.data is a string if s.processData is true) 8577 * 3) key is the dataType 8578 * 4) the catchall symbol "*" can be used 8579 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8580 */ 8581 prefilters = {}, 8582 8583 /* Transports bindings 8584 * 1) key is the dataType 8585 * 2) the catchall symbol "*" can be used 8586 * 3) selection will start with transport dataType and THEN go to "*" if needed 8587 */ 8588 transports = {}, 8589 8590 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8591 allTypes = "*/".concat("*"); 8592 8593// #8138, IE may throw an exception when accessing 8594// a field from window.location if document.domain has been set 8595try { 8596 ajaxLocation = location.href; 8597} catch( e ) { 8598 // Use the href attribute of an A element 8599 // since IE will modify it given document.location 8600 ajaxLocation = document.createElement( "a" ); 8601 ajaxLocation.href = ""; 8602 ajaxLocation = ajaxLocation.href; 8603} 8604 8605// Segment location into parts 8606ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 8607 8608// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8609function addToPrefiltersOrTransports( structure ) { 8610 8611 // dataTypeExpression is optional and defaults to "*" 8612 return function( dataTypeExpression, func ) { 8613 8614 if ( typeof dataTypeExpression !== "string" ) { 8615 func = dataTypeExpression; 8616 dataTypeExpression = "*"; 8617 } 8618 8619 var dataType, 8620 i = 0, 8621 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 8622 8623 if ( jQuery.isFunction( func ) ) { 8624 // For each dataType in the dataTypeExpression
vendor: 4,101 bytes, lines 8625-8774
8625 while ( (dataType = dataTypes[i++]) ) { 8626 // Prepend if requested 8627 if ( dataType.charAt( 0 ) === "+" ) { 8628 dataType = dataType.slice( 1 ) || "*"; 8629 (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); 8630 8631 // Otherwise append 8632 } else { 8633 (structure[ dataType ] = structure[ dataType ] || []).push( func ); 8634 } 8635 } 8636 } 8637 }; 8638} 8639 8640// Base inspection function for prefilters and transports 8641function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8642 8643 var inspected = {}, 8644 seekingTransport = ( structure === transports ); 8645 8646 function inspect( dataType ) { 8647 var selected; 8648 inspected[ dataType ] = true; 8649 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8650 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8651 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8652 options.dataTypes.unshift( dataTypeOrTransport ); 8653 inspect( dataTypeOrTransport ); 8654 return false; 8655 } else if ( seekingTransport ) { 8656 return !( selected = dataTypeOrTransport ); 8657 } 8658 }); 8659 return selected; 8660 } 8661 8662 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8663} 8664 8665// A special extend for ajax options 8666// that takes "flat" options (not to be deep extended) 8667// Fixes #9887 8668function ajaxExtend( target, src ) { 8669 var deep, key, 8670 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8671 8672 for ( key in src ) { 8673 if ( src[ key ] !== undefined ) { 8674 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; 8675 } 8676 } 8677 if ( deep ) { 8678 jQuery.extend( true, target, deep ); 8679 } 8680 8681 return target; 8682} 8683 8684/* Handles responses to an ajax request: 8685 * - finds the right dataType (mediates between content-type and expected dataType) 8686 * - returns the corresponding response 8687 */ 8688function ajaxHandleResponses( s, jqXHR, responses ) { 8689 var firstDataType, ct, finalDataType, type, 8690 contents = s.contents, 8691 dataTypes = s.dataTypes; 8692 8693 // Remove auto dataType and get content-type in the process 8694 while ( dataTypes[ 0 ] === "*" ) { 8695 dataTypes.shift(); 8696 if ( ct === undefined ) { 8697 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 8698 } 8699 } 8700 8701 // Check if we're dealing with a known content-type 8702 if ( ct ) { 8703 for ( type in contents ) { 8704 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8705 dataTypes.unshift( type ); 8706 break; 8707 } 8708 } 8709 } 8710 8711 // Check to see if we have a response for the expected dataType 8712 if ( dataTypes[ 0 ] in responses ) { 8713 finalDataType = dataTypes[ 0 ]; 8714 } else { 8715 // Try convertible dataTypes 8716 for ( type in responses ) { 8717 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 8718 finalDataType = type; 8719 break; 8720 } 8721 if ( !firstDataType ) { 8722 firstDataType = type; 8723 } 8724 } 8725 // Or just use first one 8726 finalDataType = finalDataType || firstDataType; 8727 } 8728 8729 // If we found a dataType 8730 // We add the dataType to the list if needed 8731 // and return the corresponding response 8732 if ( finalDataType ) { 8733 if ( finalDataType !== dataTypes[ 0 ] ) { 8734 dataTypes.unshift( finalDataType ); 8735 } 8736 return responses[ finalDataType ]; 8737 } 8738} 8739 8740/* Chain conversions given the request and the original response 8741 * Also sets the responseXXX fields on the jqXHR instance 8742 */ 8743function ajaxConvert( s, response, jqXHR, isSuccess ) { 8744 var conv2, current, conv, tmp, prev, 8745 converters = {}, 8746 // Work with a copy of dataTypes in case we need to modify it for conversion 8747 dataTypes = s.dataTypes.slice(); 8748 8749 // Create converters map with lowercased keys 8750 if ( dataTypes[ 1 ] ) { 8751 for ( conv in s.converters ) { 8752 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 8753 } 8754 } 8755 8756 current = dataTypes.shift(); 8757 8758 // Convert to each sequential dataType 8759 while ( current ) { 8760 8761 if ( s.responseFields[ current ] ) { 8762 jqXHR[ s.responseFields[ current ] ] = response; 8763 } 8764 8765 // Apply the dataFilter if provided 8766 if ( !prev && isSuccess && s.dataFilter ) { 8767 response = s.dataFilter( response, s.dataType ); 8768 } 8769 8770 prev = current; 8771 current = dataTypes.shift(); 8772 8773 if ( current ) { 8774
8775 // There's only work to do if current dataType is non-auto 8776 if ( current === "*" ) { 8777 8778 current = prev; 8779 8780 // Convert response if prev dataType is non-auto and differs from current 8781 } else if ( prev !== "*" && prev !== current ) { 8782 8783 // Seek a direct converter 8784 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 8785 8786 // If none found, seek a pair 8787 if ( !conv ) { 8788 for ( conv2 in converters ) { 8789 8790 // If conv2 outputs current 8791 tmp = conv2.split( " " ); 8792 if ( tmp[ 1 ] === current ) { 8793 8794 // If prev can be converted to accepted input 8795 conv = converters[ prev + " " + tmp[ 0 ] ] || 8796 converters[ "* " + tmp[ 0 ] ]; 8797 if ( conv ) { 8798 // Condense equivalence converters 8799 if ( conv === true ) { 8800 conv = converters[ conv2 ]; 8801 8802 // Otherwise, insert the intermediate dataType 8803 } else if ( converters[ conv2 ] !== true ) { 8804 current = tmp[ 0 ]; 8805 dataTypes.unshift( tmp[ 1 ] ); 8806 } 8807 break; 8808 } 8809 } 8810 } 8811 } 8812 8813 // Apply converter (if not an equivalence) 8814 if ( conv !== true ) { 8815 8816 // Unless errors are allowed to bubble, catch and return them 8817 if ( conv && s[ "throws" ] ) { 8818 response = conv( response ); 8819 } else { 8820 try { 8821 response = conv( response ); 8822 } catch ( e ) { 8823 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; 8824 } 8825 } 8826 } 8827 } 8828 } 8829 } 8830 8831 return { state: "success", data: response }; 8832} 8833 8834jQuery.extend({ 8835 8836 // Counter for holding the number of active queries 8837 active: 0, 8838 8839 // Last-Modified header cache for next request 8840 lastModified: {}, 8841 etag: {}, 8842 8843 ajaxSettings: { 8844 url: ajaxLocation, 8845 type: "GET", 8846 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 8847 global: true, 8848 processData: true, 8849 async: true, 8850 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 8851 /* 8852 timeout: 0, 8853 data: null, 8854 dataType: null, 8855 username: null, 8856 password: null, 8857 cache: null, 8858 throws: false, 8859 traditional: false, 8860 headers: {}, 8861 */ 8862 8863 accepts: { 8864 "*": allTypes, 8865 text: "text/plain", 8866 html: "text/html", 8867 xml: "application/xml, text/xml", 8868 json: "application/json, text/javascript" 8869 }, 8870 8871 contents: { 8872 xml: /xml/, 8873 html: /html/, 8874 json: /json/ 8875 }, 8876 8877 responseFields: { 8878 xml: "responseXML", 8879 text: "responseText", 8880 json: "responseJSON" 8881 }, 8882 8883 // Data converters 8884 // Keys separate source (or catchall "*") and destination types with a single space 8885 converters: { 8886 8887 // Convert anything to text 8888 "* text": String, 8889 8890 // Text to html (true = no transformation) 8891 "text html": true, 8892 8893 // Evaluate text as a json expression 8894 "text json": jQuery.parseJSON, 8895 8896 // Parse text as xml 8897 "text xml": jQuery.parseXML 8898 }, 8899 8900 // For options that shouldn't be deep extended: 8901 // you can add your own custom options here if 8902 // and when you create one that shouldn't be 8903 // deep extended (see ajaxExtend) 8904 flatOptions: { 8905 url: true, 8906 context: true 8907 } 8908 }, 8909 8910 // Creates a full fledged settings object into target 8911 // with both ajaxSettings and settings fields. 8912 // If target is omitted, writes into ajaxSettings. 8913 ajaxSetup: function( target, settings ) { 8914 return settings ? 8915 8916 // Building a settings object 8917 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 8918 8919 // Extending ajaxSettings 8920 ajaxExtend( jQuery.ajaxSettings, target ); 8921 }, 8922 8923 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 8924 ajaxTransport: addToPrefiltersOrTransports( transports ), 8925 8926 // Main method 8927 ajax: function( url, options ) { 8928 8929 // If url is an object, simulate pre-1.5 signature 8930 if ( typeof url === "object" ) { 8931 options = url; 8932 url = undefined; 8933 } 8934 8935 // Force options to be an object 8936 options = options || {}; 8937 8938 var // Cross-domain detection vars 8939 parts, 8940 // Loop variable 8941 i, 8942 // URL without anti-cache param 8943 cacheURL, 8944 // Response headers as string 8945 responseHeadersString, 8946 // timeout handle 8947 timeoutTimer, 8948 8949 // To know if global events are to be dispatched 8950 fireGlobals, 8951 8952 transport, 8953 // Response headers 8954 responseHeaders, 8955 // Create the final options object 8956 s = jQuery.ajaxSetup( {}, options ), 8957 // Callbacks context 8958 callbackContext = s.context || s, 8959 // Context for global events is callbackContext if it is a DOM node or jQuery collection 8960 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? 8961 jQuery( callbackContext ) : 8962 jQuery.event, 8963 // Deferreds 8964 deferred = jQuery.Deferred(), 8965 completeDeferred = jQuery.Callbacks("once memory"), 8966 // Status-dependent callbacks 8967 statusCode = s.statusCode || {}, 8968 // Headers (they are sent all at once) 8969 requestHeaders = {}, 8970 requestHeadersNames = {}, 8971 // The jqXHR state 8972 state = 0, 8973 // Default abort message 8974 strAbort = "canceled", 8975 // Fake xhr 8976 jqXHR = { 8977 readyState: 0, 8978 8979 // Builds headers hashtable if needed 8980 getResponseHeader: function( key ) { 8981 var match; 8982 if ( state === 2 ) { 8983 if ( !responseHeaders ) { 8984 responseHeaders = {}; 8985 while ( (match = rheaders.exec( responseHeadersString )) ) { 8986 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 8987 } 8988 } 8989 match = responseHeaders[ key.toLowerCase() ]; 8990 } 8991 return match == null ? null : match; 8992 }, 8993 8994 // Raw string 8995 getAllResponseHeaders: function() { 8996 return state === 2 ? responseHeadersString : null; 8997 }, 8998 8999 // Caches the header 9000 setRequestHeader: function( name, value ) { 9001 var lname = name.toLowerCase(); 9002 if ( !state ) { 9003 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 9004 requestHeaders[ name ] = value; 9005 } 9006 return this; 9007 }, 9008 9009 // Overrides response content-type header 9010 overrideMimeType: function( type ) { 9011 if ( !state ) { 9012 s.mimeType = type; 9013 } 9014 return this; 9015 }, 9016 9017 // Status-dependent callbacks 9018 statusCode: function( map ) { 9019 var code; 9020 if ( map ) { 9021 if ( state < 2 ) { 9022 for ( code in map ) { 9023 // Lazy-add the new callback in a way that preserves old ones 9024 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9025 } 9026 } else { 9027 // Execute the appropriate callbacks 9028 jqXHR.always( map[ jqXHR.status ] ); 9029 } 9030 } 9031 return this; 9032 }, 9033 9034 // Cancel the request 9035 abort: function( statusText ) { 9036 var finalText = statusText || strAbort; 9037 if ( transport ) { 9038 transport.abort( finalText ); 9039 } 9040 done( 0, finalText ); 9041 return this; 9042 } 9043 }; 9044 9045 // Attach deferreds 9046 deferred.promise( jqXHR ).complete = completeDeferred.add; 9047 jqXHR.success = jqXHR.done; 9048 jqXHR.error = jqXHR.fail; 9049 9050 // Remove hash character (#7531: and string promotion) 9051 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9052 // Handle falsy url in the settings object (#10093: consistency with old signature) 9053 // We also use the url parameter if available 9054 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 9055 9056 // Alias method option to type as per ticket #12004 9057 s.type = options.method || options.type || s.method || s.type; 9058 9059 // Extract dataTypes list 9060 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 9061 9062 // A cross-domain request is in order when we have a protocol:host:port mismatch 9063 if ( s.crossDomain == null ) { 9064 parts = rurl.exec( s.url.toLowerCase() ); 9065 s.crossDomain = !!( parts && 9066 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 9067 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== 9068 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) 9069 ); 9070 } 9071 9072 // Convert data if not already a string 9073 if ( s.data && s.processData && typeof s.data !== "string" ) { 9074 s.data = jQuery.param( s.data, s.traditional ); 9075 } 9076 9077 // Apply prefilters 9078 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9079 9080 // If request was aborted inside a prefilter, stop there 9081 if ( state === 2 ) { 9082 return jqXHR; 9083 } 9084 9085 // We can fire global events as of now if asked to 9086 fireGlobals = s.global; 9087 9088 // Watch for a new set of requests 9089 if ( fireGlobals && jQuery.active++ === 0 ) { 9090 jQuery.event.trigger("ajaxStart"); 9091 } 9092 9093 // Uppercase the type 9094 s.type = s.type.toUpperCase(); 9095 9096 // Determine if request has content 9097 s.hasContent = !rnoContent.test( s.type ); 9098 9099 // Save the URL in case we're toying with the If-Modified-Since 9100 // and/or If-None-Match header later on 9101 cacheURL = s.url; 9102 9103 // More options handling for requests with no content 9104 if ( !s.hasContent ) { 9105 9106 // If data is available, append data to url 9107 if ( s.data ) {
9108 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 9109 // #9682: remove data so that it's not used in an eventual retry 9110 delete s.data; 9111 } 9112 9113 // Add anti-cache in url if needed 9114 if ( s.cache === false ) { 9115 s.url = rts.test( cacheURL ) ? 9116 9117 // If there is already a '_' parameter, set its value 9118 cacheURL.replace( rts, "$1_=" + nonce++ ) : 9119 9120 // Otherwise add one to the end 9121 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 9122 } 9123 } 9124 9125 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9126 if ( s.ifModified ) { 9127 if ( jQuery.lastModified[ cacheURL ] ) { 9128 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9129 } 9130 if ( jQuery.etag[ cacheURL ] ) { 9131 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9132 } 9133 } 9134 9135 // Set the correct header, if data is being sent 9136 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9137 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9138 } 9139 9140 // Set the Accepts header for the server, depending on the dataType 9141 jqXHR.setRequestHeader( 9142 "Accept", 9143 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 9144 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9145 s.accepts[ "*" ] 9146 ); 9147 9148 // Check for headers option 9149 for ( i in s.headers ) { 9150 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9151 } 9152 9153 // Allow custom headers/mimetypes and early abort 9154 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 9155 // Abort if not done already and return 9156 return jqXHR.abort(); 9157 } 9158 9159 // aborting is no longer a cancellation 9160 strAbort = "abort"; 9161 9162 // Install callbacks on deferreds 9163 for ( i in { success: 1, error: 1, complete: 1 } ) { 9164 jqXHR[ i ]( s[ i ] ); 9165 } 9166 9167 // Get transport 9168 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9169 9170 // If no transport, we auto-abort 9171 if ( !transport ) { 9172 done( -1, "No Transport" ); 9173 } else { 9174 jqXHR.readyState = 1; 9175 9176 // Send global event 9177 if ( fireGlobals ) { 9178 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9179 } 9180 // Timeout 9181 if ( s.async && s.timeout > 0 ) { 9182 timeoutTimer = setTimeout(function() { 9183 jqXHR.abort("timeout"); 9184 }, s.timeout ); 9185 } 9186 9187 try { 9188 state = 1; 9189 transport.send( requestHeaders, done ); 9190 } catch ( e ) { 9191 // Propagate exception as error if not done 9192 if ( state < 2 ) { 9193 done( -1, e ); 9194 // Simply rethrow otherwise 9195 } else { 9196 throw e; 9197 } 9198 } 9199 } 9200 9201 // Callback for when everything is done 9202 function done( status, nativeStatusText, responses, headers ) { 9203 var isSuccess, success, error, response, modified, 9204 statusText = nativeStatusText; 9205 9206 // Called once 9207 if ( state === 2 ) { 9208 return; 9209 } 9210 9211 // State is "done" now 9212 state = 2; 9213 9214 // Clear timeout if it exists 9215 if ( timeoutTimer ) { 9216 clearTimeout( timeoutTimer ); 9217 } 9218 9219 // Dereference transport for early garbage collection 9220 // (no matter how long the jqXHR object will be used) 9221 transport = undefined; 9222 9223 // Cache response headers 9224 responseHeadersString = headers || ""; 9225 9226 // Set readyState 9227 jqXHR.readyState = status > 0 ? 4 : 0; 9228 9229 // Determine if successful 9230 isSuccess = status >= 200 && status < 300 || status === 304; 9231 9232 // Get response data 9233 if ( responses ) { 9234 response = ajaxHandleResponses( s, jqXHR, responses ); 9235 } 9236 9237 // Convert no matter what (that way responseXXX fields are always set) 9238 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9239 9240 // If successful, handle type chaining 9241 if ( isSuccess ) { 9242 9243 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9244 if ( s.ifModified ) { 9245 modified = jqXHR.getResponseHeader("Last-Modified"); 9246 if ( modified ) { 9247 jQuery.lastModified[ cacheURL ] = modified; 9248 } 9249 modified = jqXHR.getResponseHeader("etag"); 9250 if ( modified ) { 9251 jQuery.etag[ cacheURL ] = modified; 9252 } 9253 } 9254 9255 // if no content 9256 if ( status === 204 || s.type === "HEAD" ) { 9257 statusText = "nocontent"; 9258 9259 // if not modified 9260 } else if ( status === 304 ) { 9261 statusText = "notmodified"; 9262 9263 // If we have data, let's convert it 9264 } else { 9265 statusText = response.state; 9266 success = response.data; 9267 error = response.error; 9268 isSuccess = !error; 9269 } 9270 } else { 9271 // We extract error from statusText 9272 // then normalize statusText and status for non-aborts 9273 error = statusText; 9274 if ( status || !statusText ) { 9275 statusText = "error"; 9276 if ( status < 0 ) { 9277 status = 0; 9278 } 9279 } 9280 } 9281 9282 // Set data for the fake xhr object 9283 jqXHR.status = status; 9284 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9285 9286 // Success/Error 9287 if ( isSuccess ) { 9288 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9289 } else { 9290 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9291 } 9292 9293 // Status-dependent callbacks 9294 jqXHR.statusCode( statusCode ); 9295 statusCode = undefined; 9296 9297 if ( fireGlobals ) { 9298 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9299 [ jqXHR, s, isSuccess ? success : error ] ); 9300 } 9301 9302 // Complete 9303 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9304 9305 if ( fireGlobals ) { 9306 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9307 // Handle the global AJAX counter 9308 if ( !( --jQuery.active ) ) { 9309 jQuery.event.trigger("ajaxStop"); 9310 } 9311 } 9312 } 9313 9314 return jqXHR; 9315 }, 9316 9317 getJSON: function( url, data, callback ) { 9318 return jQuery.get( url, data, callback, "json" ); 9319 }, 9320 9321 getScript: function( url, callback ) { 9322 return jQuery.get( url, undefined, callback, "script" ); 9323 } 9324}); 9325 9326jQuery.each( [ "get", "post" ], function( i, method ) { 9327 jQuery[ method ] = function( url, data, callback, type ) { 9328 // shift arguments if data argument was omitted 9329 if ( jQuery.isFunction( data ) ) { 9330 type = type || callback; 9331 callback = data; 9332 data = undefined; 9333 } 9334 9335 return jQuery.ajax({ 9336 url: url, 9337 type: method, 9338 dataType: type, 9339 data: data, 9340 success: callback 9341 }); 9342 }; 9343}); 9344 9345// Attach a bunch of functions for handling common AJAX events 9346jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { 9347 jQuery.fn[ type ] = function( fn ) { 9348 return this.on( type, fn ); 9349 }; 9350}); 9351 9352 9353jQuery._evalUrl = function( url ) { 9354 return jQuery.ajax({ 9355 url: url, 9356 type: "GET", 9357 dataType: "script", 9358 async: false, 9359 global: false, 9360 "throws": true 9361 }); 9362}; 9363 9364 9365jQuery.fn.extend({ 9366 wrapAll: function( html ) { 9367 if ( jQuery.isFunction( html ) ) { 9368 return this.each(function(i) { 9369 jQuery(this).wrapAll( html.call(this, i) ); 9370 }); 9371 } 9372 9373 if ( this[0] ) { 9374 // The elements to wrap the target around 9375 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); 9376 9377 if ( this[0].parentNode ) { 9378 wrap.insertBefore( this[0] ); 9379 } 9380 9381 wrap.map(function() { 9382 var elem = this; 9383 9384 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 9385 elem = elem.firstChild; 9386 } 9387 9388 return elem; 9389 }).append( this ); 9390 } 9391 9392 return this; 9393 }, 9394 9395 wrapInner: function( html ) { 9396 if ( jQuery.isFunction( html ) ) { 9397 return this.each(function(i) { 9398 jQuery(this).wrapInner( html.call(this, i) ); 9399 }); 9400 } 9401 9402 return this.each(function() { 9403 var self = jQuery( this ), 9404 contents = self.contents(); 9405 9406 if ( contents.length ) { 9407 contents.wrapAll( html ); 9408 9409 } else { 9410 self.append( html ); 9411 } 9412 }); 9413 }, 9414 9415 wrap: function( html ) { 9416 var isFunction = jQuery.isFunction( html ); 9417 9418 return this.each(function(i) { 9419 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); 9420 }); 9421 }, 9422 9423 unwrap: function() { 9424 return this.parent().each(function() { 9425 if ( !jQuery.nodeName( this, "body" ) ) { 9426 jQuery( this ).replaceWith( this.childNodes ); 9427 } 9428 }).end(); 9429 } 9430}); 9431 9432 9433jQuery.expr.filters.hidden = function( elem ) { 9434 // Support: Opera <= 12.12 9435 // Opera reports offsetWidths and offsetHeights less than zero on some elements 9436 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || 9437 (!support.reliableHiddenOffsets() && 9438 ((elem.style && elem.style.display) || jQuery.css( elem, "dis
9438play" )) === "none"); 9439}; 9440 9441jQuery.expr.filters.visible = function( elem ) { 9442 return !jQuery.expr.filters.hidden( elem ); 9443}; 9444 9445 9446 9447 9448var r20 = /%20/g, 9449 rbracket = /\[\]$/, 9450 rCRLF = /\r?\n/g, 9451 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 9452 rsubmittable = /^(?:input|select|textarea|keygen)/i; 9453 9454function buildParams( prefix, obj, traditional, add ) { 9455 var name; 9456 9457 if ( jQuery.isArray( obj ) ) { 9458 // Serialize array item. 9459 jQuery.each( obj, function( i, v ) { 9460 if ( traditional || rbracket.test( prefix ) ) { 9461 // Treat each array item as a scalar. 9462 add( prefix, v ); 9463 9464 } else { 9465 // Item is non-scalar (array or object), encode its numeric index. 9466 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); 9467 } 9468 }); 9469 9470 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 9471 // Serialize object item. 9472 for ( name in obj ) { 9473 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 9474 } 9475 9476 } else { 9477 // Serialize scalar item. 9478 add( prefix, obj ); 9479 } 9480} 9481 9482// Serialize an array of form elements or a set of 9483// key/values into a query string 9484jQuery.param = function( a, traditional ) { 9485 var prefix, 9486 s = [], 9487 add = function( key, value ) { 9488 // If value is a function, invoke it and return its value 9489 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 9490 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 9491 }; 9492 9493 // Set traditional to true for jQuery <= 1.3.2 behavior. 9494 if ( traditional === undefined ) { 9495 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 9496 } 9497 9498 // If an array was passed in, assume that it is an array of form elements. 9499 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 9500 // Serialize the form elements 9501 jQuery.each( a, function() { 9502 add( this.name, this.value ); 9503 }); 9504 9505 } else { 9506 // If traditional, encode the "old" way (the way 1.3.2 or older 9507 // did it), otherwise encode params recursively. 9508 for ( prefix in a ) { 9509 buildParams( prefix, a[ prefix ], traditional, add ); 9510 } 9511 } 9512 9513 // Return the resulting serialization 9514 return s.join( "&" ).replace( r20, "+" ); 9515}; 9516 9517jQuery.fn.extend({ 9518 serialize: function() { 9519 return jQuery.param( this.serializeArray() ); 9520 }, 9521 serializeArray: function() { 9522 return this.map(function() { 9523 // Can add propHook for "elements" to filter or add form elements 9524 var elements = jQuery.prop( this, "elements" ); 9525 return elements ? jQuery.makeArray( elements ) : this; 9526 }) 9527 .filter(function() { 9528 var type = this.type; 9529 // Use .is(":disabled") so that fieldset[disabled] works 9530 return this.name && !jQuery( this ).is( ":disabled" ) && 9531 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 9532 ( this.checked || !rcheckableType.test( type ) ); 9533 }) 9534 .map(function( i, elem ) { 9535 var val = jQuery( this ).val(); 9536 9537 return val == null ? 9538 null : 9539 jQuery.isArray( val ) ? 9540 jQuery.map( val, function( val ) { 9541 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9542 }) : 9543 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9544 }).get(); 9545 } 9546}); 9547 9548 9549// Create the request object 9550// (This is still attached to ajaxSettings for backward compatibility) 9551jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? 9552 // Support: IE6+ 9553 function() { 9554 9555 // XHR cannot access local files, always use ActiveX for that case 9556 return !this.isLocal && 9557 9558 // Support: IE7-8 9559 // oldIE XHR does not support non-RFC2616 methods (#13240) 9560 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx 9561 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 9562 // Although this check for six methods instead of eight 9563 // since IE also does not support "trace" and "connect" 9564 /^(get|post|head|put|delete|options)$/i.test( this.type ) && 9565 9566 createStandardXHR() || createActiveXHR(); 9567 } : 9568 // For all other browsers, use the standard XMLHttpRequest object 9569 createStandardXHR; 9570 9571var xhrId = 0, 9572 xhrCallbacks = {}, 9573 xhrSupported = jQuery.ajaxSettings.xhr(); 9574 9575// Support: IE<10 9576// Open requests must be manually aborted on unload (#5280) 9577if ( window.ActiveXObject ) { 9578 jQuery( window ).on( "unload", function() {
9579 for ( var key in xhrCallbacks ) { 9580 xhrCallbacks[ key ]( undefined, true ); 9581 } 9582 }); 9583} 9584 9585// Determine support properties 9586support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9587xhrSupported = support.ajax = !!xhrSupported; 9588 9589// Create transport if the browser can provide an xhr 9590if ( xhrSupported ) { 9591 9592 jQuery.ajaxTransport(function( options ) { 9593 // Cross domain only allowed if supported through XMLHttpRequest 9594 if ( !options.crossDomain || support.cors ) { 9595 9596 var callback; 9597 9598 return { 9599 send: function( headers, complete ) { 9600 var i, 9601 xhr = options.xhr(), 9602 id = ++xhrId; 9603 9604 // Open the socket 9605 xhr.open( options.type, options.url, options.async, options.username, options.password ); 9606 9607 // Apply custom fields if provided 9608 if ( options.xhrFields ) { 9609 for ( i in options.xhrFields ) { 9610 xhr[ i ] = options.xhrFields[ i ]; 9611 } 9612 } 9613 9614 // Override mime type if needed 9615 if ( options.mimeType && xhr.overrideMimeType ) { 9616 xhr.overrideMimeType( options.mimeType ); 9617 } 9618 9619 // X-Requested-With header 9620 // For cross-domain requests, seeing as conditions for a preflight are 9621 // akin to a jigsaw puzzle, we simply never set it to be sure. 9622 // (it can always be set on a per-request basis or even using ajaxSetup)
9623 // For same-domain requests, won't change header if already provided. 9624 if ( !options.crossDomain && !headers["X-Requested-With"] ) { 9625 headers["X-Requested-With"] = "XMLHttpRequest"; 9626 } 9627 9628 // Set headers 9629 for ( i in headers ) { 9630 // Support: IE<9 9631 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting 9632 // request header to a null-value. 9633 // 9634 // To keep consistent with other XHR implementations, cast the value 9635 // to string and ignore `undefined`. 9636 if ( headers[ i ] !== undefined ) { 9637 xhr.setRequestHeader( i, headers[ i ] + "" ); 9638 } 9639 } 9640 9641 // Do send the request 9642 // This may raise an exception which is actually 9643 // handled in jQuery.ajax (so no try/catch here) 9644 xhr.send( ( options.hasContent && options.data ) || null ); 9645 9646 // Listener 9647 callback = function( _, isAbort ) { 9648 var status, statusText, responses; 9649 9650 // Was never called and is aborted or complete 9651 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 9652 // Clean up 9653 delete xhrCallbacks[ id ]; 9654 callback = undefined; 9655 xhr.onreadystatechange = jQuery.noop; 9656 9657 // Abort manually if needed 9658 if ( isAbort ) { 9659 if ( xhr.readyState !== 4 ) { 9660 xhr.abort(); 9661 } 9662 } else { 9663 responses = {}; 9664 status = xhr.status; 9665 9666 // Support: IE<10 9667 // Accessing binary-data responseText throws an exception 9668 // (#11426) 9669 if ( typeof xhr.responseText === "string" ) { 9670 responses.text = xhr.responseText; 9671 } 9672 9673 // Firefox throws an exception when accessing 9674 // statusText for faulty cross-domain requests 9675 try { 9676 statusText = xhr.statusText; 9677 } catch( e ) { 9678 // We normalize with Webkit giving an empty statusText 9679 statusText = ""; 9680 } 9681 9682 // Filter status for non standard behaviors 9683 9684 // If the request is local and we have data: assume a success 9685 // (success with no data won't get notified, that's the best we 9686 // can do given current implementations) 9687 if ( !status && options.isLocal && !options.crossDomain ) { 9688 status = responses.text ? 200 : 404; 9689 // IE - #1450: sometimes returns 1223 when it should be 204 9690 } else if ( status === 1223 ) { 9691 status = 204; 9692 } 9693 } 9694 } 9695 9696 // Call complete if needed 9697 if ( responses ) { 9698 complete( status, statusText, responses, xhr.getAllResponseHeaders() ); 9699 } 9700 }; 9701 9702 if ( !options.async ) { 9703 // if we're in sync mode we fire the callback 9704 callback(); 9705 } else if ( xhr.readyState === 4 ) { 9706 // (IE6 & IE7) if it's in cache and has been 9707 // retrieved directly we need to fire the callback 9708 setTimeout( callback ); 9709 } else { 9710 // Add to the list of active xhr callbacks 9711 xhr.onreadystatechange = xhrCallbacks[ id ] = callback; 9712 } 9713 }, 9714 9715 abort: function() { 9716 if ( callback ) { 9717 callback( undefined, true ); 9718 } 9719 } 9720 }; 9721 } 9722 }); 9723} 9724 9725// Functions to create xhrs 9726function createStandardXHR() { 9727 try { 9728 return new window.XMLHttpRequest(); 9729 } catch( e ) {} 9730} 9731 9732function createActiveXHR() { 9733 try { 9734 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 9735 } catch( e ) {} 9736} 9737 9738 9739 9740 9741// Install script dataType 9742jQuery.ajaxSetup({ 9743 accepts: { 9744 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 9745 }, 9746 contents: { 9747 script: /(?:java|ecma)script/ 9748 }, 9749 converters: { 9750 "text script": function( text ) { 9751 jQuery.globalEval( text ); 9752 return text; 9753 } 9754 } 9755}); 9756 9757// Handle cache's special case and global 9758jQuery.ajaxPrefilter( "script", function( s ) { 9759 if ( s.cache === undefined ) { 9760 s.cache = false; 9761 } 9762 if ( s.crossDomain ) { 9763 s.type = "GET"; 9764 s.global = false; 9765 } 9766}); 9767 9768// Bind script tag hack transport 9769jQuery.ajaxTransport( "script", function(s) { 9770 9771 // This transport only deals with cross domain requests 9772 if ( s.crossDomain ) { 9773 9774 var script, 9775 head = document.head || jQuery("head")[0] || document.documentElement; 9776 9777 return { 9778 9779 send: function( _, callback ) { 9780 9781 script = document.createElement("script"); 9782 9783 script.async = true; 9784 9785 if ( s.scriptCharset ) { 9786 script.charset = s.scriptCharset; 9787 } 9788 9789 script.src = s.url; 9790 9791 // Attach handlers for all browsers 9792 script.onload = script.onreadystatechange = function( _, isAbort ) { 9793 9794 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 9795 9796 // Handle memory leak in IE 9797 script.onload = script.onreadystatechange = null; 9798 9799 // Remove the script 9800 if ( script.parentNode ) { 9801 script.parentNode.removeChild( script ); 9802 } 9803 9804 // Dereference the script 9805 script = null; 9806 9807 // Callback if not abort 9808 if ( !isAbort ) { 9809 callback( 200, "success" ); 9810 } 9811 } 9812 }; 9813 9814 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending 9815 // Use native DOM manipulation to avoid our domManip AJAX trickery 9816 head.insertBefore( script, head.firstChild ); 9817 }, 9818 9819 abort: function() { 9820 if ( script ) { 9821 script.onload( undefined, true ); 9822 } 9823 } 9824 }; 9825 } 9826}); 9827 9828 9829 9830 9831var oldCallbacks = [], 9832 rjsonp = /(=)\?(?=&|$)|\?\?/; 9833 9834// Default jsonp settings 9835jQuery.ajaxSetup({ 9836 jsonp: "callback", 9837 jsonpCallback: function() { 9838 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 9839 this[ callback ] = true; 9840 return callback; 9841 } 9842}); 9843 9844// Detect, normalize options and install callbacks for jsonp requests 9845jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 9846 9847 var callbackName, overwritten, responseContainer, 9848 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 9849 "url" : 9850 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" 9851 ); 9852 9853 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9854 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 9855 9856 // Get callback name, remembering preexisting value associated with it 9857 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 9858 s.jsonpCallback() : 9859 s.jsonpCallback; 9860 9861 // Insert callback into url or form data 9862 if ( jsonProp ) { 9863 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 9864 } else if ( s.jsonp !== false ) { 9865 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 9866 } 9867 9868 // Use data converter to retrieve json after script execution 9869 s.converters["script json"] = function() { 9870 if ( !responseContainer ) { 9871 jQuery.error( callbackName + " was not called" ); 9872 } 9873 return responseContainer[ 0 ]; 9874 }; 9875 9876 // force json dataType 9877 s.dataTypes[ 0 ] = "json"; 9878 9879 // Install callback 9880 overwritten = window[ callbackName ]; 9881 window[ callbackName ] = function() { 9882 responseContainer = arguments; 9883 }; 9884 9885 // Clean-up function (fires after converters) 9886 jqXHR.always(function() { 9887 // Restore preexisting value 9888 window[ callbackName ] = overwritten; 9889 9890 // Save back as free 9891 if ( s[ callbackName ] ) { 9892 // make sure that re-using the options doesn't screw things around 9893 s.jsonpCallback = originalSettings.jsonpCallback; 9894 9895 // save the callback name for future use 9896 oldCallbacks.push( callbackName ); 9897 } 9898 9899 // Call if it was a function and we have a response 9900 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 9901 overwritten( responseContainer[ 0 ] ); 9902 } 9903 9904 responseContainer = overwritten = undefined; 9905 }); 9906 9907 // Delegate to script 9908 return "script"; 9909 } 9910}); 9911 9912 9913 9914 9915// data: string of html 9916// context (optional): If specified, the fragment will be created in this context, defaults to document 9917// keepScripts (optional): If true, will include scripts passed in the html string 9918jQuery.parseHTML = function( data, context, keepScripts ) { 9919 if ( !data || typeof data !== "string" ) { 9920 return null; 9921 } 9922 if ( typeof context === "boolean" ) { 9923 keepScripts = context; 9924 context = false;
9925 } 9926 context = context || document; 9927 9928 var parsed = rsingleTag.exec( data ), 9929 scripts = !keepScripts && []; 9930 9931 // Single tag 9932 if ( parsed ) { 9933 return [ context.createElement( parsed[1] ) ]; 9934 } 9935 9936 parsed = jQuery.buildFragment( [ data ], context, scripts ); 9937 9938 if ( scripts && scripts.length ) { 9939 jQuery( scripts ).remove(); 9940 } 9941 9942 return jQuery.merge( [], parsed.childNodes ); 9943}; 9944 9945 9946// Keep a copy of the old load method 9947var _load = jQuery.fn.load; 9948 9949/** 9950 * Load a url into a page 9951 */ 9952jQuery.fn.load = function( url, params, callback ) { 9953 if ( typeof url !== "string" && _load ) { 9954 return _load.apply( this, arguments ); 9955 } 9956 9957 var selector, response, type, 9958 self = this, 9959 off = url.indexOf(" "); 9960 9961 if ( off >= 0 ) { 9962 selector = jQuery.trim( url.slice( off, url.length ) ); 9963 url = url.slice( 0, off ); 9964 } 9965 9966 // If it's a function 9967 if ( jQuery.isFunction( params ) ) { 9968 9969 // We assume that it's the callback 9970 callback = params; 9971 params = undefined; 9972 9973 // Otherwise, build a param string 9974 } else if ( params && typeof params === "object" ) { 9975 type = "POST"; 9976 } 9977 9978 // If we have elements to modify, make the request 9979 if ( self.length > 0 ) { 9980 jQuery.ajax({ 9981 url: url, 9982 9983 // if "type" variable is undefined, then "GET" method will be used 9984 type: type, 9985 dataType: "html", 9986 data: params 9987 }).done(function( responseText ) { 9988 9989 // Save response for use in complete callback 9990 response = arguments; 9991 9992 self.html( selector ? 9993 9994 // If a selector was specified, locate the right elements in a dummy div 9995 // Exclude scripts to avoid IE 'Permission Denied' errors 9996 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : 9997 9998 // Otherwise use the full result 9999 responseText ); 10000 10001 }).complete( callback && function( jqXHR, status ) { 10002 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); 10003 }); 10004 } 10005 10006 return this; 10007}; 10008 10009 10010 10011 10012jQuery.expr.filters.animated = function( elem ) { 10013 return jQuery.grep(jQuery.timers, function( fn ) { 10014 return elem === fn.elem; 10015 }).length; 10016}; 10017 10018 10019 10020 10021 10022var docElem = window.document.documentElement; 10023 10024/** 10025 * Gets a window from an element 10026 */ 10027function getWindow( elem ) { 10028 return jQuery.isWindow( elem ) ? 10029 elem : 10030 elem.nodeType === 9 ? 10031 elem.defaultView || elem.parentWindow : 10032 false; 10033} 10034 10035jQuery.offset = { 10036 setOffset: function( elem, options, i ) { 10037 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10038 position = jQuery.css( elem, "position" ), 10039 curElem = jQuery( elem ), 10040 props = {}; 10041 10042 // set position first, in-case top/left are set even on static elem 10043 if ( position === "static" ) { 10044 elem.style.position = "relative"; 10045 } 10046 10047 curOffset = curElem.offset(); 10048 curCSSTop = jQuery.css( elem, "top" ); 10049 curCSSLeft = jQuery.css( elem, "left" ); 10050 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10051 jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; 10052 10053 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 10054 if ( calculatePosition ) { 10055 curPosition = curElem.position(); 10056 curTop = curPosition.top; 10057 curLeft = curPosition.left; 10058 } else { 10059 curTop = parseFloat( curCSSTop ) || 0; 10060 curLeft = parseFloat( curCSSLeft ) || 0; 10061 } 10062 10063 if ( jQuery.isFunction( options ) ) { 10064 options = options.call( elem, i, curOffset ); 10065 } 10066 10067 if ( options.top != null ) { 10068 props.top = ( options.top - curOffset.top ) + curTop; 10069 } 10070 if ( options.left != null ) { 10071 props.left = ( options.left - curOffset.left ) + curLeft; 10072 } 10073 10074 if ( "using" in options ) { 10075 options.using.call( elem, props ); 10076 } else { 10077 curElem.css( props ); 10078 } 10079 } 10080}; 10081 10082jQuery.fn.extend({ 10083 offset: function( options ) { 10084 if ( arguments.length ) { 10085 return options === undefined ? 10086 this : 10087 this.each(function( i ) { 10088 jQuery.offset.setOffset( this, options, i ); 10089 }); 10090 } 10091 10092 var docElem, win, 10093 box = { top: 0, left: 0 }, 10094 elem = this[ 0 ], 10095 doc = elem && elem.ownerDocument; 10096 10097 if ( !doc ) { 10098 return; 10099 } 10100 10101 docElem = doc.documentElement; 10102 10103 // Make sure it's not a disconnected DOM node 10104 if ( !jQuery.contains( docElem, elem ) ) { 10105 return box; 10106 } 10107 10108 // If we don't have gBCR, just use 0,0 rather than error 10109 // BlackBerry 5, iOS 3 (original iPhone) 10110 if ( typeof elem.getBoundingClientRect !== strundefined ) { 10111 box = elem.getBoundingClientRect(); 10112 } 10113 win = getWindow( doc ); 10114 return { 10115 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), 10116 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) 10117 }; 10118 }, 10119 10120 position: function() { 10121 if ( !this[ 0 ] ) { 10122 return; 10123 } 10124 10125 var offsetParent, offset, 10126 parentOffset = { top: 0, left: 0 }, 10127 elem = this[ 0 ]; 10128 10129 // fixed elements are offset from window (parentOffset = {top:0, left
10129: 0}, because it is its only offset parent 10130 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10131 // we assume that getBoundingClientRect is available when computed position is fixed 10132 offset = elem.getBoundingClientRect(); 10133 } else { 10134 // Get *real* offsetParent 10135 offsetParent = this.offsetParent(); 10136 10137 // Get correct offsets 10138 offset = this.offset(); 10139 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 10140 parentOffset = offsetParent.offset(); 10141 } 10142 10143 // Add offsetParent borders 10144 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 10145 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 10146 } 10147 10148 // Subtract parent offsets and element margins 10149 // note: when an element has margin: auto the offsetLeft and marginLeft 10150 // are the same in Safari causing offset.left to incorrectly be 0 10151 return { 10152 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10153 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) 10154 }; 10155 }, 10156 10157 offsetParent: function() { 10158 return this.map(function() { 10159 var offsetParent = this.offsetParent || docElem; 10160 10161 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { 10162 offsetParent = offsetParent.offsetParent; 10163 } 10164 return offsetParent || docElem; 10165 }); 10166 } 10167}); 10168 10169// Create scrollLeft and scrollTop methods 10170jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10171 var top = /Y/.test( prop ); 10172 10173 jQuery.fn[ method ] = function( val ) { 10174 return access( this, function( elem, method, val ) { 10175 var win = getWindow( elem ); 10176 10177 if ( val === undefined ) { 10178 return win ? (prop in win) ? win[ prop ] : 10179 win.document.documentElement[ method ] : 10180 elem[ method ]; 10181 } 10182 10183 if ( win ) { 10184 win.scrollTo( 10185 !top ? val : jQuery( win ).scrollLeft(), 10186 top ? val : jQuery( win ).scrollTop() 10187 ); 10188 10189 } else { 10190 elem[ method ] = val; 10191 } 10192 }, method, val, arguments.length, null ); 10193 }; 10194}); 10195 10196// Add the top/left cssHooks using jQuery.fn.position 10197// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10198// getComputedStyle returns percent when specified for top/left/bottom/right 10199// rather than make the css module depend on the offset module, we just check for it here 10200jQuery.each( [ "top", "left" ], function( i, prop ) { 10201 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10202 function( elem, computed ) { 10203 if ( computed ) { 10204 computed = curCSS( elem, prop ); 10205 // if curCSS returns percentage, fallback to offset 10206 return rnumnonpx.test( computed ) ? 10207 jQuery( elem ).position()[ prop ] + "px" : 10208 computed; 10209 } 10210 } 10211 ); 10212}); 10213 10214 10215// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10216jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10217 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { 10218 // margin is only for outerHeight, outerWidth 10219 jQuery.fn[ funcName ] = function( margin, value ) { 10220 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10221 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10222 10223 return access( this, function( elem, type, value ) { 10224 var doc; 10225 10226 if ( jQuery.isWindow( elem ) ) { 10227 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 10228 // isn't a whole lot we can do. See pull request at this URL for discussion: 10229 // https://github.com/jquery/jquery/pull/764 10230 return elem.document.documentElement[ "client" + name ]; 10231 } 10232 10233 // Get document width or height 10234 if ( elem.nodeType === 9 ) { 10235 doc = elem.documentElement; 10236 10237 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest 10238 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. 10239 return Math.max( 10240 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10241 elem.body[ "offset" + name ], doc[ "offset" + name ], 10242 doc[ "client" + name ] 10243 ); 10244 } 10245 10246 return value === undefined ? 10247 // Get width or height on the element, requesting but not forcing parseFloat 10248 jQuery.css( elem, type, extra ) : 10249 10250 // Set width or height on the element 10251 jQuery.style( elem, type, value, extra ); 10252 }, type, chainable ? margin : undefined, chainable, null ); 10253 }; 10254 }); 10255}); 10256 10257 10258// The number of elements contained in the matched element set 10259jQuery.fn.size = function() { 10260 return this.length; 10261}; 10262 10263jQuery.fn.andSelf = jQuery.fn.addBack; 10264 10265 10266 10267 10268// Register as a named AMD module, since jQuery can be concatenated with other 10269// files that may use define, but not via a proper concatenation script that 10270// understands anonymous AMD modules. A named AMD is safest and most robust 10271// way to register. Lowercase jquery is used because AMD module names are 10272// derived from file names, and jQuery is normally delivered in a lowercase 10273// file name. Do this after creating the global so that if an AMD module wants 10274// to call noConflict to hide this version of jQuery, it will work. 10275 10276// Note that for maximum portability, libraries that are not jQuery should 10277// declare themselves as anonymous modules, and avoid setting a global if an 10278// AMD loader is present. jQuery is a special case. For more information, see
10279// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10280 10281if ( typeof define === "function" && define.amd ) { 10282 define( "jquery", [], function() { 10283 return jQuery; 10284 }); 10285} 10286 10287 10288 10289 10290var 10291 // Map over jQuery in case of overwrite 10292 _jQuery = window.jQuery, 10293 10294 // Map over the $ in case of overwrite 10295 _$ = window.$; 10296 10297jQuery.noConflict = function( deep ) { 10298 if ( window.$ === jQuery ) { 10299 window.$ = _$; 10300 } 10301 10302 if ( deep && window.jQuery === jQuery ) { 10303 window.jQuery = _jQuery; 10304 } 10305 10306 return jQuery; 10307}; 10308 10309// Expose jQuery and $ identifiers, even in 10310// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10311// and CommonJS for browser emulators (#13566) 10312if ( typeof noGlobal === strundefined ) { 10313 window.jQuery = window.$ = jQuery; 10314} 10315 10316 10317 10318 10319return jQuery; 10320 10321})); 10322(function($, undefined) { 10323 10324/** 10325 * Unobtrusive scripting adapter for jQuery 10326 * https://github.com/rails/jquery-ujs 10327 * 10328 * Requires jQuery 1.7.0 or later. 10329 * 10330 * Released under the MIT license 10331 * 10332 */ 10333 10334 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 10335 // by detecting and raising an error when it happens. 10336 if ( $.rails !== undefined ) { 10337 $.error('jquery-ujs has already been loaded!'); 10338 } 10339 10340 // Shorthand to make it a little easier to call public rails functions from within rails.js 10341 var rails; 10342 var $document = $(document); 10343 10344 $.rails = rails = { 10345 // Link elements bound by jquery-ujs 10346 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with], a[data-disable]', 10347 10348 // Button elements bound by jquery-ujs 10349 buttonClickSelector: 'button[data-remote], button[data-confirm]', 10350 10351 // Select elements bound by jquery-ujs 10352 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 10353 10354 // Form elements bound by jquery-ujs 10355 formSubmitSelector: 'form', 10356 10357 // Form input elements bound by jquery-ujs 10358 formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])', 10359 10360 // Form input elements disabled during form submission 10361 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 10362 10363 // Form input elements re-enabled after form submission 10364 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 10365 10366 // Form required input elements 10367 requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])', 10368 10369 // Form file input elements 10370 fileInputSelector: 'input[type=file]', 10371 10372 // Link onClick disable selector with possible reenable after remote submission 10373 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 10374 10375 // Button onClick disable selector with possible reenable after remote submission 10376 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 10377 10378 // Make sure that every Ajax request sends the CSRF token 10379 CSRFProtection: function(xhr) { 10380 var token = $('meta[name="csrf-token"]').attr('content'); 10381 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 10382 }, 10383 10384 // making sure that all forms have actual up-to-date token(cached forms contain old one) 10385 refreshCSRFTokens: function(){ 10386 var csrfToken = $('meta[name=csrf-token]').attr('content'); 10387 var csrfParam = $('meta[name=csrf-param]').attr('content'); 10388 $('form input[name="' + csrfParam + '"]').val(csrfToken); 10389 }, 10390 10391 // Triggers an event on an element and returns false if the event result is false 10392 fire: function(obj, name, data) { 10393 var event = $.Event(name); 10394 obj.trigger(event, data); 10395 return event.result !== false; 10396 }, 10397 10398 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 10399 confirm: function(message) { 10400 return confirm(message); 10401 }, 10402 10403 // Default ajax function, may be overridden with custom function in $.rails.ajax 10404 ajax: function(options) { 10405 return $.ajax(options); 10406 }, 10407 10408 // Default way to get an element's href. May be overridden at $.rails.href. 10409 href: function(element) { 10410 return element.attr('href'); 10411 }, 10412 10413 // Submits "remote" forms and links with ajax 10414 handleRemote: function(element) { 10415 var method, url, data, elCrossDomain, crossDomain, withCredentials, dataType, options; 10416 10417 if (rails.fire(element, 'ajax:before')) { 10418 elCrossDomain = element.data('cross-domain');
10419 crossDomain = elCrossDomain === undefined ? null : elCrossDomain; 10420 withCredentials = element.data('with-credentials') || null; 10421 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 10422 10423 if (element.is('form')) { 10424 method = element.attr('method'); 10425 url = element.attr('action'); 10426 data = element.serializeArray(); 10427 // memoized value from clicked submit button 10428 var button = element.data('ujs:submit-button'); 10429 if (button) { 10430 data.push(button); 10431 element.data('ujs:submit-button', null); 10432 } 10433 } else if (element.is(rails.inputChangeSelector)) { 10434 method = element.data('method'); 10435 url = element.data('url'); 10436 data = element.serialize(); 10437 if (element.data('params')) data = data + "&" + element.data('params'); 10438 } else if (element.is(rails.buttonClickSelector)) { 10439 method = element.data('method') || 'get'; 10440 url = element.data('url'); 10441 data = element.serialize(); 10442 if (element.data('params')) data = data + "&" + element.data('params'); 10443 } else { 10444 method = element.data('method'); 10445 url = rails.href(element); 10446 data = element.data('params') || null; 10447 } 10448 10449 options = { 10450 type: method || 'GET', data: data, dataType: dataType, 10451 // stopping the "ajax:beforeSend" event will cancel the ajax request 10452 beforeSend: function(xhr, settings) { 10453 if (settings.dataType === undefined) { 10454 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 10455 } 10456 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) { 10457 element.trigger('ajax:send', xhr); 10458 } else { 10459 return false; 10460 } 10461 }, 10462 success: function(data, status, xhr) { 10463 element.trigger('ajax:success', [data, status, xhr]); 10464 }, 10465 complete: function(xhr, status) { 10466 element.trigger('ajax:complete', [xhr, status]); 10467 }, 10468 error: function(xhr, status, error) { 10469 element.trigger('ajax:error', [xhr, status, error]); 10470 }, 10471 crossDomain: crossDomain 10472 }; 10473 10474 // There is no withCredentials for IE6-8 when 10475 // "Enable native XMLHTTP support" is disabled 10476 if (withCredentials) { 10477 options.xhrFields = { 10478 withCredentials: withCredentials 10479 }; 10480 } 10481 10482 // Only pass url to `ajax` options if not blank 10483 if (url) { options.url = url; } 10484 10485 return rails.ajax(options); 10486 } else { 10487 return false; 10488 } 10489 }, 10490 10491 // Handles "data-method" on links such as: 10492 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 10493 handleMethod: function(link) { 10494 var href = rails.href(link), 10495 method = link.data('method'), 10496 target = link.attr('target'), 10497 csrfToken = $('meta[name=csrf-token]').attr('content'), 10498 csrfParam = $('meta[name=csrf-param]').attr('content'), 10499 form = $('<form method="post" action="' + href + '"></form>'), 10500 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 10501 10502 if (csrfParam !== undefined && csrfToken !== undefined) { 10503 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 10504 } 10505 10506 if (target) { form.attr('target', target); } 10507 10508 form.hide().append(metadataInput).appendTo('body'); 10509 form.submit(); 10510 }, 10511 10512 // Helper function that returns form elements that match the specified CSS selector 10513 // If form is actually a "form" element this will return associated elements outside the from that have 10514 // the html form attribute set 10515 formElements: function(form, selector) { 10516 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 10517 }, 10518 10519 /* Disables form elements: 10520 - Caches element value in 'ujs:enable-with' data store 10521 - Replaces element text with value of 'data-disable-with' attribute 10522 - Sets disabled property to true 10523 */ 10524 disableFormElements: function(form) { 10525 rails.formElements(form, rails.disableSelector).each(function() { 10526 rails.disableFormElement($(this)); 10527 }); 10528 }, 10529 10530 disableFormElement: function(element) { 10531 var method, replacement; 10532 10533 method = element.is('button') ? 'html' : 'val'; 10534 replacement = element.data('disable-with'); 10535 10536 element.data('ujs:enable-with', element[method]()); 10537 if (replacement !== undefined) { 10538 element[method](replacement); 10539 } 10540 10541 element.prop('disabled', true); 10542 }, 10543 10544 /* Re-enables disabled form elements: 10545 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 10546 - Sets disabled property to false 10547 */ 10548 enableFormElements: function(form) { 10549 rails.formElements(form, rails.enableSelector).each(function() { 10550 rails.enableFormElement($(this)); 10551 }); 10552 }, 10553 10554 enableFormElement: function(element) { 10555 var method = element.is('button') ? 'html' : 'val'; 10556 if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with')); 10557 element.prop('disabled', false); 10558 }, 10559 10560 /* For 'data-confirm' attribute: 10561 - Fires `confirm` event 10562 - Shows the confirmation dialog 10563 - Fires the `confirm:complete` event 10564 10565 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 10566 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 10567 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
10568 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 10569 */ 10570 allowAction: function(element) { 10571 var message = element.data('confirm'), 10572 answer = false, callback; 10573 if (!message) { return true; } 10574 10575 if (rails.fire(element, 'confirm')) { 10576 answer = rails.confirm(message); 10577 callback = rails.fire(element, 'confirm:complete', [answer]); 10578 } 10579 return answer && callback; 10580 }, 10581 10582 // Helper function which checks for blank inputs in a form that match the specified CSS selector 10583 blankInputs: function(form, specifiedSelector, nonBlank) { 10584 var inputs = $(), input, valueToCheck, 10585 selector = specifiedSelector || 'input,textarea', 10586 allInputs = form.find(selector); 10587 10588 allInputs.each(function() { 10589 input = $(this); 10590 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : input.val(); 10591 // If nonBlank and valueToCheck are both truthy, or nonBlank and valueToCheck are both falsey 10592 if (!valueToCheck === !nonBlank) { 10593 10594 // Don't count unchecked required radio if other radio with same name is checked 10595 if (input.is('input[type=radio]') && allInputs.filter('input[type=radio]:checked[name="' + input.attr('name') + '"]').length) { 10596 return true; // Skip to next input 10597 } 10598 10599 inputs = inputs.add(input); 10600 } 10601 }); 10602 return inputs.length ? inputs : false; 10603 }, 10604 10605 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 10606 nonBlankInputs: function(form, specifiedSelector) { 10607 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 10608 }, 10609 10610 // Helper function, needed to provide consistent behavior in IE 10611 stopEverything: function(e) { 10612 $(e.target).trigger('ujs:everythingStopped'); 10613 e.stopImmediatePropagation(); 10614 return false; 10615 }, 10616 10617 // replace element's html with the 'data-disable-with' after storing original html 10618 // and prevent clicking on it 10619 disableElement: function(element) { 10620 var replacement = element.data('disable-with'); 10621 10622 element.data('ujs:enable-with', element.html()); // store enabled state 10623 if (replacement !== undefined) { 10624 element.html(replacement); 10625 } 10626 10627 element.bind('click.railsDisable', function(e) { // prevent further clicking 10628 return rails.stopEverything(e); 10629 }); 10630 }, 10631 10632 // restore element to its original state which was disabled by 'disableElement' above 10633 enableElement: function(element) { 10634 if (element.data('ujs:enable-with') !== undefined) { 10635 element.html(element.data('ujs:enable-with')); // set to old enabled state 10636 element.removeData('ujs:enable-with'); // clean up cache 10637 } 10638 element.unbind('click.railsDisable'); // enable element 10639 } 10640 }; 10641 10642 if (rails.fire($document, 'rails:attachBindings')) { 10643 10644 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 10645 10646 $document.delegate(rails.linkDisableSelector, 'ajax:complete', function() { 10647 rails.enableElement($(this)); 10648 }); 10649 10650 $document.delegate(rails.buttonDisableSelector, 'ajax:complete', function() { 10651 rails.enableFormElement($(this)); 10652 }); 10653 10654 $document.delegate(rails.linkClickSelector, 'click.rails', function(e) { 10655 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 10656 if (!rails.allowAction(link)) return rails.stopEverything(e); 10657 10658 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 10659 10660 if (link.data('remote') !== undefined) { 10661 if (metaClick && (!method || method === 'GET') && !data) { return true; } 10662 10663 var handleRemote = rails.handleRemote(link); 10664 // response from rails.handleRemote() will either be false or a deferred object promise. 10665 if (handleRemote === false) { 10666 rails.enableElement(link); 10667 } else { 10668 handleRemote.error( function() { rails.enableElement(link); } ); 10669 } 10670 return false;
10671 10672 } else if (link.data('method')) { 10673 rails.handleMethod(link); 10674 return false; 10675 } 10676 }); 10677 10678 $document.delegate(rails.buttonClickSelector, 'click.rails', function(e) { 10679 var button = $(this); 10680 if (!rails.allowAction(button)) return rails.stopEverything(e); 10681 10682 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 10683 10684 var handleRemote = rails.handleRemote(button); 10685 // response from rails.handleRemote() will either be false or a deferred object promise. 10686 if (handleRemote === false) { 10687 rails.enableFormElement(button); 10688 } else { 10689 handleRemote.error( function() { rails.enableFormElement(button); } ); 10690 } 10691 return false; 10692 }); 10693 10694 $document.delegate(rails.inputChangeSelector, 'change.rails', function(e) { 10695 var link = $(this); 10696 if (!rails.allowAction(link)) return rails.stopEverything(e); 10697 10698 rails.handleRemote(link); 10699 return false; 10700 }); 10701 10702 $document.delegate(rails.formSubmitSelector, 'submit.rails', function(e) { 10703 var form = $(this), 10704 remote = form.data('remote') !== undefined, 10705 blankRequiredInputs, 10706 nonBlankFileInputs; 10707 10708 if (!rails.allowAction(form)) return rails.stopEverything(e); 10709 10710 // skip other logic when required values are missing or file upload is present 10711 if (form.attr('novalidate') == undefined) { 10712 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector); 10713 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 10714 return rails.stopEverything(e); 10715 } 10716 } 10717 10718 if (remote) { 10719 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 10720 if (nonBlankFileInputs) { 10721 // slight timeout so that the submit button gets properly serialized 10722 // (make it easy for event handler to serialize form without disabled values) 10723 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10724 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 10725 10726 // re-enable form elements if event bindings return false (canceling normal form submission) 10727 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 10728 10729 return aborted; 10730 } 10731 10732 rails.handleRemote(form); 10733 return false; 10734 10735 } else { 10736 // slight timeout so that the submit button gets properly serialized 10737 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10738 } 10739 }); 10740 10741 $document.delegate(rails.formInputClickSelector, 'click.rails', function(event) { 10742 var button = $(this); 10743 10744 if (!rails.allowAction(button)) return rails.stopEverything(event); 10745 10746 // register the pressed submit button 10747 var name = button.attr('name'), 10748 data = name ? {name:name, value:button.val()} : null; 10749 10750 button.closest('form').data('ujs:submit-button', data); 10751 }); 10752 10753 $document.delegate(rails.formSubmitSelector, 'ajax:send.rails', function(event) { 10754 if (this == event.target) rails.disableFormElements($(this)); 10755 }); 10756 10757 $document.delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) { 10758 if (this == event.target) rails.enableFormElements($(this)); 10759 }); 10760 10761 $(function(){ 10762 rails.refreshCSRFTokens(); 10763 }); 10764 } 10765 10766})( jQuery ); 10767(function() { 10768 var CSRFToken, Click, ComponentUrl, Link, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsCustomEvents, browserSupportsPushState, browserSupportsTurbolinks, bypassOnLoadPopstate, cacheCurrentPage, cacheSize, changePage, constrainPageCacheTo, createDocument, currentState, enableTransitionCache, executeScriptTags, extractTitleAndBody, fetch, fetchHistory, fetchReplacement, historyStateIsDefined, initializeTurbolinks, installDocumentReadyPageEventTriggers, installHistoryChangeHandler, installJqueryAjaxSuccessPageUpdateTrigger, loadedAssets, pageCache, pageChangePrevented, pagesCached, popCookie, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberReferer, removeNoscriptTags, requestMethodIsSafe, resetScrollPosition, transitionCacheEnabled, transitionCacheFor, triggerEvent, visit, xhr, _ref, 10769 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, 10770 __hasProp = {}.hasOwnProperty, 10771 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, 10772 __slice = [].slice; 10773 10774 pageCache = {}; 10775 10776 cacheSize = 10; 10777 10778 transitionCacheEnabled = false;
10779 10780 currentState = null; 10781 10782 loadedAssets = null; 10783 10784 referer = null; 10785 10786 createDocument = null; 10787 10788 xhr = null; 10789 10790 fetch = function(url) { 10791 var cachedPage; 10792 url = new ComponentUrl(url); 10793 rememberReferer(); 10794 cacheCurrentPage(); 10795 reflectNewUrl(url); 10796 if (transitionCacheEnabled && (cachedPage = transitionCacheFor(url.absolute))) { 10797 fetchHistory(cachedPage); 10798 return fetchReplacement(url); 10799 } else { 10800 return fetchReplacement(url, resetScrollPosition); 10801 } 10802 }; 10803 10804 transitionCacheFor = function(url) { 10805 var cachedPage; 10806 cachedPage = pageCache[url]; 10807 if (cachedPage && !cachedPage.transitionCacheDisabled) { 10808 return cachedPage; 10809 } 10810 }; 10811 10812 enableTransitionCache = function(enable) { 10813 if (enable == null) { 10814 enable = true; 10815 } 10816 return transitionCacheEnabled = enable; 10817 }; 10818 10819 fetchReplacement = function(url, onLoadFunction) { 10820 if (onLoadFunction == null) { 10821 onLoadFunction = (function(_this) { 10822 return function() {}; 10823 })(this); 10824 } 10825 triggerEvent('page:fetch', { 10826 url: url.absolute 10827 }); 10828 if (xhr != null) { 10829 xhr.abort(); 10830 } 10831 xhr = new XMLHttpRequest; 10832 xhr.open('GET', url.withoutHashForIE10compatibility(), true); 10833 xhr.setRequestHeader('Accept', 'text/html, application/xhtml+xml, application/xml'); 10834 xhr.setRequestHeader('X-XHR-Referer', referer); 10835 xhr.onload = function() { 10836 var doc; 10837 triggerEvent('page:receive'); 10838 if (doc = processResponse()) { 10839 changePage.apply(null, extractTitleAndBody(doc)); 10840 reflectRedirectedUrl(); 10841 onLoadFunction(); 10842 return triggerEvent('page:load'); 10843 } else { 10844 return document.location.href = url.absolute; 10845 } 10846 }; 10847 xhr.onloadend = function() { 10848 return xhr = null; 10849 }; 10850 xhr.onerror = function() { 10851 return document.location.href = url.absolute; 10852 }; 10853 return xhr.send(); 10854 }; 10855 10856 fetchHistory = function(cachedPage) { 10857 if (xhr != null) { 10858 xhr.abort(); 10859 } 10860 changePage(cachedPage.title, cachedPage.body); 10861 recallScrollPosition(cachedPage); 10862 return triggerEvent('page:restore'); 10863 }; 10864 10865 cacheCurrentPage = function() { 10866 var currentStateUrl; 10867 currentStateUrl = new ComponentUrl(currentState.url); 10868 pageCache[currentStateUrl.absolute] = { 10869 url: currentStateUrl.relative, 10870 body: document.body, 10871 title: document.title, 10872 positionY: window.pageYOffset, 10873 positionX: window.pageXOffset, 10874 cachedAt: new Date().getTime(), 10875 transitionCacheDisabled: document.querySelector('[data-no-transition-cache]') != null 10876 }; 10877 return constrainPageCacheTo(cacheSize); 10878 }; 10879 10880 pagesCached = function(size) { 10881 if (size == null) { 10882 size = cacheSize; 10883 } 10884 if (/^[\d]+$/.test(size)) { 10885 return cacheSize = parseInt(size); 10886 } 10887 }; 10888 10889 constrainPageCacheTo = function(limit) { 10890 var cacheTimesRecentFirst, key, pageCacheKeys, _i, _len, _results; 10891 pageCacheKeys = Object.keys(pageCache); 10892 cacheTimesRecentFirst = pageCacheKeys.map(function(url) { 10893 return pageCache[url].cachedAt; 10894 }).sort(function(a, b) { 10895 return b - a; 10896 }); 10897 _results = []; 10898 for (_i = 0, _len = pageCacheKeys.length; _i < _len; _i++) { 10899 key = pageCacheKeys[_i]; 10900 if (!(pageCache[key].cachedAt <= cacheTimesRecentFirst[limit])) { 10901 continue; 10902 } 10903 triggerEvent('page:expire', pageCache[key]); 10904 _results.push(delete pageCache[key]); 10905 } 10906 return _results; 10907 }; 10908 10909 changePage = function(title, body, csrfToken, runScripts) { 10910 document.title = title; 10911 document.documentElement.replaceChild(body, document.body); 10912 if (csrfToken != null) { 10913 CSRFToken.update(csrfToken); 10914 } 10915 if (runScripts) { 10916 executeScriptTags(); 10917 } 10918 currentState = window.history.state; 10919 triggerEvent('page:change'); 10920 return triggerEvent('page:update'); 10921 }; 10922 10923 executeScriptTags = function() { 10924 var attr, copy, nextSibling, parentNode, script, scripts, _i, _j, _len, _len1, _ref, _ref1; 10925 scripts = Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])')); 10926 for (_i = 0, _len = scripts.length; _i < _len; _i++) { 10927 script = scripts[_i]; 10928 if (!((_ref = script.type) === '' || _ref === 'text/javascript')) { 10929 continue; 10930 } 10931 copy = document.createElement('script'); 10932 _ref1 = script.attributes; 10933 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 10934 attr = _ref1[_j]; 10935 copy.setAttribute(attr.name, attr.value); 10936 } 10937 copy.appendChild(document.createTextNode(script.innerHTML)); 10938 parentNode = script.parentNode, nextSibling = script.nextSibling; 10939 parentNode.removeChild(script); 10940 parentNode.insertBefore(copy, nextSibling); 10941 } 10942 }; 10943 10944 removeNoscriptTags = function(node) { 10945 node.innerHTML = node.innerHTML.replace(/<noscript[\S\s]*?<\/noscript>/ig, ''); 10946 return node; 10947 }; 10948 10949 reflectNewUrl = function(url) { 10950 if ((url = new ComponentUrl(url)).absolute !== referer) { 10951 return window.history.pushState({ 10952 turbolinks: true, 10953 url: url.absolute 10954 }, '', url.absolute); 10955 } 10956 }; 10957 10958 reflectRedirectedUrl = function() { 10959 var location, preservedHash; 10960 if (location = xhr.getResponseHeader('X-XHR-Redirected-To')) { 10961 location = new ComponentUrl(location); 10962 preservedHash = location.hasNoHash() ? document.location.hash : ''; 10963 return window.history.replaceState(currentState, '', location.href + preservedHash); 10964 } 10965 }; 10966 10967 rememberReferer = function() { 10968 return referer = document.location.href; 10969 }; 10970 10971 rememberCurrentUrl = function() { 10972 return window.history.replaceState({ 10973 turbolinks: true, 10974 url: document.location.href 10975 }, '', document.location.href); 10976 }; 10977 10978 rememberCurrentState = function() { 10979 return currentState = window.history.state; 10980 }; 10981 10982 recallScrollPosition = function(page) {
10983 return window.scrollTo(page.positionX, page.positionY); 10984 }; 10985 10986 resetScrollPosition = function() { 10987 if (document.location.hash) { 10988 return document.location.href = document.location.href; 10989 } else { 10990 return window.scrollTo(0, 0); 10991 } 10992 }; 10993 10994 popCookie = function(name) { 10995 var value, _ref; 10996 value = ((_ref = document.cookie.match(new RegExp(name + "=(\\w+)"))) != null ? _ref[1].toUpperCase() : void 0) || ''; 10997 document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/'; 10998 return value; 10999 }; 11000 11001 triggerEvent = function(name, data) { 11002 var event; 11003 event = document.createEvent('Events'); 11004 if (data) { 11005 event.data = data; 11006 } 11007 event.initEvent(name, true, true); 11008 return document.dispatchEvent(event); 11009 }; 11010 11011 pageChangePrevented = function() { 11012 return !triggerEvent('page:before-change'); 11013 }; 11014 11015 processResponse = function() { 11016 var assetsChanged, clientOrServerError, doc, extractTrackAssets, intersection, validContent; 11017 clientOrServerError = function() { 11018 var _ref; 11019 return (400 <= (_ref = xhr.status) && _ref < 600); 11020 }; 11021 validContent = function() { 11022 return xhr.getResponseHeader('Content-Type').match(/^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/); 11023 }; 11024 extractTrackAssets = function(doc) { 11025 var node, _i, _len, _ref, _results; 11026 _ref = doc.head.childNodes; 11027 _results = []; 11028 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 11029 node = _ref[_i]; 11030 if ((typeof node.getAttribute === "function" ? node.getAttribute('data-turbolinks-track') : void 0) != null) { 11031 _results.push(node.getAttribute('src') || node.getAttribute('href')); 11032 } 11033 } 11034 return _results; 11035 }; 11036 assetsChanged = function(doc) { 11037 var fetchedAssets; 11038 loadedAssets || (loadedAssets = extractTrackAssets(document)); 11039 fetchedAssets = extractTrackAssets(doc); 11040 return fetchedAssets.length !== loadedAssets.length || intersection(fetchedAssets, loadedAssets).length !== loadedAssets.length; 11041 }; 11042 intersection = function(a, b) { 11043 var value, _i, _len, _ref, _results; 11044 if (a.length > b.length) { 11045 _ref = [b, a], a = _ref[0], b = _ref[1]; 11046 } 11047 _results = []; 11048 for (_i = 0, _len = a.length; _i < _len; _i++) { 11049 value = a[_i]; 11050 if (__indexOf.call(b, value) >= 0) { 11051 _results.push(value); 11052 } 11053 } 11054 return _results; 11055 }; 11056 if (!clientOrServerError() && validContent()) { 11057 doc = createDocument(xhr.responseText); 11058 if (doc && !assetsChanged(doc)) { 11059 return doc; 11060 } 11061 } 11062 }; 11063 11064 extractTitleAndBody = function(doc) { 11065 var title; 11066 title = doc.querySelector('title'); 11067 return [title != null ? title.textContent : void 0, removeNoscriptTags(doc.body), CSRFToken.get(doc).token, 'runScripts']; 11068 }; 11069 11070 CSRFToken = { 11071 get: function(doc) { 11072 var tag; 11073 if (doc == null) { 11074 doc = document; 11075 } 11076 return { 11077 node: tag = doc.querySelector('meta[name="csrf-token"]'), 11078 token: tag != null ? typeof tag.getAttribute === "function" ? tag.getAttribute('content') : void 0 : void 0 11079 }; 11080 }, 11081 update: function(latest) { 11082 var current; 11083 current = this.get(); 11084 if ((current.token != null) && (latest != null) && current.token !== latest) { 11085 return current.node.setAttribute('content', latest); 11086 } 11087 } 11088 }; 11089 11090 browserCompatibleDocumentParser = function() { 11091 var createDocumentUsingDOM, createDocumentUsingParser, createDocumentUsingWrite, e, testDoc, _ref; 11092 createDocumentUsingParser = function(html) { 11093 return (new DOMParser).parseFromString(html, 'text/html'); 11094 }; 11095 createDocumentUsingDOM = function(html) { 11096 var doc; 11097 doc = document.implementation.createHTMLDocument(''); 11098 doc.documentElement.innerHTML = html; 11099 return doc; 11100 }; 11101 createDocumentUsingWrite = function(html) { 11102 var doc; 11103 doc = document.implementation.createHTMLDocument(''); 11104 doc.open('replace'); 11105 doc.write(html); 11106 doc.close(); 11107 return doc; 11108 }; 11109 try { 11110 if (window.DOMParser) { 11111 testDoc = createDocumentUsingParser('<html><body><p>test'); 11112 return createDocumentUsingParser; 11113 } 11114 } catch (_error) { 11115 e = _error; 11116 testDoc = createDocumentUsingDOM('<html><body><p>test'); 11117 return createDocumentUsingDOM; 11118 } finally { 11119 if ((testDoc != null ? (_ref = testDoc.body) != null ? _ref.childNodes.length : void 0 : void 0) !== 1) { 11120 return createDocumentUsingWrite; 11121 } 11122 } 11123 }; 11124 11125 ComponentUrl = (function() { 11126 function ComponentUrl(original) { 11127 this.original = original != null ? original : document.location.href; 11128 if (this.original.constructor === ComponentUrl) { 11129 return this.original; 11130 } 11131 this._parse(); 11132 } 11133 11134 ComponentUrl.prototype.withoutHash = function() { 11135 return this.href.replace(this.hash, ''); 11136 }; 11137 11138 ComponentUrl.prototype.withoutHashForIE10compatibility = function() { 11139 return this.withoutHash(); 11140 }; 11141 11142 ComponentUrl.prototype.hasNoHash = function() { 11143 return this.hash.length === 0; 11144 }; 11145 11146 ComponentUrl.prototype._parse = function() { 11147 var _ref; 11148 (this.link != null ? this.link : this.link = document.createElement('a')).href = this.original; 11149 _ref = this.link, this.href = _ref.href, this.protocol = _ref.protocol, this.host = _ref.host, this.hostname = _ref.hostname, this.port = _ref.port, this.pathname = _ref.pathname, this.search = _ref.search, this.hash = _ref.hash; 11150 this.origin = [this.protocol, '//', this.hostname].join(''); 11151 if (this.port.length !== 0) { 11152 this.origin += ":" + this.port; 11153 } 11154 this.relative = [this.pathname, this.search, this.hash].join(''); 11155 return this.absolute = this.href; 11156 }; 11157 11158 return ComponentUrl; 11159 11160 })(); 11161 11162 Link = (function(_super) { 11163 __extends(Link, _super); 11164
11165 Link.HTML_EXTENSIONS = ['html']; 11166 11167 Link.allowExtensions = function() { 11168 var extension, extensions, _i, _len; 11169 extensions = 1 <= arguments.length ? __slice.call(arguments, 0) : []; 11170 for (_i = 0, _len = extensions.length; _i < _len; _i++) { 11171 extension = extensions[_i]; 11172 Link.HTML_EXTENSIONS.push(extension); 11173 } 11174 return Link.HTML_EXTENSIONS; 11175 }; 11176 11177 function Link(link) { 11178 this.link = link; 11179 if (this.link.constructor === Link) { 11180 return this.link; 11181 } 11182 this.original = this.link.href; 11183 Link.__super__.constructor.apply(this, arguments); 11184 } 11185 11186 Link.prototype.shouldIgnore = function() { 11187 return this._crossOrigin() || this._anchored() || this._nonHtml() || this._optOut() || this._target(); 11188 }; 11189 11190 Link.prototype._crossOrigin = function() { 11191 return this.origin !== (new ComponentUrl).origin; 11192 }; 11193 11194 Link.prototype._anchored = function() { 11195 var current; 11196 return ((this.hash && this.withoutHash()) === (current = new ComponentUrl).withoutHash()) || (this.href === current.href + '#'); 11197 }; 11198 11199 Link.prototype._nonHtml = function() { 11200 return this.pathname.match(/\.[a-z]+$/g) && !this.pathname.match(new RegExp("\\.(?:" + (Link.HTML_EXTENSIONS.join('|')) + ")?$", 'g')); 11201 }; 11202 11203 Link.prototype._optOut = function() { 11204 var ignore, link; 11205 link = this.link; 11206 while (!(ignore || link === document)) { 11207 ignore = link.getAttribute('data-no-turbolink') != null; 11208 link = link.parentNode; 11209 } 11210 return ignore; 11211 }; 11212 11213 Link.prototype._target = function() { 11214 return this.link.target.length !== 0; 11215 }; 11216 11217 return Link; 11218 11219 })(ComponentUrl); 11220 11221 Click = (function() { 11222 Click.installHandlerLast = function(event) { 11223 if (!event.defaultPrevented) { 11224 document.removeEventListener('click', Click.handle, false); 11225 return document.addEventListener('click', Click.handle, false); 11226 } 11227 }; 11228 11229 Click.handle = function(event) { 11230 return new Click(event); 11231 }; 11232 11233 function Click(event) { 11234 this.event = event; 11235 if (this.event.defaultPrevented) { 11236 return; 11237 } 11238 this._extractLink(); 11239 if (this._validForTurbolinks()) { 11240 if (!pageChangePrevented()) { 11241 visit(this.link.href); 11242 } 11243 this.event.preventDefault(); 11244 } 11245 } 11246 11247 Click.prototype._extractLink = function() { 11248 var link; 11249 link = this.event.target; 11250 while (!(!link.parentNode || link.nodeName === 'A')) { 11251 link = link.parentNode; 11252 } 11253 if (link.nodeName === 'A' && link.href.length !== 0) { 11254 return this.link = new Link(link); 11255 } 11256 }; 11257 11258 Click.prototype._validForTurbolinks = function() { 11259 return (this.link != null) && !(this.link.shouldIgnore() || this._nonStandardClick()); 11260 }; 11261 11262 Click.prototype._nonStandardClick = function() { 11263 return this.event.which > 1 || this.event.metaKey || this.event.ctrlKey || this.event.shiftKey || this.event.altKey; 11264 }; 11265 11266 return Click; 11267 11268 })(); 11269 11270 bypassOnLoadPopstate = function(fn) { 11271 return setTimeout(fn, 500); 11272 }; 11273 11274 installDocumentReadyPageEventTriggers = function() { 11275 return document.addEventListener('DOMContentLoaded', (function() { 11276 triggerEvent('page:change'); 11277 return triggerEvent('page:update'); 11278 }), true); 11279 }; 11280 11281 installJqueryAjaxSuccessPageUpdateTrigger = function() { 11282 if (typeof jQuery !== 'undefined') { 11283 return jQuery(document).on('ajaxSuccess', function(event, xhr, settings) { 11284 if (!jQuery.trim(xhr.responseText)) { 11285 return; 11286 } 11287 return triggerEvent('page:update'); 11288 }); 11289 } 11290 }; 11291 11292 installHistoryChangeHandler = function(event) { 11293 var cachedPage, _ref; 11294 if ((_ref = event.state) != null ? _ref.turbolinks : void 0) { 11295 if (cachedPage = pageCache[(new ComponentUrl(event.state.url)).absolute]) { 11296 cacheCurrentPage(); 11297 return fetchHistory(cachedPage); 11298 } else { 11299 return visit(event.target.location.href); 11300 } 11301 } 11302 }; 11303 11304 initializeTurbolinks = function() { 11305 rememberCurrentUrl(); 11306 rememberCurrentState(); 11307 createDocument = browserCompatibleDocumentParser(); 11308 document.addEventListener('click', Click.installHandlerLast, true); 11309 return bypassOnLoadPopstate(function() { 11310 return window.addEventListener('popstate', installHistoryChangeHandler, false); 11311 }); 11312 }; 11313 11314 historyStateIsDefined = window.history.state !== void 0 || navigator.userAgent.match(/Firefox\/2[6|7]/); 11315 11316 browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && historyStateIsDefined; 11317 11318 browserIsntBuggy = !navigator.userAgent.match(/CriOS\//); 11319 11320 requestMethodIsSafe = (_ref = popCookie('request_method')) === 'GET' || _ref === ''; 11321 11322 browserSupportsTurbolinks = browserSupportsPushState && browserIsntBuggy && requestMethodIsSafe; 11323 11324 browserSupportsCustomEvents = document.addEventListener && document.createEvent; 11325 11326 if (browserSupportsCustomEvents) { 11327 installDocumentReadyPageEventTriggers(); 11328 installJqueryAjaxSuccessPageUpdateTrigger(); 11329 } 11330 11331 if (browserSupportsTurbolinks) { 11332 visit = fetch; 11333 initializeTurbolinks(); 11334 } else { 11335 visit = function(url) { 11336 return document.location.href = url; 11337 }; 11338 } 11339 11340 this.Turbolinks = { 11341 visit: visit, 11342 pagesCached: pagesCached, 11343 enableTransitionCache: enableTransitionCache, 11344 allowLinkExtensions: Link.allowExtensions, 11345 supported: browserSupportsTurbolinks 11346 }; 11347 11348}).call(this); 11349/*! 11350 * Bootstrap v3.2.0 (http://getbootstrap.com) 11351 * Copyright 2011-2014 Twitter, Inc. 11352 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 11353 */ 11354
vendor: 11,027 bytes, lines 11355-11370
11355/*! 11356 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=f3c073c2de9b563cbd9a) 11357 * Config saved to config.json and https://gist.github.com/f3c073c2de9b563cbd9a 11358 */ 11359 11360if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),n=i.data("bs.tooltip"),s="object"==typeof e&&e;(n||"destroy"!=e)&&(n||i.data("bs.tooltip",n=new o(this,s)),"string"==typeof e&&n[e]())})}var o=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};o.VERSION="3.2.0",o.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},o.prototype.init=function(e,o,i){this.enabled=!0,this.type=e,this.$element=t(o),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&t(this.options.viewport.selector||this.options.viewport);for(var n=this.options.trigger.split(" "),s=n.length;s--;){var r=n[s];if("click"==r)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=r){var p="hover"==r?"mouseenter":"focusin",a="hover"==r?"mouseleave":"focusout";this.$element.on(p+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},o.prototype.getDefaults=function(){return o.DEFAULTS},o.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},o.prototype.getDelegateOptions=function(){var e={},o=this.getDefaults();return this._options&&t.each(this._options,function(t,i){o[t]!=i&&(e[t]=i)}),e},o.prototype.enter=function(e){var o=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return o||(o=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,o)),clearTimeout(o.timeout),o.hoverState="in",o.options.delay&&o.options.delay.show?void(o.timeout=setTimeout(function(){"in"==o.hoverState&&o.show()},o.options.delay.show)):o.show()},o.prototype.leave=function(e){var o=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return o||(o=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,o)),clearTimeout(o.timeout),o.hoverState="out",o.options.delay&&o.options.delay.hide?void(o.timeout=setTimeout(function(){"out"==o.hoverState&&o.hide()},o.options.delay.hide)):o.hide()},o.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var o=t.contains(document.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!o)return;var i=this,n=this.tip(),s=this.getUID(this.type);this.setContent(),n.attr("id",s),this.$element.attr("aria-describedby",s),this.options.animation&&n.addClass("fade");var r="function"==typeof this.options.placement?this.options.placement.call(this,n[0],this.$element[0]):this.options.placement,p=/\s?auto?\s?/i,a=p.test(r);a&&(r=r.replace(p,"")||"top"),n.detach().css({top:0,left:0,display:"block"}).addClass(r).data("bs."+this.type,this),this.options.container?n.appendTo(this.options.container):n.insertAfter(this.$element);var l=this.getPosition(),h=n[0].offsetWidth,f=n[0].offsetHeight;if(a){var c=r,u=this.$element.parent(),d=this.getPosition(u);r="bottom"==r&&l.top+l.height+f-d.scroll>d.height?"top":"top"==r&&l.top-d.scroll-f<0?"bottom":"right"==r&&l.right+h>d.width?"left":"left"==r&&l.left-h<d.left?"right":r,n.removeClass(c).addClass(r)}var g=this.getCalculatedOffset(r,l,h,f);this.applyPlacement(g,r);var v=function(){i.$element.trigger("shown.bs."+i.type),i.hoverState=null};t.support.transition&&this.$tip.hasClass("fade")?n.one("bsTransitionEnd",v).emulateTransitionEnd(150):v()}},o.prototype.applyPlacement=function(e,o){var i=this.tip(),n=i[0].offsetWidth,s=i[0].offsetHeight,r=parseInt(i.css("margin-top"),10),p=parseInt(i.css("margin-left"),10);isNaN(r)&&(r=0),isNaN(p)&&(p=0),e.top=e.top+r,e.left=e.left+p,t.offset.setOffset(i[0],t.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),i.addClass("in");var a=i[0].offsetWidth,l=i[0].offsetHeight;"top"==o&&l!=s&&(e.top=e.top+s-l);var h=this.getViewportAdjustedDelta(o,e,a,l);h.left?e.left+=h.left:e.top+=h.top;var f=h.left?2*h.left-n+a:2*h.top-s+l,c=h.left?"left":"top",u=h.left?"offsetWidth":"offsetHeight";i.offset(e),this.replaceArrow(f,i[0][u],c)},o.prototype.replaceArrow=function(t,e,o){this.arrow().css(o,t?50*(1-t/e)+"%":"")},o.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},o.prototype.hide=function(){function e(){"in"!=o.hoverState&&i.detach(),o.$element.trigger("hidden.bs."+o.type)}var o=this,i=this.tip(),n=t.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(n),n.isDefaultPrevented()?void 0:(i.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?i.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),this.hoverState=null,this)},o.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},o.prototype.hasContent=function(){return this.getTitle()},o.prototype.getPosition=function(e){e=e||this.$element;var o=e[0],i="BODY"==o.tagName;return t.extend({},"function"==typeof o.getBoundingClientRect?o.getBoundingClientRect():null,{scroll:i?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop(),width:i?t(window).width():e.outerWidth(),height:i?t(window).height():e.outerHeight()},i?{top:0,left:0}:e.offset())},o.prototype.getCalculatedOffset=function(t,e,o,i){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-o/2}:"top"==t?{top:e.top-i,left:e.left+e.width/2-o/2}:"left"==t?{top:e.top+e.height/2-i/2,left:e.left-o}:{top:e.top+e.height/2-i/2,left:e.left+e.width}},o.prototype.getViewportAdjustedDelta=function(t,e,o,i){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,r=this.getPosition(this.$viewport);if(/right|left/.test(t)){var p=e.top-s-r.scroll,a=e.top+s-r.scroll+i;p<r.top?n.top=r.top-p:a>r.top+r.height&&(n.top=r.top+r.height-a)}else{var l=e.left-s,h=e.left+s+o;l<r.left?n.left=r.left-l:h>r.width&&(n.left=r.left+r.width-h)}return n},o.prototype.getTitle=function(){var t,e=this.$element,o=this.options;return t=e.attr("data-original-title")||("function"==typeof o.title?o.title.call(e[0]):o.title)},o.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},o.prototype.tip=function(){return this.$tip=this.$tip||t(this.options.template)},o.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},o.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},o.prototype.enable=function(){this.enabled=!0},o.prototype.disable=function(){this.enabled=!1},o.prototype.toggleEnabled=function(){this.enabled=!this.enabled},o.prototype.toggle=function(e){var o=this;e&&(o=t(e.currentTarget).data("bs."+this.type),o||(o=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,o))),o.tip().hasClass("in")?o.leave(o):o.enter(o)},o.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var i=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=o,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),n=i.data("bs.popover"),s="object"==typeof e&&e;(n||"destroy"!=e)&&(n||i.data("bs.popover",n=new o(this,s)),"string"==typeof e&&n[e]())})}var o=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");o.VERSION="3.2.0",o.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),o.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),o.prototype.constructor=o,o.prototype.getDefaults=function(){return o.DEFAULTS},o.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),o=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").empty()[this.options.html?"string"==typeof o?"html":"append":"text"](o),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},o.prototype.hasContent=function(){return this.getTitle()||this.getContent()},o.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},o.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},o.prototype.tip=function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip};var i=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=o,t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(jQuery); 11361/* 11362 * Naver v3.0.8 - 2014-05-06 11363 * A jQuery plugin for responsive navigation. Part of the Formstone Library. 11364 * http://formstone.it/naver/ 11365 * 11366 * Copyright 2014 Ben Plum; MIT Licensed 11367 */ 11368 11369 11370!function(a,b){"use strict";function c(b){b=a.extend(!0,{},l,b);for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return c}function d(c,d){if(!c.data("naver")){d=a.extend(!0,{},d,c.data("naver-options"));var f=c.find(".naver-handle").length?c.find(".naver-handle").detach():a('<span class="naver-handle"></span>');c.addClass("naver "+d.customClass).wrapInner('<div class="naver-container"></div>').wrapInner('<div class="naver-wrapper"></div>').prepend(f);var g=a.extend(!0,{$nav:c,$container:c.find(".naver-container"),$wrapper:c.find(".naver-wrapper"),$handle:c.find(".naver-handle")},d);g.$handle.text(d.label?d.labels.closed:""),g.$nav.on("touchstart.naver",".naver-handle",g,e).on("click.naver",".naver-handle",g,h).data("naver",g),void 0!==b.matchMedia&&(g.mediaQuery=b.matchMedia("(max-width:"+(1/0===g.maxWidth?"100000px":g.maxWidth)+")"),g.mediaQuery.addListener(function(){i.apply(g.$nav)}),i.apply(g.$nav))}}function e(a){a.stopPropagation();var b=a.data,c=a.originalEvent;k(b.timer),b.touchStartX=c.touches[0].clientX,b.touchStartY=c.touches[0].clientY,b.$nav.on("touchmove.
11370naver",".naver-handle",b,f).on("touchend.naver",".naver-handle",b,g)}function f(a){var b=a.data,c=a.originalEvent;(Math.abs(c.touches[0].clientX-b.touchStartX)>10||Math.abs(c.touches[0].clientY-b.touchStartY)>10)&&b.$nav.off("touchmove.naver touchend.naver")}function g(a){a.preventDefault(),a.stopPropagation();var b=a.data;b.$nav.off("touchmove.naver touchend.naver click.naver"),b.timer=j(b.timer,1e3,function(){b.$nav.on("click.naver",".naver-handle",b,h)}),h(a)}function h(b){b.preventDefault(),b.stopPropagation();var c=(a(b.currentTarget),b.data);a(".naver").not(c.$nav).naver("close"),c.$nav.hasClass("open")?m.close.apply(c.$nav):m.open.apply(c.$nav)}function i(){var b=a(this).data("naver");b.mediaQuery.matches?m.enable.apply(b.$nav):m.disable.apply(b.$nav)}function j(a,b,c,d){return k(a,d),d===!0?setInterval(c,b):setTimeout(c,b)}function k(a){null!==a&&(clearInterval(a),a=null)}var l={customClass:"",label:!0,labels:{closed:"Navigation",open:"Close"},maxWidth:"980px"},m={close:function(){return a(this).each(function(b,c){var d=a(c).data("naver");d&&d.$nav.hasClass("enabled")&&(d.$wrapper.css({height:0}),d.label&&d.$handle.html(d.labels.closed),d.$nav.removeClass("open").trigger("close.naver"))})},defaults:function(b){return l=a.extend(!0,l,b||{}),a(this)},disable:function(){return a(this).each(function(b,c){var d=a(c).data("naver");d&&(d.$nav.removeClass("enabled"),d.$wrapper.css({height:""}))})},destroy:function(){return a(this).each(function(b,c){var d=a(c).data("naver");d&&(d.$handle.remove(),d.$container.contents().unwrap().unwrap(),d.$nav.removeClass("enabled disabled naver "+d.customClass).off(".naver").removeData("naver"))})},enable:function(){return a(this).each(function(b,c){var d=a(c).data("naver");d&&(d.$nav.addClass("enabled"),m.close.apply(d.$nav))})},open:function(){return a(this).each(function(b,c){var d=a(c).data("naver");d&&d.$nav.hasClass("enabled")&&(d.$wrapper.css({height:d.$container.outerHeight(!0)}),d.label&&d.$handle.html(d.labels.open),d.$nav.addClass("open").trigger("open.naver"))})}};a.fn.naver=function(a){return m[a]?m[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.naver=function(a){"defaults"===a&&m.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window); 11371 11372/* Pre-Define HTML5 Elements in IE */ 11373(function(){ var els = "source|address|article|aside|audio|canvas|command|datalist|details|dialog|figure|figcaption|footer|header|hgroup|keygen|mark|meter|menu|nav|picture|progress|ruby|section|time|video".split('|'); for(var i = 0; i < els.length; i++) { document.createElement(els[i]); } } )(); 11374 11375/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ 11376window.matchMedia || (window.matchMedia = function() { 11377 "use strict"; 11378 11379 // For browsers that support matchMedium api such as IE 9 and webkit 11380 var styleMedia = (window.styleMedia || window.media); 11381 11382 // For those that don't support matchMedium 11383 if (!styleMedia) { 11384 var style = document.createElement('style'), 11385 script = document.getElementsByTagName('script')[0], 11386 info = null; 11387 11388 style.type = 'text/css'; 11389 style.id = 'matchmediajs-test'; 11390 11391 script.parentNode.insertBefore(style, script); 11392 11393 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 11394 info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; 11395 11396 styleMedia = { 11397 matchMedium: function(media) { 11398 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 11399 11400 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 11401 if (style.styleSheet) { 11402 style.styleSheet.cssText = text; 11403 } else { 11404 style.textContent = text; 11405 } 11406 11407 // Test if media query is true or false 11408 return info.width === '1px'; 11409 } 11410 }; 11411 } 11412 11413 return function(media) { 11414 return { 11415 matches: styleMedia.matchMedium(media || 'all'), 11416 media: media || 'all' 11417 }; 11418 }; 11419}()); 11420 11421/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ 11422(function(){ 11423 // Bail out for browsers that have addListener support 11424 if (window.matchMedia && window.matchMedia('all').addListener) { 11425 return false;
11426 } 11427 11428 var localMatchMedia = window.matchMedia, 11429 hasMediaQueries = localMatchMedia('only all').matches, 11430 isListening = false, 11431 timeoutID = 0, // setTimeout for debouncing 'handleChange' 11432 queries = [], // Contains each 'mql' and associated 'listeners' if 'addListener' is used 11433 handleChange = function(evt) { 11434 // Debounce 11435 clearTimeout(timeoutID); 11436 11437 timeoutID = setTimeout(function() { 11438 for (var i = 0, il = queries.length; i < il; i++) { 11439 var mql = queries[i].mql, 11440 listeners = queries[i].listeners || [], 11441 matches = localMatchMedia(mql.media).matches; 11442 11443 // Update mql.matches value and call listeners 11444 // Fire listeners only if transitioning to or from matched state 11445 if (matches !== mql.matches) { 11446 mql.matches = matches; 11447 11448 for (var j = 0, jl = listeners.length; j < jl; j++) { 11449 listeners[j].call(window, mql); 11450 } 11451 } 11452 } 11453 }, 30); 11454 }; 11455 11456 window.matchMedia = function(media) { 11457 var mql = localMatchMedia(media), 11458 listeners = [], 11459 index = 0; 11460 11461 mql.addListener = function(listener) { 11462 // Changes would not occur to css media type so return now (Affects IE <= 8) 11463 if (!hasMediaQueries) { 11464 return; 11465 } 11466 11467 // Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8) 11468 // There should only ever be 1 resize listener running for performance 11469 if (!isListening) { 11470 isListening = true; 11471 window.addEventListener('resize', handleChange, true); 11472 } 11473 11474 // Push object only if it has not been pushed already 11475 if (index === 0) { 11476 index = queries.push({ 11477 mql : mql, 11478 listeners : listeners 11479 }); 11480 } 11481 11482 listeners.push(listener); 11483 }; 11484 11485 mql.removeListener = function(listener) { 11486 for (var i = 0, il = listeners.length; i < il; i++){ 11487 if (listeners[i] === listener){ 11488 listeners.splice(i, 1); 11489 } 11490 } 11491 }; 11492 11493 return mql; 11494 }; 11495}()); 11496// This is a manifest file that'll be compiled into application.js, which will include all the files 11497// listed below. 11498// 11499// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 11500// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 11501// 11502// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 11503// compiled file. 11504// 11505// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11506// about supported directives. 11507// 11508 11509 11510 11511 11512; 11513 11514 11515} 11516/* 11517 FILE ARCHIVED ON 15:34:29 Nov 03, 2022 AND RETRIEVED FROM THE 11518 INTERNET ARCHIVE ON 21:42:31 Jan 06, 2023. 11519 JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. 11520 11521 ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. 11522 SECTION 108(a)(3)). 11523*/ 11524/* 11525playback timings (ms): 11526 captures_list: 322.912 11527 exclusion.robots: 0.178 11528 exclusion.robots.policy: 0.171 11529 cdx.remote: 0.053 11530 esindex: 0.01 11531 LoadShardBlock: 275.727 (3) 11532 PetaboxLoader3.datanode: 175.445 (5) 11533 CDXLines.iter: 20.321 (3) 11534 load_resource: 86.757 11535 PetaboxLoader3.resolve: 42.324 11536 loaddict: 31.53 11537*/
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.