Advertisement
SamuelRehbein

CÓDIGO PRA COLAR NO CONSOLE

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