PageRenderTime 97ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 3ms

/lib/infusion/MyInfusion.js

https://bitbucket.org/jobara/decapod-ui
JavaScript | 15861 lines | 12162 code | 1945 blank | 1754 comment | 2304 complexity | 66409466d83c657ef76ab4e66a7e40b0 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, MIT, Apache-2.0, LGPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /*!
  2. * jQuery JavaScript Library v1.6.1
  3. * http://jquery.com/
  4. *
  5. * Copyright 2011, John Resig
  6. * Dual licensed under the MIT or GPL Version 2 licenses.
  7. * http://jquery.org/license
  8. *
  9. * Includes Sizzle.js
  10. * http://sizzlejs.com/
  11. * Copyright 2011, The Dojo Foundation
  12. * Released under the MIT, BSD, and GPL Licenses.
  13. *
  14. * Date: Thu May 12 15:04:36 2011 -0400
  15. */
  16. (function( window, undefined ) {
  17. // Use the correct document accordingly with window argument (sandbox)
  18. var document = window.document,
  19. navigator = window.navigator,
  20. location = window.location;
  21. var jQuery = (function() {
  22. // Define a local copy of jQuery
  23. var jQuery = function( selector, context ) {
  24. // The jQuery object is actually just the init constructor 'enhanced'
  25. return new jQuery.fn.init( selector, context, rootjQuery );
  26. },
  27. // Map over jQuery in case of overwrite
  28. _jQuery = window.jQuery,
  29. // Map over the $ in case of overwrite
  30. _$ = window.$,
  31. // A central reference to the root jQuery(document)
  32. rootjQuery,
  33. // A simple way to check for HTML strings or ID strings
  34. // (both of which we optimize for)
  35. quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
  36. // Check if a string has a non-whitespace character in it
  37. rnotwhite = /\S/,
  38. // Used for trimming whitespace
  39. trimLeft = /^\s+/,
  40. trimRight = /\s+$/,
  41. // Check for digits
  42. rdigit = /\d/,
  43. // Match a standalone tag
  44. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  45. // JSON RegExp
  46. rvalidchars = /^[\],:{}\s]*$/,
  47. rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  48. rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  49. rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  50. // Useragent RegExp
  51. rwebkit = /(webkit)[ \/]([\w.]+)/,
  52. ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  53. rmsie = /(msie) ([\w.]+)/,
  54. rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
  55. // Keep a UserAgent string for use with jQuery.browser
  56. userAgent = navigator.userAgent,
  57. // For matching the engine and version of the browser
  58. browserMatch,
  59. // The deferred used on DOM ready
  60. readyList,
  61. // The ready event handler
  62. DOMContentLoaded,
  63. // Save a reference to some core methods
  64. toString = Object.prototype.toString,
  65. hasOwn = Object.prototype.hasOwnProperty,
  66. push = Array.prototype.push,
  67. slice = Array.prototype.slice,
  68. trim = String.prototype.trim,
  69. indexOf = Array.prototype.indexOf,
  70. // [[Class]] -> type pairs
  71. class2type = {};
  72. jQuery.fn = jQuery.prototype = {
  73. constructor: jQuery,
  74. init: function( selector, context, rootjQuery ) {
  75. var match, elem, ret, doc;
  76. // Handle $(""), $(null), or $(undefined)
  77. if ( !selector ) {
  78. return this;
  79. }
  80. // Handle $(DOMElement)
  81. if ( selector.nodeType ) {
  82. this.context = this[0] = selector;
  83. this.length = 1;
  84. return this;
  85. }
  86. // The body element only exists once, optimize finding it
  87. if ( selector === "body" && !context && document.body ) {
  88. this.context = document;
  89. this[0] = document.body;
  90. this.selector = selector;
  91. this.length = 1;
  92. return this;
  93. }
  94. // Handle HTML strings
  95. if ( typeof selector === "string" ) {
  96. // Are we dealing with HTML string or an ID?
  97. if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
  98. // Assume that strings that start and end with <> are HTML and skip the regex check
  99. match = [ null, selector, null ];
  100. } else {
  101. match = quickExpr.exec( selector );
  102. }
  103. // Verify a match, and that no context was specified for #id
  104. if ( match && (match[1] || !context) ) {
  105. // HANDLE: $(html) -> $(array)
  106. if ( match[1] ) {
  107. context = context instanceof jQuery ? context[0] : context;
  108. doc = (context ? context.ownerDocument || context : document);
  109. // If a single string is passed in and it's a single tag
  110. // just do a createElement and skip the rest
  111. ret = rsingleTag.exec( selector );
  112. if ( ret ) {
  113. if ( jQuery.isPlainObject( context ) ) {
  114. selector = [ document.createElement( ret[1] ) ];
  115. jQuery.fn.attr.call( selector, context, true );
  116. } else {
  117. selector = [ doc.createElement( ret[1] ) ];
  118. }
  119. } else {
  120. ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
  121. selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
  122. }
  123. return jQuery.merge( this, selector );
  124. // HANDLE: $("#id")
  125. } else {
  126. elem = document.getElementById( match[2] );
  127. // Check parentNode to catch when Blackberry 4.6 returns
  128. // nodes that are no longer in the document #6963
  129. if ( elem && elem.parentNode ) {
  130. // Handle the case where IE and Opera return items
  131. // by name instead of ID
  132. if ( elem.id !== match[2] ) {
  133. return rootjQuery.find( selector );
  134. }
  135. // Otherwise, we inject the element directly into the jQuery object
  136. this.length = 1;
  137. this[0] = elem;
  138. }
  139. this.context = document;
  140. this.selector = selector;
  141. return this;
  142. }
  143. // HANDLE: $(expr, $(...))
  144. } else if ( !context || context.jquery ) {
  145. return (context || rootjQuery).find( selector );
  146. // HANDLE: $(expr, context)
  147. // (which is just equivalent to: $(context).find(expr)
  148. } else {
  149. return this.constructor( context ).find( selector );
  150. }
  151. // HANDLE: $(function)
  152. // Shortcut for document ready
  153. } else if ( jQuery.isFunction( selector ) ) {
  154. return rootjQuery.ready( selector );
  155. }
  156. if (selector.selector !== undefined) {
  157. this.selector = selector.selector;
  158. this.context = selector.context;
  159. }
  160. return jQuery.makeArray( selector, this );
  161. },
  162. // Start with an empty selector
  163. selector: "",
  164. // The current version of jQuery being used
  165. jquery: "1.6.1",
  166. // The default length of a jQuery object is 0
  167. length: 0,
  168. // The number of elements contained in the matched element set
  169. size: function() {
  170. return this.length;
  171. },
  172. toArray: function() {
  173. return slice.call( this, 0 );
  174. },
  175. // Get the Nth element in the matched element set OR
  176. // Get the whole matched element set as a clean array
  177. get: function( num ) {
  178. return num == null ?
  179. // Return a 'clean' array
  180. this.toArray() :
  181. // Return just the object
  182. ( num < 0 ? this[ this.length + num ] : this[ num ] );
  183. },
  184. // Take an array of elements and push it onto the stack
  185. // (returning the new matched element set)
  186. pushStack: function( elems, name, selector ) {
  187. // Build a new jQuery matched element set
  188. var ret = this.constructor();
  189. if ( jQuery.isArray( elems ) ) {
  190. push.apply( ret, elems );
  191. } else {
  192. jQuery.merge( ret, elems );
  193. }
  194. // Add the old object onto the stack (as a reference)
  195. ret.prevObject = this;
  196. ret.context = this.context;
  197. if ( name === "find" ) {
  198. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  199. } else if ( name ) {
  200. ret.selector = this.selector + "." + name + "(" + selector + ")";
  201. }
  202. // Return the newly-formed element set
  203. return ret;
  204. },
  205. // Execute a callback for every element in the matched set.
  206. // (You can seed the arguments with an array of args, but this is
  207. // only used internally.)
  208. each: function( callback, args ) {
  209. return jQuery.each( this, callback, args );
  210. },
  211. ready: function( fn ) {
  212. // Attach the listeners
  213. jQuery.bindReady();
  214. // Add the callback
  215. readyList.done( fn );
  216. return this;
  217. },
  218. eq: function( i ) {
  219. return i === -1 ?
  220. this.slice( i ) :
  221. this.slice( i, +i + 1 );
  222. },
  223. first: function() {
  224. return this.eq( 0 );
  225. },
  226. last: function() {
  227. return this.eq( -1 );
  228. },
  229. slice: function() {
  230. return this.pushStack( slice.apply( this, arguments ),
  231. "slice", slice.call(arguments).join(",") );
  232. },
  233. map: function( callback ) {
  234. return this.pushStack( jQuery.map(this, function( elem, i ) {
  235. return callback.call( elem, i, elem );
  236. }));
  237. },
  238. end: function() {
  239. return this.prevObject || this.constructor(null);
  240. },
  241. // For internal use only.
  242. // Behaves like an Array's method, not like a jQuery method.
  243. push: push,
  244. sort: [].sort,
  245. splice: [].splice
  246. };
  247. // Give the init function the jQuery prototype for later instantiation
  248. jQuery.fn.init.prototype = jQuery.fn;
  249. jQuery.extend = jQuery.fn.extend = function() {
  250. var options, name, src, copy, copyIsArray, clone,
  251. target = arguments[0] || {},
  252. i = 1,
  253. length = arguments.length,
  254. deep = false;
  255. // Handle a deep copy situation
  256. if ( typeof target === "boolean" ) {
  257. deep = target;
  258. target = arguments[1] || {};
  259. // skip the boolean and the target
  260. i = 2;
  261. }
  262. // Handle case when target is a string or something (possible in deep copy)
  263. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  264. target = {};
  265. }
  266. // extend jQuery itself if only one argument is passed
  267. if ( length === i ) {
  268. target = this;
  269. --i;
  270. }
  271. for ( ; i < length; i++ ) {
  272. // Only deal with non-null/undefined values
  273. if ( (options = arguments[ i ]) != null ) {
  274. // Extend the base object
  275. for ( name in options ) {
  276. src = target[ name ];
  277. copy = options[ name ];
  278. // Prevent never-ending loop
  279. if ( target === copy ) {
  280. continue;
  281. }
  282. // Recurse if we're merging plain objects or arrays
  283. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  284. if ( copyIsArray ) {
  285. copyIsArray = false;
  286. clone = src && jQuery.isArray(src) ? src : [];
  287. } else {
  288. clone = src && jQuery.isPlainObject(src) ? src : {};
  289. }
  290. // Never move original objects, clone them
  291. target[ name ] = jQuery.extend( deep, clone, copy );
  292. // Don't bring in undefined values
  293. } else if ( copy !== undefined ) {
  294. target[ name ] = copy;
  295. }
  296. }
  297. }
  298. }
  299. // Return the modified object
  300. return target;
  301. };
  302. jQuery.extend({
  303. noConflict: function( deep ) {
  304. if ( window.$ === jQuery ) {
  305. window.$ = _$;
  306. }
  307. if ( deep && window.jQuery === jQuery ) {
  308. window.jQuery = _jQuery;
  309. }
  310. return jQuery;
  311. },
  312. // Is the DOM ready to be used? Set to true once it occurs.
  313. isReady: false,
  314. // A counter to track how many items to wait for before
  315. // the ready event fires. See #6781
  316. readyWait: 1,
  317. // Hold (or release) the ready event
  318. holdReady: function( hold ) {
  319. if ( hold ) {
  320. jQuery.readyWait++;
  321. } else {
  322. jQuery.ready( true );
  323. }
  324. },
  325. // Handle when the DOM is ready
  326. ready: function( wait ) {
  327. // Either a released hold or an DOMready/load event and not yet ready
  328. if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
  329. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  330. if ( !document.body ) {
  331. return setTimeout( jQuery.ready, 1 );
  332. }
  333. // Remember that the DOM is ready
  334. jQuery.isReady = true;
  335. // If a normal DOM Ready event fired, decrement, and wait if need be
  336. if ( wait !== true && --jQuery.readyWait > 0 ) {
  337. return;
  338. }
  339. // If there are functions bound, to execute
  340. readyList.resolveWith( document, [ jQuery ] );
  341. // Trigger any bound ready events
  342. if ( jQuery.fn.trigger ) {
  343. jQuery( document ).trigger( "ready" ).unbind( "ready" );
  344. }
  345. }
  346. },
  347. bindReady: function() {
  348. if ( readyList ) {
  349. return;
  350. }
  351. readyList = jQuery._Deferred();
  352. // Catch cases where $(document).ready() is called after the
  353. // browser event has already occurred.
  354. if ( document.readyState === "complete" ) {
  355. // Handle it asynchronously to allow scripts the opportunity to delay ready
  356. return setTimeout( jQuery.ready, 1 );
  357. }
  358. // Mozilla, Opera and webkit nightlies currently support this event
  359. if ( document.addEventListener ) {
  360. // Use the handy event callback
  361. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  362. // A fallback to window.onload, that will always work
  363. window.addEventListener( "load", jQuery.ready, false );
  364. // If IE event model is used
  365. } else if ( document.attachEvent ) {
  366. // ensure firing before onload,
  367. // maybe late but safe also for iframes
  368. document.attachEvent( "onreadystatechange", DOMContentLoaded );
  369. // A fallback to window.onload, that will always work
  370. window.attachEvent( "onload", jQuery.ready );
  371. // If IE and not a frame
  372. // continually check to see if the document is ready
  373. var toplevel = false;
  374. try {
  375. toplevel = window.frameElement == null;
  376. } catch(e) {}
  377. if ( document.documentElement.doScroll && toplevel ) {
  378. doScrollCheck();
  379. }
  380. }
  381. },
  382. // See test/unit/core.js for details concerning isFunction.
  383. // Since version 1.3, DOM methods and functions like alert
  384. // aren't supported. They return false on IE (#2968).
  385. isFunction: function( obj ) {
  386. return jQuery.type(obj) === "function";
  387. },
  388. isArray: Array.isArray || function( obj ) {
  389. return jQuery.type(obj) === "array";
  390. },
  391. // A crude way of determining if an object is a window
  392. isWindow: function( obj ) {
  393. return obj && typeof obj === "object" && "setInterval" in obj;
  394. },
  395. isNaN: function( obj ) {
  396. return obj == null || !rdigit.test( obj ) || isNaN( obj );
  397. },
  398. type: function( obj ) {
  399. return obj == null ?
  400. String( obj ) :
  401. class2type[ toString.call(obj) ] || "object";
  402. },
  403. isPlainObject: function( obj ) {
  404. // Must be an Object.
  405. // Because of IE, we also have to check the presence of the constructor property.
  406. // Make sure that DOM nodes and window objects don't pass through, as well
  407. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  408. return false;
  409. }
  410. // Not own constructor property must be Object
  411. if ( obj.constructor &&
  412. !hasOwn.call(obj, "constructor") &&
  413. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  414. return false;
  415. }
  416. // Own properties are enumerated firstly, so to speed up,
  417. // if last one is own, then all properties are own.
  418. var key;
  419. for ( key in obj ) {}
  420. return key === undefined || hasOwn.call( obj, key );
  421. },
  422. isEmptyObject: function( obj ) {
  423. for ( var name in obj ) {
  424. return false;
  425. }
  426. return true;
  427. },
  428. error: function( msg ) {
  429. throw msg;
  430. },
  431. parseJSON: function( data ) {
  432. if ( typeof data !== "string" || !data ) {
  433. return null;
  434. }
  435. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  436. data = jQuery.trim( data );
  437. // Attempt to parse using the native JSON parser first
  438. if ( window.JSON && window.JSON.parse ) {
  439. return window.JSON.parse( data );
  440. }
  441. // Make sure the incoming data is actual JSON
  442. // Logic borrowed from http://json.org/json2.js
  443. if ( rvalidchars.test( data.replace( rvalidescape, "@" )
  444. .replace( rvalidtokens, "]" )
  445. .replace( rvalidbraces, "")) ) {
  446. return (new Function( "return " + data ))();
  447. }
  448. jQuery.error( "Invalid JSON: " + data );
  449. },
  450. // Cross-browser xml parsing
  451. // (xml & tmp used internally)
  452. parseXML: function( data , xml , tmp ) {
  453. if ( window.DOMParser ) { // Standard
  454. tmp = new DOMParser();
  455. xml = tmp.parseFromString( data , "text/xml" );
  456. } else { // IE
  457. xml = new ActiveXObject( "Microsoft.XMLDOM" );
  458. xml.async = "false";
  459. xml.loadXML( data );
  460. }
  461. tmp = xml.documentElement;
  462. if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
  463. jQuery.error( "Invalid XML: " + data );
  464. }
  465. return xml;
  466. },
  467. noop: function() {},
  468. // Evaluates a script in a global context
  469. // Workarounds based on findings by Jim Driscoll
  470. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  471. globalEval: function( data ) {
  472. if ( data && rnotwhite.test( data ) ) {
  473. // We use execScript on Internet Explorer
  474. // We use an anonymous function so that context is window
  475. // rather than jQuery in Firefox
  476. ( window.execScript || function( data ) {
  477. window[ "eval" ].call( window, data );
  478. } )( data );
  479. }
  480. },
  481. nodeName: function( elem, name ) {
  482. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  483. },
  484. // args is for internal usage only
  485. each: function( object, callback, args ) {
  486. var name, i = 0,
  487. length = object.length,
  488. isObj = length === undefined || jQuery.isFunction( object );
  489. if ( args ) {
  490. if ( isObj ) {
  491. for ( name in object ) {
  492. if ( callback.apply( object[ name ], args ) === false ) {
  493. break;
  494. }
  495. }
  496. } else {
  497. for ( ; i < length; ) {
  498. if ( callback.apply( object[ i++ ], args ) === false ) {
  499. break;
  500. }
  501. }
  502. }
  503. // A special, fast, case for the most common use of each
  504. } else {
  505. if ( isObj ) {
  506. for ( name in object ) {
  507. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  508. break;
  509. }
  510. }
  511. } else {
  512. for ( ; i < length; ) {
  513. if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
  514. break;
  515. }
  516. }
  517. }
  518. }
  519. return object;
  520. },
  521. // Use native String.trim function wherever possible
  522. trim: trim ?
  523. function( text ) {
  524. return text == null ?
  525. "" :
  526. trim.call( text );
  527. } :
  528. // Otherwise use our own trimming functionality
  529. function( text ) {
  530. return text == null ?
  531. "" :
  532. text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
  533. },
  534. // results is for internal usage only
  535. makeArray: function( array, results ) {
  536. var ret = results || [];
  537. if ( array != null ) {
  538. // The window, strings (and functions) also have 'length'
  539. // The extra typeof function check is to prevent crashes
  540. // in Safari 2 (See: #3039)
  541. // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
  542. var type = jQuery.type( array );
  543. if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
  544. push.call( ret, array );
  545. } else {
  546. jQuery.merge( ret, array );
  547. }
  548. }
  549. return ret;
  550. },
  551. inArray: function( elem, array ) {
  552. if ( indexOf ) {
  553. return indexOf.call( array, elem );
  554. }
  555. for ( var i = 0, length = array.length; i < length; i++ ) {
  556. if ( array[ i ] === elem ) {
  557. return i;
  558. }
  559. }
  560. return -1;
  561. },
  562. merge: function( first, second ) {
  563. var i = first.length,
  564. j = 0;
  565. if ( typeof second.length === "number" ) {
  566. for ( var l = second.length; j < l; j++ ) {
  567. first[ i++ ] = second[ j ];
  568. }
  569. } else {
  570. while ( second[j] !== undefined ) {
  571. first[ i++ ] = second[ j++ ];
  572. }
  573. }
  574. first.length = i;
  575. return first;
  576. },
  577. grep: function( elems, callback, inv ) {
  578. var ret = [], retVal;
  579. inv = !!inv;
  580. // Go through the array, only saving the items
  581. // that pass the validator function
  582. for ( var i = 0, length = elems.length; i < length; i++ ) {
  583. retVal = !!callback( elems[ i ], i );
  584. if ( inv !== retVal ) {
  585. ret.push( elems[ i ] );
  586. }
  587. }
  588. return ret;
  589. },
  590. // arg is for internal usage only
  591. map: function( elems, callback, arg ) {
  592. var value, key, ret = [],
  593. i = 0,
  594. length = elems.length,
  595. // jquery objects are treated as arrays
  596. isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
  597. // Go through the array, translating each of the items to their
  598. if ( isArray ) {
  599. for ( ; i < length; i++ ) {
  600. value = callback( elems[ i ], i, arg );
  601. if ( value != null ) {
  602. ret[ ret.length ] = value;
  603. }
  604. }
  605. // Go through every key on the object,
  606. } else {
  607. for ( key in elems ) {
  608. value = callback( elems[ key ], key, arg );
  609. if ( value != null ) {
  610. ret[ ret.length ] = value;
  611. }
  612. }
  613. }
  614. // Flatten any nested arrays
  615. return ret.concat.apply( [], ret );
  616. },
  617. // A global GUID counter for objects
  618. guid: 1,
  619. // Bind a function to a context, optionally partially applying any
  620. // arguments.
  621. proxy: function( fn, context ) {
  622. if ( typeof context === "string" ) {
  623. var tmp = fn[ context ];
  624. context = fn;
  625. fn = tmp;
  626. }
  627. // Quick check to determine if target is callable, in the spec
  628. // this throws a TypeError, but we will just return undefined.
  629. if ( !jQuery.isFunction( fn ) ) {
  630. return undefined;
  631. }
  632. // Simulated bind
  633. var args = slice.call( arguments, 2 ),
  634. proxy = function() {
  635. return fn.apply( context, args.concat( slice.call( arguments ) ) );
  636. };
  637. // Set the guid of unique handler to the same of original handler, so it can be removed
  638. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  639. return proxy;
  640. },
  641. // Mutifunctional method to get and set values to a collection
  642. // The value/s can be optionally by executed if its a function
  643. access: function( elems, key, value, exec, fn, pass ) {
  644. var length = elems.length;
  645. // Setting many attributes
  646. if ( typeof key === "object" ) {
  647. for ( var k in key ) {
  648. jQuery.access( elems, k, key[k], exec, fn, value );
  649. }
  650. return elems;
  651. }
  652. // Setting one attribute
  653. if ( value !== undefined ) {
  654. // Optionally, function values get executed if exec is true
  655. exec = !pass && exec && jQuery.isFunction(value);
  656. for ( var i = 0; i < length; i++ ) {
  657. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  658. }
  659. return elems;
  660. }
  661. // Getting an attribute
  662. return length ? fn( elems[0], key ) : undefined;
  663. },
  664. now: function() {
  665. return (new Date()).getTime();
  666. },
  667. // Use of jQuery.browser is frowned upon.
  668. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  669. uaMatch: function( ua ) {
  670. ua = ua.toLowerCase();
  671. var match = rwebkit.exec( ua ) ||
  672. ropera.exec( ua ) ||
  673. rmsie.exec( ua ) ||
  674. ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
  675. [];
  676. return { browser: match[1] || "", version: match[2] || "0" };
  677. },
  678. sub: function() {
  679. function jQuerySub( selector, context ) {
  680. return new jQuerySub.fn.init( selector, context );
  681. }
  682. jQuery.extend( true, jQuerySub, this );
  683. jQuerySub.superclass = this;
  684. jQuerySub.fn = jQuerySub.prototype = this();
  685. jQuerySub.fn.constructor = jQuerySub;
  686. jQuerySub.sub = this.sub;
  687. jQuerySub.fn.init = function init( selector, context ) {
  688. if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
  689. context = jQuerySub( context );
  690. }
  691. return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
  692. };
  693. jQuerySub.fn.init.prototype = jQuerySub.fn;
  694. var rootjQuerySub = jQuerySub(document);
  695. return jQuerySub;
  696. },
  697. browser: {}
  698. });
  699. // Populate the class2type map
  700. jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
  701. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  702. });
  703. browserMatch = jQuery.uaMatch( userAgent );
  704. if ( browserMatch.browser ) {
  705. jQuery.browser[ browserMatch.browser ] = true;
  706. jQuery.browser.version = browserMatch.version;
  707. }
  708. // Deprecated, use jQuery.browser.webkit instead
  709. if ( jQuery.browser.webkit ) {
  710. jQuery.browser.safari = true;
  711. }
  712. // IE doesn't match non-breaking spaces with \s
  713. if ( rnotwhite.test( "\xA0" ) ) {
  714. trimLeft = /^[\s\xA0]+/;
  715. trimRight = /[\s\xA0]+$/;
  716. }
  717. // All jQuery objects should point back to these
  718. rootjQuery = jQuery(document);
  719. // Cleanup functions for the document ready method
  720. if ( document.addEventListener ) {
  721. DOMContentLoaded = function() {
  722. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  723. jQuery.ready();
  724. };
  725. } else if ( document.attachEvent ) {
  726. DOMContentLoaded = function() {
  727. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  728. if ( document.readyState === "complete" ) {
  729. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  730. jQuery.ready();
  731. }
  732. };
  733. }
  734. // The DOM ready check for Internet Explorer
  735. function doScrollCheck() {
  736. if ( jQuery.isReady ) {
  737. return;
  738. }
  739. try {
  740. // If IE is used, use the trick by Diego Perini
  741. // http://javascript.nwbox.com/IEContentLoaded/
  742. document.documentElement.doScroll("left");
  743. } catch(e) {
  744. setTimeout( doScrollCheck, 1 );
  745. return;
  746. }
  747. // and execute any waiting functions
  748. jQuery.ready();
  749. }
  750. // Expose jQuery to the global object
  751. return jQuery;
  752. })();
  753. var // Promise methods
  754. promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
  755. // Static reference to slice
  756. sliceDeferred = [].slice;
  757. jQuery.extend({
  758. // Create a simple deferred (one callbacks list)
  759. _Deferred: function() {
  760. var // callbacks list
  761. callbacks = [],
  762. // stored [ context , args ]
  763. fired,
  764. // to avoid firing when already doing so
  765. firing,
  766. // flag to know if the deferred has been cancelled
  767. cancelled,
  768. // the deferred itself
  769. deferred = {
  770. // done( f1, f2, ...)
  771. done: function() {
  772. if ( !cancelled ) {
  773. var args = arguments,
  774. i,
  775. length,
  776. elem,
  777. type,
  778. _fired;
  779. if ( fired ) {
  780. _fired = fired;
  781. fired = 0;
  782. }
  783. for ( i = 0, length = args.length; i < length; i++ ) {
  784. elem = args[ i ];
  785. type = jQuery.type( elem );
  786. if ( type === "array" ) {
  787. deferred.done.apply( deferred, elem );
  788. } else if ( type === "function" ) {
  789. callbacks.push( elem );
  790. }
  791. }
  792. if ( _fired ) {
  793. deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
  794. }
  795. }
  796. return this;
  797. },
  798. // resolve with given context and args
  799. resolveWith: function( context, args ) {
  800. if ( !cancelled && !fired && !firing ) {
  801. // make sure args are available (#8421)
  802. args = args || [];
  803. firing = 1;
  804. try {
  805. while( callbacks[ 0 ] ) {
  806. callbacks.shift().apply( context, args );
  807. }
  808. }
  809. finally {
  810. fired = [ context, args ];
  811. firing = 0;
  812. }
  813. }
  814. return this;
  815. },
  816. // resolve with this as context and given arguments
  817. resolve: function() {
  818. deferred.resolveWith( this, arguments );
  819. return this;
  820. },
  821. // Has this deferred been resolved?
  822. isResolved: function() {
  823. return !!( firing || fired );
  824. },
  825. // Cancel
  826. cancel: function() {
  827. cancelled = 1;
  828. callbacks = [];
  829. return this;
  830. }
  831. };
  832. return deferred;
  833. },
  834. // Full fledged deferred (two callbacks list)
  835. Deferred: function( func ) {
  836. var deferred = jQuery._Deferred(),
  837. failDeferred = jQuery._Deferred(),
  838. promise;
  839. // Add errorDeferred methods, then and promise
  840. jQuery.extend( deferred, {
  841. then: function( doneCallbacks, failCallbacks ) {
  842. deferred.done( doneCallbacks ).fail( failCallbacks );
  843. return this;
  844. },
  845. always: function() {
  846. return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
  847. },
  848. fail: failDeferred.done,
  849. rejectWith: failDeferred.resolveWith,
  850. reject: failDeferred.resolve,
  851. isRejected: failDeferred.isResolved,
  852. pipe: function( fnDone, fnFail ) {
  853. return jQuery.Deferred(function( newDefer ) {
  854. jQuery.each( {
  855. done: [ fnDone, "resolve" ],
  856. fail: [ fnFail, "reject" ]
  857. }, function( handler, data ) {
  858. var fn = data[ 0 ],
  859. action = data[ 1 ],
  860. returned;
  861. if ( jQuery.isFunction( fn ) ) {
  862. deferred[ handler ](function() {
  863. returned = fn.apply( this, arguments );
  864. if ( returned && jQuery.isFunction( returned.promise ) ) {
  865. returned.promise().then( newDefer.resolve, newDefer.reject );
  866. } else {
  867. newDefer[ action ]( returned );
  868. }
  869. });
  870. } else {
  871. deferred[ handler ]( newDefer[ action ] );
  872. }
  873. });
  874. }).promise();
  875. },
  876. // Get a promise for this deferred
  877. // If obj is provided, the promise aspect is added to the object
  878. promise: function( obj ) {
  879. if ( obj == null ) {
  880. if ( promise ) {
  881. return promise;
  882. }
  883. promise = obj = {};
  884. }
  885. var i = promiseMethods.length;
  886. while( i-- ) {
  887. obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
  888. }
  889. return obj;
  890. }
  891. });
  892. // Make sure only one callback list will be used
  893. deferred.done( failDeferred.cancel ).fail( deferred.cancel );
  894. // Unexpose cancel
  895. delete deferred.cancel;
  896. // Call given func if any
  897. if ( func ) {
  898. func.call( deferred, deferred );
  899. }
  900. return deferred;
  901. },
  902. // Deferred helper
  903. when: function( firstParam ) {
  904. var args = arguments,
  905. i = 0,
  906. length = args.length,
  907. count = length,
  908. deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
  909. firstParam :
  910. jQuery.Deferred();
  911. function resolveFunc( i ) {
  912. return function( value ) {
  913. args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
  914. if ( !( --count ) ) {
  915. // Strange bug in FF4:
  916. // Values changed onto the arguments object sometimes end up as undefined values
  917. // outside the $.when method. Cloning the object into a fresh array solves the issue
  918. deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
  919. }
  920. };
  921. }
  922. if ( length > 1 ) {
  923. for( ; i < length; i++ ) {
  924. if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
  925. args[ i ].promise().then( resolveFunc(i), deferred.reject );
  926. } else {
  927. --count;
  928. }
  929. }
  930. if ( !count ) {
  931. deferred.resolveWith( deferred, args );
  932. }
  933. } else if ( deferred !== firstParam ) {
  934. deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
  935. }
  936. return deferred.promise();
  937. }
  938. });
  939. jQuery.support = (function() {
  940. var div = document.createElement( "div" ),
  941. documentElement = document.documentElement,
  942. all,
  943. a,
  944. select,
  945. opt,
  946. input,
  947. marginDiv,
  948. support,
  949. fragment,
  950. body,
  951. bodyStyle,
  952. tds,
  953. events,
  954. eventName,
  955. i,
  956. isSupported;
  957. // Preliminary tests
  958. div.setAttribute("className", "t");
  959. div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  960. all = div.getElementsByTagName( "*" );
  961. a = div.getElementsByTagName( "a" )[ 0 ];
  962. // Can't get basic test support
  963. if ( !all || !all.length || !a ) {
  964. return {};
  965. }
  966. // First batch of supports tests
  967. select = document.createElement( "select" );
  968. opt = select.appendChild( document.createElement("option") );
  969. input = div.getElementsByTagName( "input" )[ 0 ];
  970. support = {
  971. // IE strips leading whitespace when .innerHTML is used
  972. leadingWhitespace: ( div.firstChild.nodeType === 3 ),
  973. // Make sure that tbody elements aren't automatically inserted
  974. // IE will insert them into empty tables
  975. tbody: !div.getElementsByTagName( "tbody" ).length,
  976. // Make sure that link elements get serialized correctly by innerHTML
  977. // This requires a wrapper element in IE
  978. htmlSerialize: !!div.getElementsByTagName( "link" ).length,
  979. // Get the style information from getAttribute
  980. // (IE uses .cssText instead)
  981. style: /top/.test( a.getAttribute("style") ),
  982. // Make sure that URLs aren't manipulated
  983. // (IE normalizes it by default)
  984. hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
  985. // Make sure that element opacity exists
  986. // (IE uses filter instead)
  987. // Use a regex to work around a WebKit issue. See #5145
  988. opacity: /^0.55$/.test( a.style.opacity ),
  989. // Verify style float existence
  990. // (IE uses styleFloat instead of cssFloat)
  991. cssFloat: !!a.style.cssFloat,
  992. // Make sure that if no value is specified for a checkbox
  993. // that it defaults to "on".
  994. // (WebKit defaults to "" instead)
  995. checkOn: ( input.value === "on" ),
  996. // Make sure that a selected-by-default option has a working selected property.
  997. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  998. optSelected: opt.selected,
  999. // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  1000. getSetAttribute: div.className !== "t",
  1001. // Will be defined later
  1002. submitBubbles: true,
  1003. changeBubbles: true,
  1004. focusinBubbles: false,
  1005. deleteExpando: true,
  1006. noCloneEvent: true,
  1007. inlineBlockNeedsLayout: false,
  1008. shrinkWrapBlocks: false,
  1009. reliableMarginRight: true
  1010. };
  1011. // Make sure checked status is properly cloned
  1012. input.checked = true;
  1013. support.noCloneChecked = input.cloneNode( true ).checked;
  1014. // Make sure that the options inside disabled selects aren't marked as disabled
  1015. // (WebKit marks them as disabled)
  1016. select.disabled = true;
  1017. support.optDisabled = !opt.disabled;
  1018. // Test to see if it's possible to delete an expando from an element
  1019. // Fails in Internet Explorer
  1020. try {
  1021. delete div.test;
  1022. } catch( e ) {
  1023. support.deleteExpando = false;
  1024. }
  1025. if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
  1026. div.attachEvent( "onclick", function click() {
  1027. // Cloning a node shouldn't copy over any
  1028. // bound event handlers (IE does this)
  1029. support.noCloneEvent = false;
  1030. div.detachEvent( "onclick", click );
  1031. });
  1032. div.cloneNode( true ).fireEvent( "onclick" );
  1033. }
  1034. // Check if a radio maintains it's value
  1035. // after being appended to the DOM
  1036. input = document.createElement("input");
  1037. input.value = "t";
  1038. input.setAttribute("type", "radio");
  1039. support.radioValue = input.value === "t";
  1040. input.setAttribute("checked", "checked");
  1041. div.appendChild( input );
  1042. fragment = document.createDocumentFragment();
  1043. fragment.appendChild( div.firstChild );
  1044. // WebKit doesn't clone checked state correctly in fragments
  1045. support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
  1046. div.innerHTML = "";
  1047. // Figure out if the W3C box model works as expected
  1048. div.style.width = div.style.paddingLeft = "1px";
  1049. // We use our own, invisible, body
  1050. body = document.createElement( "body" );
  1051. bodyStyle = {
  1052. visibility: "hidden",
  1053. width: 0,
  1054. height: 0,
  1055. border: 0,
  1056. margin: 0,
  1057. // Set background to avoid IE crashes when removing (#9028)
  1058. background: "none"
  1059. };
  1060. for ( i in bodyStyle ) {
  1061. body.style[ i ] = bodyStyle[ i ];
  1062. }
  1063. body.appendChild( div );
  1064. documentElement.insertBefore( body, documentElement.firstChild );
  1065. // Check if a disconnected checkbox will retain its checked
  1066. // value of true after appended to the DOM (IE6/7)
  1067. support.appendChecked = input.checked;
  1068. support.boxModel = div.offsetWidth === 2;
  1069. if ( "zoom" in div.style ) {
  1070. // Check if natively block-level elements act like inline-block
  1071. // elements when setting their display to 'inline' and giving
  1072. // them layout
  1073. // (IE < 8 does this)
  1074. div.style.display = "inline";
  1075. div.style.zoom = 1;
  1076. support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
  1077. // Check if elements with layout shrink-wrap their children
  1078. // (IE 6 does this)
  1079. div.style.display = "";
  1080. div.innerHTML = "<div style='width:4px;'></div>";
  1081. support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
  1082. }
  1083. div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
  1084. tds = div.getElementsByTagName( "td" );
  1085. // Check if table cells still have offsetWidth/Height when they are set
  1086. // to display:none and there are still other visible table cells in a
  1087. // table row; if so, offsetWidth/Height are not reliable for use when
  1088. // determining if an element has been hidden directly using
  1089. // display:none (it is still safe to use offsets if a parent element is
  1090. // hidden; don safety goggles and see bug #4512 for more information).
  1091. // (only IE 8 fails this test)
  1092. isSupported = ( tds[ 0 ].offsetHeight === 0 );
  1093. tds[ 0 ].style.display = "";
  1094. tds[ 1 ].style.display = "none";
  1095. // Check if empty table cells still have offsetWidth/Height
  1096. // (IE < 8 fail this test)
  1097. support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
  1098. div.innerHTML = "";
  1099. // Check if div with explicit width and no margin-right incorrectly
  1100. // gets computed margin-right based on width of container. For more
  1101. // info see bug #3333
  1102. // Fails in WebKit before Feb 2011 nightlies
  1103. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  1104. if ( document.defaultView && document.defaultView.getComputedStyle ) {
  1105. marginDiv = document.createElement( "div" );
  1106. marginDiv.style.width = "0";
  1107. marginDiv.style.marginRight = "0";
  1108. div.appendChild( marginDiv );
  1109. support.reliableMarginRight =
  1110. ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
  1111. }
  1112. // Remove the body element we added
  1113. body.innerHTML = "";
  1114. documentElement.removeChild( body );
  1115. // Technique from Juriy Zaytsev
  1116. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  1117. // We only care about the case where non-standard event systems
  1118. // are used, namely in IE. Short-circuiting here helps us to
  1119. // avoid an eval call (in setAttribute) which can cause CSP
  1120. // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
  1121. if ( div.attachEvent ) {
  1122. for( i in {
  1123. submit: 1,
  1124. change: 1,
  1125. focusin: 1
  1126. } ) {
  1127. eventName = "on" + i;
  1128. isSupported = ( eventName in div );
  1129. if ( !isSupported ) {
  1130. div.setAttribute( eventName, "return;" );
  1131. isSupported = ( typeof div[ eventName ] === "function" );
  1132. }
  1133. support[ i + "Bubbles" ] = isSupported;
  1134. }
  1135. }
  1136. return support;
  1137. })();
  1138. // Keep track of boxModel
  1139. jQuery.boxModel = jQuery.support.boxModel;
  1140. var rbrace = /^(?:\{.*\}|\[.*\])$/,
  1141. rmultiDash = /([a-z])([A-Z])/g;
  1142. jQuery.extend({
  1143. cache: {},
  1144. // Please use with caution
  1145. uuid: 0,
  1146. // Unique for each copy of jQuery on the page
  1147. // Non-digits removed to match rinlinejQuery
  1148. expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
  1149. // The following elements throw uncatchable exceptions if you
  1150. // attempt to add expando properties to them.
  1151. noData: {
  1152. "embed": true,
  1153. // Ban all objects except for Flash (which handle expandos)
  1154. "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  1155. "applet": true
  1156. },
  1157. hasData: function( elem ) {
  1158. elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
  1159. return !!elem && !isEmptyDataObject( elem );
  1160. },
  1161. data: function( elem, name, data, pvt /* Internal Use Only */ ) {
  1162. if ( !jQuery.acceptData( elem ) ) {
  1163. return;
  1164. }
  1165. var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
  1166. // We have to handle DOM nodes and JS objects differently because IE6-7
  1167. // can't GC object references properly across the DOM-JS boundary
  1168. isNode = elem.nodeType,
  1169. // Only DOM nodes need the global jQuery cache; JS object data is
  1170. // attached directly to the object so GC can occur automatically
  1171. cache = isNode ? jQuery.cache : elem,
  1172. // Only defining an ID for JS objects if its cache already exists allows
  1173. // the code to shortcut on the same path as a DOM node with no cache
  1174. id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
  1175. // Avoid doing any more work than we need to when trying to get data on an
  1176. // object that has no data at all
  1177. if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
  1178. return;
  1179. }
  1180. if ( !id ) {
  1181. // Only DOM nodes need a new unique ID for each element since their data
  1182. // ends up in the global cache
  1183. if ( isNode ) {
  1184. elem[ jQuery.expando ] = id = ++jQuery.uuid;
  1185. } else {
  1186. id = jQuery.expando;
  1187. }
  1188. }
  1189. if ( !cache[ id ] ) {
  1190. cache[ id ] = {};
  1191. // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
  1192. // metadata on plain JS objects when the object is serialized using
  1193. // JSON.stringify
  1194. if ( !isNode ) {
  1195. cache[ id ].toJSON = jQuery.noop;
  1196. }
  1197. }
  1198. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  1199. // shallow copied over onto the existing cache
  1200. if ( typeof name === "object" || typeof name === "function" ) {
  1201. if ( pvt ) {
  1202. cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
  1203. } else {
  1204. cache[ id ] = jQuery.extend(cache[ id ], name);
  1205. }
  1206. }
  1207. thisCache = cache[ id ];
  1208. // Internal jQuery data is stored in a separate object inside the object's data
  1209. // cache in order to avoid key collisions between internal data and user-defined
  1210. // data
  1211. if ( pvt ) {
  1212. if ( !thisCache[ internalKey ] ) {
  1213. thisCache[ internalKey ] = {};
  1214. }
  1215. thisCache = thisCache[ internalKey ];
  1216. }
  1217. if ( data !== undefined ) {
  1218. thisCache[ jQuery.camelCase( name ) ] = data;
  1219. }
  1220. // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
  1221. // not attempt to inspect the internal events object using jQuery.data, as this
  1222. // internal data object is undocumented and subject to change.
  1223. if ( name === "events" && !thisCache[name] ) {
  1224. return thisCache[ internalKey ] && thisCache[ internalKey ].events;
  1225. }
  1226. return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
  1227. },
  1228. removeData: function( elem, name, pvt /* Internal Use Only */ ) {
  1229. if ( !jQuery.acceptData( elem ) ) {
  1230. return;
  1231. }
  1232. var internalKey = jQuery.expando, isNode = elem.nodeType,
  1233. // See jQuery.data for more information
  1234. cache = isNode ? jQuery.cache : elem,
  1235. // See jQuery.data for more information
  1236. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  1237. // If there is already no cache entry for this object, there is no
  1238. // purpose in continuing
  1239. if ( !cache[ id ] ) {
  1240. return;
  1241. }
  1242. if ( name ) {
  1243. var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
  1244. if ( thisCache ) {
  1245. delete thisCache[ name ];
  1246. // If there is no data left in the cache, we want to continue
  1247. // and let the cache object itself get destroyed
  1248. if ( !isEmptyDataObject(thisCache) ) {
  1249. return;
  1250. }
  1251. }
  1252. }
  1253. // See jQuery.data for more information
  1254. if ( pvt ) {
  1255. delete cache[ id ][ internalKey ];
  1256. // Don't destroy the parent cache unless the internal data object
  1257. // had been the only thing left in it
  1258. if ( !isEmptyDataObject(cache[ id ]) ) {
  1259. return;
  1260. }
  1261. }
  1262. var internalCache = cache[ id ][ internalKey ];
  1263. // Browsers that fail expando deletion also refuse to delete expandos on
  1264. // the window, but it will allow it on all other JS objects; other browsers
  1265. // don't care
  1266. if ( jQuery.support.deleteExpando || cache != window ) {
  1267. delete cache[ id ];
  1268. } else {
  1269. cache[ id ] = null;
  1270. }
  1271. // We destroyed the entire user cache at once because it's faster than
  1272. // iterating through each key, but we need to continue to persist internal
  1273. // data if it existed
  1274. if ( internalCache ) {
  1275. cache[ id ] = {};
  1276. // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
  1277. // metadata on plain JS objects when the object is serialized using
  1278. // JSON.stringify
  1279. if ( !isNode ) {
  1280. cache[ id ].toJSON = jQuery.noop;
  1281. }
  1282. cache[ id ][ internalKey ] = internalCache;
  1283. // Otherwise, we need to eliminate the expando on the node to avoid
  1284. // false lookups in the cache for entries that no longer exist
  1285. } else if ( isNode ) {
  1286. // IE does not allow us to delete expando properties from nodes,
  1287. // nor does it have a removeAttribute function on Document nodes;
  1288. // we must handle all of these cases
  1289. if ( jQuery.support.deleteExpando ) {
  1290. delete elem[ jQuery.expando ];
  1291. } else if ( elem.removeAttribute ) {
  1292. elem.removeAttribute( jQuery.expando );
  1293. } else {
  1294. elem[ jQuery.expando ] = null;
  1295. }
  1296. }
  1297. },
  1298. // For internal use only.
  1299. _data: function( elem, name, data ) {
  1300. return jQuery.data( elem, name, data, true );
  1301. },
  1302. // A method for determining if a DOM node can handle the data expando
  1303. acceptData: function( elem ) {
  1304. if ( elem.nodeName ) {
  1305. var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
  1306. if ( match ) {
  1307. return !(match === true || elem.getAttribute("classid") !== match);
  1308. }
  1309. }
  1310. return true;
  1311. }
  1312. });
  1313. jQuery.fn.extend({
  1314. data: function( key, value ) {
  1315. var data = null;
  1316. if ( typeof key === "undefined" ) {
  1317. if ( this.length ) {
  1318. data = jQuery.data( this[0] );
  1319. if ( this[0].nodeType === 1 ) {
  1320. var attr = this[0].attributes, name;
  1321. for ( var i = 0, l = attr.length; i < l; i++ ) {
  1322. name = attr[i].name;
  1323. if ( name.indexOf( "data-" ) === 0 ) {
  1324. name = jQuery.camelCase( name.substring(5) );
  1325. dataAttr( this[0], name, data[ name ] );
  1326. }
  1327. }
  1328. }
  1329. }
  1330. return data;
  1331. } else if ( typeof key === "object" ) {
  1332. return this.each(function() {
  1333. jQuery.data( this, key );
  1334. });
  1335. }
  1336. var parts = key.split(".");
  1337. parts[1] = parts[1] ? "." + parts[1] : "";
  1338. if ( value === undefined ) {
  1339. data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1340. // Try to fetch any internally stored data first
  1341. if ( data === undefined && this.length ) {
  1342. data = jQuery.data( this[0], key );
  1343. data = dataAttr( this[0], key, data );
  1344. }
  1345. return data === undefined && parts[1] ?
  1346. this.data( parts[0] ) :
  1347. data;
  1348. } else {
  1349. return this.each(function() {
  1350. var $this = jQuery( this ),
  1351. args = [ parts[0], value ];
  1352. $this.triggerHandler( "setData" + parts[1] + "!", args );
  1353. jQuery.data( this, key, value );
  1354. $this.triggerHandler( "changeData" + parts[1] + "!", args );
  1355. });
  1356. }
  1357. },
  1358. removeData: function( key ) {
  1359. return this.each(function() {
  1360. jQuery.removeData( this, key );
  1361. });
  1362. }
  1363. });
  1364. function dataAttr( elem, key, data ) {
  1365. // If nothing was found internally, try to fetch any
  1366. // data from the HTML5 data-* attribute
  1367. if ( data === undefined && elem.nodeType === 1 ) {
  1368. var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
  1369. data = elem.getAttribute( name );
  1370. if ( typeof data === "string" ) {
  1371. try {
  1372. data = data === "true" ? true :
  1373. data === "false" ? false :
  1374. data === "null" ? null :
  1375. !jQuery.isNaN( data ) ? parseFloat( data ) :
  1376. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  1377. data;
  1378. } catch( e ) {}
  1379. // Make sure we set the data so it isn't changed later
  1380. jQuery.data( elem, key, data );
  1381. } else {
  1382. data = undefined;
  1383. }
  1384. }
  1385. return data;
  1386. }
  1387. // TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
  1388. // property to be considered empty objects; this property always exists in
  1389. // order to make sure JSON.stringify does not expose internal metadata
  1390. function isEmptyDataObject( obj ) {
  1391. for ( var name in obj ) {
  1392. if ( name !== "toJSON" ) {
  1393. return false;
  1394. }
  1395. }
  1396. return true;
  1397. }
  1398. function handleQueueMarkDefer( elem, type, src ) {
  1399. var deferDataKey = type + "defer",
  1400. queueDataKey = type + "queue",
  1401. markDataKey = type + "mark",
  1402. defer = jQuery.data( elem, deferDataKey, undefined, true );
  1403. if ( defer &&
  1404. ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
  1405. ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
  1406. // Give room for hard-coded callbacks to fire first
  1407. // and eventually mark/queue something else on the element
  1408. setTimeout( function() {
  1409. if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
  1410. !jQuery.data( elem, markDataKey, undefined, true ) ) {
  1411. jQuery.removeData( elem, deferDataKey, true );
  1412. defer.resolve();
  1413. }
  1414. }, 0 );
  1415. }
  1416. }
  1417. jQuery.extend({
  1418. _mark: function( elem, type ) {
  1419. if ( elem ) {
  1420. type = (type || "fx") + "mark";
  1421. jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
  1422. }
  1423. },
  1424. _unmark: function( force, elem, type ) {
  1425. if ( force !== true ) {
  1426. type = elem;
  1427. elem = force;
  1428. force = false;
  1429. }
  1430. if ( elem ) {
  1431. type = type || "fx";
  1432. var key = type + "mark",
  1433. count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
  1434. if ( count ) {
  1435. jQuery.data( elem, key, count, true );
  1436. } else {
  1437. jQuery.removeData( elem, key, true );
  1438. handleQueueMarkDefer( elem, type, "mark" );
  1439. }
  1440. }
  1441. },
  1442. queue: function( elem, type, data ) {
  1443. if ( elem ) {
  1444. type = (type || "fx") + "queue";
  1445. var q = jQuery.data( elem, type, undefined, true );
  1446. // Speed up dequeue by getting out quickly if this is just a lookup
  1447. if ( data ) {
  1448. if ( !q || jQuery.isArray(data) ) {
  1449. q = jQuery.data( elem, type, jQuery.makeArray(data), true );
  1450. } else {
  1451. q.push( data );
  1452. }
  1453. }
  1454. return q || [];
  1455. }
  1456. },
  1457. dequeue: function( elem, type ) {
  1458. type = type || "fx";
  1459. var queue = jQuery.queue( elem, type ),
  1460. fn = queue.shift(),
  1461. defer;
  1462. // If the fx queue is dequeued, always remove the progress sentinel
  1463. if ( fn === "inprogress" ) {
  1464. fn = queue.shift();
  1465. }
  1466. if ( fn ) {
  1467. // Add a progress sentinel to prevent the fx queue from being
  1468. // automatically dequeued
  1469. if ( type === "fx" ) {
  1470. queue.unshift("inprogress");
  1471. }
  1472. fn.call(elem, function() {
  1473. jQuery.dequeue(elem, type);
  1474. });
  1475. }
  1476. if ( !queue.length ) {
  1477. jQuery.removeData( elem, type + "queue", true );
  1478. handleQueueMarkDefer( elem, type, "queue" );
  1479. }
  1480. }
  1481. });
  1482. jQuery.fn.extend({
  1483. queue: function( type, data ) {
  1484. if ( typeof type !== "string" ) {
  1485. data = type;
  1486. type = "fx";
  1487. }
  1488. if ( data === undefined ) {
  1489. return jQuery.queue( this[0], type );
  1490. }
  1491. return this.each(function() {
  1492. var queue = jQuery.queue( this, type, data );
  1493. if ( type === "fx" && queue[0] !== "inprogress" ) {
  1494. jQuery.dequeue( this, type );
  1495. }
  1496. });
  1497. },
  1498. dequeue: function( type ) {
  1499. return this.each(function() {
  1500. jQuery.dequeue( this, type );
  1501. });
  1502. },
  1503. // Based off of the plugin by Clint Helfers, with permission.
  1504. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  1505. delay: function( time, type ) {
  1506. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  1507. type = type || "fx";
  1508. return this.queue( type, function() {
  1509. var elem = this;
  1510. setTimeout(function() {
  1511. jQuery.dequeue( elem, type );
  1512. }, time );
  1513. });
  1514. },
  1515. clearQueue: function( type ) {
  1516. return this.queue( type || "fx", [] );
  1517. },
  1518. // Get a promise resolved when queues of a certain type
  1519. // are emptied (fx is the type by default)
  1520. promise: function( type, object ) {
  1521. if ( typeof type !== "string" ) {
  1522. object = type;
  1523. type = undefined;
  1524. }
  1525. type = type || "fx";
  1526. var defer = jQuery.Deferred(),
  1527. elements = this,
  1528. i = elements.length,
  1529. count = 1,
  1530. deferDataKey = type + "defer",
  1531. queueDataKey = type + "queue",
  1532. markDataKey = type + "mark",
  1533. tmp;
  1534. function resolve() {
  1535. if ( !( --count ) ) {
  1536. defer.resolveWith( elements, [ elements ] );
  1537. }
  1538. }
  1539. while( i-- ) {
  1540. if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
  1541. ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
  1542. jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
  1543. jQuery.data( elements[ i ], deferDat

Large files files are truncated, but you can click here to view the full file