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