1(function(){ 2/* 3 * jQuery 1.2.6 - New Wave Javascript 4 * 5 * Copyright (c) 2008 John Resig (jquery.com) 6 * Dual licensed under the MIT (MIT-LICENSE.txt) 7 * and GPL (GPL-LICENSE.txt) licenses. 8 * 9 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ 10 * $Rev: 5685 $ 11 */ 12 13// Map over jQuery in case of overwrite 14var _jQuery = window.jQuery, 15// Map over the $ in case of overwrite 16 _$ = window.$; 17 18var jQuery = window.jQuery = window.$ = function( selector, context ) { 19 // The jQuery object is actually just the init constructor 'enhanced' 20 return new jQuery.fn.init( selector, context ); 21}; 22 23// A simple way to check for HTML strings or ID strings 24// (both of which we optimize for) 25var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, 26 27// Is it a simple selector 28 isSimple = /^.[^:#\[\.]*$/, 29 30// Will speed up references to undefined, and allows munging its name. 31 undefined; 32 33jQuery.fn = jQuery.prototype = { 34 init: function( selector, context ) { 35 // Make sure that a selection was provided 36 selector = selector || document; 37 38 // Handle $(DOMElement) 39 if ( selector.nodeType ) { 40 this[0] = selector; 41 this.length = 1; 42 return this; 43 } 44 // Handle HTML strings 45 if ( typeof selector == "string" ) { 46 // Are we dealing with HTML string or an ID? 47 var match = quickExpr.exec( selector ); 48 49 // Verify a match, and that no context was specified for #id 50 if ( match && (match[1] || !context) ) { 51 52 // HANDLE: $(html) -> $(array) 53 if ( match[1] ) 54 selector = jQuery.clean( [ match[1] ], context ); 55 56 // HANDLE: $("#id") 57 else { 58 var elem = document.getElementById( match[3] ); 59 60 // Make sure an element was located 61 if ( elem ){ 62 // Handle the case where IE and Opera return items 63 // by name instead of ID 64 if ( elem.id != match[3] ) 65 return jQuery().find( selector ); 66 67 // Otherwise, we inject the element directly into the jQuery object 68 return jQuery( elem ); 69 } 70 selector = []; 71 } 72 73 // HANDLE: $(expr, [context]) 74 // (which is just equivalent to: $(content).find(expr) 75 } else 76 return jQuery( context ).find( selector ); 77 78 // HANDLE: $(function) 79 // Shortcut for document ready 80 } else if ( jQuery.isFunction( selector ) ) 81 return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 82 83 return this.setArray(jQuery.makeArray(selector)); 84 }, 85 86 // The current version of jQuery being used 87 jquery: "1.2.6", 88 89 // The number of elements contained in the matched element set 90 size: function() { 91 return this.length; 92 }, 93 94 // The number of elements contained in the matched element set 95 length: 0, 96 97 // Get the Nth element in the matched element set OR 98 // Get the whole matched element set as a clean array 99 get: function( num ) { 100 return num == undefined ? 101 102 // Return a 'clean' array 103 jQuery.makeArray( this ) : 104 105 // Return just the object 106 this[ num ]; 107 }, 108 109 // Take an array of elements and push it onto the stack 110 // (returning the new matched element set) 111 pushStack: function( elems ) { 112 // Build a new jQuery matched element set 113 var ret = jQuery( elems ); 114 115 // Add the old object onto the stack (as a reference) 116 ret.prevObject = this; 117 118 // Return the newly-formed element set 119 return ret; 120 }, 121 122 // Force the current matched set of elements to become 123 // the specified array of elements (destroying the stack in the process) 124 // You should use pushStack() in order to do this, but maintain the stack 125 setArray: function( elems ) { 126 // Resetting the length to 0, then using the native Array push 127 // is a super-fast way to populate an object with array-like properties 128 this.length = 0; 129 Array.prototype.push.apply( this, elems ); 130 131 return this; 132 }, 133 134 // Execute a callback for every element in the matched set. 135 // (You can seed the arguments with an array of args, but this is 136 // only used internally.) 137 each: function( callback, args ) { 138 return jQuery.each( this, callback, args ); 139 }, 140 141 // Determine the position of an element within 142 // the matched set of elements 143 index: function( elem ) { 144 var ret = -1; 145 146 // Locate the position of the desired element 147 return jQuery.inArray( 148 // If it receives a jQuery object, the first element is used 149 elem && elem.jquery ? elem[0] : elem 150 , this ); 151 }, 152 153 attr: function( name, value, type ) { 154 var options = name; 155 156 // Look for the case where we're accessing a style value 157 if ( name.constructor == String ) 158 if ( value === undefined ) 159 return this[0] && jQuery[ type || "attr" ]( this[0], name ); 160 161 else { 162 options = {}; 163 options[ name ] = value; 164 } 165 166 // Check to see if we're setting style values 167 return this.each(function(i){ 168 // Set all the styles 169 for ( name in options ) 170 jQuery.attr( 171 type ? 172 this.style : 173 this, 174 name, jQuery.prop( this, options[ name ], type, i, name ) 175 ); 176 }); 177 }, 178 179 css: function( key, value ) { 180 // ignore negative width and height values 181 if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) 182 value = undefined; 183 return this.attr( key, value, "curCSS" ); 184 }, 185 186 text: function( text ) { 187 if ( typeof text != "object" && text != null ) 188 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 189 190 var ret = ""; 191 192 jQuery.each( text || this, function(){ 193 jQuery.each( this.childNodes, function(){ 194 if ( this.nodeType != 8 ) 195 ret += this.nodeType != 1 ? 196 this.nodeValue : 197 jQuery.fn.text( [ this ] ); 198 }); 199 }); 200 201 return ret; 202 }, 203 204 wrapAll: function( html ) { 205 if ( this[0] ) 206 // The elements to wrap the target around 207 jQuery( html, this[0].ownerDocument ) 208 .clone() 209 .insertBefore( this[0] ) 210 .map(function(){ 211 var elem = this; 212 213 while ( elem.firstChild ) 214 elem = elem.firstChild; 215 216 return elem; 217 }) 218 .append(this); 219 220 return this; 221 }, 222 223 wrapInner: function( html ) { 224 return this.each(function(){ 225 jQuery( this ).contents().wrapAll( html ); 226 }); 227 }, 228 229 wrap: function( html ) { 230 return this.each(function(){ 231 jQuery( this ).wrapAll( html ); 232 }); 233 }, 234 235 append: function() { 236 return this.domManip(arguments, true, false, function(elem){ 237 if (this.nodeType == 1) 238 this.appendChild( elem ); 239 }); 240 }, 241
242 prepend: function() { 243 return this.domManip(arguments, true, true, function(elem){ 244 if (this.nodeType == 1) 245 this.insertBefore( elem, this.firstChild ); 246 }); 247 }, 248 249 before: function() { 250 return this.domManip(arguments, false, false, function(elem){ 251 this.parentNode.insertBefore( elem, this ); 252 }); 253 }, 254 255 after: function() { 256 return this.domManip(arguments, false, true, function(elem){ 257 this.parentNode.insertBefore( elem, this.nextSibling ); 258 }); 259 }, 260 261 end: function() { 262 return this.prevObject || jQuery( [] ); 263 }, 264 265 find: function( selector ) { 266 var elems = jQuery.map(this, function(elem){ 267 return jQuery.find( selector, elem ); 268 }); 269 270 return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? 271 jQuery.unique( elems ) : 272 elems ); 273 }, 274 275 clone: function( events ) { 276 // Do the clone 277 var ret = this.map(function(){ 278 if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { 279 // IE copies events bound via attachEvent when 280 // using cloneNode. Calling detachEvent on the 281 // clone will also remove the events from the orignal 282 // In order to get around this, we use innerHTML. 283 // Unfortunately, this means some modifications to 284 // attributes in IE that are actually only stored 285 // as properties will not be copied (such as the 286 // the name attribute on an input). 287 var clone = this.cloneNode(true), 288 container = document.createElement("div"); 289 container.appendChild(clone); 290 return jQuery.clean([container.innerHTML])[0]; 291 } else 292 return this.cloneNode(true); 293 }); 294 295 // Need to set the expando to null on the cloned set if it exists 296 // removeData doesn't work here, IE removes it from the original as well 297 // this is primarily for IE but the data expando shouldn't be copied over in any browser 298 var clone = ret.find("*").andSelf().each(function(){ 299 if ( this[ expando ] != undefined ) 300 this[ expando ] = null; 301 }); 302 303 // Copy the events from the original to the clone 304 if ( events === true ) 305 this.find("*").andSelf().each(function(i){ 306 if (this.nodeType == 3) 307 return; 308 var events = jQuery.data( this, "events" ); 309 310 for ( var type in events ) 311 for ( var handler in events[ type ] ) 312 jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); 313 }); 314 315 // Return the cloned set 316 return ret; 317 }, 318 319 filter: function( selector ) { 320 return this.pushStack( 321 jQuery.isFunction( selector ) && 322 jQuery.grep(this, function(elem, i){ 323 return selector.call( elem, i ); 324 }) || 325 326 jQuery.multiFilter( selector, this ) ); 327 }, 328 329 not: function( selector ) { 330 if ( selector.constructor == String ) 331 // test special case where just one selector is passed in 332 if ( isSimple.test( selector ) ) 333 return this.pushStack( jQuery.multiFilter( selector, this, true ) ); 334 else 335 selector = jQuery.multiFilter( selector, this ); 336 337 var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; 338 return this.filter(function() { 339 return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; 340 }); 341 }, 342 343 add: function( selector ) { 344 return this.pushStack( jQuery.unique( jQuery.merge( 345 this.get(), 346 typeof selector == 'string' ? 347 jQuery( selector ) : 348 jQuery.makeArray( selector ) 349 ))); 350 }, 351 352 is: function( selector ) { 353 return !!selector && jQuery.multiFilter( selector, this ).length > 0; 354 }, 355 356 hasClass: function( selector ) { 357 return this.is( "." + selector ); 358 }, 359 360 val: function( value ) { 361 if ( value == undefined ) { 362 363 if ( this.length ) { 364 var elem = this[0]; 365 366 // We need to handle select boxes special 367 if ( jQuery.nodeName( elem, "select" ) ) { 368 var index = elem.selectedIndex, 369 values = [], 370 options = elem.options, 371 one = elem.type == "select-one"; 372 373 // Nothing was selected 374 if ( index < 0 ) 375 return null; 376 377 // Loop through all the selected options 378 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { 379 var option = options[ i ]; 380 381 if ( option.selected ) { 382 // Get the specifc value for the option 383 value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; 384 385 // We don't need an array for one selects 386 if ( one ) 387 return value; 388 389 // Multi-Selects return an array 390 values.push( value ); 391 } 392 } 393 394 return values; 395 396 // Everything else, we just grab the value 397 } else 398 return (this[0].value || "").replace(/\r/g, ""); 399 400 } 401 402 return undefined; 403 } 404 405 if( value.constructor == Number ) 406 value += ''; 407 408 return this.each(function(){ 409 if ( this.nodeType != 1 ) 410 return; 411 412 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 413 this.checked = (jQuery.inArray(this.value, value) >= 0 || 414 jQuery.inArray(this.name, value) >= 0); 415 416 else if ( jQuery.nodeName( this, "select" ) ) { 417 var values = jQuery.makeArray(value); 418 419 jQuery( "option", this ).each(function(){ 420 this.selected = (jQuery.inArray( this.value, values ) >= 0 || 421 jQuery.inArray( this.text, values ) >= 0); 422 }); 423 424 if ( !values.length ) 425 this.selectedIndex = -1; 426 427 } else 428 this.value = value; 429 }); 430 }, 431 432 html: function( value ) { 433 return value == undefined ? 434 (this[0] ? 435 this[0].innerHTML : 436 null) : 437 this.empty().append( value ); 438 }, 439 440 replaceWith: function( value ) { 441 return this.after( value ).remove(); 442 }, 443 444 eq: function( i ) { 445 return this.slice( i, i + 1 ); 446 }, 447 448 slice: function() { 449 return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); 450 }, 451 452 map: function( callback ) { 453 return this.pushStack( jQuery.map(this, function(elem, i){ 454 return callback.call( elem, i, elem ); 455 })); 456 }, 457 458 andSelf: function() { 459 return this.add( this.prevObject ); 460 }, 461 462 data: function( key, value ){ 463 var parts = key.split("."); 464 parts[1] = parts[1] ? "." + parts[1] : ""; 465 466 if ( value === undefined ) { 467 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 468 469 if ( data === undefined && this.length ) 470 data = jQuery.data( this[0], key ); 471 472 return data === undefined && parts[1] ? 473 this.data( parts[0] ) : 474 data; 475 } else 476 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ 477 jQuery.data( this, key, value ); 478 }); 479 }, 480 481 removeData: function( key ){ 482 return this.each(function(){ 483 jQuery.removeData( this, key ); 484 }); 485 }, 486 487 domManip: function( args, table, reverse, callback ) { 488 var clone = this.length > 1, elems; 489 490 return this.each(function(){ 491 if ( !elems ) { 492 elems = jQuery.clean( args, this.ownerDocument ); 493 494 if ( reverse ) 495 elems.reverse(); 496 } 497 498 var obj = this; 499 500 if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) 501 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); 502 503 var scripts = jQuery( [] ); 504 505 jQuery.each(elems, function(){ 506 var elem = clone ? 507 jQuery( this ).clone( true )[0] : 508 this; 509 510 // execute all scripts after the elements have been injected 511 if ( jQuery.nodeName( elem, "script" ) ) 512 scripts = scripts.add( elem ); 513 else { 514 // Remove any inner scripts for later evaluation 515 if ( elem.nodeType == 1 )
516 scripts = scripts.add( jQuery( "script", elem ).remove() ); 517 518 // Inject the elements into the document 519 callback.call( obj, elem ); 520 } 521 }); 522 523 scripts.each( evalScript ); 524 }); 525 } 526}; 527 528// Give the init function the jQuery prototype for later instantiation 529jQuery.fn.init.prototype = jQuery.fn; 530 531function evalScript( i, elem ) { 532 if ( elem.src ) 533 jQuery.ajax({ 534 url: elem.src, 535 async: false, 536 dataType: "script" 537 }); 538 539 else 540 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 541 542 if ( elem.parentNode ) 543 elem.parentNode.removeChild( elem ); 544} 545 546function now(){ 547 return +new Date; 548} 549 550jQuery.extend = jQuery.fn.extend = function() { 551 // copy reference to target object 552 var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; 553 554 // Handle a deep copy situation 555 if ( target.constructor == Boolean ) { 556 deep = target; 557 target = arguments[1] || {}; 558 // skip the boolean and the target 559 i = 2; 560 } 561 562 // Handle case when target is a string or something (possible in deep copy) 563 if ( typeof target != "object" && typeof target != "function" ) 564 target = {}; 565 566 // extend jQuery itself if only one argument is passed 567 if ( length == i ) { 568 target = this; 569 --i; 570 } 571 572 for ( ; i < length; i++ ) 573 // Only deal with non-null/undefined values 574 if ( (options = arguments[ i ]) != null ) 575 // Extend the base object 576 for ( var name in options ) { 577 var src = target[ name ], copy = options[ name ]; 578 579 // Prevent never-ending loop 580 if ( target === copy ) 581 continue; 582 583 // Recurse if we're merging object values 584 if ( deep && copy && typeof copy == "object" && !copy.nodeType ) 585 target[ name ] = jQuery.extend( deep, 586 // Never move original objects, clone them 587 src || ( copy.length != null ? [ ] : { } ) 588 , copy ); 589 590 // Don't bring in undefined values 591 else if ( copy !== undefined ) 592 target[ name ] = copy; 593 594 } 595 596 // Return the modified object 597 return target; 598}; 599 600var expando = "jQuery" + now(), uuid = 0, windowData = {}, 601 // exclude the following css properties to add px 602 exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, 603 // cache defaultView 604 defaultView = document.defaultView || {}; 605 606jQuery.extend({ 607 noConflict: function( deep ) { 608 window.$ = _$; 609 610 if ( deep ) 611 window.jQuery = _jQuery; 612 613 return jQuery; 614 }, 615 616 // See test/unit/core.js for details concerning this function. 617 isFunction: function( fn ) { 618 return !!fn && typeof fn != "string" && !fn.nodeName && 619 fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); 620 }, 621 622 // check if an element is in a (or is an) XML document 623 isXMLDoc: function( elem ) { 624 return elem.documentElement && !elem.body || 625 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 626 }, 627 628 // Evalulates a script in a global context 629 globalEval: function( data ) { 630 data = jQuery.trim( data ); 631 632 if ( data ) { 633 // Inspired by code by Andrea Giammarchi 634 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html 635 var head = document.getElementsByTagName("head")[0] || document.documentElement, 636 script = document.createElement("script"); 637 638 script.type = "text/javascript"; 639 if ( jQuery.browser.msie ) 640 script.text = data; 641 else 642 script.appendChild( document.createTextNode( data ) ); 643 644 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 645 // This arises when a base node is used (#2709).
646 head.insertBefore( script, head.firstChild ); 647 head.removeChild( script ); 648 } 649 }, 650 651 nodeName: function( elem, name ) { 652 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); 653 }, 654 655 cache: {}, 656 657 data: function( elem, name, data ) { 658 elem = elem == window ? 659 windowData : 660 elem; 661 662 var id = elem[ expando ]; 663 664 // Compute a unique ID for the element 665 if ( !id ) 666 id = elem[ expando ] = ++uuid; 667 668 // Only generate the data cache if we're 669 // trying to access or manipulate it 670 if ( name && !jQuery.cache[ id ] ) 671 jQuery.cache[ id ] = {}; 672 673 // Prevent overriding the named cache with undefined values 674 if ( data !== undefined ) 675 jQuery.cache[ id ][ name ] = data; 676 677 // Return the named cache data, or the ID for the element 678 return name ? 679 jQuery.cache[ id ][ name ] : 680 id; 681 }, 682 683 removeData: function( elem, name ) { 684 elem = elem == window ? 685 windowData : 686 elem; 687 688 var id = elem[ expando ]; 689 690 // If we want to remove a specific section of the element's data 691 if ( name ) { 692 if ( jQuery.cache[ id ] ) { 693 // Remove the section of cache data 694 delete jQuery.cache[ id ][ name ]; 695 696 // If we've removed all the data, remove the element's cache 697 name = ""; 698 699 for ( name in jQuery.cache[ id ] ) 700 break; 701 702 if ( !name ) 703 jQuery.removeData( elem ); 704 } 705 706 // Otherwise, we want to remove all of the element's data 707 } else { 708 // Clean up the element expando 709 try { 710 delete elem[ expando ]; 711 } catch(e){ 712 // IE has trouble directly removing the expando 713 // but it's ok with using removeAttribute 714 if ( elem.removeAttribute ) 715 elem.removeAttribute( expando ); 716 } 717 718 // Completely remove the data cache 719 delete jQuery.cache[ id ]; 720 } 721 }, 722 723 // args is for internal usage only 724 each: function( object, callback, args ) { 725 var name, i = 0, length = object.length; 726 727 if ( args ) { 728 if ( length == undefined ) { 729 for ( name in object ) 730 if ( callback.apply( object[ name ], args ) === false ) 731 break; 732 } else 733 for ( ; i < length; ) 734 if ( callback.apply( object[ i++ ], args ) === false ) 735 break; 736 737 // A special, fast, case for the most common use of each 738 } else { 739 if ( length == undefined ) { 740 for ( name in object ) 741 if ( callback.call( object[ name ], name, object[ name ] ) === false ) 742 break; 743 } else 744 for ( var value = object[0]; 745 i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} 746 } 747 748 return object; 749 }, 750 751 prop: function( elem, value, type, i, name ) { 752 // Handle executable functions 753 if ( jQuery.isFunction( value ) ) 754 value = value.call( elem, i ); 755 756 // Handle passing in a number to a CSS property 757 return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? 758 value + "px" : 759 value; 760 }, 761 762 className: { 763 // internal only, use addClass("class") 764 add: function( elem, classNames ) { 765 jQuery.each((classNames || "").split(/\s+/), function(i, className){ 766 if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) 767 elem.className += (elem.className ? " " : "") + className; 768 }); 769 }, 770 771 // internal only, use removeClass("class") 772 remove: function( elem, classNames ) { 773 if (elem.nodeType == 1) 774 elem.className = classNames != undefined ? 775 jQuery.grep(elem.className.split(/\s+/), function(className){ 776 return !jQuery.className.has( classNames, className ); 777 }).join(" ") : 778 ""; 779 }, 780 781 // internal only, use hasClass("class") 782 has: function( elem, className ) { 783 return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; 784 } 785 }, 786 787 // A method for quickly swapping in/out CSS properties to get correct calculations 788 swap: function( elem, options, callback ) { 789 var old = {}; 790 // Remember the old values, and insert the new ones 791 for ( var name in options ) { 792 old[ name ] = elem.style[ name ]; 793 elem.style[ name ] = options[ name ]; 794 } 795 796 callback.call( elem ); 797 798 // Revert the old values 799 for ( var name in options ) 800 elem.style[ name ] = old[ name ]; 801 }, 802 803 css: function( elem, name, force ) { 804 if ( name == "width" || name == "height" ) { 805 var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; 806 807 function getWH() { 808 val = name == "width" ? elem.offsetWidth : elem.offsetHeight; 809 var padding = 0, border = 0; 810 jQuery.each( which, function() { 811 padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; 812 border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; 813 }); 814 val -= Math.round(padding + border); 815 } 816 817 if ( jQuery(elem).is(":visible") ) 818 getWH(); 819 else 820 jQuery.swap( elem, props, getWH ); 821 822 return Math.max(0, val); 823 } 824 825 return jQuery.curCSS( elem, name, force ); 826 }, 827 828 curCSS: function( elem, name, force ) { 829 var ret, style = elem.style; 830 831 // A helper method for determining if an element's values are broken 832 function color( elem ) { 833 if ( !jQuery.browser.safari ) 834 return false;
835 836 // defaultView is cached 837 var ret = defaultView.getComputedStyle( elem, null ); 838 return !ret || ret.getPropertyValue("color") == ""; 839 } 840 841 // We need to handle opacity special in IE 842 if ( name == "opacity" && jQuery.browser.msie ) { 843 ret = jQuery.attr( style, "opacity" ); 844 845 return ret == "" ? 846 "1" : 847 ret; 848 } 849 // Opera sometimes will give the wrong display answer, this fixes it, see #2037 850 if ( jQuery.browser.opera && name == "display" ) { 851 var save = style.outline; 852 style.outline = "0 solid black"; 853 style.outline = save; 854 } 855 856 // Make sure we're using the right name for getting the float value 857 if ( name.match( /float/i ) ) 858 name = styleFloat; 859 860 if ( !force && style && style[ name ] ) 861 ret = style[ name ]; 862 863 else if ( defaultView.getComputedStyle ) { 864 865 // Only "float" is needed here 866 if ( name.match( /float/i ) ) 867 name = "float"; 868 869 name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); 870 871 var computedStyle = defaultView.getComputedStyle( elem, null ); 872 873 if ( computedStyle && !color( elem ) ) 874 ret = computedStyle.getPropertyValue( name ); 875 876 // If the element isn't reporting its values properly in Safari 877 // then some display: none elements are involved 878 else { 879 var swap = [], stack = [], a = elem, i = 0; 880 881 // Locate all of the parent display: none elements 882 for ( ; a && color(a); a = a.parentNode ) 883 stack.unshift(a); 884 885 // Go through and make them visible, but in reverse 886 // (It would be better if we knew the exact display type that they had) 887 for ( ; i < stack.length; i++ ) 888 if ( color( stack[ i ] ) ) { 889 swap[ i ] = stack[ i ].style.display; 890 stack[ i ].style.display = "block"; 891 } 892 893 // Since we flip the display style, we have to handle that 894 // one special, otherwise get the value 895 ret = name == "display" && swap[ stack.length - 1 ] != null ? 896 "none" : 897 ( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; 898 899 // Finally, revert the display styles back 900 for ( i = 0; i < swap.length; i++ ) 901 if ( swap[ i ] != null ) 902 stack[ i ].style.display = swap[ i ]; 903 } 904 905 // We should always get a number back from opacity 906 if ( name == "opacity" && ret == "" ) 907 ret = "1"; 908 909 } else if ( elem.currentStyle ) { 910 var camelCase = name.replace(/\-(\w)/g, function(all, letter){ 911 return letter.toUpperCase(); 912 }); 913 914 ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; 915 916 // From the awesome hack by Dean Edwards 917 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 918 919 // If we're not dealing with a regular pixel number 920 // but a number that has a weird ending, we need to convert it to pixels 921 if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { 922 // Remember the original values 923 var left = style.left, rsLeft = elem.runtimeStyle.left; 924 925 // Put in the new values to get a computed value out 926 elem.runtimeStyle.left = elem.currentStyle.left; 927 style.left = ret || 0; 928 ret = style.pixelLeft + "px"; 929 930 // Revert the changed values 931 style.left = left; 932 elem.runtimeStyle.left = rsLeft; 933 } 934 } 935 936 return ret; 937 }, 938 939 clean: function( elems, context ) { 940 var ret = []; 941 context = context || document; 942 // !context.createElement fails in IE with an error but returns typeof 'object' 943 if (typeof context.createElement == 'undefined') 944 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 945 946 jQuery.each(elems, function(i, elem){ 947 if ( !elem ) 948 return; 949 950 if ( elem.constructor == Number ) 951 elem += ''; 952 953 // Convert html string into DOM nodes 954 if ( typeof elem == "string" ) { 955 // Fix "XHTML"-style tags in all browsers 956 elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ 957 return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? 958 all : 959 front + "></" + tag + ">"; 960 }); 961 962 // Trim whitespace, otherwise indexOf won't work as expected 963 var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); 964 965 var wrap = 966 // option or optgroup 967 !tags.indexOf("<opt") && 968 [ 1, "<select multiple='multiple'>", "</select>" ] || 969 970 !tags.indexOf("<leg") && 971 [ 1, "<fieldset>", "</fieldset>" ] || 972 973 tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && 974 [ 1, "<table>", "</table>" ] || 975 976 !tags.indexOf("<tr") && 977 [ 2, "<table><tbody>", "</tbody></table>" ] || 978 979 // <thead> matched above 980 (!tags.indexOf("<td") || !tags.indexOf("<th")) && 981 [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || 982 983 !tags.indexOf("<col") && 984 [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || 985 986 // IE can't serialize <link> and <script> tags normally 987 jQuery.browser.msie && 988 [ 1, "div<div>", "</div>" ] || 989 990 [ 0, "", "" ]; 991 992 // Go to html and back, then peel off extra wrappers 993 div.innerHTML = wrap[1] + elem + wrap[2]; 994 995 // Move to the right depth 996 while ( wrap[0]-- )
997 div = div.lastChild; 998 999 // Remove IE's autoinserted <tbody> from table fragments 1000 if ( jQuery.browser.msie ) { 1001 1002 // String was a <table>, *may* have spurious <tbody> 1003 var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? 1004 div.firstChild && div.firstChild.childNodes : 1005 1006 // String was a bare <thead> or <tfoot> 1007 wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? 1008 div.childNodes : 1009 []; 1010 1011 for ( var j = tbody.length - 1; j >= 0 ; --j ) 1012 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) 1013 tbody[ j ].parentNode.removeChild( tbody[ j ] ); 1014 1015 // IE completely kills leading whitespace when innerHTML is used 1016 if ( /^\s/.test( elem ) ) 1017 div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); 1018 1019 } 1020 1021 elem = jQuery.makeArray( div.childNodes ); 1022 } 1023 1024 if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) ) 1025 return; 1026 1027 if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options ) 1028 ret.push( elem ); 1029 1030 else 1031 ret = jQuery.merge( ret, elem ); 1032 1033 }); 1034 1035 return ret; 1036 }, 1037 1038 attr: function( elem, name, value ) { 1039 // don't set attributes on text and comment nodes 1040 if (!elem || elem.nodeType == 3 || elem.nodeType == 8) 1041 return undefined; 1042 1043 var notxml = !jQuery.isXMLDoc( elem ), 1044 // Whether we are setting (or getting) 1045 set = value !== undefined, 1046 msie = jQuery.browser.msie; 1047 1048 // Try to normalize/fix the name 1049 name = notxml && jQuery.props[ name ] || name; 1050 1051 // Only do all the following if this is a node (faster for style) 1052 // IE elem.getAttribute passes even for style 1053 if ( elem.tagName ) { 1054 1055 // These attributes require special treatment 1056 var special = /href|src|style/.test( name ); 1057 1058 // Safari mis-reports the default selected property of a hidden option 1059 // Accessing the parent's selectedIndex property fixes it 1060 if ( name == "selected" && jQuery.browser.safari ) 1061 elem.parentNode.selectedIndex; 1062 1063 // If applicable, access the attribute via the DOM 0 way 1064 if ( name in elem && notxml && !special ) { 1065 if ( set ){ 1066 // We can't allow the type property to be changed (since it causes problems in IE) 1067 if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) 1068 throw "type property can't be changed"; 1069 1070 if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) 1071 elem.setAttribute( name, "" + value ); 1072 else 1073 elem[ name ] = value; 1074 } 1075 1076 // browsers index elements by id/name on forms, give priority to attributes. 1077 if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) 1078 return elem.getAttributeNode( name ).nodeValue; 1079 1080 return elem[ name ]; 1081 } 1082 1083 if ( msie && notxml && name == "style" ) 1084 return jQuery.attr( elem.style, "cssText", value ); 1085 1086 if ( set ) 1087 // convert the value to a string (all browsers do this but IE) see #1070 1088 elem.setAttribute( name, "" + value ); 1089 1090 var attr = msie && notxml && special 1091 // Some attributes require a special call on IE 1092 ? elem.getAttribute( name, 2 ) 1093 : elem.getAttribute( name ); 1094 1095 // Non-existent attributes return null, we normalize to undefined 1096 return attr === null ? undefined : attr; 1097 } 1098 1099 // elem is actually elem.style ... set the style 1100 1101 // IE uses filters for opacity 1102 if ( msie && name == "opacity" ) { 1103 if ( set ) { 1104 // IE has trouble with opacity if it does not have layout 1105 // Force it by setting the zoom level 1106 elem.zoom = 1; 1107 1108 // Set the alpha filter to set the opacity 1109 elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + 1110 (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); 1111 } 1112 1113 return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? 1114 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': 1115 ""; 1116 } 1117 1118 name = name.replace(/-([a-z])/ig, function(all, letter){ 1119 return letter.toUpperCase(); 1120 }); 1121 1122 if ( set ) 1123 elem[ name ] = value; 1124 1125 return elem[ name ]; 1126 }, 1127 1128 trim: function( text ) { 1129 return (text || "").replace( /^\s+|\s+$/g, "" ); 1130 }, 1131 1132 makeArray: function( array ) { 1133 var ret = []; 1134 1135 if( array != null ){ 1136 var i = array.length; 1137 //the window, strings and functions also have 'length'
1138 if( i == null || array.split || array.setInterval || array.call ) 1139 ret[0] = array; 1140 else 1141 while( i ) 1142 ret[--i] = array[i]; 1143 } 1144 1145 return ret; 1146 }, 1147 1148 inArray: function( elem, array ) { 1149 for ( var i = 0, length = array.length; i < length; i++ ) 1150 // Use === because on IE, window == document 1151 if ( array[ i ] === elem ) 1152 return i; 1153 1154 return -1; 1155 }, 1156 1157 merge: function( first, second ) { 1158 // We have to loop this way because IE & Opera overwrite the length 1159 // expando of getElementsByTagName 1160 var i = 0, elem, pos = first.length; 1161 // Also, we need to make sure that the correct elements are being returned 1162 // (IE returns comment nodes in a '*' query) 1163 if ( jQuery.browser.msie ) { 1164 while ( elem = second[ i++ ] ) 1165 if ( elem.nodeType != 8 ) 1166 first[ pos++ ] = elem; 1167 1168 } else 1169 while ( elem = second[ i++ ] ) 1170 first[ pos++ ] = elem; 1171 1172 return first; 1173 }, 1174 1175 unique: function( array ) { 1176 var ret = [], done = {}; 1177 1178 try { 1179 1180 for ( var i = 0, length = array.length; i < length; i++ ) { 1181 var id = jQuery.data( array[ i ] ); 1182 1183 if ( !done[ id ] ) { 1184 done[ id ] = true; 1185 ret.push( array[ i ] ); 1186 } 1187 } 1188 1189 } catch( e ) { 1190 ret = array; 1191 } 1192 1193 return ret; 1194 }, 1195 1196 grep: function( elems, callback, inv ) { 1197 var ret = []; 1198 1199 // Go through the array, only saving the items 1200 // that pass the validator function 1201 for ( var i = 0, length = elems.length; i < length; i++ ) 1202 if ( !inv != !callback( elems[ i ], i ) ) 1203 ret.push( elems[ i ] ); 1204 1205 return ret; 1206 }, 1207 1208 map: function( elems, callback ) { 1209 var ret = []; 1210 1211 // Go through the array, translating each of the items to their 1212 // new value (or values). 1213 for ( var i = 0, length = elems.length; i < length; i++ ) { 1214 var value = callback( elems[ i ], i ); 1215 1216 if ( value != null ) 1217 ret[ ret.length ] = value; 1218 } 1219 1220 return ret.concat.apply( [], ret ); 1221 } 1222}); 1223 1224var userAgent = navigator.userAgent.toLowerCase(); 1225 1226// Figure out what browser is being used 1227jQuery.browser = { 1228 version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], 1229 safari: /webkit/.test( userAgent ), 1230 opera: /opera/.test( userAgent ), 1231 msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), 1232 mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) 1233}; 1234 1235var styleFloat = jQuery.browser.msie ? 1236 "styleFloat" : 1237 "cssFloat"; 1238 1239jQuery.extend({ 1240 // Check to see if the W3C box model is being used 1241 boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", 1242 1243 props: { 1244 "for": "htmlFor", 1245 "class": "className", 1246 "float": styleFloat, 1247 cssFloat: styleFloat, 1248 styleFloat: styleFloat, 1249 readonly: "readOnly", 1250 maxlength: "maxLength", 1251 cellspacing: "cellSpacing" 1252 } 1253}); 1254 1255jQuery.each({ 1256 parent: function(elem){return elem.parentNode;}, 1257 parents: function(elem){return jQuery.dir(elem,"parentNode");}, 1258 next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, 1259 prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, 1260 nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, 1261 prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, 1262 siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, 1263 children: function(elem){return jQuery.sibling(elem.firstChild);}, 1264 contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} 1265}, function(name, fn){ 1266 jQuery.fn[ name ] = function( selector ) { 1267 var ret = jQuery.map( this, fn ); 1268 1269 if ( selector && typeof selector == "string" ) 1270 ret = jQuery.multiFilter( selector, ret ); 1271 1272 return this.pushStack( jQuery.unique( ret ) ); 1273 }; 1274}); 1275 1276jQuery.each({ 1277 appendTo: "append", 1278 prependTo: "prepend", 1279 insertBefore: "before", 1280 insertAfter: "after", 1281 replaceAll: "replaceWith" 1282}, function(name, original){ 1283 jQuery.fn[ name ] = function() { 1284 var args = arguments; 1285 1286 return this.each(function(){ 1287 for ( var i = 0, length = args.length; i < length; i++ ) 1288 jQuery( args[ i ] )[ original ]( this ); 1289 }); 1290 }; 1291}); 1292 1293jQuery.each({ 1294 removeAttr: function( name ) { 1295 jQuery.attr( this, name, "" ); 1296 if (this.nodeType == 1) 1297 this.removeAttribute( name ); 1298 }, 1299 1300 addClass: function( classNames ) { 1301 jQuery.className.add( this, classNames ); 1302 }, 1303 1304 removeClass: function( classNames ) { 1305 jQuery.className.remove( this, classNames ); 1306 }, 1307 1308 toggleClass: function( classNames ) { 1309 jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames ); 1310 }, 1311 1312 remove: function( selector ) { 1313 if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { 1314 // Prevent memory leaks 1315 jQuery( "*", this ).add(this).each(function(){ 1316 jQuery.event.remove(this); 1317 jQuery.removeData(this); 1318 }); 1319 if (this.parentNode) 1320 this.parentNode.removeChild( this ); 1321 } 1322 }, 1323 1324 empty: function() { 1325 // Remove element nodes and prevent memory leaks 1326 jQuery( ">*", this ).remove(); 1327 1328 // Remove any remaining nodes 1329 while ( this.firstChild ) 1330 this.removeChild( this.firstChild ); 1331 } 1332}, function(name, fn){ 1333 jQuery.fn[ name ] = function(){ 1334 return this.each( fn, arguments ); 1335 }; 1336}); 1337 1338jQuery.each([ "Height", "Width" ], function(i, name){ 1339 var type = name.toLowerCase(); 1340 1341 jQuery.fn[ type ] = function( size ) { 1342 // Get window width or height 1343 return this[0] == window ? 1344 // Opera reports document.body.client[Width/Height] properly in both quirks and standards 1345 jQuery.browser.opera && document.body[ "client" + name ] || 1346 1347 // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
1348 jQuery.browser.safari && window[ "inner" + name ] || 1349 1350 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode 1351 document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : 1352 1353 // Get document width or height 1354 this[0] == document ? 1355 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 1356 Math.max( 1357 Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), 1358 Math.max(document.body["offset" + name], document.documentElement["offset" + name]) 1359 ) : 1360 1361 // Get or set width or height on the element 1362 size == undefined ? 1363 // Get width or height on the element 1364 (this.length ? jQuery.css( this[0], type ) : null) : 1365 1366 // Set the width or height on the element (default to pixels if value is unitless) 1367 this.css( type, size.constructor == String ? size : size + "px" ); 1368 }; 1369}); 1370 1371// Helper function used by the dimensions and offset modules 1372function num(elem, prop) { 1373 return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; 1374}
1374var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? 1375 "(?:[\\w*_-]|\\\\.)" : 1376 "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", 1377 quickChild = new RegExp("^>\\s*(" + chars + "+)"), 1378 quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"), 1379 quickClass = new RegExp("^([#.]?)(" + chars + "*)"); 1380 1381jQuery.extend({ 1382 expr: { 1383 "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);}, 1384 "#": function(a,i,m){return a.getAttribute("id")==m[2];}, 1385 ":": { 1386 // Position Checks 1387 lt: function(a,i,m){return i<m[3]-0;}, 1388 gt: function(a,i,m){return i>m[3]-0;}, 1389 nth: function(a,i,m){return m[3]-0==i;}, 1390 eq: function(a,i,m){return m[3]-0==i;}, 1391 first: function(a,i){return i==0;}, 1392 last: function(a,i,m,r){return i==r.length-1;}, 1393 even: function(a,i){return i%2==0;}, 1394 odd: function(a,i){return i%2;}, 1395 1396 // Child Checks 1397 "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;}, 1398 "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;}, 1399 "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");}, 1400 1401 // Parent Checks 1402 parent: function(a){return a.firstChild;}, 1403 empty: function(a){return !a.firstChild;}, 1404 1405 // Text Check 1406 contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;}, 1407 1408 // Visibility 1409 visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";}, 1410 hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";}, 1411 1412 // Form attributes 1413 enabled: function(a){return !a.disabled;}, 1414 disabled: function(a){return a.disabled;}, 1415 checked: function(a){return a.checked;}, 1416 selected: function(a){return a.selected||jQuery.attr(a,"selected");}, 1417 1418 // Form elements 1419 text: function(a){return "text"==a.type;}, 1420 radio: function(a){return "radio"==a.type;}, 1421 checkbox: function(a){return "checkbox"==a.type;}, 1422 file: function(a){return "file"==a.type;}, 1423 password: function(a){return "password"==a.type;}, 1424 submit: function(a){return "submit"==a.type;}, 1425 image: function(a){return "image"==a.type;}, 1426 reset: function(a){return "reset"==a.type;}, 1427 button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
1428 input: function(a){return /input|select|textarea|button/i.test(a.nodeName);}, 1429 1430 // :has() 1431 has: function(a,i,m){return jQuery.find(m[3],a).length;}, 1432 1433 // :header 1434 header: function(a){return /h\d/i.test(a.nodeName);}, 1435 1436 // :animated 1437 animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;} 1438 } 1439 }, 1440 1441 // The regular expressions that power the parsing engine 1442 parse: [ 1443 // Match: [@value='test'], [@foo] 1444 /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, 1445 1446 // Match: :contains('foo') 1447 /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, 1448 1449 // Match: :even, :last-child, #id, .class 1450 new RegExp("^([:.#]*)(" + chars + "+)") 1451 ], 1452 1453 multiFilter: function( expr, elems, not ) { 1454 var old, cur = []; 1455 1456 while ( expr && expr != old ) { 1457 old = expr; 1458 var f = jQuery.filter( expr, elems, not ); 1459 expr = f.t.replace(/^\s*,\s*/, "" ); 1460 cur = not ? elems = f.r : jQuery.merge( cur, f.r ); 1461 } 1462 1463 return cur; 1464 }, 1465 1466 find: function( t, context ) { 1467 // Quickly handle non-string expressions 1468 if ( typeof t != "string" ) 1469 return [ t ]; 1470 1471 // check to make sure context is a DOM element or a document 1472 if ( context && context.nodeType != 1 && context.nodeType != 9) 1473 return [ ]; 1474 1475 // Set the correct context (if none is provided) 1476 context = context || document; 1477 1478 // Initialize the search 1479 var ret = [context], done = [], last, nodeName; 1480 1481 // Continue while a selector expression exists, and while 1482 // we're no longer looping upon ourselves 1483 while ( t && last != t ) { 1484 var r = []; 1485 last = t; 1486 1487 t = jQuery.trim(t); 1488 1489 var foundToken = false, 1490 1491 // An attempt at speeding up child selectors that 1492 // point to a specific element tag 1493 re = quickChild, 1494 1495 m = re.exec(t); 1496 1497 if ( m ) { 1498 nodeName = m[1].toUpperCase(); 1499 1500 // Perform our own iteration and filter 1501 for ( var i = 0; ret[i]; i++ ) 1502 for ( var c = ret[i].firstChild; c; c = c.nextSibling ) 1503 if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) 1504 r.push( c ); 1505 1506 ret = r; 1507 t = t.replace( re, "" ); 1508 if ( t.indexOf(" ") == 0 ) continue; 1509 foundToken = true; 1510 } else { 1511 re = /^([>+~])\s*(\w*)/i; 1512 1513 if ( (m = re.exec(t)) != null ) { 1514 r = []; 1515 1516 var merge = {}; 1517 nodeName = m[2].toUpperCase(); 1518 m = m[1]; 1519 1520 for ( var j = 0, rl = ret.length; j < rl; j++ ) { 1521 var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild; 1522 for ( ; n; n = n.nextSibling ) 1523 if ( n.nodeType == 1 ) { 1524 var id = jQuery.data(n); 1525 1526 if ( m == "~" && merge[id] ) break; 1527 1528 if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { 1529 if ( m == "~" ) merge[id] = true; 1530 r.push( n ); 1531 } 1532 1533 if ( m == "+" ) break; 1534 } 1535 } 1536 1537 ret = r; 1538 1539 // And remove the token 1540 t = jQuery.trim( t.replace( re, "" ) ); 1541 foundToken = true; 1542 } 1543 } 1544 1545 // See if there's still an expression, and that we haven't already 1546 // matched a token 1547 if ( t && !foundToken ) { 1548 // Handle multiple expressions 1549 if ( !t.indexOf(",") ) { 1550 // Clean the result set 1551 if ( context == ret[0] ) ret.shift(); 1552 1553 // Merge the result sets 1554 done = jQuery.merge( done, ret ); 1555 1556 // Reset the context 1557 r = ret = [context]; 1558 1559 // Touch up the selector string 1560 t = " " + t.substr(1,t.length); 1561 1562 } else { 1563 // Optimize for the case nodeName#idName 1564 var re2 = quickID; 1565 var m = re2.exec(t); 1566 1567 // Re-organize the results, so that they're consistent 1568 if ( m ) { 1569 m = [ 0, m[2], m[3], m[1] ]; 1570 1571 } else { 1572 // Otherwise, do a traditional filter check for 1573 // ID, class, and element selectors 1574 re2 = quickClass; 1575 m = re2.exec(t); 1576 } 1577 1578 m[2] = m[2].replace(/\\/g, ""); 1579 1580 var elem = ret[ret.length-1]; 1581 1582 // Try to do a global search by ID, where we can 1583 if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) { 1584 // Optimization for HTML document case 1585 var oid = elem.getElementById(m[2]); 1586 1587 // Do a quick check for the existence of the actual ID attribute 1588 // to avoid selecting by the name attribute in IE 1589 // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form 1590 if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) 1591 oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; 1592 1593 // Do a quick check for node name (where applicable) so 1594 // that div#foo searches will be really fast 1595 ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; 1596 } else { 1597 // We need to find all descendant elements 1598 for ( var i = 0; ret[i]; i++ ) { 1599 // Grab the tag name being searched for 1600 var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2]; 1601 1602 // Handle IE7 being really dumb about <object>s 1603 if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) 1604 tag = "param"; 1605 1606 r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); 1607 } 1608 1609 // It's faster to filter by class and be done with it 1610 if ( m[1] == "." ) 1611 r = jQuery.classFilter( r, m[2] ); 1612
1613 // Same with ID filtering 1614 if ( m[1] == "#" ) { 1615 var tmp = []; 1616 1617 // Try to find the element with the ID 1618 for ( var i = 0; r[i]; i++ ) 1619 if ( r[i].getAttribute("id") == m[2] ) { 1620 tmp = [ r[i] ]; 1621 break; 1622 } 1623 1624 r = tmp; 1625 } 1626 1627 ret = r; 1628 } 1629 1630 t = t.replace( re2, "" ); 1631 } 1632 1633 } 1634 1635 // If a selector string still exists 1636 if ( t ) { 1637 // Attempt to filter it 1638 var val = jQuery.filter(t,r); 1639 ret = r = val.r; 1640 t = jQuery.trim(val.t); 1641 } 1642 } 1643 1644 // An error occurred with the selector; 1645 // just return an empty set instead 1646 if ( t ) 1647 ret = []; 1648 1649 // Remove the root context 1650 if ( ret && context == ret[0] ) 1651 ret.shift(); 1652 1653 // And combine the results 1654 done = jQuery.merge( done, ret ); 1655 1656 return done; 1657 }, 1658 1659 classFilter: function(r,m,not){ 1660 m = " " + m + " "; 1661 var tmp = []; 1662 for ( var i = 0; r[i]; i++ ) { 1663 var pass = (" " + r[i].className + " ").indexOf( m ) >= 0; 1664 if ( !not && pass || not && !pass ) 1665 tmp.push( r[i] ); 1666 } 1667 return tmp; 1668 }, 1669 1670 filter: function(t,r,not) { 1671 var last; 1672 1673 // Look for common filter expressions 1674 while ( t && t != last ) { 1675 last = t; 1676 1677 var p = jQuery.parse, m; 1678 1679 for ( var i = 0; p[i]; i++ ) { 1680 m = p[i].exec( t ); 1681 1682 if ( m ) { 1683 // Remove what we just matched 1684 t = t.substring( m[0].length ); 1685 1686 m[2] = m[2].replace(/\\/g, ""); 1687 break; 1688 } 1689 } 1690 1691 if ( !m ) 1692 break; 1693 1694 // :not() is a special case that can be optimized by 1695 // keeping it out of the expression list 1696 if ( m[1] == ":" && m[2] == "not" ) 1697 // optimize if only one selector found (most common case) 1698 r = isSimple.test( m[3] ) ? 1699 jQuery.filter(m[3], r, true).r : 1700 jQuery( r ).not( m[3] ); 1701 1702 // We can get a big speed boost by filtering by class here 1703 else if ( m[1] == "." ) 1704 r = jQuery.classFilter(r, m[2], not); 1705 1706 else if ( m[1] == "[" ) { 1707 var tmp = [], type = m[3]; 1708 1709 for ( var i = 0, rl = r.length; i < rl; i++ ) { 1710 var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ]; 1711 1712 if ( z == null || /href|src|selected/.test(m[2]) ) 1713 z = jQuery.attr(a,m[2]) || ''; 1714 1715 if ( (type == "" && !!z || 1716 type == "=" && z == m[5] || 1717 type == "!=" && z != m[5] || 1718 type == "^=" && z && !z.indexOf(m[5]) || 1719 type == "$=" && z.substr(z.length - m[5].length) == m[5] || 1720 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not ) 1721 tmp.push( a ); 1722 } 1723 1724 r = tmp; 1725 1726 // We can get a speed boost by handling nth-child here 1727 } else if ( m[1] == ":" && m[2] == "nth-child" ) { 1728 var merge = {}, tmp = [], 1729 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 1730 test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( 1731 m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || 1732 !/\D/.test(m[3]) && "0n+" + m[3] || m[3]), 1733 // calculate the numbers (first)n+(last) including if they are negative 1734 first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0; 1735 1736 // loop through all the elements left in the jQuery object 1737 for ( var i = 0, rl = r.length; i < rl; i++ ) { 1738 var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); 1739 1740 if ( !merge[id] ) { 1741 var c = 1; 1742 1743 for ( var n = parentNode.firstChild; n; n = n.nextSibling ) 1744 if ( n.nodeType == 1 ) 1745 n.nodeIndex = c++; 1746 1747 merge[id] = true; 1748 } 1749 1750 var add = false; 1751 1752 if ( first == 0 ) { 1753 if ( node.nodeIndex == last ) 1754 add = true; 1755 } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 ) 1756 add = true; 1757 1758 if ( add ^ not ) 1759 tmp.push( node ); 1760 } 1761 1762 r = tmp; 1763 1764 // Otherwise, find the expression to execute 1765 } else { 1766 var fn = jQuery.expr[ m[1] ]; 1767 if ( typeof fn == "object" ) 1768 fn = fn[ m[2] ]; 1769 1770 if ( typeof fn == "string" ) 1771 fn = eval("false||function(a,i){return " + fn + ";}"); 1772 1773 // Execute it against the current filter 1774 r = jQuery.grep( r, function(elem, i){ 1775 return fn(elem, i, m, r); 1776 }, not ); 1777 } 1778 } 1779 1780 // Return an array of filtered elements (r) 1781 // and the modified expression string (t) 1782 return { r: r, t: t }; 1783 }, 1784 1785 dir: function( elem, dir ){ 1786 var matched = [], 1787 cur = elem[dir]; 1788 while ( cur && cur != document ) { 1789 if ( cur.nodeType == 1 ) 1790 matched.push( cur ); 1791 cur = cur[dir]; 1792 } 1793 return matched; 1794 }, 1795 1796 nth: function(cur,result,dir,elem){ 1797 result = result || 1; 1798 var num = 0; 1799 1800 for ( ; cur; cur = cur[dir] ) 1801 if ( cur.nodeType == 1 && ++num == result ) 1802 break; 1803 1804 return cur; 1805 }, 1806 1807 sibling: function( n, elem ) { 1808 var r = []; 1809 1810 for ( ; n; n = n.nextSibling ) { 1811 if ( n.nodeType == 1 && n != elem ) 1812 r.push( n ); 1813 } 1814 1815 return r; 1816 } 1817}); 1818/* 1819 * A number of helper functions used for managing events. 1820 * Many of the ideas behind this code orignated from 1821 * Dean Edwards' addEvent library. 1822 */ 1823jQuery.event = { 1824 1825 // Bind an event to an element 1826 // Original by Dean Edwards 1827 add: function(elem, types, handler, data) { 1828 if ( elem.nodeType == 3 || elem.nodeType == 8 ) 1829 return; 1830 1831 // For whatever reason, IE has trouble passing the window object 1832 // around, causing it to be cloned in the process 1833 if ( jQuery.browser.msie && elem.setInterval ) 1834 elem = window; 1835 1836 // Make sure that the function being executed has a unique ID 1837 if ( !handler.guid ) 1838 handler.guid = this.guid++; 1839 1840 // if data is passed, bind to handler 1841 if( data != undefined ) { 1842 // Create temporary function pointer to original handler 1843 var fn = handler; 1844 1845 // Create unique handler function, wrapped around original handler 1846 handler = this.proxy( fn, function() { 1847 // Pass arguments and context to original handler 1848 return fn.apply(this, arguments); 1849 }); 1850 1851 // Store data in unique handler 1852 handler.data = data; 1853 } 1854 1855 // Init the element's event structure 1856 var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), 1857 handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ 1858 // Handle the second event of a trigger and when 1859 // an event is called after a page has unloaded 1860 if ( typeof jQuery != "undefined" && !jQuery.event.triggered ) 1861 return jQuery.event.handle.apply(arguments.callee.elem, arguments); 1862 }); 1863 // Add elem as a property of the handle function 1864 // This is to prevent a memory leak with non-native 1865 // event in IE. 1866 handle.elem = elem; 1867 1868 // Handle multiple events separated by a space 1869 // jQuery(...).bind("mouseover mouseout", fn); 1870 jQuery.each(types.split(/\s+/), function(index, type) { 1871 // Namespaced event handlers 1872 var parts = type.split("."); 1873 type = parts[0]; 1874 handler.type = parts[1]; 1875
1876 // Get the current list of functions bound to this event 1877 var handlers = events[type]; 1878 1879 // Init the event handler queue 1880 if (!handlers) { 1881 handlers = events[type] = {}; 1882 1883 // Check for a special event handler 1884 // Only use addEventListener/attachEvent if the special 1885 // events handler returns false 1886 if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) { 1887 // Bind the global event handler to the element 1888 if (elem.addEventListener) 1889 elem.addEventListener(type, handle, false); 1890 else if (elem.attachEvent) 1891 elem.attachEvent("on" + type, handle); 1892 } 1893 } 1894 1895 // Add the function to the element's handler list 1896 handlers[handler.guid] = handler; 1897 1898 // Keep track of which events have been used, for global triggering 1899 jQuery.event.global[type] = true; 1900 }); 1901 1902 // Nullify elem to prevent memory leaks in IE 1903 elem = null; 1904 }, 1905 1906 guid: 1, 1907 global: {}, 1908 1909 // Detach an event or set of events from an element 1910 remove: function(elem, types, handler) { 1911 // don't do events on text and comment nodes 1912 if ( elem.nodeType == 3 || elem.nodeType == 8 ) 1913 return; 1914 1915 var events = jQuery.data(elem, "events"), ret, index; 1916 1917 if ( events ) { 1918 // Unbind all events for the element 1919 if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") ) 1920 for ( var type in events ) 1921 this.remove( elem, type + (types || "") ); 1922 else { 1923 // types is actually an event object here 1924 if ( types.type ) { 1925 handler = types.handler; 1926 types = types.type; 1927 } 1928 1929 // Handle multiple events seperated by a space 1930 // jQuery(...).unbind("mouseover mouseout", fn); 1931 jQuery.each(types.split(/\s+/), function(index, type){ 1932 // Namespaced event handlers 1933 var parts = type.split("."); 1934 type = parts[0]; 1935 1936 if ( events[type] ) { 1937 // remove the given handler for the given type 1938 if ( handler ) 1939 delete events[type][handler.guid]; 1940 1941 // remove all handlers for the given type 1942 else 1943 for ( handler in events[type] ) 1944 // Handle the removal of namespaced events 1945 if ( !parts[1] || events[type][handler].type == parts[1] ) 1946 delete events[type][handler]; 1947 1948 // remove generic event handler if no more handlers exist 1949 for ( ret in events[type] ) break; 1950 if ( !ret ) { 1951 if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) { 1952 if (elem.removeEventListener) 1953 elem.removeEventListener(type, jQuery.data(elem, "handle"), false); 1954 else if (elem.detachEvent) 1955 elem.detachEvent("on" + type, jQuery.data(elem, "handle")); 1956 } 1957 ret = null; 1958 delete events[type]; 1959 } 1960 } 1961 }); 1962 } 1963 1964 // Remove the expando if it's no longer used 1965 for ( ret in events ) break; 1966 if ( !ret ) { 1967 var handle = jQuery.data( elem, "handle" ); 1968 if ( handle ) handle.elem = null; 1969 jQuery.removeData( elem, "events" ); 1970 jQuery.removeData( elem, "handle" ); 1971 } 1972 } 1973 }, 1974 1975 trigger: function(type, data, elem, donative, extra) { 1976 // Clone the incoming data, if any 1977 data = jQuery.makeArray(data); 1978 1979 if ( type.indexOf("!") >= 0 ) { 1980 type = type.slice(0, -1); 1981 var exclusive = true; 1982 } 1983 1984 // Handle a global trigger 1985 if ( !elem ) { 1986 // Only trigger if we've ever bound an event for it 1987 if ( this.global[type] ) 1988 jQuery("*").add([window, document]).trigger(type, data); 1989 1990 // Handle triggering a single element 1991 } else { 1992 // don't do events on text and comment nodes 1993 if ( elem.nodeType == 3 || elem.nodeType == 8 ) 1994 return undefined; 1995 1996 var val, ret, fn = jQuery.isFunction( elem[ type ] || null ), 1997 // Check to see if we need to provide a fake event, or not 1998 event = !data[0] || !data[0].preventDefault; 1999 2000 // Pass along a fake event 2001 if ( event ) { 2002 data.unshift({ 2003 type: type, 2004 target: elem, 2005 preventDefault: function(){}, 2006 stopPropagation: function(){}, 2007 timeStamp: now() 2008 }); 2009 data[0][expando] = true; // no need to fix fake event 2010 } 2011 2012 // Enforce the right trigger type 2013 data[0].type = type; 2014 if ( exclusive ) 2015 data[0].exclusive = true; 2016 2017 // Trigger the event, it is assumed that "handle" is a function 2018 var handle = jQuery.data(elem, "handle"); 2019 if ( handle ) 2020 val = handle.apply( elem, data ); 2021 2022 // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) 2023 if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) 2024 val = false;
2025 2026 // Extra functions don't get the custom event object 2027 if ( event ) 2028 data.shift(); 2029 2030 // Handle triggering of extra function 2031 if ( extra && jQuery.isFunction( extra ) ) { 2032 // call the extra function and tack the current return value on the end for possible inspection 2033 ret = extra.apply( elem, val == null ? data : data.concat( val ) ); 2034 // if anything is returned, give it precedence and have it overwrite the previous value 2035 if (ret !== undefined) 2036 val = ret; 2037 } 2038 2039 // Trigger the native events (except for clicks on links) 2040 if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) { 2041 this.triggered = true; 2042 try { 2043 elem[ type ](); 2044 // prevent IE from throwing an error for some hidden elements 2045 } catch (e) {} 2046 } 2047 2048 this.triggered = false; 2049 } 2050 2051 return val; 2052 }, 2053 2054 handle: function(event) { 2055 // returned undefined or false 2056 var val, ret, namespace, all, handlers; 2057 2058 event = arguments[0] = jQuery.event.fix( event || window.event ); 2059 2060 // Namespaced event handlers 2061 namespace = event.type.split("."); 2062 event.type = namespace[0]; 2063 namespace = namespace[1]; 2064 // Cache this now, all = true means, any handler 2065 all = !namespace && !event.exclusive; 2066 2067 handlers = ( jQuery.data(this, "events") || {} )[event.type]; 2068 2069 for ( var j in handlers ) { 2070 var handler = handlers[j]; 2071 2072 // Filter the functions by class 2073 if ( all || handler.type == namespace ) { 2074 // Pass in a reference to the handler function itself 2075 // So that we can later remove it 2076 event.handler = handler; 2077 event.data = handler.data; 2078 2079 ret = handler.apply( this, arguments ); 2080 2081 if ( val !== false ) 2082 val = ret; 2083 2084 if ( ret === false ) { 2085 event.preventDefault(); 2086 event.stopPropagation(); 2087 } 2088 } 2089 } 2090 2091 return val; 2092 }, 2093 2094 fix: function(event) { 2095 if ( event[expando] == true ) 2096 return event; 2097 2098 // store a copy of the original event object 2099 // and "clone" to set read-only properties 2100 var originalEvent = event; 2101 event = { originalEvent: originalEvent }; 2102 var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" "); 2103 for ( var i=props.length; i; i-- ) 2104 event[ props[i] ] = originalEvent[ props[i] ]; 2105 2106 // Mark it as fixed 2107 event[expando] = true; 2108 2109 // add preventDefault and stopPropagation since 2110 // they will not work on the clone 2111 event.preventDefault = function() { 2112 // if preventDefault exists run it on the original event 2113 if (originalEvent.preventDefault) 2114 originalEvent.preventDefault(); 2115 // otherwise set the returnValue property of the original event to false (IE) 2116 originalEvent.returnValue = false; 2117 }; 2118 event.stopPropagation = function() { 2119 // if stopPropagation exists run it on the original event 2120 if (originalEvent.stopPropagation) 2121 originalEvent.stopPropagation(); 2122 // otherwise set the cancelBubble property of the original event to true (IE) 2123 originalEvent.cancelBubble = true; 2124 }; 2125 2126 // Fix timeStamp 2127 event.timeStamp = event.timeStamp || now(); 2128 2129 // Fix target property, if necessary 2130 if ( !event.target ) 2131 event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either 2132 2133 // check if target is a textnode (safari) 2134 if ( event.target.nodeType == 3 ) 2135 event.target = event.target.parentNode; 2136 2137 // Add relatedTarget, if necessary 2138 if ( !event.relatedTarget && event.fromElement ) 2139 event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; 2140 2141 // Calculate pageX/Y if missing and clientX/Y available 2142 if ( event.pageX == null && event.clientX != null ) { 2143 var doc = document.documentElement, body = document.body; 2144 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); 2145 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); 2146 } 2147 2148 // Add which for key events 2149 if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) 2150 event.which = event.charCode || event.keyCode; 2151 2152 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 2153 if ( !event.metaKey && event.ctrlKey ) 2154 event.metaKey = event.ctrlKey; 2155 2156 // Add which for click: 1 == left; 2 == middle; 3 == right 2157 // Note: button is not normalized, so don't use it 2158 if ( !event.which && event.button ) 2159 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 2160 2161 return event; 2162 }, 2163 2164 proxy: function( fn, proxy ){ 2165 // Set the guid of unique handler to the same of original handler, so it can be removed 2166 proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; 2167 // So proxy can be declared as an argument 2168 return proxy; 2169 }, 2170 2171 special: { 2172 ready: { 2173 setup: function() { 2174 // Make sure the ready event is setup 2175 bindReady(); 2176 return; 2177 }, 2178 2179 teardown: function() { return; } 2180 }, 2181 2182 mouseenter: { 2183 setup: function() { 2184 if ( jQuery.browser.msie ) return false;
2185 jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); 2186 return true; 2187 }, 2188 2189 teardown: function() { 2190 if ( jQuery.browser.msie ) return false; 2191 jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); 2192 return true; 2193 }, 2194 2195 handler: function(event) { 2196 // If we actually just moused on to a sub-element, ignore it 2197 if ( withinElement(event, this) ) return true; 2198 // Execute the right handlers by setting the event type to mouseenter 2199 event.type = "mouseenter"; 2200 return jQuery.event.handle.apply(this, arguments); 2201 } 2202 }, 2203 2204 mouseleave: { 2205 setup: function() { 2206 if ( jQuery.browser.msie ) return false; 2207 jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); 2208 return true; 2209 }, 2210 2211 teardown: function() { 2212 if ( jQuery.browser.msie ) return false; 2213 jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler); 2214 return true; 2215 }, 2216 2217 handler: function(event) { 2218 // If we actually just moused on to a sub-element, ignore it 2219 if ( withinElement(event, this) ) return true; 2220 // Execute the right handlers by setting the event type to mouseleave 2221 event.type = "mouseleave"; 2222 return jQuery.event.handle.apply(this, arguments); 2223 } 2224 } 2225 } 2226}; 2227 2228jQuery.fn.extend({ 2229 bind: function( type, data, fn ) { 2230 return type == "unload" ? this.one(type, data, fn) : this.each(function(){ 2231 jQuery.event.add( this, type, fn || data, fn && data ); 2232 }); 2233 }, 2234 2235 one: function( type, data, fn ) { 2236 var one = jQuery.event.proxy( fn || data, function(event) { 2237 jQuery(this).unbind(event, one); 2238 return (fn || data).apply( this, arguments ); 2239 }); 2240 return this.each(function(){ 2241 jQuery.event.add( this, type, one, fn && data); 2242 }); 2243 }, 2244 2245 unbind: function( type, fn ) { 2246 return this.each(function(){ 2247 jQuery.event.remove( this, type, fn ); 2248 }); 2249 }, 2250 2251 trigger: function( type, data, fn ) { 2252 return this.each(function(){ 2253 jQuery.event.trigger( type, data, this, true, fn ); 2254 }); 2255 }, 2256 2257 triggerHandler: function( type, data, fn ) { 2258 return this[0] && jQuery.event.trigger( type, data, this[0], false, fn ); 2259 }, 2260 2261 toggle: function( fn ) { 2262 // Save reference to arguments for access in closure 2263 var args = arguments, i = 1; 2264 2265 // link all the functions, so any of them can unbind this click handler 2266 while( i < args.length ) 2267 jQuery.event.proxy( fn, args[i++] ); 2268 2269 return this.click( jQuery.event.proxy( fn, function(event) { 2270 // Figure out which function to execute 2271 this.lastToggle = ( this.lastToggle || 0 ) % i; 2272 2273 // Make sure that clicks stop 2274 event.preventDefault(); 2275 2276 // and execute the function 2277 return args[ this.lastToggle++ ].apply( this, arguments ) || false; 2278 })); 2279 }, 2280 2281 hover: function(fnOver, fnOut) { 2282 return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); 2283 }, 2284 2285 ready: function(fn) { 2286 // Attach the listeners 2287 bindReady(); 2288 2289 // If the DOM is already ready 2290 if ( jQuery.isReady ) 2291 // Execute the function immediately 2292 fn.call( document, jQuery ); 2293 2294 // Otherwise, remember the function for later 2295 else 2296 // Add the function to the wait list 2297 jQuery.readyList.push( function() { return fn.call(this, jQuery); } ); 2298 2299 return this; 2300 } 2301}); 2302 2303jQuery.extend({ 2304 isReady: false, 2305 readyList: [], 2306 // Handle when the DOM is ready 2307 ready: function() { 2308 // Make sure that the DOM is not already loaded 2309 if ( !jQuery.isReady ) { 2310 // Remember that the DOM is ready 2311 jQuery.isReady = true; 2312 2313 // If there are functions bound, to execute 2314 if ( jQuery.readyList ) { 2315 // Execute all of them 2316 jQuery.each( jQuery.readyList, function(){ 2317 this.call( document ); 2318 }); 2319 2320 // Reset the list of functions 2321 jQuery.readyList = null; 2322 } 2323 2324 // Trigger any bound ready events 2325 jQuery(document).triggerHandler("ready"); 2326 } 2327 } 2328}); 2329 2330var readyBound = false; 2331 2332function bindReady(){ 2333 if ( readyBound ) return; 2334 readyBound = true; 2335 2336 // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event 2337 if ( document.addEventListener && !jQuery.browser.opera) 2338 // Use the handy event callback 2339 document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); 2340 2341 // If IE is used and is not in a frame 2342 // Continually check to see if the document is ready 2343 if ( jQuery.browser.msie && window == top ) (function(){ 2344 if (jQuery.isReady) return; 2345 try { 2346 // If IE is used, use the trick by Diego Perini 2347 // http://javascript.nwbox.com/IEContentLoaded/ 2348 document.documentElement.doScroll("left"); 2349 } catch( error ) { 2350 setTimeout( arguments.callee, 0 ); 2351 return; 2352 } 2353 // and execute any waiting functions 2354 jQuery.ready(); 2355 })(); 2356 2357 if ( jQuery.browser.opera ) 2358 document.addEventListener( "DOMContentLoaded", function () { 2359 if (jQuery.isReady) return; 2360 for (var i = 0; i < document.styleSheets.length; i++) 2361 if (document.styleSheets[i].disabled) { 2362 setTimeout( arguments.callee, 0 ); 2363 return; 2364 } 2365 // and execute any waiting functions 2366 jQuery.ready(); 2367 }, false); 2368 2369 if ( jQuery.browser.safari ) { 2370 var numStyles; 2371 (function(){ 2372 if (jQuery.isReady) return; 2373 if ( document.readyState != "loaded" && document.readyState != "complete" ) { 2374 setTimeout( arguments.callee, 0 ); 2375 return; 2376 } 2377 if ( numStyles === undefined ) 2378 numStyles = jQuery("style, link[rel=stylesheet]").length; 2379 if ( document.styleSheets.length != numStyles ) { 2380 setTimeout( arguments.callee, 0 ); 2381 return; 2382 } 2383 // and execute any waiting functions 2384 jQuery.ready(); 2385 })(); 2386 } 2387 2388 // A fallback to window.onload, that will always work 2389 jQuery.event.add( window, "load", jQuery.ready ); 2390} 2391
2392jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + 2393 "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 2394 "submit,keydown,keypress,keyup,error").split(","), function(i, name){ 2395 2396 // Handle event binding 2397 jQuery.fn[name] = function(fn){ 2398 return fn ? this.bind(name, fn) : this.trigger(name); 2399 }; 2400}); 2401 2402// Checks if an event happened on an element within another element 2403// Used in jQuery.event.special.mouseenter and mouseleave handlers 2404var withinElement = function(event, elem) { 2405 // Check if mouse(over|out) are still within the same parent element 2406 var parent = event.relatedTarget; 2407 // Traverse up the tree 2408 while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } 2409 // Return true if we actually just moused on to a sub-element 2410 return parent == elem; 2411}; 2412 2413// Prevent memory leaks in IE 2414// And prevent errors on refresh with events like mouseover in other browsers 2415// Window isn't included so as not to unbind existing unload events 2416jQuery(window).bind("unload", function() { 2417 jQuery("*").add(document).unbind(); 2418}); 2419jQuery.fn.extend({ 2420 // Keep a copy of the old load 2421 _load: jQuery.fn.load, 2422 2423 load: function( url, params, callback ) { 2424 if ( typeof url != 'string' ) 2425 return this._load( url ); 2426 2427 var off = url.indexOf(" "); 2428 if ( off >= 0 ) { 2429 var selector = url.slice(off, url.length); 2430 url = url.slice(0, off); 2431 } 2432 2433 callback = callback || function(){}; 2434 2435 // Default to a GET request 2436 var type = "GET"; 2437 2438 // If the second parameter was provided 2439 if ( params ) 2440 // If it's a function 2441 if ( jQuery.isFunction( params ) ) { 2442 // We assume that it's the callback 2443 callback = params; 2444 params = null; 2445 2446 // Otherwise, build a param string 2447 } else { 2448 params = jQuery.param( params ); 2449 type = "POST"; 2450 } 2451 2452 var self = this; 2453 2454 // Request the remote document 2455 jQuery.ajax({ 2456 url: url, 2457 type: type, 2458 dataType: "html", 2459 data: params, 2460 complete: function(res, status){ 2461 // If successful, inject the HTML into all the matched elements 2462 if ( status == "success" || status == "notmodified" ) 2463 // See if a selector was specified 2464 self.html( selector ? 2465 // Create a dummy div to hold the results 2466 jQuery("<div/>") 2467 // inject the contents of the document in, removing the scripts 2468 // to avoid any 'Permission Denied' errors in IE 2469 .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) 2470 2471 // Locate the specified elements 2472 .find(selector) : 2473 2474 // If not, just inject the full result 2475 res.responseText ); 2476 2477 self.each( callback, [res.responseText, status, res] ); 2478 } 2479 }); 2480 return this; 2481 }, 2482 2483 serialize: function() { 2484 return jQuery.param(this.serializeArray()); 2485 }, 2486 serializeArray: function() { 2487 return this.map(function(){ 2488 return jQuery.nodeName(this, "form") ? 2489 jQuery.makeArray(this.elements) : this; 2490 }) 2491 .filter(function(){ 2492 return this.name && !this.disabled && 2493 (this.checked || /select|textarea/i.test(this.nodeName) || 2494 /text|hidden|password/i.test(this.type)); 2495 }) 2496 .map(function(i, elem){ 2497 var val = jQuery(this).val(); 2498 return val == null ? null : 2499 val.constructor == Array ? 2500 jQuery.map( val, function(val, i){ 2501 return {name: elem.name, value: val}; 2502 }) : 2503 {name: elem.name, value: val}; 2504 }).get(); 2505 } 2506}); 2507 2508// Attach a bunch of functions for handling common AJAX events 2509jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ 2510 jQuery.fn[o] = function(f){ 2511 return this.bind(o, f); 2512 }; 2513}); 2514 2515var jsc = now(); 2516 2517jQuery.extend({ 2518 get: function( url, data, callback, type ) { 2519 // shift arguments if data argument was ommited 2520 if ( jQuery.isFunction( data ) ) { 2521 callback = data; 2522 data = null; 2523 } 2524 2525 return jQuery.ajax({ 2526 type: "GET", 2527 url: url, 2528 data: data, 2529 success: callback, 2530 dataType: type 2531 }); 2532 }, 2533 2534 getScript: function( url, callback ) { 2535 return jQuery.get(url, null, callback, "script"); 2536 }, 2537 2538 getJSON: function( url, data, callback ) { 2539 return jQuery.get(url, data, callback, "json"); 2540 }, 2541 2542 post: function( url, data, callback, type ) { 2543 if ( jQuery.isFunction( data ) ) { 2544 callback = data; 2545 data = {}; 2546 } 2547 2548 return jQuery.ajax({ 2549 type: "POST", 2550 url: url, 2551 data: data, 2552 success: callback, 2553 dataType: type 2554 }); 2555 }, 2556 2557 ajaxSetup: function( settings ) { 2558 jQuery.extend( jQuery.ajaxSettings, settings ); 2559 }, 2560 2561 ajaxSettings: { 2562 url: location.href, 2563 global: true, 2564 type: "GET", 2565 timeout: 0, 2566 contentType: "application/x-www-form-urlencoded", 2567 processData: true, 2568 async: true, 2569 data: null, 2570 username: null, 2571 password: null, 2572 accepts: { 2573 xml: "application/xml, text/xml", 2574 html: "text/html", 2575 script: "text/javascript, application/javascript", 2576 json: "application/json, text/javascript", 2577 text: "text/plain", 2578 _default: "*/*" 2579 } 2580 }, 2581 2582 // Last-Modified header cache for next request 2583 lastModified: {}, 2584 2585 ajax: function( s ) { 2586 // Extend the settings, but re-extend 's' so that it can be 2587 // checked again later (in the test suite, specifically) 2588 s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); 2589 2590 var jsonp, jsre = /=\?(&|$)/g, status, data, 2591 type = s.type.toUpperCase(); 2592 2593 // convert data if not already a string 2594 if ( s.data && s.processData && typeof s.data != "string" ) 2595 s.data = jQuery.param(s.data); 2596 2597 // Handle JSONP Parameter Callbacks 2598 if ( s.dataType == "jsonp" ) { 2599 if ( type == "GET" ) { 2600 if ( !s.url.match(jsre) ) 2601 s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; 2602 } else if ( !s.data || !s.data.match(jsre) ) 2603 s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; 2604 s.dataType = "json"; 2605 } 2606 2607 // Build temporary JSONP function 2608 if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { 2609 jsonp = "jsonp" + jsc++; 2610 2611 // Replace the =? sequence both in the query string and the data 2612 if ( s.data ) 2613 s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); 2614 s.url = s.url.replace(jsre, "=" + jsonp + "$1"); 2615 2616 // We need to make sure 2617 // that a JSONP style response is executed properly 2618 s.dataType = "script"; 2619 2620 // Handle JSONP-style loading 2621 window[ jsonp ] = function(tmp){ 2622 data = tmp; 2623 success(); 2624 complete(); 2625 // Garbage collect 2626 window[ jsonp ] = undefined;
2627 try{ delete window[ jsonp ]; } catch(e){} 2628 if ( head ) 2629 head.removeChild( script ); 2630 }; 2631 } 2632 2633 if ( s.dataType == "script" && s.cache == null ) 2634 s.cache = false; 2635 2636 if ( s.cache === false && type == "GET" ) { 2637 var ts = now(); 2638 // try replacing _= if it is there 2639 var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); 2640 // if nothing was replaced, add timestamp to the end 2641 s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); 2642 } 2643 2644 // If data is available, append data to url for get requests 2645 if ( s.data && type == "GET" ) { 2646 s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; 2647 2648 // IE likes to send both get and post data, prevent this 2649 s.data = null; 2650 } 2651 2652 // Watch for a new set of requests 2653 if ( s.global && ! jQuery.active++ ) 2654 jQuery.event.trigger( "ajaxStart" ); 2655 2656 // Matches an absolute URL, and saves the domain 2657 var remote = /^(?:\w+:)?\/\/([^\/?#]+)/; 2658 2659 // If we're requesting a remote document 2660 // and trying to load JSON or Script with a GET 2661 if ( s.dataType == "script" && type == "GET" 2662 && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){ 2663 var head = document.getElementsByTagName("head")[0]; 2664 var script = document.createElement("script"); 2665 script.src = s.url; 2666 if (s.scriptCharset) 2667 script.charset = s.scriptCharset; 2668 2669 // Handle Script loading 2670 if ( !jsonp ) { 2671 var done = false; 2672 2673 // Attach handlers for all browsers 2674 script.onload = script.onreadystatechange = function(){ 2675 if ( !done && (!this.readyState || 2676 this.readyState == "loaded" || this.readyState == "complete") ) { 2677 done = true; 2678 success(); 2679 complete(); 2680 head.removeChild( script ); 2681 } 2682 }; 2683 } 2684 2685 head.appendChild(script); 2686 2687 // We handle everything using the script element injection 2688 return undefined; 2689 } 2690 2691 var requestDone = false; 2692 2693 // Create the request object; Microsoft failed to properly 2694 // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available 2695 var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); 2696 2697 // Open the socket 2698 // Passing null username, generates a login popup on Opera (#2865) 2699 if( s.username ) 2700 xhr.open(type, s.url, s.async, s.username, s.password); 2701 else 2702 xhr.open(type, s.url, s.async); 2703 2704 // Need an extra try/catch for cross domain requests in Firefox 3 2705 try { 2706 // Set the correct header, if data is being sent 2707 if ( s.data ) 2708 xhr.setRequestHeader("Content-Type", s.contentType); 2709 2710 // Set the If-Modified-Since header, if ifModified mode. 2711 if ( s.ifModified ) 2712 xhr.setRequestHeader("If-Modified-Since", 2713 jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); 2714 2715 // Set header so the called script knows that it's an XMLHttpRequest 2716 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 2717 2718 // Set the Accepts header for the server, depending on the dataType 2719 xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? 2720 s.accepts[ s.dataType ] + ", */*" : 2721 s.accepts._default ); 2722 } catch(e){} 2723 2724 // Allow custom headers/mimetypes 2725 if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { 2726 // cleanup active request counter 2727 s.global && jQuery.active--; 2728 // close opended socket 2729 xhr.abort(); 2730 return false; 2731 } 2732 2733 if ( s.global ) 2734 jQuery.event.trigger("ajaxSend", [xhr, s]); 2735 2736 // Wait for a response to come back 2737 var onreadystatechange = function(isTimeout){ 2738 // The transfer is complete and the data is available, or the request timed out 2739 if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { 2740 requestDone = true; 2741 2742 // clear poll interval 2743 if (ival) { 2744 clearInterval(ival); 2745 ival = null; 2746 } 2747 2748 status = isTimeout == "timeout" && "timeout" || 2749 !jQuery.httpSuccess( xhr ) && "error" || 2750 s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" || 2751 "success"; 2752 2753 if ( status == "success" ) { 2754 // Watch for, and catch, XML document parse errors 2755 try { 2756 // process the data (runs the xml through httpData regardless of callback) 2757 data = jQuery.httpData( xhr, s.dataType, s.dataFilter ); 2758 } catch(e) { 2759 status = "parsererror"; 2760 } 2761 } 2762 2763 // Make sure that the request was successful or notmodified 2764 if ( status == "success" ) { 2765 // Cache Last-Modified header, if ifModified mode. 2766 var modRes; 2767 try { 2768 modRes = xhr.getResponseHeader("Last-Modified"); 2769 } catch(e) {} // swallow exception thrown by FF if header is not available 2770 2771 if ( s.ifModified && modRes ) 2772 jQuery.lastModified[s.url] = modRes; 2773 2774 // JSONP handles its own success callback 2775 if ( !jsonp ) 2776 success(); 2777 } else 2778 jQuery.handleError(s, xhr, status); 2779 2780 // Fire the complete handlers 2781 complete(); 2782 2783 // Stop memory leaks 2784 if ( s.async ) 2785 xhr = null; 2786 } 2787 }; 2788 2789 if ( s.async ) { 2790 // don't attach the handler to the request, just poll it instead 2791 var ival = setInterval(onreadystatechange, 13); 2792 2793 // Timeout checker 2794 if ( s.timeout > 0 ) 2795 setTimeout(function(){ 2796 // Check to see if the request is still happening 2797 if ( xhr ) { 2798 // Cancel the request 2799 xhr.abort(); 2800 2801 if( !requestDone ) 2802 onreadystatechange( "timeout" ); 2803 } 2804 }, s.timeout); 2805 } 2806 2807 // Send the data 2808 try { 2809 xhr.send(s.data); 2810 } catch(e) { 2811 jQuery.handleError(s, xhr, null, e); 2812 } 2813 2814 // firefox 1.5 doesn't fire statechange for sync requests 2815 if ( !s.async ) 2816 onreadystatechange(); 2817 2818 function success(){ 2819 // If a local callback was specified, fire it and pass it the data 2820 if ( s.success ) 2821 s.success( data, status ); 2822 2823 // Fire the global callback 2824 if ( s.global ) 2825 jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); 2826 } 2827 2828 function complete(){ 2829 // Process result 2830 if ( s.complete ) 2831 s.complete(xhr, status); 2832 2833 // The request was completed 2834 if ( s.global )
2835 jQuery.event.trigger( "ajaxComplete", [xhr, s] ); 2836 2837 // Handle the global AJAX counter 2838 if ( s.global && ! --jQuery.active ) 2839 jQuery.event.trigger( "ajaxStop" ); 2840 } 2841 2842 // return XMLHttpRequest to allow aborting the request etc. 2843 return xhr; 2844 }, 2845 2846 handleError: function( s, xhr, status, e ) { 2847 // If a local callback was specified, fire it 2848 if ( s.error ) s.error( xhr, status, e ); 2849 2850 // Fire the global callback 2851 if ( s.global ) 2852 jQuery.event.trigger( "ajaxError", [xhr, s, e] ); 2853 }, 2854 2855 // Counter for holding the number of active queries 2856 active: 0, 2857 2858 // Determines if an XMLHttpRequest was successful or not 2859 httpSuccess: function( xhr ) { 2860 try { 2861 // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 2862 return !xhr.status && location.protocol == "file:" || 2863 ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 || 2864 jQuery.browser.safari && xhr.status == undefined; 2865 } catch(e){} 2866 return false; 2867 }, 2868 2869 // Determines if an XMLHttpRequest returns NotModified 2870 httpNotModified: function( xhr, url ) { 2871 try { 2872 var xhrRes = xhr.getResponseHeader("Last-Modified"); 2873 2874 // Firefox always returns 200. check Last-Modified date 2875 return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || 2876 jQuery.browser.safari && xhr.status == undefined; 2877 } catch(e){} 2878 return false; 2879 }, 2880 2881 httpData: function( xhr, type, filter ) { 2882 var ct = xhr.getResponseHeader("content-type"), 2883 xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, 2884 data = xml ? xhr.responseXML : xhr.responseText; 2885 2886 if ( xml && data.documentElement.tagName == "parsererror" ) 2887 throw "parsererror"; 2888 2889 // Allow a pre-filtering function to sanitize the response 2890 if( filter ) 2891 data = filter( data, type ); 2892 2893 // If the type is "script", eval it in global context 2894 if ( type == "script" ) 2895 jQuery.globalEval( data ); 2896 2897 // Get the JavaScript object, if JSON is used. 2898 if ( type == "json" ) 2899 data = eval("(" + data + ")"); 2900 2901 return data; 2902 }, 2903 2904 // Serialize an array of form elements or a set of 2905 // key/values into a query string 2906 param: function( a ) { 2907 var s = []; 2908 2909 // If an array was passed in, assume that it is an array 2910 // of form elements 2911 if ( a.constructor == Array || a.jquery ) 2912 // Serialize the form elements 2913 jQuery.each( a, function(){ 2914 s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); 2915 }); 2916 2917 // Otherwise, assume that it's an object of key/value pairs 2918 else 2919 // Serialize the key/values 2920 for ( var j in a ) 2921 // If the value is an array then the key names need to be repeated 2922 if ( a[j] && a[j].constructor == Array ) 2923 jQuery.each( a[j], function(){ 2924 s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); 2925 }); 2926 else 2927 s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) ); 2928 2929 // Return the resulting serialization 2930 return s.join("&").replace(/%20/g, "+"); 2931 } 2932 2933}); 2934jQuery.fn.extend({ 2935 show: function(speed,callback){ 2936 return speed ? 2937 this.animate({ 2938 height: "show", width: "show", opacity: "show" 2939 }, speed, callback) : 2940 2941 this.filter(":hidden").each(function(){ 2942 this.style.display = this.oldblock || ""; 2943 if ( jQuery.css(this,"display") == "none" ) { 2944 var elem = jQuery("<" + this.tagName + " />").appendTo("body"); 2945 this.style.display = elem.css("display"); 2946 // handle an edge condition where css is - div { display:none; } or similar 2947 if (this.style.display == "none") 2948 this.style.display = "block"; 2949 elem.remove(); 2950 } 2951 }).end(); 2952 }, 2953 2954 hide: function(speed,callback){ 2955 return speed ? 2956 this.animate({ 2957 height: "hide", width: "hide", opacity: "hide" 2958 }, speed, callback) : 2959 2960 this.filter(":visible").each(function(){ 2961 this.oldblock = this.oldblock || jQuery.css(this,"display"); 2962 this.style.display = "none"; 2963 }).end(); 2964 }, 2965 2966 // Save the old toggle function 2967 _toggle: jQuery.fn.toggle, 2968 2969 toggle: function( fn, fn2 ){ 2970 return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? 2971 this._toggle.apply( this, arguments ) : 2972 fn ? 2973 this.animate({ 2974 height: "toggle", width: "toggle", opacity: "toggle" 2975 }, fn, fn2) : 2976 this.each(function(){ 2977 jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); 2978 }); 2979 }, 2980 2981 slideDown: function(speed,callback){ 2982 return this.animate({height: "show"}, speed, callback); 2983 }, 2984 2985 slideUp: function(speed,callback){ 2986 return this.animate({height: "hide"}, speed, callback); 2987 }, 2988 2989 slideToggle: function(speed, callback){ 2990 return this.animate({height: "toggle"}, speed, callback); 2991 }, 2992 2993 fadeIn: function(speed, callback){ 2994 return this.animate({opacity: "show"}, speed, callback); 2995 }, 2996 2997 fadeOut: function(speed, callback){ 2998 return this.animate({opacity: "hide"}, speed, callback); 2999 }, 3000 3001 fadeTo: function(speed,to,callback){ 3002 return this.animate({opacity: to}, speed, callback); 3003 }, 3004 3005 animate: function( prop, speed, easing, callback ) { 3006 var optall = jQuery.speed(speed, easing, callback); 3007 3008 return this[ optall.queue === false ? "each" : "queue" ](function(){ 3009 if ( this.nodeType != 1) 3010 return false;
3011 3012 var opt = jQuery.extend({}, optall), p, 3013 hidden = jQuery(this).is(":hidden"), self = this; 3014 3015 for ( p in prop ) { 3016 if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) 3017 return opt.complete.call(this); 3018 3019 if ( p == "height" || p == "width" ) { 3020 // Store display property 3021 opt.display = jQuery.css(this, "display"); 3022 3023 // Make sure that nothing sneaks out 3024 opt.overflow = this.style.overflow; 3025 } 3026 } 3027 3028 if ( opt.overflow != null ) 3029 this.style.overflow = "hidden"; 3030 3031 opt.curAnim = jQuery.extend({}, prop); 3032 3033 jQuery.each( prop, function(name, val){ 3034 var e = new jQuery.fx( self, opt, name ); 3035 3036 if ( /toggle|show|hide/.test(val) ) 3037 e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 3038 else { 3039 var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), 3040 start = e.cur(true) || 0; 3041 3042 if ( parts ) { 3043 var end = parseFloat(parts[2]), 3044 unit = parts[3] || "px"; 3045 3046 // We need to compute starting value 3047 if ( unit != "px" ) { 3048 self.style[ name ] = (end || 1) + unit; 3049 start = ((end || 1) / e.cur(true)) * start; 3050 self.style[ name ] = start + unit; 3051 } 3052 3053 // If a +=/-= token was provided, we're doing a relative animation 3054 if ( parts[1] ) 3055 end = ((parts[1] == "-=" ? -1 : 1) * end) + start; 3056 3057 e.custom( start, end, unit ); 3058 } else 3059 e.custom( start, val, "" ); 3060 } 3061 }); 3062 3063 // For JS strict compliance 3064 return true; 3065 }); 3066 }, 3067 3068 queue: function(type, fn){ 3069 if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) { 3070 fn = type; 3071 type = "fx"; 3072 } 3073 3074 if ( !type || (typeof type == "string" && !fn) ) 3075 return queue( this[0], type ); 3076 3077 return this.each(function(){ 3078 if ( fn.constructor == Array ) 3079 queue(this, type, fn); 3080 else { 3081 queue(this, type).push( fn ); 3082 3083 if ( queue(this, type).length == 1 ) 3084 fn.call(this); 3085 } 3086 }); 3087 }, 3088 3089 stop: function(clearQueue, gotoEnd){ 3090 var timers = jQuery.timers; 3091 3092 if (clearQueue) 3093 this.queue([]); 3094 3095 this.each(function(){ 3096 // go in reverse order so anything added to the queue during the loop is ignored 3097 for ( var i = timers.length - 1; i >= 0; i-- ) 3098 if ( timers[i].elem == this ) { 3099 if (gotoEnd) 3100 // force the next step to be the last 3101 timers[i](true); 3102 timers.splice(i, 1); 3103 } 3104 }); 3105 3106 // start the next in the queue if the last step wasn't forced 3107 if (!gotoEnd) 3108 this.dequeue(); 3109 3110 return this; 3111 } 3112 3113}); 3114 3115var queue = function( elem, type, array ) { 3116 if ( elem ){ 3117 3118 type = type || "fx"; 3119 3120 var q = jQuery.data( elem, type + "queue" ); 3121 3122 if ( !q || array ) 3123 q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) ); 3124 3125 } 3126 return q; 3127}; 3128 3129jQuery.fn.dequeue = function(type){ 3130 type = type || "fx"; 3131 3132 return this.each(function(){ 3133 var q = queue(this, type); 3134 3135 q.shift(); 3136 3137 if ( q.length ) 3138 q[0].call( this ); 3139 }); 3140}; 3141 3142jQuery.extend({ 3143 3144 speed: function(speed, easing, fn) { 3145 var opt = speed && speed.constructor == Object ? speed : { 3146 complete: fn || !fn && easing || 3147 jQuery.isFunction( speed ) && speed, 3148 duration: speed, 3149 easing: fn && easing || easing && easing.constructor != Function && easing 3150 }; 3151 3152 opt.duration = (opt.duration && opt.duration.constructor == Number ? 3153 opt.duration : 3154 jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def; 3155 3156 // Queueing 3157 opt.old = opt.complete; 3158 opt.complete = function(){ 3159 if ( opt.queue !== false ) 3160 jQuery(this).dequeue(); 3161 if ( jQuery.isFunction( opt.old ) ) 3162 opt.old.call( this ); 3163 }; 3164 3165 return opt; 3166 }, 3167 3168 easing: { 3169 linear: function( p, n, firstNum, diff ) { 3170 return firstNum + diff * p; 3171 }, 3172 swing: function( p, n, firstNum, diff ) { 3173 return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; 3174 } 3175 }, 3176 3177 timers: [], 3178 timerId: null, 3179 3180 fx: function( elem, options, prop ){ 3181 this.options = options; 3182 this.elem = elem; 3183 this.prop = prop; 3184 3185 if ( !options.orig ) 3186 options.orig = {}; 3187 } 3188 3189}); 3190 3191jQuery.fx.prototype = { 3192 3193 // Simple function for setting a style value 3194 update: function(){ 3195 if ( this.options.step ) 3196 this.options.step.call( this.elem, this.now, this ); 3197 3198 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); 3199 3200 // Set display property to block for height/width animations 3201 if ( this.prop == "height" || this.prop == "width" ) 3202 this.elem.style.display = "block"; 3203 }, 3204 3205 // Get the current size 3206 cur: function(force){ 3207 if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null ) 3208 return this.elem[ this.prop ]; 3209 3210 var r = parseFloat(jQuery.css(this.elem, this.prop, force)); 3211 return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; 3212 }, 3213 3214 // Start an animation from one number to another 3215 custom: function(from, to, unit){
3216 this.startTime = now(); 3217 this.start = from; 3218 this.end = to; 3219 this.unit = unit || this.unit || "px"; 3220 this.now = this.start; 3221 this.pos = this.state = 0; 3222 this.update(); 3223 3224 var self = this; 3225 function t(gotoEnd){ 3226 return self.step(gotoEnd); 3227 } 3228 3229 t.elem = this.elem; 3230 3231 jQuery.timers.push(t); 3232 3233 if ( jQuery.timerId == null ) { 3234 jQuery.timerId = setInterval(function(){ 3235 var timers = jQuery.timers; 3236 3237 for ( var i = 0; i < timers.length; i++ ) 3238 if ( !timers[i]() ) 3239 timers.splice(i--, 1); 3240 3241 if ( !timers.length ) { 3242 clearInterval( jQuery.timerId ); 3243 jQuery.timerId = null; 3244 } 3245 }, 13); 3246 } 3247 }, 3248 3249 // Simple 'show' function 3250 show: function(){ 3251 // Remember where we started, so that we can go back to it later 3252 this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); 3253 this.options.show = true; 3254 3255 // Begin the animation 3256 this.custom(0, this.cur()); 3257 3258 // Make sure that we start at a small width/height to avoid any 3259 // flash of content 3260 if ( this.prop == "width" || this.prop == "height" ) 3261 this.elem.style[this.prop] = "1px"; 3262 3263 // Start by showing the element 3264 jQuery(this.elem).show(); 3265 }, 3266 3267 // Simple 'hide' function 3268 hide: function(){ 3269 // Remember where we started, so that we can go back to it later 3270 this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); 3271 this.options.hide = true; 3272 3273 // Begin the animation 3274 this.custom(this.cur(), 0); 3275 }, 3276 3277 // Each step of an animation 3278 step: function(gotoEnd){ 3279 var t = now(); 3280 3281 if ( gotoEnd || t > this.options.duration + this.startTime ) { 3282 this.now = this.end; 3283 this.pos = this.state = 1; 3284 this.update(); 3285 3286 this.options.curAnim[ this.prop ] = true; 3287 3288 var done = true; 3289 for ( var i in this.options.curAnim ) 3290 if ( this.options.curAnim[i] !== true ) 3291 done = false; 3292 3293 if ( done ) { 3294 if ( this.options.display != null ) { 3295 // Reset the overflow 3296 this.elem.style.overflow = this.options.overflow; 3297 3298 // Reset the display 3299 this.elem.style.display = this.options.display; 3300 if ( jQuery.css(this.elem, "display") == "none" ) 3301 this.elem.style.display = "block"; 3302 } 3303 3304 // Hide the element if the "hide" operation was done 3305 if ( this.options.hide ) 3306 this.elem.style.display = "none"; 3307 3308 // Reset the properties, if the item has been hidden or shown 3309 if ( this.options.hide || this.options.show ) 3310 for ( var p in this.options.curAnim ) 3311 jQuery.attr(this.elem.style, p, this.options.orig[p]); 3312 } 3313 3314 if ( done ) 3315 // Execute the complete function 3316 this.options.complete.call( this.elem ); 3317 3318 return false; 3319 } else { 3320 var n = t - this.startTime; 3321 this.state = n / this.options.duration; 3322 3323 // Perform the easing function, defaults to swing 3324 this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
3325 this.now = this.start + ((this.end - this.start) * this.pos); 3326 3327 // Perform the next step of the animation 3328 this.update(); 3329 } 3330 3331 return true; 3332 } 3333 3334}; 3335 3336jQuery.extend( jQuery.fx, { 3337 speeds:{ 3338 slow: 600, 3339 fast: 200, 3340 // Default speed 3341 def: 400 3342 }, 3343 step: { 3344 scrollLeft: function(fx){ 3345 fx.elem.scrollLeft = fx.now; 3346 }, 3347 3348 scrollTop: function(fx){ 3349 fx.elem.scrollTop = fx.now; 3350 }, 3351 3352 opacity: function(fx){ 3353 jQuery.attr(fx.elem.style, "opacity", fx.now); 3354 }, 3355 3356 _default: function(fx){ 3357 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 3358 } 3359 } 3360}); 3361// The Offset Method 3362// Originally By Brandon Aaron, part of the Dimension Plugin 3363// http://jquery.com/plugins/project/dimensions 3364jQuery.fn.offset = function() { 3365 var left = 0, top = 0, elem = this[0], results; 3366 3367 if ( elem ) with ( jQuery.browser ) { 3368 var parent = elem.parentNode, 3369 offsetChild = elem, 3370 offsetParent = elem.offsetParent, 3371 doc = elem.ownerDocument, 3372 safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent), 3373 css = jQuery.curCSS, 3374 fixed = css(elem, "position") == "fixed"; 3375 3376 // Use getBoundingClientRect if available 3377 if ( elem.getBoundingClientRect ) { 3378 var box = elem.getBoundingClientRect(); 3379 3380 // Add the document scroll offsets 3381 add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), 3382 box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); 3383 3384 // IE adds the HTML element's border, by default it is medium which is 2px 3385 // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } 3386 // IE 7 standards mode, the border is always 2px 3387 // This border/offset is typically represented by the clientLeft and clientTop properties 3388 // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS 3389 // Therefore this method will be off by 2px in IE while in quirksmode 3390 add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); 3391 3392 // Otherwise loop through the offsetParents and parentNodes 3393 } else { 3394 3395 // Initial element offsets 3396 add( elem.offsetLeft, elem.offsetTop ); 3397 3398 // Get parent offsets 3399 while ( offsetParent ) { 3400 // Add offsetParent offsets 3401 add( offsetParent.offsetLeft, offsetParent.offsetTop ); 3402 3403 // Mozilla and Safari > 2 does not include the border on offset parents 3404 // However Mozilla adds the border for table or table cells 3405 if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 ) 3406 border( offsetParent ); 3407 3408 // Add the document scroll offsets if position is fixed on any offsetParent 3409 if ( !fixed && css(offsetParent, "position") == "fixed" ) 3410 fixed = true; 3411 3412 // Set offsetChild to previous offsetParent unless it is the body element 3413 offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent; 3414 // Get next offsetParent 3415 offsetParent = offsetParent.offsetParent; 3416 } 3417 3418 // Get parent scroll offsets 3419 while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { 3420 // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug 3421 if ( !/^inline|table.*$/i.test(css(parent, "display")) ) 3422 // Subtract parent scroll offsets 3423 add( -parent.scrollLeft, -parent.scrollTop ); 3424 3425 // Mozilla does not add the border for a parent that has overflow != visible 3426 if ( mozilla && css(parent, "overflow") != "visible" ) 3427 border( parent ); 3428 3429 // Get next parent 3430 parent = parent.parentNode; 3431 } 3432 3433 // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild 3434 // Mozilla doubles body offsets with a non-absolutely positioned offsetChild 3435 if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) || 3436 (mozilla && css(offsetChild, "position") != "absolute") ) 3437 add( -doc.body.offsetLeft, -doc.body.offsetTop ); 3438 3439 // Add the document scroll offsets if position is fixed 3440 if ( fixed ) 3441 add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), 3442 Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); 3443 } 3444 3445 // Return an object with top and left properties 3446 results = { top: top, left: left }; 3447 } 3448 3449 function border(elem) { 3450 add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); 3451 } 3452 3453 function add(l, t) { 3454 left += parseInt(l, 10) || 0; 3455 top += parseInt(t, 10) || 0; 3456 } 3457 3458 return results; 3459}; 3460 3461 3462jQuery.fn.extend({ 3463 position: function() { 3464 var left = 0, top = 0, results; 3465 3466 if ( this[0] ) { 3467 // Get *real* offsetParent 3468 var offsetParent = this.offsetParent(), 3469 3470 // Get correct offsets 3471 offset = this.offset(), 3472 parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); 3473 3474 // Subtract element margins 3475 // note: when an element has margin: auto the offsetLeft and marginLeft 3476 // are the same in Safari causing offset.left to incorrectly be 0 3477 offset.top -= num( this, 'marginTop' ); 3478 offset.left -= num( this, 'marginLeft' ); 3479 3480 // Add offsetParent borders 3481 parentOffset.top += num( offsetParent, 'borderTopWidth' ); 3482 parentOffset.left += num( offsetParent, 'borderLeftWidth' ); 3483 3484 // Subtract the two offsets 3485 results = { 3486 top: offset.top - parentOffset.top, 3487 left: offset.left - parentOffset.left 3488 }; 3489 } 3490 3491 return results; 3492 }, 3493 3494 offsetParent: function() { 3495 var offsetParent = this[0].offsetParent; 3496 while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) 3497 offsetParent = offsetParent.offsetParent; 3498 return jQuery(offsetParent); 3499 } 3500}); 3501 3502 3503// Create scrollLeft and scrollTop methods 3504jQuery.each( ['Left', 'Top'], function(i, name) { 3505 var method = 'scroll' + name; 3506 3507 jQuery.fn[ method ] = function(val) { 3508 if (!this[0]) return; 3509 3510 return val != undefined ? 3511 3512 // Set the scroll offset 3513 this.each(function() { 3514 this == window || this == document ? 3515 window.scrollTo( 3516 !i ? val : jQuery(window).scrollLeft(), 3517 i ? val : jQuery(window).scrollTop() 3518 ) : 3519 this[ method ] = val; 3520 }) : 3521 3522 // Return the scroll offset 3523 this[0] == window || this[0] == document ? 3524 self[ i ? 'pageYOffset' : 'pageXOffset' ] || 3525 jQuery.boxModel && document.documentElement[ method ] || 3526 document.body[ method ] : 3527 this[0][ method ]; 3528 }; 3529}); 3530// Create innerHeight, innerWidth, outerHeight and outerWidth methods 3531jQuery.each([ "Height", "Width" ], function(i, name){ 3532 3533 var tl = i ? "Left" : "Top", // top or left 3534 br = i ? "Right" : "Bottom"; // bottom or right 3535
3536 // innerHeight and innerWidth 3537 jQuery.fn["inner" + name] = function(){ 3538 return this[ name.toLowerCase() ]() + 3539 num(this, "padding" + tl) + 3540 num(this, "padding" + br); 3541 }; 3542 3543 // outerHeight and outerWidth 3544 jQuery.fn["outer" + name] = function(margin) { 3545 return this["inner" + name]() + 3546 num(this, "border" + tl + "Width") + 3547 num(this, "border" + br + "Width") + 3548 (margin ? 3549 num(this, "margin" + tl) + num(this, "margin" + br) : 0); 3550 }; 3551 3552});})();
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.