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