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