Pelzini

This is the code documentation for the Pelzini project

source of /coverage/jquery.min.js

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