vendor: 24,353 bytes, lines 1-920
1(function( window, undefined ) { 2 3// Use the correct document accordingly with window argument (sandbox) 4var document = window.document, 5 navigator = window.navigator, 6 location = window.location; 7var jQuery = (function() { 8 9// Define a local copy of jQuery 10var jQuery = function( selector, context ) { 11 // The jQuery object is actually just the init constructor 'enhanced' 12 return new jQuery.fn.init( selector, context, rootjQuery ); 13 }, 14 15 // Map over jQuery in case of overwrite 16 _jQuery = window.jQuery, 17 18 // Map over the $ in case of overwrite 19 _$ = window.$, 20 21 // A central reference to the root jQuery(document) 22 rootjQuery, 23 24 // A simple way to check for HTML strings or ID strings 25 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 26 quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 27 28 // Check if a string has a non-whitespace character in it 29 rnotwhite = /\S/, 30 31 // Used for trimming whitespace 32 trimLeft = /^\s+/, 33 trimRight = /\s+$/, 34 35 // Match a standalone tag 36 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 37 38 // JSON RegExp 39 rvalidchars = /^[\],:{}\s]*$/, 40 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 41 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 42 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 43 44 // Useragent RegExp 45 rwebkit = /(webkit)[ \/]([\w.]+)/, 46 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 47 rmsie = /(msie) ([\w.]+)/, 48 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 49 50 // Matches dashed string for camelizing 51 rdashAlpha = /-([a-z]|[0-9])/ig, 52 rmsPrefix = /^-ms-/, 53 54 // Used by jQuery.camelCase as callback to replace() 55 fcamelCase = function( all, letter ) { 56 return ( letter + "" ).toUpperCase(); 57 }, 58 59 // Keep a UserAgent string for use with jQuery.browser 60 userAgent = navigator.userAgent, 61 62 // For matching the engine and version of the browser 63 browserMatch, 64 65 // The deferred used on DOM ready 66 readyList, 67 68 // The ready event handler 69 DOMContentLoaded, 70 71 // Save a reference to some core methods 72 toString = Object.prototype.toString, 73 hasOwn = Object.prototype.hasOwnProperty, 74 push = Array.prototype.push, 75 slice = Array.prototype.slice, 76 trim = String.prototype.trim, 77 indexOf = Array.prototype.indexOf, 78 79 // [[Class]] -> type pairs 80 class2type = {}; 81 82jQuery.fn = jQuery.prototype = { 83 constructor: jQuery, 84 init: function( selector, context, rootjQuery ) { 85 var match, elem, ret, doc; 86 87 // Handle $(""), $(null), or $(undefined) 88 if ( !selector ) { 89 return this; 90 } 91 92 // Handle $(DOMElement) 93 if ( selector.nodeType ) { 94 this.context = this[0] = selector; 95 this.length = 1; 96 return this; 97 } 98 99 // The body element only exists once, optimize finding it 100 if ( selector === "body" && !context && document.body ) { 101 this.context = document; 102 this[0] = document.body; 103 this.selector = selector; 104 this.length = 1; 105 return this; 106 } 107 108 // Handle HTML strings 109 if ( typeof selector === "string" ) { 110 // Are we dealing with HTML string or an ID? 111 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { 112 // Assume that strings that start and end with <> are HTML and skip the regex check 113 match = [ null, selector, null ]; 114 115 } else { 116 match = quickExpr.exec( selector ); 117 } 118 119 // Verify a match, and that no context was specified for #id 120 if ( match && (match[1] || !context) ) { 121 122 // HANDLE: $(html) -> $(array) 123 if ( match[1] ) { 124 context = context instanceof jQuery ? context[0] : context; 125 doc = ( context ? context.ownerDocument || context : document ); 126 127 // If a single string is passed in and it's a single tag 128 // just do a createElement and skip the rest 129 ret = rsingleTag.exec( selector ); 130 131 if ( ret ) { 132 if ( jQuery.isPlainObject( context ) ) { 133 selector = [ document.createElement( ret[1] ) ]; 134 jQuery.fn.attr.call( selector, context, true ); 135 136 } else { 137 selector = [ doc.createElement( ret[1] ) ]; 138 } 139 140 } else { 141 ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); 142 selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; 143 } 144 145 return jQuery.merge( this, selector ); 146 147 // HANDLE: $("#id") 148 } else { 149 elem = document.getElementById( match[2] ); 150 151 // Check parentNode to catch when Blackberry 4.6 returns 152 // nodes that are no longer in the document #6963 153 if ( elem && elem.parentNode ) { 154 // Handle the case where IE and Opera return items 155 // by name instead of ID 156 if ( elem.id !== match[2] ) { 157 return rootjQuery.find( selector ); 158 } 159 160 // Otherwise, we inject the element directly into the jQuery object 161 this.length = 1; 162 this[0] = elem; 163 } 164 165 this.context = document; 166 this.selector = selector; 167 return this; 168 } 169 170 // HANDLE: $(expr, $(...)) 171 } else if ( !context || context.jquery ) { 172 return ( context || rootjQuery ).find( selector ); 173 174 // HANDLE: $(expr, context) 175 // (which is just equivalent to: $(context).find(expr) 176 } else { 177 return this.constructor( context ).find( selector ); 178 } 179 180 // HANDLE: $(function) 181 // Shortcut for document ready 182 } else if ( jQuery.isFunction( selector ) ) { 183 return rootjQuery.ready( selector ); 184 } 185 186 if ( selector.selector !== undefined ) { 187 this.selector = selector.selector; 188 this.context = selector.context; 189 } 190 191 return jQuery.makeArray( selector, this ); 192 }, 193 194 // Start with an empty selector 195 selector: "", 196 197 // The current version of jQuery being used 198 jquery: "1.7.2", 199 200 // The default length of a jQuery object is 0 201 length: 0, 202 203 // The number of elements contained in the matched element set 204 size: function() { 205 return this.length; 206 }, 207 208 toArray: function() { 209 return slice.call( this, 0 ); 210 }, 211 212 // Get the Nth element in the matched element set OR 213 // Get the whole matched element set as a clean array 214 get: function( num ) { 215 return num == null ? 216 217 // Return a 'clean' array 218 this.toArray() : 219 220 // Return just the object 221 ( num < 0 ? this[ this.length + num ] : this[ num ] ); 222 }, 223 224 // Take an array of elements and push it onto the stack 225 // (returning the new matched element set) 226 pushStack: function( elems, name, selector ) { 227 // Build a new jQuery matched element set 228 var ret = this.constructor(); 229 230 if ( jQuery.isArray( elems ) ) { 231 push.apply( ret, elems ); 232 233 } else { 234 jQuery.merge( ret, elems ); 235 } 236 237 // Add the old object onto the stack (as a reference) 238 ret.prevObject = this; 239 240 ret.context = this.context; 241 242 if ( name === "find" ) { 243 ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; 244 } else if ( name ) { 245 ret.selector = this.selector + "." + name + "(" + selector + ")"; 246 } 247 248 // Return the newly-formed element set 249 return ret; 250 }, 251 252 // Execute a callback for every element in the matched set. 253 // (You can seed the arguments with an array of args, but this is 254 // only used internally.) 255 each: function( callback, args ) { 256 return jQuery.each( this, callback, args ); 257 }, 258 259 ready: function( fn ) { 260 // Attach the listeners 261 jQuery.bindReady(); 262 263 // Add the callback 264 readyList.add( fn ); 265 266 return this; 267 }, 268 269 eq: function( i ) { 270 i = +i; 271 return i === -1 ? 272 this.slice( i ) : 273 this.slice( i, i + 1 ); 274 }, 275 276 first: function() { 277 return this.eq( 0 ); 278 }, 279 280 last: function() { 281 return this.eq( -1 ); 282 }, 283 284 slice: function() { 285 return this.pushStack( slice.apply( this, arguments ), 286 "slice", slice.call(arguments).join(",") ); 287 }, 288 289 map: function( callback ) { 290 return this.pushStack( jQuery.map(this, function( elem, i ) { 291 return callback.call( elem, i, elem ); 292 })); 293 }, 294 295 end: function() { 296 return this.prevObject || this.constructor(null); 297 }, 298 299 // For internal use only. 300 // Behaves like an Array's method, not like a jQuery method. 301 push: push, 302 sort: [].sort, 303 splice: [].splice 304}; 305 306// Give the init function the jQuery prototype for later instantiation 307jQuery.fn.init.prototype = jQuery.fn; 308 309jQuery.extend = jQuery.fn.extend = function() { 310 var options, name, src, copy, copyIsArray, clone, 311 target = arguments[0] || {}, 312 i = 1, 313 length = arguments.length, 314 deep = false; 315 316 // Handle a deep copy situation 317 if ( typeof target === "boolean" ) { 318 deep = target; 319 target = arguments[1] || {}; 320 // skip the boolean and the target 321 i = 2; 322 } 323 324 // Handle case when target is a string or something (possible in deep copy) 325 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 326 target = {}; 327 } 328 329 // extend jQuery itself if only one argument is passed 330 if ( length === i ) { 331 target = this; 332 --i; 333 } 334 335 for ( ; i < length; i++ ) { 336 // Only deal with non-null/undefined values 337 if ( (options = arguments[ i ]) != null ) { 338 // Extend the base object 339 for ( name in options ) { 340 src = target[ name ]; 341 copy = options[ name ]; 342 343 // Prevent never-ending loop 344 if ( target === copy ) { 345 continue; 346 } 347 348 // Recurse if we're merging plain objects or arrays 349 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 350 if ( copyIsArray ) { 351 copyIsArray = false; 352 clone = src && jQuery.isArray(src) ? src : []; 353 354 } else { 355 clone = src && jQuery.isPlainObject(src) ? src : {}; 356 } 357 358 // Never move original objects, clone them 359 target[ name ] = jQuery.extend( deep, clone, copy ); 360 361 // Don't bring in undefined values 362 } else if ( copy !== undefined ) { 363 target[ name ] = copy; 364 } 365 } 366 } 367 } 368 369 // Return the modified object 370 return target; 371}; 372 373jQuery.extend({ 374 noConflict: function( deep ) { 375 if ( window.$ === jQuery ) { 376 window.$ = _$; 377 } 378 379 if ( deep && window.jQuery === jQuery ) { 380 window.jQuery = _jQuery; 381 } 382 383 return jQuery; 384 }, 385 386 // Is the DOM ready to be used? Set to true once it occurs. 387 isReady: false, 388 389 // A counter to track how many items to wait for before 390 // the ready event fires. See #6781 391 readyWait: 1, 392 393 // Hold (or release) the ready event 394 holdReady: function( hold ) { 395 if ( hold ) { 396 jQuery.readyWait++; 397 } else { 398 jQuery.ready( true ); 399 } 400 }, 401 402 // Handle when the DOM is ready 403 ready: function( wait ) { 404 // Either a released hold or an DOMready/load event and not yet ready 405 if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { 406 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 407 if ( !document.body ) { 408 return setTimeout( jQuery.ready, 1 ); 409 } 410 411 // Remember that the DOM is ready 412 jQuery.isReady = true; 413 414 // If a normal DOM Ready event fired, decrement, and wait if need be 415 if ( wait !== true && --jQuery.readyWait > 0 ) { 416 return; 417 } 418 419 // If there are functions bound, to execute 420 readyList.fireWith( document, [ jQuery ] ); 421 422 // Trigger any bound ready events 423 if ( jQuery.fn.trigger ) { 424 jQuery( document ).trigger( "ready" ).off( "ready" ); 425 } 426 } 427 }, 428 429 bindReady: function() { 430 if ( readyList ) { 431 return; 432 } 433 434 readyList = jQuery.Callbacks( "once memory" ); 435 436 // Catch cases where $(document).ready() is called after the 437 // browser event has already occurred. 438 if ( document.readyState === "complete" ) { 439 // Handle it asynchronously to allow scripts the opportunity to delay ready 440 return setTimeout( jQuery.ready, 1 ); 441 } 442 443 // Mozilla, Opera and webkit nightlies currently support this event 444 if ( document.addEventListener ) { 445 // Use the handy event callback 446 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 447 448 // A fallback to window.onload, that will always work 449 window.addEventListener( "load", jQuery.ready, false ); 450 451 // If IE event model is used 452 } else if ( document.attachEvent ) { 453 // ensure firing before onload, 454 // maybe late but safe also for iframes 455 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 456 457 // A fallback to window.onload, that will always work 458 window.attachEvent( "onload", jQuery.ready ); 459 460 // If IE and not a frame 461 // continually check to see if the document is ready 462 var toplevel = false; 463 464 try { 465 toplevel = window.frameElement == null; 466 } catch(e) {} 467 468 if ( document.documentElement.doScroll && toplevel ) { 469 doScrollCheck(); 470 } 471 } 472 }, 473 474 // See test/unit/core.js for details concerning isFunction. 475 // Since version 1.3, DOM methods and functions like alert 476 // aren't supported. They return false on IE (#2968). 477 isFunction: function( obj ) { 478 return jQuery.type(obj) === "function"; 479 }, 480 481 isArray: Array.isArray || function( obj ) { 482 return jQuery.type(obj) === "array"; 483 }, 484 485 isWindow: function( obj ) { 486 return obj != null && obj == obj.window; 487 }, 488 489 isNumeric: function( obj ) { 490 return !isNaN( parseFloat(obj) ) && isFinite( obj ); 491 }, 492 493 type: function( obj ) { 494 return obj == null ? 495 String( obj ) : 496 class2type[ toString.call(obj) ] || "object"; 497 }, 498 499 isPlainObject: function( obj ) { 500 // Must be an Object. 501 // Because of IE, we also have to check the presence of the constructor property. 502 // Make sure that DOM nodes and window objects don't pass through, as well 503 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 504 return false; 505 } 506 507 try { 508 // Not own constructor property must be Object 509 if ( obj.constructor && 510 !hasOwn.call(obj, "constructor") && 511 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 512 return false; 513 } 514 } catch ( e ) { 515 // IE8,9 Will throw exceptions on certain host objects #9897 516 return false; 517 } 518 519 // Own properties are enumerated firstly, so to speed up, 520 // if last one is own, then all properties are own. 521 522 var key; 523 for ( key in obj ) {} 524 525 return key === undefined || hasOwn.call( obj, key ); 526 }, 527 528 isEmptyObject: function( obj ) { 529 for ( var name in obj ) { 530 return false; 531 } 532 return true; 533 }, 534 535 error: function( msg ) { 536 throw new Error( msg ); 537 }, 538 539 parseJSON: function( data ) { 540 if ( typeof data !== "string" || !data ) { 541 return null; 542 } 543 544 // Make sure leading/trailing whitespace is removed (IE can't handle it) 545 data = jQuery.trim( data ); 546 547 // Attempt to parse using the native JSON parser first 548 if ( window.JSON && window.JSON.parse ) { 549 return window.JSON.parse( data ); 550 } 551 552 // Make sure the incoming data is actual JSON 553 // Logic borrowed from http://json.org/json2.js 554 if ( rvalidchars.test( data.replace( rvalidescape, "@" ) 555 .replace( rvalidtokens, "]" ) 556 .replace( rvalidbraces, "")) ) { 557 558 return ( new Function( "return " + data ) )(); 559 560 } 561 jQuery.error( "Invalid JSON: " + data ); 562 }, 563 564 // Cross-browser xml parsing 565 parseXML: function( data ) { 566 if ( typeof data !== "string" || !data ) { 567 return null; 568 } 569 var xml, tmp; 570 try { 571 if ( window.DOMParser ) { // Standard 572 tmp = new DOMParser(); 573 xml = tmp.parseFromString( data , "text/xml" ); 574 } else { // IE 575 xml = new ActiveXObject( "Microsoft.XMLDOM" ); 576 xml.async = "false"; 577 xml.loadXML( data ); 578 } 579 } catch( e ) { 580 xml = undefined; 581 } 582 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 583 jQuery.error( "Invalid XML: " + data ); 584 } 585 return xml; 586 }, 587 588 noop: function() {}, 589 590 // Evaluates a script in a global context 591 // Workarounds based on findings by Jim Driscoll 592 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 593 globalEval: function( data ) { 594 if ( data && rnotwhite.test( data ) ) { 595 // We use execScript on Internet Explorer 596 // We use an anonymous function so that context is window 597 // rather than jQuery in Firefox 598 ( window.execScript || function( data ) { 599 window[ "eval" ].call( window, data ); 600 } )( data ); 601 } 602 }, 603 604 // Convert dashed to camelCase; used by the css and data modules 605 // Microsoft forgot to hump their vendor prefix (#9572) 606 camelCase: function( string ) { 607 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 608 }, 609 610 nodeName: function( elem, name ) { 611 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 612 }, 613 614 // args is for internal usage only 615 each: function( object, callback, args ) { 616 var name, i = 0, 617 length = object.length, 618 isObj = length === undefined || jQuery.isFunction( object ); 619 620 if ( args ) { 621 if ( isObj ) { 622 for ( name in object ) { 623 if ( callback.apply( object[ name ], args ) === false ) { 624 break; 625 } 626 } 627 } else { 628 for ( ; i < length; ) { 629 if ( callback.apply( object[ i++ ], args ) === false ) { 630 break; 631 } 632 } 633 } 634 635 // A special, fast, case for the most common use of each 636 } else { 637 if ( isObj ) { 638 for ( name in object ) { 639 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { 640 break; 641 } 642 } 643 } else { 644 for ( ; i < length; ) { 645 if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { 646 break; 647 } 648 } 649 } 650 } 651 652 return object; 653 }, 654 655 // Use native String.trim function wherever possible 656 trim: trim ? 657 function( text ) { 658 return text == null ? 659 "" : 660 trim.call( text ); 661 } : 662 663 // Otherwise use our own trimming functionality 664 function( text ) { 665 return text == null ? 666 "" : 667 text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); 668 }, 669 670 // results is for internal usage only 671 makeArray: function( array, results ) { 672 var ret = results || []; 673 674 if ( array != null ) { 675 // The window, strings (and functions) also have 'length' 676 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 677 var type = jQuery.type( array ); 678 679 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { 680 push.call( ret, array ); 681 } else { 682 jQuery.merge( ret, array ); 683 } 684 } 685 686 return ret; 687 }, 688 689 inArray: function( elem, array, i ) { 690 var len; 691 692 if ( array ) { 693 if ( indexOf ) { 694 return indexOf.call( array, elem, i ); 695 } 696 697 len = array.length; 698 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 699 700 for ( ; i < len; i++ ) { 701 // Skip accessing in sparse arrays 702 if ( i in array && array[ i ] === elem ) { 703 return i; 704 } 705 } 706 } 707 708 return -1; 709 }, 710 711 merge: function( first, second ) { 712 var i = first.length, 713 j = 0; 714 715 if ( typeof second.length === "number" ) { 716 for ( var l = second.length; j < l; j++ ) { 717 first[ i++ ] = second[ j ]; 718 } 719 720 } else { 721 while ( second[j] !== undefined ) { 722 first[ i++ ] = second[ j++ ]; 723 } 724 } 725 726 first.length = i; 727 728 return first; 729 }, 730 731 grep: function( elems, callback, inv ) { 732 var ret = [], retVal; 733 inv = !!inv; 734 735 // Go through the array, only saving the items 736 // that pass the validator function 737 for ( var i = 0, length = elems.length; i < length; i++ ) { 738 retVal = !!callback( elems[ i ], i ); 739 if ( inv !== retVal ) { 740 ret.push( elems[ i ] ); 741 } 742 } 743 744 return ret; 745 }, 746 747 // arg is for internal usage only 748 map: function( elems, callback, arg ) { 749 var value, key, ret = [], 750 i = 0, 751 length = elems.length, 752 // jquery objects are treated as arrays 753 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; 754 755 // Go through the array, translating each of the items to their 756 if ( isArray ) { 757 for ( ; i < length; i++ ) { 758 value = callback( elems[ i ], i, arg ); 759 760 if ( value != null ) { 761 ret[ ret.length ] = value; 762 } 763 } 764 765 // Go through every key on the object, 766 } else { 767 for ( key in elems ) { 768 value = callback( elems[ key ], key, arg ); 769 770 if ( value != null ) { 771 ret[ ret.length ] = value; 772 } 773 } 774 } 775 776 // Flatten any nested arrays 777 return ret.concat.apply( [], ret ); 778 }, 779 780 // A global GUID counter for objects 781 guid: 1, 782 783 // Bind a function to a context, optionally partially applying any 784 // arguments. 785 proxy: function( fn, context ) { 786 if ( typeof context === "string" ) { 787 var tmp = fn[ context ]; 788 context = fn; 789 fn = tmp; 790 } 791 792 // Quick check to determine if target is callable, in the spec 793 // this throws a TypeError, but we will just return undefined. 794 if ( !jQuery.isFunction( fn ) ) { 795 return undefined; 796 } 797 798 // Simulated bind 799 var args = slice.call( arguments, 2 ), 800 proxy = function() { 801 return fn.apply( context, args.concat( slice.call( arguments ) ) ); 802 }; 803 804 // Set the guid of unique handler to the same of original handler, so it can be removed 805 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 806 807 return proxy; 808 }, 809 810 // Mutifunctional method to get and set values to a collection 811 // The value/s can optionally be executed if it's a function 812 access: function( elems, fn, key, value, chainable, emptyGet, pass ) { 813 var exec, 814 bulk = key == null, 815 i = 0, 816 length = elems.length; 817 818 // Sets many values 819 if ( key && typeof key === "object" ) { 820 for ( i in key ) { 821 jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); 822 } 823 chainable = 1; 824 825 // Sets one value 826 } else if ( value !== undefined ) { 827 // Optionally, function values get executed if exec is true 828 exec = pass === undefined && jQuery.isFunction( value ); 829 830 if ( bulk ) { 831 // Bulk operations only iterate when executing function values 832 if ( exec ) { 833 exec = fn; 834 fn = function( elem, key, value ) { 835 return exec.call( jQuery( elem ), value ); 836 }; 837 838 // Otherwise they run against the entire set 839 } else { 840 fn.call( elems, value ); 841 fn = null; 842 } 843 } 844 845 if ( fn ) { 846 for (; i < length; i++ ) { 847 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); 848 } 849 } 850 851 chainable = 1; 852 } 853 854 return chainable ? 855 elems : 856 857 // Gets 858 bulk ? 859 fn.call( elems ) : 860 length ? fn( elems[0], key ) : emptyGet; 861 }, 862 863 now: function() { 864 return ( new Date() ).getTime(); 865 }, 866 867 // Use of jQuery.browser is frowned upon. 868 // More details: http://docs.jquery.com/Utilities/jQuery.browser 869 uaMatch: function( ua ) { 870 ua = ua.toLowerCase(); 871 872 var match = rwebkit.exec( ua ) || 873 ropera.exec( ua ) || 874 rmsie.exec( ua ) || 875 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 876 []; 877 878 return { browser: match[1] || "", version: match[2] || "0" }; 879 }, 880 881 sub: function() { 882 function jQuerySub( selector, context ) { 883 return new jQuerySub.fn.init( selector, context ); 884 } 885 jQuery.extend( true, jQuerySub, this ); 886 jQuerySub.superclass = this; 887 jQuerySub.fn = jQuerySub.prototype = this(); 888 jQuerySub.fn.constructor = jQuerySub; 889 jQuerySub.sub = this.sub; 890 jQuerySub.fn.init = function init( selector, context ) { 891 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { 892 context = jQuerySub( context ); 893 } 894 895 return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); 896 }; 897 jQuerySub.fn.init.prototype = jQuerySub.fn; 898 var rootjQuerySub = jQuerySub(document); 899 return jQuerySub; 900 }, 901 902 browser: {} 903}); 904 905// Populate the class2type map 906jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { 907 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 908}); 909 910browserMatch = jQuery.uaMatch( userAgent ); 911if ( browserMatch.browser ) { 912 jQuery.browser[ browserMatch.browser ] = true; 913 jQuery.browser.version = browserMatch.version; 914} 915 916// Deprecated, use jQuery.browser.webkit instead 917if ( jQuery.browser.webkit ) { 918 jQuery.browser.safari = true; 919} 920
921// IE doesn't match non-breaking spaces with \s 922if ( rnotwhite.test( "\xA0" ) ) { 923 trimLeft = /^[\s\xA0]+/; 924 trimRight = /[\s\xA0]+$/; 925} 926 927// All jQuery objects should point back to these 928rootjQuery = jQuery(document); 929 930// Cleanup functions for the document ready method 931if ( document.addEventListener ) { 932 DOMContentLoaded = function() { 933 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 934 jQuery.ready(); 935 }; 936 937} else if ( document.attachEvent ) { 938 DOMContentLoaded = function() { 939 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 940 if ( document.readyState === "complete" ) { 941 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 942 jQuery.ready(); 943 } 944 }; 945} 946 947// The DOM ready check for Internet Explorer 948function doScrollCheck() { 949 if ( jQuery.isReady ) { 950 return; 951 } 952 953 try { 954 // If IE is used, use the trick by Diego Perini 955 // http://javascript.nwbox.com/IEContentLoaded/ 956 document.documentElement.doScroll("left"); 957 } catch(e) { 958 setTimeout( doScrollCheck, 1 ); 959 return; 960 } 961 962 // and execute any waiting functions 963 jQuery.ready(); 964} 965 966return jQuery; 967 968})(); 969 970 971// String to Object flags format cache 972var flagsCache = {}; 973 974// Convert String-formatted flags into Object-formatted ones and store in cache 975function createFlags( flags ) { 976 var object = flagsCache[ flags ] = {}, 977 i, length; 978 flags = flags.split( /\s+/ ); 979 for ( i = 0, length = flags.length; i < length; i++ ) { 980 object[ flags[i] ] = true; 981 } 982 return object; 983} 984 985/* 986 * Create a callback list using the following parameters: 987 * 988 * flags: an optional list of space-separated flags that will change how 989 * the callback list behaves 990 * 991 * By default a callback list will act like an event callback list and can be 992 * "fired" multiple times. 993 * 994 * Possible flags: 995 * 996 * once: will ensure the callback list can only be fired once (like a Deferred) 997 * 998 * memory: will keep track of previous values and will call any callback added 999 * after the list has been fired right away with the latest "memorized" 1000 * values (like a Deferred) 1001 * 1002 * unique: will ensure a callback can only be added once (no duplicate in the list) 1003 * 1004 * stopOnFalse: interrupt callings when a callback returns false 1005 * 1006 */ 1007jQuery.Callbacks = function( flags ) { 1008 1009 // Convert flags from String-formatted to Object-formatted 1010 // (we check in cache first) 1011 flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; 1012 1013 var // Actual callback list 1014 list = [], 1015 // Stack of fire calls for repeatable lists 1016 stack = [], 1017 // Last fire value (for non-forgettable lists) 1018 memory, 1019 // Flag to know if list was already fired 1020 fired, 1021 // Flag to know if list is currently firing 1022 firing, 1023 // First callback to fire (used internally by add and fireWith) 1024 firingStart, 1025 // End of the loop when firing 1026 firingLength, 1027 // Index of currently firing callback (modified by remove if needed) 1028 firingIndex, 1029 // Add one or several callbacks to the list 1030 add = function( args ) { 1031 var i, 1032 length, 1033 elem, 1034 type, 1035 actual; 1036 for ( i = 0, length = args.length; i < length; i++ ) { 1037 elem = args[ i ]; 1038 type = jQuery.type( elem ); 1039 if ( type === "array" ) { 1040 // Inspect recursively 1041 add( elem ); 1042 } else if ( type === "function" ) { 1043 // Add if not in unique mode and callback is not in 1044 if ( !flags.unique || !self.has( elem ) ) { 1045 list.push( elem ); 1046 } 1047 } 1048 } 1049 }, 1050 // Fire callbacks 1051 fire = function( context, args ) { 1052 args = args || []; 1053 memory = !flags.memory || [ context, args ]; 1054 fired = true; 1055 firing = true; 1056 firingIndex = firingStart || 0; 1057 firingStart = 0; 1058 firingLength = list.length; 1059 for ( ; list && firingIndex < firingLength; firingIndex++ ) { 1060 if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { 1061 memory = true; // Mark as halted 1062 break; 1063 } 1064 } 1065 firing = false; 1066 if ( list ) { 1067 if ( !flags.once ) { 1068 if ( stack && stack.length ) { 1069 memory = stack.shift(); 1070 self.fireWith( memory[ 0 ], memory[ 1 ] ); 1071 } 1072 } else if ( memory === true ) { 1073 self.disable(); 1074 } else { 1075 list = []; 1076 } 1077 } 1078 }, 1079 // Actual Callbacks object 1080 self = { 1081 // Add a callback or a collection of callbacks to the list 1082 add: function() { 1083 if ( list ) { 1084 var length = list.length; 1085 add( arguments ); 1086 // Do we need to add the callbacks to the 1087 // current firing batch? 1088 if ( firing ) { 1089 firingLength = list.length; 1090 // With memory, if we're not firing then 1091 // we should call right away, unless previous 1092 // firing was halted (stopOnFalse) 1093 } else if ( memory && memory !== true ) { 1094 firingStart = length; 1095 fire( memory[ 0 ], memory[ 1 ] ); 1096 } 1097 } 1098 return this; 1099 }, 1100 // Remove a callback from the list 1101 remove: function() { 1102 if ( list ) { 1103 var args = arguments, 1104 argIndex = 0, 1105 argLength = args.length; 1106 for ( ; argIndex < argLength ; argIndex++ ) { 1107 for ( var i = 0; i < list.length; i++ ) { 1108 if ( args[ argIndex ] === list[ i ] ) { 1109 // Handle firingIndex and firingLength 1110 if ( firing ) { 1111 if ( i <= firingLength ) { 1112 firingLength--; 1113 if ( i <= firingIndex ) { 1114 firingIndex--; 1115 } 1116 } 1117 } 1118 // Remove the element 1119 list.splice( i--, 1 ); 1120 // If we have some unicity property then 1121 // we only need to do this once 1122 if ( flags.unique ) { 1123 break; 1124 } 1125 } 1126 } 1127 } 1128 } 1129 return this; 1130 }, 1131 // Control if a given callback is in the list 1132 has: function( fn ) { 1133 if ( list ) { 1134 var i = 0, 1135 length = list.length; 1136 for ( ; i < length; i++ ) { 1137 if ( fn === list[ i ] ) { 1138 return true; 1139 } 1140 } 1141 } 1142 return false; 1143 }, 1144 // Remove all callbacks from the list 1145 empty: function() { 1146 list = []; 1147 return this; 1148 }, 1149 // Have the list do nothing anymore 1150 disable: function() { 1151 list = stack = memory = undefined; 1152 return this; 1153 }, 1154 // Is it disabled? 1155 disabled: function() { 1156 return !list; 1157 }, 1158 // Lock the list in its current state 1159 lock: function() { 1160 stack = undefined; 1161 if ( !memory || memory === true ) { 1162 self.disable(); 1163 } 1164 return this; 1165 }, 1166 // Is it locked? 1167 locked: function() { 1168 return !stack; 1169 }, 1170 // Call all callbacks with the given context and arguments 1171 fireWith: function( context, args ) { 1172 if ( stack ) { 1173 if ( firing ) { 1174 if ( !flags.once ) { 1175 stack.push( [ context, args ] ); 1176 } 1177 } else if ( !( flags.once && memory ) ) { 1178 fire( context, args ); 1179 } 1180 } 1181 return this; 1182 }, 1183 // Call all the callbacks with the given arguments 1184 fire: function() { 1185 self.fireWith( this, arguments ); 1186 return this; 1187 }, 1188 // To know if the callbacks have already been called at least once 1189 fired: function() { 1190 return !!fired; 1191 } 1192 }; 1193 1194 return self; 1195}; 1196 1197 1198 1199 1200var // Static reference to slice 1201 sliceDeferred = [].slice; 1202 1203jQuery.extend({ 1204 1205 Deferred: function( func ) { 1206 var doneList = jQuery.Callbacks( "once memory" ), 1207 failList = jQuery.Callbacks( "once memory" ), 1208 progressList = jQuery.Callbacks( "memory" ), 1209 state = "pending", 1210 lists = { 1211 resolve: doneList, 1212 reject: failList, 1213 notify: progressList 1214 }, 1215 promise = { 1216 done: doneList.add, 1217 fail: failList.add, 1218 progress: progressList.add, 1219 1220 state: function() { 1221 return state; 1222 }, 1223 1224 // Deprecated 1225 isResolved: doneList.fired, 1226 isRejected: failList.fired, 1227 1228 then: function( doneCallbacks, failCallbacks, progressCallbacks ) { 1229 deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); 1230 return this; 1231 }, 1232 always: function() { 1233 deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); 1234 return this; 1235 }, 1236 pipe: function( fnDone, fnFail, fnProgress ) { 1237 return jQuery.Deferred(function( newDefer ) { 1238 jQuery.each( { 1239 done: [ fnDone, "resolve" ], 1240 fail: [ fnFail, "reject" ], 1241 progress: [ fnProgress, "notify" ] 1242 }, function( handler, data ) { 1243 var fn = data[ 0 ], 1244 action = data[ 1 ], 1245 returned; 1246 if ( jQuery.isFunction( fn ) ) { 1247 deferred[ handler ](function() { 1248 returned = fn.apply( this, arguments ); 1249 if ( returned && jQuery.isFunction( returned.promise ) ) { 1250 returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); 1251 } else { 1252 newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); 1253 } 1254 });
1255 } else { 1256 deferred[ handler ]( newDefer[ action ] ); 1257 } 1258 }); 1259 }).promise(); 1260 }, 1261 // Get a promise for this deferred 1262 // If obj is provided, the promise aspect is added to the object 1263 promise: function( obj ) { 1264 if ( obj == null ) { 1265 obj = promise; 1266 } else { 1267 for ( var key in promise ) { 1268 obj[ key ] = promise[ key ]; 1269 } 1270 } 1271 return obj; 1272 } 1273 }, 1274 deferred = promise.promise({}), 1275 key; 1276 1277 for ( key in lists ) { 1278 deferred[ key ] = lists[ key ].fire; 1279 deferred[ key + "With" ] = lists[ key ].fireWith; 1280 } 1281 1282 // Handle state 1283 deferred.done( function() { 1284 state = "resolved"; 1285 }, failList.disable, progressList.lock ).fail( function() { 1286 state = "rejected"; 1287 }, doneList.disable, progressList.lock ); 1288 1289 // Call given func if any 1290 if ( func ) { 1291 func.call( deferred, deferred ); 1292 } 1293 1294 // All done! 1295 return deferred; 1296 }, 1297 1298 // Deferred helper 1299 when: function( firstParam ) { 1300 var args = sliceDeferred.call( arguments, 0 ), 1301 i = 0, 1302 length = args.length, 1303 pValues = new Array( length ), 1304 count = length, 1305 pCount = length, 1306 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? 1307 firstParam : 1308 jQuery.Deferred(), 1309 promise = deferred.promise(); 1310 function resolveFunc( i ) { 1311 return function( value ) { 1312 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1313 if ( !( --count ) ) { 1314 deferred.resolveWith( deferred, args ); 1315 } 1316 }; 1317 } 1318 function progressFunc( i ) { 1319 return function( value ) { 1320 pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1321 deferred.notifyWith( promise, pValues ); 1322 }; 1323 } 1324 if ( length > 1 ) { 1325 for ( ; i < length; i++ ) { 1326 if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { 1327 args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); 1328 } else { 1329 --count; 1330 } 1331 } 1332 if ( !count ) { 1333 deferred.resolveWith( deferred, args ); 1334 } 1335 } else if ( deferred !== firstParam ) { 1336 deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); 1337 } 1338 return promise; 1339 } 1340}); 1341 1342 1343 1344 1345jQuery.support = (function() { 1346 1347 var support, 1348 all, 1349 a, 1350 select, 1351 opt, 1352 input, 1353 fragment, 1354 tds, 1355 events, 1356 eventName, 1357 i, 1358 isSupported, 1359 div = document.createElement( "div" ), 1360 documentElement = document.documentElement; 1361 1362 // Preliminary tests 1363 div.setAttribute("className", "t"); 1364 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; 1365 1366 all = div.getElementsByTagName( "*" ); 1367 a = div.getElementsByTagName( "a" )[ 0 ]; 1368 1369 // Can't get basic test support 1370 if ( !all || !all.length || !a ) { 1371 return {}; 1372 } 1373 1374 // First batch of supports tests 1375 select = document.createElement( "select" ); 1376 opt = select.appendChild( document.createElement("option") ); 1377 input = div.getElementsByTagName( "input" )[ 0 ]; 1378 1379 support = { 1380 // IE strips leading whitespace when .innerHTML is used 1381 leadingWhitespace: ( div.firstChild.nodeType === 3 ), 1382 1383 // Make sure that tbody elements aren't automatically inserted 1384 // IE will insert them into empty tables 1385 tbody: !div.getElementsByTagName("tbody").length, 1386 1387 // Make sure that link elements get serialized correctly by innerHTML 1388 // This requires a wrapper element in IE 1389 htmlSerialize: !!div.getElementsByTagName("link").length, 1390 1391 // Get the style information from getAttribute 1392 // (IE uses .cssText instead) 1393 style: /top/.test( a.getAttribute("style") ), 1394 1395 // Make sure that URLs aren't manipulated 1396 // (IE normalizes it by default) 1397 hrefNormalized: ( a.getAttribute("href") === "/a" ), 1398 1399 // Make sure that element opacity exists 1400 // (IE uses filter instead) 1401 // Use a regex to work around a WebKit issue. See #5145 1402 opacity: /^0.55/.test( a.style.opacity ), 1403 1404 // Verify style float existence 1405 // (IE uses styleFloat instead of cssFloat) 1406 cssFloat: !!a.style.cssFloat, 1407 1408 // Make sure that if no value is specified for a checkbox 1409 // that it defaults to "on". 1410 // (WebKit defaults to "" instead) 1411 checkOn: ( input.value === "on" ), 1412 1413 // Make sure that a selected-by-default option has a working selected property. 1414 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 1415 optSelected: opt.selected, 1416 1417 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) 1418 getSetAttribute: div.className !== "t", 1419 1420 // Tests for enctype support on a form(#6743) 1421 enctype: !!document.createElement("form").enctype, 1422 1423 // Makes sure cloning an html5 element does not cause problems 1424 // Where outerHTML is undefined, this still works 1425 html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", 1426 1427 // Will be defined later 1428 submitBubbles: true, 1429 changeBubbles: true, 1430 focusinBubbles: false, 1431 deleteExpando: true, 1432 noCloneEvent: true, 1433 inlineBlockNeedsLayout: false, 1434 shrinkWrapBlocks: false, 1435 reliableMarginRight: true, 1436 pixelMargin: true 1437 }; 1438 1439 // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead 1440 jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); 1441 1442 // Make sure checked status is properly cloned 1443 input.checked = true; 1444 support.noCloneChecked = input.cloneNode( true ).checked; 1445 1446 // Make sure that the options inside disabled selects aren't marked as disabled 1447 // (WebKit marks them as disabled) 1448 select.disabled = true; 1449 support.optDisabled = !opt.disabled; 1450 1451 // Test to see if it's possible to delete an expando from an element 1452 // Fails in Internet Explorer 1453 try { 1454 delete div.test; 1455 } catch( e ) { 1456 support.deleteExpando = false; 1457 } 1458 1459 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { 1460 div.attachEvent( "onclick", function() { 1461 // Cloning a node shouldn't copy over any 1462 // bound event handlers (IE does this) 1463 support.noCloneEvent = false; 1464 }); 1465 div.cloneNode( true ).fireEvent( "onclick" ); 1466 } 1467 1468 // Check if a radio maintains its value 1469 // after being appended to the DOM 1470 input = document.createElement("input"); 1471 input.value = "t"; 1472 input.setAttribute("type", "radio"); 1473 support.radioValue = input.value === "t"; 1474 1475 input.setAttribute("checked", "checked"); 1476 1477 // #11217 - WebKit loses check when the name is after the checked attribute 1478 input.setAttribute( "name", "t" ); 1479 1480 div.appendChild( input ); 1481 fragment = document.createDocumentFragment();
1482 fragment.appendChild( div.lastChild ); 1483 1484 // WebKit doesn't clone checked state correctly in fragments 1485 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; 1486 1487 // Check if a disconnected checkbox will retain its checked 1488 // value of true after appended to the DOM (IE6/7) 1489 support.appendChecked = input.checked; 1490 1491 fragment.removeChild( input ); 1492 fragment.appendChild( div ); 1493 1494 // Technique from Juriy Zaytsev 1495 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 1496 // We only care about the case where non-standard event systems 1497 // are used, namely in IE. Short-circuiting here helps us to 1498 // avoid an eval call (in setAttribute) which can cause CSP 1499 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP 1500 if ( div.attachEvent ) { 1501 for ( i in { 1502 submit: 1, 1503 change: 1, 1504 focusin: 1 1505 }) { 1506 eventName = "on" + i; 1507 isSupported = ( eventName in div ); 1508 if ( !isSupported ) { 1509 div.setAttribute( eventName, "return;" ); 1510 isSupported = ( typeof div[ eventName ] === "function" ); 1511 } 1512 support[ i + "Bubbles" ] = isSupported; 1513 } 1514 } 1515 1516 fragment.removeChild( div ); 1517 1518 // Null elements to avoid leaks in IE 1519 fragment = select = opt = div = input = null; 1520 1521 // Run tests that need a body at doc ready 1522 jQuery(function() { 1523 var container, outer, inner, table, td, offsetSupport, 1524 marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, 1525 paddingMarginBorderVisibility, paddingMarginBorder, 1526 body = document.getElementsByTagName("body")[0]; 1527 1528 if ( !body ) { 1529 // Return for frameset docs that don't have a body 1530 return; 1531 } 1532 1533 conMarginTop = 1; 1534 paddingMarginBorder = "padding:0;margin:0;border:"; 1535 positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; 1536 paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; 1537 style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; 1538 html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" + 1539 "<table " + style + "' cellpadding='0' cellspacing='0'>" + 1540 "<tr><td></td></tr></table>"; 1541 1542 container = document.createElement("div"); 1543 container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; 1544 body.insertBefore( container, body.firstChild ); 1545 1546 // Construct the test element 1547 div = document.createElement("div"); 1548 container.appendChild( div ); 1549 1550 // Check if table cells still have offsetWidth/Height when they are set 1551 // to display:none and there are still other visible table cells in a 1552 // table row; if so, offsetWidth/Height are not reliable for use when 1553 // determining if an element has been hidden directly using 1554 // display:none (it is still safe to use offsets if a parent element is 1555 // hidden; don safety goggles and see bug #4512 for more information). 1556 // (only IE 8 fails this test) 1557 div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>"; 1558 tds = div.getElementsByTagName( "td" ); 1559 isSupported = ( tds[ 0 ].offsetHeight === 0 ); 1560 1561 tds[ 0 ].style.display = ""; 1562 tds[ 1 ].style.display = "none"; 1563 1564 // Check if empty table cells still have offsetWidth/Height 1565 // (IE <= 8 fail this test) 1566 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); 1567 1568 // Check if div with explicit width and no margin-right incorrectly 1569 // gets computed margin-right based on width of container. For more 1570 // info see bug #3333 1571 // Fails in WebKit before Feb 2011 nightlies 1572 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1573 if ( window.getComputedStyle ) { 1574 div.innerHTML = ""; 1575 marginDiv = document.createElement( "div" ); 1576 marginDiv.style.width = "0"; 1577 marginDiv.style.marginRight = "0"; 1578 div.style.width = "2px"; 1579 div.appendChild( marginDiv ); 1580 support.reliableMarginRight = 1581 ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; 1582 } 1583 1584 if ( typeof div.style.zoom !== "undefined" ) { 1585 // Check if natively block-level elements act like inline-block 1586 // elements when setting their display to 'inline' and giving 1587 // them layout 1588 // (IE < 8 does this) 1589 div.innerHTML = ""; 1590 div.style.width = div.style.padding = "1px"; 1591 div.style.border = 0; 1592 div.style.overflow = "hidden"; 1593 div.style.display = "inline"; 1594 div.style.zoom = 1; 1595 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); 1596 1597 // Check if elements with layout shrink-wrap their children 1598 // (IE 6 does this) 1599 div.style.display = "block"; 1600 div.style.overflow = "visible"; 1601 div.innerHTML = "<div style='width:5px;'></div>"; 1602 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); 1603 } 1604 1605 div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; 1606 div.innerHTML = html; 1607 1608 outer = div.firstChild; 1609 inner = outer.firstChild; 1610 td = outer.nextSibling.firstChild.firstChild; 1611 1612 offsetSupport = { 1613 doesNotAddBorder: ( inner.offsetTop !== 5 ), 1614 doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) 1615 }; 1616 1617 inner.style.position = "fixed"; 1618 inner.style.top = "20px"; 1619 1620 // safari subtracts parent border width here which is 5px 1621 offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); 1622 inner.style.position = inner.style.top = ""; 1623 1624 outer.style.overflow = "hidden"; 1625 outer.style.position = "relative"; 1626 1627 offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); 1628 offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); 1629 1630 if ( window.getComputedStyle ) { 1631 div.style.marginTop = "1%"; 1632 support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; 1633 } 1634 1635 if ( typeof container.style.zoom !== "undefined" ) { 1636 container.style.zoom = 1; 1637 } 1638 1639 body.removeChild( container ); 1640 marginDiv = div = container = null; 1641 1642 jQuery.extend( support, offsetSupport ); 1643 }); 1644 1645 return support; 1646})(); 1647 1648 1649 1650 1651var rbrace = /^(?:\{.*\}|\[.*\])$/, 1652 rmultiDash = /([A-Z])/g; 1653 1654jQuery.extend({ 1655 cache: {}, 1656 1657 // Please use with caution 1658 uuid: 0, 1659 1660 // Unique for each copy of jQuery on the page 1661 // Non-digits removed to match rinlinejQuery 1662 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), 1663 1664 // The following elements throw uncatchable exceptions if you 1665 // attempt to add expando properties to them. 1666 noData: { 1667 "embed": true, 1668 // Ban all objects except for Flash (which handle expandos) 1669 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 1670 "applet": true 1671 }, 1672 1673 hasData: function( elem ) { 1674 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; 1675 return !!elem && !isEmptyDataObject( elem ); 1676 }, 1677 1678 data: function( elem, name, data, pvt /* Internal Use Only */ ) { 1679 if ( !jQuery.acceptData( elem ) ) { 1680 return; 1681 } 1682 1683 var privateCache, thisCache, ret, 1684 internalKey = jQuery.expando, 1685 getByName = typeof name === "string", 1686 1687 // We have to handle DOM nodes and JS objects differently because IE6-7 1688 // can't GC object references properly across the DOM-JS boundary 1689 isNode = elem.nodeType, 1690 1691 // Only DOM nodes need the global jQuery cache; JS object data is 1692 // attached directly to the object so GC can occur automatically 1693 cache = isNode ? jQuery.cache : elem, 1694 1695 // Only defining an ID for JS objects if its cache already exists allows 1696 // the code to shortcut on the same path as a DOM node with no cache 1697 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, 1698 isEvents = name === "events"; 1699 1700 // Avoid doing any more work than we need to when trying to get data on an 1701 // object that has no data at all 1702 if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { 1703 return; 1704 } 1705 1706 if ( !id ) { 1707 // Only DOM nodes need a new unique ID for each element since their data 1708 // ends up in the global cache 1709 if ( isNode ) { 1710 elem[ internalKey ] = id = ++jQuery.uuid; 1711 } else { 1712 id = internalKey; 1713 } 1714 } 1715 1716 if ( !cache[ id ] ) { 1717 cache[ id ] = {}; 1718 1719 // Avoids exposing jQuery metadata on plain JS objects when the object 1720 // is serialized using JSON.stringify 1721 if ( !isNode ) { 1722 cache[ id ].toJSON = jQuery.noop; 1723 } 1724 } 1725
vendor: 5,095 bytes, lines 1726-1911
1726 // An object can be passed to jQuery.data instead of a key/value pair; this gets 1727 // shallow copied over onto the existing cache 1728 if ( typeof name === "object" || typeof name === "function" ) { 1729 if ( pvt ) { 1730 cache[ id ] = jQuery.extend( cache[ id ], name ); 1731 } else { 1732 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 1733 } 1734 } 1735 1736 privateCache = thisCache = cache[ id ]; 1737 1738 // jQuery data() is stored in a separate object inside the object's internal data 1739 // cache in order to avoid key collisions between internal data and user-defined 1740 // data. 1741 if ( !pvt ) { 1742 if ( !thisCache.data ) { 1743 thisCache.data = {}; 1744 } 1745 1746 thisCache = thisCache.data; 1747 } 1748 1749 if ( data !== undefined ) { 1750 thisCache[ jQuery.camelCase( name ) ] = data; 1751 } 1752 1753 // Users should not attempt to inspect the internal events object using jQuery.data, 1754 // it is undocumented and subject to change. But does anyone listen? No. 1755 if ( isEvents && !thisCache[ name ] ) { 1756 return privateCache.events; 1757 } 1758 1759 // Check for both converted-to-camel and non-converted data property names 1760 // If a data property was specified 1761 if ( getByName ) { 1762 1763 // First Try to find as-is property data 1764 ret = thisCache[ name ]; 1765 1766 // Test for null|undefined property data 1767 if ( ret == null ) { 1768 1769 // Try to find the camelCased property 1770 ret = thisCache[ jQuery.camelCase( name ) ]; 1771 } 1772 } else { 1773 ret = thisCache; 1774 } 1775 1776 return ret; 1777 }, 1778 1779 removeData: function( elem, name, pvt /* Internal Use Only */ ) { 1780 if ( !jQuery.acceptData( elem ) ) { 1781 return; 1782 } 1783 1784 var thisCache, i, l, 1785 1786 // Reference to internal data cache key 1787 internalKey = jQuery.expando, 1788 1789 isNode = elem.nodeType, 1790 1791 // See jQuery.data for more information 1792 cache = isNode ? jQuery.cache : elem, 1793 1794 // See jQuery.data for more information 1795 id = isNode ? elem[ internalKey ] : internalKey; 1796 1797 // If there is already no cache entry for this object, there is no 1798 // purpose in continuing 1799 if ( !cache[ id ] ) { 1800 return; 1801 } 1802 1803 if ( name ) { 1804 1805 thisCache = pvt ? cache[ id ] : cache[ id ].data; 1806 1807 if ( thisCache ) { 1808 1809 // Support array or space separated string names for data keys 1810 if ( !jQuery.isArray( name ) ) { 1811 1812 // try the string as a key before any manipulation 1813 if ( name in thisCache ) { 1814 name = [ name ]; 1815 } else { 1816 1817 // split the camel cased version by spaces unless a key with the spaces exists 1818 name = jQuery.camelCase( name ); 1819 if ( name in thisCache ) { 1820 name = [ name ]; 1821 } else { 1822 name = name.split( " " ); 1823 } 1824 } 1825 } 1826 1827 for ( i = 0, l = name.length; i < l; i++ ) { 1828 delete thisCache[ name[i] ]; 1829 } 1830 1831 // If there is no data left in the cache, we want to continue 1832 // and let the cache object itself get destroyed 1833 if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { 1834 return; 1835 } 1836 } 1837 } 1838 1839 // See jQuery.data for more information 1840 if ( !pvt ) { 1841 delete cache[ id ].data; 1842 1843 // Don't destroy the parent cache unless the internal data object 1844 // had been the only thing left in it 1845 if ( !isEmptyDataObject(cache[ id ]) ) { 1846 return; 1847 } 1848 } 1849 1850 // Browsers that fail expando deletion also refuse to delete expandos on 1851 // the window, but it will allow it on all other JS objects; other browsers 1852 // don't care 1853 // Ensure that `cache` is not a window object #10080 1854 if ( jQuery.support.deleteExpando || !cache.setInterval ) { 1855 delete cache[ id ]; 1856 } else { 1857 cache[ id ] = null; 1858 } 1859 1860 // We destroyed the cache and need to eliminate the expando on the node to avoid 1861 // false lookups in the cache for entries that no longer exist 1862 if ( isNode ) { 1863 // IE does not allow us to delete expando properties from nodes, 1864 // nor does it have a removeAttribute function on Document nodes; 1865 // we must handle all of these cases 1866 if ( jQuery.support.deleteExpando ) { 1867 delete elem[ internalKey ]; 1868 } else if ( elem.removeAttribute ) { 1869 elem.removeAttribute( internalKey ); 1870 } else { 1871 elem[ internalKey ] = null; 1872 } 1873 } 1874 }, 1875 1876 // For internal use only. 1877 _data: function( elem, name, data ) { 1878 return jQuery.data( elem, name, data, true ); 1879 }, 1880 1881 // A method for determining if a DOM node can handle the data expando 1882 acceptData: function( elem ) { 1883 if ( elem.nodeName ) { 1884 var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; 1885 1886 if ( match ) { 1887 return !(match === true || elem.getAttribute("classid") !== match); 1888 } 1889 } 1890 1891 return true; 1892 } 1893}); 1894 1895jQuery.fn.extend({ 1896 data: function( key, value ) { 1897 var parts, part, attr, name, l, 1898 elem = this[0], 1899 i = 0, 1900 data = null; 1901 1902 // Gets all values 1903 if ( key === undefined ) { 1904 if ( this.length ) { 1905 data = jQuery.data( elem ); 1906 1907 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { 1908 attr = elem.attributes; 1909 for ( l = attr.length; i < l; i++ ) { 1910 name = attr[i].name; 1911
1912 if ( name.indexOf( "data-" ) === 0 ) { 1913 name = jQuery.camelCase( name.substring(5) ); 1914 1915 dataAttr( elem, name, data[ name ] ); 1916 } 1917 } 1918 jQuery._data( elem, "parsedAttrs", true ); 1919 } 1920 } 1921 1922 return data; 1923 } 1924 1925 // Sets multiple values 1926 if ( typeof key === "object" ) { 1927 return this.each(function() { 1928 jQuery.data( this, key ); 1929 }); 1930 } 1931 1932 parts = key.split( ".", 2 ); 1933 parts[1] = parts[1] ? "." + parts[1] : ""; 1934 part = parts[1] + "!"; 1935 1936 return jQuery.access( this, function( value ) { 1937 1938 if ( value === undefined ) { 1939 data = this.triggerHandler( "getData" + part, [ parts[0] ] ); 1940 1941 // Try to fetch any internally stored data first 1942 if ( data === undefined && elem ) { 1943 data = jQuery.data( elem, key ); 1944 data = dataAttr( elem, key, data ); 1945 } 1946 1947 return data === undefined && parts[1] ? 1948 this.data( parts[0] ) : 1949 data; 1950 } 1951 1952 parts[1] = value; 1953 this.each(function() { 1954 var self = jQuery( this ); 1955 1956 self.triggerHandler( "setData" + part, parts ); 1957 jQuery.data( this, key, value ); 1958 self.triggerHandler( "changeData" + part, parts ); 1959 }); 1960 }, null, value, arguments.length > 1, null, false ); 1961 }, 1962 1963 removeData: function( key ) { 1964 return this.each(function() { 1965 jQuery.removeData( this, key ); 1966 }); 1967 } 1968}); 1969 1970function dataAttr( elem, key, data ) { 1971 // If nothing was found internally, try to fetch any 1972 // data from the HTML5 data-* attribute 1973 if ( data === undefined && elem.nodeType === 1 ) { 1974 1975 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 1976 1977 data = elem.getAttribute( name ); 1978 1979 if ( typeof data === "string" ) { 1980 try { 1981 data = data === "true" ? true : 1982 data === "false" ? false : 1983 data === "null" ? null : 1984 jQuery.isNumeric( data ) ? +data : 1985 rbrace.test( data ) ? jQuery.parseJSON( data ) : 1986 data; 1987 } catch( e ) {} 1988 1989 // Make sure we set the data so it isn't changed later 1990 jQuery.data( elem, key, data ); 1991 1992 } else { 1993 data = undefined; 1994 } 1995 } 1996 1997 return data; 1998} 1999 2000// checks a cache object for emptiness 2001function isEmptyDataObject( obj ) { 2002 for ( var name in obj ) { 2003 2004 // if the public data object is empty, the private is still empty 2005 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { 2006 continue; 2007 } 2008 if ( name !== "toJSON" ) { 2009 return false; 2010 } 2011 } 2012 2013 return true; 2014} 2015 2016 2017 2018 2019function handleQueueMarkDefer( elem, type, src ) { 2020 var deferDataKey = type + "defer", 2021 queueDataKey = type + "queue", 2022 markDataKey = type + "mark", 2023 defer = jQuery._data( elem, deferDataKey ); 2024 if ( defer && 2025 ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && 2026 ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { 2027 // Give room for hard-coded callbacks to fire first 2028 // and eventually mark/queue something else on the element 2029 setTimeout( function() { 2030 if ( !jQuery._data( elem, queueDataKey ) && 2031 !jQuery._data( elem, markDataKey ) ) { 2032 jQuery.removeData( elem, deferDataKey, true ); 2033 defer.fire(); 2034 } 2035 }, 0 ); 2036 } 2037} 2038 2039jQuery.extend({ 2040 2041 _mark: function( elem, type ) { 2042 if ( elem ) { 2043 type = ( type || "fx" ) + "mark"; 2044 jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); 2045 } 2046 }, 2047 2048 _unmark: function( force, elem, type ) { 2049 if ( force !== true ) { 2050 type = elem; 2051 elem = force; 2052 force = false; 2053 } 2054 if ( elem ) { 2055 type = type || "fx"; 2056 var key = type + "mark", 2057 count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); 2058 if ( count ) { 2059 jQuery._data( elem, key, count ); 2060 } else { 2061 jQuery.removeData( elem, key, true ); 2062 handleQueueMarkDefer( elem, type, "mark" ); 2063 } 2064 } 2065 }, 2066 2067 queue: function( elem, type, data ) { 2068 var q; 2069 if ( elem ) { 2070 type = ( type || "fx" ) + "queue"; 2071 q = jQuery._data( elem, type ); 2072 2073 // Speed up dequeue by getting out quickly if this is just a lookup 2074 if ( data ) { 2075 if ( !q || jQuery.isArray(data) ) { 2076 q = jQuery._data( elem, type, jQuery.makeArray(data) ); 2077 } else { 2078 q.push( data ); 2079 } 2080 } 2081 return q || []; 2082 } 2083 }, 2084 2085 dequeue: function( elem, type ) {
vendor: 34,606 bytes, lines 2086-3261
2086 type = type || "fx"; 2087 2088 var queue = jQuery.queue( elem, type ), 2089 fn = queue.shift(), 2090 hooks = {}; 2091 2092 // If the fx queue is dequeued, always remove the progress sentinel 2093 if ( fn === "inprogress" ) { 2094 fn = queue.shift(); 2095 } 2096 2097 if ( fn ) { 2098 // Add a progress sentinel to prevent the fx queue from being 2099 // automatically dequeued 2100 if ( type === "fx" ) { 2101 queue.unshift( "inprogress" ); 2102 } 2103 2104 jQuery._data( elem, type + ".run", hooks ); 2105 fn.call( elem, function() { 2106 jQuery.dequeue( elem, type ); 2107 }, hooks ); 2108 } 2109 2110 if ( !queue.length ) { 2111 jQuery.removeData( elem, type + "queue " + type + ".run", true ); 2112 handleQueueMarkDefer( elem, type, "queue" ); 2113 } 2114 } 2115}); 2116 2117jQuery.fn.extend({ 2118 queue: function( type, data ) { 2119 var setter = 2; 2120 2121 if ( typeof type !== "string" ) { 2122 data = type; 2123 type = "fx"; 2124 setter--; 2125 } 2126 2127 if ( arguments.length < setter ) { 2128 return jQuery.queue( this[0], type ); 2129 } 2130 2131 return data === undefined ? 2132 this : 2133 this.each(function() { 2134 var queue = jQuery.queue( this, type, data ); 2135 2136 if ( type === "fx" && queue[0] !== "inprogress" ) { 2137 jQuery.dequeue( this, type ); 2138 } 2139 }); 2140 }, 2141 dequeue: function( type ) { 2142 return this.each(function() { 2143 jQuery.dequeue( this, type ); 2144 }); 2145 }, 2146 // Based off of the plugin by Clint Helfers, with permission. 2147 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 2148 delay: function( time, type ) { 2149 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 2150 type = type || "fx"; 2151 2152 return this.queue( type, function( next, hooks ) { 2153 var timeout = setTimeout( next, time ); 2154 hooks.stop = function() { 2155 clearTimeout( timeout ); 2156 }; 2157 }); 2158 }, 2159 clearQueue: function( type ) { 2160 return this.queue( type || "fx", [] ); 2161 }, 2162 // Get a promise resolved when queues of a certain type 2163 // are emptied (fx is the type by default) 2164 promise: function( type, object ) { 2165 if ( typeof type !== "string" ) { 2166 object = type; 2167 type = undefined; 2168 } 2169 type = type || "fx"; 2170 var defer = jQuery.Deferred(), 2171 elements = this, 2172 i = elements.length, 2173 count = 1, 2174 deferDataKey = type + "defer", 2175 queueDataKey = type + "queue", 2176 markDataKey = type + "mark", 2177 tmp; 2178 function resolve() { 2179 if ( !( --count ) ) { 2180 defer.resolveWith( elements, [ elements ] ); 2181 } 2182 } 2183 while( i-- ) { 2184 if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || 2185 ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || 2186 jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && 2187 jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { 2188 count++; 2189 tmp.add( resolve ); 2190 } 2191 } 2192 resolve(); 2193 return defer.promise( object ); 2194 } 2195}); 2196 2197 2198 2199 2200var rclass = /[\n\t\r]/g, 2201 rspace = /\s+/, 2202 rreturn = /\r/g, 2203 rtype = /^(?:button|input)$/i, 2204 rfocusable = /^(?:button|input|object|select|textarea)$/i, 2205 rclickable = /^a(?:rea)?$/i, 2206 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 2207 getSetAttribute = jQuery.support.getSetAttribute, 2208 nodeHook, boolHook, fixSpecified; 2209 2210jQuery.fn.extend({ 2211 attr: function( name, value ) { 2212 return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); 2213 }, 2214 2215 removeAttr: function( name ) { 2216 return this.each(function() { 2217 jQuery.removeAttr( this, name ); 2218 }); 2219 }, 2220 2221 prop: function( name, value ) { 2222 return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); 2223 }, 2224 2225 removeProp: function( name ) { 2226 name = jQuery.propFix[ name ] || name; 2227 return this.each(function() { 2228 // try/catch handles cases where IE balks (such as removing a property on window) 2229 try { 2230 this[ name ] = undefined; 2231 delete this[ name ]; 2232 } catch( e ) {} 2233 }); 2234 }, 2235 2236 addClass: function( value ) { 2237 var classNames, i, l, elem, 2238 setClass, c, cl; 2239 2240 if ( jQuery.isFunction( value ) ) { 2241 return this.each(function( j ) { 2242 jQuery( this ).addClass( value.call(this, j, this.className) ); 2243 }); 2244 } 2245 2246 if ( value && typeof value === "string" ) { 2247 classNames = value.split( rspace ); 2248 2249 for ( i = 0, l = this.length; i < l; i++ ) { 2250 elem = this[ i ]; 2251 2252 if ( elem.nodeType === 1 ) { 2253 if ( !elem.className && classNames.length === 1 ) { 2254 elem.className = value; 2255 2256 } else { 2257 setClass = " " + elem.className + " "; 2258 2259 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2260 if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { 2261 setClass += classNames[ c ] + " "; 2262 } 2263 } 2264 elem.className = jQuery.trim( setClass ); 2265 } 2266 } 2267 } 2268 } 2269 2270 return this; 2271 }, 2272 2273 removeClass: function( value ) { 2274 var classNames, i, l, elem, className, c, cl; 2275 2276 if ( jQuery.isFunction( value ) ) { 2277 return this.each(function( j ) { 2278 jQuery( this ).removeClass( value.call(this, j, this.className) ); 2279 }); 2280 } 2281 2282 if ( (value && typeof value === "string") || value === undefined ) { 2283 classNames = ( value || "" ).split( rspace ); 2284 2285 for ( i = 0, l = this.length; i < l; i++ ) { 2286 elem = this[ i ]; 2287 2288 if ( elem.nodeType === 1 && elem.className ) { 2289 if ( value ) { 2290 className = (" " + elem.className + " ").replace( rclass, " " ); 2291 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2292 className = className.replace(" " + classNames[ c ] + " ", " "); 2293 } 2294 elem.className = jQuery.trim( className ); 2295 2296 } else { 2297 elem.className = ""; 2298 } 2299 } 2300 } 2301 } 2302 2303 return this; 2304 }, 2305 2306 toggleClass: function( value, stateVal ) { 2307 var type = typeof value, 2308 isBool = typeof stateVal === "boolean"; 2309 2310 if ( jQuery.isFunction( value ) ) { 2311 return this.each(function( i ) { 2312 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); 2313 }); 2314 } 2315 2316 return this.each(function() { 2317 if ( type === "string" ) { 2318 // toggle individual class names 2319 var className, 2320 i = 0, 2321 self = jQuery( this ), 2322 state = stateVal, 2323 classNames = value.split( rspace ); 2324 2325 while ( (className = classNames[ i++ ]) ) { 2326 // check each className given, space seperated list 2327 state = isBool ? state : !self.hasClass( className ); 2328 self[ state ? "addClass" : "removeClass" ]( className ); 2329 } 2330 2331 } else if ( type === "undefined" || type === "boolean" ) { 2332 if ( this.className ) { 2333 // store className if set 2334 jQuery._data( this, "__className__", this.className ); 2335 } 2336 2337 // toggle whole className 2338 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; 2339 } 2340 }); 2341 }, 2342 2343 hasClass: function( selector ) { 2344 var className = " " + selector + " ", 2345 i = 0, 2346 l = this.length; 2347 for ( ; i < l; i++ ) { 2348 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { 2349 return true; 2350 } 2351 } 2352 2353 return false; 2354 }, 2355 2356 val: function( value ) { 2357 var hooks, ret, isFunction, 2358 elem = this[0]; 2359 2360 if ( !arguments.length ) { 2361 if ( elem ) { 2362 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 2363 2364 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { 2365 return ret; 2366 } 2367 2368 ret = elem.value; 2369 2370 return typeof ret === "string" ? 2371 // handle most common string cases 2372 ret.replace(rreturn, "") : 2373 // handle cases where value is null/undef or number 2374 ret == null ? "" : ret; 2375 } 2376 2377 return; 2378 } 2379 2380 isFunction = jQuery.isFunction( value ); 2381 2382 return this.each(function( i ) { 2383 var self = jQuery(this), val; 2384 2385 if ( this.nodeType !== 1 ) { 2386 return; 2387 } 2388 2389 if ( isFunction ) { 2390 val = value.call( this, i, self.val() ); 2391 } else { 2392 val = value; 2393 } 2394 2395 // Treat null/undefined as ""; convert numbers to string 2396 if ( val == null ) { 2397 val = ""; 2398 } else if ( typeof val === "number" ) { 2399 val += ""; 2400 } else if ( jQuery.isArray( val ) ) { 2401 val = jQuery.map(val, function ( value ) { 2402 return value == null ? "" : value + ""; 2403 }); 2404 } 2405 2406 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 2407 2408 // If set returns undefined, fall back to normal setting 2409 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { 2410 this.value = val; 2411 } 2412 }); 2413 } 2414}); 2415 2416jQuery.extend({ 2417 valHooks: { 2418 option: { 2419 get: function( elem ) { 2420 // attributes.value is undefined in Blackberry 4.7 but 2421 // uses .value. See #6932 2422 var val = elem.attributes.value; 2423 return !val || val.specified ? elem.value : elem.text; 2424 } 2425 }, 2426 select: { 2427 get: function( elem ) { 2428 var value, i, max, option, 2429 index = elem.selectedIndex, 2430 values = [], 2431 options = elem.options, 2432 one = elem.type === "select-one"; 2433 2434 // Nothing was selected 2435 if ( index < 0 ) { 2436 return null; 2437 } 2438 2439 // Loop through all the selected options 2440 i = one ? index : 0; 2441 max = one ? index + 1 : options.length; 2442 for ( ; i < max; i++ ) { 2443 option = options[ i ]; 2444 2445 // Don't return options that are disabled or in a disabled optgroup 2446 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 2447 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { 2448 2449 // Get the specific value for the option 2450 value = jQuery( option ).val(); 2451 2452 // We don't need an array for one selects 2453 if ( one ) { 2454 return value; 2455 } 2456 2457 // Multi-Selects return an array 2458 values.push( value ); 2459 } 2460 } 2461 2462 // Fixes Bug #2551 -- select.val() broken in IE after form.reset() 2463 if ( one && !values.length && options.length ) { 2464 return jQuery( options[ index ] ).val(); 2465 } 2466 2467 return values; 2468 }, 2469 2470 set: function( elem, value ) { 2471 var values = jQuery.makeArray( value ); 2472 2473 jQuery(elem).find("option").each(function() { 2474 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; 2475 }); 2476 2477 if ( !values.length ) { 2478 elem.selectedIndex = -1; 2479 } 2480 return values; 2481 } 2482 } 2483 }, 2484 2485 attrFn: { 2486 val: true, 2487 css: true, 2488 html: true, 2489 text: true, 2490 data: true, 2491 width: true, 2492 height: true, 2493 offset: true 2494 }, 2495 2496 attr: function( elem, name, value, pass ) { 2497 var ret, hooks, notxml, 2498 nType = elem.nodeType; 2499 2500 // don't get/set attributes on text, comment and attribute nodes 2501 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 2502 return; 2503 } 2504 2505 if ( pass && name in jQuery.attrFn ) { 2506 return jQuery( elem )[ name ]( value ); 2507 } 2508 2509 // Fallback to prop when attributes are not supported 2510 if ( typeof elem.getAttribute === "undefined" ) { 2511 return jQuery.prop( elem, name, value ); 2512 } 2513 2514 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 2515 2516 // All attributes are lowercase 2517 // Grab necessary hook if one is defined 2518 if ( notxml ) { 2519 name = name.toLowerCase(); 2520 hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); 2521 } 2522 2523 if ( value !== undefined ) { 2524 2525 if ( value === null ) { 2526 jQuery.removeAttr( elem, name ); 2527 return; 2528 2529 } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { 2530 return ret; 2531 2532 } else { 2533 elem.setAttribute( name, "" + value ); 2534 return value; 2535 } 2536 2537 } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { 2538 return ret; 2539 2540 } else { 2541 2542 ret = elem.getAttribute( name ); 2543 2544 // Non-existent attributes return null, we normalize to undefined 2545 return ret === null ? 2546 undefined : 2547 ret; 2548 } 2549 }, 2550 2551 removeAttr: function( elem, value ) { 2552 var propName, attrNames, name, l, isBool, 2553 i = 0; 2554 2555 if ( value && elem.nodeType === 1 ) { 2556 attrNames = value.toLowerCase().split( rspace ); 2557 l = attrNames.length; 2558 2559 for ( ; i < l; i++ ) { 2560 name = attrNames[ i ]; 2561 2562 if ( name ) { 2563 propName = jQuery.propFix[ name ] || name; 2564 isBool = rboolean.test( name ); 2565 2566 // See #9699 for explanation of this approach (setting first, then removal) 2567 // Do not do this for boolean attributes (see #10870) 2568 if ( !isBool ) { 2569 jQuery.attr( elem, name, "" ); 2570 } 2571 elem.removeAttribute( getSetAttribute ? name : propName ); 2572 2573 // Set corresponding property to false for boolean attributes 2574 if ( isBool && propName in elem ) { 2575 elem[ propName ] = false; 2576 } 2577 } 2578 } 2579 } 2580 }, 2581 2582 attrHooks: { 2583 type: { 2584 set: function( elem, value ) { 2585 // We can't allow the type property to be changed (since it causes problems in IE) 2586 if ( rtype.test( elem.nodeName ) && elem.parentNode ) { 2587 jQuery.error( "type property can't be changed" ); 2588 } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { 2589 // Setting the type on a radio button after the value resets the value in IE6-9 2590 // Reset value to it's default in case type is set after value 2591 // This is for element creation 2592 var val = elem.value; 2593 elem.setAttribute( "type", value ); 2594 if ( val ) { 2595 elem.value = val; 2596 } 2597 return value; 2598 } 2599 } 2600 }, 2601 // Use the value property for back compat 2602 // Use the nodeHook for button elements in IE6/7 (#1954) 2603 value: { 2604 get: function( elem, name ) { 2605 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { 2606 return nodeHook.get( elem, name ); 2607 } 2608 return name in elem ? 2609 elem.value : 2610 null; 2611 }, 2612 set: function( elem, value, name ) { 2613 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { 2614 return nodeHook.set( elem, value, name ); 2615 } 2616 // Does not return so that setAttribute is also used 2617 elem.value = value; 2618 } 2619 } 2620 }, 2621 2622 propFix: { 2623 tabindex: "tabIndex", 2624 readonly: "readOnly", 2625 "for": "htmlFor", 2626 "class": "className", 2627 maxlength: "maxLength", 2628 cellspacing: "cellSpacing", 2629 cellpadding: "cellPadding", 2630 rowspan: "rowSpan", 2631 colspan: "colSpan", 2632 usemap: "useMap", 2633 frameborder: "frameBorder", 2634 contenteditable: "contentEditable" 2635 }, 2636 2637 prop: function( elem, name, value ) { 2638 var ret, hooks, notxml, 2639 nType = elem.nodeType; 2640 2641 // don't get/set properties on text, comment and attribute nodes 2642 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 2643 return; 2644 } 2645 2646 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 2647 2648 if ( notxml ) { 2649 // Fix name and attach hooks 2650 name = jQuery.propFix[ name ] || name; 2651 hooks = jQuery.propHooks[ name ]; 2652 } 2653 2654 if ( value !== undefined ) { 2655 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { 2656 return ret; 2657 2658 } else { 2659 return ( elem[ name ] = value ); 2660 } 2661 2662 } else { 2663 if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { 2664 return ret; 2665 2666 } else { 2667 return elem[ name ]; 2668 } 2669 } 2670 }, 2671 2672 propHooks: { 2673 tabIndex: { 2674 get: function( elem ) { 2675 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 2676 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 2677 var attributeNode = elem.getAttributeNode("tabindex"); 2678 2679 return attributeNode && attributeNode.specified ? 2680 parseInt( attributeNode.value, 10 ) : 2681 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 2682 0 : 2683 undefined; 2684 } 2685 } 2686 } 2687}); 2688 2689// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) 2690jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; 2691 2692// Hook for boolean attributes 2693boolHook = { 2694 get: function( elem, name ) { 2695 // Align boolean attributes with corresponding properties 2696 // Fall back to attribute presence where some booleans are not supported 2697 var attrNode, 2698 property = jQuery.prop( elem, name ); 2699 return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? 2700 name.toLowerCase() : 2701 undefined; 2702 }, 2703 set: function( elem, value, name ) { 2704 var propName; 2705 if ( value === false ) { 2706 // Remove boolean attributes when set to false 2707 jQuery.removeAttr( elem, name ); 2708 } else { 2709 // value is true since we know at this point it's type boolean and not false 2710 // Set boolean attributes to the same name and set the DOM property 2711 propName = jQuery.propFix[ name ] || name; 2712 if ( propName in elem ) { 2713 // Only set the IDL specifically if it already exists on the element 2714 elem[ propName ] = true; 2715 } 2716 2717 elem.setAttribute( name, name.toLowerCase() ); 2718 } 2719 return name; 2720 } 2721}; 2722 2723// IE6/7 do not support getting/setting some attributes with get/setAttribute 2724if ( !getSetAttribute ) { 2725 2726 fixSpecified = { 2727 name: true, 2728 id: true, 2729 coords: true 2730 }; 2731 2732 // Use this for any attribute in IE6/7 2733 // This fixes almost every IE6/7 issue 2734 nodeHook = jQuery.valHooks.button = { 2735 get: function( elem, name ) { 2736 var ret; 2737 ret = elem.getAttributeNode( name ); 2738 return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? 2739 ret.nodeValue : 2740 undefined; 2741 }, 2742 set: function( elem, value, name ) { 2743 // Set the existing or create a new attribute node 2744 var ret = elem.getAttributeNode( name ); 2745 if ( !ret ) { 2746 ret = document.createAttribute( name ); 2747 elem.setAttributeNode( ret ); 2748 } 2749 return ( ret.nodeValue = value + "" ); 2750 } 2751 }; 2752 2753 // Apply the nodeHook to tabindex 2754 jQuery.attrHooks.tabindex.set = nodeHook.set; 2755 2756 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 2757 // This is for removals 2758 jQuery.each([ "width", "height" ], function( i, name ) { 2759 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { 2760 set: function( elem, value ) { 2761 if ( value === "" ) { 2762 elem.setAttribute( name, "auto" ); 2763 return value; 2764 } 2765 } 2766 }); 2767 }); 2768 2769 // Set contenteditable to false on removals(#10429) 2770 // Setting to empty string throws an error as an invalid value 2771 jQuery.attrHooks.contenteditable = { 2772 get: nodeHook.get, 2773 set: function( elem, value, name ) { 2774 if ( value === "" ) { 2775 value = "false"; 2776 } 2777 nodeHook.set( elem, value, name ); 2778 } 2779 }; 2780} 2781 2782 2783// Some attributes require a special call on IE 2784if ( !jQuery.support.hrefNormalized ) { 2785 jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { 2786 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { 2787 get: function( elem ) { 2788 var ret = elem.getAttribute( name, 2 ); 2789 return ret === null ? undefined : ret; 2790 } 2791 }); 2792 }); 2793} 2794 2795if ( !jQuery.support.style ) { 2796 jQuery.attrHooks.style = { 2797 get: function( elem ) { 2798 // Return undefined in the case of empty string 2799 // Normalize to lowercase since IE uppercases css property names 2800 return elem.style.cssText.toLowerCase() || undefined; 2801 }, 2802 set: function( elem, value ) { 2803 return ( elem.style.cssText = "" + value ); 2804 } 2805 }; 2806} 2807 2808// Safari mis-reports the default selected property of an option 2809// Accessing the parent's selectedIndex property fixes it 2810if ( !jQuery.support.optSelected ) { 2811 jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { 2812 get: function( elem ) { 2813 var parent = elem.parentNode; 2814 2815 if ( parent ) { 2816 parent.selectedIndex; 2817 2818 // Make sure that it also works with optgroups, see #5701 2819 if ( parent.parentNode ) { 2820 parent.parentNode.selectedIndex; 2821 } 2822 } 2823 return null; 2824 } 2825 }); 2826} 2827 2828// IE6/7 call enctype encoding 2829if ( !jQuery.support.enctype ) { 2830 jQuery.propFix.enctype = "encoding"; 2831} 2832 2833// Radios and checkboxes getter/setter 2834if ( !jQuery.support.checkOn ) { 2835 jQuery.each([ "radio", "checkbox" ], function() { 2836 jQuery.valHooks[ this ] = { 2837 get: function( elem ) { 2838 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 2839 return elem.getAttribute("value") === null ? "on" : elem.value; 2840 } 2841 }; 2842 }); 2843} 2844jQuery.each([ "radio", "checkbox" ], function() { 2845 jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { 2846 set: function( elem, value ) { 2847 if ( jQuery.isArray( value ) ) { 2848 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); 2849 } 2850 } 2851 }); 2852}); 2853 2854 2855 2856 2857var rformElems = /^(?:textarea|input|select)$/i, 2858 rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, 2859 rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, 2860 rkeyEvent = /^key/, 2861 rmouseEvent = /^(?:mouse|contextmenu)|click/, 2862 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 2863 rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, 2864 quickParse = function( selector ) { 2865 var quick = rquickIs.exec( selector ); 2866 if ( quick ) { 2867 // 0 1 2 3 2868 // [ _, tag, id, class ] 2869 quick[1] = ( quick[1] || "" ).toLowerCase(); 2870 quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); 2871 } 2872 return quick; 2873 }, 2874 quickIs = function( elem, m ) { 2875 var attrs = elem.attributes || {}; 2876 return ( 2877 (!m[1] || elem.nodeName.toLowerCase() === m[1]) && 2878 (!m[2] || (attrs.id || {}).value === m[2]) && 2879 (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) 2880 ); 2881 }, 2882 hoverHack = function( events ) { 2883 return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); 2884 }; 2885 2886/* 2887 * Helper functions for managing events -- not part of the public interface. 2888 * Props to Dean Edwards' addEvent library for many of the ideas. 2889 */ 2890jQuery.event = { 2891 2892 add: function( elem, types, handler, data, selector ) { 2893 2894 var elemData, eventHandle, events, 2895 t, tns, type, namespaces, handleObj, 2896 handleObjIn, quick, handlers, special; 2897 2898 // Don't attach events to noData or text/comment nodes (allow plain objects tho) 2899 if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { 2900 return; 2901 } 2902 2903 // Caller can pass in an object of custom data in lieu of the handler 2904 if ( handler.handler ) { 2905 handleObjIn = handler; 2906 handler = handleObjIn.handler; 2907 selector = handleObjIn.selector; 2908 } 2909 2910 // Make sure that the handler has a unique ID, used to find/remove it later 2911 if ( !handler.guid ) { 2912 handler.guid = jQuery.guid++; 2913 } 2914 2915 // Init the element's event structure and main handler, if this is the first 2916 events = elemData.events; 2917 if ( !events ) { 2918 elemData.events = events = {}; 2919 } 2920 eventHandle = elemData.handle; 2921 if ( !eventHandle ) { 2922 elemData.handle = eventHandle = function( e ) { 2923 // Discard the second event of a jQuery.event.trigger() and 2924 // when an event is called after a page has unloaded 2925 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? 2926 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 2927 undefined; 2928 }; 2929 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events 2930 eventHandle.elem = elem; 2931 } 2932 2933 // Handle multiple events separated by a space 2934 // jQuery(...).bind("mouseover mouseout", fn); 2935 types = jQuery.trim( hoverHack(types) ).split( " " ); 2936 for ( t = 0; t < types.length; t++ ) { 2937 2938 tns = rtypenamespace.exec( types[t] ) || []; 2939 type = tns[1]; 2940 namespaces = ( tns[2] || "" ).split( "." ).sort(); 2941 2942 // If event changes its type, use the special event handlers for the changed type 2943 special = jQuery.event.special[ type ] || {}; 2944 2945 // If selector defined, determine special event api type, otherwise given type 2946 type = ( selector ? special.delegateType : special.bindType ) || type; 2947 2948 // Update special based on newly reset type 2949 special = jQuery.event.special[ type ] || {}; 2950 2951 // handleObj is passed to all event handlers 2952 handleObj = jQuery.extend({ 2953 type: type, 2954 origType: tns[1], 2955 data: data, 2956 handler: handler, 2957 guid: handler.guid, 2958 selector: selector, 2959 quick: selector && quickParse( selector ), 2960 namespace: namespaces.join(".") 2961 }, handleObjIn ); 2962 2963 // Init the event handler queue if we're the first 2964 handlers = events[ type ]; 2965 if ( !handlers ) { 2966 handlers = events[ type ] = []; 2967 handlers.delegateCount = 0; 2968 2969 // Only use addEventListener/attachEvent if the special events handler returns false 2970 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 2971 // Bind the global event handler to the element 2972 if ( elem.addEventListener ) { 2973 elem.addEventListener( type, eventHandle, false ); 2974 2975 } else if ( elem.attachEvent ) { 2976 elem.attachEvent( "on" + type, eventHandle ); 2977 } 2978 } 2979 } 2980 2981 if ( special.add ) { 2982 special.add.call( elem, handleObj ); 2983 2984 if ( !handleObj.handler.guid ) { 2985 handleObj.handler.guid = handler.guid; 2986 } 2987 } 2988 2989 // Add to the element's handler list, delegates in front 2990 if ( selector ) { 2991 handlers.splice( handlers.delegateCount++, 0, handleObj ); 2992 } else { 2993 handlers.push( handleObj ); 2994 } 2995 2996 // Keep track of which events have ever been used, for event optimization 2997 jQuery.event.global[ type ] = true; 2998 } 2999 3000 // Nullify elem to prevent memory leaks in IE 3001 elem = null; 3002 }, 3003 3004 global: {}, 3005 3006 // Detach an event or set of events from an element 3007 remove: function( elem, types, handler, selector, mappedTypes ) { 3008 3009 var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), 3010 t, tns, type, origType, namespaces, origCount, 3011 j, events, special, handle, eventType, handleObj; 3012 3013 if ( !elemData || !(events = elemData.events) ) { 3014 return; 3015 } 3016 3017 // Once for each type.namespace in types; type may be omitted 3018 types = jQuery.trim( hoverHack( types || "" ) ).split(" "); 3019 for ( t = 0; t < types.length; t++ ) { 3020 tns = rtypenamespace.exec( types[t] ) || []; 3021 type = origType = tns[1]; 3022 namespaces = tns[2]; 3023 3024 // Unbind all events (on this namespace, if provided) for the element 3025 if ( !type ) { 3026 for ( type in events ) { 3027 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 3028 } 3029 continue; 3030 } 3031 3032 special = jQuery.event.special[ type ] || {}; 3033 type = ( selector? special.delegateType : special.bindType ) || type; 3034 eventType = events[ type ] || []; 3035 origCount = eventType.length; 3036 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 3037 3038 // Remove matching events 3039 for ( j = 0; j < eventType.length; j++ ) { 3040 handleObj = eventType[ j ]; 3041 3042 if ( ( mappedTypes || origType === handleObj.origType ) && 3043 ( !handler || handler.guid === handleObj.guid ) && 3044 ( !namespaces || namespaces.test( handleObj.namespace ) ) && 3045 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { 3046 eventType.splice( j--, 1 ); 3047 3048 if ( handleObj.selector ) { 3049 eventType.delegateCount--; 3050 } 3051 if ( special.remove ) { 3052 special.remove.call( elem, handleObj ); 3053 } 3054 } 3055 } 3056 3057 // Remove generic event handler if we removed something and no more handlers exist 3058 // (avoids potential for endless recursion during removal of special event handlers) 3059 if ( eventType.length === 0 && origCount !== eventType.length ) { 3060 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { 3061 jQuery.removeEvent( elem, type, elemData.handle ); 3062 } 3063 3064 delete events[ type ]; 3065 } 3066 } 3067 3068 // Remove the expando if it's no longer used 3069 if ( jQuery.isEmptyObject( events ) ) { 3070 handle = elemData.handle; 3071 if ( handle ) { 3072 handle.elem = null; 3073 } 3074 3075 // removeData also checks for emptiness and clears the expando if empty 3076 // so use it instead of delete 3077 jQuery.removeData( elem, [ "events", "handle" ], true ); 3078 } 3079 }, 3080 3081 // Events that are safe to short-circuit if no handlers are attached. 3082 // Native DOM events should not be added, they may have inline handlers. 3083 customEvent: { 3084 "getData": true, 3085 "setData": true, 3086 "changeData": true 3087 }, 3088 3089 trigger: function( event, data, elem, onlyHandlers ) { 3090 // Don't do events on text and comment nodes 3091 if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { 3092 return; 3093 } 3094 3095 // Event object or event type 3096 var type = event.type || event, 3097 namespaces = [], 3098 cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; 3099 3100 // focus/blur morphs to focusin/out; ensure we're not firing them right now 3101 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 3102 return; 3103 } 3104 3105 if ( type.indexOf( "!" ) >= 0 ) { 3106 // Exclusive events trigger only for the exact event (no namespaces) 3107 type = type.slice(0, -1); 3108 exclusive = true; 3109 } 3110 3111 if ( type.indexOf( "." ) >= 0 ) { 3112 // Namespaced trigger; create a regexp to match event type in handle() 3113 namespaces = type.split("."); 3114 type = namespaces.shift(); 3115 namespaces.sort(); 3116 } 3117 3118 if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { 3119 // No jQuery handlers for this event type, and it can't have inline handlers 3120 return; 3121 } 3122 3123 // Caller can pass in an Event, Object, or just an event type string 3124 event = typeof event === "object" ? 3125 // jQuery.Event object 3126 event[ jQuery.expando ] ? event : 3127 // Object literal 3128 new jQuery.Event( type, event ) : 3129 // Just the event type (string) 3130 new jQuery.Event( type ); 3131 3132 event.type = type; 3133 event.isTrigger = true; 3134 event.exclusive = exclusive; 3135 event.namespace = namespaces.join( "." ); 3136 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; 3137 ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; 3138 3139 // Handle a global trigger 3140 if ( !elem ) { 3141 3142 // TODO: Stop taunting the data cache; remove global events and always attach to document 3143 cache = jQuery.cache; 3144 for ( i in cache ) { 3145 if ( cache[ i ].events && cache[ i ].events[ type ] ) { 3146 jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); 3147 } 3148 } 3149 return; 3150 } 3151 3152 // Clean up the event in case it is being reused 3153 event.result = undefined; 3154 if ( !event.target ) { 3155 event.target = elem; 3156 } 3157 3158 // Clone any incoming data and prepend the event, creating the handler arg list 3159 data = data != null ? jQuery.makeArray( data ) : []; 3160 data.unshift( event ); 3161 3162 // Allow special events to draw outside the lines 3163 special = jQuery.event.special[ type ] || {}; 3164 if ( special.trigger && special.trigger.apply( elem, data ) === false ) { 3165 return; 3166 } 3167 3168 // Determine event propagation path in advance, per W3C events spec (#9951) 3169 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 3170 eventPath = [[ elem, special.bindType || type ]]; 3171 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 3172 3173 bubbleType = special.delegateType || type; 3174 cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; 3175 old = null; 3176 for ( ; cur; cur = cur.parentNode ) { 3177 eventPath.push([ cur, bubbleType ]); 3178 old = cur; 3179 } 3180 3181 // Only add window if we got to document (e.g., not plain obj or detached DOM) 3182 if ( old && old === elem.ownerDocument ) { 3183 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); 3184 } 3185 } 3186 3187 // Fire handlers on the event path 3188 for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { 3189 3190 cur = eventPath[i][0]; 3191 event.type = eventPath[i][1]; 3192 3193 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); 3194 if ( handle ) { 3195 handle.apply( cur, data ); 3196 } 3197 // Note that this is a bare JS function and not a jQuery handler 3198 handle = ontype && cur[ ontype ]; 3199 if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { 3200 event.preventDefault(); 3201 } 3202 } 3203 event.type = type; 3204 3205 // If nobody prevented the default action, do it now 3206 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 3207 3208 if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && 3209 !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { 3210 3211 // Call a native DOM method on the target with the same name name as the event. 3212 // Can't use an .isFunction() check here because IE6/7 fails that test. 3213 // Don't do default actions on window, that's where global variables be (#6170) 3214 // IE<9 dies on focus/blur to hidden element (#1486) 3215 if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { 3216 3217 // Don't re-trigger an onFOO event when we call its FOO() method 3218 old = elem[ ontype ]; 3219 3220 if ( old ) { 3221 elem[ ontype ] = null; 3222 } 3223 3224 // Prevent re-triggering of the same event, since we already bubbled it above 3225 jQuery.event.triggered = type; 3226 elem[ type ](); 3227 jQuery.event.triggered = undefined; 3228 3229 if ( old ) { 3230 elem[ ontype ] = old; 3231 } 3232 } 3233 } 3234 } 3235 3236 return event.result; 3237 }, 3238 3239 dispatch: function( event ) { 3240 3241 // Make a writable jQuery.Event from the native event object 3242 event = jQuery.event.fix( event || window.event ); 3243 3244 var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), 3245 delegateCount = handlers.delegateCount, 3246 args = [].slice.call( arguments, 0 ), 3247 run_all = !event.exclusive && !event.namespace, 3248 special = jQuery.event.special[ event.type ] || {}, 3249 handlerQueue = [], 3250 i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; 3251 3252 // Use the fix-ed jQuery.Event rather than the (read-only) native event 3253 args[0] = event; 3254 event.delegateTarget = this; 3255 3256 // Call the preDispatch hook for the mapped type, and let it bail if desired 3257 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 3258 return; 3259 } 3260 3261 // Determine handlers that should run if there are delegated events
3262 // Avoid non-left-click bubbling in Firefox (#3861) 3263 if ( delegateCount && !(event.button && event.type === "click") ) { 3264 3265 // Pregenerate a single jQuery object for reuse with .is() 3266 jqcur = jQuery(this); 3267 jqcur.context = this.ownerDocument || this; 3268 3269 for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { 3270 3271 // Don't process events on disabled elements (#6911, #8165) 3272 if ( cur.disabled !== true ) { 3273 selMatch = {}; 3274 matches = []; 3275 jqcur[0] = cur; 3276 for ( i = 0; i < delegateCount; i++ ) { 3277 handleObj = handlers[ i ]; 3278 sel = handleObj.selector; 3279 3280 if ( selMatch[ sel ] === undefined ) { 3281 selMatch[ sel ] = ( 3282 handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) 3283 ); 3284 } 3285 if ( selMatch[ sel ] ) { 3286 matches.push( handleObj ); 3287 } 3288 } 3289 if ( matches.length ) { 3290 handlerQueue.push({ elem: cur, matches: matches }); 3291 } 3292 } 3293 } 3294 } 3295 3296 // Add the remaining (directly-bou
vendor: 18,310 bytes, lines 3296-3913
3296nd) handlers 3297 if ( handlers.length > delegateCount ) { 3298 handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); 3299 } 3300 3301 // Run delegates first; they may want to stop propagation beneath us 3302 for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { 3303 matched = handlerQueue[ i ]; 3304 event.currentTarget = matched.elem; 3305 3306 for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { 3307 handleObj = matched.matches[ j ]; 3308 3309 // Triggered event must either 1) be non-exclusive and have no namespace, or 3310 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). 3311 if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { 3312 3313 event.data = handleObj.data; 3314 event.handleObj = handleObj; 3315 3316 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) 3317 .apply( matched.elem, args ); 3318 3319 if ( ret !== undefined ) { 3320 event.result = ret; 3321 if ( ret === false ) { 3322 event.preventDefault(); 3323 event.stopPropagation(); 3324 } 3325 } 3326 } 3327 } 3328 } 3329 3330 // Call the postDispatch hook for the mapped type 3331 if ( special.postDispatch ) { 3332 special.postDispatch.call( this, event ); 3333 } 3334 3335 return event.result; 3336 }, 3337 3338 // Includes some event props shared by KeyEvent and MouseEvent 3339 // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** 3340 props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), 3341 3342 fixHooks: {}, 3343 3344 keyHooks: { 3345 props: "char charCode key keyCode".split(" "), 3346 filter: function( event, original ) { 3347 3348 // Add which for key events 3349 if ( event.which == null ) { 3350 event.which = original.charCode != null ? original.charCode : original.keyCode; 3351 } 3352 3353 return event; 3354 } 3355 }, 3356 3357 mouseHooks: { 3358 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), 3359 filter: function( event, original ) { 3360 var eventDoc, doc, body, 3361 button = original.button, 3362 fromElement = original.fromElement; 3363 3364 // Calculate pageX/Y if missing and clientX/Y available 3365 if ( event.pageX == null && original.clientX != null ) { 3366 eventDoc = event.target.ownerDocument || document; 3367 doc = eventDoc.documentElement; 3368 body = eventDoc.body; 3369 3370 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 3371 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); 3372 } 3373 3374 // Add relatedTarget, if necessary 3375 if ( !event.relatedTarget && fromElement ) { 3376 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; 3377 } 3378 3379 // Add which for click: 1 === left; 2 === middle; 3 === right 3380 // Note: button is not normalized, so don't use it 3381 if ( !event.which && button !== undefined ) { 3382 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 3383 } 3384 3385 return event; 3386 } 3387 }, 3388 3389 fix: function( event ) { 3390 if ( event[ jQuery.expando ] ) { 3391 return event; 3392 } 3393 3394 // Create a writable copy of the event object and normalize some properties 3395 var i, prop, 3396 originalEvent = event, 3397 fixHook = jQuery.event.fixHooks[ event.type ] || {}, 3398 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 3399 3400 event = jQuery.Event( originalEvent ); 3401 3402 for ( i = copy.length; i; ) { 3403 prop = copy[ --i ]; 3404 event[ prop ] = originalEvent[ prop ]; 3405 } 3406 3407 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) 3408 if ( !event.target ) { 3409 event.target = originalEvent.srcElement || document; 3410 } 3411 3412 // Target should not be a text node (#504, Safari) 3413 if ( event.target.nodeType === 3 ) { 3414 event.target = event.target.parentNode; 3415 } 3416 3417 // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) 3418 if ( event.metaKey === undefined ) { 3419 event.metaKey = event.ctrlKey; 3420 } 3421 3422 return fixHook.filter? fixHook.filter( event, originalEvent ) : event; 3423 }, 3424 3425 special: { 3426 ready: { 3427 // Make sure the ready event is setup 3428 setup: jQuery.bindReady 3429 }, 3430 3431 load: { 3432 // Prevent triggered image.load events from bubbling to window.load 3433 noBubble: true 3434 }, 3435 3436 focus: { 3437 delegateType: "focusin" 3438 }, 3439 blur: { 3440 delegateType: "focusout" 3441 }, 3442 3443 beforeunload: { 3444 setup: function( data, namespaces, eventHandle ) { 3445 // We only want to do this special case on windows 3446 if ( jQuery.isWindow( this ) ) { 3447 this.onbeforeunload = eventHandle; 3448 } 3449 }, 3450 3451 teardown: function( namespaces, eventHandle ) { 3452 if ( this.onbeforeunload === eventHandle ) { 3453 this.onbeforeunload = null; 3454 } 3455 } 3456 } 3457 }, 3458 3459 simulate: function( type, elem, event, bubble ) { 3460 // Piggyback on a donor event to simulate a different one. 3461 // Fake originalEvent to avoid donor's stopPropagation, but if the 3462 // simulated event prevents default then we do the same on the donor. 3463 var e = jQuery.extend( 3464 new jQuery.Event(), 3465 event, 3466 { type: type, 3467 isSimulated: true, 3468 originalEvent: {} 3469 } 3470 ); 3471 if ( bubble ) { 3472 jQuery.event.trigger( e, null, elem ); 3473 } else { 3474 jQuery.event.dispatch.call( elem, e ); 3475 } 3476 if ( e.isDefaultPrevented() ) { 3477 event.preventDefault(); 3478 } 3479 } 3480}; 3481 3482// Some plugins are using, but it's undocumented/deprecated and will be removed. 3483// The 1.7 special event interface should provide all the hooks needed now. 3484jQuery.event.handle = jQuery.event.dispatch; 3485 3486jQuery.removeEvent = document.removeEventListener ? 3487 function( elem, type, handle ) { 3488 if ( elem.removeEventListener ) { 3489 elem.removeEventListener( type, handle, false ); 3490 } 3491 } : 3492 function( elem, type, handle ) { 3493 if ( elem.detachEvent ) { 3494 elem.detachEvent( "on" + type, handle ); 3495 } 3496 }; 3497 3498jQuery.Event = function( src, props ) { 3499 // Allow instantiation without the 'new' keyword 3500 if ( !(this instanceof jQuery.Event) ) { 3501 return new jQuery.Event( src, props ); 3502 } 3503 3504 // Event object 3505 if ( src && src.type ) { 3506 this.originalEvent = src; 3507 this.type = src.type; 3508 3509 // Events bubbling up the document may have been marked as prevented 3510 // by a handler lower down the tree; reflect the correct value. 3511 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || 3512 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; 3513 3514 // Event type 3515 } else { 3516 this.type = src; 3517 } 3518 3519 // Put explicitly provided properties onto the event object 3520 if ( props ) { 3521 jQuery.extend( this, props ); 3522 } 3523 3524 // Create a timestamp if incoming event doesn't have one 3525 this.timeStamp = src && src.timeStamp || jQuery.now(); 3526 3527 // Mark it as fixed 3528 this[ jQuery.expando ] = true; 3529}; 3530 3531function returnFalse() { 3532 return false; 3533} 3534function returnTrue() { 3535 return true; 3536} 3537 3538// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 3539// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 3540jQuery.Event.prototype = { 3541 preventDefault: function() { 3542 this.isDefaultPrevented = returnTrue; 3543 3544 var e = this.originalEvent; 3545 if ( !e ) { 3546 return; 3547 } 3548 3549 // if preventDefault exists run it on the original event 3550 if ( e.preventDefault ) { 3551 e.preventDefault(); 3552 3553 // otherwise set the returnValue property of the original event to false (IE) 3554 } else { 3555 e.returnValue = false; 3556 } 3557 }, 3558 stopPropagation: function() { 3559 this.isPropagationStopped = returnTrue; 3560 3561 var e = this.originalEvent; 3562 if ( !e ) { 3563 return; 3564 } 3565 // if stopPropagation exists run it on the original event 3566 if ( e.stopPropagation ) { 3567 e.stopPropagation(); 3568 } 3569 // otherwise set the cancelBubble property of the original event to true (IE) 3570 e.cancelBubble = true; 3571 }, 3572 stopImmediatePropagation: function() { 3573 this.isImmediatePropagationStopped = returnTrue; 3574 this.stopPropagation(); 3575 }, 3576 isDefaultPrevented: returnFalse, 3577 isPropagationStopped: returnFalse, 3578 isImmediatePropagationStopped: returnFalse 3579}; 3580 3581// Create mouseenter/leave events using mouseover/out and event-time checks 3582jQuery.each({ 3583 mouseenter: "mouseover", 3584 mouseleave: "mouseout" 3585}, function( orig, fix ) { 3586 jQuery.event.special[ orig ] = { 3587 delegateType: fix, 3588 bindType: fix, 3589 3590 handle: function( event ) { 3591 var target = this, 3592 related = event.relatedTarget, 3593 handleObj = event.handleObj, 3594 selector = handleObj.selector, 3595 ret; 3596 3597 // For mousenter/leave call the handler if related is outside the target. 3598 // NB: No relatedTarget if the mouse left/entered the browser window 3599 if ( !related || (related !== target && !jQuery.contains( target, related )) ) { 3600 event.type = handleObj.origType; 3601 ret = handleObj.handler.apply( this, arguments ); 3602 event.type = fix; 3603 } 3604 return ret; 3605 } 3606 }; 3607}); 3608 3609// IE submit delegation 3610if ( !jQuery.support.submitBubbles ) { 3611 3612 jQuery.event.special.submit = { 3613 setup: function() { 3614 // Only need this for delegated form submit events 3615 if ( jQuery.nodeName( this, "form" ) ) { 3616 return false; 3617 } 3618 3619 // Lazy-add a submit handler when a descendant form may potentially be submitted 3620 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 3621 // Node name check avoids a VML-related crash in IE (#9807) 3622 var elem = e.target, 3623 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; 3624 if ( form && !form._submit_attached ) { 3625 jQuery.event.add( form, "submit._submit", function( event ) { 3626 event._submit_bubble = true; 3627 }); 3628 form._submit_attached = true; 3629 } 3630 }); 3631 // return undefined since we don't need an event listener 3632 }, 3633 3634 postDispatch: function( event ) { 3635 // If form was submitted by the user, bubble the event up the tree 3636 if ( event._submit_bubble ) { 3637 delete event._submit_bubble; 3638 if ( this.parentNode && !event.isTrigger ) { 3639 jQuery.event.simulate( "submit", this.parentNode, event, true ); 3640 } 3641 } 3642 }, 3643 3644 teardown: function() { 3645 // Only need this for delegated form submit events 3646 if ( jQuery.nodeName( this, "form" ) ) { 3647 return false; 3648 } 3649 3650 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 3651 jQuery.event.remove( this, "._submit" ); 3652 } 3653 }; 3654} 3655 3656// IE change delegation and checkbox/radio fix 3657if ( !jQuery.support.changeBubbles ) { 3658 3659 jQuery.event.special.change = { 3660 3661 setup: function() { 3662 3663 if ( rformElems.test( this.nodeName ) ) { 3664 // IE doesn't fire change on a check/radio until blur; trigger it on click 3665 // after a propertychange. Eat the blur-change in special.change.handle. 3666 // This still fires onchange a second time for check/radio after blur. 3667 if ( this.type === "checkbox" || this.type === "radio" ) { 3668 jQuery.event.add( this, "propertychange._change", function( event ) { 3669 if ( event.originalEvent.propertyName === "checked" ) { 3670 this._just_changed = true; 3671 } 3672 }); 3673 jQuery.event.add( this, "click._change", function( event ) { 3674 if ( this._just_changed && !event.isTrigger ) { 3675 this._just_changed = false; 3676 jQuery.event.simulate( "change", this, event, true ); 3677 } 3678 }); 3679 } 3680 return false; 3681 } 3682 // Delegated event; lazy-add a change handler on descendant inputs 3683 jQuery.event.add( this, "beforeactivate._change", function( e ) { 3684 var elem = e.target; 3685 3686 if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { 3687 jQuery.event.add( elem, "change._change", function( event ) { 3688 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 3689 jQuery.event.simulate( "change", this.parentNode, event, true ); 3690 } 3691 }); 3692 elem._change_attached = true; 3693 } 3694 }); 3695 }, 3696 3697 handle: function( event ) { 3698 var elem = event.target; 3699 3700 // Swallow native change events from checkbox/radio, we already triggered them above 3701 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { 3702 return event.handleObj.handler.apply( this, arguments ); 3703 } 3704 }, 3705 3706 teardown: function() { 3707 jQuery.event.remove( this, "._change" ); 3708 3709 return rformElems.test( this.nodeName ); 3710 } 3711 }; 3712} 3713 3714// Create "bubbling" focus and blur events 3715if ( !jQuery.support.focusinBubbles ) { 3716 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { 3717 3718 // Attach a single capturing handler while someone wants focusin/focusout 3719 var attaches = 0, 3720 handler = function( event ) { 3721 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); 3722 }; 3723 3724 jQuery.event.special[ fix ] = { 3725 setup: function() { 3726 if ( attaches++ === 0 ) { 3727 document.addEventListener( orig, handler, true ); 3728 } 3729 }, 3730 teardown: function() { 3731 if ( --attaches === 0 ) { 3732 document.removeEventListener( orig, handler, true ); 3733 } 3734 } 3735 }; 3736 }); 3737} 3738 3739jQuery.fn.extend({ 3740 3741 on: function( types, selector, data, fn, /*INTERNAL*/ one ) { 3742 var origFn, type; 3743 3744 // Types can be a map of types/handlers 3745 if ( typeof types === "object" ) { 3746 // ( types-Object, selector, data ) 3747 if ( typeof selector !== "string" ) { // && selector != null 3748 // ( types-Object, data ) 3749 data = data || selector; 3750 selector = undefined; 3751 } 3752 for ( type in types ) { 3753 this.on( type, selector, data, types[ type ], one ); 3754 } 3755 return this; 3756 } 3757 3758 if ( data == null && fn == null ) { 3759 // ( types, fn ) 3760 fn = selector; 3761 data = selector = undefined; 3762 } else if ( fn == null ) { 3763 if ( typeof selector === "string" ) { 3764 // ( types, selector, fn ) 3765 fn = data; 3766 data = undefined; 3767 } else { 3768 // ( types, data, fn ) 3769 fn = data; 3770 data = selector; 3771 selector = undefined; 3772 } 3773 } 3774 if ( fn === false ) { 3775 fn = returnFalse; 3776 } else if ( !fn ) { 3777 return this; 3778 } 3779 3780 if ( one === 1 ) { 3781 origFn = fn; 3782 fn = function( event ) { 3783 // Can use an empty set, since event contains the info 3784 jQuery().off( event ); 3785 return origFn.apply( this, arguments ); 3786 }; 3787 // Use same guid so caller can remove using origFn 3788 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 3789 } 3790 return this.each( function() { 3791 jQuery.event.add( this, types, fn, data, selector ); 3792 }); 3793 }, 3794 one: function( types, selector, data, fn ) { 3795 return this.on( types, selector, data, fn, 1 ); 3796 }, 3797 off: function( types, selector, fn ) { 3798 if ( types && types.preventDefault && types.handleObj ) { 3799 // ( event ) dispatched jQuery.Event 3800 var handleObj = types.handleObj; 3801 jQuery( types.delegateTarget ).off( 3802 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, 3803 handleObj.selector, 3804 handleObj.handler 3805 ); 3806 return this; 3807 } 3808 if ( typeof types === "object" ) { 3809 // ( types-object [, selector] ) 3810 for ( var type in types ) { 3811 this.off( type, selector, types[ type ] ); 3812 } 3813 return this; 3814 } 3815 if ( selector === false || typeof selector === "function" ) { 3816 // ( types [, fn] ) 3817 fn = selector; 3818 selector = undefined; 3819 } 3820 if ( fn === false ) { 3821 fn = returnFalse; 3822 } 3823 return this.each(function() { 3824 jQuery.event.remove( this, types, fn, selector ); 3825 }); 3826 }, 3827 3828 bind: function( types, data, fn ) { 3829 return this.on( types, null, data, fn ); 3830 }, 3831 unbind: function( types, fn ) { 3832 return this.off( types, null, fn ); 3833 }, 3834 3835 live: function( types, data, fn ) { 3836 jQuery( this.context ).on( types, this.selector, data, fn ); 3837 return this; 3838 }, 3839 die: function( types, fn ) { 3840 jQuery( this.context ).off( types, this.selector || "**", fn ); 3841 return this; 3842 }, 3843 3844 delegate: function( selector, types, data, fn ) { 3845 return this.on( types, selector, data, fn ); 3846 }, 3847 undelegate: function( selector, types, fn ) { 3848 // ( namespace ) or ( selector, types [, fn] ) 3849 return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); 3850 }, 3851 3852 trigger: function( type, data ) { 3853 return this.each(function() { 3854 jQuery.event.trigger( type, data, this ); 3855 }); 3856 }, 3857 triggerHandler: function( type, data ) { 3858 if ( this[0] ) { 3859 return jQuery.event.trigger( type, data, this[0], true ); 3860 } 3861 }, 3862 3863 toggle: function( fn ) { 3864 // Save reference to arguments for access in closure 3865 var args = arguments, 3866 guid = fn.guid || jQuery.guid++, 3867 i = 0, 3868 toggler = function( event ) { 3869 // Figure out which function to execute 3870 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; 3871 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); 3872 3873 // Make sure that clicks stop 3874 event.preventDefault(); 3875 3876 // and execute the function 3877 return args[ lastToggle ].apply( this, arguments ) || false; 3878 }; 3879 3880 // link all the functions, so any of them can unbind this click handler 3881 toggler.guid = guid; 3882 while ( i < args.length ) { 3883 args[ i++ ].guid = guid; 3884 } 3885 3886 return this.click( toggler ); 3887 }, 3888 3889 hover: function( fnOver, fnOut ) { 3890 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 3891 } 3892}); 3893 3894jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 3895 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 3896 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 3897 3898 // Handle event binding 3899 jQuery.fn[ name ] = function( data, fn ) { 3900 if ( fn == null ) { 3901 fn = data; 3902 data = null; 3903 } 3904 3905 return arguments.length > 0 ? 3906 this.on( name, null, data, fn ) : 3907 this.trigger( name ); 3908 }; 3909 3910 if ( jQuery.attrFn ) { 3911 jQuery.attrFn[ name ] = true; 3912 } 3913
vendor: 4,873 bytes, lines 3914-4120
3914 if ( rkeyEvent.test( name ) ) { 3915 jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; 3916 } 3917 3918 if ( rmouseEvent.test( name ) ) { 3919 jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; 3920 } 3921}); 3922 3923 3924 3925/*! 3926 * Sizzle CSS Selector Engine 3927 * Copyright 2011, The Dojo Foundation 3928 * Released under the MIT, BSD, and GPL Licenses. 3929 * More information: http://sizzlejs.com/ 3930 */ 3931(function(){ 3932 3933var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 3934 expando = "sizcache" + (Math.random() + '').replace('.', ''), 3935 done = 0, 3936 toString = Object.prototype.toString, 3937 hasDuplicate = false, 3938 baseHasDuplicate = true, 3939 rBackslash = /\\/g, 3940 rReturn = /\r\n/g, 3941 rNonWord = /\W/; 3942 3943// Here we check if the JavaScript engine is using some sort of 3944// optimization where it does not always call our comparision 3945// function. If that is the case, discard the hasDuplicate value. 3946// Thus far that includes Google Chrome. 3947[0, 0].sort(function() { 3948 baseHasDuplicate = false; 3949 return 0; 3950}); 3951 3952var Sizzle = function( selector, context, results, seed ) { 3953 results = results || []; 3954 context = context || document; 3955 3956 var origContext = context; 3957 3958 if ( context.nodeType !== 1 && context.nodeType !== 9 ) { 3959 return []; 3960 } 3961 3962 if ( !selector || typeof selector !== "string" ) { 3963 return results; 3964 } 3965 3966 var m, set, checkSet, extra, ret, cur, pop, i, 3967 prune = true, 3968 contextXML = Sizzle.isXML( context ), 3969 parts = [], 3970 soFar = selector; 3971 3972 // Reset the position of the chunker regexp (start from head) 3973 do { 3974 chunker.exec( "" ); 3975 m = chunker.exec( soFar ); 3976 3977 if ( m ) { 3978 soFar = m[3]; 3979 3980 parts.push( m[1] ); 3981 3982 if ( m[2] ) { 3983 extra = m[3]; 3984 break; 3985 } 3986 } 3987 } while ( m ); 3988 3989 if ( parts.length > 1 && origPOS.exec( selector ) ) { 3990 3991 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 3992 set = posProcess( parts[0] + parts[1], context, seed ); 3993 3994 } else { 3995 set = Expr.relative[ parts[0] ] ? 3996 [ context ] : 3997 Sizzle( parts.shift(), context ); 3998 3999 while ( parts.length ) { 4000 selector = parts.shift(); 4001 4002 if ( Expr.relative[ selector ] ) { 4003 selector += parts.shift(); 4004 } 4005 4006 set = posProcess( selector, set, seed ); 4007 } 4008 } 4009 4010 } else { 4011 // Take a shortcut and set the context if the root selector is an ID 4012 // (but not if it'll be faster if the inner selector is an ID) 4013 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 4014 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { 4015 4016 ret = Sizzle.find( parts.shift(), context, contextXML ); 4017 context = ret.expr ? 4018 Sizzle.filter( ret.expr, ret.set )[0] : 4019 ret.set[0]; 4020 } 4021 4022 if ( context ) { 4023 ret = seed ? 4024 { expr: parts.pop(), set: makeArray(seed) } : 4025 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); 4026 4027 set = ret.expr ? 4028 Sizzle.filter( ret.expr, ret.set ) : 4029 ret.set; 4030 4031 if ( parts.length > 0 ) { 4032 checkSet = makeArray( set ); 4033 4034 } else { 4035 prune = false; 4036 } 4037 4038 while ( parts.length ) { 4039 cur = parts.pop(); 4040 pop = cur; 4041 4042 if ( !Expr.relative[ cur ] ) { 4043 cur = ""; 4044 } else { 4045 pop = parts.pop(); 4046 } 4047 4048 if ( pop == null ) { 4049 pop = context; 4050 } 4051 4052 Expr.relative[ cur ]( checkSet, pop, contextXML ); 4053 } 4054 4055 } else { 4056 checkSet = parts = []; 4057 } 4058 } 4059 4060 if ( !checkSet ) { 4061 checkSet = set; 4062 } 4063 4064 if ( !checkSet ) { 4065 Sizzle.error( cur || selector ); 4066 } 4067 4068 if ( toString.call(checkSet) === "[object Array]" ) { 4069 if ( !prune ) { 4070 results.push.apply( results, checkSet ); 4071 4072 } else if ( context && context.nodeType === 1 ) { 4073 for ( i = 0; checkSet[i] != null; i++ ) { 4074 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { 4075 results.push( set[i] ); 4076 } 4077 } 4078 4079 } else { 4080 for ( i = 0; checkSet[i] != null; i++ ) { 4081 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 4082 results.push( set[i] ); 4083 } 4084 } 4085 } 4086 4087 } else { 4088 makeArray( checkSet, results ); 4089 } 4090 4091 if ( extra ) { 4092 Sizzle( extra, origContext, results, seed ); 4093 Sizzle.uniqueSort( results ); 4094 } 4095 4096 return results; 4097}; 4098 4099Sizzle.uniqueSort = function( results ) { 4100 if ( sortOrder ) { 4101 hasDuplicate = baseHasDuplicate; 4102 results.sort( sortOrder ); 4103 4104 if ( hasDuplicate ) { 4105 for ( var i = 1; i < results.length; i++ ) { 4106 if ( results[i] === results[ i - 1 ] ) { 4107 results.splice( i--, 1 ); 4108 } 4109 } 4110 } 4111 } 4112 4113 return results; 4114}; 4115 4116Sizzle.matches = function( expr, set ) { 4117 return Sizzle( expr, null, null, set ); 4118}; 4119 4120Sizzle.matchesSelector = function( node, expr ) {
4121 return Sizzle( expr, null, null, [node] ).length > 0; 4122}; 4123 4124Sizzle.find = function( expr, context, isXML ) { 4125 var set, i, len, match, type, left; 4126 4127 if ( !expr ) { 4128 return []; 4129 } 4130 4131 for ( i = 0, len = Expr.order.length; i < len; i++ ) { 4132 type = Expr.order[i]; 4133 4134 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { 4135 left = match[1]; 4136 match.splice( 1, 1 ); 4137 4138 if ( left.substr( left.length - 1 ) !== "\\" ) { 4139 match[1] = (match[1] || "").replace( rBackslash, "" ); 4140 set = Expr.find[ type ]( match, context, isXML ); 4141 4142 if ( set != null ) { 4143 expr = expr.replace( Expr.match[ type ], "" ); 4144 break; 4145 } 4146 } 4147 } 4148 } 4149 4150 if ( !set ) { 4151 set = typeof context.getElementsByTagName !== "undefined" ? 4152 context.getElementsByTagName( "*" ) : 4153 []; 4154 } 4155 4156 return { set: set, expr: expr }; 4157}; 4158 4159Sizzle.filter = function( expr, set, inplace, not ) { 4160 var match, anyFound, 4161 type, found, item, filter, left, 4162 i, pass, 4163 old = expr, 4164 result = [], 4165 curLoop = set, 4166 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); 4167 4168 while ( expr && set.length ) { 4169 for ( type in Expr.filter ) { 4170 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { 4171 filter = Expr.filter[ type ]; 4172 left = match[1]; 4173 4174 anyFound = false; 4175 4176 match.splice(1,1); 4177 4178 if ( left.substr( left.length - 1 ) === "\\" ) { 4179 continue; 4180 } 4181 4182 if ( curLoop === result ) { 4183 result = []; 4184 } 4185 4186 if ( Expr.preFilter[ type ] ) { 4187 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); 4188 4189 if ( !match ) { 4190 anyFound = found = true; 4191 4192 } else if ( match === true ) { 4193 continue; 4194 } 4195 } 4196 4197 if ( match ) { 4198 for ( i = 0; (item = curLoop[i]) != null; i++ ) { 4199 if ( item ) { 4200 found = filter( item, match, i, curLoop ); 4201 pass = not ^ found; 4202 4203 if ( inplace && found != null ) { 4204 if ( pass ) { 4205 anyFound = true; 4206 4207 } else { 4208 curLoop[i] = false; 4209 } 4210 4211 } else if ( pass ) { 4212 result.push( item ); 4213 anyFound = true; 4214 } 4215 } 4216 } 4217 } 4218 4219 if ( found !== undefined ) { 4220 if ( !inplace ) { 4221 curLoop = result; 4222 } 4223 4224 expr = expr.replace( Expr.match[ type ], "" ); 4225 4226 if ( !anyFound ) { 4227 return []; 4228 } 4229 4230 break; 4231 } 4232 } 4233 } 4234 4235 // Improper expression 4236 if ( expr === old ) { 4237 if ( anyFound == null ) { 4238 Sizzle.error( expr ); 4239 4240 } else { 4241 break; 4242 } 4243 } 4244 4245 old = expr; 4246 } 4247 4248 return curLoop; 4249}; 4250 4251Sizzle.error = function( msg ) { 4252 throw new Error( "Syntax error, unrecognized expression: " + msg ); 4253}; 4254 4255/** 4256 * Utility function for retreiving the text value of an array of DOM nodes 4257 * @param {Array|Element} elem 4258 */ 4259var getText = Sizzle.getText = function( elem ) { 4260 var i, node, 4261 nodeType = elem.nodeType, 4262 ret = ""; 4263 4264 if ( nodeType ) { 4265 if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 4266 // Use textContent || innerText for elements 4267 if ( typeof elem.textContent === 'string' ) { 4268 return elem.textContent; 4269 } else if ( typeof elem.innerText === 'string' ) { 4270 // Replace IE's carriage returns 4271 return elem.innerText.replace( rReturn, '' ); 4272 } else { 4273 // Traverse it's children 4274 for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { 4275 ret += getText( elem ); 4276 } 4277 } 4278 } else if ( nodeType === 3 || nodeType === 4 ) { 4279 return elem.nodeValue; 4280 } 4281 } else { 4282 4283 // If no nodeType, this is expected to be an array 4284 for ( i = 0; (node = elem[i]); i++ ) { 4285 // Do not traverse comment nodes 4286 if ( node.nodeType !== 8 ) { 4287 ret += getText( node ); 4288 } 4289 } 4290 } 4291 return ret; 4292}; 4293 4294var Expr = Sizzle.selectors = { 4295 order: [ "ID", "NAME", "TAG" ], 4296 4297 match: { 4298 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4299 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4300 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, 4301 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, 4302 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, 4303 CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, 4304 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, 4305 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ 4306 }, 4307 4308 leftMatch: {}, 4309 4310 attrMap: { 4311 "class": "className", 4312 "for": "htmlFor" 4313 }, 4314 4315 attrHandle: { 4316 href: function( elem ) { 4317 return elem.getAttribute( "href" ); 4318 }, 4319 type: function( elem ) { 4320 return elem.getAttribute( "type" ); 4321 } 4322 }, 4323 4324 relative: { 4325 "+": function(checkSet, part){ 4326 var isPartStr = typeof part === "string", 4327 isTag = isPartStr && !rNonWord.test( part ), 4328 isPartStrNotTag = isPartStr && !isTag; 4329 4330 if ( isTag ) { 4331 part = part.toLowerCase(); 4332 } 4333 4334 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { 4335 if ( (elem = checkSet[i]) ) { 4336 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} 4337 4338 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? 4339 elem || false : 4340 elem === part; 4341 } 4342 } 4343 4344 if ( isPartStrNotTag ) { 4345 Sizzle.filter( part, checkSet, true ); 4346 } 4347 }, 4348 4349 ">": function( checkSet, part ) { 4350 var elem, 4351 isPartStr = typeof part === "string", 4352 i = 0, 4353 l = checkSet.length; 4354 4355 if ( isPartStr && !rNonWord.test( part ) ) { 4356 part = part.toLowerCase(); 4357 4358 for ( ; i < l; i++ ) { 4359 elem = checkSet[i]; 4360 4361 if ( elem ) { 4362 var parent = elem.parentNode; 4363 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; 4364 } 4365 } 4366 4367 } else { 4368 for ( ; i < l; i++ ) { 4369 elem = checkSet[i]; 4370 4371 if ( elem ) { 4372 checkSet[i] = isPartStr ? 4373 elem.parentNode : 4374 elem.parentNode === part; 4375 } 4376 } 4377 4378 if ( isPartStr ) { 4379 Sizzle.filter( part, checkSet, true ); 4380 } 4381 } 4382 }, 4383 4384 "": function(checkSet, part, isXML){ 4385 var nodeCheck, 4386 doneName = done++, 4387 checkFn = dirCheck; 4388 4389 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4390 part = part.toLowerCase(); 4391 nodeCheck = part; 4392 checkFn = dirNodeCheck; 4393 } 4394 4395 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); 4396 }, 4397 4398 "~": function( checkSet, part, isXML ) { 4399 var nodeCheck, 4400 doneName = done++, 4401 checkFn = dirCheck; 4402 4403 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4404 part = part.toLowerCase(); 4405 nodeCheck = part; 4406 checkFn = dirNodeCheck; 4407 } 4408 4409 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); 4410 } 4411 }, 4412 4413 find: { 4414 ID: function( match, context, isXML ) { 4415 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4416 var m = context.getElementById(match[1]); 4417 // Check parentNode to catch when Blackberry 4.6 returns 4418 // nodes that are no longer in the document #6963 4419 return m && m.parentNode ? [m] : []; 4420 } 4421 }, 4422 4423 NAME: function( match, context ) { 4424 if ( typeof context.getElementsByName !== "undefined" ) { 4425 var ret = [], 4426 results = context.getElementsByName( match[1] ); 4427 4428 for ( var i = 0, l = results.length; i < l; i++ ) { 4429 if ( results[i].getAttribute("name") === match[1] ) {
vendor: 8,850 bytes, lines 4430-4800
4430 ret.push( results[i] ); 4431 } 4432 } 4433 4434 return ret.length === 0 ? null : ret; 4435 } 4436 }, 4437 4438 TAG: function( match, context ) { 4439 if ( typeof context.getElementsByTagName !== "undefined" ) { 4440 return context.getElementsByTagName( match[1] ); 4441 } 4442 } 4443 }, 4444 preFilter: { 4445 CLASS: function( match, curLoop, inplace, result, not, isXML ) { 4446 match = " " + match[1].replace( rBackslash, "" ) + " "; 4447 4448 if ( isXML ) { 4449 return match; 4450 } 4451 4452 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { 4453 if ( elem ) { 4454 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { 4455 if ( !inplace ) { 4456 result.push( elem ); 4457 } 4458 4459 } else if ( inplace ) { 4460 curLoop[i] = false; 4461 } 4462 } 4463 } 4464 4465 return false; 4466 }, 4467 4468 ID: function( match ) { 4469 return match[1].replace( rBackslash, "" ); 4470 }, 4471 4472 TAG: function( match, curLoop ) { 4473 return match[1].replace( rBackslash, "" ).toLowerCase(); 4474 }, 4475 4476 CHILD: function( match ) { 4477 if ( match[1] === "nth" ) { 4478 if ( !match[2] ) { 4479 Sizzle.error( match[0] ); 4480 } 4481 4482 match[2] = match[2].replace(/^\+|\s*/g, ''); 4483 4484 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 4485 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( 4486 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || 4487 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 4488 4489 // calculate the numbers (first)n+(last) including if they are negative 4490 match[2] = (test[1] + (test[2] || 1)) - 0; 4491 match[3] = test[3] - 0; 4492 } 4493 else if ( match[2] ) { 4494 Sizzle.error( match[0] ); 4495 } 4496 4497 // TODO: Move to normal caching system 4498 match[0] = done++; 4499 4500 return match; 4501 }, 4502 4503 ATTR: function( match, curLoop, inplace, result, not, isXML ) { 4504 var name = match[1] = match[1].replace( rBackslash, "" ); 4505 4506 if ( !isXML && Expr.attrMap[name] ) { 4507 match[1] = Expr.attrMap[name]; 4508 } 4509 4510 // Handle if an un-quoted value was used 4511 match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); 4512 4513 if ( match[2] === "~=" ) { 4514 match[4] = " " + match[4] + " "; 4515 } 4516 4517 return match; 4518 }, 4519 4520 PSEUDO: function( match, curLoop, inplace, result, not ) { 4521 if ( match[1] === "not" ) { 4522 // If we're dealing with a complex expression, or a simple one 4523 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { 4524 match[3] = Sizzle(match[3], null, null, curLoop); 4525 4526 } else { 4527 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 4528 4529 if ( !inplace ) { 4530 result.push.apply( result, ret ); 4531 } 4532 4533 return false; 4534 } 4535 4536 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { 4537 return true; 4538 } 4539 4540 return match; 4541 }, 4542 4543 POS: function( match ) { 4544 match.unshift( true ); 4545 4546 return match; 4547 } 4548 }, 4549 4550 filters: { 4551 enabled: function( elem ) { 4552 return elem.disabled === false && elem.type !== "hidden"; 4553 }, 4554 4555 disabled: function( elem ) { 4556 return elem.disabled === true; 4557 }, 4558 4559 checked: function( elem ) { 4560 return elem.checked === true; 4561 }, 4562 4563 selected: function( elem ) { 4564 // Accessing this property makes selected-by-default 4565 // options in Safari work properly 4566 if ( elem.parentNode ) { 4567 elem.parentNode.selectedIndex; 4568 } 4569 4570 return elem.selected === true; 4571 }, 4572 4573 parent: function( elem ) { 4574 return !!elem.firstChild; 4575 }, 4576 4577 empty: function( elem ) { 4578 return !elem.firstChild; 4579 }, 4580 4581 has: function( elem, i, match ) { 4582 return !!Sizzle( match[3], elem ).length; 4583 }, 4584 4585 header: function( elem ) { 4586 return (/h\d/i).test( elem.nodeName ); 4587 }, 4588 4589 text: function( elem ) { 4590 var attr = elem.getAttribute( "type" ), type = elem.type; 4591 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 4592 // use getAttribute instead to test this case 4593 return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); 4594 }, 4595 4596 radio: function( elem ) { 4597 return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; 4598 }, 4599 4600 checkbox: function( elem ) { 4601 return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; 4602 }, 4603 4604 file: function( elem ) { 4605 return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; 4606 }, 4607 4608 password: function( elem ) { 4609 return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; 4610 }, 4611 4612 submit: function( elem ) { 4613 var name = elem.nodeName.toLowerCase(); 4614 return (name === "input" || name === "button") && "submit" === elem.type; 4615 }, 4616 4617 image: function( elem ) { 4618 return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; 4619 }, 4620 4621 reset: function( elem ) { 4622 var name = elem.nodeName.toLowerCase(); 4623 return (name === "input" || name === "button") && "reset" === elem.type; 4624 }, 4625 4626 button: function( elem ) { 4627 var name = elem.nodeName.toLowerCase(); 4628 return name === "input" && "button" === elem.type || name === "button"; 4629 }, 4630 4631 input: function( elem ) { 4632 return (/input|select|textarea|button/i).test( elem.nodeName ); 4633 }, 4634 4635 focus: function( elem ) { 4636 return elem === elem.ownerDocument.activeElement; 4637 } 4638 }, 4639 setFilters: { 4640 first: function( elem, i ) { 4641 return i === 0; 4642 }, 4643 4644 last: function( elem, i, match, array ) { 4645 return i === array.length - 1; 4646 }, 4647 4648 even: function( elem, i ) { 4649 return i % 2 === 0; 4650 }, 4651 4652 odd: function( elem, i ) { 4653 return i % 2 === 1; 4654 }, 4655 4656 lt: function( elem, i, match ) { 4657 return i < match[3] - 0; 4658 }, 4659 4660 gt: function( elem, i, match ) { 4661 return i > match[3] - 0; 4662 }, 4663 4664 nth: function( elem, i, match ) { 4665 return match[3] - 0 === i; 4666 }, 4667 4668 eq: function( elem, i, match ) { 4669 return match[3] - 0 === i; 4670 } 4671 }, 4672 filter: { 4673 PSEUDO: function( elem, match, i, array ) { 4674 var name = match[1], 4675 filter = Expr.filters[ name ]; 4676 4677 if ( filter ) { 4678 return filter( elem, i, match, array ); 4679 4680 } else if ( name === "contains" ) { 4681 return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; 4682 4683 } else if ( name === "not" ) { 4684 var not = match[3]; 4685 4686 for ( var j = 0, l = not.length; j < l; j++ ) { 4687 if ( not[j] === elem ) { 4688 return false; 4689 } 4690 } 4691 4692 return true; 4693 4694 } else { 4695 Sizzle.error( name ); 4696 } 4697 }, 4698 4699 CHILD: function( elem, match ) { 4700 var first, last, 4701 doneName, parent, cache, 4702 count, diff, 4703 type = match[1], 4704 node = elem; 4705 4706 switch ( type ) { 4707 case "only": 4708 case "first": 4709 while ( (node = node.previousSibling) ) { 4710 if ( node.nodeType === 1 ) { 4711 return false; 4712 } 4713 } 4714 4715 if ( type === "first" ) { 4716 return true; 4717 } 4718 4719 node = elem; 4720 4721 /* falls through */ 4722 case "last": 4723 while ( (node = node.nextSibling) ) { 4724 if ( node.nodeType === 1 ) { 4725 return false; 4726 } 4727 } 4728 4729 return true; 4730 4731 case "nth": 4732 first = match[2]; 4733 last = match[3]; 4734 4735 if ( first === 1 && last === 0 ) { 4736 return true; 4737 } 4738 4739 doneName = match[0]; 4740 parent = elem.parentNode; 4741 4742 if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { 4743 count = 0; 4744 4745 for ( node = parent.firstChild; node; node = node.nextSibling ) { 4746 if ( node.nodeType === 1 ) { 4747 node.nodeIndex = ++count; 4748 } 4749 } 4750 4751 parent[ expando ] = doneName; 4752 } 4753 4754 diff = elem.nodeIndex - last; 4755 4756 if ( first === 0 ) { 4757 return diff === 0; 4758 4759 } else { 4760 return ( diff % first === 0 && diff / first >= 0 ); 4761 } 4762 } 4763 }, 4764 4765 ID: function( elem, match ) { 4766 return elem.nodeType === 1 && elem.getAttribute("id") === match; 4767 }, 4768 4769 TAG: function( elem, match ) { 4770 return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; 4771 }, 4772 4773 CLASS: function( elem, match ) { 4774 return (" " + (elem.className || elem.getAttribute("class")) + " ") 4775 .indexOf( match ) > -1; 4776 }, 4777 4778 ATTR: function( elem, match ) { 4779 var name = match[1], 4780 result = Sizzle.attr ? 4781 Sizzle.attr( elem, name ) : 4782 Expr.attrHandle[ name ] ? 4783 Expr.attrHandle[ name ]( elem ) : 4784 elem[ name ] != null ? 4785 elem[ name ] : 4786 elem.getAttribute( name ), 4787 value = result + "", 4788 type = match[2], 4789 check = match[4]; 4790 4791 return result == null ? 4792 type === "!=" : 4793 !type && Sizzle.attr ? 4794 result != null : 4795 type === "=" ? 4796 value === check : 4797 type === "*=" ? 4798 value.indexOf(check) >= 0 : 4799 type === "~=" ? 4800 (" " + value + " ").indexOf(check) >= 0 :
4801 !check ? 4802 value && result !== false : 4803 type === "!=" ? 4804 value !== check : 4805 type === "^=" ? 4806 value.indexOf(check) === 0 : 4807 type === "$=" ? 4808 value.substr(value.length - check.length) === check : 4809 type === "|=" ? 4810 value === check || value.substr(0, check.length + 1) === check + "-" : 4811 false; 4812 }, 4813 4814 POS: function( elem, match, i, array ) { 4815 var name = match[2], 4816 filter = Expr.setFilters[ name ]; 4817 4818 if ( filter ) { 4819 return filter( elem, i, match, array ); 4820 } 4821 } 4822 } 4823}; 4824 4825var origPOS = Expr.match.POS, 4826 fescape = function(all, num){ 4827 return "\\" + (num - 0 + 1); 4828 }; 4829 4830for ( var type in Expr.match ) { 4831 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); 4832 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); 4833} 4834// Expose origPOS 4835// "global" as in regardless of relation to brackets/parens 4836Expr.match.globalPOS = origPOS; 4837 4838var makeArray = function( array, results ) { 4839 array = Array.prototype.slice.call( array, 0 ); 4840 4841 if ( results ) { 4842 results.push.apply( results, array ); 4843 return results; 4844 } 4845 4846 return array; 4847}; 4848 4849// Perform a simple check to determine if the browser is capable of 4850// converting a NodeList to an array using builtin methods. 4851// Also verifies that the returned array holds DOM nodes 4852// (which is not the case in the Blackberry browser) 4853try { 4854 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; 4855 4856// Provide a fallback method if it does not work 4857} catch( e ) { 4858 makeArray = function( array, results ) { 4859 var i = 0, 4860 ret = results || []; 4861 4862 if ( toString.call(array) === "[object Array]" ) { 4863 Array.prototype.push.apply( ret, array ); 4864 4865 } else { 4866 if ( typeof array.length === "number" ) { 4867 for ( var l = array.length; i < l; i++ ) { 4868 ret.push( array[i] ); 4869 } 4870 4871 } else { 4872 for ( ; array[i]; i++ ) { 4873 ret.push( array[i] ); 4874 } 4875 } 4876 } 4877 4878 return ret; 4879 }; 4880} 4881 4882var sortOrder, siblingCheck; 4883 4884if ( document.documentElement.compareDocumentPosition ) { 4885 sortOrder = function( a, b ) { 4886 if ( a === b ) { 4887 hasDuplicate = true; 4888 return 0; 4889 } 4890 4891 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { 4892 return a.compareDocumentPosition ? -1 : 1; 4893 } 4894 4895 return a.compareDocumentPosition(b) & 4 ? -1 : 1; 4896 }; 4897 4898} else { 4899 sortOrder = function( a, b ) { 4900 // The nodes are identical, we can exit early 4901 if ( a === b ) { 4902 hasDuplicate = true; 4903 return 0; 4904 4905 // Fallback to using sourceIndex (in IE) if it's available on both nodes 4906 } else if ( a.sourceIndex && b.sourceIndex ) { 4907 return a.sourceIndex - b.sourceIndex; 4908 } 4909 4910 var al, bl, 4911 ap = [], 4912 bp = [], 4913 aup = a.parentNode, 4914 bup = b.parentNode, 4915 cur = aup; 4916 4917 // If the nodes are siblings (or identical) we can do a quick check 4918 if ( aup === bup ) { 4919 return siblingCheck( a, b ); 4920 4921 // If no parents were found then the nodes are disconnected 4922 } else if ( !aup ) { 4923 return -1; 4924 4925 } else if ( !bup ) { 4926 return 1; 4927 } 4928 4929 // Otherwise they're somewhere else in the tree so we need 4930 // to build up a full list of the parentNodes for comparison 4931 while ( cur ) { 4932 ap.unshift( cur ); 4933 cur = cur.parentNode; 4934 } 4935 4936 cur = bup; 4937 4938 while ( cur ) { 4939 bp.unshift( cur ); 4940 cur = cur.parentNode; 4941 } 4942 4943 al = ap.length; 4944 bl = bp.length; 4945 4946 // Start walking down the tree looking for a discrepancy 4947 for ( var i = 0; i < al && i < bl; i++ ) { 4948 if ( ap[i] !== bp[i] ) { 4949 return siblingCheck( ap[i], bp[i] ); 4950 } 4951 } 4952 4953 // We ended someplace up the tree so do a sibling check 4954 return i === al ? 4955 siblingCheck( a, bp[i], -1 ) : 4956 siblingCheck( ap[i], b, 1 ); 4957 }; 4958 4959 siblingCheck = function( a, b, ret ) { 4960 if ( a === b ) { 4961 return ret; 4962 } 4963 4964 var cur = a.nextSibling; 4965 4966 while ( cur ) { 4967 if ( cur === b ) { 4968 return -1; 4969 } 4970 4971 cur = cur.nextSibling; 4972 } 4973 4974 return 1; 4975 }; 4976} 4977 4978// Check to see if the browser returns elements by name when 4979// querying by getElementById (and provide a workaround) 4980(function(){ 4981 // We're going to inject a fake input element with a specified name 4982 var form = document.createElement("div"), 4983 id = "script" + (new Date()).getTime(), 4984 root = document.documentElement; 4985
4986 form.innerHTML = "<a name='" + id + "'/>"; 4987 4988 // Inject it into the root element, check its status, and remove it quickly 4989 root.insertBefore( form, root.firstChild ); 4990 4991 // The workaround has to do additional checks after a getElementById 4992 // Which slows things down for other browsers (hence the branching) 4993 if ( document.getElementById( id ) ) { 4994 Expr.find.ID = function( match, context, isXML ) { 4995 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4996 var m = context.getElementById(match[1]); 4997 4998 return m ? 4999 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? 5000 [m] : 5001 undefined : 5002 []; 5003 } 5004 }; 5005 5006 Expr.filter.ID = function( elem, match ) { 5007 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 5008 5009 return elem.nodeType === 1 && node && node.nodeValue === match; 5010 }; 5011 } 5012 5013 root.removeChild( form ); 5014 5015 // release memory in IE 5016 root = form = null; 5017})(); 5018 5019(function(){ 5020 // Check to see if the browser returns only elements 5021 // when doing getElementsByTagName("*") 5022 5023 // Create a fake element 5024 var div = document.createElement("div"); 5025 div.appendChild( document.createComment("") ); 5026 5027 // Make sure no comments are found 5028 if ( div.getElementsByTagName("*").length > 0 ) { 5029 Expr.find.TAG = function( match, context ) { 5030 var results = context.getElementsByTagName( match[1] ); 5031 5032 // Filter out possible comments 5033 if ( match[1] === "*" ) { 5034 var tmp = []; 5035 5036 for ( var i = 0; results[i]; i++ ) { 5037 if ( results[i].nodeType === 1 ) { 5038 tmp.push( results[i] ); 5039 } 5040 } 5041 5042 results = tmp; 5043 } 5044 5045 return results; 5046 }; 5047 } 5048 5049 // Check to see if an attribute returns normalized href attributes 5050 div.innerHTML = "<a href='#'></a>"; 5051 5052 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && 5053 div.firstChild.getAttribute("href") !== "#" ) { 5054 5055 Expr.attrHandle.href = function( elem ) { 5056 return elem.getAttribute( "href", 2 ); 5057 }; 5058 } 5059 5060 // release memory in IE 5061 div = null; 5062})(); 5063 5064if ( document.querySelectorAll ) { 5065 (function(){ 5066 var oldSizzle = Sizzle, 5067 div = document.createElement("div"), 5068 id = "__sizzle__"; 5069 5070 div.innerHTML = "<p class='TEST'></p>"; 5071 5072 // Safari can't handle uppercase or unicode characters when 5073 // in quirks mode. 5074 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { 5075 return; 5076 } 5077 5078 Sizzle = function( query, context, extra, seed ) { 5079 context = context || document; 5080 5081 // Only use querySelectorAll on non-XML documents 5082 // (ID selectors don't work in non-HTML documents) 5083 if ( !seed && !Sizzle.isXML(context) ) { 5084 // See if we find a selector to speed up 5085 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); 5086 5087 if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { 5088 // Speed-up: Sizzle("TAG") 5089 if ( match[1] ) { 5090 return makeArray( context.getElementsByTagName( query ), extra ); 5091 5092 // Speed-up: Sizzle(".CLASS") 5093 } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { 5094 return makeArray( context.getElementsByClassName( match[2] ), extra ); 5095 } 5096 } 5097 5098 if ( context.nodeType === 9 ) { 5099 // Speed-up: Sizzle("body") 5100 // The body element only exists once, optimize finding it 5101 if ( query === "body" && context.body ) { 5102 return makeArray( [ context.body ], extra ); 5103 5104 // Speed-up: Sizzle("#ID") 5105 } else if ( match && match[3] ) { 5106 var elem = context.getElementById( match[3] ); 5107 5108 // Check parentNode to catch when Blackberry 4.6 returns 5109 // nodes that are no longer in the document #6963 5110 if ( elem && elem.parentNode ) { 5111 // Handle the case where IE and Opera return items 5112 // by name instead of ID 5113 if ( elem.id === match[3] ) { 5114 return makeArray( [ elem ], extra ); 5115 } 5116 5117 } else { 5118 return makeArray( [], extra ); 5119 } 5120 } 5121 5122 try { 5123 return makeArray( context.querySelectorAll(query), extra ); 5124 } catch(qsaError) {} 5125 5126 // qSA works strangely on Element-rooted queries 5127 // We can work around this by specifying an extra ID on the root 5128 // and working up from there (Thanks to Andrew Dupont for the technique) 5129 // IE 8 doesn't work on object elements 5130 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { 5131 var oldContext = context, 5132 old = context.getAttribute( "id" ), 5133 nid = old || id, 5134 hasParent = context.parentNode, 5135 relativeHierarchySelector = /^\s*[+~]/.test( query ); 5136 5137 if ( !old ) { 5138 context.setAttribute( "id", nid ); 5139 } else { 5140 nid = nid.replace( /'/g, "\\$&" ); 5141 } 5142 if ( relativeHierarchySelector && hasParent ) { 5143 context = context.parentNode; 5144 } 5145 5146 try { 5147 if ( !relativeHierarchySelector || hasParent ) { 5148 return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); 5149 } 5150 5151 } catch(pseudoError) { 5152 } finally { 5153 if ( !old ) { 5154 oldContext.removeAttribute( "id" ); 5155 } 5156 } 5157 } 5158 } 5159 5160 return oldSizzle(query, context, extra, seed); 5161 }; 5162 5163 for ( var prop in oldSizzle ) { 5164 Sizzle[ prop ] = oldSizzle[ prop ]; 5165 } 5166 5167 // release memory in IE 5168 div = null; 5169 })(); 5170} 5171 5172(function(){ 5173 var html = document.documentElement, 5174 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; 5175 5176 if ( matches ) { 5177 // Check to see if it's possible to do matchesSelector 5178 // on a disconnected node (IE 9 fails this) 5179 var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), 5180 pseudoWorks = false; 5181 5182 try { 5183 // This should fail with an exception 5184 // Gecko does not error, returns false instead
5185 matches.call( document.documentElement, "[test!='']:sizzle" ); 5186 5187 } catch( pseudoError ) { 5188 pseudoWorks = true; 5189 } 5190 5191 Sizzle.matchesSelector = function( node, expr ) { 5192 // Make sure that attribute selectors are quoted 5193 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); 5194 5195 if ( !Sizzle.isXML( node ) ) { 5196 try { 5197 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { 5198 var ret = matches.call( node, expr ); 5199 5200 // IE 9's matchesSelector returns false on disconnected nodes 5201 if ( ret || !disconnectedMatch || 5202 // As well, disconnected nodes are said to be in a document 5203 // fragment in IE 9, so check for that 5204 node.document && node.document.nodeType !== 11 ) { 5205 return ret; 5206 } 5207 } 5208 } catch(e) {} 5209 } 5210 5211 return Sizzle(expr, null, null, [node]).length > 0; 5212 }; 5213 } 5214})(); 5215 5216(function(){ 5217 var div = document.createElement("div"); 5218 5219 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 5220 5221 // Opera can't find a second classname (in 9.6) 5222 // Also, make sure that getElementsByClassName actually exists 5223 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { 5224 return; 5225 } 5226 5227 // Safari caches class attributes, doesn't catch changes (in 3.2) 5228 div.lastChild.className = "e"; 5229 5230 if ( div.getElementsByClassName("e").length === 1 ) { 5231 return; 5232 } 5233 5234 Expr.order.splice(1, 0, "CLASS"); 5235 Expr.find.CLASS = function( match, context, isXML ) { 5236 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { 5237 return context.getElementsByClassName(match[1]); 5238 } 5239 }; 5240 5241 // release memory in IE 5242 div = null; 5243})(); 5244 5245function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 5246 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 5247 var elem = checkSet[i]; 5248 5249 if ( elem ) { 5250 var match = false; 5251 5252 elem = elem[dir]; 5253 5254 while ( elem ) { 5255 if ( elem[ expando ] === doneName ) { 5256 match = checkSet[elem.sizset]; 5257 break; 5258 } 5259 5260 if ( elem.nodeType === 1 && !isXML ){ 5261 elem[ expando ] = doneName; 5262 elem.sizset = i; 5263 } 5264 5265 if ( elem.nodeName.toLowerCase() === cur ) { 5266 match = elem; 5267 break; 5268 } 5269 5270 elem = elem[dir]; 5271 } 5272 5273 checkSet[i] = match; 5274 } 5275 } 5276} 5277 5278function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 5279 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 5280 var elem = checkSet[i]; 5281 5282 if ( elem ) { 5283 var match = false; 5284 5285 elem = elem[dir]; 5286 5287 while ( elem ) { 5288 if ( elem[ expando ] === doneName ) { 5289 match = checkSet[elem.sizset]; 5290 break; 5291 } 5292 5293 if ( elem.nodeType === 1 ) { 5294 if ( !isXML ) { 5295 elem[ expando ] = doneName; 5296 elem.sizset = i; 5297 } 5298 5299 if ( typeof cur !== "string" ) { 5300 if ( elem === cur ) { 5301 match = true; 5302 break; 5303 } 5304 5305 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { 5306 match = elem; 5307 break; 5308 } 5309 } 5310 5311 elem = elem[dir]; 5312 } 5313 5314 checkSet[i] = match; 5315 } 5316 } 5317} 5318 5319if ( document.documentElement.contains ) { 5320 Sizzle.contains = function( a, b ) { 5321 return a !== b && (a.contains ? a.contains(b) : true); 5322 }; 5323 5324} else if ( document.documentElement.compareDocumentPosition ) { 5325 Sizzle.contains = function( a, b ) { 5326 return !!(a.compareDocumentPosition(b) & 16); 5327 }; 5328 5329} else { 5330 Sizzle.contains = function() { 5331 return false; 5332 }; 5333} 5334 5335Sizzle.isXML = function( elem ) { 5336 // documentElement is verified for cases where it doesn't yet exist 5337 // (such as loading iframes in IE - #4833) 5338 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; 5339 5340 return documentElement ? documentElement.nodeName !== "HTML" : false; 5341}; 5342 5343var posProcess = function( selector, context, seed ) { 5344 var match, 5345 tmpSet = [], 5346 later = "", 5347 root = context.nodeType ? [context] : context; 5348 5349 // Position selectors must be done after the filter 5350 // And so must :not(positional) so we move all PSEUDOs to the end 5351 while ( (match = Expr.match.PSEUDO.exec( selector )) ) { 5352 later += match[0]; 5353 selector = selector.replace( Expr.match.PSEUDO, "" ); 5354 } 5355 5356 selector = Expr.relative[selector] ? selector + "*" : selector; 5357 5358 for ( var i = 0, l = root.length; i < l; i++ ) { 5359 Sizzle( selector, root[i], tmpSet, seed ); 5360 } 5361 5362 return Sizzle.filter( later, tmpSet ); 5363}; 5364 5365// EXPOSE 5366// Override sizzle attribute retrieval 5367Sizzle.attr = jQuery.attr; 5368Sizzle.selectors.attrMap = {}; 5369jQuery.find = Sizzle; 5370jQuery.expr = Sizzle.selectors; 5371jQuery.expr[":"] = jQuery.expr.filters; 5372jQuery.unique = Sizzle.uniqueSort; 5373jQuery.text = Sizzle.getText;
vendor: 14,807 bytes, lines 5374-5930
5374jQuery.isXMLDoc = Sizzle.isXML; 5375jQuery.contains = Sizzle.contains; 5376 5377 5378})(); 5379 5380 5381var runtil = /Until$/, 5382 rparentsprev = /^(?:parents|prevUntil|prevAll)/, 5383 // Note: This RegExp should be improved, or likely pulled from Sizzle 5384 rmultiselector = /,/, 5385 isSimple = /^.[^:#\[\.,]*$/, 5386 slice = Array.prototype.slice, 5387 POS = jQuery.expr.match.globalPOS, 5388 // methods guaranteed to produce a unique set when starting from a unique set 5389 guaranteedUnique = { 5390 children: true, 5391 contents: true, 5392 next: true, 5393 prev: true 5394 }; 5395 5396jQuery.fn.extend({ 5397 find: function( selector ) { 5398 var self = this, 5399 i, l; 5400 5401 if ( typeof selector !== "string" ) { 5402 return jQuery( selector ).filter(function() { 5403 for ( i = 0, l = self.length; i < l; i++ ) { 5404 if ( jQuery.contains( self[ i ], this ) ) { 5405 return true; 5406 } 5407 } 5408 }); 5409 } 5410 5411 var ret = this.pushStack( "", "find", selector ), 5412 length, n, r; 5413 5414 for ( i = 0, l = this.length; i < l; i++ ) { 5415 length = ret.length; 5416 jQuery.find( selector, this[i], ret ); 5417 5418 if ( i > 0 ) { 5419 // Make sure that the results are unique 5420 for ( n = length; n < ret.length; n++ ) { 5421 for ( r = 0; r < length; r++ ) { 5422 if ( ret[r] === ret[n] ) { 5423 ret.splice(n--, 1); 5424 break; 5425 } 5426 } 5427 } 5428 } 5429 } 5430 5431 return ret; 5432 }, 5433 5434 has: function( target ) { 5435 var targets = jQuery( target ); 5436 return this.filter(function() { 5437 for ( var i = 0, l = targets.length; i < l; i++ ) { 5438 if ( jQuery.contains( this, targets[i] ) ) { 5439 return true; 5440 } 5441 } 5442 }); 5443 }, 5444 5445 not: function( selector ) { 5446 return this.pushStack( winnow(this, selector, false), "not", selector); 5447 }, 5448 5449 filter: function( selector ) { 5450 return this.pushStack( winnow(this, selector, true), "filter", selector ); 5451 }, 5452 5453 is: function( selector ) { 5454 return !!selector && ( 5455 typeof selector === "string" ? 5456 // If this is a positional selector, check membership in the returned set 5457 // so $("p:first").is("p:last") won't return true for a doc with two "p". 5458 POS.test( selector ) ? 5459 jQuery( selector, this.context ).index( this[0] ) >= 0 : 5460 jQuery.filter( selector, this ).length > 0 : 5461 this.filter( selector ).length > 0 ); 5462 }, 5463 5464 closest: function( selectors, context ) { 5465 var ret = [], i, l, cur = this[0]; 5466 5467 // Array (deprecated as of jQuery 1.7) 5468 if ( jQuery.isArray( selectors ) ) { 5469 var level = 1; 5470 5471 while ( cur && cur.ownerDocument && cur !== context ) { 5472 for ( i = 0; i < selectors.length; i++ ) { 5473 5474 if ( jQuery( cur ).is( selectors[ i ] ) ) { 5475 ret.push({ selector: selectors[ i ], elem: cur, level: level }); 5476 } 5477 } 5478 5479 cur = cur.parentNode; 5480 level++; 5481 } 5482 5483 return ret; 5484 } 5485 5486 // String 5487 var pos = POS.test( selectors ) || typeof selectors !== "string" ? 5488 jQuery( selectors, context || this.context ) : 5489 0; 5490 5491 for ( i = 0, l = this.length; i < l; i++ ) { 5492 cur = this[i]; 5493 5494 while ( cur ) { 5495 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { 5496 ret.push( cur ); 5497 break; 5498 5499 } else { 5500 cur = cur.parentNode; 5501 if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { 5502 break; 5503 } 5504 } 5505 } 5506 } 5507 5508 ret = ret.length > 1 ? jQuery.unique( ret ) : ret; 5509 5510 return this.pushStack( ret, "closest", selectors ); 5511 }, 5512 5513 // Determine the position of an element within 5514 // the matched set of elements 5515 index: function( elem ) { 5516 5517 // No argument, return index in parent 5518 if ( !elem ) { 5519 return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; 5520 } 5521 5522 // index in selector 5523 if ( typeof elem === "string" ) { 5524 return jQuery.inArray( this[0], jQuery( elem ) ); 5525 } 5526 5527 // Locate the position of the desired element 5528 return jQuery.inArray( 5529 // If it receives a jQuery object, the first element is used 5530 elem.jquery ? elem[0] : elem, this ); 5531 }, 5532 5533 add: function( selector, context ) { 5534 var set = typeof selector === "string" ? 5535 jQuery( selector, context ) : 5536 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), 5537 all = jQuery.merge( this.get(), set ); 5538 5539 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? 5540 all : 5541 jQuery.unique( all ) ); 5542 }, 5543 5544 andSelf: function() { 5545 return this.add( this.prevObject ); 5546 } 5547}); 5548 5549// A painfully simple check to see if an element is disconnected 5550// from a document (should be improved, where feasible). 5551function isDisconnected( node ) { 5552 return !node || !node.parentNode || node.parentNode.nodeType === 11; 5553} 5554 5555jQuery.each({ 5556 parent: function( elem ) { 5557 var parent = elem.parentNode; 5558 return parent && parent.nodeType !== 11 ? parent : null; 5559 }, 5560 parents: function( elem ) { 5561 return jQuery.dir( elem, "parentNode" ); 5562 }, 5563 parentsUntil: function( elem, i, until ) { 5564 return jQuery.dir( elem, "parentNode", until ); 5565 }, 5566 next: function( elem ) { 5567 return jQuery.nth( elem, 2, "nextSibling" ); 5568 }, 5569 prev: function( elem ) { 5570 return jQuery.nth( elem, 2, "previousSibling" ); 5571 }, 5572 nextAll: function( elem ) { 5573 return jQuery.dir( elem, "nextSibling" ); 5574 }, 5575 prevAll: function( elem ) { 5576 return jQuery.dir( elem, "previousSibling" ); 5577 }, 5578 nextUntil: function( elem, i, until ) { 5579 return jQuery.dir( elem, "nextSibling", until ); 5580 }, 5581 prevUntil: function( elem, i, until ) { 5582 return jQuery.dir( elem, "previousSibling", until ); 5583 }, 5584 siblings: function( elem ) { 5585 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); 5586 }, 5587 children: function( elem ) { 5588 return jQuery.sibling( elem.firstChild ); 5589 }, 5590 contents: function( elem ) { 5591 return jQuery.nodeName( elem, "iframe" ) ? 5592 elem.contentDocument || elem.contentWindow.document : 5593 jQuery.makeArray( elem.childNodes ); 5594 } 5595}, function( name, fn ) { 5596 jQuery.fn[ name ] = function( until, selector ) { 5597 var ret = jQuery.map( this, fn, until ); 5598 5599 if ( !runtil.test( name ) ) { 5600 selector = until; 5601 } 5602 5603 if ( selector && typeof selector === "string" ) { 5604 ret = jQuery.filter( selector, ret ); 5605 } 5606 5607 ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; 5608 5609 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { 5610 ret = ret.reverse(); 5611 } 5612 5613 return this.pushStack( ret, name, slice.call( arguments ).join(",") ); 5614 }; 5615}); 5616 5617jQuery.extend({ 5618 filter: function( expr, elems, not ) { 5619 if ( not ) { 5620 expr = ":not(" + expr + ")"; 5621 } 5622 5623 return elems.length === 1 ? 5624 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : 5625 jQuery.find.matches(expr, elems); 5626 }, 5627 5628 dir: function( elem, dir, until ) { 5629 var matched = [], 5630 cur = elem[ dir ]; 5631 5632 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { 5633 if ( cur.nodeType === 1 ) { 5634 matched.push( cur ); 5635 } 5636 cur = cur[dir]; 5637 } 5638 return matched; 5639 }, 5640 5641 nth: function( cur, result, dir, elem ) { 5642 result = result || 1; 5643 var num = 0; 5644 5645 for ( ; cur; cur = cur[dir] ) { 5646 if ( cur.nodeType === 1 && ++num === result ) { 5647 break; 5648 } 5649 } 5650 5651 return cur; 5652 }, 5653 5654 sibling: function( n, elem ) { 5655 var r = []; 5656 5657 for ( ; n; n = n.nextSibling ) { 5658 if ( n.nodeType === 1 && n !== elem ) { 5659 r.push( n ); 5660 } 5661 } 5662 5663 return r; 5664 } 5665}); 5666 5667// Implement the identical functionality for filter and not 5668function winnow( elements, qualifier, keep ) { 5669 5670 // Can't pass null or undefined to indexOf in Firefox 4 5671 // Set to 0 to skip string check 5672 qualifier = qualifier || 0; 5673 5674 if ( jQuery.isFunction( qualifier ) ) { 5675 return jQuery.grep(elements, function( elem, i ) { 5676 var retVal = !!qualifier.call( elem, i, elem ); 5677 return retVal === keep; 5678 }); 5679 5680 } else if ( qualifier.nodeType ) { 5681 return jQuery.grep(elements, function( elem, i ) { 5682 return ( elem === qualifier ) === keep; 5683 }); 5684 5685 } else if ( typeof qualifier === "string" ) { 5686 var filtered = jQuery.grep(elements, function( elem ) { 5687 return elem.nodeType === 1; 5688 }); 5689 5690 if ( isSimple.test( qualifier ) ) { 5691 return jQuery.filter(qualifier, filtered, !keep); 5692 } else { 5693 qualifier = jQuery.filter( qualifier, filtered ); 5694 } 5695 } 5696 5697 return jQuery.grep(elements, function( elem, i ) { 5698 return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; 5699 }); 5700} 5701 5702 5703 5704 5705function createSafeFragment( document ) { 5706 var list = nodeNames.split( "|" ), 5707 safeFrag = document.createDocumentFragment(); 5708 5709 if ( safeFrag.createElement ) { 5710 while ( list.length ) { 5711 safeFrag.createElement( 5712 list.pop() 5713 ); 5714 } 5715 } 5716 return safeFrag; 5717} 5718 5719var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + 5720 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", 5721 rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, 5722 rleadingWhitespace = /^\s+/, 5723 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, 5724 rtagName = /<([\w:]+)/, 5725 rtbody = /<tbody/i, 5726 rhtml = /<|&#?\w+;/, 5727 rnoInnerhtml = /<(?:script|style)/i, 5728 rnocache = /<(?:script|object|embed|option|style)/i, 5729 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), 5730 // checked="checked" or checked 5731 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5732 rscriptType = /\/(java|ecma)script/i, 5733 rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/, 5734 wrapMap = { 5735 option: [ 1, "<select multiple='multiple'>", "</select>" ], 5736 legend: [ 1, "<fieldset>", "</fieldset>" ], 5737 thead: [ 1, "<table>", "</table>" ], 5738 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 5739 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 5740 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 5741 area: [ 1, "<map>", "</map>" ], 5742 _default: [ 0, "", "" ] 5743 }, 5744 safeFragment = createSafeFragment( document ); 5745 5746wrapMap.optgroup = wrapMap.option; 5747wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5748wrapMap.th = wrapMap.td; 5749 5750// IE can't serialize <link> and <script> tags normally 5751if ( !jQuery.support.htmlSerialize ) { 5752 wrapMap._default = [ 1, "div<div>", "</div>" ]; 5753} 5754 5755jQuery.fn.extend({ 5756 text: function( value ) { 5757 return jQuery.access( this, function( value ) { 5758 return value === undefined ? 5759 jQuery.text( this ) : 5760 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); 5761 }, null, value, arguments.length ); 5762 }, 5763 5764 wrapAll: function( html ) { 5765 if ( jQuery.isFunction( html ) ) { 5766 return this.each(function(i) { 5767 jQuery(this).wrapAll( html.call(this, i) ); 5768 }); 5769 } 5770 5771 if ( this[0] ) { 5772 // The elements to wrap the target around 5773 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); 5774 5775 if ( this[0].parentNode ) { 5776 wrap.insertBefore( this[0] ); 5777 } 5778 5779 wrap.map(function() { 5780 var elem = this; 5781 5782 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 5783 elem = elem.firstChild; 5784 } 5785 5786 return elem; 5787 }).append( this ); 5788 } 5789 5790 return this; 5791 }, 5792 5793 wrapInner: function( html ) { 5794 if ( jQuery.isFunction( html ) ) { 5795 return this.each(function(i) { 5796 jQuery(this).wrapInner( html.call(this, i) ); 5797 }); 5798 } 5799 5800 return this.each(function() { 5801 var self = jQuery( this ), 5802 contents = self.contents(); 5803 5804 if ( contents.length ) { 5805 contents.wrapAll( html ); 5806 5807 } else { 5808 self.append( html ); 5809 } 5810 }); 5811 }, 5812 5813 wrap: function( html ) { 5814 var isFunction = jQuery.isFunction( html ); 5815 5816 return this.each(function(i) { 5817 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); 5818 }); 5819 }, 5820 5821 unwrap: function() { 5822 return this.parent().each(function() { 5823 if ( !jQuery.nodeName( this, "body" ) ) { 5824 jQuery( this ).replaceWith( this.childNodes ); 5825 } 5826 }).end(); 5827 }, 5828 5829 append: function() { 5830 return this.domManip(arguments, true, function( elem ) { 5831 if ( this.nodeType === 1 ) { 5832 this.appendChild( elem ); 5833 } 5834 }); 5835 }, 5836 5837 prepend: function() { 5838 return this.domManip(arguments, true, function( elem ) { 5839 if ( this.nodeType === 1 ) { 5840 this.insertBefore( elem, this.firstChild ); 5841 } 5842 }); 5843 }, 5844 5845 before: function() { 5846 if ( this[0] && this[0].parentNode ) { 5847 return this.domManip(arguments, false, function( elem ) { 5848 this.parentNode.insertBefore( elem, this ); 5849 }); 5850 } else if ( arguments.length ) { 5851 var set = jQuery.clean( arguments ); 5852 set.push.apply( set, this.toArray() ); 5853 return this.pushStack( set, "before", arguments ); 5854 } 5855 }, 5856 5857 after: function() { 5858 if ( this[0] && this[0].parentNode ) { 5859 return this.domManip(arguments, false, function( elem ) { 5860 this.parentNode.insertBefore( elem, this.nextSibling ); 5861 }); 5862 } else if ( arguments.length ) { 5863 var set = this.pushStack( this, "after", arguments ); 5864 set.push.apply( set, jQuery.clean(arguments) ); 5865 return set; 5866 } 5867 }, 5868 5869 // keepData is for internal use only--do not document 5870 remove: function( selector, keepData ) { 5871 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 5872 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { 5873 if ( !keepData && elem.nodeType === 1 ) { 5874 jQuery.cleanData( elem.getElementsByTagName("*") ); 5875 jQuery.cleanData( [ elem ] ); 5876 } 5877 5878 if ( elem.parentNode ) { 5879 elem.parentNode.removeChild( elem ); 5880 } 5881 } 5882 } 5883 5884 return this; 5885 }, 5886 5887 empty: function() { 5888 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 5889 // Remove element nodes and prevent memory leaks 5890 if ( elem.nodeType === 1 ) { 5891 jQuery.cleanData( elem.getElementsByTagName("*") ); 5892 } 5893 5894 // Remove any remaining nodes 5895 while ( elem.firstChild ) { 5896 elem.removeChild( elem.firstChild ); 5897 } 5898 } 5899 5900 return this; 5901 }, 5902 5903 clone: function( dataAndEvents, deepDataAndEvents ) { 5904 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5905 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5906 5907 return this.map( function () { 5908 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 5909 }); 5910 }, 5911 5912 html: function( value ) { 5913 return jQuery.access( this, function( value ) { 5914 var elem = this[0] || {}, 5915 i = 0, 5916 l = this.length; 5917 5918 if ( value === undefined ) { 5919 return elem.nodeType === 1 ? 5920 elem.innerHTML.replace( rinlinejQuery, "" ) : 5921 null; 5922 } 5923 5924 5925 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 5926 ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && 5927 !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { 5928 5929 value = value.replace( rxhtmlTag, "<$1></$2>" ); 5930
5931 try { 5932 for (; i < l; i++ ) { 5933 // Remove element nodes and prevent memory leaks 5934 elem = this[i] || {}; 5935 if ( elem.nodeType === 1 ) { 5936 jQuery.cleanData( elem.getElementsByTagName( "*" ) ); 5937 elem.innerHTML = value; 5938 } 5939 } 5940 5941 elem = 0; 5942 5943 // If using innerHTML throws an exception, use the fallback method 5944 } catch(e) {} 5945 } 5946 5947 if ( elem ) { 5948 this.empty().append( value ); 5949 } 5950 }, null, value, arguments.length ); 5951 }, 5952 5953 replaceWith: function( value ) { 5954 if ( this[0] && this[0].parentNode ) { 5955 // Make sure that the elements are removed from the DOM before they are inserted 5956 // this can help fix replacing a parent with child elements 5957 if ( jQuery.isFunction( value ) ) { 5958 return this.each(function(i) { 5959 var self = jQuery(this), old = self.html(); 5960 self.replaceWith( value.call( this, i, old ) ); 5961 }); 5962 } 5963 5964 if ( typeof value !== "string" ) { 5965 value = jQuery( value ).detach(); 5966 } 5967 5968 return this.each(function() { 5969 var next = this.nextSibling, 5970 parent = this.parentNode; 5971 5972 jQuery( this ).remove(); 5973 5974 if ( next ) { 5975 jQuery(next).before( value ); 5976 } else { 5977 jQuery(parent).append( value ); 5978 } 5979 }); 5980 } else { 5981 return this.length ? 5982 this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : 5983 this; 5984 } 5985 }, 5986 5987 detach: function( selector ) { 5988 return this.remove( selector, true ); 5989 }, 5990 5991 domManip: function( args, table, callback ) { 5992 var results, first, fragment, parent, 5993 value = args[0], 5994 scripts = []; 5995 5996 // We can't cloneNode fragments that contain checked, in WebKit 5997 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { 5998 return this.each(function() { 5999 jQuery(this).domManip( args, table, callback, true ); 6000 }); 6001 } 6002 6003 if ( jQuery.isFunction(value) ) { 6004 return this.each(function(i) { 6005 var self = jQuery(this); 6006 args[0] = value.call(this, i, table ? self.html() : undefined); 6007 self.domManip( args, table, callback ); 6008 }); 6009 } 6010 6011 if ( this[0] ) { 6012 parent = value && value.parentNode; 6013 6014 // If we're in a fragment, just use that instead of building a new one 6015 if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { 6016 results = { fragment: parent }; 6017 6018 } else { 6019 results = jQuery.buildFragment( args, this, scripts ); 6020 } 6021 6022 fragment = results.fragment; 6023 6024 if ( fragment.childNodes.length === 1 ) { 6025 first = fragment = fragment.firstChild; 6026 } else { 6027 first = fragment.firstChild; 6028 } 6029 6030 if ( first ) { 6031 table = table && jQuery.nodeName( first, "tr" ); 6032 6033 for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { 6034 callback.call( 6035 table ? 6036 root(this[i], first) : 6037 this[i], 6038 // Make sure that we do not leak memory by inadvertently discarding 6039 // the original fragment (which might have attached data) instead of 6040 // using it; in addition, use the original fragment object for the last 6041 // item instead of first because it can end up being emptied incorrectly 6042 // in certain situations (Bug #8070). 6043 // Fragments from the fragment cache must always be cloned and never used 6044 // in place. 6045 results.cacheable || ( l > 1 && i < lastIndex ) ? 6046 jQuery.clone( fragment, true, true ) : 6047 fragment 6048 ); 6049 } 6050 } 6051 6052 if ( scripts.length ) { 6053 jQuery.each( scripts, function( i, elem ) { 6054 if ( elem.src ) { 6055 jQuery.ajax({ 6056 type: "GET", 6057 global: false, 6058 url: elem.src, 6059 async: false, 6060 dataType: "script" 6061 }); 6062 } else { 6063 jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); 6064 } 6065 6066 if ( elem.parentNode ) { 6067 elem.parentNode.removeChild( elem ); 6068 } 6069 }); 6070 } 6071 } 6072 6073 return this; 6074 } 6075}); 6076 6077function root( elem, cur ) { 6078 return jQuery.nodeName(elem, "table") ? 6079 (elem.getElementsByTagName("tbody")[0] || 6080 elem.appendChild(elem.ownerDocument.createElement("tbody"))) : 6081 elem; 6082} 6083 6084function cloneCopyEvent( src, dest ) { 6085
vendor: 4,528 bytes, lines 6086-6220
6086 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 6087 return; 6088 } 6089 6090 var type, i, l, 6091 oldData = jQuery._data( src ), 6092 curData = jQuery._data( dest, oldData ), 6093 events = oldData.events; 6094 6095 if ( events ) { 6096 delete curData.handle; 6097 curData.events = {}; 6098 6099 for ( type in events ) { 6100 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6101 jQuery.event.add( dest, type, events[ type ][ i ] ); 6102 } 6103 } 6104 } 6105 6106 // make the cloned public data object a copy from the original 6107 if ( curData.data ) { 6108 curData.data = jQuery.extend( {}, curData.data ); 6109 } 6110} 6111 6112function cloneFixAttributes( src, dest ) { 6113 var nodeName; 6114 6115 // We do not need to do anything for non-Elements 6116 if ( dest.nodeType !== 1 ) { 6117 return; 6118 } 6119 6120 // clearAttributes removes the attributes, which we don't want, 6121 // but also removes the attachEvent events, which we *do* want 6122 if ( dest.clearAttributes ) { 6123 dest.clearAttributes(); 6124 } 6125 6126 // mergeAttributes, in contrast, only merges back on the 6127 // original attributes, not the events 6128 if ( dest.mergeAttributes ) { 6129 dest.mergeAttributes( src ); 6130 } 6131 6132 nodeName = dest.nodeName.toLowerCase(); 6133 6134 // IE6-8 fail to clone children inside object elements that use 6135 // the proprietary classid attribute value (rather than the type 6136 // attribute) to identify the type of content to display 6137 if ( nodeName === "object" ) { 6138 dest.outerHTML = src.outerHTML; 6139 6140 } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { 6141 // IE6-8 fails to persist the checked state of a cloned checkbox 6142 // or radio button. Worse, IE6-7 fail to give the cloned element 6143 // a checked appearance if the defaultChecked value isn't also set 6144 if ( src.checked ) { 6145 dest.defaultChecked = dest.checked = src.checked; 6146 } 6147 6148 // IE6-7 get confused and end up setting the value of a cloned 6149 // checkbox/radio button to an empty string instead of "on" 6150 if ( dest.value !== src.value ) { 6151 dest.value = src.value; 6152 } 6153 6154 // IE6-8 fails to return the selected option to the default selected 6155 // state when cloning options 6156 } else if ( nodeName === "option" ) { 6157 dest.selected = src.defaultSelected; 6158 6159 // IE6-8 fails to set the defaultValue to the correct value when 6160 // cloning other types of input fields 6161 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6162 dest.defaultValue = src.defaultValue; 6163 6164 // IE blanks contents when cloning scripts 6165 } else if ( nodeName === "script" && dest.text !== src.text ) { 6166 dest.text = src.text; 6167 } 6168 6169 // Event data gets referenced instead of copied if the expando 6170 // gets copied too 6171 dest.removeAttribute( jQuery.expando ); 6172 6173 // Clear flags for bubbling special change/submit events, they must 6174 // be reattached when the newly cloned events are first activated 6175 dest.removeAttribute( "_submit_attached" ); 6176 dest.removeAttribute( "_change_attached" ); 6177} 6178 6179jQuery.buildFragment = function( args, nodes, scripts ) { 6180 var fragment, cacheable, cacheresults, doc, 6181 first = args[ 0 ]; 6182 6183 // nodes may contain either an explicit document object, 6184 // a jQuery collection or context object. 6185 // If nodes[0] contains a valid object to assign to doc 6186 if ( nodes && nodes[0] ) { 6187 doc = nodes[0].ownerDocument || nodes[0]; 6188 } 6189 6190 // Ensure that an attr object doesn't incorrectly stand in as a document object 6191 // Chrome and Firefox seem to allow this to occur and will throw exception 6192 // Fixes #8950 6193 if ( !doc.createDocumentFragment ) { 6194 doc = document; 6195 } 6196 6197 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document 6198 // Cloning options loses the selected state, so don't cache them 6199 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment 6200 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache 6201 // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 6202 if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && 6203 first.charAt(0) === "<" && !rnocache.test( first ) && 6204 (jQuery.support.checkClone || !rchecked.test( first )) && 6205 (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { 6206 6207 cacheable = true; 6208 6209 cacheresults = jQuery.fragments[ first ]; 6210 if ( cacheresults && cacheresults !== 1 ) { 6211 fragment = cacheresults; 6212 } 6213 } 6214 6215 if ( !fragment ) { 6216 fragment = doc.createDocumentFragment(); 6217 jQuery.clean( args, doc, fragment, scripts ); 6218 } 6219 6220 if ( cacheable ) {
6221 jQuery.fragments[ first ] = cacheresults ? fragment : 1; 6222 } 6223 6224 return { fragment: fragment, cacheable: cacheable }; 6225}; 6226 6227jQuery.fragments = {}; 6228 6229jQuery.each({ 6230 appendTo: "append", 6231 prependTo: "prepend", 6232 insertBefore: "before", 6233 insertAfter: "after", 6234 replaceAll: "replaceWith" 6235}, function( name, original ) { 6236 jQuery.fn[ name ] = function( selector ) { 6237 var ret = [], 6238 insert = jQuery( selector ), 6239 parent = this.length === 1 && this[0].parentNode; 6240 6241 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { 6242 insert[ original ]( this[0] ); 6243 return this; 6244 6245 } else { 6246 for ( var i = 0, l = insert.length; i < l; i++ ) { 6247 var elems = ( i > 0 ? this.clone(true) : this ).get(); 6248 jQuery( insert[i] )[ original ]( elems ); 6249 ret = ret.concat( elems ); 6250 } 6251 6252 return this.pushStack( ret, name, insert.selector ); 6253 } 6254 }; 6255}); 6256 6257function getAll( elem ) { 6258 if ( typeof elem.getElementsByTagName !== "undefined" ) { 6259 return elem.getElementsByTagName( "*" ); 6260 6261 } else if ( typeof elem.querySelectorAll !== "undefined" ) { 6262 return elem.querySelectorAll( "*" ); 6263 6264 } else { 6265 return []; 6266 } 6267} 6268 6269// Used in clean, fixes the defaultChecked property 6270function fixDefaultChecked( elem ) { 6271 if ( elem.type === "checkbox" || elem.type === "radio" ) { 6272 elem.defaultChecked = elem.checked; 6273 } 6274} 6275// Finds all inputs and passes them to fixDefaultChecked 6276function findInputs( elem ) { 6277 var nodeName = ( elem.nodeName || "" ).toLowerCase(); 6278 if ( nodeName === "input" ) { 6279 fixDefaultChecked( elem ); 6280 // Skip scripts, get other children 6281 } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { 6282 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); 6283 } 6284} 6285 6286// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js 6287function shimCloneNode( elem ) { 6288 var div = document.createElement( "div" ); 6289 safeFragment.appendChild( div ); 6290 6291 div.innerHTML = elem.outerHTML; 6292 return div.firstChild; 6293} 6294 6295jQuery.extend({ 6296 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6297 var srcElements, 6298 destElements, 6299 i, 6300 // IE<=8 does not properly clone detached, unknown element nodes 6301 clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ? 6302 elem.cloneNode( true ) : 6303 shimCloneNode( elem ); 6304 6305 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && 6306 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { 6307 // IE copies events bound via attachEvent when using cloneNode. 6308 // Calling detachEvent on the clone will also remove the events 6309 // from the original. In order to get around this, we use some 6310 // proprietary methods to clear the events. Thanks to MooTools 6311 // guys for this hotness. 6312 6313 cloneFixAttributes( elem, clone ); 6314 6315 // Using Sizzle here is crazy slow, so we use getElementsByTagName instead 6316 srcElements = getAll( elem ); 6317 destElements = getAll( clone ); 6318 6319 // Weird iteration because IE will replace the length property 6320 // with an element if you are cloning the body and one of the 6321 // elements on the page has a name or id of "length" 6322 for ( i = 0; srcElements[i]; ++i ) { 6323 // Ensure that the destination node is not null; Fixes #9587 6324 if ( destElements[i] ) { 6325 cloneFixAttributes( srcElements[i], destElements[i] ); 6326 } 6327 } 6328 } 6329 6330 // Copy the events from the original to the clone 6331 if ( dataAndEvents ) { 6332 cloneCopyEvent( elem, clone ); 6333 6334 if ( deepDataAndEvents ) { 6335 srcElements = getAll( elem ); 6336 destElements = getAll( clone ); 6337 6338 for ( i = 0; srcElements[i]; ++i ) { 6339 cloneCopyEvent( srcElements[i], destElements[i] ); 6340 } 6341 } 6342 } 6343 6344 srcElements = destElements = null; 6345 6346 // Return the cloned set 6347 return clone; 6348 }, 6349 6350 clean: function( elems, context, fragment, scripts ) { 6351 var checkScriptType, script, j, 6352 ret = []; 6353 6354 context = context || document; 6355 6356 // !context.createElement fails in IE with an error but returns typeof 'object' 6357 if ( typeof context.createElement === "undefined" ) { 6358 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 6359 } 6360 6361 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 6362 if ( typeof elem === "number" ) { 6363 elem += ""; 6364 } 6365 6366 if ( !elem ) { 6367 continue; 6368 } 6369 6370 // Convert html string into DOM nodes 6371 if ( typeof elem === "string" ) { 6372 if ( !rhtml.test( elem ) ) { 6373 elem = context.createTextNode( elem ); 6374 } else { 6375 // Fix "XHTML"-style tags in all browsers 6376 elem = elem.replace(rxhtmlTag, "<$1></$2>"); 6377 6378 // Trim whitespace, otherwise indexOf won't work as expected 6379 var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), 6380 wrap = wrapMap[ tag ] || wrapMap._default, 6381 depth = wrap[0], 6382 div = context.createElement("div"), 6383 safeChildNodes = safeFragment.childNodes, 6384 remove; 6385 6386 // Append wrapper element to unknown element safe doc fragment 6387 if ( context === document ) { 6388 // Use the fragment we've already created for this document 6389 safeFragment.appendChild( div ); 6390 } else { 6391 // Use a fragment created with the owner document 6392 createSafeFragment( context ).appendChild( div ); 6393 } 6394 6395 // Go to html and back, then peel off extra wrappers 6396 div.innerHTML = wrap[1] + elem + wrap[2]; 6397 6398 // Move to the right depth 6399 while ( depth-- ) {
6400 div = div.lastChild; 6401 } 6402 6403 // Remove IE's autoinserted <tbody> from table fragments 6404 if ( !jQuery.support.tbody ) { 6405 6406 // String was a <table>, *may* have spurious <tbody> 6407 var hasBody = rtbody.test(elem), 6408 tbody = tag === "table" && !hasBody ? 6409 div.firstChild && div.firstChild.childNodes : 6410 6411 // String was a bare <thead> or <tfoot> 6412 wrap[1] === "<table>" && !hasBody ? 6413 div.childNodes : 6414 []; 6415 6416 for ( j = tbody.length - 1; j >= 0 ; --j ) { 6417 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { 6418 tbody[ j ].parentNode.removeChild( tbody[ j ] ); 6419 } 6420 } 6421 } 6422 6423 // IE completely kills leading whitespace when innerHTML is used 6424 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 6425 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); 6426 } 6427 6428 elem = div.childNodes; 6429 6430 // Clear elements from DocumentFragment (safeFragment or otherwise) 6431 // to avoid hoarding elements. Fixes #11356 6432 if ( div ) { 6433 div.parentNode.removeChild( div ); 6434 6435 // Guard against -1 index exceptions in FF3.6 6436 if ( safeChildNodes.length > 0 ) { 6437 remove = safeChildNodes[ safeChildNodes.length - 1 ]; 6438 6439 if ( remove && remove.parentNode ) { 6440 remove.parentNode.removeChild( remove ); 6441 } 6442 } 6443 } 6444 } 6445 } 6446 6447 // Resets defaultChecked for any radios and checkboxes 6448 // about to be appended to the DOM in IE 6/7 (#8060) 6449 var len; 6450 if ( !jQuery.support.appendChecked ) { 6451 if ( elem[0] && typeof (len = elem.length) === "number" ) { 6452 for ( j = 0; j < len; j++ ) { 6453 findInputs( elem[j] ); 6454 } 6455 } else { 6456 findInputs( elem ); 6457 } 6458 } 6459 6460 if ( elem.nodeType ) { 6461 ret.push( elem ); 6462 } else { 6463 ret = jQuery.merge( ret, elem ); 6464 } 6465 } 6466 6467 if ( fragment ) { 6468 checkScriptType = function( elem ) { 6469 return !elem.type || rscriptType.test( elem.type ); 6470 }; 6471 for ( i = 0; ret[i]; i++ ) { 6472 script = ret[i]; 6473 if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) { 6474 scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script ); 6475 6476 } else { 6477 if ( script.nodeType === 1 ) { 6478 var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType ); 6479 6480 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); 6481 } 6482 fragment.appendChild( script ); 6483 } 6484 } 6485 } 6486 6487 return ret; 6488 }, 6489 6490 cleanData: function( elems ) { 6491 var data, id, 6492 cache = jQuery.cache, 6493 special = jQuery.event.special, 6494 deleteExpando = jQuery.support.deleteExpando; 6495 6496 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 6497 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { 6498 continue; 6499 } 6500 6501 id = elem[ jQuery.expando ]; 6502 6503 if ( id ) { 6504 data = cache[ id ]; 6505 6506 if ( data && data.events ) { 6507 for ( var type in data.events ) { 6508 if ( special[ type ] ) { 6509 jQuery.event.remove( elem, type ); 6510 6511 // This is a shortcut to avoid jQuery.event.remove's overhead 6512 } else { 6513 jQuery.removeEvent( elem, type, data.handle ); 6514 } 6515 } 6516 6517 // Null the DOM reference to avoid IE6/7/8 leak (#7054) 6518 if ( data.handle ) { 6519 data.handle.elem = null; 6520 } 6521 } 6522 6523 if ( deleteExpando ) { 6524 delete elem[ jQuery.expando ]; 6525 6526 } else if ( elem.removeAttribute ) { 6527 elem.removeAttribute( jQuery.expando ); 6528 } 6529 6530 delete cache[ id ]; 6531 } 6532 } 6533 } 6534}); 6535 6536 6537 6538 6539var ralpha = /alpha\([^)]*\)/i, 6540 ropacity = /opacity=([^)]*)/, 6541 // fixed for IE9, see #8346 6542 rupper = /([A-Z]|^ms)/g, 6543 rnum = /^[\-+]?(?:\d*\.)?\d+$/i, 6544 rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i, 6545 rrelNum = /^([\-+])=([\-+.\de]+)/, 6546 rmargin = /^margin/, 6547 6548 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6549 6550 // order is important! 6551 cssExpand = [ "Top", "Right", "Bottom", "Left" ], 6552 6553 curCSS, 6554 6555 getComputedStyle, 6556 currentStyle; 6557 6558jQuery.fn.css = function( name, value ) { 6559 return jQuery.access( this, function( elem, name, value ) { 6560 return value !== undefined ? 6561 jQuery.style( elem, name, value ) : 6562 jQuery.css( elem, name ); 6563 }, name, value, arguments.length > 1 ); 6564};
6565 6566jQuery.extend({ 6567 // Add in style property hooks for overriding the default 6568 // behavior of getting and setting a style property 6569 cssHooks: { 6570 opacity: { 6571 get: function( elem, computed ) { 6572 if ( computed ) { 6573 // We should always get a number back from opacity 6574 var ret = curCSS( elem, "opacity" ); 6575 return ret === "" ? "1" : ret; 6576 6577 } else { 6578 return elem.style.opacity; 6579 } 6580 } 6581 } 6582 }, 6583 6584 // Exclude the following css properties to add px 6585 cssNumber: { 6586 "fillOpacity": true, 6587 "fontWeight": true, 6588 "lineHeight": true, 6589 "opacity": true, 6590 "orphans": true, 6591 "widows": true, 6592 "zIndex": true, 6593 "zoom": true 6594 }, 6595 6596 // Add in properties whose names you wish to fix before 6597 // setting or getting the value 6598 cssProps: { 6599 // normalize float css property 6600 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" 6601 }, 6602 6603 // Get and set the style property on a DOM Node 6604 style: function( elem, name, value, extra ) { 6605 // Don't set styles on text and comment nodes 6606 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6607 return; 6608 } 6609 6610 // Make sure that we're working with the right name 6611 var ret, type, origName = jQuery.camelCase( name ), 6612 style = elem.style, hooks = jQuery.cssHooks[ origName ]; 6613 6614 name = jQuery.cssProps[ origName ] || origName; 6615 6616 // Check if we're setting a value 6617 if ( value !== undefined ) { 6618 type = typeof value; 6619 6620 // convert relative number strings (+= or -=) to relative numbers. #7345 6621 if ( type === "string" && (ret = rrelNum.exec( value )) ) { 6622 value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); 6623 // Fixes bug #9237 6624 type = "number"; 6625 } 6626 6627 // Make sure that NaN and null values aren't set. See: #7116 6628 if ( value == null || type === "number" && isNaN( value ) ) { 6629 return; 6630 } 6631 6632 // If a number was passed in, add 'px' to the (except for certain CSS properties) 6633 if ( type === "number" && !jQuery.cssNumber[ origName ] ) { 6634 value += "px"; 6635 } 6636 6637 // If a hook was provided, use that value, otherwise just set the specified value 6638 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { 6639 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided 6640 // Fixes bug #5509 6641 try { 6642 style[ name ] = value; 6643 } catch(e) {} 6644 } 6645 6646 } else { 6647 // If a hook was provided get the non-computed value from there 6648 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { 6649 return ret; 6650 } 6651 6652 // Otherwise just get the value from the style object 6653 return style[ name ]; 6654 } 6655 }, 6656 6657 css: function( elem, name, extra ) { 6658 var ret, hooks; 6659 6660 // Make sure that we're working with the right name 6661 name = jQuery.camelCase( name ); 6662 hooks = jQuery.cssHooks[ name ]; 6663 name = jQuery.cssProps[ name ] || name; 6664 6665 // cssFloat needs a special treatment 6666 if ( name === "cssFloat" ) { 6667 name = "float"; 6668 } 6669 6670 // If a hook was provided get the computed value from there 6671 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { 6672 return ret; 6673 6674 // Otherwise, if a way to get the computed value exists, use that 6675 } else if ( curCSS ) { 6676 return curCSS( elem, name ); 6677 } 6678 }, 6679 6680 // A method for quickly swapping in/out CSS properties to get correct calculations 6681 swap: function( elem, options, callback ) { 6682 var old = {}, 6683 ret, name; 6684 6685 // Remember the old values, and insert the new ones 6686 for ( name in options ) { 6687 old[ name ] = elem.style[ name ]; 6688 elem.style[ name ] = options[ name ]; 6689 } 6690 6691 ret = callback.call( elem ); 6692 6693 // Revert the old values 6694 for ( name in options ) { 6695 elem.style[ name ] = old[ name ]; 6696 } 6697 6698 return ret; 6699 } 6700}); 6701 6702// DEPRECATED in 1.3, Use jQuery.css() instead 6703jQuery.curCSS = jQuery.css; 6704 6705if ( document.defaultView && document.defaultView.getComputedStyle ) { 6706 getComputedStyle = function( elem, name ) { 6707 var ret, defaultView, computedStyle, width, 6708 style = elem.style; 6709 6710 name = name.replace( rupper, "-$1" ).toLowerCase(); 6711 6712 if ( (defaultView = elem.ownerDocument.defaultView) && 6713 (computedStyle = defaultView.getComputedStyle( elem, null )) ) { 6714 6715 ret = computedStyle.getPropertyValue( name ); 6716 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { 6717 ret = jQuery.style( elem, name ); 6718 } 6719 } 6720 6721 // A tribute to the "awesome hack by Dean Edwards" 6722 // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins 6723 // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values 6724 if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) { 6725 width = style.width; 6726 style.width = ret; 6727 ret = computedStyle.width; 6728 style.width = width; 6729 } 6730 6731 return ret; 6732 }; 6733} 6734 6735if ( document.documentElement.currentStyle ) { 6736 currentStyle = function( elem, name ) { 6737 var left, rsLeft, uncomputed, 6738 ret = elem.currentStyle && elem.currentStyle[ name ], 6739 style = elem.style; 6740 6741 // Avoid setting ret to empty string here 6742 // so we don't default to auto 6743 if ( ret == null && style && (uncomputed = style[ name ]) ) { 6744 ret = uncomputed; 6745 } 6746 6747 // From the awesome hack by Dean Edwards 6748 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6749 6750 // If we're not dealing with a regular pixel number 6751 // but a number that has a weird ending, we need to convert it to pixels 6752 if ( rnumnonpx.test( ret ) ) { 6753 6754 // Remember the original values 6755 left = style.left; 6756 rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; 6757 6758 // Put in the new values to get a computed value out 6759 if ( rsLeft ) { 6760 elem.runtimeStyle.left = elem.currentStyle.left; 6761 } 6762 style.left = name === "fontSize" ? "1em" : ret; 6763 ret = style.pixelLeft + "px"; 6764 6765 // Revert the changed values 6766 style.left = left; 6767 if ( rsLeft ) { 6768 elem.runtimeStyle.left = rsLeft; 6769 } 6770 } 6771 6772 return ret === "" ? "auto" : ret; 6773 }; 6774} 6775 6776curCSS = getComputedStyle || currentStyle; 6777 6778function getWidthOrHeight( elem, name, extra ) { 6779 6780 // Start with offset property 6781 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6782 i = name === "width" ? 1 : 0, 6783 len = 4; 6784 6785 if ( val > 0 ) { 6786 if ( extra !== "border" ) { 6787 for ( ; i < len; i += 2 ) { 6788 if ( !extra ) { 6789 val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0; 6790 } 6791 if ( extra === "margin" ) { 6792 val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0; 6793 } else { 6794 val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; 6795 } 6796 } 6797 } 6798 6799 return val + "px"; 6800 } 6801 6802 // Fall back to computed then uncomputed css if necessary 6803 val = curCSS( elem, name ); 6804 if ( val < 0 || val == null ) { 6805 val = elem.style[ name ]; 6806 } 6807 6808 // Computed unit is not pixels. Stop here and return. 6809 if ( rnumnonpx.test(val) ) { 6810 return val; 6811 } 6812 6813 // Normalize "", auto, and prepare for extra 6814 val = parseFloat( val ) || 0; 6815 6816 // Add padding, border, margin 6817 if ( extra ) { 6818 for ( ; i < len; i += 2 ) { 6819 val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0; 6820 if ( extra !== "padding" ) { 6821 val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; 6822 } 6823 if ( extra === "margin" ) { 6824 val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0; 6825 } 6826 } 6827 } 6828 6829 return val + "px"; 6830} 6831 6832jQuery.each([ "height", "width" ], function( i, name ) { 6833 jQuery.cssHooks[ name ] = { 6834 get: function( elem, computed, extra ) { 6835 if ( computed ) { 6836 if ( elem.offsetWidth !== 0 ) { 6837 return getWidthOrHeight( elem, name, extra ); 6838 } else { 6839 return jQuery.swap( elem, cssShow, function() { 6840 return getWidthOrHeight( elem, name, extra ); 6841 });
vendor: 28,632 bytes, lines 6842-7842
6842 } 6843 } 6844 }, 6845 6846 set: function( elem, value ) { 6847 return rnum.test( value ) ? 6848 value + "px" : 6849 value; 6850 } 6851 }; 6852}); 6853 6854if ( !jQuery.support.opacity ) { 6855 jQuery.cssHooks.opacity = { 6856 get: function( elem, computed ) { 6857 // IE uses filters for opacity 6858 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? 6859 ( parseFloat( RegExp.$1 ) / 100 ) + "" : 6860 computed ? "1" : ""; 6861 }, 6862 6863 set: function( elem, value ) { 6864 var style = elem.style, 6865 currentStyle = elem.currentStyle, 6866 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 6867 filter = currentStyle && currentStyle.filter || style.filter || ""; 6868 6869 // IE has trouble with opacity if it does not have layout 6870 // Force it by setting the zoom level 6871 style.zoom = 1; 6872 6873 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 6874 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { 6875 6876 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 6877 // if "filter:" is present at all, clearType is disabled, we want to avoid this 6878 // style.removeAttribute is IE Only, but so apparently is this code path... 6879 style.removeAttribute( "filter" ); 6880 6881 // if there there is no filter style applied in a css rule, we are done 6882 if ( currentStyle && !currentStyle.filter ) { 6883 return; 6884 } 6885 } 6886 6887 // otherwise, set new filter values 6888 style.filter = ralpha.test( filter ) ? 6889 filter.replace( ralpha, opacity ) : 6890 filter + " " + opacity; 6891 } 6892 }; 6893} 6894 6895jQuery(function() { 6896 // This hook cannot be added until DOM ready because the support test 6897 // for it is not run until after DOM ready 6898 if ( !jQuery.support.reliableMarginRight ) { 6899 jQuery.cssHooks.marginRight = { 6900 get: function( elem, computed ) { 6901 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6902 // Work around by temporarily setting element display to inline-block 6903 return jQuery.swap( elem, { "display": "inline-block" }, function() { 6904 if ( computed ) { 6905 return curCSS( elem, "margin-right" ); 6906 } else { 6907 return elem.style.marginRight; 6908 } 6909 }); 6910 } 6911 }; 6912 } 6913}); 6914 6915if ( jQuery.expr && jQuery.expr.filters ) { 6916 jQuery.expr.filters.hidden = function( elem ) { 6917 var width = elem.offsetWidth, 6918 height = elem.offsetHeight; 6919 6920 return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); 6921 }; 6922 6923 jQuery.expr.filters.visible = function( elem ) { 6924 return !jQuery.expr.filters.hidden( elem ); 6925 }; 6926} 6927 6928// These hooks are used by animate to expand properties 6929jQuery.each({ 6930 margin: "", 6931 padding: "", 6932 border: "Width" 6933}, function( prefix, suffix ) { 6934 6935 jQuery.cssHooks[ prefix + suffix ] = { 6936 expand: function( value ) { 6937 var i, 6938 6939 // assumes a single number if not a string 6940 parts = typeof value === "string" ? value.split(" ") : [ value ], 6941 expanded = {}; 6942 6943 for ( i = 0; i < 4; i++ ) { 6944 expanded[ prefix + cssExpand[ i ] + suffix ] = 6945 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6946 } 6947 6948 return expanded; 6949 } 6950 }; 6951}); 6952 6953 6954 6955 6956var r20 = /%20/g, 6957 rbracket = /\[\]$/, 6958 rCRLF = /\r?\n/g, 6959 rhash = /#.*$/, 6960 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 6961 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 6962 // #7653, #8125, #8152: local protocol detection 6963 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, 6964 rnoContent = /^(?:GET|HEAD)$/, 6965 rprotocol = /^\/\//, 6966 rquery = /\?/, 6967 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, 6968 rselectTextarea = /^(?:select|textarea)/i, 6969 rspacesAjax = /\s+/, 6970 rts = /([?&])_=[^&]*/, 6971 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, 6972 6973 // Keep a copy of the old load method 6974 _load = jQuery.fn.load, 6975 6976 /* Prefilters 6977 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 6978 * 2) These are called: 6979 * - BEFORE asking for a transport 6980 * - AFTER param serialization (s.data is a string if s.processData is true) 6981 * 3) key is the dataType 6982 * 4) the catchall symbol "*" can be used 6983 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 6984 */ 6985 prefilters = {}, 6986 6987 /* Transports bindings 6988 * 1) key is the dataType 6989 * 2) the catchall symbol "*" can be used 6990 * 3) selection will start with transport dataType and THEN go to "*" if needed 6991 */ 6992 transports = {}, 6993 6994 // Document location 6995 ajaxLocation, 6996 6997 // Document location segments 6998 ajaxLocParts, 6999 7000 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 7001 allTypes = ["*/"] + ["*"]; 7002 7003// #8138, IE may throw an exception when accessing 7004// a field from window.location if document.domain has been set 7005try { 7006 ajaxLocation = location.href; 7007} catch( e ) { 7008 // Use the href attribute of an A element 7009 // since IE will modify it given document.location 7010 ajaxLocation = document.createElement( "a" ); 7011 ajaxLocation.href = ""; 7012 ajaxLocation = ajaxLocation.href; 7013} 7014 7015// Segment location into parts 7016ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 7017 7018// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 7019function addToPrefiltersOrTransports( structure ) { 7020 7021 // dataTypeExpression is optional and defaults to "*" 7022 return function( dataTypeExpression, func ) { 7023 7024 if ( typeof dataTypeExpression !== "string" ) { 7025 func = dataTypeExpression; 7026 dataTypeExpression = "*"; 7027 } 7028 7029 if ( jQuery.isFunction( func ) ) { 7030 var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), 7031 i = 0, 7032 length = dataTypes.length, 7033 dataType, 7034 list, 7035 placeBefore; 7036 7037 // For each dataType in the dataTypeExpression 7038 for ( ; i < length; i++ ) { 7039 dataType = dataTypes[ i ]; 7040 // We control if we're asked to add before 7041 // any existing element 7042 placeBefore = /^\+/.test( dataType ); 7043 if ( placeBefore ) { 7044 dataType = dataType.substr( 1 ) || "*"; 7045 } 7046 list = structure[ dataType ] = structure[ dataType ] || []; 7047 // then we add to the structure accordingly 7048 list[ placeBefore ? "unshift" : "push" ]( func ); 7049 } 7050 } 7051 }; 7052} 7053 7054// Base inspection function for prefilters and transports 7055function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, 7056 dataType /* internal */, inspected /* internal */ ) { 7057 7058 dataType = dataType || options.dataTypes[ 0 ]; 7059 inspected = inspected || {}; 7060 7061 inspected[ dataType ] = true; 7062 7063 var list = structure[ dataType ], 7064 i = 0, 7065 length = list ? list.length : 0, 7066 executeOnly = ( structure === prefilters ), 7067 selection; 7068 7069 for ( ; i < length && ( executeOnly || !selection ); i++ ) { 7070 selection = list[ i ]( options, originalOptions, jqXHR ); 7071 // If we got redirected to another dataType 7072 // we try there if executing only and not done already 7073 if ( typeof selection === "string" ) { 7074 if ( !executeOnly || inspected[ selection ] ) { 7075 selection = undefined; 7076 } else { 7077 options.dataTypes.unshift( selection ); 7078 selection = inspectPrefiltersOrTransports( 7079 structure, options, originalOptions, jqXHR, selection, inspected ); 7080 } 7081 } 7082 } 7083 // If we're only executing or nothing was selected 7084 // we try the catchall dataType if not done already 7085 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { 7086 selection = inspectPrefiltersOrTransports( 7087 structure, options, originalOptions, jqXHR, "*", inspected ); 7088 } 7089 // unnecessary when only executing (prefilters) 7090 // but it'll be ignored by the caller in that case 7091 return selection; 7092} 7093 7094// A special extend for ajax options 7095// that takes "flat" options (not to be deep extended) 7096// Fixes #9887 7097function ajaxExtend( target, src ) { 7098 var key, deep, 7099 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 7100 for ( key in src ) { 7101 if ( src[ key ] !== undefined ) { 7102 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 7103 } 7104 } 7105 if ( deep ) { 7106 jQuery.extend( true, target, deep ); 7107 } 7108} 7109 7110jQuery.fn.extend({ 7111 load: function( url, params, callback ) { 7112 if ( typeof url !== "string" && _load ) { 7113 return _load.apply( this, arguments ); 7114 7115 // Don't do a request if no elements are being requested 7116 } else if ( !this.length ) { 7117 return this; 7118 } 7119 7120 var off = url.indexOf( " " ); 7121 if ( off >= 0 ) { 7122 var selector = url.slice( off, url.length ); 7123 url = url.slice( 0, off ); 7124 } 7125 7126 // Default to a GET request 7127 var type = "GET"; 7128 7129 // If the second parameter was provided 7130 if ( params ) { 7131 // If it's a function 7132 if ( jQuery.isFunction( params ) ) { 7133 // We assume that it's the callback 7134 callback = params; 7135 params = undefined; 7136 7137 // Otherwise, build a param string 7138 } else if ( typeof params === "object" ) { 7139 params = jQuery.param( params, jQuery.ajaxSettings.traditional ); 7140 type = "POST"; 7141 } 7142 } 7143 7144 var self = this; 7145 7146 // Request the remote document 7147 jQuery.ajax({ 7148 url: url, 7149 type: type, 7150 dataType: "html", 7151 data: params, 7152 // Complete callback (responseText is used internally) 7153 complete: function( jqXHR, status, responseText ) { 7154 // Store the response as specified by the jqXHR object 7155 responseText = jqXHR.responseText; 7156 // If successful, inject the HTML into all the matched elements 7157 if ( jqXHR.isResolved() ) { 7158 // #4825: Get the actual response in case 7159 // a dataFilter is present in ajaxSettings 7160 jqXHR.done(function( r ) { 7161 responseText = r; 7162 }); 7163 // See if a selector was specified 7164 self.html( selector ? 7165 // Create a dummy div to hold the results 7166 jQuery("<div>") 7167 // inject the contents of the document in, removing the scripts 7168 // to avoid any 'Permission Denied' errors in IE 7169 .append(responseText.replace(rscript, "")) 7170 7171 // Locate the specified elements 7172 .find(selector) : 7173 7174 // If not, just inject the full result 7175 responseText ); 7176 } 7177 7178 if ( callback ) { 7179 self.each( callback, [ responseText, status, jqXHR ] ); 7180 } 7181 } 7182 }); 7183 7184 return this; 7185 }, 7186 7187 serialize: function() { 7188 return jQuery.param( this.serializeArray() ); 7189 }, 7190 7191 serializeArray: function() { 7192 return this.map(function(){ 7193 return this.elements ? jQuery.makeArray( this.elements ) : this; 7194 }) 7195 .filter(function(){ 7196 return this.name && !this.disabled && 7197 ( this.checked || rselectTextarea.test( this.nodeName ) || 7198 rinput.test( this.type ) ); 7199 }) 7200 .map(function( i, elem ){ 7201 var val = jQuery( this ).val(); 7202 7203 return val == null ? 7204 null : 7205 jQuery.isArray( val ) ? 7206 jQuery.map( val, function( val, i ){ 7207 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 7208 }) : 7209 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 7210 }).get(); 7211 } 7212}); 7213 7214// Attach a bunch of functions for handling common AJAX events 7215jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ 7216 jQuery.fn[ o ] = function( f ){ 7217 return this.on( o, f ); 7218 }; 7219}); 7220 7221jQuery.each( [ "get", "post" ], function( i, method ) { 7222 jQuery[ method ] = function( url, data, callback, type ) { 7223 // shift arguments if data argument was omitted 7224 if ( jQuery.isFunction( data ) ) { 7225 type = type || callback; 7226 callback = data; 7227 data = undefined; 7228 } 7229 7230 return jQuery.ajax({ 7231 type: method, 7232 url: url, 7233 data: data, 7234 success: callback, 7235 dataType: type 7236 }); 7237 }; 7238}); 7239 7240jQuery.extend({ 7241 7242 getScript: function( url, callback ) { 7243 return jQuery.get( url, undefined, callback, "script" ); 7244 }, 7245 7246 getJSON: function( url, data, callback ) { 7247 return jQuery.get( url, data, callback, "json" ); 7248 }, 7249 7250 // Creates a full fledged settings object into target 7251 // with both ajaxSettings and settings fields. 7252 // If target is omitted, writes into ajaxSettings. 7253 ajaxSetup: function( target, settings ) { 7254 if ( settings ) { 7255 // Building a settings object 7256 ajaxExtend( target, jQuery.ajaxSettings ); 7257 } else { 7258 // Extending ajaxSettings 7259 settings = target; 7260 target = jQuery.ajaxSettings; 7261 } 7262 ajaxExtend( target, settings ); 7263 return target; 7264 }, 7265 7266 ajaxSettings: { 7267 url: ajaxLocation, 7268 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 7269 global: true, 7270 type: "GET", 7271 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 7272 processData: true, 7273 async: true, 7274 /* 7275 timeout: 0, 7276 data: null, 7277 dataType: null, 7278 username: null, 7279 password: null, 7280 cache: null, 7281 traditional: false, 7282 headers: {}, 7283 */ 7284 7285 accepts: { 7286 xml: "application/xml, text/xml", 7287 html: "text/html", 7288 text: "text/plain", 7289 json: "application/json, text/javascript", 7290 "*": allTypes 7291 }, 7292 7293 contents: { 7294 xml: /xml/, 7295 html: /html/, 7296 json: /json/ 7297 }, 7298 7299 responseFields: { 7300 xml: "responseXML", 7301 text: "responseText" 7302 }, 7303 7304 // List of data converters 7305 // 1) key format is "source_type destination_type" (a single space in-between) 7306 // 2) the catchall symbol "*" can be used for source_type 7307 converters: { 7308 7309 // Convert anything to text 7310 "* text": window.String, 7311 7312 // Text to html (true = no transformation) 7313 "text html": true, 7314 7315 // Evaluate text as a json expression 7316 "text json": jQuery.parseJSON, 7317 7318 // Parse text as xml 7319 "text xml": jQuery.parseXML 7320 }, 7321 7322 // For options that shouldn't be deep extended: 7323 // you can add your own custom options here if 7324 // and when you create one that shouldn't be 7325 // deep extended (see ajaxExtend) 7326 flatOptions: { 7327 context: true, 7328 url: true 7329 } 7330 }, 7331 7332 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 7333 ajaxTransport: addToPrefiltersOrTransports( transports ), 7334 7335 // Main method 7336 ajax: function( url, options ) { 7337 7338 // If url is an object, simulate pre-1.5 signature 7339 if ( typeof url === "object" ) { 7340 options = url; 7341 url = undefined; 7342 } 7343 7344 // Force options to be an object 7345 options = options || {}; 7346 7347 var // Create the final options object 7348 s = jQuery.ajaxSetup( {}, options ), 7349 // Callbacks context 7350 callbackContext = s.context || s, 7351 // Context for global events 7352 // It's the callbackContext if one was provided in the options 7353 // and if it's a DOM node or a jQuery collection 7354 globalEventContext = callbackContext !== s && 7355 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? 7356 jQuery( callbackContext ) : jQuery.event, 7357 // Deferreds 7358 deferred = jQuery.Deferred(), 7359 completeDeferred = jQuery.Callbacks( "once memory" ), 7360 // Status-dependent callbacks 7361 statusCode = s.statusCode || {}, 7362 // ifModified key 7363 ifModifiedKey, 7364 // Headers (they are sent all at once) 7365 requestHeaders = {}, 7366 requestHeadersNames = {}, 7367 // Response headers 7368 responseHeadersString, 7369 responseHeaders, 7370 // transport 7371 transport, 7372 // timeout handle 7373 timeoutTimer, 7374 // Cross-domain detection vars 7375 parts, 7376 // The jqXHR state 7377 state = 0, 7378 // To know if global events are to be dispatched 7379 fireGlobals, 7380 // Loop variable 7381 i, 7382 // Fake xhr 7383 jqXHR = { 7384 7385 readyState: 0, 7386 7387 // Caches the header 7388 setRequestHeader: function( name, value ) { 7389 if ( !state ) { 7390 var lname = name.toLowerCase(); 7391 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 7392 requestHeaders[ name ] = value; 7393 } 7394 return this; 7395 }, 7396 7397 // Raw string 7398 getAllResponseHeaders: function() { 7399 return state === 2 ? responseHeadersString : null; 7400 }, 7401 7402 // Builds headers hashtable if needed 7403 getResponseHeader: function( key ) { 7404 var match; 7405 if ( state === 2 ) { 7406 if ( !responseHeaders ) { 7407 responseHeaders = {}; 7408 while( ( match = rheaders.exec( responseHeadersString ) ) ) { 7409 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 7410 } 7411 } 7412 match = responseHeaders[ key.toLowerCase() ]; 7413 } 7414 return match === undefined ? null : match; 7415 }, 7416 7417 // Overrides response content-type header 7418 overrideMimeType: function( type ) { 7419 if ( !state ) { 7420 s.mimeType = type; 7421 } 7422 return this; 7423 }, 7424 7425 // Cancel the request 7426 abort: function( statusText ) { 7427 statusText = statusText || "abort"; 7428 if ( transport ) { 7429 transport.abort( statusText ); 7430 } 7431 done( 0, statusText ); 7432 return this; 7433 } 7434 }; 7435 7436 // Callback for when everything is done 7437 // It is defined here because jslint complains if it is declared 7438 // at the end of the function (which would be more logical and readable) 7439 function done( status, nativeStatusText, responses, headers ) { 7440 7441 // Called once 7442 if ( state === 2 ) { 7443 return; 7444 } 7445 7446 // State is "done" now 7447 state = 2; 7448 7449 // Clear timeout if it exists 7450 if ( timeoutTimer ) { 7451 clearTimeout( timeoutTimer ); 7452 } 7453 7454 // Dereference transport for early garbage collection 7455 // (no matter how long the jqXHR object will be used) 7456 transport = undefined; 7457 7458 // Cache response headers 7459 responseHeadersString = headers || ""; 7460 7461 // Set readyState 7462 jqXHR.readyState = status > 0 ? 4 : 0; 7463 7464 var isSuccess, 7465 success, 7466 error, 7467 statusText = nativeStatusText, 7468 response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, 7469 lastModified, 7470 etag; 7471 7472 // If successful, handle type chaining 7473 if ( status >= 200 && status < 300 || status === 304 ) { 7474 7475 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7476 if ( s.ifModified ) { 7477 7478 if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { 7479 jQuery.lastModified[ ifModifiedKey ] = lastModified; 7480 } 7481 if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { 7482 jQuery.etag[ ifModifiedKey ] = etag; 7483 } 7484 } 7485 7486 // If not modified 7487 if ( status === 304 ) { 7488 7489 statusText = "notmodified"; 7490 isSuccess = true; 7491 7492 // If we have data 7493 } else { 7494 7495 try { 7496 success = ajaxConvert( s, response ); 7497 statusText = "success"; 7498 isSuccess = true; 7499 } catch(e) { 7500 // We have a parsererror 7501 statusText = "parsererror"; 7502 error = e; 7503 } 7504 } 7505 } else { 7506 // We extract error from statusText 7507 // then normalize statusText and status for non-aborts 7508 error = statusText; 7509 if ( !statusText || status ) { 7510 statusText = "error"; 7511 if ( status < 0 ) { 7512 status = 0; 7513 } 7514 } 7515 } 7516 7517 // Set data for the fake xhr object 7518 jqXHR.status = status; 7519 jqXHR.statusText = "" + ( nativeStatusText || statusText ); 7520 7521 // Success/Error 7522 if ( isSuccess ) { 7523 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 7524 } else { 7525 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 7526 } 7527 7528 // Status-dependent callbacks 7529 jqXHR.statusCode( statusCode ); 7530 statusCode = undefined; 7531 7532 if ( fireGlobals ) { 7533 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), 7534 [ jqXHR, s, isSuccess ? success : error ] ); 7535 } 7536 7537 // Complete 7538 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 7539 7540 if ( fireGlobals ) { 7541 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 7542 // Handle the global AJAX counter 7543 if ( !( --jQuery.active ) ) { 7544 jQuery.event.trigger( "ajaxStop" ); 7545 } 7546 } 7547 } 7548 7549 // Attach deferreds 7550 deferred.promise( jqXHR ); 7551 jqXHR.success = jqXHR.done; 7552 jqXHR.error = jqXHR.fail; 7553 jqXHR.complete = completeDeferred.add; 7554 7555 // Status-dependent callbacks 7556 jqXHR.statusCode = function( map ) { 7557 if ( map ) { 7558 var tmp; 7559 if ( state < 2 ) { 7560 for ( tmp in map ) { 7561 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; 7562 } 7563 } else { 7564 tmp = map[ jqXHR.status ]; 7565 jqXHR.then( tmp, tmp ); 7566 } 7567 } 7568 return this; 7569 }; 7570 7571 // Remove hash character (#7531: and string promotion) 7572 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 7573 // We also use the url parameter if available 7574 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 7575 7576 // Extract dataTypes list 7577 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); 7578 7579 // Determine if a cross-domain request is in order 7580 if ( s.crossDomain == null ) { 7581 parts = rurl.exec( s.url.toLowerCase() ); 7582 s.crossDomain = !!( parts && 7583 ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || 7584 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != 7585 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) 7586 ); 7587 } 7588 7589 // Convert data if not already a string 7590 if ( s.data && s.processData && typeof s.data !== "string" ) { 7591 s.data = jQuery.param( s.data, s.traditional ); 7592 } 7593 7594 // Apply prefilters 7595 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 7596 7597 // If request was aborted inside a prefilter, stop there 7598 if ( state === 2 ) { 7599 return false; 7600 } 7601 7602 // We can fire global events as of now if asked to 7603 fireGlobals = s.global; 7604 7605 // Uppercase the type 7606 s.type = s.type.toUpperCase(); 7607 7608 // Determine if request has content 7609 s.hasContent = !rnoContent.test( s.type ); 7610 7611 // Watch for a new set of requests 7612 if ( fireGlobals && jQuery.active++ === 0 ) { 7613 jQuery.event.trigger( "ajaxStart" ); 7614 } 7615 7616 // More options handling for requests with no content 7617 if ( !s.hasContent ) { 7618 7619 // If data is available, append data to url 7620 if ( s.data ) { 7621 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; 7622 // #9682: remove data so that it's not used in an eventual retry 7623 delete s.data; 7624 } 7625 7626 // Get ifModifiedKey before adding the anti-cache parameter 7627 ifModifiedKey = s.url; 7628 7629 // Add anti-cache in url if needed 7630 if ( s.cache === false ) { 7631 7632 var ts = jQuery.now(), 7633 // try replacing _= if it is there 7634 ret = s.url.replace( rts, "$1_=" + ts ); 7635 7636 // if nothing was replaced, add timestamp to the end 7637 s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); 7638 } 7639 } 7640 7641 // Set the correct header, if data is being sent 7642 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 7643 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 7644 } 7645 7646 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 7647 if ( s.ifModified ) { 7648 ifModifiedKey = ifModifiedKey || s.url; 7649 if ( jQuery.lastModified[ ifModifiedKey ] ) { 7650 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); 7651 } 7652 if ( jQuery.etag[ ifModifiedKey ] ) { 7653 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); 7654 } 7655 } 7656 7657 // Set the Accepts header for the server, depending on the dataType 7658 jqXHR.setRequestHeader( 7659 "Accept", 7660 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 7661 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 7662 s.accepts[ "*" ] 7663 ); 7664 7665 // Check for headers option 7666 for ( i in s.headers ) { 7667 jqXHR.setRequestHeader( i, s.headers[ i ] ); 7668 } 7669 7670 // Allow custom headers/mimetypes and early abort 7671 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 7672 // Abort if not done already 7673 jqXHR.abort(); 7674 return false; 7675 7676 } 7677 7678 // Install callbacks on deferreds 7679 for ( i in { success: 1, error: 1, complete: 1 } ) { 7680 jqXHR[ i ]( s[ i ] ); 7681 } 7682 7683 // Get transport 7684 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 7685 7686 // If no transport, we auto-abort 7687 if ( !transport ) { 7688 done( -1, "No Transport" ); 7689 } else { 7690 jqXHR.readyState = 1; 7691 // Send global event 7692 if ( fireGlobals ) { 7693 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 7694 } 7695 // Timeout 7696 if ( s.async && s.timeout > 0 ) { 7697 timeoutTimer = setTimeout( function(){ 7698 jqXHR.abort( "timeout" ); 7699 }, s.timeout ); 7700 } 7701 7702 try { 7703 state = 1; 7704 transport.send( requestHeaders, done ); 7705 } catch (e) { 7706 // Propagate exception as error if not done 7707 if ( state < 2 ) { 7708 done( -1, e ); 7709 // Simply rethrow otherwise 7710 } else { 7711 throw e; 7712 } 7713 } 7714 } 7715 7716 return jqXHR; 7717 }, 7718 7719 // Serialize an array of form elements or a set of 7720 // key/values into a query string 7721 param: function( a, traditional ) { 7722 var s = [], 7723 add = function( key, value ) { 7724 // If value is a function, invoke it and return its value 7725 value = jQuery.isFunction( value ) ? value() : value; 7726 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 7727 }; 7728 7729 // Set traditional to true for jQuery <= 1.3.2 behavior. 7730 if ( traditional === undefined ) { 7731 traditional = jQuery.ajaxSettings.traditional; 7732 } 7733 7734 // If an array was passed in, assume that it is an array of form elements. 7735 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 7736 // Serialize the form elements 7737 jQuery.each( a, function() { 7738 add( this.name, this.value ); 7739 }); 7740 7741 } else { 7742 // If traditional, encode the "old" way (the way 1.3.2 or older 7743 // did it), otherwise encode params recursively. 7744 for ( var prefix in a ) { 7745 buildParams( prefix, a[ prefix ], traditional, add ); 7746 } 7747 } 7748 7749 // Return the resulting serialization 7750 return s.join( "&" ).replace( r20, "+" ); 7751 } 7752}); 7753 7754function buildParams( prefix, obj, traditional, add ) { 7755 if ( jQuery.isArray( obj ) ) { 7756 // Serialize array item. 7757 jQuery.each( obj, function( i, v ) { 7758 if ( traditional || rbracket.test( prefix ) ) { 7759 // Treat each array item as a scalar. 7760 add( prefix, v ); 7761 7762 } else { 7763 // If array item is non-scalar (array or object), encode its 7764 // numeric index to resolve deserialization ambiguity issues. 7765 // Note that rack (as of 1.0.0) can't currently deserialize 7766 // nested arrays properly, and attempting to do so may cause 7767 // a server error. Possible fixes are to modify rack's 7768 // deserialization algorithm or to provide an option or flag 7769 // to force array serialization to be shallow. 7770 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); 7771 } 7772 }); 7773 7774 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 7775 // Serialize object item. 7776 for ( var name in obj ) { 7777 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 7778 } 7779 7780 } else { 7781 // Serialize scalar item. 7782 add( prefix, obj ); 7783 } 7784} 7785 7786// This is still on the jQuery object... for now 7787// Want to move this to jQuery.ajax some day 7788jQuery.extend({ 7789 7790 // Counter for holding the number of active queries 7791 active: 0, 7792 7793 // Last-Modified header cache for next request 7794 lastModified: {}, 7795 etag: {} 7796 7797}); 7798 7799/* Handles responses to an ajax request: 7800 * - sets all responseXXX fields accordingly 7801 * - finds the right dataType (mediates between content-type and expected dataType) 7802 * - returns the corresponding response 7803 */ 7804function ajaxHandleResponses( s, jqXHR, responses ) { 7805 7806 var contents = s.contents, 7807 dataTypes = s.dataTypes, 7808 responseFields = s.responseFields, 7809 ct, 7810 type, 7811 finalDataType, 7812 firstDataType; 7813 7814 // Fill responseXXX fields 7815 for ( type in responseFields ) { 7816 if ( type in responses ) { 7817 jqXHR[ responseFields[type] ] = responses[ type ]; 7818 } 7819 } 7820 7821 // Remove auto dataType and get content-type in the process 7822 while( dataTypes[ 0 ] === "*" ) { 7823 dataTypes.shift(); 7824 if ( ct === undefined ) { 7825 ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); 7826 } 7827 } 7828 7829 // Check if we're dealing with a known content-type 7830 if ( ct ) { 7831 for ( type in contents ) { 7832 if ( contents[ type ] && contents[ type ].test( ct ) ) { 7833 dataTypes.unshift( type ); 7834 break; 7835 } 7836 } 7837 } 7838 7839 // Check to see if we have a response for the expected dataType 7840 if ( dataTypes[ 0 ] in responses ) { 7841 finalDataType = dataTypes[ 0 ]; 7842 } else {
7843 // Try convertible dataTypes 7844 for ( type in responses ) { 7845 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 7846 finalDataType = type; 7847 break; 7848 } 7849 if ( !firstDataType ) { 7850 firstDataType = type; 7851 } 7852 } 7853 // Or just use first one 7854 finalDataType = finalDataType || firstDataType; 7855 } 7856 7857 // If we found a dataType 7858 // We add the dataType to the list if needed 7859 // and return the corresponding response 7860 if ( finalDataType ) { 7861 if ( finalDataType !== dataTypes[ 0 ] ) { 7862 dataTypes.unshift( finalDataType ); 7863 } 7864 return responses[ finalDataType ]; 7865 } 7866} 7867 7868// Chain conversions given the request and the original response 7869function ajaxConvert( s, response ) { 7870 7871 // Apply the dataFilter if provided 7872 if ( s.dataFilter ) { 7873 response = s.dataFilter( response, s.dataType ); 7874 } 7875 7876 var dataTypes = s.dataTypes, 7877 converters = {}, 7878 i, 7879 key, 7880 length = dataTypes.length, 7881 tmp, 7882 // Current and previous dataTypes 7883 current = dataTypes[ 0 ], 7884 prev, 7885 // Conversion expression 7886 conversion, 7887 // Conversion function 7888 conv, 7889 // Conversion functions (transitive conversion) 7890 conv1, 7891 conv2; 7892 7893 // For each dataType in the chain 7894 for ( i = 1; i < length; i++ ) { 7895 7896 // Create converters map 7897 // with lowercased keys 7898 if ( i === 1 ) { 7899 for ( key in s.converters ) { 7900 if ( typeof key === "string" ) { 7901 converters[ key.toLowerCase() ] = s.converters[ key ]; 7902 } 7903 } 7904 } 7905 7906 // Get the dataTypes 7907 prev = current; 7908 current = dataTypes[ i ]; 7909 7910 // If current is auto dataType, update it to prev 7911 if ( current === "*" ) { 7912 current = prev; 7913 // If no auto and dataTypes are actually different 7914 } else if ( prev !== "*" && prev !== current ) { 7915 7916 // Get the converter 7917 conversion = prev + " " + current; 7918 conv = converters[ conversion ] || converters[ "* " + current ]; 7919 7920 // If there is no direct converter, search transitively 7921 if ( !conv ) { 7922 conv2 = undefined; 7923 for ( conv1 in converters ) { 7924 tmp = conv1.split( " " ); 7925 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { 7926 conv2 = converters[ tmp[1] + " " + current ]; 7927 if ( conv2 ) { 7928 conv1 = converters[ conv1 ]; 7929 if ( conv1 === true ) { 7930 conv = conv2; 7931 } else if ( conv2 === true ) { 7932 conv = conv1; 7933 } 7934 break; 7935 } 7936 } 7937 } 7938 } 7939 // If we found no converter, dispatch an error 7940 if ( !( conv || conv2 ) ) { 7941 jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); 7942 } 7943 // If found converter is not an equivalence 7944 if ( conv !== true ) { 7945 // Convert with 1 or 2 converters accordingly 7946 response = conv ? conv( response ) : conv2( conv1(response) ); 7947 } 7948 } 7949 } 7950 return response; 7951} 7952 7953 7954 7955 7956var jsc = jQuery.now(), 7957 jsre = /(\=)\?(&|$)|\?\?/i; 7958 7959// Default jsonp settings 7960jQuery.ajaxSetup({ 7961 jsonp: "callback", 7962 jsonpCallback: function() { 7963 return jQuery.expando + "_" + ( jsc++ ); 7964 } 7965}); 7966 7967// Detect, normalize options and install callbacks for jsonp requests 7968jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 7969 7970 var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType ); 7971 7972 if ( s.dataTypes[ 0 ] === "jsonp" || 7973 s.jsonp !== false && ( jsre.test( s.url ) || 7974 inspectData && jsre.test( s.data ) ) ) { 7975 7976 var responseContainer, 7977 jsonpCallback = s.jsonpCallback = 7978 jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, 7979 previous = window[ jsonpCallback ], 7980 url = s.url, 7981 data = s.data, 7982 replace = "$1" + jsonpCallback + "$2"; 7983 7984 if ( s.jsonp !== false ) { 7985 url = url.replace( jsre, replace ); 7986 if ( s.url === url ) { 7987 if ( inspectData ) { 7988 data = data.replace( jsre, replace ); 7989 } 7990 if ( s.data === data ) { 7991 // Add callback manually 7992 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; 7993 } 7994 } 7995 } 7996 7997 s.url = url; 7998 s.data = data; 7999 8000 // Install callback 8001 window[ jsonpCallback ] = function( response ) { 8002 responseContainer = [ response ]; 8003 }; 8004 8005 // Clean-up function 8006 jqXHR.always(function() { 8007 // Set callback back to previous value 8008 window[ jsonpCallback ] = previous; 8009 // Call if it was a function and we have a response 8010 if ( responseContainer && jQuery.isFunction( previous ) ) { 8011 window[ jsonpCallback ]( responseContainer[ 0 ] ); 8012 } 8013 }); 8014 8015 // Use data converter to retrieve json after script execution
vendor: 10,031 bytes, lines 8016-8384
8016 s.converters["script json"] = function() { 8017 if ( !responseContainer ) { 8018 jQuery.error( jsonpCallback + " was not called" ); 8019 } 8020 return responseContainer[ 0 ]; 8021 }; 8022 8023 // force json dataType 8024 s.dataTypes[ 0 ] = "json"; 8025 8026 // Delegate to script 8027 return "script"; 8028 } 8029}); 8030 8031 8032 8033 8034// Install script dataType 8035jQuery.ajaxSetup({ 8036 accepts: { 8037 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 8038 }, 8039 contents: { 8040 script: /javascript|ecmascript/ 8041 }, 8042 converters: { 8043 "text script": function( text ) { 8044 jQuery.globalEval( text ); 8045 return text; 8046 } 8047 } 8048}); 8049 8050// Handle cache's special case and global 8051jQuery.ajaxPrefilter( "script", function( s ) { 8052 if ( s.cache === undefined ) { 8053 s.cache = false; 8054 } 8055 if ( s.crossDomain ) { 8056 s.type = "GET"; 8057 s.global = false; 8058 } 8059}); 8060 8061// Bind script tag hack transport 8062jQuery.ajaxTransport( "script", function(s) { 8063 8064 // This transport only deals with cross domain requests 8065 if ( s.crossDomain ) { 8066 8067 var script, 8068 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; 8069 8070 return { 8071 8072 send: function( _, callback ) { 8073 8074 script = document.createElement( "script" ); 8075 8076 script.async = "async"; 8077 8078 if ( s.scriptCharset ) { 8079 script.charset = s.scriptCharset; 8080 } 8081 8082 script.src = s.url; 8083 8084 // Attach handlers for all browsers 8085 script.onload = script.onreadystatechange = function( _, isAbort ) { 8086 8087 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 8088 8089 // Handle memory leak in IE 8090 script.onload = script.onreadystatechange = null; 8091 8092 // Remove the script 8093 if ( head && script.parentNode ) { 8094 head.removeChild( script ); 8095 } 8096 8097 // Dereference the script 8098 script = undefined; 8099 8100 // Callback if not abort 8101 if ( !isAbort ) { 8102 callback( 200, "success" ); 8103 } 8104 } 8105 }; 8106 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 8107 // This arises when a base node is used (#2709 and #4378). 8108 head.insertBefore( script, head.firstChild ); 8109 }, 8110 8111 abort: function() { 8112 if ( script ) { 8113 script.onload( 0, 1 ); 8114 } 8115 } 8116 }; 8117 } 8118}); 8119 8120 8121 8122 8123var // #5280: Internet Explorer will keep connections alive if we don't abort on unload 8124 xhrOnUnloadAbort = window.ActiveXObject ? function() { 8125 // Abort all pending requests 8126 for ( var key in xhrCallbacks ) { 8127 xhrCallbacks[ key ]( 0, 1 ); 8128 } 8129 } : false, 8130 xhrId = 0, 8131 xhrCallbacks; 8132 8133// Functions to create xhrs 8134function createStandardXHR() { 8135 try { 8136 return new window.XMLHttpRequest(); 8137 } catch( e ) {} 8138} 8139 8140function createActiveXHR() { 8141 try { 8142 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 8143 } catch( e ) {} 8144} 8145 8146// Create the request object 8147// (This is still attached to ajaxSettings for backward compatibility) 8148jQuery.ajaxSettings.xhr = window.ActiveXObject ? 8149 /* Microsoft failed to properly 8150 * implement the XMLHttpRequest in IE7 (can't request local files), 8151 * so we use the ActiveXObject when it is available 8152 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so 8153 * we need a fallback. 8154 */ 8155 function() { 8156 return !this.isLocal && createStandardXHR() || createActiveXHR(); 8157 } : 8158 // For all other browsers, use the standard XMLHttpRequest object 8159 createStandardXHR; 8160 8161// Determine support properties 8162(function( xhr ) { 8163 jQuery.extend( jQuery.support, { 8164 ajax: !!xhr, 8165 cors: !!xhr && ( "withCredentials" in xhr ) 8166 }); 8167})( jQuery.ajaxSettings.xhr() ); 8168 8169// Create transport if the browser can provide an xhr 8170if ( jQuery.support.ajax ) { 8171 8172 jQuery.ajaxTransport(function( s ) { 8173 // Cross domain only allowed if supported through XMLHttpRequest 8174 if ( !s.crossDomain || jQuery.support.cors ) { 8175 8176 var callback; 8177 8178 return { 8179 send: function( headers, complete ) { 8180 8181 // Get a new xhr 8182 var xhr = s.xhr(), 8183 handle, 8184 i; 8185 8186 // Open the socket 8187 // Passing null username, generates a login popup on Opera (#2865) 8188 if ( s.username ) { 8189 xhr.open( s.type, s.url, s.async, s.username, s.password ); 8190 } else { 8191 xhr.open( s.type, s.url, s.async ); 8192 } 8193 8194 // Apply custom fields if provided 8195 if ( s.xhrFields ) { 8196 for ( i in s.xhrFields ) { 8197 xhr[ i ] = s.xhrFields[ i ]; 8198 } 8199 } 8200 8201 // Override mime type if needed 8202 if ( s.mimeType && xhr.overrideMimeType ) { 8203 xhr.overrideMimeType( s.mimeType ); 8204 } 8205 8206 // X-Requested-With header 8207 // For cross-domain requests, seeing as conditions for a preflight are 8208 // akin to a jigsaw puzzle, we simply never set it to be sure. 8209 // (it can always be set on a per-request basis or even using ajaxSetup) 8210 // For same-domain requests, won't change header if already provided. 8211 if ( !s.crossDomain && !headers["X-Requested-With"] ) { 8212 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 8213 } 8214 8215 // Need an extra try/catch for cross domain requests in Firefox 3 8216 try { 8217 for ( i in headers ) { 8218 xhr.setRequestHeader( i, headers[ i ] ); 8219 } 8220 } catch( _ ) {} 8221 8222 // Do send the request 8223 // This may raise an exception which is actually 8224 // handled in jQuery.ajax (so no try/catch here) 8225 xhr.send( ( s.hasContent && s.data ) || null ); 8226 8227 // Listener 8228 callback = function( _, isAbort ) { 8229 8230 var status, 8231 statusText, 8232 responseHeaders, 8233 responses, 8234 xml; 8235 8236 // Firefox throws exceptions when accessing properties 8237 // of an xhr when a network error occured 8238 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) 8239 try { 8240 8241 // Was never called and is aborted or complete 8242 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 8243 8244 // Only called once 8245 callback = undefined; 8246 8247 // Do not keep as active anymore 8248 if ( handle ) { 8249 xhr.onreadystatechange = jQuery.noop; 8250 if ( xhrOnUnloadAbort ) { 8251 delete xhrCallbacks[ handle ]; 8252 } 8253 } 8254 8255 // If it's an abort 8256 if ( isAbort ) { 8257 // Abort it manually if needed 8258 if ( xhr.readyState !== 4 ) { 8259 xhr.abort(); 8260 } 8261 } else { 8262 status = xhr.status; 8263 responseHeaders = xhr.getAllResponseHeaders(); 8264 responses = {}; 8265 xml = xhr.responseXML; 8266 8267 // Construct response list 8268 if ( xml && xml.documentElement /* #4958 */ ) { 8269 responses.xml = xml; 8270 } 8271 8272 // When requesting binary data, IE6-9 will throw an exception 8273 // on any attempt to access responseText (#11426) 8274 try { 8275 responses.text = xhr.responseText; 8276 } catch( _ ) { 8277 } 8278 8279 // Firefox throws an exception when accessing 8280 // statusText for faulty cross-domain requests 8281 try { 8282 statusText = xhr.statusText; 8283 } catch( e ) { 8284 // We normalize with Webkit giving an empty statusText 8285 statusText = ""; 8286 } 8287 8288 // Filter status for non standard behaviors 8289 8290 // If the request is local and we have data: assume a success 8291 // (success with no data won't get notified, that's the best we 8292 // can do given current implementations) 8293 if ( !status && s.isLocal && !s.crossDomain ) { 8294 status = responses.text ? 200 : 404; 8295 // IE - #1450: sometimes returns 1223 when it should be 204 8296 } else if ( status === 1223 ) { 8297 status = 204; 8298 } 8299 } 8300 } 8301 } catch( firefoxAccessException ) { 8302 if ( !isAbort ) { 8303 complete( -1, firefoxAccessException ); 8304 } 8305 } 8306 8307 // Call complete if needed 8308 if ( responses ) { 8309 complete( status, statusText, responses, responseHeaders ); 8310 } 8311 }; 8312 8313 // if we're in sync mode or it's in cache 8314 // and has been retrieved directly (IE6 & IE7) 8315 // we need to manually fire the callback 8316 if ( !s.async || xhr.readyState === 4 ) { 8317 callback(); 8318 } else { 8319 handle = ++xhrId; 8320 if ( xhrOnUnloadAbort ) { 8321 // Create the active xhrs callbacks list if needed 8322 // and attach the unload handler 8323 if ( !xhrCallbacks ) { 8324 xhrCallbacks = {}; 8325 jQuery( window ).unload( xhrOnUnloadAbort ); 8326 } 8327 // Add to list of active xhrs callbacks 8328 xhrCallbacks[ handle ] = callback; 8329 } 8330 xhr.onreadystatechange = callback; 8331 } 8332 }, 8333 8334 abort: function() { 8335 if ( callback ) { 8336 callback(0,1); 8337 } 8338 } 8339 }; 8340 } 8341 }); 8342} 8343 8344 8345 8346 8347var elemdisplay = {}, 8348 iframe, iframeDoc, 8349 rfxtypes = /^(?:toggle|show|hide)$/, 8350 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, 8351 timerId, 8352 fxAttrs = [ 8353 // height animations 8354 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], 8355 // width animations 8356 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], 8357 // opacity animations 8358 [ "opacity" ] 8359 ], 8360 fxNow; 8361 8362jQuery.fn.extend({ 8363 show: function( speed, easing, callback ) { 8364 var elem, display; 8365 8366 if ( speed || speed === 0 ) { 8367 return this.animate( genFx("show", 3), speed, easing, callback ); 8368 8369 } else { 8370 for ( var i = 0, j = this.length; i < j; i++ ) { 8371 elem = this[ i ]; 8372 8373 if ( elem.style ) { 8374 display = elem.style.display; 8375 8376 // Reset the inline display of this element to learn if it is 8377 // being hidden by cascaded rules or not 8378 if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { 8379 display = elem.style.display = ""; 8380 } 8381 8382 // Set elements which have been overridden with display: none 8383 // in a stylesheet to whatever the default browser style is 8384 // for such an element
8385 if ( (display === "" && jQuery.css(elem, "display") === "none") || 8386 !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { 8387 jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); 8388 } 8389 } 8390 } 8391 8392 // Set the display of most of the elements in a second loop 8393 // to avoid the constant reflow 8394 for ( i = 0; i < j; i++ ) { 8395 elem = this[ i ]; 8396 8397 if ( elem.style ) { 8398 display = elem.style.display; 8399 8400 if ( display === "" || display === "none" ) { 8401 elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; 8402 } 8403 } 8404 } 8405 8406 return this; 8407 } 8408 }, 8409 8410 hide: function( speed, easing, callback ) { 8411 if ( speed || speed === 0 ) { 8412 return this.animate( genFx("hide", 3), speed, easing, callback); 8413 8414 } else { 8415 var elem, display, 8416 i = 0, 8417 j = this.length; 8418 8419 for ( ; i < j; i++ ) { 8420 elem = this[i]; 8421 if ( elem.style ) { 8422 display = jQuery.css( elem, "display" ); 8423 8424 if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { 8425 jQuery._data( elem, "olddisplay", display ); 8426 } 8427 } 8428 } 8429 8430 // Set the display of the elements in a second loop 8431 // to avoid the constant reflow 8432 for ( i = 0; i < j; i++ ) { 8433 if ( this[i].style ) { 8434 this[i].style.display = "none"; 8435 } 8436 } 8437 8438 return this; 8439 } 8440 }, 8441 8442 // Save the old toggle function 8443 _toggle: jQuery.fn.toggle, 8444 8445 toggle: function( fn, fn2, callback ) { 8446 var bool = typeof fn === "boolean"; 8447 8448 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { 8449 this._toggle.apply( this, arguments ); 8450 8451 } else if ( fn == null || bool ) { 8452 this.each(function() { 8453 var state = bool ? fn : jQuery(this).is(":hidden"); 8454 jQuery(this)[ state ? "show" : "hide" ](); 8455 }); 8456 8457 } else { 8458 this.animate(genFx("toggle", 3), fn, fn2, callback); 8459 } 8460 8461 return this; 8462 }, 8463 8464 fadeTo: function( speed, to, easing, callback ) { 8465 return this.filter(":hidden").css("opacity", 0).show().end() 8466 .animate({opacity: to}, speed, easing, callback); 8467 }, 8468 8469 animate: function( prop, speed, easing, callback ) { 8470 var optall = jQuery.speed( speed, easing, callback ); 8471 8472 if ( jQuery.isEmptyObject( prop ) ) { 8473 return this.each( optall.complete, [ false ] ); 8474 } 8475 8476 // Do not change referenced properties as per-property easing will be lost 8477 prop = jQuery.extend( {}, prop ); 8478 8479 function doAnimation() { 8480 // XXX 'this' does not always have a nodeName when running the 8481 // test suite 8482 8483 if ( optall.queue === false ) { 8484 jQuery._mark( this ); 8485 } 8486 8487 var opt = jQuery.extend( {}, optall ), 8488 isElement = this.nodeType === 1, 8489 hidden = isElement && jQuery(this).is(":hidden"), 8490 name, val, p, e, hooks, replace, 8491 parts, start, end, unit, 8492 method; 8493 8494 // will store per property easing and be used to determine when an animation is complete 8495 opt.animatedProperties = {}; 8496 8497 // first pass over propertys to expand / normalize 8498 for ( p in prop ) { 8499 name = jQuery.camelCase( p ); 8500 if ( p !== name ) { 8501 prop[ name ] = prop[ p ]; 8502 delete prop[ p ]; 8503 } 8504 8505 if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) { 8506 replace = hooks.expand( prop[ name ] ); 8507 delete prop[ name ]; 8508 8509 // not quite $.extend, this wont overwrite keys already present. 8510 // also - reusing 'p' from above because we have the correct "name" 8511 for ( p in replace ) { 8512 if ( ! ( p in prop ) ) { 8513 prop[ p ] = replace[ p ]; 8514 } 8515 } 8516 } 8517 } 8518 8519 for ( name in prop ) { 8520 val = prop[ name ]; 8521 // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) 8522 if ( jQuery.isArray( val ) ) { 8523 opt.animatedProperties[ name ] = val[ 1 ]; 8524 val = prop[ name ] = val[ 0 ]; 8525 } else { 8526 opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; 8527 } 8528 8529 if ( val === "hide" && hidden || val === "show" && !hidden ) { 8530 return opt.complete.call( this ); 8531 } 8532 8533 if ( isElement && ( name === "height" || name === "width" ) ) { 8534 // Make sure that nothing sneaks out 8535 // Record all 3 overflow attributes because IE does not 8536 // change the overflow attribute when overflowX and 8537 // overflowY are set to the same value 8538 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; 8539 8540 // Set display property to inline-block for height/width 8541 // animations on inline elements that are having width/height animated 8542 if ( jQuery.css( this, "display" ) === "inline" && 8543 jQuery.css( this, "float" ) === "none" ) { 8544 8545 // inline-level elements accept inline-block; 8546 // block-level elements need to be inline with layout 8547 if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { 8548 this.style.display = "inline-block"; 8549 8550 } else { 8551 this.style.zoom = 1; 8552 } 8553 } 8554 } 8555 } 8556 8557 if ( opt.overflow != null ) { 8558 this.style.overflow = "hidden"; 8559 } 8560 8561 for ( p in prop ) { 8562 e = new jQuery.fx( this, opt, p ); 8563 val = prop[ p ]; 8564 8565 if ( rfxtypes.test( val ) ) { 8566 8567 // Tracks whether to show or hide based on private 8568 // data attached to the element 8569 method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); 8570 if ( method ) { 8571 jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); 8572 e[ method ](); 8573 } else { 8574 e[ val ](); 8575 } 8576 8577 } else { 8578 parts = rfxnum.exec( val ); 8579 start = e.cur(); 8580 8581 if ( parts ) { 8582 end = parseFloat( parts[2] ); 8583 unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); 8584 8585 // We need to compute starting value 8586 if ( unit !== "px" ) {
8587 jQuery.style( this, p, (end || 1) + unit); 8588 start = ( (end || 1) / e.cur() ) * start; 8589 jQuery.style( this, p, start + unit); 8590 } 8591 8592 // If a +=/-= token was provided, we're doing a relative animation 8593 if ( parts[1] ) { 8594 end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; 8595 } 8596 8597 e.custom( start, end, unit ); 8598 8599 } else { 8600 e.custom( start, val, "" ); 8601 } 8602 } 8603 } 8604 8605 // For JS strict compliance 8606 return true; 8607 } 8608 8609 return optall.queue === false ? 8610 this.each( doAnimation ) : 8611 this.queue( optall.queue, doAnimation ); 8612 }, 8613 8614 stop: function( type, clearQueue, gotoEnd ) { 8615 if ( typeof type !== "string" ) { 8616 gotoEnd = clearQueue; 8617 clearQueue = type; 8618 type = undefined; 8619 } 8620 if ( clearQueue && type !== false ) { 8621 this.queue( type || "fx", [] ); 8622 } 8623 8624 return this.each(function() { 8625 var index, 8626 hadTimers = false, 8627 timers = jQuery.timers, 8628 data = jQuery._data( this ); 8629 8630 // clear marker counters if we know they won't be 8631 if ( !gotoEnd ) { 8632 jQuery._unmark( true, this ); 8633 } 8634 8635 function stopQueue( elem, data, index ) { 8636 var hooks = data[ index ]; 8637 jQuery.removeData( elem, index, true ); 8638 hooks.stop( gotoEnd ); 8639 } 8640 8641 if ( type == null ) { 8642 for ( index in data ) { 8643 if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { 8644 stopQueue( this, data, index ); 8645 } 8646 } 8647 } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ 8648 stopQueue( this, data, index ); 8649 } 8650 8651 for ( index = timers.length; index--; ) { 8652 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { 8653 if ( gotoEnd ) { 8654 8655 // force the next step to be the last 8656 timers[ index ]( true ); 8657 } else { 8658 timers[ index ].saveState(); 8659 } 8660 hadTimers = true; 8661 timers.splice( index, 1 ); 8662 } 8663 } 8664 8665 // start the next in the queue if the last step wasn't forced 8666 // timers currently will call their complete callbacks, which will dequeue 8667 // but only if they were gotoEnd 8668 if ( !( gotoEnd && hadTimers ) ) { 8669 jQuery.dequeue( this, type ); 8670 } 8671 }); 8672 } 8673 8674}); 8675 8676// Animations created synchronously will run synchronously 8677function createFxNow() { 8678 setTimeout( clearFxNow, 0 ); 8679 return ( fxNow = jQuery.now() ); 8680} 8681 8682function clearFxNow() { 8683 fxNow = undefined; 8684} 8685 8686// Generate parameters to create a standard animation 8687function genFx( type, num ) { 8688 var obj = {}; 8689 8690 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { 8691 obj[ this ] = type; 8692 }); 8693 8694 return obj; 8695} 8696 8697// Generate shortcuts for custom animations 8698jQuery.each({ 8699 slideDown: genFx( "show", 1 ), 8700 slideUp: genFx( "hide", 1 ), 8701 slideToggle: genFx( "toggle", 1 ), 8702 fadeIn: { opacity: "show" }, 8703 fadeOut: { opacity: "hide" }, 8704 fadeToggle: { opacity: "toggle" } 8705}, function( name, props ) { 8706 jQuery.fn[ name ] = function( speed, easing, callback ) { 8707 return this.animate( props, speed, easing, callback ); 8708 }; 8709}); 8710 8711jQuery.extend({ 8712 speed: function( speed, easing, fn ) { 8713 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 8714 complete: fn || !fn && easing || 8715 jQuery.isFunction( speed ) && speed, 8716 duration: speed, 8717 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 8718 }; 8719 8720 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 8721 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 8722 8723 // normalize opt.queue - true/undefined/null -> "fx" 8724 if ( opt.queue == null || opt.queue === true ) { 8725 opt.queue = "fx"; 8726 } 8727 8728 // Queueing 8729 opt.old = opt.complete; 8730 8731 opt.complete = function( noUnmark ) { 8732 if ( jQuery.isFunction( opt.old ) ) { 8733 opt.old.call( this ); 8734 } 8735 8736 if ( opt.queue ) { 8737 jQuery.dequeue( this, opt.queue ); 8738 } else if ( noUnmark !== false ) { 8739 jQuery._unmark( this ); 8740 } 8741 }; 8742 8743 return opt; 8744 }, 8745 8746 easing: { 8747 linear: function( p ) { 8748 return p; 8749 }, 8750 swing: function( p ) { 8751 return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5; 8752 } 8753 }, 8754 8755 timers: [], 8756 8757 fx: function( elem, options, prop ) { 8758 this.options = options; 8759 this.elem = elem; 8760 this.prop = prop; 8761 8762 options.orig = options.orig || {}; 8763 } 8764 8765}); 8766 8767jQuery.fx.prototype = { 8768 // Simple function for setting a style value 8769 update: function() { 8770 if ( this.options.step ) { 8771 this.options.step.call( this.elem, this.now, this ); 8772 } 8773 8774 ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); 8775 }, 8776 8777 // Get the current size 8778 cur: function() { 8779 if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { 8780 return this.elem[ this.prop ]; 8781 } 8782 8783 var parsed, 8784 r = jQuery.css( this.elem, this.prop ); 8785 // Empty strings, null, undefined and "auto" are converted to 0, 8786 // complex values such as "rotate(1rad)" are returned as is, 8787 // simple values such as "10px" are parsed to Float. 8788 return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; 8789 }, 8790 8791 // Start an animation from one number to another 8792 custom: function( from, to, unit ) { 8793 var self = this, 8794 fx = jQuery.fx; 8795 8796 this.startTime = fxNow || createFxNow(); 8797 this.end = to; 8798 this.now = this.start = from; 8799 this.pos = this.state = 0; 8800 this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); 8801 8802 function t( gotoEnd ) { 8803 return self.step( gotoEnd ); 8804 } 8805 8806 t.queue = this.options.queue; 8807 t.elem = this.elem;
8808 t.saveState = function() { 8809 if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { 8810 if ( self.options.hide ) { 8811 jQuery._data( self.elem, "fxshow" + self.prop, self.start ); 8812 } else if ( self.options.show ) { 8813 jQuery._data( self.elem, "fxshow" + self.prop, self.end ); 8814 } 8815 } 8816 }; 8817 8818 if ( t() && jQuery.timers.push(t) && !timerId ) { 8819 timerId = setInterval( fx.tick, fx.interval ); 8820 } 8821 }, 8822 8823 // Simple 'show' function 8824 show: function() { 8825 var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); 8826 8827 // Remember where we started, so that we can go back to it later 8828 this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); 8829 this.options.show = true; 8830 8831 // Begin the animation 8832 // Make sure that we start at a small width/height to avoid any flash of content 8833 if ( dataShow !== undefined ) { 8834 // This show is picking up where a previous hide or show left off 8835 this.custom( this.cur(), dataShow ); 8836 } else { 8837 this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); 8838 } 8839 8840 // Start by showing the element 8841 jQuery( this.elem ).show(); 8842 }, 8843 8844 // Simple 'hide' function 8845 hide: function() { 8846 // Remember where we started, so that we can go back to it later 8847 this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); 8848 this.options.hide = true; 8849 8850 // Begin the animation 8851 this.custom( this.cur(), 0 ); 8852 }, 8853 8854 // Each step of an animation 8855 step: function( gotoEnd ) { 8856 var p, n, complete, 8857 t = fxNow || createFxNow(), 8858 done = true, 8859 elem = this.elem, 8860 options = this.options; 8861 8862 if ( gotoEnd || t >= options.duration + this.startTime ) { 8863 this.now = this.end; 8864 this.pos = this.state = 1; 8865 this.update(); 8866 8867 options.animatedProperties[ this.prop ] = true; 8868 8869 for ( p in options.animatedProperties ) { 8870 if ( options.animatedProperties[ p ] !== true ) { 8871 done = false; 8872 } 8873 } 8874 8875 if ( done ) { 8876 // Reset the overflow 8877 if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { 8878 8879 jQuery.each( [ "", "X", "Y" ], function( index, value ) { 8880 elem.style[ "overflow" + value ] = options.overflow[ index ]; 8881 }); 8882 } 8883 8884 // Hide the element if the "hide" operation was done 8885 if ( options.hide ) { 8886 jQuery( elem ).hide(); 8887 } 8888 8889 // Reset the properties, if the item has been hidden or shown 8890 if ( options.hide || options.show ) { 8891 for ( p in options.animatedProperties ) { 8892 jQuery.style( elem, p, options.orig[ p ] ); 8893 jQuery.removeData( elem, "fxshow" + p, true ); 8894 // Toggle data is no longer needed 8895 jQuery.removeData( elem, "toggle" + p, true ); 8896 } 8897 } 8898 8899 // Execute the complete function 8900 // in the event that the complete function throws an exception 8901 // we must ensure it won't be called twice. #5684 8902 8903 complete = options.complete; 8904 if ( complete ) { 8905 8906 options.complete = false; 8907 complete.call( elem ); 8908 } 8909 } 8910 8911 return false; 8912 8913 } else { 8914 // classical easing cannot be used with an Infinity duration 8915 if ( options.duration == Infinity ) { 8916 this.now = t; 8917 } else { 8918 n = t - this.startTime; 8919 this.state = n / options.duration; 8920 8921 // Perform the easing function, defaults to swing 8922 this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); 8923 this.now = this.start + ( (this.end - this.start) * this.pos ); 8924 } 8925 // Perform the next step of the animation 8926 this.update(); 8927 } 8928 8929 return true; 8930 } 8931}; 8932 8933jQuery.extend( jQuery.fx, { 8934 tick: function() { 8935 var timer, 8936 timers = jQuery.timers, 8937 i = 0; 8938 8939 for ( ; i < timers.length; i++ ) { 8940 timer = timers[ i ]; 8941 // Checks the timer has not already been removed 8942 if ( !timer() && timers[ i ] === timer ) { 8943 timers.splice( i--, 1 ); 8944 } 8945 } 8946 8947 if ( !timers.length ) { 8948 jQuery.fx.stop(); 8949 } 8950 }, 8951 8952 interval: 13, 8953 8954 stop: function() { 8955 clearInterval( timerId ); 8956 timerId = null; 8957 }, 8958 8959 speeds: { 8960 slow: 600, 8961 fast: 200, 8962 // Default speed 8963 _default: 400 8964 }, 8965 8966 step: { 8967 opacity: function( fx ) { 8968 jQuery.style( fx.elem, "opacity", fx.now ); 8969 }, 8970 8971 _default: function( fx ) { 8972 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { 8973 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 8974 } else { 8975 fx.elem[ fx.prop ] = fx.now; 8976 } 8977 } 8978 } 8979}); 8980 8981// Ensure props that can't be negative don't go there on undershoot easing
8982jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) { 8983 // exclude marginTop, marginLeft, marginBottom and marginRight from this list 8984 if ( prop.indexOf( "margin" ) ) { 8985 jQuery.fx.step[ prop ] = function( fx ) { 8986 jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); 8987 }; 8988 } 8989}); 8990 8991if ( jQuery.expr && jQuery.expr.filters ) { 8992 jQuery.expr.filters.animated = function( elem ) { 8993 return jQuery.grep(jQuery.timers, function( fn ) { 8994 return elem === fn.elem; 8995 }).length; 8996 }; 8997} 8998 8999// Try to restore the default display value of an element 9000function defaultDisplay( nodeName ) { 9001 9002 if ( !elemdisplay[ nodeName ] ) { 9003 9004 var body = document.body, 9005 elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), 9006 display = elem.css( "display" ); 9007 elem.remove(); 9008 9009 // If the simple way fails, 9010 // get element's real default display by attaching it to a temp iframe 9011 if ( display === "none" || display === "" ) { 9012 // No iframe to use yet, so create it 9013 if ( !iframe ) { 9014 iframe = document.createElement( "iframe" ); 9015 iframe.frameBorder = iframe.width = iframe.height = 0; 9016 } 9017 9018 body.appendChild( iframe ); 9019 9020 // Create a cacheable copy of the iframe document on first call. 9021 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML 9022 // document to it; WebKit & Firefox won't allow reusing the iframe document. 9023 if ( !iframeDoc || !iframe.createElement ) { 9024 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; 9025 iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" ); 9026 iframeDoc.close(); 9027 } 9028 9029 elem = iframeDoc.createElement( nodeName ); 9030 9031 iframeDoc.body.appendChild( elem ); 9032 9033 display = jQuery.css( elem, "display" ); 9034 body.removeChild( iframe ); 9035 } 9036 9037 // Store the correct default display 9038 elemdisplay[ nodeName ] = display; 9039 } 9040 9041 return elemdisplay[ nodeName ]; 9042} 9043 9044 9045 9046 9047var getOffset, 9048 rtable = /^t(?:able|d|h)$/i, 9049 rroot = /^(?:body|html)$/i; 9050 9051if ( "getBoundingClientRect" in document.documentElement ) { 9052 getOffset = function( elem, doc, docElem, box ) { 9053 try { 9054 box = elem.getBoundingClientRect(); 9055 } catch(e) {} 9056 9057 // Make sure we're not dealing with a disconnected DOM node 9058 if ( !box || !jQuery.contains( docElem, elem ) ) { 9059 return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; 9060 } 9061 9062 var body = doc.body, 9063 win = getWindow( doc ), 9064 clientTop = docElem.clientTop || body.clientTop || 0, 9065 clientLeft = docElem.clientLeft || body.clientLeft || 0, 9066 scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, 9067 scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, 9068 top = box.top + scrollTop - clientTop, 9069 left = box.left + scrollLeft - clientLeft; 9070 9071 return { top: top, left: left }; 9072 }; 9073 9074} else { 9075 getOffset = function( elem, doc, docElem ) { 9076 var computedStyle, 9077 offsetParent = elem.offsetParent, 9078 prevOffsetParent = elem, 9079 body = doc.body, 9080 defaultView = doc.defaultView, 9081 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, 9082 top = elem.offsetTop, 9083 left = elem.offsetLeft; 9084 9085 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { 9086 if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { 9087 break; 9088 } 9089 9090 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; 9091 top -= elem.scrollTop; 9092 left -= elem.scrollLeft; 9093 9094 if ( elem === offsetParent ) { 9095 top += elem.offsetTop; 9096 left += elem.offsetLeft; 9097 9098 if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { 9099 top += parseFloat( computedStyle.borderTopWidth ) || 0; 9100 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 9101 } 9102 9103 prevOffsetParent = offsetParent; 9104 offsetParent = elem.offsetParent; 9105 } 9106 9107 if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { 9108 top += parseFloat( computedStyle.borderTopWidth ) || 0; 9109 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 9110 } 9111 9112 prevComputedStyle = computedStyle; 9113 } 9114 9115 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { 9116 top += body.offsetTop; 9117 left += body.offsetLeft; 9118 } 9119 9120 if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { 9121 top += Math.max( docElem.scrollTop, body.scrollTop ); 9122 left += Math.max( docElem.scrollLeft, body.scrollLeft ); 9123 } 9124 9125 return { top: top, left: left }; 9126 }; 9127} 9128 9129jQuery.fn.offset = function( options ) { 9130 if ( arguments.length ) { 9131 return options === undefined ?
vendor: 4,616 bytes, lines 9132-9300
9132 this : 9133 this.each(function( i ) { 9134 jQuery.offset.setOffset( this, options, i ); 9135 }); 9136 } 9137 9138 var elem = this[0], 9139 doc = elem && elem.ownerDocument; 9140 9141 if ( !doc ) { 9142 return null; 9143 } 9144 9145 if ( elem === doc.body ) { 9146 return jQuery.offset.bodyOffset( elem ); 9147 } 9148 9149 return getOffset( elem, doc, doc.documentElement ); 9150}; 9151 9152jQuery.offset = { 9153 9154 bodyOffset: function( body ) { 9155 var top = body.offsetTop, 9156 left = body.offsetLeft; 9157 9158 if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { 9159 top += parseFloat( jQuery.css(body, "marginTop") ) || 0; 9160 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; 9161 } 9162 9163 return { top: top, left: left }; 9164 }, 9165 9166 setOffset: function( elem, options, i ) { 9167 var position = jQuery.css( elem, "position" ); 9168 9169 // set position first, in-case top/left are set even on static elem 9170 if ( position === "static" ) { 9171 elem.style.position = "relative"; 9172 } 9173 9174 var curElem = jQuery( elem ), 9175 curOffset = curElem.offset(), 9176 curCSSTop = jQuery.css( elem, "top" ), 9177 curCSSLeft = jQuery.css( elem, "left" ), 9178 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, 9179 props = {}, curPosition = {}, curTop, curLeft; 9180 9181 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 9182 if ( calculatePosition ) { 9183 curPosition = curElem.position(); 9184 curTop = curPosition.top; 9185 curLeft = curPosition.left; 9186 } else { 9187 curTop = parseFloat( curCSSTop ) || 0; 9188 curLeft = parseFloat( curCSSLeft ) || 0; 9189 } 9190 9191 if ( jQuery.isFunction( options ) ) { 9192 options = options.call( elem, i, curOffset ); 9193 } 9194 9195 if ( options.top != null ) { 9196 props.top = ( options.top - curOffset.top ) + curTop; 9197 } 9198 if ( options.left != null ) { 9199 props.left = ( options.left - curOffset.left ) + curLeft; 9200 } 9201 9202 if ( "using" in options ) { 9203 options.using.call( elem, props ); 9204 } else { 9205 curElem.css( props ); 9206 } 9207 } 9208}; 9209 9210 9211jQuery.fn.extend({ 9212 9213 position: function() { 9214 if ( !this[0] ) { 9215 return null; 9216 } 9217 9218 var elem = this[0], 9219 9220 // Get *real* offsetParent 9221 offsetParent = this.offsetParent(), 9222 9223 // Get correct offsets 9224 offset = this.offset(), 9225 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); 9226 9227 // Subtract element margins 9228 // note: when an element has margin: auto the offsetLeft and marginLeft 9229 // are the same in Safari causing offset.left to incorrectly be 0 9230 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; 9231 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; 9232 9233 // Add offsetParent borders 9234 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; 9235 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; 9236 9237 // Subtract the two offsets 9238 return { 9239 top: offset.top - parentOffset.top, 9240 left: offset.left - parentOffset.left 9241 }; 9242 }, 9243 9244 offsetParent: function() { 9245 return this.map(function() { 9246 var offsetParent = this.offsetParent || document.body; 9247 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { 9248 offsetParent = offsetParent.offsetParent; 9249 } 9250 return offsetParent; 9251 }); 9252 } 9253}); 9254 9255 9256// Create scrollLeft and scrollTop methods 9257jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { 9258 var top = /Y/.test( prop ); 9259 9260 jQuery.fn[ method ] = function( val ) { 9261 return jQuery.access( this, function( elem, method, val ) { 9262 var win = getWindow( elem ); 9263 9264 if ( val === undefined ) { 9265 return win ? (prop in win) ? win[ prop ] : 9266 jQuery.support.boxModel && win.document.documentElement[ method ] || 9267 win.document.body[ method ] : 9268 elem[ method ]; 9269 } 9270 9271 if ( win ) { 9272 win.scrollTo( 9273 !top ? val : jQuery( win ).scrollLeft(), 9274 top ? val : jQuery( win ).scrollTop() 9275 ); 9276 9277 } else { 9278 elem[ method ] = val; 9279 } 9280 }, method, val, arguments.length, null ); 9281 }; 9282}); 9283 9284function getWindow( elem ) { 9285 return jQuery.isWindow( elem ) ? 9286 elem : 9287 elem.nodeType === 9 ? 9288 elem.defaultView || elem.parentWindow : 9289 false; 9290} 9291 9292 9293 9294 9295// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods 9296jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 9297 var clientProp = "client" + name, 9298 scrollProp = "scroll" + name, 9299 offsetProp = "offset" + name; 9300
9301 // innerHeight and innerWidth 9302 jQuery.fn[ "inner" + name ] = function() { 9303 var elem = this[0]; 9304 return elem ? 9305 elem.style ? 9306 parseFloat( jQuery.css( elem, type, "padding" ) ) : 9307 this[ type ]() : 9308 null; 9309 }; 9310 9311 // outerHeight and outerWidth 9312 jQuery.fn[ "outer" + name ] = function( margin ) { 9313 var elem = this[0]; 9314 return elem ? 9315 elem.style ? 9316 parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : 9317 this[ type ]() : 9318 null; 9319 }; 9320 9321 jQuery.fn[ type ] = function( value ) { 9322 return jQuery.access( this, function( elem, type, value ) { 9323 var doc, docElemProp, orig, ret; 9324 9325 if ( jQuery.isWindow( elem ) ) { 9326 // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat 9327 doc = elem.document; 9328 docElemProp = doc.documentElement[ clientProp ]; 9329 return jQuery.support.boxModel && docElemProp || 9330 doc.body && doc.body[ clientProp ] || docElemProp; 9331 } 9332 9333 // Get document width or height 9334 if ( elem.nodeType === 9 ) { 9335 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 9336 doc = elem.documentElement; 9337 9338 // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height] 9339 // so we can't use max, as it'll choose the incorrect offset[Width/Height] 9340 // instead we use the correct client[Width/Height] 9341 // support:IE6 9342 if ( doc[ clientProp ] >= doc[ scrollProp ] ) { 9343 return doc[ clientProp ]; 9344 } 9345 9346 return Math.max( 9347 elem.body[ scrollProp ], doc[ scrollProp ], 9348 elem.body[ offsetProp ], doc[ offsetProp ] 9349 ); 9350 } 9351 9352 // Get width or height on the element 9353 if ( value === undefined ) { 9354 orig = jQuery.css( elem, type ); 9355 ret = parseFloat( orig ); 9356 return jQuery.isNumeric( ret ) ? ret : orig; 9357 } 9358 9359 // Set the width or height on the element 9360 jQuery( elem ).css( type, value ); 9361 }, type, value, arguments.length, null ); 9362 }; 9363}); 9364 9365 9366 9367 9368// Expose jQuery to the global object 9369window.jQuery = window.$ = jQuery; 9370if ( typeof define === "function" && define.amd && define.amd.jQuery ) { 9371 define( "jquery", [], function () { return jQuery; } ); 9372} 9373 9374 9375 9376})( window );
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.