Advertisement
Guest User

Untitled

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