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 } 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: 25,506 bytes, lines 7669-8644
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 * jQuery JavaScript Library v1.5.2 8333 * http://jquery.com/ 8334 * 8335 * Copyright 2011, John Resig 8336 * Dual licensed under the MIT or GPL Version 2 licenses. 8337 * http://jquery.org/license 8338 * 8339 * Includes Sizzle.js 8340 * http://sizzlejs.com/ 8341 * Copyright 2011, The Dojo Foundation 8342 * Released under the MIT, BSD, and GPL Licenses. 8343 * 8344 * Date: Thu Mar 31 15:28:23 2011 -0400 8345 */ 8346(function( window, undefined ) { 8347 8348// Use the correct document accordingly with window argument (sandbox) 8349var document = window.document; 8350var jQuery = (function() { 8351 8352// Define a local copy of jQuery 8353var jQuery = function( selector, context ) { 8354 // The jQuery object is actually just the init constructor 'enhanced' 8355 return new jQuery.fn.init( selector, context, rootjQuery ); 8356 }, 8357 8358 // Map over jQuery in case of overwrite 8359 _jQuery = window.jQuery, 8360 8361 // Map over the $ in case of overwrite 8362 _$ = window.$, 8363 8364 // A central reference to the root jQuery(document) 8365 rootjQuery, 8366 8367 // A simple way to check for HTML strings or ID strings 8368 // (both of which we optimize for) 8369 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, 8370 8371 // Check if a string has a non-whitespace character in it 8372 rnotwhite = /\S/, 8373 8374 // Used for trimming whitespace 8375 trimLeft = /^\s+/, 8376 trimRight = /\s+$/, 8377 8378 // Check for digits 8379 rdigit = /\d/, 8380 8381 // Match a standalone tag 8382 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 8383 8384 // JSON RegExp 8385 rvalidchars = /^[\],:{}\s]*$/, 8386 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 8387 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 8388 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 8389 8390 // Useragent RegExp 8391 rwebkit = /(webkit)[ \/]([\w.]+)/, 8392 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 8393 rmsie = /(msie) ([\w.]+)/, 8394 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 8395 8396 // Keep a UserAgent string for use with jQuery.browser 8397 userAgent = navigator.userAgent, 8398 8399 // For matching the engine and version of the browser 8400 browserMatch, 8401 8402 // The deferred used on DOM ready 8403 readyList, 8404 8405 // The ready event handler 8406 DOMContentLoaded, 8407 8408 // Save a reference to some core methods 8409 toString = Object.prototype.toString, 8410 hasOwn = Object.prototype.hasOwnProperty, 8411 push = Array.prototype.push, 8412 slice = Array.prototype.slice, 8413 trim = String.prototype.trim, 8414 indexOf = Array.prototype.indexOf, 8415 8416 // [[Class]] -> type pairs 8417 class2type = {}; 8418 8419jQuery.fn = jQuery.prototype = { 8420 constructor: jQuery, 8421 init: function( selector, context, rootjQuery ) { 8422 var match, elem, ret, doc; 8423 8424 // Handle $(""), $(null), or $(undefined) 8425 if ( !selector ) { 8426 return this; 8427 } 8428 8429 // Handle $(DOMElement) 8430 if ( selector.nodeType ) { 8431 this.context = this[0] = selector; 8432 this.length = 1; 8433 return this; 8434 } 8435 8436 // The body element only exists once, optimize finding it 8437 if ( selector === "body" && !context && document.body ) { 8438 this.context = document; 8439 this[0] = document.body; 8440 this.selector = "body"; 8441 this.length = 1; 8442 return this; 8443 } 8444 8445 // Handle HTML strings 8446 if ( typeof selector === "string" ) { 8447 // Are we dealing with HTML string or an ID? 8448 match = quickExpr.exec( selector ); 8449 8450 // Verify a match, and that no context was specified for #id 8451 if ( match && (match[1] || !context) ) { 8452 8453 // HANDLE: $(html) -> $(array) 8454 if ( match[1] ) { 8455 context = context instanceof jQuery ? context[0] : context; 8456 doc = (context ? context.ownerDocument || context : document); 8457 8458 // If a single string is passed in and it's a single tag 8459 // just do a createElement and skip the rest 8460 ret = rsingleTag.exec( selector ); 8461 8462 if ( ret ) { 8463 if ( jQuery.isPlainObject( context ) ) { 8464 selector = [ document.createElement( ret[1] ) ]; 8465 jQuery.fn.attr.call( selector, context, true ); 8466 8467 } else { 8468 selector = [ doc.createElement( ret[1] ) ]; 8469 } 8470 8471 } else { 8472 ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); 8473 selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; 8474 } 8475 8476 return jQuery.merge( this, selector ); 8477 8478 // HANDLE: $("#id") 8479 } else { 8480 elem = document.getElementById( match[2] ); 8481 8482 // Check parentNode to catch when Blackberry 4.6 returns 8483 // nodes that are no longer in the document #6963 8484 if ( elem && elem.parentNode ) { 8485 // Handle the case where IE and Opera return items 8486 // by name instead of ID 8487 if ( elem.id !== match[2] ) { 8488 return rootjQuery.find( selector ); 8489 } 8490 8491 // Otherwise, we inject the element directly into the jQuery object 8492 this.length = 1; 8493 this[0] = elem; 8494 } 8495 8496 this.context = document; 8497 this.selector = selector; 8498 return this; 8499 } 8500 8501 // HANDLE: $(expr, $(...)) 8502 } else if ( !context || context.jquery ) { 8503 return (context || rootjQuery).find( selector ); 8504 8505 // HANDLE: $(expr, context) 8506 // (which is just equivalent to: $(context).find(expr) 8507 } else { 8508 return this.constructor( context ).find( selector ); 8509 } 8510 8511 // HANDLE: $(function) 8512 // Shortcut for document ready 8513 } else if ( jQuery.isFunction( selector ) ) { 8514 return rootjQuery.ready( selector ); 8515 } 8516 8517 if (selector.selector !== undefined) { 8518 this.selector = selector.selector; 8519 this.context = selector.context; 8520 } 8521 8522 return jQuery.makeArray( selector, this ); 8523 }, 8524 8525 // Start with an empty selector 8526 selector: "", 8527 8528 // The current version of jQuery being used 8529 jquery: "1.5.2", 8530 8531 // The default length of a jQuery object is 0 8532 length: 0, 8533 8534 // The number of elements contained in the matched element set 8535 size: function() { 8536 return this.length; 8537 }, 8538 8539 toArray: function() { 8540 return slice.call( this, 0 ); 8541 }, 8542 8543 // Get the Nth element in the matched element set OR 8544 // Get the whole matched element set as a clean array 8545 get: function( num ) { 8546 return num == null ? 8547 8548 // Return a 'clean' array 8549 this.toArray() : 8550 8551 // Return just the object 8552 ( num < 0 ? this[ this.length + num ] : this[ num ] ); 8553 }, 8554 8555 // Take an array of elements and push it onto the stack 8556 // (returning the new matched element set) 8557 pushStack: function( elems, name, selector ) { 8558 // Build a new jQuery matched element set 8559 var ret = this.constructor(); 8560 8561 if ( jQuery.isArray( elems ) ) { 8562 push.apply( ret, elems ); 8563 8564 } else { 8565 jQuery.merge( ret, elems ); 8566 } 8567 8568 // Add the old object onto the stack (as a reference) 8569 ret.prevObject = this; 8570 8571 ret.context = this.context; 8572 8573 if ( name === "find" ) { 8574 ret.selector = this.selector + (this.selector ? " " : "") + selector; 8575 } else if ( name ) { 8576 ret.selector = this.selector + "." + name + "(" + selector + ")"; 8577 } 8578 8579 // Return the newly-formed element set 8580 return ret; 8581 }, 8582 8583 // Execute a callback for every element in the matched set. 8584 // (You can seed the arguments with an array of args, but this is 8585 // only used internally.) 8586 each: function( callback, args ) { 8587 return jQuery.each( this, callback, args ); 8588 }, 8589 8590 ready: function( fn ) { 8591 // Attach the listeners 8592 jQuery.bindReady(); 8593 8594 // Add the callback 8595 readyList.done( fn ); 8596 8597 return this; 8598 }, 8599 8600 eq: function( i ) { 8601 return i === -1 ? 8602 this.slice( i ) : 8603 this.slice( i, +i + 1 ); 8604 }, 8605 8606 first: function() { 8607 return this.eq( 0 ); 8608 }, 8609 8610 last: function() { 8611 return this.eq( -1 ); 8612 }, 8613 8614 slice: function() { 8615 return this.pushStack( slice.apply( this, arguments ), 8616 "slice", slice.call(arguments).join(",") ); 8617 }, 8618 8619 map: function( callback ) { 8620 return this.pushStack( jQuery.map(this, function( elem, i ) { 8621 return callback.call( elem, i, elem ); 8622 })); 8623 }, 8624 8625 end: function() { 8626 return this.prevObject || this.constructor(null); 8627 }, 8628 8629 // For internal use only. 8630 // Behaves like an Array's method, not like a jQuery method. 8631 push: push, 8632 sort: [].sort, 8633 splice: [].splice 8634}; 8635 8636// Give the init function the jQuery prototype for later instantiation 8637jQuery.fn.init.prototype = jQuery.fn; 8638 8639jQuery.extend = jQuery.fn.extend = function() { 8640 var options, name, src, copy, copyIsArray, clone, 8641 target = arguments[0] || {}, 8642 i = 1, 8643 length = arguments.length, 8644 deep = false;
vendor: 4,951 bytes, lines 8645-8829
8645 8646 // Handle a deep copy situation 8647 if ( typeof target === "boolean" ) { 8648 deep = target; 8649 target = arguments[1] || {}; 8650 // skip the boolean and the target 8651 i = 2; 8652 } 8653 8654 // Handle case when target is a string or something (possible in deep copy) 8655 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 8656 target = {}; 8657 } 8658 8659 // extend jQuery itself if only one argument is passed 8660 if ( length === i ) { 8661 target = this; 8662 --i; 8663 } 8664 8665 for ( ; i < length; i++ ) { 8666 // Only deal with non-null/undefined values 8667 if ( (options = arguments[ i ]) != null ) { 8668 // Extend the base object 8669 for ( name in options ) { 8670 src = target[ name ]; 8671 copy = options[ name ]; 8672 8673 // Prevent never-ending loop 8674 if ( target === copy ) { 8675 continue; 8676 } 8677 8678 // Recurse if we're merging plain objects or arrays 8679 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 8680 if ( copyIsArray ) { 8681 copyIsArray = false; 8682 clone = src && jQuery.isArray(src) ? src : []; 8683 8684 } else { 8685 clone = src && jQuery.isPlainObject(src) ? src : {}; 8686 } 8687 8688 // Never move original objects, clone them 8689 target[ name ] = jQuery.extend( deep, clone, copy ); 8690 8691 // Don't bring in undefined values 8692 } else if ( copy !== undefined ) { 8693 target[ name ] = copy; 8694 } 8695 } 8696 } 8697 } 8698 8699 // Return the modified object 8700 return target; 8701}; 8702 8703jQuery.extend({ 8704 noConflict: function( deep ) { 8705 window.$ = _$; 8706 8707 if ( deep ) { 8708 window.jQuery = _jQuery; 8709 } 8710 8711 return jQuery; 8712 }, 8713 8714 // Is the DOM ready to be used? Set to true once it occurs. 8715 isReady: false, 8716 8717 // A counter to track how many items to wait for before 8718 // the ready event fires. See #6781 8719 readyWait: 1, 8720 8721 // Handle when the DOM is ready 8722 ready: function( wait ) { 8723 // A third-party is pushing the ready event forwards 8724 if ( wait === true ) { 8725 jQuery.readyWait--; 8726 } 8727 8728 // Make sure that the DOM is not already loaded 8729 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { 8730 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 8731 if ( !document.body ) { 8732 return setTimeout( jQuery.ready, 1 ); 8733 } 8734 8735 // Remember that the DOM is ready 8736 jQuery.isReady = true; 8737 8738 // If a normal DOM Ready event fired, decrement, and wait if need be 8739 if ( wait !== true && --jQuery.readyWait > 0 ) { 8740 return; 8741 } 8742 8743 // If there are functions bound, to execute 8744 readyList.resolveWith( document, [ jQuery ] ); 8745 8746 // Trigger any bound ready events 8747 if ( jQuery.fn.trigger ) { 8748 jQuery( document ).trigger( "ready" ).unbind( "ready" ); 8749 } 8750 } 8751 }, 8752 8753 bindReady: function() { 8754 if ( readyList ) { 8755 return; 8756 } 8757 8758 readyList = jQuery._Deferred(); 8759 8760 // Catch cases where $(document).ready() is called after the 8761 // browser event has already occurred. 8762 if ( document.readyState === "complete" ) { 8763 // Handle it asynchronously to allow scripts the opportunity to delay ready 8764 return setTimeout( jQuery.ready, 1 ); 8765 } 8766 8767 // Mozilla, Opera and webkit nightlies currently support this event 8768 if ( document.addEventListener ) { 8769 // Use the handy event callback 8770 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 8771 8772 // A fallback to window.onload, that will always work 8773 window.addEventListener( "load", jQuery.ready, false ); 8774 8775 // If IE event model is used 8776 } else if ( document.attachEvent ) { 8777 // ensure firing before onload, 8778 // maybe late but safe also for iframes 8779 document.attachEvent("onreadystatechange", DOMContentLoaded); 8780 8781 // A fallback to window.onload, that will always work 8782 window.attachEvent( "onload", jQuery.ready ); 8783 8784 // If IE and not a frame 8785 // continually check to see if the document is ready 8786 var toplevel = false; 8787 8788 try { 8789 toplevel = window.frameElement == null; 8790 } catch(e) {} 8791 8792 if ( document.documentElement.doScroll && toplevel ) { 8793 doScrollCheck(); 8794 } 8795 } 8796 }, 8797 8798 // See test/unit/core.js for details concerning isFunction. 8799 // Since version 1.3, DOM methods and functions like alert 8800 // aren't supported. They return false on IE (#2968). 8801 isFunction: function( obj ) { 8802 return jQuery.type(obj) === "function"; 8803 }, 8804 8805 isArray: Array.isArray || function( obj ) { 8806 return jQuery.type(obj) === "array"; 8807 }, 8808 8809 // A crude way of determining if an object is a window 8810 isWindow: function( obj ) { 8811 return obj && typeof obj === "object" && "setInterval" in obj; 8812 }, 8813 8814 isNaN: function( obj ) { 8815 return obj == null || !rdigit.test( obj ) || isNaN( obj ); 8816 }, 8817 8818 type: function( obj ) { 8819 return obj == null ? 8820 String( obj ) : 8821 class2type[ toString.call(obj) ] || "object"; 8822 }, 8823 8824 isPlainObject: function( obj ) { 8825 // Must be an Object. 8826 // Because of IE, we also have to check the presence of the constructor property. 8827 // Make sure that DOM nodes and window objects don't pass through, as well 8828 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 8829 return false;
8830 } 8831 8832 // Not own constructor property must be Object 8833 if ( obj.constructor && 8834 !hasOwn.call(obj, "constructor") && 8835 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 8836 return false; 8837 } 8838 8839 // Own properties are enumerated firstly, so to speed up, 8840 // if last one is own, then all properties are own. 8841 8842 var key; 8843 for ( key in obj ) {} 8844 8845 return key === undefined || hasOwn.call( obj, key ); 8846 }, 8847 8848 isEmptyObject: function( obj ) { 8849 for ( var name in obj ) { 8850 return false; 8851 } 8852 return true; 8853 }, 8854 8855 error: function( msg ) { 8856 throw msg; 8857 }, 8858 8859 parseJSON: function( data ) { 8860 if ( typeof data !== "string" || !data ) { 8861 return null; 8862 } 8863 8864 // Make sure leading/trailing whitespace is removed (IE can't handle it) 8865 data = jQuery.trim( data ); 8866 8867 // Make sure the incoming data is actual JSON 8868 // Logic borrowed from http://json.org/json2.js 8869 if ( rvalidchars.test(data.replace(rvalidescape, "@") 8870 .replace(rvalidtokens, "]") 8871 .replace(rvalidbraces, "")) ) { 8872 8873 // Try to use the native JSON parser first 8874 return window.JSON && window.JSON.parse ? 8875 window.JSON.parse( data ) : 8876 (new Function("return " + data))(); 8877 8878 } else { 8879 jQuery.error( "Invalid JSON: " + data ); 8880 } 8881 }, 8882 8883 // Cross-browser xml parsing 8884 // (xml & tmp used internally) 8885 parseXML: function( data , xml , tmp ) { 8886 8887 if ( window.DOMParser ) { // Standard 8888 tmp = new DOMParser(); 8889 xml = tmp.parseFromString( data , "text/xml" ); 8890 } else { // IE 8891 xml = new ActiveXObject( "Microsoft.XMLDOM" ); 8892 xml.async = "false"; 8893 xml.loadXML( data ); 8894 } 8895 8896 tmp = xml.documentElement; 8897 8898 if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { 8899 jQuery.error( "Invalid XML: " + data ); 8900 } 8901 8902 return xml; 8903 }, 8904 8905 noop: function() {}, 8906 8907 // Evalulates a script in a global context 8908 globalEval: function( data ) { 8909 if ( data && rnotwhite.test(data) ) { 8910 // Inspired by code by Andrea Giammarchi 8911 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html 8912 var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement, 8913 script = document.createElement( "script" ); 8914 8915 if ( jQuery.support.scriptEval() ) { 8916 script.appendChild( document.createTextNode( data ) ); 8917 } else { 8918 script.text = data; 8919 } 8920 8921 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 8922 // This arises when a base node is used (#2709).
8923 head.insertBefore( script, head.firstChild ); 8924 head.removeChild( script ); 8925 } 8926 }, 8927 8928 nodeName: function( elem, name ) { 8929 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 8930 }, 8931 8932 // args is for internal usage only 8933 each: function( object, callback, args ) { 8934 var name, i = 0, 8935 length = object.length, 8936 isObj = length === undefined || jQuery.isFunction(object); 8937 8938 if ( args ) { 8939 if ( isObj ) { 8940 for ( name in object ) { 8941 if ( callback.apply( object[ name ], args ) === false ) { 8942 break; 8943 } 8944 } 8945 } else { 8946 for ( ; i < length; ) { 8947 if ( callback.apply( object[ i++ ], args ) === false ) { 8948 break; 8949 } 8950 } 8951 } 8952 8953 // A special, fast, case for the most common use of each 8954 } else { 8955 if ( isObj ) { 8956 for ( name in object ) { 8957 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { 8958 break; 8959 } 8960 } 8961 } else { 8962 for ( var value = object[0]; 8963 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} 8964 } 8965 } 8966 8967 return object; 8968 }, 8969 8970 // Use native String.trim function wherever possible 8971 trim: trim ? 8972 function( text ) { 8973 return text == null ? 8974 "" : 8975 trim.call( text ); 8976 } : 8977 8978 // Otherwise use our own trimming functionality 8979 function( text ) { 8980 return text == null ? 8981 "" : 8982 text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); 8983 }, 8984 8985 // results is for internal usage only 8986 makeArray: function( array, results ) { 8987 var ret = results || []; 8988 8989 if ( array != null ) { 8990 // The window, strings (and functions) also have 'length' 8991 // The extra typeof function check is to prevent crashes 8992 // in Safari 2 (See: #3039) 8993 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 8994 var type = jQuery.type(array); 8995 8996 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { 8997 push.call( ret, array ); 8998 } else { 8999 jQuery.merge( ret, array ); 9000 } 9001 } 9002 9003 return ret; 9004 }, 9005 9006 inArray: function( elem, array ) { 9007 if ( array.indexOf ) { 9008 return array.indexOf( elem ); 9009 } 9010 9011 for ( var i = 0, length = array.length; i < length; i++ ) { 9012 if ( array[ i ] === elem ) { 9013 return i; 9014 } 9015 } 9016 9017 return -1; 9018 }, 9019 9020 merge: function( first, second ) { 9021 var i = first.length, 9022 j = 0; 9023 9024 if ( typeof second.length === "number" ) { 9025 for ( var l = second.length; j < l; j++ ) { 9026 first[ i++ ] = second[ j ]; 9027 } 9028 9029 } else { 9030 while ( second[j] !== undefined ) { 9031 first[ i++ ] = second[ j++ ]; 9032 } 9033 } 9034 9035 first.length = i; 9036 9037 return first; 9038 }, 9039 9040 grep: function( elems, callback, inv ) { 9041 var ret = [], retVal; 9042 inv = !!inv; 9043 9044 // Go through the array, only saving the items 9045 // that pass the validator function 9046 for ( var i = 0, length = elems.length; i < length; i++ ) { 9047 retVal = !!callback( elems[ i ], i ); 9048 if ( inv !== retVal ) { 9049 ret.push( elems[ i ] ); 9050 } 9051 } 9052 9053 return ret; 9054 }, 9055 9056 // arg is for internal usage only 9057 map: function( elems, callback, arg ) { 9058 var ret = [], value; 9059 9060 // Go through the array, translating each of the items to their 9061 // new value (or values). 9062 for ( var i = 0, length = elems.length; i < length; i++ ) { 9063 value = callback( elems[ i ], i, arg ); 9064 9065 if ( value != null ) { 9066 ret[ ret.length ] = value; 9067 } 9068 } 9069 9070 // Flatten any nested arrays 9071 return ret.concat.apply( [], ret ); 9072 }, 9073 9074 // A global GUID counter for objects 9075 guid: 1, 9076 9077 proxy: function( fn, proxy, thisObject ) { 9078 if ( arguments.length === 2 ) { 9079 if ( typeof proxy === "string" ) { 9080 thisObject = fn; 9081 fn = thisObject[ proxy ]; 9082 proxy = undefined; 9083 9084 } else if ( proxy && !jQuery.isFunction( proxy ) ) { 9085 thisObject = proxy; 9086 proxy = undefined; 9087 } 9088 } 9089 9090 if ( !proxy && fn ) { 9091 proxy = function() { 9092 return fn.apply( thisObject || this, arguments ); 9093 }; 9094 } 9095 9096 // Set the guid of unique handler to the same of original handler, so it can be removed 9097 if ( fn ) { 9098 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 9099 } 9100 9101 // So proxy can be declared as an argument 9102 return proxy; 9103 }, 9104 9105 // Mutifunctional method to get and set values to a collection 9106 // The value/s can be optionally by executed if its a function 9107 access: function( elems, key, value, exec, fn, pass ) { 9108 var length = elems.length; 9109 9110 // Setting many attributes 9111 if ( typeof key === "object" ) { 9112 for ( var k in key ) { 9113 jQuery.access( elems, k, key[k], exec, fn, value ); 9114 } 9115 return elems; 9116 } 9117 9118 // Setting one attribute 9119 if ( value !== undefined ) { 9120 // Optionally, function values get executed if exec is true 9121 exec = !pass && exec && jQuery.isFunction(value); 9122 9123 for ( var i = 0; i < length; i++ ) { 9124 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); 9125 } 9126 9127 return elems; 9128 } 9129 9130 // Getting an attribute 9131 return length ? fn( elems[0], key ) : undefined; 9132 }, 9133 9134 now: function() { 9135 return (new Date()).getTime(); 9136 }, 9137 9138 // Use of jQuery.browser is frowned upon. 9139 // More details: http://docs.jquery.com/Utilities/jQuery.browser 9140 uaMatch: function( ua ) { 9141 ua = ua.toLowerCase(); 9142 9143 var match = rwebkit.exec( ua ) || 9144 ropera.exec( ua ) || 9145 rmsie.exec( ua ) || 9146 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 9147 []; 9148 9149 return { browser: match[1] || "", version: match[2] || "0" }; 9150 }, 9151 9152 sub: function() { 9153 function jQuerySubclass( selector, context ) { 9154 return new jQuerySubclass.fn.init( selector, context ); 9155 } 9156 jQuery.extend( true, jQuerySubclass, this ); 9157 jQuerySubclass.superclass = this; 9158 jQuerySubclass.fn = jQuerySubclass.prototype = this(); 9159 jQuerySubclass.fn.constructor = jQuerySubclass; 9160 jQuerySubclass.subclass = this.subclass; 9161 jQuerySubclass.fn.init = function init( selector, context ) { 9162 if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { 9163 context = jQuerySubclass(context); 9164 } 9165 9166 return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); 9167 }; 9168 jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; 9169 var rootjQuerySubclass = jQuerySubclass(document); 9170 return jQuerySubclass; 9171 }, 9172 9173 browser: {} 9174}); 9175 9176// Populate the class2type map 9177jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { 9178 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 9179}); 9180 9181browserMatch = jQuery.uaMatch( userAgent ); 9182if ( browserMatch.browser ) { 9183 jQuery.browser[ browserMatch.browser ] = true; 9184 jQuery.browser.version = browserMatch.version; 9185} 9186 9187// Deprecated, use jQuery.browser.webkit instead 9188if ( jQuery.browser.webkit ) { 9189 jQuery.browser.safari = true; 9190} 9191 9192if ( indexOf ) { 9193 jQuery.inArray = function( elem, array ) { 9194 return indexOf.call( array, elem ); 9195 }; 9196} 9197
9198// IE doesn't match non-breaking spaces with \s 9199if ( rnotwhite.test( "\xA0" ) ) { 9200 trimLeft = /^[\s\xA0]+/; 9201 trimRight = /[\s\xA0]+$/; 9202} 9203 9204// All jQuery objects should point back to these 9205rootjQuery = jQuery(document); 9206 9207// Cleanup functions for the document ready method 9208if ( document.addEventListener ) { 9209 DOMContentLoaded = function() { 9210 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 9211 jQuery.ready(); 9212 }; 9213 9214} else if ( document.attachEvent ) { 9215 DOMContentLoaded = function() { 9216 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 9217 if ( document.readyState === "complete" ) { 9218 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 9219 jQuery.ready(); 9220 } 9221 }; 9222} 9223 9224// The DOM ready check for Internet Explorer 9225function doScrollCheck() { 9226 if ( jQuery.isReady ) { 9227 return; 9228 } 9229 9230 try { 9231 // If IE is used, use the trick by Diego Perini 9232 // http://javascript.nwbox.com/IEContentLoaded/ 9233 document.documentElement.doScroll("left"); 9234 } catch(e) { 9235 setTimeout( doScrollCheck, 1 ); 9236 return; 9237 } 9238 9239 // and execute any waiting functions 9240 jQuery.ready(); 9241} 9242 9243// Expose jQuery to the global object 9244return jQuery; 9245 9246})(); 9247 9248 9249var // Promise methods 9250 promiseMethods = "then done fail isResolved isRejected promise".split( " " ), 9251 // Static reference to slice 9252 sliceDeferred = [].slice; 9253 9254jQuery.extend({ 9255 // Create a simple deferred (one callbacks list) 9256 _Deferred: function() { 9257 var // callbacks list 9258 callbacks = [], 9259 // stored [ context , args ] 9260 fired, 9261 // to avoid firing when already doing so 9262 firing, 9263 // flag to know if the deferred has been cancelled 9264 cancelled, 9265 // the deferred itself 9266 deferred = { 9267 9268 // done( f1, f2, ...) 9269 done: function() { 9270 if ( !cancelled ) { 9271 var args = arguments, 9272 i, 9273 length, 9274 elem, 9275 type, 9276 _fired; 9277 if ( fired ) { 9278 _fired = fired; 9279 fired = 0; 9280 } 9281 for ( i = 0, length = args.length; i < length; i++ ) { 9282 elem = args[ i ]; 9283 type = jQuery.type( elem ); 9284 if ( type === "array" ) { 9285 deferred.done.apply( deferred, elem ); 9286 } else if ( type === "function" ) { 9287 callbacks.push( elem ); 9288 } 9289 } 9290 if ( _fired ) { 9291 deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); 9292 } 9293 } 9294 return this; 9295 }, 9296 9297 // resolve with given context and args 9298 resolveWith: function( context, args ) { 9299 if ( !cancelled && !fired && !firing ) { 9300 // make sure args are available (#8421) 9301 args = args || []; 9302 firing = 1; 9303 try { 9304 while( callbacks[ 0 ] ) { 9305 callbacks.shift().apply( context, args ); 9306 } 9307 } 9308 finally { 9309 fired = [ context, args ]; 9310 firing = 0; 9311 } 9312 } 9313 return this; 9314 }, 9315 9316 // resolve with this as context and given arguments 9317 resolve: function() { 9318 deferred.resolveWith( this, arguments ); 9319 return this; 9320 }, 9321 9322 // Has this deferred been resolved? 9323 isResolved: function() { 9324 return !!( firing || fired ); 9325 }, 9326 9327 // Cancel 9328 cancel: function() { 9329 cancelled = 1; 9330 callbacks = []; 9331 return this; 9332 } 9333 }; 9334 9335 return deferred; 9336 }, 9337 9338 // Full fledged deferred (two callbacks list) 9339 Deferred: function( func ) { 9340 var deferred = jQuery._Deferred(), 9341 failDeferred = jQuery._Deferred(), 9342 promise; 9343 // Add errorDeferred methods, then and promise 9344 jQuery.extend( deferred, { 9345 then: function( doneCallbacks, failCallbacks ) { 9346 deferred.done( doneCallbacks ).fail( failCallbacks ); 9347 return this; 9348 }, 9349 fail: failDeferred.done, 9350 rejectWith: failDeferred.resolveWith, 9351 reject: failDeferred.resolve, 9352 isRejected: failDeferred.isResolved, 9353 // Get a promise for this deferred 9354 // If obj is provided, the promise aspect is added to the object 9355 promise: function( obj ) { 9356 if ( obj == null ) { 9357 if ( promise ) { 9358 return promise; 9359 } 9360 promise = obj = {}; 9361 } 9362 var i = promiseMethods.length; 9363 while( i-- ) { 9364 obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; 9365 } 9366 return obj; 9367 } 9368 } ); 9369 // Make sure only one callback list will be used 9370 deferred.done( failDeferred.cancel ).fail( deferred.cancel ); 9371 // Unexpose cancel 9372 delete deferred.cancel; 9373 // Call given func if any 9374 if ( func ) { 9375 func.call( deferred, deferred ); 9376 } 9377 return deferred; 9378 }, 9379 9380 // Deferred helper 9381 when: function( firstParam ) { 9382 var args = arguments, 9383 i = 0, 9384 length = args.length, 9385 count = length, 9386 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? 9387 firstParam : 9388 jQuery.Deferred(); 9389 function resolveFunc( i ) { 9390 return function( value ) { 9391 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 9392 if ( !( --count ) ) { 9393 // Strange bug in FF4: 9394 // Values changed onto the arguments object sometimes end up as undefined values 9395 // outside the $.when method. Cloning the object into a fresh array solves the issue 9396 deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); 9397 } 9398 }; 9399 } 9400 if ( length > 1 ) { 9401 for( ; i < length; i++ ) { 9402 if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { 9403 args[ i ].promise().then( resolveFunc(i), deferred.reject ); 9404 } else { 9405 --count; 9406 } 9407 } 9408 if ( !count ) { 9409 deferred.resolveWith( deferred, args ); 9410 } 9411 } else if ( deferred !== firstParam ) { 9412 deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); 9413 } 9414 return deferred.promise(); 9415 } 9416}); 9417 9418 9419 9420 9421(function() { 9422 9423 jQuery.support = {}; 9424 9425 var div = document.createElement("div"); 9426 9427 div.style.display = "none"; 9428 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a>
9428<input type='checkbox'/>"; 9429 9430 var all = div.getElementsByTagName("*"), 9431 a = div.getElementsByTagName("a")[0], 9432 select = document.createElement("select"), 9433 opt = select.appendChild( document.createElement("option") ), 9434 input = div.getElementsByTagName("input")[0]; 9435 9436 // Can't get basic test support 9437 if ( !all || !all.length || !a ) { 9438 return; 9439 } 9440 9441 jQuery.support = { 9442 // IE strips leading whitespace when .innerHTML is used 9443 leadingWhitespace: div.firstChild.nodeType === 3, 9444 9445 // Make sure that tbody elements aren't automatically inserted 9446 // IE will insert them into empty tables 9447 tbody: !div.getElementsByTagName("tbody").length, 9448 9449 // Make sure that link elements get serialized correctly by innerHTML 9450 // This requires a wrapper element in IE 9451 htmlSerialize: !!div.getElementsByTagName("link").length, 9452 9453 // Get the style information from getAttribute 9454 // (IE uses .cssText insted) 9455 style: /red/.test( a.getAttribute("style") ), 9456 9457 // Make sure that URLs aren't manipulated 9458 // (IE normalizes it by default) 9459 hrefNormalized: a.getAttribute("href") === "/a", 9460 9461 // Make sure that element opacity exists 9462 // (IE uses filter instead) 9463 // Use a regex to work around a WebKit issue. See #5145 9464 opacity: /^0.55$/.test( a.style.opacity ), 9465 9466 // Verify style float existence 9467 // (IE uses styleFloat instead of cssFloat) 9468 cssFloat: !!a.style.cssFloat, 9469 9470 // Make sure that if no value is specified for a checkbox 9471 // that it defaults to "on". 9472 // (WebKit defaults to "" instead) 9473 checkOn: input.value === "on", 9474 9475 // Make sure that a selected-by-default option has a working selected property. 9476 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 9477 optSelected: opt.selected, 9478 9479 // Will be defined later 9480 deleteExpando: true, 9481 optDisabled: false, 9482 checkClone: false, 9483 noCloneEvent: true, 9484 noCloneChecked: true, 9485 boxModel: null, 9486 inlineBlockNeedsLayout: false, 9487 shrinkWrapBlocks: false, 9488 reliableHiddenOffsets: true, 9489 reliableMarginRight: true 9490 }; 9491 9492 input.checked = true; 9493 jQuery.support.noCloneChecked = input.cloneNode( true ).checked; 9494 9495 // Make sure that the options inside disabled selects aren't marked as disabled 9496 // (WebKit marks them as diabled) 9497 select.disabled = true; 9498 jQuery.support.optDisabled = !opt.disabled; 9499 9500 var _scriptEval = null; 9501 jQuery.support.scriptEval = function() { 9502 if ( _scriptEval === null ) { 9503 var root = document.documentElement, 9504 script = document.createElement("script"), 9505 id = "script" + jQuery.now(); 9506 9507 // Make sure that the execution of code works by injecting a script 9508 // tag with appendChild/createTextNode 9509 // (IE doesn't support this, fails, and uses .text instead) 9510 try { 9511 script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); 9512 } catch(e) {} 9513 9514 root.insertBefore( script, root.firstChild ); 9515 9516 if ( window[ id ] ) { 9517 _scriptEval = true; 9518 delete window[ id ]; 9519 } else { 9520 _scriptEval = false; 9521 } 9522 9523 root.removeChild( script ); 9524 } 9525 9526 return _scriptEval; 9527 }; 9528 9529 // Test to see if it's possible to delete an expando from an element 9530 // Fails in Internet Explorer 9531 try { 9532 delete div.test; 9533 9534 } catch(e) { 9535 jQuery.support.deleteExpando = false; 9536 } 9537 9538 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { 9539 div.attachEvent("onclick", function click() { 9540 // Cloning a node shouldn't copy over any 9541 // bound event handlers (IE does this) 9542 jQuery.support.noCloneEvent = false; 9543 div.detachEvent("onclick", click); 9544 }); 9545 div.cloneNode(true).fireEvent("onclick"); 9546 } 9547 9548 div = document.createElement("div"); 9549 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; 9550 9551 var fragment = document.createDocumentFragment(); 9552 fragment.appendChild( div.firstChild ); 9553 9554 // WebKit doesn't clone checked state correctly in fragments 9555 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; 9556 9557 // Figure out if the W3C box model works as expected 9558 // document.body must exist before we can do this 9559 jQuery(function() { 9560 var div = document.createElement("div"), 9561 body = document.getElementsByTagName("body")[0]; 9562 9563 // Frameset documents with no body should not run this code 9564 if ( !body ) { 9565 return; 9566 } 9567 9568 div.style.width = div.style.paddingLeft = "1px"; 9569 body.appendChild( div ); 9570 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; 9571 9572 if ( "zoom" in div.style ) { 9573 // Check if natively block-level elements act like inline-block 9574 // elements when setting their display to 'inline' and giving 9575 // them layout 9576 // (IE < 8 does this) 9577 div.style.display = "inline"; 9578 div.style.zoom = 1; 9579 jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; 9580 9581 // Check if elements with layout shrink-wrap their children 9582 // (IE 6 does this) 9583 div.style.display = ""; 9584 div.innerHTML = "<div style='width:4px;'></div>"; 9585 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; 9586 } 9587 9588 div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; 9589 var tds = div.getElementsByTagName("td"); 9590 9591 // Check if table cells still have offsetWidth/Height when they are set 9592 // to display:none and there are still other visible table cells in a 9593 // table row; if so, offsetWidth/Height are not reliable for use when 9594 // determining if an element has been hidden directly using 9595 // display:none (it is still safe to use offsets if a parent element is 9596 // hidden; don safety goggles and see bug #4512 for more information). 9597 // (only IE 8 fails this test) 9598 jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; 9599 9600 tds[0].style.display = ""; 9601 tds[1].style.display = "none"; 9602 9603 // Check if empty table cells still have offsetWidth/Height 9604 // (IE < 8 fail this test) 9605 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; 9606 div.innerHTML = ""; 9607 9608 // Check if div with explicit width and no margin-right incorrectly 9609 // gets computed margin-right based on width of container. For more 9610 // info see bug #3333 9611 // Fails in WebKit before Feb 2011 nightlies 9612 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 9613 if ( document.defaultView && document.defaultView.getComputedStyle ) { 9614 div.style.width = "1px"; 9615 div.style.marginRight = "0"; 9616 jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0; 9617 } 9618 9619 body.removeChild( div ).style.display = "none"; 9620 div = tds = null; 9621 }); 9622 9623 // Technique from Juriy Zaytsev 9624 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ 9625 var eventSupported = function( eventName ) { 9626 var el = document.createElement("div"); 9627 eventName = "on" + eventName; 9628 9629 // We only care about the case where non-standard event systems 9630 // are used, namely in IE. Short-circuiting here helps us to 9631 // avoid an eval call (in setAttribute) which can cause CSP 9632 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP 9633 if ( !el.attachEvent ) { 9634 return true; 9635 } 9636 9637 var isSupported = (eventName in el); 9638 if ( !isSupported ) { 9639 el.setAttribute(eventName, "return;"); 9640 isSupported = typeof el[eventName] === "function"; 9641 } 9642 return isSupported; 9643 }; 9644 9645 jQuery.support.submitBubbles = eventSupported("submit"); 9646 jQuery.support.changeBubbles = eventSupported("change"); 9647 9648 // release memory in IE 9649 div = all = a = null; 9650})(); 9651 9652 9653 9654var rbrace = /^(?:\{.*\}|\[.*\])$/; 9655 9656jQuery.extend({ 9657 cache: {}, 9658 9659 // Please use with caution 9660 uuid: 0, 9661 9662 // Unique for each copy of jQuery on the page 9663 // Non-digits removed to match rinlinejQuery 9664 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), 9665 9666 // The following elements throw uncatchable exceptions if you 9667 // attempt to add expando properties to them. 9668 noData: { 9669 "embed": true, 9670 // Ban all objects except for Flash (which handle expandos) 9671 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 9672 "applet": true 9673 }, 9674 9675 hasData: function( elem ) { 9676 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; 9677 9678 return !!elem && !isEmptyDataObject( elem ); 9679 }, 9680 9681 data: function( elem, name, data, pvt /* Internal Use Only */ ) { 9682 if ( !jQuery.acceptData( elem ) ) { 9683 return; 9684 } 9685 9686 var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, 9687 9688 // We have to handle DOM nodes and JS objects differently because IE6-7 9689 // can't GC object references properly across the DOM-JS boundary 9690 isNode = elem.nodeType, 9691 9692 // Only DOM nodes need the global jQuery cache; JS object data is 9693 // attached directly to the object so GC can occur automatically 9694 cache = isNode ? jQuery.cache : elem, 9695 9696 // Only defining an ID for JS objects if its cache already exists allows 9697 // the code to shortcut on the same path as a DOM node with no cache 9698 id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; 9699 9700 // Avoid doing any more work than we need to when trying to get data on an 9701 // object that has no data at all 9702 if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { 9703 return; 9704 } 9705 9706 if ( !id ) { 9707 // Only DOM nodes need a new unique ID for each element since their data 9708 // ends up in the global cache 9709 if ( isNode ) { 9710 elem[ jQuery.expando ] = id = ++jQuery.uuid; 9711 } else { 9712 id = jQuery.expando; 9713 } 9714 } 9715 9716 if ( !cache[ id ] ) { 9717 cache[ id ] = {}; 9718 9719 // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery 9720 // metadata on plain JS objects when the object is serialized using 9721 // JSON.stringify 9722 if ( !isNode ) { 9723 cache[ id ].toJSON = jQuery.noop; 9724 } 9725 } 9726
9727 // An object can be passed to jQuery.data instead of a key/value pair; this gets 9728 // shallow copied over onto the existing cache 9729 if ( typeof name === "object" || typeof name === "function" ) { 9730 if ( pvt ) { 9731 cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); 9732 } else { 9733 cache[ id ] = jQuery.extend(cache[ id ], name); 9734 } 9735 } 9736 9737 thisCache = cache[ id ]; 9738 9739 // Internal jQuery data is stored in a separate object inside the object's data 9740 // cache in order to avoid key collisions between internal data and user-defined 9741 // data 9742 if ( pvt ) { 9743 if ( !thisCache[ internalKey ] ) { 9744 thisCache[ internalKey ] = {}; 9745 } 9746 9747 thisCache = thisCache[ internalKey ]; 9748 } 9749 9750 if ( data !== undefined ) { 9751 thisCache[ name ] = data; 9752 } 9753 9754 // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should 9755 // not attempt to inspect the internal events object using jQuery.data, as this 9756 // internal data object is undocumented and subject to change. 9757 if ( name === "events" && !thisCache[name] ) { 9758 return thisCache[ internalKey ] && thisCache[ internalKey ].events; 9759 } 9760 9761 return getByName ? thisCache[ name ] : thisCache; 9762 }, 9763 9764 removeData: function( elem, name, pvt /* Internal Use Only */ ) { 9765 if ( !jQuery.acceptData( elem ) ) { 9766 return; 9767 } 9768 9769 var internalKey = jQuery.expando, isNode = elem.nodeType, 9770 9771 // See jQuery.data for more information 9772 cache = isNode ? jQuery.cache : elem, 9773 9774 // See jQuery.data for more information 9775 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 9776 9777 // If there is already no cache entry for this object, there is no 9778 // purpose in continuing 9779 if ( !cache[ id ] ) { 9780 return; 9781 } 9782 9783 if ( name ) { 9784 var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; 9785 9786 if ( thisCache ) { 9787 delete thisCache[ name ]; 9788 9789 // If there is no data left in the cache, we want to continue 9790 // and let the cache object itself get destroyed 9791 if ( !isEmptyDataObject(thisCache) ) { 9792 return; 9793 } 9794 } 9795 } 9796 9797 // See jQuery.data for more information 9798 if ( pvt ) { 9799 delete cache[ id ][ internalKey ]; 9800 9801 // Don't destroy the parent cache unless the internal data object 9802 // had been the only thing left in it 9803 if ( !isEmptyDataObject(cache[ id ]) ) { 9804 return; 9805 } 9806 } 9807 9808 var internalCache = cache[ id ][ internalKey ]; 9809 9810 // Browsers that fail expando deletion also refuse to delete expandos on 9811 // the window, but it will allow it on all other JS objects; other browsers 9812 // don't care 9813 if ( jQuery.support.deleteExpando || cache != window ) { 9814 delete cache[ id ]; 9815 } else { 9816 cache[ id ] = null; 9817 } 9818 9819 // We destroyed the entire user cache at once because it's faster than 9820 // iterating through each key, but we need to continue to persist internal 9821 // data if it existed 9822 if ( internalCache ) { 9823 cache[ id ] = {}; 9824 // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery 9825 // metadata on plain JS objects when the object is serialized using 9826 // JSON.stringify 9827 if ( !isNode ) { 9828 cache[ id ].toJSON = jQuery.noop; 9829 } 9830 9831 cache[ id ][ internalKey ] = internalCache; 9832 9833 // Otherwise, we need to eliminate the expando on the node to avoid 9834 // false lookups in the cache for entries that no longer exist 9835 } else if ( isNode ) { 9836 // IE does not allow us to delete expando properties from nodes, 9837 // nor does it have a removeAttribute function on Document nodes; 9838 // we must handle all of these cases 9839 if ( jQuery.support.deleteExpando ) { 9840 delete elem[ jQuery.expando ]; 9841 } else if ( elem.removeAttribute ) { 9842 elem.removeAttribute( jQuery.expando ); 9843 } else { 9844 elem[ jQuery.expando ] = null; 9845 } 9846 } 9847 }, 9848 9849 // For internal use only. 9850 _data: function( elem, name, data ) { 9851 return jQuery.data( elem, name, data, true ); 9852 }, 9853 9854 // A method for determining if a DOM node can handle the data expando 9855 acceptData: function( elem ) { 9856 if ( elem.nodeName ) { 9857 var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; 9858 9859 if ( match ) { 9860 return !(match === true || elem.getAttribute("classid") !== match); 9861 } 9862 } 9863 9864 return true; 9865 } 9866}); 9867 9868jQuery.fn.extend({ 9869 data: function( key, value ) { 9870 var data = null; 9871 9872 if ( typeof key === "undefined" ) { 9873 if ( this.length ) { 9874 data = jQuery.data( this[0] ); 9875 9876 if ( this[0].nodeType === 1 ) { 9877 var attr = this[0].attributes, name; 9878 for ( var i = 0, l = attr.length; i < l; i++ ) { 9879 name = attr[i].name; 9880
vendor: 8,001 bytes, lines 9881-10224
9881 if ( name.indexOf( "data-" ) === 0 ) { 9882 name = name.substr( 5 ); 9883 dataAttr( this[0], name, data[ name ] ); 9884 } 9885 } 9886 } 9887 } 9888 9889 return data; 9890 9891 } else if ( typeof key === "object" ) { 9892 return this.each(function() { 9893 jQuery.data( this, key ); 9894 }); 9895 } 9896 9897 var parts = key.split("."); 9898 parts[1] = parts[1] ? "." + parts[1] : ""; 9899 9900 if ( value === undefined ) { 9901 data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 9902 9903 // Try to fetch any internally stored data first 9904 if ( data === undefined && this.length ) { 9905 data = jQuery.data( this[0], key ); 9906 data = dataAttr( this[0], key, data ); 9907 } 9908 9909 return data === undefined && parts[1] ? 9910 this.data( parts[0] ) : 9911 data; 9912 9913 } else { 9914 return this.each(function() { 9915 var $this = jQuery( this ), 9916 args = [ parts[0], value ]; 9917 9918 $this.triggerHandler( "setData" + parts[1] + "!", args ); 9919 jQuery.data( this, key, value ); 9920 $this.triggerHandler( "changeData" + parts[1] + "!", args ); 9921 }); 9922 } 9923 }, 9924 9925 removeData: function( key ) { 9926 return this.each(function() { 9927 jQuery.removeData( this, key ); 9928 }); 9929 } 9930}); 9931 9932function dataAttr( elem, key, data ) { 9933 // If nothing was found internally, try to fetch any 9934 // data from the HTML5 data-* attribute 9935 if ( data === undefined && elem.nodeType === 1 ) { 9936 data = elem.getAttribute( "data-" + key ); 9937 9938 if ( typeof data === "string" ) { 9939 try { 9940 data = data === "true" ? true : 9941 data === "false" ? false : 9942 data === "null" ? null : 9943 !jQuery.isNaN( data ) ? parseFloat( data ) : 9944 rbrace.test( data ) ? jQuery.parseJSON( data ) : 9945 data; 9946 } catch( e ) {} 9947 9948 // Make sure we set the data so it isn't changed later 9949 jQuery.data( elem, key, data ); 9950 9951 } else { 9952 data = undefined; 9953 } 9954 } 9955 9956 return data; 9957} 9958 9959// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON 9960// property to be considered empty objects; this property always exists in 9961// order to make sure JSON.stringify does not expose internal metadata 9962function isEmptyDataObject( obj ) { 9963 for ( var name in obj ) { 9964 if ( name !== "toJSON" ) { 9965 return false; 9966 } 9967 } 9968 9969 return true; 9970} 9971 9972 9973 9974 9975jQuery.extend({ 9976 queue: function( elem, type, data ) { 9977 if ( !elem ) { 9978 return; 9979 } 9980 9981 type = (type || "fx") + "queue"; 9982 var q = jQuery._data( elem, type ); 9983 9984 // Speed up dequeue by getting out quickly if this is just a lookup 9985 if ( !data ) { 9986 return q || []; 9987 } 9988 9989 if ( !q || jQuery.isArray(data) ) { 9990 q = jQuery._data( elem, type, jQuery.makeArray(data) ); 9991 9992 } else { 9993 q.push( data ); 9994 } 9995 9996 return q; 9997 }, 9998 9999 dequeue: function( elem, type ) { 10000 type = type || "fx"; 10001 10002 var queue = jQuery.queue( elem, type ), 10003 fn = queue.shift(); 10004 10005 // If the fx queue is dequeued, always remove the progress sentinel 10006 if ( fn === "inprogress" ) { 10007 fn = queue.shift(); 10008 } 10009 10010 if ( fn ) { 10011 // Add a progress sentinel to prevent the fx queue from being 10012 // automatically dequeued 10013 if ( type === "fx" ) { 10014 queue.unshift("inprogress"); 10015 } 10016 10017 fn.call(elem, function() { 10018 jQuery.dequeue(elem, type); 10019 }); 10020 } 10021 10022 if ( !queue.length ) { 10023 jQuery.removeData( elem, type + "queue", true ); 10024 } 10025 } 10026}); 10027 10028jQuery.fn.extend({ 10029 queue: function( type, data ) { 10030 if ( typeof type !== "string" ) { 10031 data = type; 10032 type = "fx"; 10033 } 10034 10035 if ( data === undefined ) { 10036 return jQuery.queue( this[0], type ); 10037 } 10038 return this.each(function( i ) { 10039 var queue = jQuery.queue( this, type, data ); 10040 10041 if ( type === "fx" && queue[0] !== "inprogress" ) { 10042 jQuery.dequeue( this, type ); 10043 } 10044 }); 10045 }, 10046 dequeue: function( type ) { 10047 return this.each(function() { 10048 jQuery.dequeue( this, type ); 10049 }); 10050 }, 10051 10052 // Based off of the plugin by Clint Helfers, with permission. 10053 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 10054 delay: function( time, type ) { 10055 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 10056 type = type || "fx"; 10057 10058 return this.queue( type, function() { 10059 var elem = this; 10060 setTimeout(function() { 10061 jQuery.dequeue( elem, type ); 10062 }, time ); 10063 }); 10064 }, 10065 10066 clearQueue: function( type ) { 10067 return this.queue( type || "fx", [] ); 10068 } 10069}); 10070 10071 10072 10073 10074var rclass = /[\n\t\r]/g, 10075 rspaces = /\s+/, 10076 rreturn = /\r/g, 10077 rspecialurl = /^(?:href|src|style)$/, 10078 rtype = /^(?:button|input)$/i, 10079 rfocusable = /^(?:button|input|object|select|textarea)$/i, 10080 rclickable = /^a(?:rea)?$/i, 10081 rradiocheck = /^(?:radio|checkbox)$/i; 10082 10083jQuery.props = { 10084 "for": "htmlFor", 10085 "class": "className", 10086 readonly: "readOnly", 10087 maxlength: "maxLength", 10088 cellspacing: "cellSpacing", 10089 rowspan: "rowSpan", 10090 colspan: "colSpan", 10091 tabindex: "tabIndex", 10092 usemap: "useMap", 10093 frameborder: "frameBorder" 10094}; 10095 10096jQuery.fn.extend({ 10097 attr: function( name, value ) { 10098 return jQuery.access( this, name, value, true, jQuery.attr ); 10099 }, 10100 10101 removeAttr: function( name, fn ) { 10102 return this.each(function(){ 10103 jQuery.attr( this, name, "" ); 10104 if ( this.nodeType === 1 ) { 10105 this.removeAttribute( name ); 10106 } 10107 }); 10108 }, 10109 10110 addClass: function( value ) { 10111 if ( jQuery.isFunction(value) ) { 10112 return this.each(function(i) { 10113 var self = jQuery(this); 10114 self.addClass( value.call(this, i, self.attr("class")) ); 10115 }); 10116 } 10117 10118 if ( value && typeof value === "string" ) { 10119 var classNames = (value || "").split( rspaces ); 10120 10121 for ( var i = 0, l = this.length; i < l; i++ ) { 10122 var elem = this[i]; 10123 10124 if ( elem.nodeType === 1 ) { 10125 if ( !elem.className ) { 10126 elem.className = value; 10127 10128 } else { 10129 var className = " " + elem.className + " ", 10130 setClass = elem.className; 10131 10132 for ( var c = 0, cl = classNames.length; c < cl; c++ ) { 10133 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { 10134 setClass += " " + classNames[c]; 10135 } 10136 } 10137 elem.className = jQuery.trim( setClass ); 10138 } 10139 } 10140 } 10141 } 10142 10143 return this; 10144 }, 10145 10146 removeClass: function( value ) { 10147 if ( jQuery.isFunction(value) ) { 10148 return this.each(function(i) { 10149 var self = jQuery(this); 10150 self.removeClass( value.call(this, i, self.attr("class")) ); 10151 }); 10152 } 10153 10154 if ( (value && typeof value === "string") || value === undefined ) { 10155 var classNames = (value || "").split( rspaces ); 10156 10157 for ( var i = 0, l = this.length; i < l; i++ ) { 10158 var elem = this[i]; 10159 10160 if ( elem.nodeType === 1 && elem.className ) { 10161 if ( value ) { 10162 var className = (" " + elem.className + " ").replace(rclass, " "); 10163 for ( var c = 0, cl = classNames.length; c < cl; c++ ) { 10164 className = className.replace(" " + classNames[c] + " ", " "); 10165 } 10166 elem.className = jQuery.trim( className ); 10167 10168 } else { 10169 elem.className = ""; 10170 } 10171 } 10172 } 10173 } 10174 10175 return this; 10176 }, 10177 10178 toggleClass: function( value, stateVal ) { 10179 var type = typeof value, 10180 isBool = typeof stateVal === "boolean"; 10181 10182 if ( jQuery.isFunction( value ) ) { 10183 return this.each(function(i) { 10184 var self = jQuery(this); 10185 self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); 10186 }); 10187 } 10188 10189 return this.each(function() { 10190 if ( type === "string" ) { 10191 // toggle individual class names 10192 var className, 10193 i = 0, 10194 self = jQuery( this ), 10195 state = stateVal, 10196 classNames = value.split( rspaces ); 10197 10198 while ( (className = classNames[ i++ ]) ) { 10199 // check each className given, space seperated list 10200 state = isBool ? state : !self.hasClass( className ); 10201 self[ state ? "addClass" : "removeClass" ]( className ); 10202 } 10203 10204 } else if ( type === "undefined" || type === "boolean" ) { 10205 if ( this.className ) { 10206 // store className if set 10207 jQuery._data( this, "__className__", this.className ); 10208 } 10209 10210 // toggle whole className 10211 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; 10212 } 10213 }); 10214 }, 10215 10216 hasClass: function( selector ) { 10217 var className = " " + selector + " "; 10218 for ( var i = 0, l = this.length; i < l; i++ ) { 10219 if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { 10220 return true; 10221 } 10222 } 10223 10224 return false;
10225 }, 10226 10227 val: function( value ) { 10228 if ( !arguments.length ) { 10229 var elem = this[0]; 10230 10231 if ( elem ) { 10232 if ( jQuery.nodeName( elem, "option" ) ) { 10233 // attributes.value is undefined in Blackberry 4.7 but 10234 // uses .value. See #6932 10235 var val = elem.attributes.value; 10236 return !val || val.specified ? elem.value : elem.text; 10237 } 10238 10239 // We need to handle select boxes special 10240 if ( jQuery.nodeName( elem, "select" ) ) { 10241 var index = elem.selectedIndex, 10242 values = [], 10243 options = elem.options, 10244 one = elem.type === "select-one"; 10245 10246 // Nothing was selected 10247 if ( index < 0 ) { 10248 return null; 10249 } 10250 10251 // Loop through all the selected options 10252 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { 10253 var option = options[ i ]; 10254 10255 // Don't return options that are disabled or in a disabled optgroup 10256 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 10257 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { 10258 10259 // Get the specific value for the option 10260 value = jQuery(option).val(); 10261 10262 // We don't need an array for one selects 10263 if ( one ) { 10264 return value; 10265 } 10266 10267 // Multi-Selects return an array 10268 values.push( value ); 10269 } 10270 } 10271 10272 // Fixes Bug #2551 -- select.val() broken in IE after form.reset() 10273 if ( one && !values.length && options.length ) { 10274 return jQuery( options[ index ] ).val(); 10275 } 10276 10277 return values; 10278 } 10279 10280 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 10281 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { 10282 return elem.getAttribute("value") === null ? "on" : elem.value; 10283 } 10284 10285 // Everything else, we just grab the value 10286 return (elem.value || "").replace(rreturn, ""); 10287 10288 } 10289 10290 return undefined; 10291 } 10292 10293 var isFunction = jQuery.isFunction(value); 10294 10295 return this.each(function(i) { 10296 var self = jQuery(this), val = value; 10297 10298 if ( this.nodeType !== 1 ) { 10299 return; 10300 } 10301 10302 if ( isFunction ) { 10303 val = value.call(this, i, self.val()); 10304 } 10305 10306 // Treat null/undefined as ""; convert numbers to string 10307 if ( val == null ) { 10308 val = ""; 10309 } else if ( typeof val === "number" ) { 10310 val += ""; 10311 } else if ( jQuery.isArray(val) ) { 10312 val = jQuery.map(val, function (value) { 10313 return value == null ? "" : value + ""; 10314 }); 10315 } 10316 10317 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { 10318 this.checked = jQuery.inArray( self.val(), val ) >= 0; 10319 10320 } else if ( jQuery.nodeName( this, "select" ) ) { 10321 var values = jQuery.makeArray(val); 10322 10323 jQuery( "option", this ).each(function() { 10324 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; 10325 }); 10326 10327 if ( !values.length ) { 10328 this.selectedIndex = -1; 10329 } 10330 10331 } else { 10332 this.value = val; 10333 } 10334 }); 10335 } 10336}); 10337 10338jQuery.extend({ 10339 attrFn: { 10340 val: true, 10341 css: true, 10342 html: true, 10343 text: true, 10344 data: true, 10345 width: true, 10346 height: true, 10347 offset: true 10348 }, 10349 10350 attr: function( elem, name, value, pass ) { 10351 // don't get/set attributes on text, comment and attribute nodes 10352 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) { 10353 return undefined; 10354 } 10355 10356 if ( pass && name in jQuery.attrFn ) { 10357 return jQuery(elem)[name](value); 10358 } 10359 10360 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), 10361 // Whether we are setting (or getting) 10362 set = value !== undefined; 10363 10364 // Try to normalize/fix the name 10365 name = notxml && jQuery.props[ name ] || name; 10366 10367 // Only do all the following if this is a node (faster for style) 10368 if ( elem.nodeType === 1 ) { 10369 // These attributes require special treatment 10370 var special = rspecialurl.test( name ); 10371 10372 // Safari mis-reports the default selected property of an option 10373 // Accessing the parent's selectedIndex property fixes it 10374 if ( name === "selected" && !jQuery.support.optSelected ) { 10375 var parent = elem.parentNode; 10376 if ( parent ) { 10377 parent.selectedIndex; 10378 10379 // Make sure that it also works with optgroups, see #5701 10380 if ( parent.parentNode ) { 10381 parent.parentNode.selectedIndex; 10382 } 10383 } 10384 } 10385 10386 // If applicable, access the attribute via the DOM 0 way 10387 // 'in' checks fail in Blackberry 4.7 #6931 10388 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { 10389 if ( set ) { 10390 // We can't allow the type property to be changed (since it causes problems in IE)
10391 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { 10392 jQuery.error( "type property can't be changed" ); 10393 } 10394 10395 if ( value === null ) { 10396 if ( elem.nodeType === 1 ) { 10397 elem.removeAttribute( name ); 10398 } 10399 10400 } else { 10401 elem[ name ] = value; 10402 } 10403 } 10404 10405 // browsers index elements by id/name on forms, give priority to attributes. 10406 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { 10407 return elem.getAttributeNode( name ).nodeValue; 10408 } 10409 10410 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 10411 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 10412 if ( name === "tabIndex" ) { 10413 var attributeNode = elem.getAttributeNode( "tabIndex" ); 10414 10415 return attributeNode && attributeNode.specified ? 10416 attributeNode.value : 10417 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 10418 0 : 10419 undefined; 10420 } 10421 10422 return elem[ name ]; 10423 } 10424 10425 if ( !jQuery.support.style && notxml && name === "style" ) { 10426 if ( set ) { 10427 elem.style.cssText = "" + value; 10428 } 10429 10430 return elem.style.cssText; 10431 } 10432 10433 if ( set ) { 10434 // convert the value to a string (all browsers do this but IE) see #1070 10435 elem.setAttribute( name, "" + value ); 10436 } 10437 10438 // Ensure that missing attributes return undefined 10439 // Blackberry 4.7 returns "" from getAttribute #6938 10440 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { 10441 return undefined; 10442 } 10443 10444 var attr = !jQuery.support.hrefNormalized && notxml && special ? 10445 // Some attributes require a special call on IE 10446 elem.getAttribute( name, 2 ) : 10447 elem.getAttribute( name ); 10448 10449 // Non-existent attributes return null, we normalize to undefined 10450 return attr === null ? undefined : attr; 10451 } 10452 // Handle everything which isn't a DOM element node 10453 if ( set ) { 10454 elem[ name ] = value; 10455 } 10456 return elem[ name ]; 10457 } 10458}); 10459 10460 10461 10462 10463var rnamespaces = /\.(.*)$/, 10464 rformElems = /^(?:textarea|input|select)$/i, 10465 rperiod = /\./g, 10466 rspace = / /g, 10467 rescape = /[^\w\s.|`]/g, 10468 fcleanup = function( nm ) { 10469 return nm.replace(rescape, "\\$&"); 10470 }; 10471 10472/* 10473 * A number of helper functions used for managing events. 10474 * Many of the ideas behind this code originated from 10475 * Dean Edwards' addEvent library. 10476 */ 10477jQuery.event = { 10478 10479 // Bind an event to an element 10480 // Original by Dean Edwards 10481 add: function( elem, types, handler, data ) { 10482 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 10483 return; 10484 } 10485 10486 // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6) 10487 // Minor release fix for bug #8018 10488 try { 10489 // For whatever reason, IE has trouble passing the window object 10490 // around, causing it to be cloned in the process 10491 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { 10492 elem = window; 10493 } 10494 } 10495 catch ( e ) {} 10496 10497 if ( handler === false ) { 10498 handler = returnFalse; 10499 } else if ( !handler ) { 10500 // Fixes bug #7229. Fix recommended by jdalton 10501 return; 10502 } 10503 10504 var handleObjIn, handleObj; 10505 10506 if ( handler.handler ) { 10507 handleObjIn = handler; 10508 handler = handleObjIn.handler; 10509 } 10510 10511 // Make sure that the function being executed has a unique ID 10512 if ( !handler.guid ) { 10513 handler.guid = jQuery.guid++; 10514 } 10515 10516 // Init the element's event structure 10517 var elemData = jQuery._data( elem ); 10518 10519 // If no elemData is found then we must be trying to bind to one of the 10520 // banned noData elements 10521 if ( !elemData ) { 10522 return; 10523 } 10524 10525 var events = elemData.events, 10526 eventHandle = elemData.handle; 10527 10528 if ( !events ) { 10529 elemData.events = events = {}; 10530 } 10531 10532 if ( !eventHandle ) { 10533 elemData.handle = eventHandle = function( e ) { 10534 // Handle the second event of a trigger and when 10535 // an event is called after a page has unloaded 10536 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 10537 jQuery.event.handle.apply( eventHandle.elem, arguments ) : 10538 undefined; 10539 }; 10540 } 10541 10542 // Add elem as a property of the handle function 10543 // This is to prevent a memory leak with non-native events in IE. 10544 eventHandle.elem = elem; 10545 10546 // Handle multiple events separated by a space 10547 // jQuery(...).bind("mouseover mouseout", fn); 10548 types = types.split(" "); 10549 10550 var type, i = 0, namespaces; 10551 10552 while ( (type = types[ i++ ]) ) { 10553 handleObj = handleObjIn ? 10554 jQuery.extend({}, handleObjIn) : 10555 { handler: handler, data: data }; 10556 10557 // Namespaced event handlers 10558 if ( type.indexOf(".") > -1 ) { 10559 namespaces = type.split("."); 10560 type = namespaces.shift(); 10561 handleObj.namespace = namespaces.slice(0).sort().join("."); 10562 10563 } else { 10564 namespaces = []; 10565 handleObj.namespace = ""; 10566 } 10567 10568 handleObj.type = type; 10569 if ( !handleObj.guid ) { 10570 handleObj.guid = handler.guid; 10571 } 10572
vendor: 6,396 bytes, lines 10573-10813
10573 // Get the current list of functions bound to this event 10574 var handlers = events[ type ], 10575 special = jQuery.event.special[ type ] || {}; 10576 10577 // Init the event handler queue 10578 if ( !handlers ) { 10579 handlers = events[ type ] = []; 10580 10581 // Check for a special event handler 10582 // Only use addEventListener/attachEvent if the special 10583 // events handler returns false 10584 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 10585 // Bind the global event handler to the element 10586 if ( elem.addEventListener ) { 10587 elem.addEventListener( type, eventHandle, false ); 10588 10589 } else if ( elem.attachEvent ) { 10590 elem.attachEvent( "on" + type, eventHandle ); 10591 } 10592 } 10593 } 10594 10595 if ( special.add ) { 10596 special.add.call( elem, handleObj ); 10597 10598 if ( !handleObj.handler.guid ) { 10599 handleObj.handler.guid = handler.guid; 10600 } 10601 } 10602 10603 // Add the function to the element's handler list 10604 handlers.push( handleObj ); 10605 10606 // Keep track of which events have been used, for global triggering 10607 jQuery.event.global[ type ] = true; 10608 } 10609 10610 // Nullify elem to prevent memory leaks in IE 10611 elem = null; 10612 }, 10613 10614 global: {}, 10615 10616 // Detach an event or set of events from an element 10617 remove: function( elem, types, handler, pos ) { 10618 // don't do events on text and comment nodes 10619 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 10620 return; 10621 } 10622 10623 if ( handler === false ) { 10624 handler = returnFalse; 10625 } 10626 10627 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, 10628 elemData = jQuery.hasData( elem ) && jQuery._data( elem ), 10629 events = elemData && elemData.events; 10630 10631 if ( !elemData || !events ) { 10632 return; 10633 } 10634 10635 // types is actually an event object here 10636 if ( types && types.type ) { 10637 handler = types.handler; 10638 types = types.type; 10639 } 10640 10641 // Unbind all events for the element 10642 if ( !types || typeof types === "string" && types.charAt(0) === "." ) { 10643 types = types || ""; 10644 10645 for ( type in events ) { 10646 jQuery.event.remove( elem, type + types ); 10647 } 10648 10649 return; 10650 } 10651 10652 // Handle multiple events separated by a space 10653 // jQuery(...).unbind("mouseover mouseout", fn); 10654 types = types.split(" "); 10655 10656 while ( (type = types[ i++ ]) ) { 10657 origType = type; 10658 handleObj = null; 10659 all = type.indexOf(".") < 0; 10660 namespaces = []; 10661 10662 if ( !all ) { 10663 // Namespaced event handlers 10664 namespaces = type.split("."); 10665 type = namespaces.shift(); 10666 10667 namespace = new RegExp("(^|\\.)" + 10668 jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); 10669 } 10670 10671 eventType = events[ type ]; 10672 10673 if ( !eventType ) { 10674 continue; 10675 } 10676 10677 if ( !handler ) { 10678 for ( j = 0; j < eventType.length; j++ ) { 10679 handleObj = eventType[ j ]; 10680 10681 if ( all || namespace.test( handleObj.namespace ) ) { 10682 jQuery.event.remove( elem, origType, handleObj.handler, j ); 10683 eventType.splice( j--, 1 ); 10684 } 10685 } 10686 10687 continue; 10688 } 10689 10690 special = jQuery.event.special[ type ] || {}; 10691 10692 for ( j = pos || 0; j < eventType.length; j++ ) { 10693 handleObj = eventType[ j ]; 10694 10695 if ( handler.guid === handleObj.guid ) { 10696 // remove the given handler for the given type 10697 if ( all || namespace.test( handleObj.namespace ) ) { 10698 if ( pos == null ) { 10699 eventType.splice( j--, 1 ); 10700 } 10701 10702 if ( special.remove ) { 10703 special.remove.call( elem, handleObj ); 10704 } 10705 } 10706 10707 if ( pos != null ) { 10708 break; 10709 } 10710 } 10711 } 10712 10713 // remove generic event handler if no more handlers exist 10714 if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { 10715 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { 10716 jQuery.removeEvent( elem, type, elemData.handle ); 10717 } 10718 10719 ret = null; 10720 delete events[ type ]; 10721 } 10722 } 10723 10724 // Remove the expando if it's no longer used 10725 if ( jQuery.isEmptyObject( events ) ) { 10726 var handle = elemData.handle; 10727 if ( handle ) { 10728 handle.elem = null; 10729 } 10730 10731 delete elemData.events; 10732 delete elemData.handle; 10733 10734 if ( jQuery.isEmptyObject( elemData ) ) { 10735 jQuery.removeData( elem, undefined, true ); 10736 } 10737 } 10738 }, 10739 10740 // bubbling is internal 10741 trigger: function( event, data, elem /*, bubbling */ ) { 10742 // Event object or event type 10743 var type = event.type || event, 10744 bubbling = arguments[3]; 10745 10746 if ( !bubbling ) { 10747 event = typeof event === "object" ? 10748 // jQuery.Event object 10749 event[ jQuery.expando ] ? event : 10750 // Object literal 10751 jQuery.extend( jQuery.Event(type), event ) : 10752 // Just the event type (string) 10753 jQuery.Event(type); 10754 10755 if ( type.indexOf("!") >= 0 ) { 10756 event.type = type = type.slice(0, -1); 10757 event.exclusive = true; 10758 } 10759 10760 // Handle a global trigger 10761 if ( !elem ) { 10762 // Don't bubble custom events when global (to avoid too much overhead) 10763 event.stopPropagation(); 10764 10765 // Only trigger if we've ever bound an event for it 10766 if ( jQuery.event.global[ type ] ) { 10767 // XXX This code smells terrible. event.js should not be directly 10768 // inspecting the data cache 10769 jQuery.each( jQuery.cache, function() { 10770 // internalKey variable is just used to make it easier to find 10771 // and potentially change this stuff later; currently it just 10772 // points to jQuery.expando 10773 var internalKey = jQuery.expando, 10774 internalCache = this[ internalKey ]; 10775 if ( internalCache && internalCache.events && internalCache.events[ type ] ) { 10776 jQuery.event.trigger( event, data, internalCache.handle.elem ); 10777 } 10778 }); 10779 } 10780 } 10781 10782 // Handle triggering a single element 10783 10784 // don't do events on text and comment nodes 10785 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { 10786 return undefined; 10787 } 10788 10789 // Clean up in case it is reused 10790 event.result = undefined; 10791 event.target = elem; 10792 10793 // Clone the incoming data, if any 10794 data = jQuery.makeArray( data ); 10795 data.unshift( event ); 10796 } 10797 10798 event.currentTarget = elem; 10799 10800 // Trigger the event, it is assumed that "handle" is a function 10801 var handle = jQuery._data( elem, "handle" ); 10802 10803 if ( handle ) { 10804 handle.apply( elem, data ); 10805 } 10806 10807 var parent = elem.parentNode || elem.ownerDocument; 10808 10809 // Trigger an inline bound script 10810 try { 10811 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { 10812 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { 10813 event.result = false;
10814 event.preventDefault(); 10815 } 10816 } 10817 10818 // prevent IE from throwing an error for some elements with some event types, see #3533 10819 } catch (inlineError) {} 10820 10821 if ( !event.isPropagationStopped() && parent ) { 10822 jQuery.event.trigger( event, data, parent, true ); 10823 10824 } else if ( !event.isDefaultPrevented() ) { 10825 var old, 10826 target = event.target, 10827 targetType = type.replace( rnamespaces, "" ), 10828 isClick = jQuery.nodeName( target, "a" ) && targetType === "click", 10829 special = jQuery.event.special[ targetType ] || {}; 10830 10831 if ( (!special._default || special._default.call( elem, event ) === false) && 10832 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { 10833 10834 try { 10835 if ( target[ targetType ] ) { 10836 // Make sure that we don't accidentally re-trigger the onFOO events 10837 old = target[ "on" + targetType ]; 10838 10839 if ( old ) { 10840 target[ "on" + targetType ] = null; 10841 } 10842 10843 jQuery.event.triggered = event.type; 10844 target[ targetType ](); 10845 } 10846 10847 // prevent IE from throwing an error for some elements with some event types, see #3533 10848 } catch (triggerError) {} 10849 10850 if ( old ) { 10851 target[ "on" + targetType ] = old; 10852 } 10853 10854 jQuery.event.triggered = undefined; 10855 } 10856 } 10857 }, 10858 10859 handle: function( event ) { 10860 var all, handlers, namespaces, namespace_re, events, 10861 namespace_sort = [], 10862 args = jQuery.makeArray( arguments ); 10863 10864 event = args[0] = jQuery.event.fix( event || window.event ); 10865 event.currentTarget = this; 10866 10867 // Namespaced event handlers 10868 all = event.type.indexOf(".") < 0 && !event.exclusive; 10869 10870 if ( !all ) { 10871 namespaces = event.type.split("."); 10872 event.type = namespaces.shift(); 10873 namespace_sort = namespaces.slice(0).sort(); 10874 namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); 10875 } 10876 10877 event.namespace = event.namespace || namespace_sort.join("."); 10878 10879 events = jQuery._data(this, "events"); 10880 10881 handlers = (events || {})[ event.type ]; 10882 10883 if ( events && handlers ) { 10884 // Clone the handlers to prevent manipulation 10885 handlers = handlers.slice(0); 10886 10887 for ( var j = 0, l = handlers.length; j < l; j++ ) { 10888 var handleObj = handlers[ j ]; 10889 10890 // Filter the functions by class 10891 if ( all || namespace_re.test( handleObj.namespace ) ) { 10892 // Pass in a reference to the handler function itself 10893 // So that we can later remove it 10894 event.handler = handleObj.handler; 10895 event.data = handleObj.data; 10896 event.handleObj = handleObj; 10897 10898 var ret = handleObj.handler.apply( this, args ); 10899 10900 if ( ret !== undefined ) { 10901 event.result = ret; 10902 if ( ret === false ) { 10903 event.preventDefault(); 10904 event.stopPropagation(); 10905 } 10906 } 10907 10908 if ( event.isImmediatePropagationStopped() ) { 10909 break; 10910 } 10911 } 10912 } 10913 } 10914 10915 return event.result; 10916 }, 10917 10918 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(" "), 10919 10920 fix: function( event ) { 10921 if ( event[ jQuery.expando ] ) { 10922 return event; 10923 } 10924 10925 // store a copy of the original event object 10926 // and "clone" to set read-only properties 10927 var originalEvent = event; 10928 event = jQuery.Event( originalEvent ); 10929 10930 for ( var i = this.props.length, prop; i; ) { 10931 prop = this.props[ --i ]; 10932 event[ prop ] = originalEvent[ prop ]; 10933 } 10934 10935 // Fix target property, if necessary 10936 if ( !event.target ) { 10937 // Fixes #1925 where srcElement might not be defined either 10938 event.target = event.srcElement || document; 10939 } 10940 10941 // check if target is a textnode (safari) 10942 if ( event.target.nodeType === 3 ) { 10943 event.target = event.target.parentNode; 10944 } 10945 10946 // Add relatedTarget, if necessary 10947 if ( !event.relatedTarget && event.fromElement ) { 10948 event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; 10949 } 10950 10951 // Calculate pageX/Y if missing and clientX/Y available 10952 if ( event.pageX == null && event.clientX != null ) { 10953 var doc = document.documentElement, 10954 body = document.body; 10955 10956 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); 10957 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); 10958 } 10959 10960 // Add which for key events 10961 if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { 10962 event.which = event.charCode != null ? event.charCode : event.keyCode; 10963 } 10964 10965 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 10966 if ( !event.metaKey && event.ctrlKey ) { 10967 event.metaKey = event.ctrlKey; 10968 } 10969 10970 // Add which for click: 1 === left; 2 === middle; 3 === right 10971 // Note: button is not normalized, so don't use it 10972 if ( !event.which && event.button !== undefined ) { 10973 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 10974 } 10975 10976 return event; 10977 }, 10978 10979 // Deprecated, use jQuery.guid instead 10980 guid: 1E8, 10981 10982 // Deprecated, use jQuery.proxy instead 10983 proxy: jQuery.proxy, 10984 10985 special: { 10986 ready: { 10987 // Make sure the ready event is setup 10988 setup: jQuery.bindReady, 10989 teardown: jQuery.noop 10990 }, 10991 10992 live: { 10993 add: function( handleObj ) { 10994 jQuery.event.add( this, 10995 liveConvert( handleObj.origType, handleObj.selector ), 10996 jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); 10997 }, 10998 10999 remove: function( handleObj ) { 11000 jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); 11001 } 11002 }, 11003 11004 beforeunload: { 11005 setup: function( data, namespaces, eventHandle ) { 11006 // We only want to do this special case on windows 11007 if ( jQuery.isWindow( this ) ) { 11008 this.onbeforeunload = eventHandle; 11009 } 11010 }, 11011 11012 teardown: function( namespaces, eventHandle ) { 11013 if ( this.onbeforeunload === eventHandle ) { 11014 this.onbeforeunload = null; 11015 } 11016 } 11017 } 11018 } 11019}; 11020 11021jQuery.removeEvent = document.removeEventListener ? 11022 function( elem, type, handle ) { 11023 if ( elem.removeEventListener ) { 11024 elem.removeEventListener( type, handle, false ); 11025 } 11026 } : 11027 function( elem, type, handle ) { 11028 if ( elem.detachEvent ) { 11029 elem.detachEvent( "on" + type, handle ); 11030 } 11031 }; 11032 11033jQuery.Event = function( src ) { 11034 // Allow instantiation without the 'new' keyword 11035 if ( !this.preventDefault ) { 11036 return new jQuery.Event( src ); 11037 } 11038 11039 // Event object 11040 if ( src && src.type ) { 11041 this.originalEvent = src; 11042 this.type = src.type; 11043 11044 // Events bubbling up the document may have been marked as prevented 11045 // by a handler lower down the tree; reflect the correct value. 11046 this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || 11047 src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; 11048 11049 // Event type 11050 } else { 11051 this.type = src; 11052 } 11053 11054 // timeStamp is buggy for some events on Firefox(#3843) 11055 // So we won't rely on the native value 11056 this.timeStamp = jQuery.now(); 11057 11058 // Mark it as fixed 11059 this[ jQuery.expando ] = true; 11060}; 11061 11062function returnFalse() { 11063 return false;
vendor: 11,731 bytes, lines 11064-11520
11064} 11065function returnTrue() { 11066 return true; 11067} 11068 11069// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 11070// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 11071jQuery.Event.prototype = { 11072 preventDefault: function() { 11073 this.isDefaultPrevented = returnTrue; 11074 11075 var e = this.originalEvent; 11076 if ( !e ) { 11077 return; 11078 } 11079 11080 // if preventDefault exists run it on the original event 11081 if ( e.preventDefault ) { 11082 e.preventDefault(); 11083 11084 // otherwise set the returnValue property of the original event to false (IE) 11085 } else { 11086 e.returnValue = false; 11087 } 11088 }, 11089 stopPropagation: function() { 11090 this.isPropagationStopped = returnTrue; 11091 11092 var e = this.originalEvent; 11093 if ( !e ) { 11094 return; 11095 } 11096 // if stopPropagation exists run it on the original event 11097 if ( e.stopPropagation ) { 11098 e.stopPropagation(); 11099 } 11100 // otherwise set the cancelBubble property of the original event to true (IE) 11101 e.cancelBubble = true; 11102 }, 11103 stopImmediatePropagation: function() { 11104 this.isImmediatePropagationStopped = returnTrue; 11105 this.stopPropagation(); 11106 }, 11107 isDefaultPrevented: returnFalse, 11108 isPropagationStopped: returnFalse, 11109 isImmediatePropagationStopped: returnFalse 11110}; 11111 11112// Checks if an event happened on an element within another element 11113// Used in jQuery.event.special.mouseenter and mouseleave handlers 11114var withinElement = function( event ) { 11115 // Check if mouse(over|out) are still within the same parent element 11116 var parent = event.relatedTarget; 11117 11118 // Firefox sometimes assigns relatedTarget a XUL element 11119 // which we cannot access the parentNode property of 11120 try { 11121 11122 // Chrome does something similar, the parentNode property 11123 // can be accessed but is null. 11124 if ( parent && parent !== document && !parent.parentNode ) { 11125 return; 11126 } 11127 // Traverse up the tree 11128 while ( parent && parent !== this ) { 11129 parent = parent.parentNode; 11130 } 11131 11132 if ( parent !== this ) { 11133 // set the correct event type 11134 event.type = event.data; 11135 11136 // handle event if we actually just moused on to a non sub-element 11137 jQuery.event.handle.apply( this, arguments ); 11138 } 11139 11140 // assuming we've left the element since we most likely mousedover a xul element 11141 } catch(e) { } 11142}, 11143 11144// In case of event delegation, we only need to rename the event.type, 11145// liveHandler will take care of the rest. 11146delegate = function( event ) { 11147 event.type = event.data; 11148 jQuery.event.handle.apply( this, arguments ); 11149}; 11150 11151// Create mouseenter and mouseleave events 11152jQuery.each({ 11153 mouseenter: "mouseover", 11154 mouseleave: "mouseout" 11155}, function( orig, fix ) { 11156 jQuery.event.special[ orig ] = { 11157 setup: function( data ) { 11158 jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); 11159 }, 11160 teardown: function( data ) { 11161 jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); 11162 } 11163 }; 11164}); 11165 11166// submit delegation 11167if ( !jQuery.support.submitBubbles ) { 11168 11169 jQuery.event.special.submit = { 11170 setup: function( data, namespaces ) { 11171 if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) { 11172 jQuery.event.add(this, "click.specialSubmit", function( e ) { 11173 var elem = e.target, 11174 type = elem.type; 11175 11176 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { 11177 trigger( "submit", this, arguments ); 11178 } 11179 }); 11180 11181 jQuery.event.add(this, "keypress.specialSubmit", function( e ) { 11182 var elem = e.target, 11183 type = elem.type; 11184 11185 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { 11186 trigger( "submit", this, arguments ); 11187 } 11188 }); 11189 11190 } else { 11191 return false; 11192 } 11193 }, 11194 11195 teardown: function( namespaces ) { 11196 jQuery.event.remove( this, ".specialSubmit" ); 11197 } 11198 }; 11199 11200} 11201 11202// change delegation, happens here so we have bind. 11203if ( !jQuery.support.changeBubbles ) { 11204 11205 var changeFilters, 11206 11207 getVal = function( elem ) { 11208 var type = elem.type, val = elem.value; 11209 11210 if ( type === "radio" || type === "checkbox" ) { 11211 val = elem.checked; 11212 11213 } else if ( type === "select-multiple" ) { 11214 val = elem.selectedIndex > -1 ? 11215 jQuery.map( elem.options, function( elem ) { 11216 return elem.selected; 11217 }).join("-") : 11218 ""; 11219 11220 } else if ( elem.nodeName.toLowerCase() === "select" ) { 11221 val = elem.selectedIndex; 11222 } 11223 11224 return val; 11225 }, 11226 11227 testChange = function testChange( e ) { 11228 var elem = e.target, data, val; 11229 11230 if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { 11231 return; 11232 } 11233 11234 data = jQuery._data( elem, "_change_data" ); 11235 val = getVal(elem); 11236 11237 // the current data will be also retrieved by beforeactivate 11238 if ( e.type !== "focusout" || elem.type !== "radio" ) { 11239 jQuery._data( elem, "_change_data", val ); 11240 } 11241 11242 if ( data === undefined || val === data ) { 11243 return; 11244 } 11245 11246 if ( data != null || val ) { 11247 e.type = "change"; 11248 e.liveFired = undefined; 11249 jQuery.event.trigger( e, arguments[1], elem ); 11250 } 11251 }; 11252 11253 jQuery.event.special.change = { 11254 filters: { 11255 focusout: testChange, 11256 11257 beforedeactivate: testChange, 11258 11259 click: function( e ) { 11260 var elem = e.target, type = elem.type; 11261 11262 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { 11263 testChange.call( this, e ); 11264 } 11265 }, 11266 11267 // Change has to be called before submit 11268 // Keydown will be called before keypress, which is used in submit-event delegation 11269 keydown: function( e ) { 11270 var elem = e.target, type = elem.type; 11271 11272 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || 11273 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || 11274 type === "select-multiple" ) { 11275 testChange.call( this, e ); 11276 } 11277 }, 11278 11279 // Beforeactivate happens also before the previous element is blurred 11280 // with this event you can't trigger a change event, but you can store 11281 // information 11282 beforeactivate: function( e ) { 11283 var elem = e.target; 11284 jQuery._data( elem, "_change_data", getVal(elem) ); 11285 } 11286 }, 11287 11288 setup: function( data, namespaces ) { 11289 if ( this.type === "file" ) { 11290 return false; 11291 } 11292 11293 for ( var type in changeFilters ) { 11294 jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); 11295 } 11296 11297 return rformElems.test( this.nodeName ); 11298 }, 11299 11300 teardown: function( namespaces ) { 11301 jQuery.event.remove( this, ".specialChange" ); 11302 11303 return rformElems.test( this.nodeName ); 11304 } 11305 }; 11306 11307 changeFilters = jQuery.event.special.change.filters; 11308 11309 // Handle when the input is .focus()'d 11310 changeFilters.focus = changeFilters.beforeactivate; 11311} 11312 11313function trigger( type, elem, args ) { 11314 // Piggyback on a donor event to simulate a different one. 11315 // Fake originalEvent to avoid donor's stopPropagation, but if the 11316 // simulated event prevents default then we do the same on the donor. 11317 // Don't pass args or remember liveFired; they apply to the donor event. 11318 var event = jQuery.extend( {}, args[ 0 ] ); 11319 event.type = type; 11320 event.originalEvent = {}; 11321 event.liveFired = undefined; 11322 jQuery.event.handle.call( elem, event ); 11323 if ( event.isDefaultPrevented() ) { 11324 args[ 0 ].preventDefault(); 11325 } 11326} 11327 11328// Create "bubbling" focus and blur events 11329if ( document.addEventListener ) { 11330 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { 11331 11332 // Attach a single capturing handler while someone wants focusin/focusout 11333 var attaches = 0; 11334 11335 jQuery.event.special[ fix ] = { 11336 setup: function() { 11337 if ( attaches++ === 0 ) { 11338 document.addEventListener( orig, handler, true ); 11339 } 11340 }, 11341 teardown: function() { 11342 if ( --attaches === 0 ) { 11343 document.removeEventListener( orig, handler, true ); 11344 } 11345 } 11346 }; 11347 11348 function handler( donor ) { 11349 // Donor event is always a native one; fix it and switch its type. 11350 // Let focusin/out handler cancel the donor focus/blur event. 11351 var e = jQuery.event.fix( donor ); 11352 e.type = fix; 11353 e.originalEvent = {}; 11354 jQuery.event.trigger( e, null, e.target ); 11355 if ( e.isDefaultPrevented() ) { 11356 donor.preventDefault(); 11357 } 11358 } 11359 }); 11360} 11361 11362jQuery.each(["bind", "one"], function( i, name ) { 11363 jQuery.fn[ name ] = function( type, data, fn ) { 11364 // Handle object literals 11365 if ( typeof type === "object" ) { 11366 for ( var key in type ) { 11367 this[ name ](key, data, type[key], fn); 11368 } 11369 return this; 11370 } 11371 11372 if ( jQuery.isFunction( data ) || data === false ) { 11373 fn = data; 11374 data = undefined; 11375 } 11376 11377 var handler = name === "one" ? jQuery.proxy( fn, function( event ) { 11378 jQuery( this ).unbind( event, handler ); 11379 return fn.apply( this, arguments ); 11380 }) : fn; 11381 11382 if ( type === "unload" && name !== "one" ) { 11383 this.one( type, data, fn ); 11384 11385 } else { 11386 for ( var i = 0, l = this.length; i < l; i++ ) { 11387 jQuery.event.add( this[i], type, handler, data ); 11388 } 11389 } 11390 11391 return this; 11392 }; 11393}); 11394 11395jQuery.fn.extend({ 11396 unbind: function( type, fn ) { 11397 // Handle object literals 11398 if ( typeof type === "object" && !type.preventDefault ) { 11399 for ( var key in type ) { 11400 this.unbind(key, type[key]); 11401 } 11402 11403 } else { 11404 for ( var i = 0, l = this.length; i < l; i++ ) { 11405 jQuery.event.remove( this[i], type, fn ); 11406 } 11407 } 11408 11409 return this; 11410 }, 11411 11412 delegate: function( selector, types, data, fn ) { 11413 return this.live( types, data, fn, selector ); 11414 }, 11415 11416 undelegate: function( selector, types, fn ) { 11417 if ( arguments.length === 0 ) { 11418 return this.unbind( "live" ); 11419 11420 } else { 11421 return this.die( types, null, fn, selector ); 11422 } 11423 }, 11424 11425 trigger: function( type, data ) { 11426 return this.each(function() { 11427 jQuery.event.trigger( type, data, this ); 11428 }); 11429 }, 11430 11431 triggerHandler: function( type, data ) { 11432 if ( this[0] ) { 11433 var event = jQuery.Event( type ); 11434 event.preventDefault(); 11435 event.stopPropagation(); 11436 jQuery.event.trigger( event, data, this[0] ); 11437 return event.result; 11438 } 11439 }, 11440 11441 toggle: function( fn ) { 11442 // Save reference to arguments for access in closure 11443 var args = arguments, 11444 i = 1; 11445 11446 // link all the functions, so any of them can unbind this click handler 11447 while ( i < args.length ) { 11448 jQuery.proxy( fn, args[ i++ ] ); 11449 } 11450 11451 return this.click( jQuery.proxy( fn, function( event ) { 11452 // Figure out which function to execute 11453 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; 11454 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); 11455 11456 // Make sure that clicks stop 11457 event.preventDefault(); 11458 11459 // and execute the function 11460 return args[ lastToggle ].apply( this, arguments ) || false; 11461 })); 11462 }, 11463 11464 hover: function( fnOver, fnOut ) { 11465 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 11466 } 11467}); 11468 11469var liveMap = { 11470 focus: "focusin", 11471 blur: "focusout", 11472 mouseenter: "mouseover", 11473 mouseleave: "mouseout" 11474}; 11475 11476jQuery.each(["live", "die"], function( i, name ) { 11477 jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { 11478 var type, i = 0, match, namespaces, preType, 11479 selector = origSelector || this.selector, 11480 context = origSelector ? this : jQuery( this.context ); 11481 11482 if ( typeof types === "object" && !types.preventDefault ) { 11483 for ( var key in types ) { 11484 context[ name ]( key, data, types[key], selector ); 11485 } 11486 11487 return this; 11488 } 11489 11490 if ( jQuery.isFunction( data ) ) { 11491 fn = data; 11492 data = undefined; 11493 } 11494 11495 types = (types || "").split(" "); 11496 11497 while ( (type = types[ i++ ]) != null ) { 11498 match = rnamespaces.exec( type ); 11499 namespaces = ""; 11500 11501 if ( match ) { 11502 namespaces = match[0]; 11503 type = type.replace( rnamespaces, "" ); 11504 } 11505 11506 if ( type === "hover" ) { 11507 types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); 11508 continue; 11509 } 11510 11511 preType = type; 11512 11513 if ( type === "focus" || type === "blur" ) { 11514 types.push( liveMap[ type ] + namespaces ); 11515 type = type + namespaces; 11516 11517 } else { 11518 type = (liveMap[ type ] || type) + namespaces; 11519 } 11520
11521 if ( name === "live" ) { 11522 // bind live handler 11523 for ( var j = 0, l = context.length; j < l; j++ ) { 11524 jQuery.event.add( context[j], "live." + liveConvert( type, selector ), 11525 { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); 11526 } 11527 11528 } else { 11529 // unbind live handler 11530 context.unbind( "live." + liveConvert( type, selector ), fn ); 11531 } 11532 } 11533 11534 return this; 11535 }; 11536}); 11537 11538function liveHandler( event ) { 11539 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, 11540 elems = [], 11541 selectors = [], 11542 events = jQuery._data( this, "events" ); 11543 11544 // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) 11545 if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { 11546 return; 11547 } 11548 11549 if ( event.namespace ) { 11550 namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); 11551 } 11552 11553 event.liveFired = this; 11554 11555 var live = events.live.slice(0); 11556 11557 for ( j = 0; j < live.length; j++ ) { 11558 handleObj = live[j]; 11559 11560 if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { 11561 selectors.push( handleObj.selector ); 11562 11563 } else { 11564 live.splice( j--, 1 ); 11565 } 11566 } 11567 11568 match = jQuery( event.target ).closest( selectors, event.currentTarget ); 11569 11570 for ( i = 0, l = match.length; i < l; i++ ) { 11571 close = match[i]; 11572 11573 for ( j = 0; j < live.length; j++ ) { 11574 handleObj = live[j]; 11575 11576 if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { 11577 elem = close.elem; 11578 related = null; 11579 11580 // Those two events require additional checking 11581 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { 11582 event.type = handleObj.preType; 11583 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; 11584 } 11585 11586 if ( !related || related !== elem ) { 11587 elems.push({ elem: elem, handleObj: handleObj, level: close.level }); 11588 } 11589 } 11590 } 11591 } 11592 11593 for ( i = 0, l = elems.length; i < l; i++ ) { 11594 match = elems[i]; 11595 11596 if ( maxLevel && match.level > maxLevel ) { 11597 break; 11598 } 11599 11600 event.currentTarget = match.elem; 11601 event.data = match.handleObj.data; 11602 event.handleObj = match.handleObj; 11603 11604 ret = match.handleObj.origHandler.apply( match.elem, arguments ); 11605 11606 if ( ret === false || event.isPropagationStopped() ) { 11607 maxLevel = match.level; 11608 11609 if ( ret === false ) { 11610 stop = false; 11611 } 11612 if ( event.isImmediatePropagationStopped() ) { 11613 break; 11614 } 11615 } 11616 } 11617 11618 return stop; 11619} 11620 11621function liveConvert( type, selector ) { 11622 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); 11623} 11624 11625jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 11626 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 11627 "change select submit keydown keypress keyup error").split(" "), function( i, name ) { 11628 11629 // Handle event binding 11630 jQuery.fn[ name ] = function( data, fn ) { 11631 if ( fn == null ) { 11632 fn = data; 11633 data = null; 11634 } 11635 11636 return arguments.length > 0 ? 11637 this.bind( name, data, fn ) : 11638 this.trigger( name ); 11639 }; 11640 11641 if ( jQuery.attrFn ) { 11642 jQuery.attrFn[ name ] = true; 11643 } 11644}); 11645 11646 11647/*! 11648 * Sizzle CSS Selector Engine 11649 * Copyright 2011, The Dojo Foundation 11650 * Released under the MIT, BSD, and GPL Licenses. 11651 * More information: http://sizzlejs.com/ 11652 */ 11653(function(){ 11654 11655var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 11656 done = 0, 11657 toString = Object.prototype.toString, 11658 hasDuplicate = false, 11659 baseHasDuplicate = true, 11660 rBackslash = /\\/g, 11661 rNonWord = /\W/; 11662 11663// Here we check if the JavaScript engine is using some sort of 11664// optimization where it does not always call our comparision 11665// function. If that is the case, discard the hasDuplicate value. 11666// Thus far that includes Google Chrome. 11667[0, 0].sort(function() { 11668 baseHasDuplicate = false; 11669 return 0; 11670}); 11671 11672var Sizzle = function( selector, context, results, seed ) { 11673 results = results || []; 11674 context = context || document; 11675 11676 var origContext = context; 11677 11678 if ( context.nodeType !== 1 && context.nodeType !== 9 ) { 11679 return []; 11680 } 11681 11682 if ( !selector || typeof selector !== "string" ) { 11683 return results; 11684 } 11685 11686 var m, set, checkSet, extra, ret, cur, pop, i, 11687 prune = true, 11688 contextXML = Sizzle.isXML( context ), 11689 parts = [], 11690 soFar = selector; 11691 11692 // Reset the position of the chunker regexp (start from head) 11693 do { 11694 chunker.exec( "" ); 11695 m = chunker.exec( soFar ); 11696 11697 if ( m ) { 11698 soFar = m[3]; 11699 11700 parts.push( m[1] ); 11701 11702 if ( m[2] ) { 11703 extra = m[3]; 11704 break; 11705 } 11706 } 11707 } while ( m ); 11708 11709 if ( parts.length > 1 && origPOS.exec( selector ) ) { 11710 11711 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 11712 set = posProcess( parts[0] + parts[1], context ); 11713 11714 } else { 11715 set = Expr.relative[ parts[0] ] ? 11716 [ context ] : 11717 Sizzle( parts.shift(), context ); 11718 11719 while ( parts.length ) { 11720 selector = parts.shift(); 11721 11722 if ( Expr.relative[ selector ] ) { 11723 selector += parts.shift(); 11724 } 11725 11726 set = posProcess( selector, set ); 11727 } 11728 } 11729 11730 } else { 11731 // Take a shortcut and set the context if the root selector is an ID 11732 // (but not if it'll be faster if the inner selector is an ID) 11733 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 11734 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { 11735 11736 ret = Sizzle.find( parts.shift(), context, contextXML ); 11737 context = ret.expr ? 11738 Sizzle.filter( ret.expr, ret.set )[0] : 11739 ret.set[0]; 11740 } 11741 11742 if ( context ) { 11743 ret = seed ? 11744 { expr: parts.pop(), set: makeArray(seed) } : 11745 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); 11746 11747 set = ret.expr ? 11748 Sizzle.filter( ret.expr, ret.set ) : 11749 ret.set; 11750 11751 if ( parts.length > 0 ) { 11752 checkSet = makeArray( set ); 11753 11754 } else { 11755 prune = false;
vendor: 18,754 bytes, lines 11756-12611
11756 } 11757 11758 while ( parts.length ) { 11759 cur = parts.pop(); 11760 pop = cur; 11761 11762 if ( !Expr.relative[ cur ] ) { 11763 cur = ""; 11764 } else { 11765 pop = parts.pop(); 11766 } 11767 11768 if ( pop == null ) { 11769 pop = context; 11770 } 11771 11772 Expr.relative[ cur ]( checkSet, pop, contextXML ); 11773 } 11774 11775 } else { 11776 checkSet = parts = []; 11777 } 11778 } 11779 11780 if ( !checkSet ) { 11781 checkSet = set; 11782 } 11783 11784 if ( !checkSet ) { 11785 Sizzle.error( cur || selector ); 11786 } 11787 11788 if ( toString.call(checkSet) === "[object Array]" ) { 11789 if ( !prune ) { 11790 results.push.apply( results, checkSet ); 11791 11792 } else if ( context && context.nodeType === 1 ) { 11793 for ( i = 0; checkSet[i] != null; i++ ) { 11794 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { 11795 results.push( set[i] ); 11796 } 11797 } 11798 11799 } else { 11800 for ( i = 0; checkSet[i] != null; i++ ) { 11801 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 11802 results.push( set[i] ); 11803 } 11804 } 11805 } 11806 11807 } else { 11808 makeArray( checkSet, results ); 11809 } 11810 11811 if ( extra ) { 11812 Sizzle( extra, origContext, results, seed ); 11813 Sizzle.uniqueSort( results ); 11814 } 11815 11816 return results; 11817}; 11818 11819Sizzle.uniqueSort = function( results ) { 11820 if ( sortOrder ) { 11821 hasDuplicate = baseHasDuplicate; 11822 results.sort( sortOrder ); 11823 11824 if ( hasDuplicate ) { 11825 for ( var i = 1; i < results.length; i++ ) { 11826 if ( results[i] === results[ i - 1 ] ) { 11827 results.splice( i--, 1 ); 11828 } 11829 } 11830 } 11831 } 11832 11833 return results; 11834}; 11835 11836Sizzle.matches = function( expr, set ) { 11837 return Sizzle( expr, null, null, set ); 11838}; 11839 11840Sizzle.matchesSelector = function( node, expr ) { 11841 return Sizzle( expr, null, null, [node] ).length > 0; 11842}; 11843 11844Sizzle.find = function( expr, context, isXML ) { 11845 var set; 11846 11847 if ( !expr ) { 11848 return []; 11849 } 11850 11851 for ( var i = 0, l = Expr.order.length; i < l; i++ ) { 11852 var match, 11853 type = Expr.order[i]; 11854 11855 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { 11856 var left = match[1]; 11857 match.splice( 1, 1 ); 11858 11859 if ( left.substr( left.length - 1 ) !== "\\" ) { 11860 match[1] = (match[1] || "").replace( rBackslash, "" ); 11861 set = Expr.find[ type ]( match, context, isXML ); 11862 11863 if ( set != null ) { 11864 expr = expr.replace( Expr.match[ type ], "" ); 11865 break; 11866 } 11867 } 11868 } 11869 } 11870 11871 if ( !set ) { 11872 set = typeof context.getElementsByTagName !== "undefined" ? 11873 context.getElementsByTagName( "*" ) : 11874 []; 11875 } 11876 11877 return { set: set, expr: expr }; 11878}; 11879 11880Sizzle.filter = function( expr, set, inplace, not ) { 11881 var match, anyFound, 11882 old = expr, 11883 result = [], 11884 curLoop = set, 11885 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); 11886 11887 while ( expr && set.length ) { 11888 for ( var type in Expr.filter ) { 11889 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { 11890 var found, item, 11891 filter = Expr.filter[ type ], 11892 left = match[1]; 11893 11894 anyFound = false; 11895 11896 match.splice(1,1); 11897 11898 if ( left.substr( left.length - 1 ) === "\\" ) { 11899 continue; 11900 } 11901 11902 if ( curLoop === result ) { 11903 result = []; 11904 } 11905 11906 if ( Expr.preFilter[ type ] ) { 11907 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); 11908 11909 if ( !match ) { 11910 anyFound = found = true; 11911 11912 } else if ( match === true ) { 11913 continue; 11914 } 11915 } 11916 11917 if ( match ) { 11918 for ( var i = 0; (item = curLoop[i]) != null; i++ ) { 11919 if ( item ) { 11920 found = filter( item, match, i, curLoop ); 11921 var pass = not ^ !!found; 11922 11923 if ( inplace && found != null ) { 11924 if ( pass ) { 11925 anyFound = true; 11926 11927 } else { 11928 curLoop[i] = false; 11929 } 11930 11931 } else if ( pass ) { 11932 result.push( item ); 11933 anyFound = true; 11934 } 11935 } 11936 } 11937 } 11938 11939 if ( found !== undefined ) { 11940 if ( !inplace ) { 11941 curLoop = result; 11942 } 11943 11944 expr = expr.replace( Expr.match[ type ], "" ); 11945 11946 if ( !anyFound ) { 11947 return []; 11948 } 11949 11950 break; 11951 } 11952 } 11953 } 11954 11955 // Improper expression 11956 if ( expr === old ) { 11957 if ( anyFound == null ) { 11958 Sizzle.error( expr ); 11959 11960 } else { 11961 break; 11962 } 11963 } 11964 11965 old = expr; 11966 } 11967 11968 return curLoop; 11969}; 11970 11971Sizzle.error = function( msg ) { 11972 throw "Syntax error, unrecognized expression: " + msg; 11973}; 11974 11975var Expr = Sizzle.selectors = { 11976 order: [ "ID", "NAME", "TAG" ], 11977 11978 match: { 11979 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 11980 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 11981 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, 11982 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, 11983 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, 11984 CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, 11985 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, 11986 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ 11987 }, 11988 11989 leftMatch: {}, 11990 11991 attrMap: { 11992 "class": "className", 11993 "for": "htmlFor" 11994 }, 11995 11996 attrHandle: { 11997 href: function( elem ) { 11998 return elem.getAttribute( "href" ); 11999 }, 12000 type: function( elem ) { 12001 return elem.getAttribute( "type" ); 12002 } 12003 }, 12004 12005 relative: { 12006 "+": function(checkSet, part){ 12007 var isPartStr = typeof part === "string", 12008 isTag = isPartStr && !rNonWord.test( part ), 12009 isPartStrNotTag = isPartStr && !isTag; 12010 12011 if ( isTag ) { 12012 part = part.toLowerCase(); 12013 } 12014 12015 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { 12016 if ( (elem = checkSet[i]) ) { 12017 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} 12018 12019 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? 12020 elem || false : 12021 elem === part; 12022 } 12023 } 12024 12025 if ( isPartStrNotTag ) { 12026 Sizzle.filter( part, checkSet, true ); 12027 } 12028 }, 12029 12030 ">": function( checkSet, part ) { 12031 var elem, 12032 isPartStr = typeof part === "string", 12033 i = 0, 12034 l = checkSet.length; 12035 12036 if ( isPartStr && !rNonWord.test( part ) ) { 12037 part = part.toLowerCase(); 12038 12039 for ( ; i < l; i++ ) { 12040 elem = checkSet[i]; 12041 12042 if ( elem ) { 12043 var parent = elem.parentNode; 12044 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; 12045 } 12046 } 12047 12048 } else { 12049 for ( ; i < l; i++ ) { 12050 elem = checkSet[i]; 12051 12052 if ( elem ) { 12053 checkSet[i] = isPartStr ? 12054 elem.parentNode : 12055 elem.parentNode === part; 12056 } 12057 } 12058 12059 if ( isPartStr ) { 12060 Sizzle.filter( part, checkSet, true ); 12061 } 12062 } 12063 }, 12064 12065 "": function(checkSet, part, isXML){ 12066 var nodeCheck, 12067 doneName = done++, 12068 checkFn = dirCheck; 12069 12070 if ( typeof part === "string" && !rNonWord.test( part ) ) { 12071 part = part.toLowerCase(); 12072 nodeCheck = part; 12073 checkFn = dirNodeCheck; 12074 } 12075 12076 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); 12077 }, 12078 12079 "~": function( checkSet, part, isXML ) { 12080 var nodeCheck, 12081 doneName = done++, 12082 checkFn = dirCheck; 12083 12084 if ( typeof part === "string" && !rNonWord.test( part ) ) { 12085 part = part.toLowerCase(); 12086 nodeCheck = part; 12087 checkFn = dirNodeCheck; 12088 } 12089 12090 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); 12091 } 12092 }, 12093 12094 find: { 12095 ID: function( match, context, isXML ) { 12096 if ( typeof context.getElementById !== "undefined" && !isXML ) { 12097 var m = context.getElementById(match[1]); 12098 // Check parentNode to catch when Blackberry 4.6 returns 12099 // nodes that are no longer in the document #6963 12100 return m && m.parentNode ? [m] : []; 12101 } 12102 }, 12103 12104 NAME: function( match, context ) { 12105 if ( typeof context.getElementsByName !== "undefined" ) { 12106 var ret = [], 12107 results = context.getElementsByName( match[1] ); 12108 12109 for ( var i = 0, l = results.length; i < l; i++ ) { 12110 if ( results[i].getAttribute("name") === match[1] ) { 12111 ret.push( results[i] ); 12112 } 12113 } 12114 12115 return ret.length === 0 ? null : ret; 12116 } 12117 }, 12118 12119 TAG: function( match, context ) { 12120 if ( typeof context.getElementsByTagName !== "undefined" ) { 12121 return context.getElementsByTagName( match[1] ); 12122 } 12123 } 12124 }, 12125 preFilter: { 12126 CLASS: function( match, curLoop, inplace, result, not, isXML ) { 12127 match = " " + match[1].replace( rBackslash, "" ) + " "; 12128 12129 if ( isXML ) { 12130 return match; 12131 } 12132 12133 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { 12134 if ( elem ) { 12135 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { 12136 if ( !inplace ) { 12137 result.push( elem ); 12138 } 12139 12140 } else if ( inplace ) { 12141 curLoop[i] = false; 12142 } 12143 } 12144 } 12145 12146 return false; 12147 }, 12148 12149 ID: function( match ) { 12150 return match[1].replace( rBackslash, "" ); 12151 }, 12152 12153 TAG: function( match, curLoop ) { 12154 return match[1].replace( rBackslash, "" ).toLowerCase(); 12155 }, 12156 12157 CHILD: function( match ) { 12158 if ( match[1] === "nth" ) { 12159 if ( !match[2] ) { 12160 Sizzle.error( match[0] ); 12161 } 12162 12163 match[2] = match[2].replace(/^\+|\s*/g, ''); 12164 12165 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 12166 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( 12167 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || 12168 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 12169 12170 // calculate the numbers (first)n+(last) including if they are negative 12171 match[2] = (test[1] + (test[2] || 1)) - 0; 12172 match[3] = test[3] - 0; 12173 } 12174 else if ( match[2] ) { 12175 Sizzle.error( match[0] ); 12176 } 12177 12178 // TODO: Move to normal caching system 12179 match[0] = done++; 12180 12181 return match; 12182 }, 12183 12184 ATTR: function( match, curLoop, inplace, result, not, isXML ) { 12185 var name = match[1] = match[1].replace( rBackslash, "" ); 12186 12187 if ( !isXML && Expr.attrMap[name] ) { 12188 match[1] = Expr.attrMap[name]; 12189 } 12190 12191 // Handle if an un-quoted value was used 12192 match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); 12193 12194 if ( match[2] === "~=" ) { 12195 match[4] = " " + match[4] + " "; 12196 } 12197 12198 return match; 12199 }, 12200 12201 PSEUDO: function( match, curLoop, inplace, result, not ) { 12202 if ( match[1] === "not" ) { 12203 // If we're dealing with a complex expression, or a simple one 12204 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { 12205 match[3] = Sizzle(match[3], null, null, curLoop); 12206 12207 } else { 12208 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 12209 12210 if ( !inplace ) { 12211 result.push.apply( result, ret ); 12212 } 12213 12214 return false; 12215 } 12216 12217 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { 12218 return true; 12219 } 12220 12221 return match; 12222 }, 12223 12224 POS: function( match ) { 12225 match.unshift( true ); 12226 12227 return match; 12228 } 12229 }, 12230 12231 filters: { 12232 enabled: function( elem ) { 12233 return elem.disabled === false && elem.type !== "hidden"; 12234 }, 12235 12236 disabled: function( elem ) { 12237 return elem.disabled === true; 12238 }, 12239 12240 checked: function( elem ) { 12241 return elem.checked === true; 12242 }, 12243 12244 selected: function( elem ) { 12245 // Accessing this property makes selected-by-default 12246 // options in Safari work properly 12247 if ( elem.parentNode ) { 12248 elem.parentNode.selectedIndex; 12249 } 12250 12251 return elem.selected === true; 12252 }, 12253 12254 parent: function( elem ) { 12255 return !!elem.firstChild; 12256 }, 12257 12258 empty: function( elem ) { 12259 return !elem.firstChild; 12260 }, 12261 12262 has: function( elem, i, match ) { 12263 return !!Sizzle( match[3], elem ).length; 12264 }, 12265 12266 header: function( elem ) { 12267 return (/h\d/i).test( elem.nodeName ); 12268 }, 12269 12270 text: function( elem ) { 12271 var attr = elem.getAttribute( "type" ), type = elem.type; 12272 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 12273 // use getAttribute instead to test this case 12274 return "text" === type && ( attr === type || attr === null ); 12275 }, 12276 12277 radio: function( elem ) { 12278 return "radio" === elem.type; 12279 }, 12280 12281 checkbox: function( elem ) { 12282 return "checkbox" === elem.type; 12283 }, 12284 12285 file: function( elem ) { 12286 return "file" === elem.type; 12287 }, 12288 password: function( elem ) { 12289 return "password" === elem.type; 12290 }, 12291 12292 submit: function( elem ) { 12293 return "submit" === elem.type; 12294 }, 12295 12296 image: function( elem ) { 12297 return "image" === elem.type; 12298 }, 12299 12300 reset: function( elem ) { 12301 return "reset" === elem.type; 12302 }, 12303 12304 button: function( elem ) { 12305 return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; 12306 }, 12307 12308 input: function( elem ) { 12309 return (/input|select|textarea|button/i).test( elem.nodeName ); 12310 } 12311 }, 12312 setFilters: { 12313 first: function( elem, i ) { 12314 return i === 0; 12315 }, 12316 12317 last: function( elem, i, match, array ) { 12318 return i === array.length - 1; 12319 }, 12320 12321 even: function( elem, i ) { 12322 return i % 2 === 0; 12323 }, 12324 12325 odd: function( elem, i ) { 12326 return i % 2 === 1; 12327 }, 12328 12329 lt: function( elem, i, match ) { 12330 return i < match[3] - 0; 12331 }, 12332 12333 gt: function( elem, i, match ) { 12334 return i > match[3] - 0; 12335 }, 12336 12337 nth: function( elem, i, match ) { 12338 return match[3] - 0 === i; 12339 }, 12340 12341 eq: function( elem, i, match ) { 12342 return match[3] - 0 === i; 12343 } 12344 }, 12345 filter: { 12346 PSEUDO: function( elem, match, i, array ) { 12347 var name = match[1], 12348 filter = Expr.filters[ name ]; 12349 12350 if ( filter ) { 12351 return filter( elem, i, match, array ); 12352 12353 } else if ( name === "contains" ) { 12354 return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; 12355 12356 } else if ( name === "not" ) { 12357 var not = match[3]; 12358 12359 for ( var j = 0, l = not.length; j < l; j++ ) { 12360 if ( not[j] === elem ) { 12361 return false; 12362 } 12363 } 12364 12365 return true; 12366 12367 } else { 12368 Sizzle.error( name ); 12369 } 12370 }, 12371 12372 CHILD: function( elem, match ) { 12373 var type = match[1], 12374 node = elem; 12375 12376 switch ( type ) { 12377 case "only": 12378 case "first": 12379 while ( (node = node.previousSibling) ) { 12380 if ( node.nodeType === 1 ) { 12381 return false; 12382 } 12383 } 12384 12385 if ( type === "first" ) { 12386 return true; 12387 } 12388 12389 node = elem; 12390 12391 case "last": 12392 while ( (node = node.nextSibling) ) { 12393 if ( node.nodeType === 1 ) { 12394 return false; 12395 } 12396 } 12397 12398 return true; 12399 12400 case "nth": 12401 var first = match[2], 12402 last = match[3]; 12403 12404 if ( first === 1 && last === 0 ) { 12405 return true; 12406 } 12407 12408 var doneName = match[0], 12409 parent = elem.parentNode; 12410 12411 if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { 12412 var count = 0; 12413 12414 for ( node = parent.firstChild; node; node = node.nextSibling ) { 12415 if ( node.nodeType === 1 ) { 12416 node.nodeIndex = ++count; 12417 } 12418 } 12419 12420 parent.sizcache = doneName; 12421 } 12422 12423 var diff = elem.nodeIndex - last; 12424 12425 if ( first === 0 ) { 12426 return diff === 0; 12427 12428 } else { 12429 return ( diff % first === 0 && diff / first >= 0 ); 12430 } 12431 } 12432 }, 12433 12434 ID: function( elem, match ) { 12435 return elem.nodeType === 1 && elem.getAttribute("id") === match; 12436 }, 12437 12438 TAG: function( elem, match ) { 12439 return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; 12440 }, 12441 12442 CLASS: function( elem, match ) { 12443 return (" " + (elem.className || elem.getAttribute("class")) + " ") 12444 .indexOf( match ) > -1; 12445 }, 12446 12447 ATTR: function( elem, match ) { 12448 var name = match[1], 12449 result = Expr.attrHandle[ name ] ? 12450 Expr.attrHandle[ name ]( elem ) : 12451 elem[ name ] != null ? 12452 elem[ name ] : 12453 elem.getAttribute( name ), 12454 value = result + "", 12455 type = match[2], 12456 check = match[4]; 12457 12458 return result == null ? 12459 type === "!=" : 12460 type === "=" ? 12461 value === check : 12462 type === "*=" ? 12463 value.indexOf(check) >= 0 : 12464 type === "~=" ? 12465 (" " + value + " ").indexOf(check) >= 0 : 12466 !check ? 12467 value && result !== false : 12468 type === "!=" ? 12469 value !== check : 12470 type === "^=" ? 12471 value.indexOf(check) === 0 : 12472 type === "$=" ? 12473 value.substr(value.length - check.length) === check : 12474 type === "|=" ? 12475 value === check || value.substr(0, check.length + 1) === check + "-" : 12476 false; 12477 }, 12478 12479 POS: function( elem, match, i, array ) { 12480 var name = match[2], 12481 filter = Expr.setFilters[ name ]; 12482 12483 if ( filter ) { 12484 return filter( elem, i, match, array ); 12485 } 12486 } 12487 } 12488}; 12489 12490var origPOS = Expr.match.POS, 12491 fescape = function(all, num){ 12492 return "\\" + (num - 0 + 1); 12493 }; 12494 12495for ( var type in Expr.match ) { 12496 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); 12497 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); 12498} 12499 12500var makeArray = function( array, results ) { 12501 array = Array.prototype.slice.call( array, 0 ); 12502 12503 if ( results ) { 12504 results.push.apply( results, array ); 12505 return results; 12506 } 12507 12508 return array; 12509}; 12510 12511// Perform a simple check to determine if the browser is capable of 12512// converting a NodeList to an array using builtin methods. 12513// Also verifies that the returned array holds DOM nodes 12514// (which is not the case in the Blackberry browser) 12515try { 12516 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; 12517 12518// Provide a fallback method if it does not work 12519} catch( e ) { 12520 makeArray = function( array, results ) { 12521 var i = 0, 12522 ret = results || []; 12523 12524 if ( toString.call(array) === "[object Array]" ) { 12525 Array.prototype.push.apply( ret, array ); 12526 12527 } else { 12528 if ( typeof array.length === "number" ) { 12529 for ( var l = array.length; i < l; i++ ) { 12530 ret.push( array[i] ); 12531 } 12532 12533 } else { 12534 for ( ; array[i]; i++ ) { 12535 ret.push( array[i] ); 12536 } 12537 } 12538 } 12539 12540 return ret; 12541 }; 12542} 12543 12544var sortOrder, siblingCheck; 12545 12546if ( document.documentElement.compareDocumentPosition ) { 12547 sortOrder = function( a, b ) { 12548 if ( a === b ) { 12549 hasDuplicate = true; 12550 return 0; 12551 } 12552 12553 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { 12554 return a.compareDocumentPosition ? -1 : 1; 12555 } 12556 12557 return a.compareDocumentPosition(b) & 4 ? -1 : 1; 12558 }; 12559 12560} else { 12561 sortOrder = function( a, b ) { 12562 var al, bl, 12563 ap = [], 12564 bp = [], 12565 aup = a.parentNode, 12566 bup = b.parentNode, 12567 cur = aup; 12568 12569 // The nodes are identical, we can exit early 12570 if ( a === b ) { 12571 hasDuplicate = true; 12572 return 0; 12573 12574 // If the nodes are siblings (or identical) we can do a quick check 12575 } else if ( aup === bup ) { 12576 return siblingCheck( a, b ); 12577 12578 // If no parents were found then the nodes are disconnected 12579 } else if ( !aup ) { 12580 return -1; 12581 12582 } else if ( !bup ) { 12583 return 1; 12584 } 12585 12586 // Otherwise they're somewhere else in the tree so we need 12587 // to build up a full list of the parentNodes for comparison 12588 while ( cur ) { 12589 ap.unshift( cur ); 12590 cur = cur.parentNode; 12591 } 12592 12593 cur = bup; 12594 12595 while ( cur ) { 12596 bp.unshift( cur ); 12597 cur = cur.parentNode; 12598 } 12599 12600 al = ap.length; 12601 bl = bp.length; 12602 12603 // Start walking down the tree looking for a discrepancy 12604 for ( var i = 0; i < al && i < bl; i++ ) { 12605 if ( ap[i] !== bp[i] ) { 12606 return siblingCheck( ap[i], bp[i] ); 12607 } 12608 } 12609 12610 // We ended someplace up the tree so do a sibling check 12611 return i === al ?
12612 siblingCheck( a, bp[i], -1 ) : 12613 siblingCheck( ap[i], b, 1 ); 12614 }; 12615 12616 siblingCheck = function( a, b, ret ) { 12617 if ( a === b ) { 12618 return ret; 12619 } 12620 12621 var cur = a.nextSibling; 12622 12623 while ( cur ) { 12624 if ( cur === b ) { 12625 return -1; 12626 } 12627 12628 cur = cur.nextSibling; 12629 } 12630 12631 return 1; 12632 }; 12633} 12634 12635// Utility function for retreiving the text value of an array of DOM nodes 12636Sizzle.getText = function( elems ) { 12637 var ret = "", elem; 12638 12639 for ( var i = 0; elems[i]; i++ ) { 12640 elem = elems[i]; 12641 12642 // Get the text from text nodes and CDATA nodes 12643 if ( elem.nodeType === 3 || elem.nodeType === 4 ) { 12644 ret += elem.nodeValue; 12645 12646 // Traverse everything else, except comment nodes 12647 } else if ( elem.nodeType !== 8 ) { 12648 ret += Sizzle.getText( elem.childNodes ); 12649 } 12650 } 12651 12652 return ret; 12653}; 12654 12655// Check to see if the browser returns elements by name when 12656// querying by getElementById (and provide a workaround) 12657(function(){ 12658 // We're going to inject a fake input element with a specified name 12659 var form = document.createElement("div"), 12660 id = "script" + (new Date()).getTime(), 12661 root = document.documentElement; 12662 12663 form.innerHTML = "<a name='" + id + "'/>"; 12664 12665 // Inject it into the root element, check its status, and remove it quickly 12666 root.insertBefore( form, root.firstChild ); 12667 12668 // The workaround has to do additional checks after a getElementById 12669 // Which slows things down for other browsers (hence the branching) 12670 if ( document.getElementById( id ) ) { 12671 Expr.find.ID = function( match, context, isXML ) { 12672 if ( typeof context.getElementById !== "undefined" && !isXML ) { 12673 var m = context.getElementById(match[1]); 12674 12675 return m ? 12676 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? 12677 [m] : 12678 undefined : 12679 []; 12680 } 12681 }; 12682 12683 Expr.filter.ID = function( elem, match ) { 12684 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 12685 12686 return elem.nodeType === 1 && node && node.nodeValue === match; 12687 }; 12688 } 12689 12690 root.removeChild( form ); 12691 12692 // release memory in IE 12693 root = form = null; 12694})(); 12695 12696(function(){ 12697 // Check to see if the browser returns only elements 12698 // when doing getElementsByTagName("*") 12699 12700 // Create a fake element 12701 var div = document.createElement("div"); 12702 div.appendChild( document.createComment("") ); 12703 12704 // Make sure no comments are found 12705 if ( div.getElementsByTagName("*").length > 0 ) { 12706 Expr.find.TAG = function( match, context ) { 12707 var results = context.getElementsByTagName( match[1] ); 12708 12709 // Filter out possible comments 12710 if ( match[1] === "*" ) { 12711 var tmp = []; 12712 12713 for ( var i = 0; results[i]; i++ ) { 12714 if ( results[i].nodeType === 1 ) { 12715 tmp.push( results[i] ); 12716 } 12717 } 12718 12719 results = tmp; 12720 } 12721 12722 return results; 12723 }; 12724 } 12725 12726 // Check to see if an attribute returns normalized href attributes 12727 div.innerHTML = "<a href='#'></a>"; 12728 12729 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && 12730 div.firstChild.getAttribute("href") !== "#" ) { 12731 12732 Expr.attrHandle.href = function( elem ) { 12733 return elem.getAttribute( "href", 2 ); 12734 }; 12735 } 12736 12737 // release memory in IE 12738 div = null; 12739})(); 12740 12741if ( document.querySelectorAll ) { 12742 (function(){ 12743 var oldSizzle = Sizzle, 12744 div = document.createElement("div"), 12745 id = "__sizzle__"; 12746 12747 div.innerHTML = "<p class='TEST'></p>"; 12748 12749 // Safari can't handle uppercase or unicode characters when 12750 // in quirks mode. 12751 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { 12752 return; 12753 } 12754 12755 Sizzle = function( query, context, extra, seed ) { 12756 context = context || document; 12757 12758 // Only use querySelectorAll on non-XML documents 12759 // (ID selectors don't work in non-HTML documents) 12760 if ( !seed && !Sizzle.isXML(context) ) { 12761 // See if we find a selector to speed up 12762 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); 12763 12764 if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { 12765 // Speed-up: Sizzle("TAG") 12766 if ( match[1] ) { 12767 return makeArray( context.getElementsByTagName( query ), extra ); 12768 12769 // Speed-up: Sizzle(".CLASS") 12770 } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { 12771 return makeArray( context.getElementsByClassName( match[2] ), extra ); 12772 } 12773 } 12774 12775 if ( context.nodeType === 9 ) { 12776 // Speed-up: Sizzle("body") 12777 // The body element only exists once, optimize finding it 12778 if ( query === "body" && context.body ) { 12779 return makeArray( [ context.body ], extra ); 12780 12781 // Speed-up: Sizzle("#ID") 12782 } else if ( match && match[3] ) { 12783 var elem = context.getElementById( match[3] ); 12784 12785 // Check parentNode to catch when Blackberry 4.6 returns 12786 // nodes that are no longer in the document #6963 12787 if ( elem && elem.parentNode ) { 12788 // Handle the case where IE and Opera return items 12789 // by name instead of ID 12790 if ( elem.id === match[3] ) { 12791 return makeArray( [ elem ], extra ); 12792 } 12793 12794 } else { 12795 return makeArray( [], extra ); 12796 } 12797 } 12798 12799 try { 12800 return makeArray( context.querySelectorAll(query), extra ); 12801 } catch(qsaError) {} 12802 12803 // qSA works strangely on Element-rooted queries 12804 // We can work around this by specifying an extra ID on the root 12805 // and working up from there (Thanks to Andrew Dupont for the technique) 12806 // IE 8 doesn't work on object elements 12807 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { 12808 var oldContext = context, 12809 old = context.getAttribute( "id" ), 12810 nid = old || id, 12811 hasParent = context.parentNode, 12812 relativeHierarchySelector = /^\s*[+~]/.test( query ); 12813 12814 if ( !old ) { 12815 context.setAttribute( "id", nid ); 12816 } else { 12817 nid = nid.replace( /'/g, "\\$&" ); 12818 } 12819 if ( relativeHierarchySelector && hasParent ) { 12820 context = context.parentNode; 12821 } 12822 12823 try { 12824 if ( !relativeHierarchySelector || hasParent ) { 12825 return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); 12826 } 12827 12828 } catch(pseudoError) { 12829 } finally { 12830 if ( !old ) { 12831 oldContext.removeAttribute( "id" ); 12832 } 12833 } 12834 } 12835 } 12836 12837 return oldSizzle(query, context, extra, seed); 12838 }; 12839 12840 for ( var prop in oldSizzle ) { 12841 Sizzle[ prop ] = oldSizzle[ prop ]; 12842 } 12843 12844 // release memory in IE 12845 div = null; 12846 })(); 12847} 12848 12849(function(){ 12850 var html = document.documentElement, 12851 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; 12852 12853 if ( matches ) { 12854 // Check to see if it's possible to do matchesSelector 12855 // on a disconnected node (IE 9 fails this) 12856 var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), 12857 pseudoWorks = false;
vendor: 5,897 bytes, lines 12858-13110
12858 12859 try { 12860 // This should fail with an exception 12861 // Gecko does not error, returns false instead 12862 matches.call( document.documentElement, "[test!='']:sizzle" ); 12863 12864 } catch( pseudoError ) { 12865 pseudoWorks = true; 12866 } 12867 12868 Sizzle.matchesSelector = function( node, expr ) { 12869 // Make sure that attribute selectors are quoted 12870 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); 12871 12872 if ( !Sizzle.isXML( node ) ) { 12873 try { 12874 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { 12875 var ret = matches.call( node, expr ); 12876 12877 // IE 9's matchesSelector returns false on disconnected nodes 12878 if ( ret || !disconnectedMatch || 12879 // As well, disconnected nodes are said to be in a document 12880 // fragment in IE 9, so check for that 12881 node.document && node.document.nodeType !== 11 ) { 12882 return ret; 12883 } 12884 } 12885 } catch(e) {} 12886 } 12887 12888 return Sizzle(expr, null, null, [node]).length > 0; 12889 }; 12890 } 12891})(); 12892 12893(function(){ 12894 var div = document.createElement("div"); 12895 12896 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 12897 12898 // Opera can't find a second classname (in 9.6) 12899 // Also, make sure that getElementsByClassName actually exists 12900 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { 12901 return; 12902 } 12903 12904 // Safari caches class attributes, doesn't catch changes (in 3.2) 12905 div.lastChild.className = "e"; 12906 12907 if ( div.getElementsByClassName("e").length === 1 ) { 12908 return; 12909 } 12910 12911 Expr.order.splice(1, 0, "CLASS"); 12912 Expr.find.CLASS = function( match, context, isXML ) { 12913 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { 12914 return context.getElementsByClassName(match[1]); 12915 } 12916 }; 12917 12918 // release memory in IE 12919 div = null; 12920})(); 12921 12922function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 12923 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 12924 var elem = checkSet[i]; 12925 12926 if ( elem ) { 12927 var match = false; 12928 12929 elem = elem[dir]; 12930 12931 while ( elem ) { 12932 if ( elem.sizcache === doneName ) { 12933 match = checkSet[elem.sizset]; 12934 break; 12935 } 12936 12937 if ( elem.nodeType === 1 && !isXML ){ 12938 elem.sizcache = doneName; 12939 elem.sizset = i; 12940 } 12941 12942 if ( elem.nodeName.toLowerCase() === cur ) { 12943 match = elem; 12944 break; 12945 } 12946 12947 elem = elem[dir]; 12948 } 12949 12950 checkSet[i] = match; 12951 } 12952 } 12953} 12954 12955function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 12956 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 12957 var elem = checkSet[i]; 12958 12959 if ( elem ) { 12960 var match = false; 12961 12962 elem = elem[dir]; 12963 12964 while ( elem ) { 12965 if ( elem.sizcache === doneName ) { 12966 match = checkSet[elem.sizset]; 12967 break; 12968 } 12969 12970 if ( elem.nodeType === 1 ) { 12971 if ( !isXML ) { 12972 elem.sizcache = doneName; 12973 elem.sizset = i; 12974 } 12975 12976 if ( typeof cur !== "string" ) { 12977 if ( elem === cur ) { 12978 match = true; 12979 break; 12980 } 12981 12982 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { 12983 match = elem; 12984 break; 12985 } 12986 } 12987 12988 elem = elem[dir]; 12989 } 12990 12991 checkSet[i] = match; 12992 } 12993 } 12994} 12995 12996if ( document.documentElement.contains ) { 12997 Sizzle.contains = function( a, b ) { 12998 return a !== b && (a.contains ? a.contains(b) : true); 12999 }; 13000 13001} else if ( document.documentElement.compareDocumentPosition ) { 13002 Sizzle.contains = function( a, b ) { 13003 return !!(a.compareDocumentPosition(b) & 16); 13004 }; 13005 13006} else { 13007 Sizzle.contains = function() { 13008 return false; 13009 }; 13010} 13011 13012Sizzle.isXML = function( elem ) { 13013 // documentElement is verified for cases where it doesn't yet exist 13014 // (such as loading iframes in IE - #4833) 13015 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; 13016 13017 return documentElement ? documentElement.nodeName !== "HTML" : false; 13018}; 13019 13020var posProcess = function( selector, context ) { 13021 var match, 13022 tmpSet = [], 13023 later = "", 13024 root = context.nodeType ? [context] : context; 13025 13026 // Position selectors must be done after the filter 13027 // And so must :not(positional) so we move all PSEUDOs to the end 13028 while ( (match = Expr.match.PSEUDO.exec( selector )) ) { 13029 later += match[0]; 13030 selector = selector.replace( Expr.match.PSEUDO, "" ); 13031 } 13032 13033 selector = Expr.relative[selector] ? selector + "*" : selector; 13034 13035 for ( var i = 0, l = root.length; i < l; i++ ) { 13036 Sizzle( selector, root[i], tmpSet ); 13037 } 13038 13039 return Sizzle.filter( later, tmpSet ); 13040}; 13041 13042// EXPOSE 13043jQuery.find = Sizzle; 13044jQuery.expr = Sizzle.selectors; 13045jQuery.expr[":"] = jQuery.expr.filters; 13046jQuery.unique = Sizzle.uniqueSort; 13047jQuery.text = Sizzle.getText; 13048jQuery.isXMLDoc = Sizzle.isXML; 13049jQuery.contains = Sizzle.contains; 13050 13051 13052})(); 13053 13054 13055var runtil = /Until$/, 13056 rparentsprev = /^(?:parents|prevUntil|prevAll)/, 13057 // Note: This RegExp should be improved, or likely pulled from Sizzle 13058 rmultiselector = /,/, 13059 isSimple = /^.[^:#\[\.,]*$/, 13060 slice = Array.prototype.slice, 13061 POS = jQuery.expr.match.POS, 13062 // methods guaranteed to produce a unique set when starting from a unique set 13063 guaranteedUnique = { 13064 children: true, 13065 contents: true, 13066 next: true, 13067 prev: true 13068 }; 13069 13070jQuery.fn.extend({ 13071 find: function( selector ) { 13072 var ret = this.pushStack( "", "find", selector ), 13073 length = 0; 13074 13075 for ( var i = 0, l = this.length; i < l; i++ ) { 13076 length = ret.length; 13077 jQuery.find( selector, this[i], ret ); 13078 13079 if ( i > 0 ) { 13080 // Make sure that the results are unique 13081 for ( var n = length; n < ret.length; n++ ) { 13082 for ( var r = 0; r < length; r++ ) { 13083 if ( ret[r] === ret[n] ) { 13084 ret.splice(n--, 1); 13085 break; 13086 } 13087 } 13088 } 13089 } 13090 } 13091 13092 return ret; 13093 }, 13094 13095 has: function( target ) { 13096 var targets = jQuery( target ); 13097 return this.filter(function() { 13098 for ( var i = 0, l = targets.length; i < l; i++ ) { 13099 if ( jQuery.contains( this, targets[i] ) ) { 13100 return true; 13101 } 13102 } 13103 }); 13104 }, 13105 13106 not: function( selector ) { 13107 return this.pushStack( winnow(this, selector, false), "not", selector); 13108 }, 13109 13110 filter: function( selector ) {
13111 return this.pushStack( winnow(this, selector, true), "filter", selector ); 13112 }, 13113 13114 is: function( selector ) { 13115 return !!selector && jQuery.filter( selector, this ).length > 0; 13116 }, 13117 13118 closest: function( selectors, context ) { 13119 var ret = [], i, l, cur = this[0]; 13120 13121 if ( jQuery.isArray( selectors ) ) { 13122 var match, selector, 13123 matches = {}, 13124 level = 1; 13125 13126 if ( cur && selectors.length ) { 13127 for ( i = 0, l = selectors.length; i < l; i++ ) { 13128 selector = selectors[i]; 13129 13130 if ( !matches[selector] ) { 13131 matches[selector] = jQuery.expr.match.POS.test( selector ) ? 13132 jQuery( selector, context || this.context ) : 13133 selector; 13134 } 13135 } 13136 13137 while ( cur && cur.ownerDocument && cur !== context ) { 13138 for ( selector in matches ) { 13139 match = matches[selector]; 13140 13141 if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { 13142 ret.push({ selector: selector, elem: cur, level: level }); 13143 } 13144 } 13145 13146 cur = cur.parentNode; 13147 level++; 13148 } 13149 } 13150 13151 return ret; 13152 } 13153 13154 var pos = POS.test( selectors ) ? 13155 jQuery( selectors, context || this.context ) : null; 13156 13157 for ( i = 0, l = this.length; i < l; i++ ) { 13158 cur = this[i]; 13159 13160 while ( cur ) { 13161 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { 13162 ret.push( cur ); 13163 break; 13164 13165 } else { 13166 cur = cur.parentNode; 13167 if ( !cur || !cur.ownerDocument || cur === context ) { 13168 break; 13169 } 13170 } 13171 } 13172 } 13173 13174 ret = ret.length > 1 ? jQuery.unique(ret) : ret; 13175 13176 return this.pushStack( ret, "closest", selectors ); 13177 }, 13178 13179 // Determine the position of an element within 13180 // the matched set of elements 13181 index: function( elem ) { 13182 if ( !elem || typeof elem === "string" ) { 13183 return jQuery.inArray( this[0], 13184 // If it receives a string, the selector is used 13185 // If it receives nothing, the siblings are used 13186 elem ? jQuery( elem ) : this.parent().children() ); 13187 } 13188 // Locate the position of the desired element 13189 return jQuery.inArray( 13190 // If it receives a jQuery object, the first element is used 13191 elem.jquery ? elem[0] : elem, this ); 13192 }, 13193 13194 add: function( selector, context ) { 13195 var set = typeof selector === "string" ? 13196 jQuery( selector, context ) : 13197 jQuery.makeArray( selector ), 13198 all = jQuery.merge( this.get(), set ); 13199 13200 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? 13201 all : 13202 jQuery.unique( all ) ); 13203 }, 13204 13205 andSelf: function() { 13206 return this.add( this.prevObject ); 13207 } 13208}); 13209 13210// A painfully simple check to see if an element is disconnected 13211// from a document (should be improved, where feasible). 13212function isDisconnected( node ) { 13213 return !node || !node.parentNode || node.parentNode.nodeType === 11; 13214} 13215 13216jQuery.each({ 13217 parent: function( elem ) { 13218 var parent = elem.parentNode; 13219 return parent && parent.nodeType !== 11 ? parent : null; 13220 }, 13221 parents: function( elem ) { 13222 return jQuery.dir( elem, "parentNode" ); 13223 }, 13224 parentsUntil: function( elem, i, until ) { 13225 return jQuery.dir( elem, "parentNode", until ); 13226 }, 13227 next: function( elem ) { 13228 return jQuery.nth( elem, 2, "nextSibling" ); 13229 }, 13230 prev: function( elem ) { 13231 return jQuery.nth( elem, 2, "previousSibling" ); 13232 }, 13233 nextAll: function( elem ) { 13234 return jQuery.dir( elem, "nextSibling" ); 13235 }, 13236 prevAll: function( elem ) { 13237 return jQuery.dir( elem, "previousSibling" ); 13238 }, 13239 nextUntil: function( elem, i, until ) { 13240 return jQuery.dir( elem, "nextSibling", until ); 13241 }, 13242 prevUntil: function( elem, i, until ) { 13243 return jQuery.dir( elem, "previousSibling", until ); 13244 }, 13245 siblings: function( elem ) { 13246 return jQuery.sibling( elem.parentNode.firstChild, elem ); 13247 }, 13248 children: function( elem ) { 13249 return jQuery.sibling( elem.firstChild ); 13250 }, 13251 contents: function( elem ) { 13252 return jQuery.nodeName( elem, "iframe" ) ? 13253 elem.contentDocument || elem.contentWindow.document : 13254 jQuery.makeArray( elem.childNodes ); 13255 } 13256}, function( name, fn ) { 13257 jQuery.fn[ name ] = function( until, selector ) { 13258 var ret = jQuery.map( this, fn, until ), 13259 // The variable 'args' was introduced in 13260 // https://github.com/jquery/jquery/commit/52a0238 13261 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. 13262 // http://code.google.com/p/v8/issues/detail?id=1050 13263 args = slice.call(arguments); 13264 13265 if ( !runtil.test( name ) ) { 13266 selector = until; 13267 } 13268 13269 if ( selector && typeof selector === "string" ) { 13270 ret = jQuery.filter( selector, ret ); 13271 } 13272 13273 ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; 13274 13275 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { 13276 ret = ret.reverse(); 13277 } 13278 13279 return this.pushStack( ret, name, args.join(",") ); 13280 }; 13281}); 13282 13283jQuery.extend({ 13284 filter: function( expr, elems, not ) { 13285 if ( not ) { 13286 expr = ":not(" + expr + ")"; 13287 } 13288 13289 return elems.length === 1 ? 13290 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : 13291 jQuery.find.matches(expr, elems); 13292 }, 13293 13294 dir: function( elem, dir, until ) { 13295 var matched = [], 13296 cur = elem[ dir ]; 13297 13298 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { 13299 if ( cur.nodeType === 1 ) { 13300 matched.push( cur ); 13301 } 13302 cur = cur[dir]; 13303 } 13304 return matched; 13305 }, 13306 13307 nth: function( cur, result, dir, elem ) { 13308 result = result || 1; 13309 var num = 0; 13310 13311 for ( ; cur; cur = cur[dir] ) { 13312 if ( cur.nodeType === 1 && ++num === result ) { 13313 break; 13314 } 13315 } 13316 13317 return cur; 13318 }, 13319 13320 sibling: function( n, elem ) { 13321 var r = []; 13322 13323 for ( ; n; n = n.nextSibling ) { 13324 if ( n.nodeType === 1 && n !== elem ) { 13325 r.push( n ); 13326 } 13327 } 13328 13329 return r; 13330 } 13331}); 13332 13333// Implement the identical functionality for filter and not 13334function winnow( elements, qualifier, keep ) { 13335 if ( jQuery.isFunction( qualifier ) ) { 13336 return jQuery.grep(elements, function( elem, i ) { 13337 var retVal = !!qualifier.call( elem, i, elem ); 13338 return retVal === keep; 13339 }); 13340 13341 } else if ( qualifier.nodeType ) { 13342 return jQuery.grep(elements, function( elem, i ) { 13343 return (elem === qualifier) === keep; 13344 }); 13345 13346 } else if ( typeof qualifier === "string" ) { 13347 var filtered = jQuery.grep(elements, function( elem ) { 13348 return elem.nodeType === 1; 13349 }); 13350 13351 if ( isSimple.test( qualifier ) ) { 13352 return jQuery.filter(qualifier, filtered, !keep); 13353 } else { 13354 qualifier = jQuery.filter( qualifier, filtered ); 13355 } 13356 } 13357 13358 return jQuery.grep(elements, function( elem, i ) { 13359 return (jQuery.inArray( elem, qualifier ) >= 0) === keep; 13360 }); 13361} 13362 13363 13364 13365 13366var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, 13367 rleadingWhitespace = /^\s+/, 13368 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, 13369 rtagName = /<([\w:]+)/, 13370 rtbody = /<tbody/i,
vendor: 9,105 bytes, lines 13371-13715
13371 rhtml = /<|&#?\w+;/, 13372 rnocache = /<(?:script|object|embed|option|style)/i, 13373 // checked="checked" or checked 13374 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 13375 wrapMap = { 13376 option: [ 1, "<select multiple='multiple'>", "</select>" ], 13377 legend: [ 1, "<fieldset>", "</fieldset>" ], 13378 thead: [ 1, "<table>", "</table>" ], 13379 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 13380 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 13381 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 13382 area: [ 1, "<map>", "</map>" ], 13383 _default: [ 0, "", "" ] 13384 }; 13385 13386wrapMap.optgroup = wrapMap.option; 13387wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 13388wrapMap.th = wrapMap.td; 13389 13390// IE can't serialize <link> and <script> tags normally 13391if ( !jQuery.support.htmlSerialize ) { 13392 wrapMap._default = [ 1, "div<div>", "</div>" ]; 13393} 13394 13395jQuery.fn.extend({ 13396 text: function( text ) { 13397 if ( jQuery.isFunction(text) ) { 13398 return this.each(function(i) { 13399 var self = jQuery( this ); 13400 13401 self.text( text.call(this, i, self.text()) ); 13402 }); 13403 } 13404 13405 if ( typeof text !== "object" && text !== undefined ) { 13406 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 13407 } 13408 13409 return jQuery.text( this ); 13410 }, 13411 13412 wrapAll: function( html ) { 13413 if ( jQuery.isFunction( html ) ) { 13414 return this.each(function(i) { 13415 jQuery(this).wrapAll( html.call(this, i) ); 13416 }); 13417 } 13418 13419 if ( this[0] ) { 13420 // The elements to wrap the target around 13421 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); 13422 13423 if ( this[0].parentNode ) { 13424 wrap.insertBefore( this[0] ); 13425 } 13426 13427 wrap.map(function() { 13428 var elem = this; 13429 13430 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 13431 elem = elem.firstChild; 13432 } 13433 13434 return elem; 13435 }).append(this); 13436 } 13437 13438 return this; 13439 }, 13440 13441 wrapInner: function( html ) { 13442 if ( jQuery.isFunction( html ) ) { 13443 return this.each(function(i) { 13444 jQuery(this).wrapInner( html.call(this, i) ); 13445 }); 13446 } 13447 13448 return this.each(function() { 13449 var self = jQuery( this ), 13450 contents = self.contents(); 13451 13452 if ( contents.length ) { 13453 contents.wrapAll( html ); 13454 13455 } else { 13456 self.append( html ); 13457 } 13458 }); 13459 }, 13460 13461 wrap: function( html ) { 13462 return this.each(function() { 13463 jQuery( this ).wrapAll( html ); 13464 }); 13465 }, 13466 13467 unwrap: function() { 13468 return this.parent().each(function() { 13469 if ( !jQuery.nodeName( this, "body" ) ) { 13470 jQuery( this ).replaceWith( this.childNodes ); 13471 } 13472 }).end(); 13473 }, 13474 13475 append: function() { 13476 return this.domManip(arguments, true, function( elem ) { 13477 if ( this.nodeType === 1 ) { 13478 this.appendChild( elem ); 13479 } 13480 }); 13481 }, 13482 13483 prepend: function() { 13484 return this.domManip(arguments, true, function( elem ) { 13485 if ( this.nodeType === 1 ) { 13486 this.insertBefore( elem, this.firstChild ); 13487 } 13488 }); 13489 }, 13490 13491 before: function() { 13492 if ( this[0] && this[0].parentNode ) { 13493 return this.domManip(arguments, false, function( elem ) { 13494 this.parentNode.insertBefore( elem, this ); 13495 }); 13496 } else if ( arguments.length ) { 13497 var set = jQuery(arguments[0]); 13498 set.push.apply( set, this.toArray() ); 13499 return this.pushStack( set, "before", arguments ); 13500 } 13501 }, 13502 13503 after: function() { 13504 if ( this[0] && this[0].parentNode ) { 13505 return this.domManip(arguments, false, function( elem ) { 13506 this.parentNode.insertBefore( elem, this.nextSibling ); 13507 }); 13508 } else if ( arguments.length ) { 13509 var set = this.pushStack( this, "after", arguments ); 13510 set.push.apply( set, jQuery(arguments[0]).toArray() ); 13511 return set; 13512 } 13513 }, 13514 13515 // keepData is for internal use only--do not document 13516 remove: function( selector, keepData ) { 13517 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 13518 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { 13519 if ( !keepData && elem.nodeType === 1 ) { 13520 jQuery.cleanData( elem.getElementsByTagName("*") ); 13521 jQuery.cleanData( [ elem ] ); 13522 } 13523 13524 if ( elem.parentNode ) { 13525 elem.parentNode.removeChild( elem ); 13526 } 13527 } 13528 } 13529 13530 return this; 13531 }, 13532 13533 empty: function() { 13534 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { 13535 // Remove element nodes and prevent memory leaks 13536 if ( elem.nodeType === 1 ) { 13537 jQuery.cleanData( elem.getElementsByTagName("*") ); 13538 } 13539 13540 // Remove any remaining nodes 13541 while ( elem.firstChild ) { 13542 elem.removeChild( elem.firstChild ); 13543 } 13544 } 13545 13546 return this; 13547 }, 13548 13549 clone: function( dataAndEvents, deepDataAndEvents ) { 13550 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 13551 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 13552 13553 return this.map( function () { 13554 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 13555 }); 13556 }, 13557 13558 html: function( value ) { 13559 if ( value === undefined ) { 13560 return this[0] && this[0].nodeType === 1 ? 13561 this[0].innerHTML.replace(rinlinejQuery, "") : 13562 null; 13563 13564 // See if we can take a shortcut and just use innerHTML 13565 } else if ( typeof value === "string" && !rnocache.test( value ) && 13566 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && 13567 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { 13568 13569 value = value.replace(rxhtmlTag, "<$1></$2>"); 13570 13571 try { 13572 for ( var i = 0, l = this.length; i < l; i++ ) { 13573 // Remove element nodes and prevent memory leaks 13574 if ( this[i].nodeType === 1 ) { 13575 jQuery.cleanData( this[i].getElementsByTagName("*") ); 13576 this[i].innerHTML = value; 13577 } 13578 } 13579 13580 // If using innerHTML throws an exception, use the fallback method 13581 } catch(e) { 13582 this.empty().append( value ); 13583 } 13584 13585 } else if ( jQuery.isFunction( value ) ) { 13586 this.each(function(i){ 13587 var self = jQuery( this ); 13588 13589 self.html( value.call(this, i, self.html()) ); 13590 }); 13591 13592 } else { 13593 this.empty().append( value ); 13594 } 13595 13596 return this; 13597 }, 13598 13599 replaceWith: function( value ) { 13600 if ( this[0] && this[0].parentNode ) { 13601 // Make sure that the elements are removed from the DOM before they are inserted 13602 // this can help fix replacing a parent with child elements 13603 if ( jQuery.isFunction( value ) ) { 13604 return this.each(function(i) { 13605 var self = jQuery(this), old = self.html(); 13606 self.replaceWith( value.call( this, i, old ) ); 13607 }); 13608 } 13609 13610 if ( typeof value !== "string" ) { 13611 value = jQuery( value ).detach(); 13612 } 13613 13614 return this.each(function() { 13615 var next = this.nextSibling, 13616 parent = this.parentNode; 13617 13618 jQuery( this ).remove(); 13619 13620 if ( next ) { 13621 jQuery(next).before( value ); 13622 } else { 13623 jQuery(parent).append( value ); 13624 } 13625 }); 13626 } else { 13627 return this.length ? 13628 this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : 13629 this; 13630 } 13631 }, 13632 13633 detach: function( selector ) { 13634 return this.remove( selector, true ); 13635 }, 13636 13637 domManip: function( args, table, callback ) { 13638 var results, first, fragment, parent, 13639 value = args[0], 13640 scripts = []; 13641 13642 // We can't cloneNode fragments that contain checked, in WebKit 13643 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { 13644 return this.each(function() { 13645 jQuery(this).domManip( args, table, callback, true ); 13646 }); 13647 } 13648 13649 if ( jQuery.isFunction(value) ) { 13650 return this.each(function(i) { 13651 var self = jQuery(this); 13652 args[0] = value.call(this, i, table ? self.html() : undefined); 13653 self.domManip( args, table, callback ); 13654 }); 13655 } 13656 13657 if ( this[0] ) { 13658 parent = value && value.parentNode; 13659 13660 // If we're in a fragment, just use that instead of building a new one 13661 if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { 13662 results = { fragment: parent }; 13663 13664 } else { 13665 results = jQuery.buildFragment( args, this, scripts ); 13666 } 13667 13668 fragment = results.fragment; 13669 13670 if ( fragment.childNodes.length === 1 ) { 13671 first = fragment = fragment.firstChild; 13672 } else { 13673 first = fragment.firstChild; 13674 } 13675 13676 if ( first ) { 13677 table = table && jQuery.nodeName( first, "tr" ); 13678 13679 for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { 13680 callback.call( 13681 table ? 13682 root(this[i], first) : 13683 this[i], 13684 // Make sure that we do not leak memory by inadvertently discarding 13685 // the original fragment (which might have attached data) instead of 13686 // using it; in addition, use the original fragment object for the last 13687 // item instead of first because it can end up being emptied incorrectly 13688 // in certain situations (Bug #8070). 13689 // Fragments from the fragment cache must always be cloned and never used 13690 // in place. 13691 results.cacheable || (l > 1 && i < lastIndex) ? 13692 jQuery.clone( fragment, true, true ) : 13693 fragment 13694 ); 13695 } 13696 } 13697 13698 if ( scripts.length ) { 13699 jQuery.each( scripts, evalScript ); 13700 } 13701 } 13702 13703 return this; 13704 } 13705}); 13706 13707function root( elem, cur ) { 13708 return jQuery.nodeName(elem, "table") ? 13709 (elem.getElementsByTagName("tbody")[0] || 13710 elem.appendChild(elem.ownerDocument.createElement("tbody"))) : 13711 elem; 13712} 13713 13714function cloneCopyEvent( src, dest ) { 13715
13716 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 13717 return; 13718 } 13719 13720 var internalKey = jQuery.expando, 13721 oldData = jQuery.data( src ), 13722 curData = jQuery.data( dest, oldData ); 13723 13724 // Switch to use the internal data object, if it exists, for the next 13725 // stage of data copying 13726 if ( (oldData = oldData[ internalKey ]) ) { 13727 var events = oldData.events; 13728 curData = curData[ internalKey ] = jQuery.extend({}, oldData); 13729 13730 if ( events ) { 13731 delete curData.handle; 13732 curData.events = {}; 13733 13734 for ( var type in events ) { 13735 for ( var i = 0, l = events[ type ].length; i < l; i++ ) { 13736 jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); 13737 } 13738 } 13739 } 13740 } 13741} 13742 13743function cloneFixAttributes(src, dest) { 13744 // We do not need to do anything for non-Elements 13745 if ( dest.nodeType !== 1 ) { 13746 return; 13747 } 13748 13749 var nodeName = dest.nodeName.toLowerCase(); 13750 13751 // clearAttributes removes the attributes, which we don't want, 13752 // but also removes the attachEvent events, which we *do* want 13753 dest.clearAttributes(); 13754 13755 // mergeAttributes, in contrast, only merges back on the 13756 // original attributes, not the events 13757 dest.mergeAttributes(src); 13758 13759 // IE6-8 fail to clone children inside object elements that use 13760 // the proprietary classid attribute value (rather than the type 13761 // attribute) to identify the type of content to display 13762 if ( nodeName === "object" ) { 13763 dest.outerHTML = src.outerHTML; 13764 13765 } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { 13766 // IE6-8 fails to persist the checked state of a cloned checkbox 13767 // or radio button. Worse, IE6-7 fail to give the cloned element 13768 // a checked appearance if the defaultChecked value isn't also set 13769 if ( src.checked ) { 13770 dest.defaultChecked = dest.checked = src.checked; 13771 } 13772 13773 // IE6-7 get confused and end up setting the value of a cloned 13774 // checkbox/radio button to an empty string instead of "on" 13775 if ( dest.value !== src.value ) { 13776 dest.value = src.value; 13777 } 13778 13779 // IE6-8 fails to return the selected option to the default selected 13780 // state when cloning options 13781 } else if ( nodeName === "option" ) { 13782 dest.selected = src.defaultSelected; 13783 13784 // IE6-8 fails to set the defaultValue to the correct value when 13785 // cloning other types of input fields 13786 } else if ( nodeName === "input" || nodeName === "textarea" ) { 13787 dest.defaultValue = src.defaultValue; 13788 } 13789 13790 // Event data gets referenced instead of copied if the expando 13791 // gets copied too 13792 dest.removeAttribute( jQuery.expando ); 13793} 13794 13795jQuery.buildFragment = function( args, nodes, scripts ) { 13796 var fragment, cacheable, cacheresults, 13797 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); 13798 13799 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document 13800 // Cloning options loses the selected state, so don't cache them 13801 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment 13802 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache 13803 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && 13804 args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { 13805 13806 cacheable = true; 13807 cacheresults = jQuery.fragments[ args[0] ]; 13808 if ( cacheresults ) { 13809 if ( cacheresults !== 1 ) { 13810 fragment = cacheresults; 13811 } 13812 } 13813 } 13814 13815 if ( !fragment ) { 13816 fragment = doc.createDocumentFragment(); 13817 jQuery.clean( args, doc, fragment, scripts ); 13818 } 13819 13820 if ( cacheable ) { 13821 jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; 13822 } 13823 13824 return { fragment: fragment, cacheable: cacheable }; 13825}; 13826 13827jQuery.fragments = {}; 13828 13829jQuery.each({ 13830 appendTo: "append", 13831 prependTo: "prepend", 13832 insertBefore: "before", 13833 insertAfter: "after", 13834 replaceAll: "replaceWith" 13835}, function( name, original ) { 13836 jQuery.fn[ name ] = function( selector ) { 13837 var ret = [], 13838 insert = jQuery( selector ), 13839 parent = this.length === 1 && this[0].parentNode; 13840 13841 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { 13842 insert[ original ]( this[0] ); 13843 return this; 13844 13845 } else { 13846 for ( var i = 0, l = insert.length; i < l; i++ ) { 13847 var elems = (i > 0 ? this.clone(true) : this).get(); 13848 jQuery( insert[i] )[ original ]( elems ); 13849 ret = ret.concat( elems ); 13850 } 13851 13852 return this.pushStack( ret, name, insert.selector ); 13853 } 13854 }; 13855}); 13856 13857function getAll( elem ) { 13858 if ( "getElementsByTagName" in elem ) { 13859 return elem.getElementsByTagName( "*" ); 13860 13861 } else if ( "querySelectorAll" in elem ) { 13862 return elem.querySelectorAll( "*" ); 13863 13864 } else { 13865 return []; 13866 } 13867} 13868 13869jQuery.extend({ 13870 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 13871 var clone = elem.cloneNode(true), 13872 srcElements, 13873 destElements, 13874 i; 13875 13876 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && 13877 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { 13878 // IE copies events bound via attachEvent when using cloneNode. 13879 // Calling detachEvent on the clone will also remove the events 13880 // from the original. In order to get around this, we use some 13881 // proprietary methods to clear the events. Thanks to MooTools 13882 // guys for this hotness. 13883 13884 cloneFixAttributes( elem, clone ); 13885 13886 // Using Sizzle here is crazy slow, so we use getElementsByTagName 13887 // instead 13888 srcElements = getAll( elem ); 13889 destElements = getAll( clone ); 13890 13891 // Weird iteration because IE will replace the length property 13892 // with an element if you are cloning the body and one of the 13893 // elements on the page has a name or id of "length" 13894 for ( i = 0; srcElements[i]; ++i ) { 13895 cloneFixAttributes( srcElements[i], destElements[i] ); 13896 } 13897 } 13898 13899 // Copy the events from the original to the clone 13900 if ( dataAndEvents ) { 13901 cloneCopyEvent( elem, clone ); 13902 13903 if ( deepDataAndEvents ) { 13904 srcElements = getAll( elem ); 13905 destElements = getAll( clone ); 13906 13907 for ( i = 0; srcElements[i]; ++i ) { 13908 cloneCopyEvent( srcElements[i], destElements[i] ); 13909 } 13910 } 13911 } 13912 13913 // Return the cloned set 13914 return clone; 13915}, 13916 clean: function( elems, context, fragment, scripts ) { 13917 context = context || document; 13918 13919 // !context.createElement fails in IE with an error but returns typeof 'object' 13920 if ( typeof context.createElement === "undefined" ) { 13921 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 13922 } 13923 13924 var ret = []; 13925 13926 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 13927 if ( typeof elem === "number" ) { 13928 elem += ""; 13929 } 13930 13931 if ( !elem ) { 13932 continue; 13933 } 13934 13935 // Convert html string into DOM nodes 13936 if ( typeof elem === "string" && !rhtml.test( elem ) ) { 13937 elem = context.createTextNode( elem ); 13938 13939 } else if ( typeof elem === "string" ) { 13940 // Fix "XHTML"-style tags in all browsers 13941 elem = elem.replace(rxhtmlTag, "<$1></$2>"); 13942 13943 // Trim whitespace, otherwise indexOf won't work as expected 13944 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), 13945 wrap = wrapMap[ tag ] || wrapMap._default, 13946 depth = wrap[0], 13947 div = context.createElement("div"); 13948 13949 // Go to html and back, then peel off extra wrappers 13950 div.innerHTML = wrap[1] + elem + wrap[2]; 13951 13952 // Move to the right depth 13953 while ( depth-- ) {
13954 div = div.lastChild; 13955 } 13956 13957 // Remove IE's autoinserted <tbody> from table fragments 13958 if ( !jQuery.support.tbody ) { 13959 13960 // String was a <table>, *may* have spurious <tbody> 13961 var hasBody = rtbody.test(elem), 13962 tbody = tag === "table" && !hasBody ? 13963 div.firstChild && div.firstChild.childNodes : 13964 13965 // String was a bare <thead> or <tfoot> 13966 wrap[1] === "<table>" && !hasBody ? 13967 div.childNodes : 13968 []; 13969 13970 for ( var j = tbody.length - 1; j >= 0 ; --j ) { 13971 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { 13972 tbody[ j ].parentNode.removeChild( tbody[ j ] ); 13973 } 13974 } 13975 13976 } 13977 13978 // IE completely kills leading whitespace when innerHTML is used 13979 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 13980 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); 13981 } 13982 13983 elem = div.childNodes; 13984 } 13985 13986 if ( elem.nodeType ) { 13987 ret.push( elem ); 13988 } else { 13989 ret = jQuery.merge( ret, elem ); 13990 } 13991 } 13992 13993 if ( fragment ) { 13994 for ( i = 0; ret[i]; i++ ) { 13995 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { 13996 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); 13997 13998 } else { 13999 if ( ret[i].nodeType === 1 ) { 14000 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); 14001 } 14002 fragment.appendChild( ret[i] ); 14003 } 14004 } 14005 } 14006 14007 return ret; 14008 }, 14009 14010 cleanData: function( elems ) { 14011 var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special, 14012 deleteExpando = jQuery.support.deleteExpando; 14013 14014 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 14015 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { 14016 continue; 14017 } 14018 14019 id = elem[ jQuery.expando ]; 14020 14021 if ( id ) { 14022 data = cache[ id ] && cache[ id ][ internalKey ]; 14023 14024 if ( data && data.events ) { 14025 for ( var type in data.events ) { 14026 if ( special[ type ] ) { 14027 jQuery.event.remove( elem, type ); 14028 14029 // This is a shortcut to avoid jQuery.event.remove's overhead 14030 } else { 14031 jQuery.removeEvent( elem, type, data.handle ); 14032 } 14033 } 14034 14035 // Null the DOM reference to avoid IE6/7/8 leak (#7054) 14036 if ( data.handle ) { 14037 data.handle.elem = null; 14038 } 14039 } 14040 14041 if ( deleteExpando ) { 14042 delete elem[ jQuery.expando ]; 14043 14044 } else if ( elem.removeAttribute ) { 14045 elem.removeAttribute( jQuery.expando ); 14046 } 14047 14048 delete cache[ id ]; 14049 } 14050 } 14051 } 14052}); 14053 14054function evalScript( i, elem ) { 14055 if ( elem.src ) { 14056 jQuery.ajax({ 14057 url: elem.src, 14058 async: false, 14059 dataType: "script" 14060 }); 14061 } else { 14062 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 14063 } 14064 14065 if ( elem.parentNode ) { 14066 elem.parentNode.removeChild( elem ); 14067 } 14068} 14069 14070 14071 14072 14073var ralpha = /alpha\([^)]*\)/i, 14074 ropacity = /opacity=([^)]*)/, 14075 rdashAlpha = /-([a-z])/ig, 14076 // fixed for IE9, see #8346 14077 rupper = /([A-Z]|^ms)/g, 14078 rnumpx = /^-?\d+(?:px)?$/i, 14079 rnum = /^-?\d/, 14080 14081 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 14082 cssWidth = [ "Left", "Right" ], 14083 cssHeight = [ "Top", "Bottom" ], 14084 curCSS, 14085 14086 getComputedStyle, 14087 currentStyle, 14088 14089 fcamelCase = function( all, letter ) { 14090 return letter.toUpperCase(); 14091 }; 14092 14093jQuery.fn.css = function( name, value ) { 14094 // Setting 'undefined' is a no-op 14095 if ( arguments.length === 2 && value === undefined ) { 14096 return this; 14097 } 14098 14099 return jQuery.access( this, name, value, true, function( elem, name, value ) { 14100 return value !== undefined ? 14101 jQuery.style( elem, name, value ) : 14102 jQuery.css( elem, name ); 14103 }); 14104}; 14105 14106jQuery.extend({ 14107 // Add in style property hooks for overriding the default 14108 // behavior of getting and setting a style property 14109 cssHooks: { 14110 opacity: { 14111 get: function( elem, computed ) { 14112 if ( computed ) { 14113 // We should always get a number back from opacity 14114 var ret = curCSS( elem, "opacity", "opacity" ); 14115 return ret === "" ? "1" : ret; 14116 14117 } else { 14118 return elem.style.opacity; 14119 } 14120 } 14121 } 14122 }, 14123 14124 // Exclude the following css properties to add px 14125 cssNumber: { 14126 "zIndex": true, 14127 "fontWeight": true, 14128 "opacity": true, 14129 "zoom": true, 14130 "lineHeight": true 14131 }, 14132 14133 // Add in properties whose names you wish to fix before 14134 // setting or getting the value 14135 cssProps: { 14136 // normalize float css property 14137 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" 14138 }, 14139 14140 // Get and set the style property on a DOM Node 14141 style: function( elem, name, value, extra ) { 14142 // Don't set styles on text and comment nodes 14143 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 14144 return; 14145 } 14146 14147 // Make sure that we're working with the right name 14148 var ret, origName = jQuery.camelCase( name ), 14149 style = elem.style, hooks = jQuery.cssHooks[ origName ]; 14150 14151 name = jQuery.cssProps[ origName ] || origName; 14152 14153 // Check if we're setting a value 14154 if ( value !== undefined ) { 14155 // Make sure that NaN and null values aren't set. See: #7116 14156 if ( typeof value === "number" && isNaN( value ) || value == null ) { 14157 return; 14158 } 14159 14160 // If a number was passed in, add 'px' to the (except for certain CSS properties) 14161 if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { 14162 value += "px"; 14163 } 14164 14165 // If a hook was provided, use that value, otherwise just set the specified value 14166 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
14167 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided 14168 // Fixes bug #5509 14169 try { 14170 style[ name ] = value; 14171 } catch(e) {} 14172 } 14173 14174 } else { 14175 // If a hook was provided get the non-computed value from there 14176 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { 14177 return ret; 14178 } 14179 14180 // Otherwise just get the value from the style object 14181 return style[ name ]; 14182 } 14183 }, 14184 14185 css: function( elem, name, extra ) { 14186 // Make sure that we're working with the right name 14187 var ret, origName = jQuery.camelCase( name ), 14188 hooks = jQuery.cssHooks[ origName ]; 14189 14190 name = jQuery.cssProps[ origName ] || origName; 14191 14192 // If a hook was provided get the computed value from there 14193 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { 14194 return ret; 14195 14196 // Otherwise, if a way to get the computed value exists, use that 14197 } else if ( curCSS ) { 14198 return curCSS( elem, name, origName ); 14199 } 14200 }, 14201 14202 // A method for quickly swapping in/out CSS properties to get correct calculations 14203 swap: function( elem, options, callback ) { 14204 var old = {}; 14205 14206 // Remember the old values, and insert the new ones 14207 for ( var name in options ) { 14208 old[ name ] = elem.style[ name ]; 14209 elem.style[ name ] = options[ name ]; 14210 } 14211 14212 callback.call( elem ); 14213 14214 // Revert the old values 14215 for ( name in options ) { 14216 elem.style[ name ] = old[ name ]; 14217 } 14218 }, 14219 14220 camelCase: function( string ) { 14221 return string.replace( rdashAlpha, fcamelCase ); 14222 } 14223}); 14224 14225// DEPRECATED, Use jQuery.css() instead 14226jQuery.curCSS = jQuery.css; 14227 14228jQuery.each(["height", "width"], function( i, name ) { 14229 jQuery.cssHooks[ name ] = { 14230 get: function( elem, computed, extra ) { 14231 var val; 14232 14233 if ( computed ) { 14234 if ( elem.offsetWidth !== 0 ) { 14235 val = getWH( elem, name, extra ); 14236 14237 } else { 14238 jQuery.swap( elem, cssShow, function() { 14239 val = getWH( elem, name, extra ); 14240 }); 14241 } 14242 14243 if ( val <= 0 ) { 14244 val = curCSS( elem, name, name ); 14245 14246 if ( val === "0px" && currentStyle ) { 14247 val = currentStyle( elem, name, name ); 14248 } 14249 14250 if ( val != null ) {
14251 // Should return "auto" instead of 0, use 0 for 14252 // temporary backwards-compat 14253 return val === "" || val === "auto" ? "0px" : val; 14254 } 14255 } 14256 14257 if ( val < 0 || val == null ) { 14258 val = elem.style[ name ]; 14259 14260 // Should return "auto" instead of 0, use 0 for 14261 // temporary backwards-compat 14262 return val === "" || val === "auto" ? "0px" : val; 14263 } 14264 14265 return typeof val === "string" ? val : val + "px"; 14266 } 14267 }, 14268 14269 set: function( elem, value ) { 14270 if ( rnumpx.test( value ) ) { 14271 // ignore negative width and height values #1599 14272 value = parseFloat(value); 14273 14274 if ( value >= 0 ) { 14275 return value + "px"; 14276 } 14277 14278 } else { 14279 return value; 14280 } 14281 } 14282 }; 14283}); 14284 14285if ( !jQuery.support.opacity ) { 14286 jQuery.cssHooks.opacity = { 14287 get: function( elem, computed ) { 14288 // IE uses filters for opacity 14289 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? 14290 (parseFloat(RegExp.$1) / 100) + "" : 14291 computed ? "1" : ""; 14292 }, 14293 14294 set: function( elem, value ) { 14295 var style = elem.style; 14296 14297 // IE has trouble with opacity if it does not have layout 14298 // Force it by setting the zoom level 14299 style.zoom = 1; 14300 14301 // Set the alpha filter to set the opacity 14302 var opacity = jQuery.isNaN(value) ? 14303 "" : 14304 "alpha(opacity=" + value * 100 + ")", 14305 filter = style.filter || ""; 14306 14307 style.filter = ralpha.test(filter) ? 14308 filter.replace(ralpha, opacity) : 14309 style.filter + ' ' + opacity; 14310 } 14311 }; 14312} 14313 14314jQuery(function() { 14315 // This hook cannot be added until DOM ready because the support test 14316 // for it is not run until after DOM ready 14317 if ( !jQuery.support.reliableMarginRight ) { 14318 jQuery.cssHooks.marginRight = { 14319 get: function( elem, computed ) { 14320 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 14321 // Work around by temporarily setting element display to inline-block 14322 var ret; 14323 jQuery.swap( elem, { "display": "inline-block" }, function() { 14324 if ( computed ) { 14325 ret = curCSS( elem, "margin-right", "marginRight" ); 14326 } else { 14327 ret = elem.style.marginRight; 14328 } 14329 }); 14330 return ret; 14331 } 14332 }; 14333 } 14334}); 14335 14336if ( document.defaultView && document.defaultView.getComputedStyle ) { 14337 getComputedStyle = function( elem, newName, name ) { 14338 var ret, defaultView, computedStyle; 14339 14340 name = name.replace( rupper, "-$1" ).toLowerCase(); 14341 14342 if ( !(defaultView = elem.ownerDocument.defaultView) ) { 14343 return undefined; 14344 } 14345 14346 if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) { 14347 ret = computedStyle.getPropertyValue( name ); 14348 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { 14349 ret = jQuery.style( elem, name ); 14350 } 14351 } 14352 14353 return ret; 14354 }; 14355} 14356 14357if ( document.documentElement.currentStyle ) { 14358 currentStyle = function( elem, name ) { 14359 var left, 14360 ret = elem.currentStyle && elem.currentStyle[ name ], 14361 rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], 14362 style = elem.style; 14363 14364 // From the awesome hack by Dean Edwards 14365 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 14366 14367 // If we're not dealing with a regular pixel number 14368 // but a number that has a weird ending, we need to convert it to pixels 14369 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { 14370 // Remember the original values 14371 left = style.left; 14372 14373 // Put in the new values to get a computed value out 14374 if ( rsLeft ) { 14375 elem.runtimeStyle.left = elem.currentStyle.left; 14376 } 14377 style.left = name === "fontSize" ? "1em" : (ret || 0); 14378 ret = style.pixelLeft + "px"; 14379 14380 // Revert the changed values 14381 style.left = left; 14382 if ( rsLeft ) { 14383 elem.runtimeStyle.left = rsLeft; 14384 } 14385 } 14386 14387 return ret === "" ? "auto" : ret; 14388 }; 14389} 14390 14391curCSS = getComputedStyle || currentStyle; 14392 14393function getWH( elem, name, extra ) { 14394 var which = name === "width" ? cssWidth : cssHeight, 14395 val = name === "width" ? elem.offsetWidth : elem.offsetHeight; 14396 14397 if ( extra === "border" ) { 14398 return val; 14399 } 14400 14401 jQuery.each( which, function() { 14402 if ( !extra ) { 14403 val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0; 14404 } 14405 14406 if ( extra === "margin" ) { 14407 val += parseFloat(jQuery.css( elem, "margin" + this )) || 0; 14408 14409 } else { 14410 val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0; 14411 } 14412 }); 14413 14414 return val; 14415} 14416 14417if ( jQuery.expr && jQuery.expr.filters ) { 14418 jQuery.expr.filters.hidden = function( elem ) { 14419 var width = elem.offsetWidth, 14420 height = elem.offsetHeight; 14421 14422 return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "dis
14422play" )) === "none"); 14423 }; 14424 14425 jQuery.expr.filters.visible = function( elem ) { 14426 return !jQuery.expr.filters.hidden( elem ); 14427 }; 14428} 14429 14430 14431 14432 14433var r20 = /%20/g, 14434 rbracket = /\[\]$/, 14435 rCRLF = /\r?\n/g, 14436 rhash = /#.*$/, 14437 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL 14438 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 14439 // #7653, #8125, #8152: local protocol detection 14440 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, 14441 rnoContent = /^(?:GET|HEAD)$/, 14442 rprotocol = /^\/\//, 14443 rquery = /\?/, 14444 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, 14445 rselectTextarea = /^(?:select|textarea)/i, 14446 rspacesAjax = /\s+/, 14447 rts = /([?&])_=[^&]*/, 14448 rucHeaders = /(^|\-)([a-z])/g, 14449 rucHeadersFunc = function( _, $1, $2 ) { 14450 return $1 + $2.toUpperCase(); 14451 }, 14452 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, 14453 14454 // Keep a copy of the old load method 14455 _load = jQuery.fn.load, 14456 14457 /* Prefilters 14458 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 14459 * 2) These are called: 14460 * - BEFORE asking for a transport 14461 * - AFTER param serialization (s.data is a string if s.processData is true) 14462 * 3) key is the dataType 14463 * 4) the catchall symbol "*" can be used 14464 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 14465 */ 14466 prefilters = {}, 14467 14468 /* Transports bindings 14469 * 1) key is the dataType 14470 * 2) the catchall symbol "*" can be used 14471 * 3) selection will start with transport dataType and THEN go to "*" if needed 14472 */ 14473 transports = {}, 14474 14475 // Document location 14476 ajaxLocation, 14477 14478 // Document location segments 14479 ajaxLocParts; 14480 14481// #8138, IE may throw an exception when accessing 14482// a field from document.location if document.domain has been set 14483try { 14484 ajaxLocation = document.location.href; 14485} catch( e ) { 14486 // Use the href attribute of an A element 14487 // since IE will modify it given document.location 14488 ajaxLocation = document.createElement( "a" ); 14489 ajaxLocation.href = ""; 14490 ajaxLocation = ajaxLocation.href; 14491} 14492 14493// Segment location into parts 14494ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 14495 14496// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 14497function addToPrefiltersOrTransports( structure ) { 14498 14499 // dataTypeExpression is optional and defaults to "*" 14500 return function( dataTypeExpression, func ) { 14501 14502 if ( typeof dataTypeExpression !== "string" ) { 14503 func = dataTypeExpression; 14504 dataTypeExpression = "*"; 14505 } 14506 14507 if ( jQuery.isFunction( func ) ) { 14508 var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), 14509 i = 0, 14510 length = dataTypes.length, 14511 dataType, 14512 list, 14513 placeBefore; 14514 14515 // For each dataType in the dataTypeExpression 14516 for(; i < length; i++ ) { 14517 dataType = dataTypes[ i ]; 14518 // We control if we're asked to add before 14519 // any existing element 14520 placeBefore = /^\+/.test( dataType ); 14521 if ( placeBefore ) { 14522 dataType = dataType.substr( 1 ) || "*"; 14523 } 14524 list = structure[ dataType ] = structure[ dataType ] || []; 14525 // then we add to the structure accordingly 14526 list[ placeBefore ? "unshift" : "push" ]( func ); 14527 } 14528 } 14529 }; 14530} 14531 14532//Base inspection function for prefilters and transports 14533function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, 14534 dataType /* internal */, inspected /* internal */ ) { 14535 14536 dataType = dataType || options.dataTypes[ 0 ]; 14537 inspected = inspected || {}; 14538 14539 inspected[ dataType ] = true; 14540 14541 var list = structure[ dataType ], 14542 i = 0, 14543 length = list ? list.length : 0, 14544 executeOnly = ( structure === prefilters ), 14545 selection; 14546 14547 for(; i < length && ( executeOnly || !selection ); i++ ) { 14548 selection = list[ i ]( options, originalOptions, jqXHR ); 14549 // If we got redirected to another dataType 14550 // we try there if executing only and not done already 14551 if ( typeof selection === "string" ) { 14552 if ( !executeOnly || inspected[ selection ] ) { 14553 selection = undefined; 14554 } else { 14555 options.dataTypes.unshift( selection ); 14556 selection = inspectPrefiltersOrTransports( 14557 structure, options, originalOptions, jqXHR, selection, inspected ); 14558 } 14559 } 14560 } 14561 // If we're only executing or nothing was selected 14562 // we try the catchall dataType if not done already 14563 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { 14564 selection = inspectPrefiltersOrTransports( 14565 structure, options, originalOptions, jqXHR, "*", inspected ); 14566 } 14567 // unnecessary when only executing (prefilters) 14568 // but it'll be ignored by the caller in that case 14569 return selection; 14570} 14571 14572jQuery.fn.extend({ 14573 load: function( url, params, callback ) { 14574 if ( typeof url !== "string" && _load ) { 14575 return _load.apply( this, arguments ); 14576 14577 // Don't do a request if no elements are being requested 14578 } else if ( !this.length ) { 14579 return this; 14580 } 14581 14582 var off = url.indexOf( " " ); 14583 if ( off >= 0 ) { 14584 var selector = url.slice( off, url.length ); 14585 url = url.slice( 0, off ); 14586 } 14587
vendor: 12,189 bytes, lines 14588-15055
14588 // Default to a GET request 14589 var type = "GET"; 14590 14591 // If the second parameter was provided 14592 if ( params ) { 14593 // If it's a function 14594 if ( jQuery.isFunction( params ) ) { 14595 // We assume that it's the callback 14596 callback = params; 14597 params = undefined; 14598 14599 // Otherwise, build a param string 14600 } else if ( typeof params === "object" ) { 14601 params = jQuery.param( params, jQuery.ajaxSettings.traditional ); 14602 type = "POST"; 14603 } 14604 } 14605 14606 var self = this; 14607 14608 // Request the remote document 14609 jQuery.ajax({ 14610 url: url, 14611 type: type, 14612 dataType: "html", 14613 data: params, 14614 // Complete callback (responseText is used internally) 14615 complete: function( jqXHR, status, responseText ) { 14616 // Store the response as specified by the jqXHR object 14617 responseText = jqXHR.responseText; 14618 // If successful, inject the HTML into all the matched elements 14619 if ( jqXHR.isResolved() ) { 14620 // #4825: Get the actual response in case 14621 // a dataFilter is present in ajaxSettings 14622 jqXHR.done(function( r ) { 14623 responseText = r; 14624 }); 14625 // See if a selector was specified 14626 self.html( selector ? 14627 // Create a dummy div to hold the results 14628 jQuery("<div>") 14629 // inject the contents of the document in, removing the scripts 14630 // to avoid any 'Permission Denied' errors in IE 14631 .append(responseText.replace(rscript, "")) 14632 14633 // Locate the specified elements 14634 .find(selector) : 14635 14636 // If not, just inject the full result 14637 responseText ); 14638 } 14639 14640 if ( callback ) { 14641 self.each( callback, [ responseText, status, jqXHR ] ); 14642 } 14643 } 14644 }); 14645 14646 return this; 14647 }, 14648 14649 serialize: function() { 14650 return jQuery.param( this.serializeArray() ); 14651 }, 14652 14653 serializeArray: function() { 14654 return this.map(function(){ 14655 return this.elements ? jQuery.makeArray( this.elements ) : this; 14656 }) 14657 .filter(function(){ 14658 return this.name && !this.disabled && 14659 ( this.checked || rselectTextarea.test( this.nodeName ) || 14660 rinput.test( this.type ) ); 14661 }) 14662 .map(function( i, elem ){ 14663 var val = jQuery( this ).val(); 14664 14665 return val == null ? 14666 null : 14667 jQuery.isArray( val ) ? 14668 jQuery.map( val, function( val, i ){ 14669 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 14670 }) : 14671 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 14672 }).get(); 14673 } 14674}); 14675 14676// Attach a bunch of functions for handling common AJAX events 14677jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ 14678 jQuery.fn[ o ] = function( f ){ 14679 return this.bind( o, f ); 14680 }; 14681} ); 14682 14683jQuery.each( [ "get", "post" ], function( i, method ) { 14684 jQuery[ method ] = function( url, data, callback, type ) { 14685 // shift arguments if data argument was omitted 14686 if ( jQuery.isFunction( data ) ) { 14687 type = type || callback; 14688 callback = data; 14689 data = undefined; 14690 } 14691 14692 return jQuery.ajax({ 14693 type: method, 14694 url: url, 14695 data: data, 14696 success: callback, 14697 dataType: type 14698 }); 14699 }; 14700} ); 14701 14702jQuery.extend({ 14703 14704 getScript: function( url, callback ) { 14705 return jQuery.get( url, undefined, callback, "script" ); 14706 }, 14707 14708 getJSON: function( url, data, callback ) { 14709 return jQuery.get( url, data, callback, "json" ); 14710 }, 14711 14712 // Creates a full fledged settings object into target 14713 // with both ajaxSettings and settings fields. 14714 // If target is omitted, writes into ajaxSettings. 14715 ajaxSetup: function ( target, settings ) { 14716 if ( !settings ) { 14717 // Only one parameter, we extend ajaxSettings 14718 settings = target; 14719 target = jQuery.extend( true, jQuery.ajaxSettings, settings ); 14720 } else { 14721 // target was provided, we extend into it 14722 jQuery.extend( true, target, jQuery.ajaxSettings, settings ); 14723 } 14724 // Flatten fields we don't want deep extended 14725 for( var field in { context: 1, url: 1 } ) { 14726 if ( field in settings ) { 14727 target[ field ] = settings[ field ]; 14728 } else if( field in jQuery.ajaxSettings ) { 14729 target[ field ] = jQuery.ajaxSettings[ field ]; 14730 } 14731 } 14732 return target; 14733 }, 14734 14735 ajaxSettings: { 14736 url: ajaxLocation, 14737 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 14738 global: true, 14739 type: "GET", 14740 contentType: "application/x-www-form-urlencoded", 14741 processData: true, 14742 async: true, 14743 /* 14744 timeout: 0, 14745 data: null, 14746 dataType: null, 14747 username: null, 14748 password: null, 14749 cache: null, 14750 traditional: false, 14751 headers: {}, 14752 */ 14753 14754 accepts: { 14755 xml: "application/xml, text/xml", 14756 html: "text/html", 14757 text: "text/plain", 14758 json: "application/json, text/javascript", 14759 "*": "*/*" 14760 }, 14761 14762 contents: { 14763 xml: /xml/, 14764 html: /html/, 14765 json: /json/ 14766 }, 14767 14768 responseFields: { 14769 xml: "responseXML", 14770 text: "responseText" 14771 }, 14772 14773 // List of data converters 14774 // 1) key format is "source_type destination_type" (a single space in-between) 14775 // 2) the catchall symbol "*" can be used for source_type 14776 converters: { 14777 14778 // Convert anything to text 14779 "* text": window.String, 14780 14781 // Text to html (true = no transformation) 14782 "text html": true, 14783 14784 // Evaluate text as a json expression 14785 "text json": jQuery.parseJSON, 14786 14787 // Parse text as xml 14788 "text xml": jQuery.parseXML 14789 } 14790 }, 14791 14792 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 14793 ajaxTransport: addToPrefiltersOrTransports( transports ), 14794 14795 // Main method 14796 ajax: function( url, options ) { 14797 14798 // If url is an object, simulate pre-1.5 signature 14799 if ( typeof url === "object" ) { 14800 options = url; 14801 url = undefined; 14802 } 14803 14804 // Force options to be an object 14805 options = options || {}; 14806 14807 var // Create the final options object 14808 s = jQuery.ajaxSetup( {}, options ), 14809 // Callbacks context 14810 callbackContext = s.context || s, 14811 // Context for global events 14812 // It's the callbackContext if one was provided in the options 14813 // and if it's a DOM node or a jQuery collection 14814 globalEventContext = callbackContext !== s && 14815 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? 14816 jQuery( callbackContext ) : jQuery.event, 14817 // Deferreds 14818 deferred = jQuery.Deferred(), 14819 completeDeferred = jQuery._Deferred(), 14820 // Status-dependent callbacks 14821 statusCode = s.statusCode || {}, 14822 // ifModified key 14823 ifModifiedKey, 14824 // Headers (they are sent all at once) 14825 requestHeaders = {}, 14826 // Response headers 14827 responseHeadersString, 14828 responseHeaders, 14829 // transport 14830 transport, 14831 // timeout handle 14832 timeoutTimer, 14833 // Cross-domain detection vars 14834 parts, 14835 // The jqXHR state 14836 state = 0, 14837 // To know if global events are to be dispatched 14838 fireGlobals, 14839 // Loop variable 14840 i, 14841 // Fake xhr 14842 jqXHR = { 14843 14844 readyState: 0, 14845 14846 // Caches the header 14847 setRequestHeader: function( name, value ) { 14848 if ( !state ) { 14849 requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value; 14850 } 14851 return this; 14852 }, 14853 14854 // Raw string 14855 getAllResponseHeaders: function() { 14856 return state === 2 ? responseHeadersString : null; 14857 }, 14858 14859 // Builds headers hashtable if needed 14860 getResponseHeader: function( key ) { 14861 var match; 14862 if ( state === 2 ) { 14863 if ( !responseHeaders ) { 14864 responseHeaders = {}; 14865 while( ( match = rheaders.exec( responseHeadersString ) ) ) { 14866 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; 14867 } 14868 } 14869 match = responseHeaders[ key.toLowerCase() ]; 14870 } 14871 return match === undefined ? null : match; 14872 }, 14873 14874 // Overrides response content-type header 14875 overrideMimeType: function( type ) { 14876 if ( !state ) { 14877 s.mimeType = type; 14878 } 14879 return this; 14880 }, 14881 14882 // Cancel the request 14883 abort: function( statusText ) { 14884 statusText = statusText || "abort"; 14885 if ( transport ) { 14886 transport.abort( statusText ); 14887 } 14888 done( 0, statusText ); 14889 return this; 14890 } 14891 }; 14892 14893 // Callback for when everything is done 14894 // It is defined here because jslint complains if it is declared 14895 // at the end of the function (which would be more logical and readable) 14896 function done( status, statusText, responses, headers ) { 14897 14898 // Called once 14899 if ( state === 2 ) { 14900 return; 14901 } 14902 14903 // State is "done" now 14904 state = 2; 14905 14906 // Clear timeout if it exists 14907 if ( timeoutTimer ) { 14908 clearTimeout( timeoutTimer ); 14909 } 14910 14911 // Dereference transport for early garbage collection 14912 // (no matter how long the jqXHR object will be used) 14913 transport = undefined; 14914 14915 // Cache response headers 14916 responseHeadersString = headers || ""; 14917 14918 // Set readyState 14919 jqXHR.readyState = status ? 4 : 0; 14920 14921 var isSuccess, 14922 success, 14923 error, 14924 response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, 14925 lastModified, 14926 etag; 14927 14928 // If successful, handle type chaining 14929 if ( status >= 200 && status < 300 || status === 304 ) { 14930 14931 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 14932 if ( s.ifModified ) { 14933 14934 if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { 14935 jQuery.lastModified[ ifModifiedKey ] = lastModified; 14936 } 14937 if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { 14938 jQuery.etag[ ifModifiedKey ] = etag; 14939 } 14940 } 14941 14942 // If not modified 14943 if ( status === 304 ) { 14944 14945 statusText = "notmodified"; 14946 isSuccess = true; 14947 14948 // If we have data 14949 } else { 14950 14951 try { 14952 success = ajaxConvert( s, response ); 14953 statusText = "success"; 14954 isSuccess = true; 14955 } catch(e) { 14956 // We have a parsererror 14957 statusText = "parsererror"; 14958 error = e; 14959 } 14960 } 14961 } else { 14962 // We extract error from statusText 14963 // then normalize statusText and status for non-aborts 14964 error = statusText; 14965 if( !statusText || status ) { 14966 statusText = "error"; 14967 if ( status < 0 ) { 14968 status = 0; 14969 } 14970 } 14971 } 14972 14973 // Set data for the fake xhr object 14974 jqXHR.status = status; 14975 jqXHR.statusText = statusText; 14976 14977 // Success/Error 14978 if ( isSuccess ) { 14979 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 14980 } else { 14981 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 14982 } 14983 14984 // Status-dependent callbacks 14985 jqXHR.statusCode( statusCode ); 14986 statusCode = undefined; 14987 14988 if ( fireGlobals ) { 14989 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), 14990 [ jqXHR, s, isSuccess ? success : error ] ); 14991 } 14992 14993 // Complete 14994 completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] ); 14995 14996 if ( fireGlobals ) { 14997 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] ); 14998 // Handle the global AJAX counter 14999 if ( !( --jQuery.active ) ) { 15000 jQuery.event.trigger( "ajaxStop" ); 15001 } 15002 } 15003 } 15004 15005 // Attach deferreds 15006 deferred.promise( jqXHR ); 15007 jqXHR.success = jqXHR.done; 15008 jqXHR.error = jqXHR.fail; 15009 jqXHR.complete = completeDeferred.done; 15010 15011 // Status-dependent callbacks 15012 jqXHR.statusCode = function( map ) { 15013 if ( map ) { 15014 var tmp; 15015 if ( state < 2 ) { 15016 for( tmp in map ) { 15017 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; 15018 } 15019 } else { 15020 tmp = map[ jqXHR.status ]; 15021 jqXHR.then( tmp, tmp ); 15022 } 15023 } 15024 return this; 15025 }; 15026 15027 // Remove hash character (#7531: and string promotion) 15028 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 15029 // We also use the url parameter if available 15030 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 15031 15032 // Extract dataTypes list 15033 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); 15034 15035 // Determine if a cross-domain request is in order 15036 if ( s.crossDomain == null ) { 15037 parts = rurl.exec( s.url.toLowerCase() ); 15038 s.crossDomain = !!( parts && 15039 ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || 15040 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != 15041 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) 15042 ); 15043 } 15044 15045 // Convert data if not already a string 15046 if ( s.data && s.processData && typeof s.data !== "string" ) { 15047 s.data = jQuery.param( s.data, s.traditional ); 15048 } 15049 15050 // Apply prefilters 15051 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 15052 15053 // If request was aborted inside a prefiler, stop there 15054 if ( state === 2 ) { 15055 return false;
15056 } 15057 15058 // We can fire global events as of now if asked to 15059 fireGlobals = s.global; 15060 15061 // Uppercase the type 15062 s.type = s.type.toUpperCase(); 15063 15064 // Determine if request has content 15065 s.hasContent = !rnoContent.test( s.type ); 15066 15067 // Watch for a new set of requests 15068 if ( fireGlobals && jQuery.active++ === 0 ) { 15069 jQuery.event.trigger( "ajaxStart" ); 15070 } 15071 15072 // More options handling for requests with no content 15073 if ( !s.hasContent ) { 15074 15075 // If data is available, append data to url 15076 if ( s.data ) { 15077 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; 15078 } 15079 15080 // Get ifModifiedKey before adding the anti-cache parameter 15081 ifModifiedKey = s.url; 15082 15083 // Add anti-cache in url if needed 15084 if ( s.cache === false ) { 15085 15086 var ts = jQuery.now(), 15087 // try replacing _= if it is there 15088 ret = s.url.replace( rts, "$1_=" + ts ); 15089 15090 // if nothing was replaced, add timestamp to the end 15091 s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); 15092 } 15093 } 15094 15095 // Set the correct header, if data is being sent 15096 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 15097 requestHeaders[ "Content-Type" ] = s.contentType; 15098 } 15099 15100 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 15101 if ( s.ifModified ) { 15102 ifModifiedKey = ifModifiedKey || s.url; 15103 if ( jQuery.lastModified[ ifModifiedKey ] ) { 15104 requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ]; 15105 } 15106 if ( jQuery.etag[ ifModifiedKey ] ) { 15107 requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ]; 15108 } 15109 } 15110 15111 // Set the Accepts header for the server, depending on the dataType 15112 requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? 15113 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : 15114 s.accepts[ "*" ]; 15115 15116 // Check for headers option 15117 for ( i in s.headers ) { 15118 jqXHR.setRequestHeader( i, s.headers[ i ] ); 15119 } 15120 15121 // Allow custom headers/mimetypes and early abort 15122 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 15123 // Abort if not done already 15124 jqXHR.abort(); 15125 return false; 15126 15127 } 15128 15129 // Install callbacks on deferreds 15130 for ( i in { success: 1, error: 1, complete: 1 } ) { 15131 jqXHR[ i ]( s[ i ] ); 15132 } 15133 15134 // Get transport 15135 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 15136 15137 // If no transport, we auto-abort 15138 if ( !transport ) { 15139 done( -1, "No Transport" ); 15140 } else { 15141 jqXHR.readyState = 1; 15142 // Send global event 15143 if ( fireGlobals ) { 15144 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 15145 } 15146 // Timeout 15147 if ( s.async && s.timeout > 0 ) { 15148 timeoutTimer = setTimeout( function(){ 15149 jqXHR.abort( "timeout" ); 15150 }, s.timeout ); 15151 } 15152 15153 try { 15154 state = 1; 15155 transport.send( requestHeaders, done ); 15156 } catch (e) { 15157 // Propagate exception as error if not done 15158 if ( status < 2 ) { 15159 done( -1, e ); 15160 // Simply rethrow otherwise 15161 } else { 15162 jQuery.error( e ); 15163 } 15164 } 15165 } 15166 15167 return jqXHR; 15168 }, 15169 15170 // Serialize an array of form elements or a set of 15171 // key/values into a query string 15172 param: function( a, traditional ) { 15173 var s = [], 15174 add = function( key, value ) { 15175 // If value is a function, invoke it and return its value 15176 value = jQuery.isFunction( value ) ? value() : value; 15177 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 15178 }; 15179 15180 // Set traditional to true for jQuery <= 1.3.2 behavior. 15181 if ( traditional === undefined ) { 15182 traditional = jQuery.ajaxSettings.traditional; 15183 } 15184 15185 // If an array was passed in, assume that it is an array of form elements. 15186 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 15187 // Serialize the form elements 15188 jQuery.each( a, function() { 15189 add( this.name, this.value ); 15190 } ); 15191 15192 } else { 15193 // If traditional, encode the "old" way (the way 1.3.2 or older 15194 // did it), otherwise encode params recursively. 15195 for ( var prefix in a ) { 15196 buildParams( prefix, a[ prefix ], traditional, add ); 15197 } 15198 } 15199 15200 // Return the resulting serialization 15201 return s.join( "&" ).replace( r20, "+" ); 15202 } 15203}); 15204 15205function buildParams( prefix, obj, traditional, add ) { 15206 if ( jQuery.isArray( obj ) && obj.length ) { 15207 // Serialize array item. 15208 jQuery.each( obj, function( i, v ) { 15209 if ( traditional || rbracket.test( prefix ) ) { 15210 // Treat each array item as a scalar. 15211 add( prefix, v ); 15212 15213 } else { 15214 // If array item is non-scalar (array or object), encode its 15215 // numeric index to resolve deserialization ambiguity issues. 15216 // Note that rack (as of 1.0.0) can't currently deserialize 15217 // nested arrays properly, and attempting to do so may cause 15218 // a server error. Possible fixes are to modify rack's 15219 // deserialization algorithm or to provide an option or flag 15220 // to force array serialization to be shallow. 15221 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); 15222 } 15223 }); 15224 15225 } else if ( !traditional && obj != null && typeof obj === "object" ) { 15226 // If we see an array here, it is empty and should be treated as an empty 15227 // object 15228 if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) { 15229 add( prefix, "" ); 15230 15231 // Serialize object item. 15232 } else { 15233 for ( var name in obj ) { 15234 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 15235 } 15236 } 15237 15238 } else { 15239 // Serialize scalar item. 15240 add( prefix, obj ); 15241 } 15242} 15243 15244// This is still on the jQuery object... for now 15245// Want to move this to jQuery.ajax some day 15246jQuery.extend({ 15247 15248 // Counter for holding the number of active queries 15249 active: 0, 15250 15251 // Last-Modified header cache for next request 15252 lastModified: {}, 15253 etag: {} 15254 15255}
15255); 15256 15257/* Handles responses to an ajax request: 15258 * - sets all responseXXX fields accordingly 15259 * - finds the right dataType (mediates between content-type and expected dataType) 15260 * - returns the corresponding response 15261 */ 15262function ajaxHandleResponses( s, jqXHR, responses ) { 15263 15264 var contents = s.contents, 15265 dataTypes = s.dataTypes, 15266 responseFields = s.responseFields, 15267 ct, 15268 type, 15269 finalDataType, 15270 firstDataType; 15271 15272 // Fill responseXXX fields 15273 for( type in responseFields ) { 15274 if ( type in responses ) { 15275 jqXHR[ responseFields[type] ] = responses[ type ]; 15276 } 15277 } 15278 15279 // Remove auto dataType and get content-type in the process 15280 while( dataTypes[ 0 ] === "*" ) { 15281 dataTypes.shift(); 15282 if ( ct === undefined ) { 15283 ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); 15284 } 15285 } 15286 15287 // Check if we're dealing with a known content-type 15288 if ( ct ) { 15289 for ( type in contents ) { 15290 if ( contents[ type ] && contents[ type ].test( ct ) ) { 15291 dataTypes.unshift( type ); 15292 break; 15293 } 15294 } 15295 } 15296 15297 // Check to see if we have a response for the expected dataType 15298 if ( dataTypes[ 0 ] in responses ) { 15299 finalDataType = dataTypes[ 0 ]; 15300 } else { 15301 // Try convertible dataTypes 15302 for ( type in responses ) { 15303 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 15304 finalDataType = type; 15305 break; 15306 } 15307 if ( !firstDataType ) { 15308 firstDataType = type; 15309 } 15310 } 15311 // Or just use first one 15312 finalDataType = finalDataType || firstDataType; 15313 } 15314 15315 // If we found a dataType 15316 // We add the dataType to the list if needed 15317 // and return the corresponding response 15318 if ( finalDataType ) { 15319 if ( finalDataType !== dataTypes[ 0 ] ) { 15320 dataTypes.unshift( finalDataType ); 15321 } 15322 return responses[ finalDataType ]; 15323 } 15324} 15325 15326// Chain conversions given the request and the original response 15327function ajaxConvert( s, response ) { 15328 15329 // Apply the dataFilter if provided 15330 if ( s.dataFilter ) { 15331 response = s.dataFilter( response, s.dataType ); 15332 } 15333 15334 var dataTypes = s.dataTypes, 15335 converters = {}, 15336 i, 15337 key, 15338 length = dataTypes.length, 15339 tmp, 15340 // Current and previous dataTypes 15341 current = dataTypes[ 0 ], 15342 prev, 15343 // Conversion expression 15344 conversion, 15345 // Conversion function 15346 conv, 15347 // Conversion functions (transitive conversion) 15348 conv1, 15349 conv2; 15350 15351 // For each dataType in the chain 15352 for( i = 1; i < length; i++ ) { 15353 15354 // Create converters map 15355 // with lowercased keys 15356 if ( i === 1 ) { 15357 for( key in s.converters ) { 15358 if( typeof key === "string" ) { 15359 converters[ key.toLowerCase() ] = s.converters[ key ]; 15360 } 15361 } 15362 } 15363 15364 // Get the dataTypes 15365 prev = current; 15366 current = dataTypes[ i ]; 15367 15368 // If current is auto dataType, update it to prev 15369 if( current === "*" ) { 15370 current = prev; 15371 // If no auto and dataTypes are actually different 15372 } else if ( prev !== "*" && prev !== current ) { 15373 15374 // Get the converter 15375 conversion = prev + " " + current; 15376 conv = converters[ conversion ] || converters[ "* " + current ]; 15377 15378 // If there is no direct converter, search transitively 15379 if ( !conv ) { 15380 conv2 = undefined; 15381 for( conv1 in converters ) { 15382 tmp = conv1.split( " " ); 15383 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { 15384 conv2 = converters[ tmp[1] + " " + current ]; 15385 if ( conv2 ) { 15386 conv1 = converters[ conv1 ]; 15387 if ( conv1 === true ) { 15388 conv = conv2; 15389 } else if ( conv2 === true ) { 15390 conv = conv1; 15391 } 15392 break; 15393 } 15394 } 15395 } 15396 } 15397 // If we found no converter, dispatch an error 15398 if ( !( conv || conv2 ) ) { 15399 jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); 15400 } 15401 // If found converter is not an equivalence 15402 if ( conv !== true ) { 15403 // Convert with 1 or 2 converters accordingly 15404 response = conv ? conv( response ) : conv2( conv1(response) ); 15405 } 15406 } 15407 } 15408 return response; 15409} 15410 15411 15412 15413 15414var jsc = jQuery.now(), 15415 jsre = /(\=)\?(&|$)|\?\?/i; 15416 15417// Default jsonp settings 15418jQuery.ajaxSetup({ 15419 jsonp: "callback", 15420 jsonpCallback: function() { 15421 return jQuery.expando + "_" + ( jsc++ ); 15422 } 15423}); 15424 15425// Detect, normalize options and install callbacks for jsonp requests 15426jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 15427 15428 var dataIsString = ( typeof s.data === "string" ); 15429 15430 if ( s.dataTypes[ 0 ] === "jsonp" || 15431 originalSettings.jsonpCallback || 15432 originalSettings.jsonp != null || 15433 s.jsonp !== false && ( jsre.test( s.url ) || 15434 dataIsString && jsre.test( s.data ) ) ) { 15435 15436 var responseContainer, 15437 jsonpCallback = s.jsonpCallback = 15438 jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, 15439 previous = window[ jsonpCallback ], 15440 url = s.url, 15441 data = s.data, 15442 replace = "$1" + jsonpCallback + "$2", 15443 cleanUp = function() { 15444 // Set callback back to previous value 15445 window[ jsonpCallback ] = previous; 15446 // Call if it was a function and we have a response 15447 if ( responseContainer && jQuery.isFunction( previous ) ) { 15448 window[ jsonpCallback ]( responseContainer[ 0 ] ); 15449 } 15450 }; 15451 15452 if ( s.jsonp !== false ) { 15453 url = url.replace( jsre, replace ); 15454 if ( s.url === url ) { 15455 if ( dataIsString ) { 15456 data = data.replace( jsre, replace ); 15457 } 15458 if ( s.data === data ) { 15459 // Add callback manually 15460 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; 15461 } 15462 } 15463 } 15464 15465 s.url = url; 15466 s.data = data; 15467 15468 // Install callback 15469 window[ jsonpCallback ] = function( response ) { 15470 responseContainer = [ response ]; 15471 }; 15472 15473 // Install cleanUp function 15474 jqXHR.then( cleanUp, cleanUp ); 15475 15476 // Use data converter to retrieve json after script execution 15477 s.converters["script json"] = function() { 15478 if ( !responseContainer ) { 15479 jQuery.error( jsonpCallback + " was not called" ); 15480 } 15481 return responseContainer[ 0 ]; 15482 }; 15483 15484 // force json dataType 15485 s.dataTypes[ 0 ] = "json"; 15486 15487 // Delegate to script 15488 return "script"; 15489 } 15490} ); 15491 15492 15493 15494 15495// Install script dataType 15496jQuery.ajaxSetup({ 15497 accepts: { 15498 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 15499 }, 15500 contents: { 15501 script: /javascript|ecmascript/ 15502 }, 15503 converters: { 15504 "text script": function( text ) { 15505 jQuery.globalEval( text ); 15506 return text; 15507 } 15508 } 15509}); 15510 15511// Handle cache's special case and global 15512jQuery.ajaxPrefilter( "script", function( s ) { 15513 if ( s.cache === undefined ) { 15514 s.cache = false;
15515 } 15516 if ( s.crossDomain ) { 15517 s.type = "GET"; 15518 s.global = false; 15519 } 15520} ); 15521 15522// Bind script tag hack transport 15523jQuery.ajaxTransport( "script", function(s) { 15524 15525 // This transport only deals with cross domain requests 15526 if ( s.crossDomain ) { 15527 15528 var script, 15529 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; 15530 15531 return { 15532 15533 send: function( _, callback ) { 15534 15535 script = document.createElement( "script" ); 15536 15537 script.async = "async"; 15538 15539 if ( s.scriptCharset ) { 15540 script.charset = s.scriptCharset; 15541 } 15542 15543 script.src = s.url; 15544 15545 // Attach handlers for all browsers 15546 script.onload = script.onreadystatechange = function( _, isAbort ) { 15547 15548 if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { 15549 15550 // Handle memory leak in IE 15551 script.onload = script.onreadystatechange = null; 15552 15553 // Remove the script 15554 if ( head && script.parentNode ) { 15555 head.removeChild( script ); 15556 } 15557 15558 // Dereference the script 15559 script = undefined; 15560 15561 // Callback if not abort 15562 if ( !isAbort ) { 15563 callback( 200, "success" ); 15564 } 15565 } 15566 }; 15567 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 15568 // This arises when a base node is used (#2709 and #4378). 15569 head.insertBefore( script, head.firstChild ); 15570 }, 15571 15572 abort: function() { 15573 if ( script ) { 15574 script.onload( 0, 1 ); 15575 } 15576 } 15577 }; 15578 } 15579} ); 15580 15581 15582 15583 15584var // #5280: next active xhr id and list of active xhrs' callbacks 15585 xhrId = jQuery.now(), 15586 xhrCallbacks, 15587 15588 // XHR used to determine supports properties 15589 testXHR; 15590 15591// #5280: Internet Explorer will keep connections alive if we don't abort on unload 15592function xhrOnUnloadAbort() { 15593 jQuery( window ).unload(function() { 15594 // Abort all pending requests 15595 for ( var key in xhrCallbacks ) { 15596 xhrCallbacks[ key ]( 0, 1 ); 15597 } 15598 }); 15599} 15600 15601// Functions to create xhrs 15602function createStandardXHR() { 15603 try { 15604 return new window.XMLHttpRequest(); 15605 } catch( e ) {} 15606} 15607 15608function createActiveXHR() { 15609 try { 15610 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 15611 } catch( e ) {} 15612} 15613 15614// Create the request object 15615// (This is still attached to ajaxSettings for backward compatibility) 15616jQuery.ajaxSettings.xhr = window.ActiveXObject ? 15617 /* Microsoft failed to properly 15618 * implement the XMLHttpRequest in IE7 (can't request local files), 15619 * so we use the ActiveXObject when it is available 15620 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so 15621 * we need a fallback. 15622 */ 15623 function() { 15624 return !this.isLocal && createStandardXHR() || createActiveXHR(); 15625 } : 15626 // For all other browsers, use the standard XMLHttpRequest object 15627 createStandardXHR; 15628 15629// Test if we can create an xhr object 15630testXHR = jQuery.ajaxSettings.xhr(); 15631jQuery.support.ajax = !!testXHR; 15632 15633// Does this browser support crossDomain XHR requests 15634jQuery.support.cors = testXHR && ( "withCredentials" in testXHR ); 15635 15636// No need for the temporary xhr anymore 15637testXHR = undefined; 15638 15639// Create transport if the browser can provide an xhr 15640if ( jQuery.support.ajax ) { 15641 15642 jQuery.ajaxTransport(function( s ) { 15643 // Cross domain only allowed if supported through XMLHttpRequest 15644 if ( !s.crossDomain || jQuery.support.cors ) { 15645 15646 var callback; 15647 15648 return { 15649 send: function( headers, complete ) { 15650 15651 // Get a new xhr 15652 var xhr = s.xhr(), 15653 handle, 15654 i; 15655 15656 // Open the socket 15657 // Passing null username, generates a login popup on Opera (#2865) 15658 if ( s.username ) { 15659 xhr.open( s.type, s.url, s.async, s.username, s.password ); 15660 } else { 15661 xhr.open( s.type, s.url, s.async ); 15662 } 15663 15664 // Apply custom fields if provided 15665 if ( s.xhrFields ) { 15666 for ( i in s.xhrFields ) { 15667 xhr[ i ] = s.xhrFields[ i ]; 15668 } 15669 } 15670 15671 // Override mime type if needed 15672 if ( s.mimeType && xhr.overrideMimeType ) { 15673 xhr.overrideMimeType( s.mimeType ); 15674 } 15675 15676 // X-Requested-With header 15677 // For cross-domain requests, seeing as conditions for a preflight are 15678 // akin to a jigsaw puzzle, we simply never set it to be sure. 15679 // (it can always be set on a per-request basis or even using ajaxSetup)
15680 // For same-domain requests, won't change header if already provided. 15681 if ( !s.crossDomain && !headers["X-Requested-With"] ) { 15682 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 15683 } 15684 15685 // Need an extra try/catch for cross domain requests in Firefox 3 15686 try { 15687 for ( i in headers ) { 15688 xhr.setRequestHeader( i, headers[ i ] ); 15689 } 15690 } catch( _ ) {} 15691 15692 // Do send the request 15693 // This may raise an exception which is actually 15694 // handled in jQuery.ajax (so no try/catch here) 15695 xhr.send( ( s.hasContent && s.data ) || null ); 15696 15697 // Listener 15698 callback = function( _, isAbort ) { 15699 15700 var status, 15701 statusText, 15702 responseHeaders, 15703 responses, 15704 xml; 15705 15706 // Firefox throws exceptions when accessing properties 15707 // of an xhr when a network error occured 15708 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) 15709 try { 15710 15711 // Was never called and is aborted or complete 15712 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 15713 15714 // Only called once 15715 callback = undefined; 15716 15717 // Do not keep as active anymore 15718 if ( handle ) { 15719 xhr.onreadystatechange = jQuery.noop; 15720 delete xhrCallbacks[ handle ]; 15721 } 15722 15723 // If it's an abort 15724 if ( isAbort ) { 15725 // Abort it manually if needed 15726 if ( xhr.readyState !== 4 ) { 15727 xhr.abort(); 15728 } 15729 } else { 15730 status = xhr.status; 15731 responseHeaders = xhr.getAllResponseHeaders(); 15732 responses = {}; 15733 xml = xhr.responseXML; 15734 15735 // Construct response list 15736 if ( xml && xml.documentElement /* #4958 */ ) { 15737 responses.xml = xml; 15738 } 15739 responses.text = xhr.responseText; 15740 15741 // Firefox throws an exception when accessing 15742 // statusText for faulty cross-domain requests 15743 try { 15744 statusText = xhr.statusText; 15745 } catch( e ) { 15746 // We normalize with Webkit giving an empty statusText 15747 statusText = ""; 15748 } 15749 15750 // Filter status for non standard behaviors 15751 15752 // If the request is local and we have data: assume a success 15753 // (success with no data won't get notified, that's the best we 15754 // can do given current implementations) 15755 if ( !status && s.isLocal && !s.crossDomain ) { 15756 status = responses.text ? 200 : 404; 15757 // IE - #1450: sometimes returns 1223 when it should be 204 15758 } else if ( status === 1223 ) { 15759 status = 204; 15760 } 15761 } 15762 } 15763 } catch( firefoxAccessException ) { 15764 if ( !isAbort ) { 15765 complete( -1, firefoxAccessException ); 15766 } 15767 } 15768 15769 // Call complete if needed 15770 if ( responses ) { 15771 complete( status, statusText, responses, responseHeaders ); 15772 } 15773 }; 15774 15775 // if we're in sync mode or it's in cache 15776 // and has been retrieved directly (IE6 & IE7) 15777 // we need to manually fire the callback 15778 if ( !s.async || xhr.readyState === 4 ) { 15779 callback(); 15780 } else { 15781 // Create the active xhrs callbacks list if needed 15782 // and attach the unload handler 15783 if ( !xhrCallbacks ) { 15784 xhrCallbacks = {}; 15785 xhrOnUnloadAbort(); 15786 } 15787 // Add to list of active xhrs callbacks 15788 handle = xhrId++; 15789 xhr.onreadystatechange = xhrCallbacks[ handle ] = callback; 15790 } 15791 }, 15792 15793 abort: function() { 15794 if ( callback ) { 15795 callback(0,1); 15796 } 15797 } 15798 }; 15799 } 15800 }); 15801} 15802 15803 15804 15805 15806var elemdisplay = {}, 15807 rfxtypes = /^(?:toggle|show|hide)$/, 15808 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, 15809 timerId, 15810 fxAttrs = [ 15811 // height animations 15812 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], 15813 // width animations 15814 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], 15815 // opacity animations 15816 [ "opacity" ] 15817 ]; 15818 15819jQuery.fn.extend({ 15820 show: function( speed, easing, callback ) { 15821 var elem, display; 15822 15823 if ( speed || speed === 0 ) { 15824 return this.animate( genFx("show", 3), speed, easing, callback); 15825 15826 } else { 15827 for ( var i = 0, j = this.length; i < j; i++ ) { 15828 elem = this[i]; 15829 display = elem.style.display; 15830 15831 // Reset the inline display of this element to learn if it is 15832 // being hidden by cascaded rules or not 15833 if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { 15834 display = elem.style.display = ""; 15835 } 15836 15837 // Set elements which have been overridden with display: none 15838 // in a stylesheet to whatever the default browser style is 15839 // for such an element
15840 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { 15841 jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); 15842 } 15843 } 15844 15845 // Set the display of most of the elements in a second loop 15846 // to avoid the constant reflow 15847 for ( i = 0; i < j; i++ ) { 15848 elem = this[i]; 15849 display = elem.style.display; 15850 15851 if ( display === "" || display === "none" ) { 15852 elem.style.display = jQuery._data(elem, "olddisplay") || ""; 15853 } 15854 } 15855 15856 return this; 15857 } 15858 }, 15859 15860 hide: function( speed, easing, callback ) { 15861 if ( speed || speed === 0 ) { 15862 return this.animate( genFx("hide", 3), speed, easing, callback); 15863 15864 } else { 15865 for ( var i = 0, j = this.length; i < j; i++ ) { 15866 var display = jQuery.css( this[i], "display" ); 15867 15868 if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { 15869 jQuery._data( this[i], "olddisplay", display ); 15870 } 15871 } 15872 15873 // Set the display of the elements in a second loop 15874 // to avoid the constant reflow 15875 for ( i = 0; i < j; i++ ) { 15876 this[i].style.display = "none"; 15877 } 15878 15879 return this; 15880 } 15881 }, 15882 15883 // Save the old toggle function 15884 _toggle: jQuery.fn.toggle, 15885 15886 toggle: function( fn, fn2, callback ) { 15887 var bool = typeof fn === "boolean"; 15888 15889 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { 15890 this._toggle.apply( this, arguments ); 15891 15892 } else if ( fn == null || bool ) { 15893 this.each(function() { 15894 var state = bool ? fn : jQuery(this).is(":hidden"); 15895 jQuery(this)[ state ? "show" : "hide" ](); 15896 }); 15897 15898 } else { 15899 this.animate(genFx("toggle", 3), fn, fn2, callback); 15900 } 15901 15902 return this; 15903 }, 15904 15905 fadeTo: function( speed, to, easing, callback ) { 15906 return this.filter(":hidden").css("opacity", 0).show().end() 15907 .animate({opacity: to}, speed, easing, callback); 15908 }, 15909 15910 animate: function( prop, speed, easing, callback ) { 15911 var optall = jQuery.speed(speed, easing, callback); 15912 15913 if ( jQuery.isEmptyObject( prop ) ) { 15914 return this.each( optall.complete ); 15915 } 15916 15917 return this[ optall.queue === false ? "each" : "queue" ](function() { 15918 // XXX 'this' does not always have a nodeName when running the 15919 // test suite 15920 15921 var opt = jQuery.extend({}, optall), p, 15922 isElement = this.nodeType === 1, 15923 hidden = isElement && jQuery(this).is(":hidden"), 15924 self = this; 15925 15926 for ( p in prop ) { 15927 var name = jQuery.camelCase( p ); 15928 15929 if ( p !== name ) { 15930 prop[ name ] = prop[ p ]; 15931 delete prop[ p ]; 15932 p = name; 15933 } 15934 15935 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { 15936 return opt.complete.call(this); 15937 } 15938 15939 if ( isElement && ( p === "height" || p === "width" ) ) { 15940 // Make sure that nothing sneaks out 15941 // Record all 3 overflow attributes because IE does not 15942 // change the overflow attribute when overflowX and 15943 // overflowY are set to the same value 15944 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; 15945 15946 // Set display property to inline-block for height/width 15947 // animations on inline elements that are having width/height 15948 // animated 15949 if ( jQuery.css( this, "display" ) === "inline" && 15950 jQuery.css( this, "float" ) === "none" ) { 15951 if ( !jQuery.support.inlineBlockNeedsLayout ) { 15952 this.style.display = "inline-block"; 15953 15954 } else { 15955 var display = defaultDisplay(this.nodeName); 15956 15957 // inline-level elements accept inline-block; 15958 // block-level elements need to be inline with layout 15959 if ( display === "inline" ) { 15960 this.style.display = "inline-block"; 15961 15962 } else { 15963 this.style.display = "inline"; 15964 this.style.zoom = 1; 15965 } 15966 } 15967 } 15968 } 15969 15970 if ( jQuery.isArray( prop[p] ) ) { 15971 // Create (if needed) and add to specialEasing 15972 (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; 15973 prop[p] = prop[p][0]; 15974 } 15975 } 15976 15977 if ( opt.overflow != null ) { 15978 this.style.overflow = "hidden"; 15979 } 15980 15981 opt.curAnim = jQuery.extend({}, prop); 15982 15983 jQuery.each( prop, function( name, val ) { 15984 var e = new jQuery.fx( self, opt, name ); 15985 15986 if ( rfxtypes.test(val) ) { 15987 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 15988 15989 } else { 15990 var parts = rfxnum.exec(val), 15991 start = e.cur(); 15992 15993 if ( parts ) { 15994 var end = parseFloat( parts[2] ), 15995 unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" ); 15996 15997 // We need to compute starting value 15998 if ( unit !== "px" ) {
vendor: 15,692 bytes, lines 15999-16579
15999 jQuery.style( self, name, (end || 1) + unit); 16000 start = ((end || 1) / e.cur()) * start; 16001 jQuery.style( self, name, start + unit); 16002 } 16003 16004 // If a +=/-= token was provided, we're doing a relative animation 16005 if ( parts[1] ) { 16006 end = ((parts[1] === "-=" ? -1 : 1) * end) + start; 16007 } 16008 16009 e.custom( start, end, unit ); 16010 16011 } else { 16012 e.custom( start, val, "" ); 16013 } 16014 } 16015 }); 16016 16017 // For JS strict compliance 16018 return true; 16019 }); 16020 }, 16021 16022 stop: function( clearQueue, gotoEnd ) { 16023 var timers = jQuery.timers; 16024 16025 if ( clearQueue ) { 16026 this.queue([]); 16027 } 16028 16029 this.each(function() { 16030 // go in reverse order so anything added to the queue during the loop is ignored 16031 for ( var i = timers.length - 1; i >= 0; i-- ) { 16032 if ( timers[i].elem === this ) { 16033 if (gotoEnd) { 16034 // force the next step to be the last 16035 timers[i](true); 16036 } 16037 16038 timers.splice(i, 1); 16039 } 16040 } 16041 }); 16042 16043 // start the next in the queue if the last step wasn't forced 16044 if ( !gotoEnd ) { 16045 this.dequeue(); 16046 } 16047 16048 return this; 16049 } 16050 16051}); 16052 16053function genFx( type, num ) { 16054 var obj = {}; 16055 16056 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { 16057 obj[ this ] = type; 16058 }); 16059 16060 return obj; 16061} 16062 16063// Generate shortcuts for custom animations 16064jQuery.each({ 16065 slideDown: genFx("show", 1), 16066 slideUp: genFx("hide", 1), 16067 slideToggle: genFx("toggle", 1), 16068 fadeIn: { opacity: "show" }, 16069 fadeOut: { opacity: "hide" }, 16070 fadeToggle: { opacity: "toggle" } 16071}, function( name, props ) { 16072 jQuery.fn[ name ] = function( speed, easing, callback ) { 16073 return this.animate( props, speed, easing, callback ); 16074 }; 16075}); 16076 16077jQuery.extend({ 16078 speed: function( speed, easing, fn ) { 16079 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 16080 complete: fn || !fn && easing || 16081 jQuery.isFunction( speed ) && speed, 16082 duration: speed, 16083 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing 16084 }; 16085 16086 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 16087 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; 16088 16089 // Queueing 16090 opt.old = opt.complete; 16091 opt.complete = function() { 16092 if ( opt.queue !== false ) { 16093 jQuery(this).dequeue(); 16094 } 16095 if ( jQuery.isFunction( opt.old ) ) { 16096 opt.old.call( this ); 16097 } 16098 }; 16099 16100 return opt; 16101 }, 16102 16103 easing: { 16104 linear: function( p, n, firstNum, diff ) { 16105 return firstNum + diff * p; 16106 }, 16107 swing: function( p, n, firstNum, diff ) { 16108 return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; 16109 } 16110 }, 16111 16112 timers: [], 16113 16114 fx: function( elem, options, prop ) { 16115 this.options = options; 16116 this.elem = elem; 16117 this.prop = prop; 16118 16119 if ( !options.orig ) { 16120 options.orig = {}; 16121 } 16122 } 16123 16124}); 16125 16126jQuery.fx.prototype = { 16127 // Simple function for setting a style value 16128 update: function() { 16129 if ( this.options.step ) { 16130 this.options.step.call( this.elem, this.now, this ); 16131 } 16132 16133 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); 16134 }, 16135 16136 // Get the current size 16137 cur: function() { 16138 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { 16139 return this.elem[ this.prop ]; 16140 } 16141 16142 var parsed, 16143 r = jQuery.css( this.elem, this.prop ); 16144 // Empty strings, null, undefined and "auto" are converted to 0, 16145 // complex values such as "rotate(1rad)" are returned as is, 16146 // simple values such as "10px" are parsed to Float. 16147 return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; 16148 }, 16149 16150 // Start an animation from one number to another 16151 custom: function( from, to, unit ) { 16152 var self = this, 16153 fx = jQuery.fx; 16154 16155 this.startTime = jQuery.now(); 16156 this.start = from; 16157 this.end = to; 16158 this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); 16159 this.now = this.start; 16160 this.pos = this.state = 0; 16161 16162 function t( gotoEnd ) { 16163 return self.step(gotoEnd); 16164 } 16165 16166 t.elem = this.elem; 16167 16168 if ( t() && jQuery.timers.push(t) && !timerId ) { 16169 timerId = setInterval(fx.tick, fx.interval); 16170 } 16171 }, 16172 16173 // Simple 'show' function 16174 show: function() { 16175 // Remember where we started, so that we can go back to it later 16176 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); 16177 this.options.show = true; 16178 16179 // Begin the animation 16180 // Make sure that we start at a small width/height to avoid any 16181 // flash of content 16182 this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); 16183 16184 // Start by showing the element 16185 jQuery( this.elem ).show(); 16186 }, 16187 16188 // Simple 'hide' function 16189 hide: function() { 16190 // Remember where we started, so that we can go back to it later 16191 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); 16192 this.options.hide = true; 16193 16194 // Begin the animation 16195 this.custom(this.cur(), 0); 16196 }, 16197 16198 // Each step of an animation 16199 step: function( gotoEnd ) { 16200 var t = jQuery.now(), done = true; 16201 16202 if ( gotoEnd || t >= this.options.duration + this.startTime ) { 16203 this.now = this.end; 16204 this.pos = this.state = 1; 16205 this.update(); 16206 16207 this.options.curAnim[ this.prop ] = true; 16208 16209 for ( var i in this.options.curAnim ) { 16210 if ( this.options.curAnim[i] !== true ) { 16211 done = false; 16212 } 16213 } 16214 16215 if ( done ) { 16216 // Reset the overflow 16217 if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { 16218 var elem = this.elem, 16219 options = this.options; 16220 16221 jQuery.each( [ "", "X", "Y" ], function (index, value) { 16222 elem.style[ "overflow" + value ] = options.overflow[index]; 16223 } ); 16224 } 16225 16226 // Hide the element if the "hide" operation was done 16227 if ( this.options.hide ) { 16228 jQuery(this.elem).hide(); 16229 } 16230 16231 // Reset the properties, if the item has been hidden or shown 16232 if ( this.options.hide || this.options.show ) { 16233 for ( var p in this.options.curAnim ) { 16234 jQuery.style( this.elem, p, this.options.orig[p] ); 16235 } 16236 } 16237 16238 // Execute the complete function 16239 this.options.complete.call( this.elem ); 16240 } 16241 16242 return false; 16243 16244 } else { 16245 var n = t - this.startTime; 16246 this.state = n / this.options.duration; 16247 16248 // Perform the easing function, defaults to swing 16249 var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; 16250 var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); 16251 this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); 16252 this.now = this.start + ((this.end - this.start) * this.pos); 16253 16254 // Perform the next step of the animation 16255 this.update(); 16256 } 16257 16258 return true; 16259 } 16260}; 16261 16262jQuery.extend( jQuery.fx, { 16263 tick: function() { 16264 var timers = jQuery.timers; 16265 16266 for ( var i = 0; i < timers.length; i++ ) { 16267 if ( !timers[i]() ) { 16268 timers.splice(i--, 1); 16269 } 16270 } 16271 16272 if ( !timers.length ) { 16273 jQuery.fx.stop(); 16274 } 16275 }, 16276 16277 interval: 13, 16278 16279 stop: function() { 16280 clearInterval( timerId ); 16281 timerId = null; 16282 }, 16283 16284 speeds: { 16285 slow: 600, 16286 fast: 200, 16287 // Default speed 16288 _default: 400 16289 }, 16290 16291 step: { 16292 opacity: function( fx ) { 16293 jQuery.style( fx.elem, "opacity", fx.now ); 16294 }, 16295 16296 _default: function( fx ) { 16297 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { 16298 fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; 16299 } else { 16300 fx.elem[ fx.prop ] = fx.now; 16301 } 16302 } 16303 } 16304}); 16305 16306if ( jQuery.expr && jQuery.expr.filters ) { 16307 jQuery.expr.filters.animated = function( elem ) { 16308 return jQuery.grep(jQuery.timers, function( fn ) { 16309 return elem === fn.elem; 16310 }).length; 16311 }; 16312} 16313 16314function defaultDisplay( nodeName ) { 16315 if ( !elemdisplay[ nodeName ] ) { 16316 var elem = jQuery("<" + nodeName + ">").appendTo("body"), 16317 display = elem.css("display"); 16318 16319 elem.remove(); 16320 16321 if ( display === "none" || display === "" ) { 16322 display = "block"; 16323 } 16324 16325 elemdisplay[ nodeName ] = display; 16326 } 16327 16328 return elemdisplay[ nodeName ]; 16329} 16330 16331 16332 16333 16334var rtable = /^t(?:able|d|h)$/i, 16335 rroot = /^(?:body|html)$/i; 16336 16337if ( "getBoundingClientRect" in document.documentElement ) { 16338 jQuery.fn.offset = function( options ) { 16339 var elem = this[0], box; 16340 16341 if ( options ) { 16342 return this.each(function( i ) { 16343 jQuery.offset.setOffset( this, options, i ); 16344 }); 16345 } 16346 16347 if ( !elem || !elem.ownerDocument ) { 16348 return null; 16349 } 16350 16351 if ( elem === elem.ownerDocument.body ) { 16352 return jQuery.offset.bodyOffset( elem ); 16353 } 16354 16355 try { 16356 box = elem.getBoundingClientRect(); 16357 } catch(e) {} 16358 16359 var doc = elem.ownerDocument, 16360 docElem = doc.documentElement; 16361 16362 // Make sure we're not dealing with a disconnected DOM node 16363 if ( !box || !jQuery.contains( docElem, elem ) ) { 16364 return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; 16365 } 16366 16367 var body = doc.body, 16368 win = getWindow(doc), 16369 clientTop = docElem.clientTop || body.clientTop || 0, 16370 clientLeft = docElem.clientLeft || body.clientLeft || 0, 16371 scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, 16372 scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, 16373 top = box.top + scrollTop - clientTop, 16374 left = box.left + scrollLeft - clientLeft; 16375 16376 return { top: top, left: left }; 16377 }; 16378 16379} else { 16380 jQuery.fn.offset = function( options ) { 16381 var elem = this[0]; 16382 16383 if ( options ) { 16384 return this.each(function( i ) { 16385 jQuery.offset.setOffset( this, options, i ); 16386 }); 16387 } 16388 16389 if ( !elem || !elem.ownerDocument ) { 16390 return null; 16391 } 16392 16393 if ( elem === elem.ownerDocument.body ) { 16394 return jQuery.offset.bodyOffset( elem ); 16395 } 16396 16397 jQuery.offset.initialize(); 16398 16399 var computedStyle, 16400 offsetParent = elem.offsetParent, 16401 prevOffsetParent = elem, 16402 doc = elem.ownerDocument, 16403 docElem = doc.documentElement, 16404 body = doc.body, 16405 defaultView = doc.defaultView, 16406 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, 16407 top = elem.offsetTop, 16408 left = elem.offsetLeft; 16409 16410 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { 16411 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { 16412 break; 16413 } 16414 16415 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; 16416 top -= elem.scrollTop; 16417 left -= elem.scrollLeft; 16418 16419 if ( elem === offsetParent ) { 16420 top += elem.offsetTop; 16421 left += elem.offsetLeft; 16422 16423 if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { 16424 top += parseFloat( computedStyle.borderTopWidth ) || 0; 16425 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 16426 } 16427 16428 prevOffsetParent = offsetParent; 16429 offsetParent = elem.offsetParent; 16430 } 16431 16432 if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { 16433 top += parseFloat( computedStyle.borderTopWidth ) || 0; 16434 left += parseFloat( computedStyle.borderLeftWidth ) || 0; 16435 } 16436 16437 prevComputedStyle = computedStyle; 16438 } 16439 16440 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { 16441 top += body.offsetTop; 16442 left += body.offsetLeft; 16443 } 16444 16445 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { 16446 top += Math.max( docElem.scrollTop, body.scrollTop ); 16447 left += Math.max( docElem.scrollLeft, body.scrollLeft ); 16448 } 16449 16450 return { top: top, left: left }; 16451 }; 16452} 16453 16454jQuery.offset = { 16455 initialize: function() { 16456 var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0, 16457 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>"; 16458 16459 jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); 16460 16461 container.innerHTML = html; 16462 body.insertBefore( container, body.firstChild ); 16463 innerDiv = container.firstChild; 16464 checkDiv = innerDiv.firstChild; 16465 td = innerDiv.nextSibling.firstChild.firstChild; 16466 16467 this.doesNotAddBorder = (checkDiv.offsetTop !== 5); 16468 this.doesAddBorderForTableAndCells = (td.offsetTop === 5); 16469 16470 checkDiv.style.position = "fixed"; 16471 checkDiv.style.top = "20px"; 16472 16473 // safari subtracts parent border width here which is 5px 16474 this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); 16475 checkDiv.style.position = checkDiv.style.top = ""; 16476 16477 innerDiv.style.overflow = "hidden"; 16478 innerDiv.style.position = "relative"; 16479 16480 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); 16481 16482 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); 16483 16484 body.removeChild( container ); 16485 jQuery.offset.initialize = jQuery.noop; 16486 }, 16487 16488 bodyOffset: function( body ) { 16489 var top = body.offsetTop, 16490 left = body.offsetLeft; 16491 16492 jQuery.offset.initialize(); 16493 16494 if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { 16495 top += parseFloat( jQuery.css(body, "marginTop") ) || 0; 16496 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; 16497 } 16498 16499 return { top: top, left: left }; 16500 }, 16501 16502 setOffset: function( elem, options, i ) { 16503 var position = jQuery.css( elem, "position" ); 16504 16505 // set position first, in-case top/left are set even on static elem 16506 if ( position === "static" ) { 16507 elem.style.position = "relative"; 16508 } 16509 16510 var curElem = jQuery( elem ), 16511 curOffset = curElem.offset(), 16512 curCSSTop = jQuery.css( elem, "top" ), 16513 curCSSLeft = jQuery.css( elem, "left" ), 16514 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1, 16515 props = {}, curPosition = {}, curTop, curLeft; 16516 16517 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed 16518 if ( calculatePosition ) { 16519 curPosition = curElem.position(); 16520 } 16521 16522 curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; 16523 curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; 16524 16525 if ( jQuery.isFunction( options ) ) { 16526 options = options.call( elem, i, curOffset ); 16527 } 16528 16529 if (options.top != null) { 16530 props.top = (options.top - curOffset.top) + curTop; 16531 } 16532 if (options.left != null) { 16533 props.left = (options.left - curOffset.left) + curLeft; 16534 } 16535 16536 if ( "using" in options ) { 16537 options.using.call( elem, props ); 16538 } else { 16539 curElem.css( props ); 16540 } 16541 } 16542}; 16543 16544 16545jQuery.fn.extend({ 16546 position: function() { 16547 if ( !this[0] ) { 16548 return null; 16549 } 16550 16551 var elem = this[0], 16552 16553 // Get *real* offsetParent 16554 offsetParent = this.offsetParent(), 16555 16556 // Get correct offsets 16557 offset = this.offset(), 16558 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); 16559 16560 // Subtract element margins 16561 // note: when an element has margin: auto the offsetLeft and marginLeft 16562 // are the same in Safari causing offset.left to incorrectly be 0 16563 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; 16564 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; 16565 16566 // Add offsetParent borders 16567 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; 16568 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; 16569 16570 // Subtract the two offsets 16571 return { 16572 top: offset.top - parentOffset.top, 16573 left: offset.left - parentOffset.left 16574 }; 16575 }, 16576 16577 offsetParent: function() { 16578 return this.map(function() { 16579 var offsetParent = this.offsetParent || document.body;
16580 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { 16581 offsetParent = offsetParent.offsetParent; 16582 } 16583 return offsetParent; 16584 }); 16585 } 16586}); 16587 16588 16589// Create scrollLeft and scrollTop methods 16590jQuery.each( ["Left", "Top"], function( i, name ) { 16591 var method = "scroll" + name; 16592 16593 jQuery.fn[ method ] = function(val) { 16594 var elem = this[0], win; 16595 16596 if ( !elem ) { 16597 return null; 16598 } 16599 16600 if ( val !== undefined ) { 16601 // Set the scroll offset 16602 return this.each(function() { 16603 win = getWindow( this ); 16604 16605 if ( win ) { 16606 win.scrollTo( 16607 !i ? val : jQuery(win).scrollLeft(), 16608 i ? val : jQuery(win).scrollTop() 16609 ); 16610 16611 } else { 16612 this[ method ] = val; 16613 } 16614 }); 16615 } else { 16616 win = getWindow( elem ); 16617 16618 // Return the scroll offset 16619 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : 16620 jQuery.support.boxModel && win.document.documentElement[ method ] || 16621 win.document.body[ method ] : 16622 elem[ method ]; 16623 } 16624 }; 16625}); 16626 16627function getWindow( elem ) { 16628 return jQuery.isWindow( elem ) ? 16629 elem : 16630 elem.nodeType === 9 ? 16631 elem.defaultView || elem.parentWindow : 16632 false; 16633} 16634 16635 16636 16637 16638// Create innerHeight, innerWidth, outerHeight and outerWidth methods 16639jQuery.each([ "Height", "Width" ], function( i, name ) { 16640 16641 var type = name.toLowerCase(); 16642 16643 // innerHeight and innerWidth 16644 jQuery.fn["inner" + name] = function() { 16645 return this[0] ? 16646 parseFloat( jQuery.css( this[0], type, "padding" ) ) : 16647 null; 16648 }; 16649 16650 // outerHeight and outerWidth 16651 jQuery.fn["outer" + name] = function( margin ) { 16652 return this[0] ? 16653 parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) : 16654 null; 16655 }; 16656 16657 jQuery.fn[ type ] = function( size ) { 16658 // Get window width or height 16659 var elem = this[0]; 16660 if ( !elem ) { 16661 return size == null ? null : this; 16662 } 16663 16664 if ( jQuery.isFunction( size ) ) { 16665 return this.each(function( i ) { 16666 var self = jQuery( this ); 16667 self[ type ]( size.call( this, i, self[ type ]() ) ); 16668 }); 16669 } 16670 16671 if ( jQuery.isWindow( elem ) ) { 16672 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode 16673 // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat 16674 var docElemProp = elem.document.documentElement[ "client" + name ]; 16675 return elem.document.compatMode === "CSS1Compat" && docElemProp || 16676 elem.document.body[ "client" + name ] || docElemProp; 16677 16678 // Get document width or height 16679 } else if ( elem.nodeType === 9 ) { 16680 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 16681 return Math.max( 16682 elem.documentElement["client" + name], 16683 elem.body["scroll" + name], elem.documentElement["scroll" + name], 16684 elem.body["offset" + name], elem.documentElement["offset" + name] 16685 ); 16686 16687 // Get or set width or height on the element 16688 } else if ( size === undefined ) { 16689 var orig = jQuery.css( elem, type ), 16690 ret = parseFloat( orig ); 16691 16692 return jQuery.isNaN( ret ) ? orig : ret; 16693 16694 // Set the width or height on the element (default to pixels if value is unitless) 16695 } else { 16696 return this.css( type, typeof size === "string" ? size : size + "px" ); 16697 } 16698 }; 16699 16700}); 16701 16702 16703window.jQuery = window.$ = jQuery; 16704})(window); 16705 } 16706 16707 if ( jQuery.isFunction( size ) ) { 16708 return this.each(function( i ) { 16709 var self = jQuery( this ); 16710 self[ type ]( size.call( this, i, self[ type ]() ) ); 16711 }); 16712 } 16713 16714 if ( jQuery.isWindow( elem ) ) { 16715 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode 16716 // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat 16717 var docElemProp = elem.document.documentElement[ "client" + name ]; 16718 return elem.document.compatMode === "CSS1Compat" && docElemProp || 16719 elem.document.body[ "client" + name ] || docElemProp; 16720 16721 // Get document width or height 16722 } else if ( elem.nodeType === 9 ) { 16723 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 16724 return Math.max( 16725 elem.documentElement["client" + name], 16726 elem.body["scroll" + name], elem.documentElement["scroll" + name], 16727 elem.body["offset" + name], elem.documentElement["offset" + name] 16728 ); 16729 16730 // Get or set width or height on the element 16731 } else if ( size === undefined ) { 16732 var orig = jQuery.css( elem, type ), 16733 ret = parseFloat( orig ); 16734 16735 return jQuery.isNaN( ret ) ? orig : ret; 16736 16737 // Set the width or height on the element (default to pixels if value is unitless) 16738 } else { 16739 return this.css( type, typeof size === "string" ? size : size + "px" ); 16740 } 16741 }; 16742 16743}); 16744 16745 16746window.jQuery = window.$ = jQuery; 16747})(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.