You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8842 lines
237 KiB

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