Advertisement
Guest User

Untitled

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