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.

9454 lines
260 KiB

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