Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4241 lines
114 KiB

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