Advertisement
Guest User

Untitled

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