/trunk/SPS/sps.administration/pages/include/script/jquery-1.2.6.js

http://fatal-error.googlecode.com/ · JavaScript · 2305 lines · 1791 code · 292 blank · 222 comment · 351 complexity · 343607636acfee88faa2b638330a3370 MD5 · raw file

  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. // Map over jQuery in case of overwrite
  13. var _jQuery = window.jQuery,
  14. // Map over the $ in case of overwrite
  15. _$ = window.$;
  16. var jQuery = window.jQuery = window.$ = function( selector, context ) {
  17. // The jQuery object is actually just the init constructor 'enhanced'
  18. return new jQuery.fn.init( selector, context );
  19. };
  20. // A simple way to check for HTML strings or ID strings
  21. // (both of which we optimize for)
  22. var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
  23. // Is it a simple selector
  24. isSimple = /^.[^:#\[\.]*$/,
  25. // Will speed up references to undefined, and allows munging its name.
  26. undefined;
  27. jQuery.fn = jQuery.prototype = {
  28. init: function( selector, context ) {
  29. // Make sure that a selection was provided
  30. selector = selector || document;
  31. // Handle $(DOMElement)
  32. if ( selector.nodeType ) {
  33. this[0] = selector;
  34. this.length = 1;
  35. return this;
  36. }
  37. // Handle HTML strings
  38. if ( typeof selector == "string" ) {
  39. // Are we dealing with HTML string or an ID?
  40. var match = quickExpr.exec( selector );
  41. // Verify a match, and that no context was specified for #id
  42. if ( match && (match[1] || !context) ) {
  43. // HANDLE: $(html) -> $(array)
  44. if ( match[1] )
  45. selector = jQuery.clean( [ match[1] ], context );
  46. // HANDLE: $("#id")
  47. else {
  48. var elem = document.getElementById( match[3] );
  49. // Make sure an element was located
  50. if ( elem ){
  51. // Handle the case where IE and Opera return items
  52. // by name instead of ID
  53. if ( elem.id != match[3] )
  54. return jQuery().find( selector );
  55. // Otherwise, we inject the element directly into the jQuery object
  56. return jQuery( elem );
  57. }
  58. selector = [];
  59. }
  60. // HANDLE: $(expr, [context])
  61. // (which is just equivalent to: $(content).find(expr)
  62. } else
  63. return jQuery( context ).find( selector );
  64. // HANDLE: $(function)
  65. // Shortcut for document ready
  66. } else if ( jQuery.isFunction( selector ) )
  67. return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
  68. return this.setArray(jQuery.makeArray(selector));
  69. },
  70. // The current version of jQuery being used
  71. jquery: "1.2.6",
  72. // The number of elements contained in the matched element set
  73. size: function() {
  74. return this.length;
  75. },
  76. // The number of elements contained in the matched element set
  77. length: 0,
  78. // Get the Nth element in the matched element set OR
  79. // Get the whole matched element set as a clean array
  80. get: function( num ) {
  81. return num == undefined ?
  82. // Return a 'clean' array
  83. jQuery.makeArray( this ) :
  84. // Return just the object
  85. this[ num ];
  86. },
  87. // Take an array of elements and push it onto the stack
  88. // (returning the new matched element set)
  89. pushStack: function( elems ) {
  90. // Build a new jQuery matched element set
  91. var ret = jQuery( elems );
  92. // Add the old object onto the stack (as a reference)
  93. ret.prevObject = this;
  94. // Return the newly-formed element set
  95. return ret;
  96. },
  97. // Force the current matched set of elements to become
  98. // the specified array of elements (destroying the stack in the process)
  99. // You should use pushStack() in order to do this, but maintain the stack
  100. setArray: function( elems ) {
  101. // Resetting the length to 0, then using the native Array push
  102. // is a super-fast way to populate an object with array-like properties
  103. this.length = 0;
  104. Array.prototype.push.apply( this, elems );
  105. return this;
  106. },
  107. // Execute a callback for every element in the matched set.
  108. // (You can seed the arguments with an array of args, but this is
  109. // only used internally.)
  110. each: function( callback, args ) {
  111. return jQuery.each( this, callback, args );
  112. },
  113. // Determine the position of an element within
  114. // the matched set of elements
  115. index: function( elem ) {
  116. var ret = -1;
  117. // Locate the position of the desired element
  118. return jQuery.inArray(
  119. // If it receives a jQuery object, the first element is used
  120. elem && elem.jquery ? elem[0] : elem
  121. , this );
  122. },
  123. attr: function( name, value, type ) {
  124. var options = name;
  125. // Look for the case where we're accessing a style value
  126. if ( name.constructor == String )
  127. if ( value === undefined )
  128. return this[0] && jQuery[ type || "attr" ]( this[0], name );
  129. else {
  130. options = {};
  131. options[ name ] = value;
  132. }
  133. // Check to see if we're setting style values
  134. return this.each(function(i){
  135. // Set all the styles
  136. for ( name in options )
  137. jQuery.attr(
  138. type ?
  139. this.style :
  140. this,
  141. name, jQuery.prop( this, options[ name ], type, i, name )
  142. );
  143. });
  144. },
  145. css: function( key, value ) {
  146. // ignore negative width and height values
  147. if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  148. value = undefined;
  149. return this.attr( key, value, "curCSS" );
  150. },
  151. text: function( text ) {
  152. if ( typeof text != "object" && text != null )
  153. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  154. var ret = "";
  155. jQuery.each( text || this, function(){
  156. jQuery.each( this.childNodes, function(){
  157. if ( this.nodeType != 8 )
  158. ret += this.nodeType != 1 ?
  159. this.nodeValue :
  160. jQuery.fn.text( [ this ] );
  161. });
  162. });
  163. return ret;
  164. },
  165. wrapAll: function( html ) {
  166. if ( this[0] )
  167. // The elements to wrap the target around
  168. jQuery( html, this[0].ownerDocument )
  169. .clone()
  170. .insertBefore( this[0] )
  171. .map(function(){
  172. var elem = this;
  173. while ( elem.firstChild )
  174. elem = elem.firstChild;
  175. return elem;
  176. })
  177. .append(this);
  178. return this;
  179. },
  180. wrapInner: function( html ) {
  181. return this.each(function(){
  182. jQuery( this ).contents().wrapAll( html );
  183. });
  184. },
  185. wrap: function( html ) {
  186. return this.each(function(){
  187. jQuery( this ).wrapAll( html );
  188. });
  189. },
  190. append: function() {
  191. return this.domManip(arguments, true, false, function(elem){
  192. if (this.nodeType == 1)
  193. this.appendChild( elem );
  194. });
  195. },
  196. prepend: function() {
  197. return this.domManip(arguments, true, true, function(elem){
  198. if (this.nodeType == 1)
  199. this.insertBefore( elem, this.firstChild );
  200. });
  201. },
  202. before: function() {
  203. return this.domManip(arguments, false, false, function(elem){
  204. this.parentNode.insertBefore( elem, this );
  205. });
  206. },
  207. after: function() {
  208. return this.domManip(arguments, false, true, function(elem){
  209. this.parentNode.insertBefore( elem, this.nextSibling );
  210. });
  211. },
  212. end: function() {
  213. return this.prevObject || jQuery( [] );
  214. },
  215. find: function( selector ) {
  216. var elems = jQuery.map(this, function(elem){
  217. return jQuery.find( selector, elem );
  218. });
  219. return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
  220. jQuery.unique( elems ) :
  221. elems );
  222. },
  223. clone: function( events ) {
  224. // Do the clone
  225. var ret = this.map(function(){
  226. if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
  227. // IE copies events bound via attachEvent when
  228. // using cloneNode. Calling detachEvent on the
  229. // clone will also remove the events from the orignal
  230. // In order to get around this, we use innerHTML.
  231. // Unfortunately, this means some modifications to
  232. // attributes in IE that are actually only stored
  233. // as properties will not be copied (such as the
  234. // the name attribute on an input).
  235. var clone = this.cloneNode(true),
  236. container = document.createElement("div");
  237. container.appendChild(clone);
  238. return jQuery.clean([container.innerHTML])[0];
  239. } else
  240. return this.cloneNode(true);
  241. });
  242. // Need to set the expando to null on the cloned set if it exists
  243. // removeData doesn't work here, IE removes it from the original as well
  244. // this is primarily for IE but the data expando shouldn't be copied over in any browser
  245. var clone = ret.find("*").andSelf().each(function(){
  246. if ( this[ expando ] != undefined )
  247. this[ expando ] = null;
  248. });
  249. // Copy the events from the original to the clone
  250. if ( events === true )
  251. this.find("*").andSelf().each(function(i){
  252. if (this.nodeType == 3)
  253. return;
  254. var events = jQuery.data( this, "events" );
  255. for ( var type in events )
  256. for ( var handler in events[ type ] )
  257. jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
  258. });
  259. // Return the cloned set
  260. return ret;
  261. },
  262. filter: function( selector ) {
  263. return this.pushStack(
  264. jQuery.isFunction( selector ) &&
  265. jQuery.grep(this, function(elem, i){
  266. return selector.call( elem, i );
  267. }) ||
  268. jQuery.multiFilter( selector, this ) );
  269. },
  270. not: function( selector ) {
  271. if ( selector.constructor == String )
  272. // test special case where just one selector is passed in
  273. if ( isSimple.test( selector ) )
  274. return this.pushStack( jQuery.multiFilter( selector, this, true ) );
  275. else
  276. selector = jQuery.multiFilter( selector, this );
  277. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  278. return this.filter(function() {
  279. return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  280. });
  281. },
  282. add: function( selector ) {
  283. return this.pushStack( jQuery.unique( jQuery.merge(
  284. this.get(),
  285. typeof selector == 'string' ?
  286. jQuery( selector ) :
  287. jQuery.makeArray( selector )
  288. )));
  289. },
  290. is: function( selector ) {
  291. return !!selector && jQuery.multiFilter( selector, this ).length > 0;
  292. },
  293. hasClass: function( selector ) {
  294. return this.is( "." + selector );
  295. },
  296. val: function( value ) {
  297. if ( value == undefined ) {
  298. if ( this.length ) {
  299. var elem = this[0];
  300. // We need to handle select boxes special
  301. if ( jQuery.nodeName( elem, "select" ) ) {
  302. var index = elem.selectedIndex,
  303. values = [],
  304. options = elem.options,
  305. one = elem.type == "select-one";
  306. // Nothing was selected
  307. if ( index < 0 )
  308. return null;
  309. // Loop through all the selected options
  310. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  311. var option = options[ i ];
  312. if ( option.selected ) {
  313. // Get the specifc value for the option
  314. value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
  315. // We don't need an array for one selects
  316. if ( one )
  317. return value;
  318. // Multi-Selects return an array
  319. values.push( value );
  320. }
  321. }
  322. return values;
  323. // Everything else, we just grab the value
  324. } else
  325. return (this[0].value || "").replace(/\r/g, "");
  326. }
  327. return undefined;
  328. }
  329. if( value.constructor == Number )
  330. value += '';
  331. return this.each(function(){
  332. if ( this.nodeType != 1 )
  333. return;
  334. if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
  335. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  336. jQuery.inArray(this.name, value) >= 0);
  337. else if ( jQuery.nodeName( this, "select" ) ) {
  338. var values = jQuery.makeArray(value);
  339. jQuery( "option", this ).each(function(){
  340. this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  341. jQuery.inArray( this.text, values ) >= 0);
  342. });
  343. if ( !values.length )
  344. this.selectedIndex = -1;
  345. } else
  346. this.value = value;
  347. });
  348. },
  349. html: function( value ) {
  350. return value == undefined ?
  351. (this[0] ?
  352. this[0].innerHTML :
  353. null) :
  354. this.empty().append( value );
  355. },
  356. replaceWith: function( value ) {
  357. return this.after( value ).remove();
  358. },
  359. eq: function( i ) {
  360. return this.slice( i, i + 1 );
  361. },
  362. slice: function() {
  363. return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
  364. },
  365. map: function( callback ) {
  366. return this.pushStack( jQuery.map(this, function(elem, i){
  367. return callback.call( elem, i, elem );
  368. }));
  369. },
  370. andSelf: function() {
  371. return this.add( this.prevObject );
  372. },
  373. data: function( key, value ){
  374. var parts = key.split(".");
  375. parts[1] = parts[1] ? "." + parts[1] : "";
  376. if ( value === undefined ) {
  377. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  378. if ( data === undefined && this.length )
  379. data = jQuery.data( this[0], key );
  380. return data === undefined && parts[1] ?
  381. this.data( parts[0] ) :
  382. data;
  383. } else
  384. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
  385. jQuery.data( this, key, value );
  386. });
  387. },
  388. removeData: function( key ){
  389. return this.each(function(){
  390. jQuery.removeData( this, key );
  391. });
  392. },
  393. domManip: function( args, table, reverse, callback ) {
  394. var clone = this.length > 1, elems;
  395. return this.each(function(){
  396. if ( !elems ) {
  397. elems = jQuery.clean( args, this.ownerDocument );
  398. if ( reverse )
  399. elems.reverse();
  400. }
  401. var obj = this;
  402. if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
  403. obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
  404. var scripts = jQuery( [] );
  405. jQuery.each(elems, function(){
  406. var elem = clone ?
  407. jQuery( this ).clone( true )[0] :
  408. this;
  409. // execute all scripts after the elements have been injected
  410. if ( jQuery.nodeName( elem, "script" ) )
  411. scripts = scripts.add( elem );
  412. else {
  413. // Remove any inner scripts for later evaluation
  414. if ( elem.nodeType == 1 )
  415. scripts = scripts.add( jQuery( "script", elem ).remove() );
  416. // Inject the elements into the document
  417. callback.call( obj, elem );
  418. }
  419. });
  420. scripts.each( evalScript );
  421. });
  422. }
  423. };
  424. // Give the init function the jQuery prototype for later instantiation
  425. jQuery.fn.init.prototype = jQuery.fn;
  426. function evalScript( i, elem ) {
  427. if ( elem.src )
  428. jQuery.ajax({
  429. url: elem.src,
  430. async: false,
  431. dataType: "script"
  432. });
  433. else
  434. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  435. if ( elem.parentNode )
  436. elem.parentNode.removeChild( elem );
  437. }
  438. function now(){
  439. return +new Date;
  440. }
  441. jQuery.extend = jQuery.fn.extend = function() {
  442. // copy reference to target object
  443. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  444. // Handle a deep copy situation
  445. if ( target.constructor == Boolean ) {
  446. deep = target;
  447. target = arguments[1] || {};
  448. // skip the boolean and the target
  449. i = 2;
  450. }
  451. // Handle case when target is a string or something (possible in deep copy)
  452. if ( typeof target != "object" && typeof target != "function" )
  453. target = {};
  454. // extend jQuery itself if only one argument is passed
  455. if ( length == i ) {
  456. target = this;
  457. --i;
  458. }
  459. for ( ; i < length; i++ )
  460. // Only deal with non-null/undefined values
  461. if ( (options = arguments[ i ]) != null )
  462. // Extend the base object
  463. for ( var name in options ) {
  464. var src = target[ name ], copy = options[ name ];
  465. // Prevent never-ending loop
  466. if ( target === copy )
  467. continue;
  468. // Recurse if we're merging object values
  469. if ( deep && copy && typeof copy == "object" && !copy.nodeType )
  470. target[ name ] = jQuery.extend( deep,
  471. // Never move original objects, clone them
  472. src || ( copy.length != null ? [ ] : { } )
  473. , copy );
  474. // Don't bring in undefined values
  475. else if ( copy !== undefined )
  476. target[ name ] = copy;
  477. }
  478. // Return the modified object
  479. return target;
  480. };
  481. var expando = "jQuery" + now(), uuid = 0, windowData = {},
  482. // exclude the following css properties to add px
  483. exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  484. // cache defaultView
  485. defaultView = document.defaultView || {};
  486. jQuery.extend({
  487. noConflict: function( deep ) {
  488. window.$ = _$;
  489. if ( deep )
  490. window.jQuery = _jQuery;
  491. return jQuery;
  492. },
  493. // See test/unit/core.js for details concerning this function.
  494. isFunction: function( fn ) {
  495. return !!fn && typeof fn != "string" && !fn.nodeName &&
  496. fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
  497. },
  498. // check if an element is in a (or is an) XML document
  499. isXMLDoc: function( elem ) {
  500. return elem.documentElement && !elem.body ||
  501. elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
  502. },
  503. // Evalulates a script in a global context
  504. globalEval: function( data ) {
  505. data = jQuery.trim( data );
  506. if ( data ) {
  507. // Inspired by code by Andrea Giammarchi
  508. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  509. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  510. script = document.createElement("script");
  511. script.type = "text/javascript";
  512. if ( jQuery.browser.msie )
  513. script.text = data;
  514. else
  515. script.appendChild( document.createTextNode( data ) );
  516. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  517. // This arises when a base node is used (#2709).
  518. head.insertBefore( script, head.firstChild );
  519. head.removeChild( script );
  520. }
  521. },
  522. nodeName: function( elem, name ) {
  523. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  524. },
  525. cache: {},
  526. data: function( elem, name, data ) {
  527. elem = elem == window ?
  528. windowData :
  529. elem;
  530. var id = elem[ expando ];
  531. // Compute a unique ID for the element
  532. if ( !id )
  533. id = elem[ expando ] = ++uuid;
  534. // Only generate the data cache if we're
  535. // trying to access or manipulate it
  536. if ( name && !jQuery.cache[ id ] )
  537. jQuery.cache[ id ] = {};
  538. // Prevent overriding the named cache with undefined values
  539. if ( data !== undefined )
  540. jQuery.cache[ id ][ name ] = data;
  541. // Return the named cache data, or the ID for the element
  542. return name ?
  543. jQuery.cache[ id ][ name ] :
  544. id;
  545. },
  546. removeData: function( elem, name ) {
  547. elem = elem == window ?
  548. windowData :
  549. elem;
  550. var id = elem[ expando ];
  551. // If we want to remove a specific section of the element's data
  552. if ( name ) {
  553. if ( jQuery.cache[ id ] ) {
  554. // Remove the section of cache data
  555. delete jQuery.cache[ id ][ name ];
  556. // If we've removed all the data, remove the element's cache
  557. name = "";
  558. for ( name in jQuery.cache[ id ] )
  559. break;
  560. if ( !name )
  561. jQuery.removeData( elem );
  562. }
  563. // Otherwise, we want to remove all of the element's data
  564. } else {
  565. // Clean up the element expando
  566. try {
  567. delete elem[ expando ];
  568. } catch(e){
  569. // IE has trouble directly removing the expando
  570. // but it's ok with using removeAttribute
  571. if ( elem.removeAttribute )
  572. elem.removeAttribute( expando );
  573. }
  574. // Completely remove the data cache
  575. delete jQuery.cache[ id ];
  576. }
  577. },
  578. // args is for internal usage only
  579. each: function( object, callback, args ) {
  580. var name, i = 0, length = object.length;
  581. if ( args ) {
  582. if ( length == undefined ) {
  583. for ( name in object )
  584. if ( callback.apply( object[ name ], args ) === false )
  585. break;
  586. } else
  587. for ( ; i < length; )
  588. if ( callback.apply( object[ i++ ], args ) === false )
  589. break;
  590. // A special, fast, case for the most common use of each
  591. } else {
  592. if ( length == undefined ) {
  593. for ( name in object )
  594. if ( callback.call( object[ name ], name, object[ name ] ) === false )
  595. break;
  596. } else
  597. for ( var value = object[0];
  598. i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  599. }
  600. return object;
  601. },
  602. prop: function( elem, value, type, i, name ) {
  603. // Handle executable functions
  604. if ( jQuery.isFunction( value ) )
  605. value = value.call( elem, i );
  606. // Handle passing in a number to a CSS property
  607. return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
  608. value + "px" :
  609. value;
  610. },
  611. className: {
  612. // internal only, use addClass("class")
  613. add: function( elem, classNames ) {
  614. jQuery.each((classNames || "").split(/\s+/), function(i, className){
  615. if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  616. elem.className += (elem.className ? " " : "") + className;
  617. });
  618. },
  619. // internal only, use removeClass("class")
  620. remove: function( elem, classNames ) {
  621. if (elem.nodeType == 1)
  622. elem.className = classNames != undefined ?
  623. jQuery.grep(elem.className.split(/\s+/), function(className){
  624. return !jQuery.className.has( classNames, className );
  625. }).join(" ") :
  626. "";
  627. },
  628. // internal only, use hasClass("class")
  629. has: function( elem, className ) {
  630. return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  631. }
  632. },
  633. // A method for quickly swapping in/out CSS properties to get correct calculations
  634. swap: function( elem, options, callback ) {
  635. var old = {};
  636. // Remember the old values, and insert the new ones
  637. for ( var name in options ) {
  638. old[ name ] = elem.style[ name ];
  639. elem.style[ name ] = options[ name ];
  640. }
  641. callback.call( elem );
  642. // Revert the old values
  643. for ( var name in options )
  644. elem.style[ name ] = old[ name ];
  645. },
  646. css: function( elem, name, force ) {
  647. if ( name == "width" || name == "height" ) {
  648. var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  649. function getWH() {
  650. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  651. var padding = 0, border = 0;
  652. jQuery.each( which, function() {
  653. padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  654. border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  655. });
  656. val -= Math.round(padding + border);
  657. }
  658. if ( jQuery(elem).is(":visible") )
  659. getWH();
  660. else
  661. jQuery.swap( elem, props, getWH );
  662. return Math.max(0, val);
  663. }
  664. return jQuery.curCSS( elem, name, force );
  665. },
  666. curCSS: function( elem, name, force ) {
  667. var ret, style = elem.style;
  668. // A helper method for determining if an element's values are broken
  669. function color( elem ) {
  670. if ( !jQuery.browser.safari )
  671. return false;
  672. // defaultView is cached
  673. var ret = defaultView.getComputedStyle( elem, null );
  674. return !ret || ret.getPropertyValue("color") == "";
  675. }
  676. // We need to handle opacity special in IE
  677. if ( name == "opacity" && jQuery.browser.msie ) {
  678. ret = jQuery.attr( style, "opacity" );
  679. return ret == "" ?
  680. "1" :
  681. ret;
  682. }
  683. // Opera sometimes will give the wrong display answer, this fixes it, see #2037
  684. if ( jQuery.browser.opera && name == "display" ) {
  685. var save = style.outline;
  686. style.outline = "0 solid black";
  687. style.outline = save;
  688. }
  689. // Make sure we're using the right name for getting the float value
  690. if ( name.match( /float/i ) )
  691. name = styleFloat;
  692. if ( !force && style && style[ name ] )
  693. ret = style[ name ];
  694. else if ( defaultView.getComputedStyle ) {
  695. // Only "float" is needed here
  696. if ( name.match( /float/i ) )
  697. name = "float";
  698. name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  699. var computedStyle = defaultView.getComputedStyle( elem, null );
  700. if ( computedStyle && !color( elem ) )
  701. ret = computedStyle.getPropertyValue( name );
  702. // If the element isn't reporting its values properly in Safari
  703. // then some display: none elements are involved
  704. else {
  705. var swap = [], stack = [], a = elem, i = 0;
  706. // Locate all of the parent display: none elements
  707. for ( ; a && color(a); a = a.parentNode )
  708. stack.unshift(a);
  709. // Go through and make them visible, but in reverse
  710. // (It would be better if we knew the exact display type that they had)
  711. for ( ; i < stack.length; i++ )
  712. if ( color( stack[ i ] ) ) {
  713. swap[ i ] = stack[ i ].style.display;
  714. stack[ i ].style.display = "block";
  715. }
  716. // Since we flip the display style, we have to handle that
  717. // one special, otherwise get the value
  718. ret = name == "display" && swap[ stack.length - 1 ] != null ?
  719. "none" :
  720. ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
  721. // Finally, revert the display styles back
  722. for ( i = 0; i < swap.length; i++ )
  723. if ( swap[ i ] != null )
  724. stack[ i ].style.display = swap[ i ];
  725. }
  726. // We should always get a number back from opacity
  727. if ( name == "opacity" && ret == "" )
  728. ret = "1";
  729. } else if ( elem.currentStyle ) {
  730. var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  731. return letter.toUpperCase();
  732. });
  733. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  734. // From the awesome hack by Dean Edwards
  735. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  736. // If we're not dealing with a regular pixel number
  737. // but a number that has a weird ending, we need to convert it to pixels
  738. if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  739. // Remember the original values
  740. var left = style.left, rsLeft = elem.runtimeStyle.left;
  741. // Put in the new values to get a computed value out
  742. elem.runtimeStyle.left = elem.currentStyle.left;
  743. style.left = ret || 0;
  744. ret = style.pixelLeft + "px";
  745. // Revert the changed values
  746. style.left = left;
  747. elem.runtimeStyle.left = rsLeft;
  748. }
  749. }
  750. return ret;
  751. },
  752. clean: function( elems, context ) {
  753. var ret = [];
  754. context = context || document;
  755. // !context.createElement fails in IE with an error but returns typeof 'object'
  756. if (typeof context.createElement == 'undefined')
  757. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  758. jQuery.each(elems, function(i, elem){
  759. if ( !elem )
  760. return;
  761. if ( elem.constructor == Number )
  762. elem += '';
  763. // Convert html string into DOM nodes
  764. if ( typeof elem == "string" ) {
  765. // Fix "XHTML"-style tags in all browsers
  766. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  767. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  768. all :
  769. front + "></" + tag + ">";
  770. });
  771. // Trim whitespace, otherwise indexOf won't work as expected
  772. var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
  773. var wrap =
  774. // option or optgroup
  775. !tags.indexOf("<opt") &&
  776. [ 1, "<select multiple='multiple'>", "</select>" ] ||
  777. !tags.indexOf("<leg") &&
  778. [ 1, "<fieldset>", "</fieldset>" ] ||
  779. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  780. [ 1, "<table>", "</table>" ] ||
  781. !tags.indexOf("<tr") &&
  782. [ 2, "<table><tbody>", "</tbody></table>" ] ||
  783. // <thead> matched above
  784. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  785. [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  786. !tags.indexOf("<col") &&
  787. [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  788. // IE can't serialize <link> and <script> tags normally
  789. jQuery.browser.msie &&
  790. [ 1, "div<div>", "</div>" ] ||
  791. [ 0, "", "" ];
  792. // Go to html and back, then peel off extra wrappers
  793. div.innerHTML = wrap[1] + elem + wrap[2];
  794. // Move to the right depth
  795. while ( wrap[0]-- )
  796. div = div.lastChild;
  797. // Remove IE's autoinserted <tbody> from table fragments
  798. if ( jQuery.browser.msie ) {
  799. // String was a <table>, *may* have spurious <tbody>
  800. var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
  801. div.firstChild && div.firstChild.childNodes :
  802. // String was a bare <thead> or <tfoot>
  803. wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
  804. div.childNodes :
  805. [];
  806. for ( var j = tbody.length - 1; j >= 0 ; --j )
  807. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  808. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  809. // IE completely kills leading whitespace when innerHTML is used
  810. if ( /^\s/.test( elem ) )
  811. div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  812. }
  813. elem = jQuery.makeArray( div.childNodes );
  814. }
  815. if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
  816. return;
  817. if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
  818. ret.push( elem );
  819. else
  820. ret = jQuery.merge( ret, elem );
  821. });
  822. return ret;
  823. },
  824. attr: function( elem, name, value ) {
  825. // don't set attributes on text and comment nodes
  826. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  827. return undefined;
  828. var notxml = !jQuery.isXMLDoc( elem ),
  829. // Whether we are setting (or getting)
  830. set = value !== undefined,
  831. msie = jQuery.browser.msie;
  832. // Try to normalize/fix the name
  833. name = notxml && jQuery.props[ name ] || name;
  834. // Only do all the following if this is a node (faster for style)
  835. // IE elem.getAttribute passes even for style
  836. if ( elem.tagName ) {
  837. // These attributes require special treatment
  838. var special = /href|src|style/.test( name );
  839. // Safari mis-reports the default selected property of a hidden option
  840. // Accessing the parent's selectedIndex property fixes it
  841. if ( name == "selected" && jQuery.browser.safari )
  842. elem.parentNode.selectedIndex;
  843. // If applicable, access the attribute via the DOM 0 way
  844. if ( name in elem && notxml && !special ) {
  845. if ( set ){
  846. // We can't allow the type property to be changed (since it causes problems in IE)
  847. if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  848. throw "type property can't be changed";
  849. elem[ name ] = value;
  850. }
  851. // browsers index elements by id/name on forms, give priority to attributes.
  852. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
  853. return elem.getAttributeNode( name ).nodeValue;
  854. return elem[ name ];
  855. }
  856. if ( msie && notxml && name == "style" )
  857. return jQuery.attr( elem.style, "cssText", value );
  858. if ( set )
  859. // convert the value to a string (all browsers do this but IE) see #1070
  860. elem.setAttribute( name, "" + value );
  861. var attr = msie && notxml && special
  862. // Some attributes require a special call on IE
  863. ? elem.getAttribute( name, 2 )
  864. : elem.getAttribute( name );
  865. // Non-existent attributes return null, we normalize to undefined
  866. return attr === null ? undefined : attr;
  867. }
  868. // elem is actually elem.style ... set the style
  869. // IE uses filters for opacity
  870. if ( msie && name == "opacity" ) {
  871. if ( set ) {
  872. // IE has trouble with opacity if it does not have layout
  873. // Force it by setting the zoom level
  874. elem.zoom = 1;
  875. // Set the alpha filter to set the opacity
  876. elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  877. (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  878. }
  879. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  880. (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
  881. "";
  882. }
  883. name = name.replace(/-([a-z])/ig, function(all, letter){
  884. return letter.toUpperCase();
  885. });
  886. if ( set )
  887. elem[ name ] = value;
  888. return elem[ name ];
  889. },
  890. trim: function( text ) {
  891. return (text || "").replace( /^\s+|\s+$/g, "" );
  892. },
  893. makeArray: function( array ) {
  894. var ret = [];
  895. if( array != null ){
  896. var i = array.length;
  897. //the window, strings and functions also have 'length'
  898. if( i == null || array.split || array.setInterval || array.call )
  899. ret[0] = array;
  900. else
  901. while( i )
  902. ret[--i] = array[i];
  903. }
  904. return ret;
  905. },
  906. inArray: function( elem, array ) {
  907. for ( var i = 0, length = array.length; i < length; i++ )
  908. // Use === because on IE, window == document
  909. if ( array[ i ] === elem )
  910. return i;
  911. return -1;
  912. },
  913. merge: function( first, second ) {
  914. // We have to loop this way because IE & Opera overwrite the length
  915. // expando of getElementsByTagName
  916. var i = 0, elem, pos = first.length;
  917. // Also, we need to make sure that the correct elements are being returned
  918. // (IE returns comment nodes in a '*' query)
  919. if ( jQuery.browser.msie ) {
  920. while ( elem = second[ i++ ] )
  921. if ( elem.nodeType != 8 )
  922. first[ pos++ ] = elem;
  923. } else
  924. while ( elem = second[ i++ ] )
  925. first[ pos++ ] = elem;
  926. return first;
  927. },
  928. unique: function( array ) {
  929. var ret = [], done = {};
  930. try {
  931. for ( var i = 0, length = array.length; i < length; i++ ) {
  932. var id = jQuery.data( array[ i ] );
  933. if ( !done[ id ] ) {
  934. done[ id ] = true;
  935. ret.push( array[ i ] );
  936. }
  937. }
  938. } catch( e ) {
  939. ret = array;
  940. }
  941. return ret;
  942. },
  943. grep: function( elems, callback, inv ) {
  944. var ret = [];
  945. // Go through the array, only saving the items
  946. // that pass the validator function
  947. for ( var i = 0, length = elems.length; i < length; i++ )
  948. if ( !inv != !callback( elems[ i ], i ) )
  949. ret.push( elems[ i ] );
  950. return ret;
  951. },
  952. map: function( elems, callback ) {
  953. var ret = [];
  954. // Go through the array, translating each of the items to their
  955. // new value (or values).
  956. for ( var i = 0, length = elems.length; i < length; i++ ) {
  957. var value = callback( elems[ i ], i );
  958. if ( value != null )
  959. ret[ ret.length ] = value;
  960. }
  961. return ret.concat.apply( [], ret );
  962. }
  963. });
  964. var userAgent = navigator.userAgent.toLowerCase();
  965. // Figure out what browser is being used
  966. jQuery.browser = {
  967. version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
  968. safari: /webkit/.test( userAgent ),
  969. opera: /opera/.test( userAgent ),
  970. msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  971. mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  972. };
  973. var styleFloat = jQuery.browser.msie ?
  974. "styleFloat" :
  975. "cssFloat";
  976. jQuery.extend({
  977. // Check to see if the W3C box model is being used
  978. boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
  979. props: {
  980. "for": "htmlFor",
  981. "class": "className",
  982. "float": styleFloat,
  983. cssFloat: styleFloat,
  984. styleFloat: styleFloat,
  985. readonly: "readOnly",
  986. maxlength: "maxLength",
  987. cellspacing: "cellSpacing"
  988. }
  989. });
  990. jQuery.each({
  991. parent: function(elem){return elem.parentNode;},
  992. parents: function(elem){return jQuery.dir(elem,"parentNode");},
  993. next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
  994. prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
  995. nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
  996. prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
  997. siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
  998. children: function(elem){return jQuery.sibling(elem.firstChild);},
  999. contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
  1000. }, function(name, fn){
  1001. jQuery.fn[ name ] = function( selector ) {
  1002. var ret = jQuery.map( this, fn );
  1003. if ( selector && typeof selector == "string" )
  1004. ret = jQuery.multiFilter( selector, ret );
  1005. return this.pushStack( jQuery.unique( ret ) );
  1006. };
  1007. });
  1008. jQuery.each({
  1009. appendTo: "append",
  1010. prependTo: "prepend",
  1011. insertBefore: "before",
  1012. insertAfter: "after",
  1013. replaceAll: "replaceWith"
  1014. }, function(name, original){
  1015. jQuery.fn[ name ] = function() {
  1016. var args = arguments;
  1017. return this.each(function(){
  1018. for ( var i = 0, length = args.length; i < length; i++ )
  1019. jQuery( args[ i ] )[ original ]( this );
  1020. });
  1021. };
  1022. });
  1023. jQuery.each({
  1024. removeAttr: function( name ) {
  1025. jQuery.attr( this, name, "" );
  1026. if (this.nodeType == 1)
  1027. this.removeAttribute( name );
  1028. },
  1029. addClass: function( classNames ) {
  1030. jQuery.className.add( this, classNames );
  1031. },
  1032. removeClass: function( classNames ) {
  1033. jQuery.className.remove( this, classNames );
  1034. },
  1035. toggleClass: function( classNames ) {
  1036. jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
  1037. },
  1038. remove: function( selector ) {
  1039. if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
  1040. // Prevent memory leaks
  1041. jQuery( "*", this ).add(this).each(function(){
  1042. jQuery.event.remove(this);
  1043. jQuery.removeData(this);
  1044. });
  1045. if (this.parentNode)
  1046. this.parentNode.removeChild( this );
  1047. }
  1048. },
  1049. empty: function() {
  1050. // Remove element nodes and prevent memory leaks
  1051. jQuery( ">*", this ).remove();
  1052. // Remove any remaining nodes
  1053. while ( this.firstChild )
  1054. this.removeChild( this.firstChild );
  1055. }
  1056. }, function(name, fn){
  1057. jQuery.fn[ name ] = function(){
  1058. return this.each( fn, arguments );
  1059. };
  1060. });
  1061. jQuery.each([ "Height", "Width" ], function(i, name){
  1062. var type = name.toLowerCase();
  1063. jQuery.fn[ type ] = function( size ) {
  1064. // Get window width or height
  1065. return this[0] == window ?
  1066. // Opera reports document.body.client[Width/Height] properly in both quirks and standards
  1067. jQuery.browser.opera && document.body[ "client" + name ] ||
  1068. // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
  1069. jQuery.browser.safari && window[ "inner" + name ] ||
  1070. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  1071. document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
  1072. // Get document width or height
  1073. this[0] == document ?
  1074. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  1075. Math.max(
  1076. Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
  1077. Math.max(document.body["offset" + name], document.documentElement["offset" + name])
  1078. ) :
  1079. // Get or set width or height on the element
  1080. size == undefined ?
  1081. // Get width or height on the element
  1082. (this.length ? jQuery.css( this[0], type ) : null) :
  1083. // Set the width or height on the element (default to pixels if value is unitless)
  1084. this.css( type, size.constructor == String ? size : size + "px" );
  1085. };
  1086. });
  1087. // Helper function used by the dimensions and offset modules
  1088. function num(elem, prop) {
  1089. return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
  1090. }var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
  1091. "(?:[\\w*_-]|\\\\.)" :
  1092. "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
  1093. quickChild = new RegExp("^>\\s*(" + chars + "+)"),
  1094. quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
  1095. quickClass = new RegExp("^([#.]?)(" + chars + "*)");
  1096. jQuery.extend({
  1097. expr: {
  1098. "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
  1099. "#": function(a,i,m){return a.getAttribute("id")==m[2];},
  1100. ":": {
  1101. // Position Checks
  1102. lt: function(a,i,m){return i<m[3]-0;},
  1103. gt: function(a,i,m){return i>m[3]-0;},
  1104. nth: function(a,i,m){return m[3]-0==i;},
  1105. eq: function(a,i,m){return m[3]-0==i;},
  1106. first: function(a,i){return i==0;},
  1107. last: function(a,i,m,r){return i==r.length-1;},
  1108. even: function(a,i){return i%2==0;},
  1109. odd: function(a,i){return i%2;},
  1110. // Child Checks
  1111. "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
  1112. "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
  1113. "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
  1114. // Parent Checks
  1115. parent: function(a){return a.firstChild;},
  1116. empty: function(a){return !a.firstChild;},
  1117. // Text Check
  1118. contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
  1119. // Visibility
  1120. visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
  1121. hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
  1122. // Form attributes
  1123. enabled: function(a){return !a.disabled;},
  1124. disabled: function(a){return a.disabled;},
  1125. checked: function(a){return a.checked;},
  1126. selected: function(a){return a.selected||jQuery.attr(a,"selected");},
  1127. // Form elements
  1128. text: function(a){return "text"==a.type;},
  1129. radio: function(a){return "radio"==a.type;},
  1130. checkbox: function(a){return "checkbox"==a.type;},
  1131. file: function(a){return "file"==a.type;},
  1132. password: function(a){return "password"==a.type;},
  1133. submit: function(a){return "submit"==a.type;},
  1134. image: function(a){return "image"==a.type;},
  1135. reset: function(a){return "reset"==a.type;},
  1136. button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
  1137. input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
  1138. // :has()
  1139. has: function(a,i,m){return jQuery.find(m[3],a).length;},
  1140. // :header
  1141. header: function(a){return /h\d/i.test(a.nodeName);},
  1142. // :animated
  1143. animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
  1144. }
  1145. },
  1146. // The regular expressions that power the parsing engine
  1147. parse: [
  1148. // Match: [@value='test'], [@foo]
  1149. /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
  1150. // Match: :contains('foo')
  1151. /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
  1152. // Match: :even, :last-child, #id, .class
  1153. new RegExp("^([:.#]*)(" + chars + "+)")
  1154. ],
  1155. multiFilter: function( expr, elems, not ) {
  1156. var old, cur = [];
  1157. while ( expr && expr != old ) {
  1158. old = expr;
  1159. var f = jQuery.filter( expr, elems, not );
  1160. expr = f.t.replace(/^\s*,\s*/, "" );
  1161. cur = not ? elems = f.r : jQuery.merge( cur, f.r );
  1162. }
  1163. return cur;
  1164. },
  1165. find: function( t, context ) {
  1166. // Quickly handle non-string expressions
  1167. if ( typeof t != "string" )
  1168. return [ t ];
  1169. // check to make sure context is a DOM element or a document
  1170. if ( context && context.nodeType != 1 && context.nodeType != 9)
  1171. return [ ];
  1172. // Set the correct context (if none is provided)
  1173. context = context || document;
  1174. // Initialize the search
  1175. var ret = [context], done = [], last, nodeName;
  1176. // Continue while a selector expression exists, and while
  1177. // we're no longer looping upon ourselves
  1178. while ( t && last != t ) {
  1179. var r = [];
  1180. last = t;
  1181. t = jQuery.trim(t);
  1182. var foundToken = false,
  1183. // An attempt at speeding up child selectors that
  1184. // point to a specific element tag
  1185. re = quickChild,
  1186. m = re.exec(t);
  1187. if ( m ) {
  1188. nodeName = m[1].toUpperCase();
  1189. // Perform our own iteration and filter
  1190. for ( var i = 0; ret[i]; i++ )
  1191. for ( var c = ret[i].firstChild; c; c = c.nextSibling )
  1192. if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
  1193. r.push( c );
  1194. ret = r;
  1195. t = t.replace( re, "" );
  1196. if ( t.indexOf(" ") == 0 ) continue;
  1197. foundToken = true;
  1198. } else {
  1199. re = /^([>+~])\s*(\w*)/i;
  1200. if ( (m = re.exec(t)) != null ) {
  1201. r = [];
  1202. var merge = {};
  1203. nodeName = m[2].toUpperCase();
  1204. m = m[1];
  1205. for ( var j = 0, rl = ret.length; j < rl; j++ ) {
  1206. var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
  1207. for ( ; n; n = n.nextSibling )
  1208. if ( n.nodeType == 1 ) {
  1209. var id = jQuery.data(n);
  1210. if ( m == "~" && merge[id] ) break;
  1211. if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
  1212. if ( m == "~" ) merge[id] = true;
  1213. r.push( n );
  1214. }
  1215. if ( m == "+" ) break;
  1216. }
  1217. }
  1218. ret = r;
  1219. // And remove the token
  1220. t = jQuery.trim( t.replace( re, "" ) );
  1221. foundToken = true;
  1222. }
  1223. }
  1224. // See if there's still an expression, and that we haven't already
  1225. // matched a token
  1226. if ( t && !foundToken ) {
  1227. // Handle multiple expressions
  1228. if ( !t.indexOf(",") ) {
  1229. // Clean the result set
  1230. if ( context == ret[0] ) ret.shift();
  1231. // Merge the result sets
  1232. done = jQuery.merge( done, ret );
  1233. // Reset the context
  1234. r = ret = [context];
  1235. // Touch up the selector string
  1236. t = " " + t.substr(1,t.length);
  1237. } else {
  1238. // Optimize for the case nodeName#idName
  1239. var re2 = quickID;
  1240. var m = re2.exec(t);
  1241. // Re-organize the results, so that they're consistent
  1242. if ( m ) {
  1243. m = [ 0, m[2], m[3], m[1] ];
  1244. } else {
  1245. // Otherwise, do a traditional filter check for
  1246. // ID, class, and element selectors
  1247. re2 = quickClass;
  1248. m = re2.exec(t);
  1249. }
  1250. m[2] = m[2].replace(/\\/g, "");
  1251. var elem = ret[ret.length-1];
  1252. // Try to do a global search by ID, where we can
  1253. if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
  1254. // Optimization for HTML document case
  1255. var oid = elem.getElementById(m[2]);
  1256. // Do a quick check for the existence of the actual ID attribute
  1257. // to avoid selecting by the name attribute in IE
  1258. // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
  1259. if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
  1260. oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
  1261. // Do a quick check for node name (where applicable) so
  1262. // that div#foo searches will be really fast
  1263. ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
  1264. } else {
  1265. // We need to find all descendant elements
  1266. for ( var i = 0; ret[i]; i++ ) {
  1267. // Grab the tag name being searched for
  1268. var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
  1269. // Handle IE7 being really dumb about <object>s
  1270. if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
  1271. tag = "param";
  1272. r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
  1273. }
  1274. // It's faster to filter by class and be done with it
  1275. if ( m[1] == "." )
  1276. r = jQuery.classFilter( r, m[2] );
  1277. // Same with ID filtering
  1278. if ( m[1] == "#" ) {
  1279. var tmp = [];
  1280. // Try to find the element with the ID
  1281. for ( var i = 0; r[i]; i++ )
  1282. if ( r[i].getAttribute("id") == m[2] ) {
  1283. tmp = [ r[i] ];
  1284. break;
  1285. }
  1286. r = tmp;
  1287. }
  1288. ret = r;
  1289. }
  1290. t = t.replace( re2, "" );
  1291. }
  1292. }
  1293. // If a selector string still exists
  1294. if ( t ) {
  1295. // Attempt to filter it
  1296. var val = jQuery.filter(t,r);
  1297. ret = r = val.r;
  1298. t = jQuery.trim(val.t);
  1299. }
  1300. }
  1301. // An error occurred with the selector;
  1302. // just return an empty set instead
  1303. if ( t )
  1304. ret = [];
  1305. // Remove the root context
  1306. if ( ret && context == ret[0] )
  1307. ret.shift();
  1308. // And combine the results
  1309. done = jQuery.merge( done, ret );
  1310. return done;
  1311. },
  1312. classFilter: function(r,m,not){
  1313. m = " " + m + " ";
  1314. var tmp = [];
  1315. for ( var i = 0; r[i]; i++ ) {
  1316. var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
  1317. if ( !not && pass || not && !pass )
  1318. tmp.push( r[i] );
  1319. }
  1320. return tmp;
  1321. },
  1322. filter: function(t,r,not) {
  1323. var last;
  1324. // Look for common filter expressions
  1325. while ( t && t != last ) {
  1326. last = t;
  1327. var p = jQuery.parse, m;
  1328. for ( var i = 0; p[i]; i++ ) {
  1329. m = p[i].exec( t );
  1330. if ( m ) {
  1331. // Remove what we just matched
  1332. t = t.substring( m[0].length );
  1333. m[2] = m[2].replace(/\\/g, "");
  1334. break;
  1335. }
  1336. }
  1337. if ( !m )
  1338. break;
  1339. // :not() is a special case that can be optimized by
  1340. // keeping it out of the expression list
  1341. if ( m[1] == ":" && m[2] == "not" )
  1342. // optimize if only one selector found (most common case)
  1343. r = isSimple.test( m[3] ) ?
  1344. jQuery.filter(m[3], r, true).r :
  1345. jQuery( r ).not( m[3] );
  1346. // We can get a big speed boost by filtering by class here
  1347. else if ( m[1] == "." )
  1348. r = jQuery.classFilter(r, m[2], not);
  1349. else if ( m[1] == "[" ) {
  1350. var tmp = [], type = m[3];
  1351. for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1352. var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
  1353. if ( z == null || /href|src|selected/.test(m[2]) )
  1354. z = jQuery.attr(a,m[2]) || '';
  1355. if ( (type == "" && !!z ||
  1356. type == "=" && z == m[5] ||
  1357. type == "!=" && z != m[5] ||
  1358. type == "^=" && z && !z.indexOf(m[5]) ||
  1359. type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
  1360. (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
  1361. tmp.push( a );
  1362. }
  1363. r = tmp;
  1364. // We can get a speed boost by handling nth-child here
  1365. } else if ( m[1] == ":" && m[2] == "nth-child" ) {
  1366. var merge = {}, tmp = [],
  1367. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1368. test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  1369. m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
  1370. !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
  1371. // calculate the numbers (first)n+(last) including if they are negative
  1372. first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
  1373. // loop through all the elements left in the jQuery object
  1374. for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1375. var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
  1376. if ( !merge[id] ) {
  1377. var c = 1;
  1378. for ( var n = parentNode.firstChild; n; n = n.nextSibling )
  1379. if ( n.nodeType == 1 )
  1380. n.nodeIndex = c++;
  1381. merge[id] = true;
  1382. }
  1383. var add = false;
  1384. if ( first == 0 ) {
  1385. if ( node.nodeIndex == last )
  1386. add = true;
  1387. } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
  1388. add = true;
  1389. if ( add ^ not )
  1390. tmp.push( node );
  1391. }
  1392. r = tmp;
  1393. // Otherwise, find the expression to execute
  1394. } else {
  1395. var fn = jQuery.expr[ m[1] ];
  1396. if ( typeof fn == "object" )
  1397. fn = fn[ m[2] ];
  1398. if ( typeof fn == "string" )
  1399. fn = eval("false||function(a,i){return " + fn + ";}");
  1400. // Execute it against the current filter
  1401. r = jQuery.grep( r, function(elem, i){
  1402. return fn(elem, i, m, r);
  1403. }, not );
  1404. }
  1405. }
  1406. // Return an array of filtered elements (r)
  1407. // and the modified expression string (t)
  1408. return { r: r, t: t };
  1409. },
  1410. dir: function( elem, dir ){
  1411. var matched = [],
  1412. cur = elem[dir];
  1413. while ( cur && cur != document ) {
  1414. if ( cur.nodeType == 1 )
  1415. matched.push( cur );
  1416. cur = cur[dir];
  1417. }
  1418. return matched;
  1419. },
  1420. nth: function(cur,result,dir,elem){
  1421. result = result || 1;
  1422. var num = 0;
  1423. for ( ; cur; cur = cur[dir] )
  1424. if ( cur.nodeType == 1 && ++num == result )
  1425. break;
  1426. return cur;
  1427. },
  1428. sibling: function( n, elem ) {
  1429. var r = [];
  1430. for ( ; n; n = n.nextSibling ) {
  1431. if ( n.nodeType == 1 && n != elem )
  1432. r.push( n );
  1433. }
  1434. return r;
  1435. }
  1436. });
  1437. /*
  1438. * A number of helper functions used for managing events.
  1439. * Many of the ideas behind this code orignated from
  1440. * Dean Edwards' addEvent library.
  1441. */
  1442. jQuery.event = {
  1443. // Bind an event to an element
  1444. // Original by Dean Edwards
  1445. add: function(elem, types, handler, data) {
  1446. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1447. return;
  1448. // For whatever reason, IE has trouble passing the window object
  1449. // around, causing it to be cloned in the process
  1450. if ( jQuery.browser.msie && elem.setInterval )
  1451. elem = window;
  1452. // Make sure that the function being executed has a unique ID
  1453. if ( !handler.guid )
  1454. handler.guid = this.guid++;
  1455. // if data is passed, bind to handler
  1456. if( data != undefined ) {
  1457. // Create temporary function pointer to original handler
  1458. var fn = handler;
  1459. // Create unique handler function, wrapped around original handler
  1460. handler = this.proxy( fn, function() {
  1461. // Pass arguments and context to original handler
  1462. return fn.apply(this, arguments);
  1463. });
  1464. // Store data in unique handler
  1465. handler.data = data;
  1466. }
  1467. // Init the element's event structure
  1468. var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
  1469. handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
  1470. // Handle the second event of a trigger and when
  1471. // an event is called after a page has unloaded
  1472. if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
  1473. return jQuery.event.handle.apply(arguments.callee.elem, arguments);
  1474. });
  1475. // Add elem as a property of the handle function
  1476. // This is to prevent a memory leak with non-native
  1477. // event in IE.
  1478. handle.elem = elem;
  1479. // Handle multiple events separated by a space
  1480. // jQuery(...).bind("mouseover mouseout", fn);
  1481. jQuery.each(types.split(/\s+/), function(index, type) {
  1482. // Namespaced event handlers
  1483. var parts = type.split(".");
  1484. type = parts[0];
  1485. handler.type = parts[1];
  1486. // Get the current list of functions bound to this event
  1487. var handlers = events[type];
  1488. // Init the event handler queue
  1489. if (!handlers) {
  1490. handlers = events[type] = {};
  1491. // Check for a special event handler
  1492. // Only use addEventListener/attachEvent if the special
  1493. // events handler returns false
  1494. if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
  1495. // Bind the global event handler to the element
  1496. if (elem.addEventListener)
  1497. elem.addEventListener(type, handle, false);
  1498. else if (elem.attachEvent)
  1499. elem.attachEvent("on" + type, handle);
  1500. }
  1501. }
  1502. // Add the function to the element's handler list
  1503. handlers[handler.guid] = handler;
  1504. // Keep track of which events have been used, for global triggering
  1505. jQuery.event.global[type] = true;
  1506. });
  1507. // Nullify elem to prevent memory leaks in IE
  1508. elem = null;
  1509. },
  1510. guid: 1,
  1511. global: {},
  1512. // Detach an event or set of events from an element
  1513. remove: function(elem, types, handler) {
  1514. // don't do events on text and comment nodes
  1515. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1516. return;
  1517. var events = jQuery.data(elem, "events"), ret, index;
  1518. if ( events ) {
  1519. // Unbind all events for the element
  1520. if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
  1521. for ( var type in events )
  1522. this.remove( elem, type + (types || "") );
  1523. else {
  1524. // types is actually an event object here
  1525. if ( types.type ) {
  1526. handler = types.handler;
  1527. types = types.type;
  1528. }
  1529. // Handle multiple events seperated by a space
  1530. // jQuery(...).unbind("mouseover mouseout", fn);
  1531. jQuery.each(types.split(/\s+/), function(index, type){
  1532. // Namespaced event handlers
  1533. var parts = type.split(".");
  1534. type = parts[0];
  1535. if ( events[type] ) {
  1536. // remove the given handler for the given type
  1537. if ( handler )
  1538. delete events[type][handler.guid];
  1539. // remove all handlers for the given type
  1540. else
  1541. for ( handler in events[type] )
  1542. // Handle the removal of namespaced events
  1543. if ( !parts[1] || events[type][handler].type == parts[1] )
  1544. delete events[type][handler];
  1545. // remove generic event handler if no more handlers exist
  1546. for ( ret in events[type] ) break;
  1547. if ( !ret ) {
  1548. if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
  1549. if (elem.removeEventListener)
  1550. elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
  1551. else if (elem.detachEvent)
  1552. elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
  1553. }
  1554. ret = null;
  1555. delete events[type];
  1556. }
  1557. }
  1558. });
  1559. }
  1560. // Remove the expando if it's no longer used
  1561. for ( ret in events ) break;
  1562. if ( !ret ) {
  1563. var handle = jQuery.data( elem, "handle" );
  1564. if ( handle ) handle.elem = null;
  1565. jQuery.removeData( elem, "events" );
  1566. jQuery.removeData( elem, "handle" );
  1567. }
  1568. }
  1569. },
  1570. trigger: function(type, data, elem, donative, extra) {
  1571. // Clone the incoming data, if any
  1572. data = jQuery.makeArray(data);
  1573. if ( type.indexOf("!") >= 0 ) {
  1574. type = type.slice(0, -1);
  1575. var exclusive = true;
  1576. }
  1577. // Handle a global trigger
  1578. if ( !elem ) {
  1579. // Only trigger if we've ever bound an event for it
  1580. if ( this.global[type] )
  1581. jQuery("*").add([window, document]).trigger(type, data);
  1582. // Handle triggering a single element
  1583. } else {
  1584. // don't do events on text and comment nodes
  1585. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1586. return undefined;
  1587. var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
  1588. // Check to see if we need to provide a fake event, or not
  1589. event = !data[0] || !data[0].preventDefault;
  1590. // Pass along a fake event
  1591. if ( event ) {
  1592. data.unshift({
  1593. type: type,
  1594. target: elem,
  1595. preventDefault: function(){},
  1596. stopPropagation: function(){},
  1597. timeStamp: now()
  1598. });
  1599. data[0][expando] = true; // no need to fix fake event
  1600. }
  1601. // Enforce the right trigger type
  1602. data[0].type = type;
  1603. if ( exclusive )
  1604. data[0].exclusive = true;
  1605. // Trigger the event, it is assumed that "handle" is a function
  1606. var handle = jQuery.data(elem, "handle");
  1607. if ( handle )
  1608. val = handle.apply( elem, data );
  1609. // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
  1610. if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
  1611. val = false;
  1612. // Extra functions don't get the custom event object
  1613. if ( event )
  1614. data.shift();
  1615. // Handle triggering of extra function
  1616. if ( extra && jQuery.isFunction( extra ) ) {
  1617. // call the extra function and tack the current return value on the end for possible inspection
  1618. ret = extra.apply( elem, val == null ? data : data.concat( val ) );
  1619. // if anything is returned, give it precedence and have it overwrite the previous value
  1620. if (ret !== undefined)
  1621. val = ret;
  1622. }
  1623. // Trigger the native events (except for clicks on links)
  1624. if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
  1625. this.triggered = true;
  1626. try {
  1627. elem[ type ]();
  1628. // prevent IE from throwing an error for some hidden elements
  1629. } catch (e) {}
  1630. }
  1631. this.triggered = false;
  1632. }
  1633. return val;
  1634. },
  1635. handle: function(event) {
  1636. // returned undefined or false
  1637. var val, ret, namespace, all, handlers;
  1638. event = arguments[0] = jQuery.event.fix( event || window.event );
  1639. // Namespaced event handlers
  1640. namespace = event.type.split(".");
  1641. event.type = namespace[0];
  1642. namespace = namespace[1];
  1643. // Cache this now, all = true means, any handler
  1644. all = !namespace && !event.exclusive;
  1645. handlers = ( jQuery.data(this, "events") || {} )[event.type];
  1646. for ( var j in handlers ) {
  1647. var handler = handlers[j];
  1648. // Filter the functions by class
  1649. if ( all || handler.type == namespace ) {
  1650. // Pass in a reference to the handler function itself
  1651. // So that we can later remove it
  1652. event.handler = handler;
  1653. event.data = handler.data;
  1654. ret = handler.apply( this, arguments );
  1655. if ( val !== false )
  1656. val = ret;
  1657. if ( ret === false ) {
  1658. event.preventDefault();
  1659. event.stopPropagation();
  1660. }
  1661. }
  1662. }
  1663. return val;
  1664. },
  1665. fix: function(event) {
  1666. if ( event[expando] == true )
  1667. return event;
  1668. // store a copy of the original event object
  1669. // and "clone" to set read-only properties
  1670. var originalEvent = event;
  1671. event = { originalEvent: originalEvent };
  1672. 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(" ");
  1673. for ( var i=props.length; i; i-- )
  1674. event[ props[i] ] = originalEvent[ props[i] ];
  1675. // Mark it as fixed
  1676. event[expando] = true;
  1677. // add preventDefault and stopPropagation since
  1678. // they will not work on the clone
  1679. event.preventDefault = function() {
  1680. // if preventDefault exists run it on the original event
  1681. if (originalEvent.preventDefault)
  1682. originalEvent.preventDefault();
  1683. // otherwise set the returnValue property of the original event to false (IE)
  1684. originalEvent.returnValue = false;
  1685. };
  1686. event.stopPropagation = function() {
  1687. // if stopPropagation exists run it on the original event
  1688. if (originalEvent.stopPropagation)
  1689. originalEvent.stopPropagation();
  1690. // otherwise set the cancelBubble property of the original event to true (IE)
  1691. originalEvent.cancelBubble = true;
  1692. };
  1693. // Fix timeStamp
  1694. event.timeStamp = event.timeStamp || now();
  1695. // Fix target property, if necessary
  1696. if ( !event.target )
  1697. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  1698. // check if target is a textnode (safari)
  1699. if ( event.target.nodeType == 3 )
  1700. event.target = event.target.parentNode;
  1701. // Add relatedTarget, if necessary
  1702. if ( !event.relatedTarget && event.fromElement )
  1703. event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
  1704. // Calculate pageX/Y if missing and clientX/Y available
  1705. if ( event.pageX == null && event.clientX != null ) {
  1706. var doc = document.documentElement, body = document.body;
  1707. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  1708. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  1709. }
  1710. // Add which for key events
  1711. if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
  1712. event.which = event.charCode || event.keyCode;
  1713. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  1714. if ( !event.metaKey && event.ctrlKey )
  1715. event.metaKey = event.ctrlKey;
  1716. // Add which for click: 1 == left; 2 == middle; 3 == right
  1717. // Note: button is not normalized, so don't use it
  1718. if ( !event.which && event.button )
  1719. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  1720. return event;
  1721. },
  1722. proxy: function( fn, proxy ){
  1723. // Set the guid of unique handler to the same of original handler, so it can be removed
  1724. proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
  1725. // So proxy can be declared as an argument
  1726. return proxy;
  1727. },
  1728. special: {
  1729. ready: {
  1730. setup: function() {
  1731. // Make sure the ready event is setup
  1732. bindReady();
  1733. return;
  1734. },
  1735. teardown: function() { return; }
  1736. },
  1737. mouseenter: {
  1738. setup: function() {
  1739. if ( jQuery.browser.msie ) return false;
  1740. jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
  1741. return true;
  1742. },
  1743. teardown: function() {
  1744. if ( jQuery.browser.msie ) return false;
  1745. jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
  1746. return true;
  1747. },
  1748. handler: function(event) {
  1749. // If we actually just moused on to a sub-element, ignore it
  1750. if ( withinElement(event, this) ) return true;
  1751. // Execute the right handlers by setting the event type to mouseenter
  1752. event.type = "mouseenter";
  1753. return jQuery.event.handle.apply(this, arguments);
  1754. }
  1755. },
  1756. mouseleave: {
  1757. setup: function() {
  1758. if ( jQuery.browser.msie ) return false;
  1759. jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
  1760. return true;
  1761. },
  1762. teardown: function() {
  1763. if ( jQuery.browser.msie ) return false;
  1764. jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
  1765. return true;
  1766. },
  1767. handler: function(event) {
  1768. // If we actually just moused on to a sub-element, ignore it
  1769. if ( withinElement(event, this) ) return true;
  1770. // Execute the right handlers by setting the event type to mouseleave
  1771. event.type = "mouseleave";
  1772. return jQuery.event.handle.apply(this, arguments);
  1773. }
  1774. }
  1775. }
  1776. };
  1777. jQuery.fn.extend({
  1778. bind: function( type, data, fn ) {
  1779. return type == "unload" ? this.one(type, data, fn) : this.each(function(){
  1780. jQuery.event.add( this, type, fn || data, fn && data );
  1781. });
  1782. },
  1783. one: function( type, data, fn ) {
  1784. var one = jQuery.event.proxy( fn || data, function(event) {
  1785. jQuery(this).unbind(event, one);
  1786. return (fn || data).apply( this, arguments );
  1787. });
  1788. return this.each(function(){
  1789. jQuery.event.add( this, type, one, fn && data);
  1790. });
  1791. },
  1792. unbind: function( type, fn ) {
  1793. return this.each(function(){
  1794. jQuery.event.remove( this, type, fn );
  1795. });
  1796. },
  1797. trigger: function( type, data, fn ) {
  1798. return this.each(function(){
  1799. jQuery.event.trigger( type, data, this, true, fn );
  1800. });
  1801. },
  1802. triggerHandler: function( type, data, fn ) {
  1803. return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
  1804. },
  1805. toggle: function( fn ) {
  1806. // Save reference to arguments for access in closure
  1807. var args = arguments, i = 1;
  1808. // link all the functions, so any of them can unbind this click handler
  1809. while( i < args.length )
  1810. jQuery.event.proxy( fn, args[i++] );
  1811. return this.click( jQuery.event.proxy( fn, function(event) {
  1812. // Figure out which function to execute
  1813. this.lastToggle = ( this.lastToggle || 0 ) % i;
  1814. // Make sure that clicks stop
  1815. event.preventDefault();
  1816. // and execute the function
  1817. return args[ this.lastToggle++ ].apply( this, arguments ) || false;
  1818. }));
  1819. },
  1820. hover: function(fnOver, fnOut) {
  1821. return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
  1822. },
  1823. ready: function(fn) {
  1824. // Attach the listeners
  1825. bindReady();
  1826. // If the DOM is already ready
  1827. if ( jQuery.isReady )
  1828. // Execute the function immediately
  1829. fn.call( document, jQuery );
  1830. // Otherwise, remember the function for later
  1831. else
  1832. // Add the function to the wait list
  1833. jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
  1834. return this;
  1835. }
  1836. });
  1837. jQuery.extend({
  1838. isReady: false,
  1839. readyList: [],
  1840. // Handle when the DOM is ready
  1841. ready: function() {
  1842. // Make