Advertisement
Guest User

Untitled

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