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