PageRenderTime 63ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 1ms

/src/MM.Web/Scripts/jquery-1.4.1.js

#
JavaScript | 6111 lines | 4741 code | 828 blank | 542 comment | 975 complexity | e7b3b1cb5cb82f2f4c36c28ddb736f45 MD5 | raw file

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

  1. /*!
  2. * jQuery JavaScript Library v1.4.1
  3. * http://jquery.com/
  4. *
  5. * Copyright 2010, John Resig
  6. *
  7. * Includes Sizzle.js
  8. * http://sizzlejs.com/
  9. * Copyright 2010, The Dojo Foundation
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining
  12. * a copy of this software and associated documentation files (the
  13. * "Software"), to deal in the Software without restriction, including
  14. * without limitation the rights to use, copy, modify, merge, publish,
  15. * distribute, sublicense, and/or sell copies of the Software, and to
  16. * permit persons to whom the Software is furnished to do so, subject to
  17. * the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be
  20. * included in all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. * Date: Mon Jan 25 19:43:33 2010 -0500
  30. */
  31. (function( window, undefined ) {
  32. // Define a local copy of jQuery
  33. var jQuery = function( selector, context ) {
  34. // The jQuery object is actually just the init constructor 'enhanced'
  35. return new jQuery.fn.init( selector, context );
  36. },
  37. // Map over jQuery in case of overwrite
  38. _jQuery = window.jQuery,
  39. // Map over the $ in case of overwrite
  40. _$ = window.$,
  41. // Use the correct document accordingly with window argument (sandbox)
  42. document = window.document,
  43. // A central reference to the root jQuery(document)
  44. rootjQuery,
  45. // A simple way to check for HTML strings or ID strings
  46. // (both of which we optimize for)
  47. quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
  48. // Is it a simple selector
  49. isSimple = /^.[^:#\[\.,]*$/,
  50. // Check if a string has a non-whitespace character in it
  51. rnotwhite = /\S/,
  52. // Used for trimming whitespace
  53. rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
  54. // Match a standalone tag
  55. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  56. // Keep a UserAgent string for use with jQuery.browser
  57. userAgent = navigator.userAgent,
  58. // For matching the engine and version of the browser
  59. browserMatch,
  60. // Has the ready events already been bound?
  61. readyBound = false,
  62. // The functions to execute on DOM ready
  63. readyList = [],
  64. // The ready event handler
  65. DOMContentLoaded,
  66. // Save a reference to some core methods
  67. toString = Object.prototype.toString,
  68. hasOwnProperty = Object.prototype.hasOwnProperty,
  69. push = Array.prototype.push,
  70. slice = Array.prototype.slice,
  71. indexOf = Array.prototype.indexOf;
  72. jQuery.fn = jQuery.prototype = {
  73. init: function( selector, context ) {
  74. var match, elem, ret, doc;
  75. // Handle $(""), $(null), or $(undefined)
  76. if ( !selector ) {
  77. return this;
  78. }
  79. // Handle $(DOMElement)
  80. if ( selector.nodeType ) {
  81. this.context = this[0] = selector;
  82. this.length = 1;
  83. return this;
  84. }
  85. // Handle HTML strings
  86. if ( typeof selector === "string" ) {
  87. // Are we dealing with HTML string or an ID?
  88. match = quickExpr.exec( selector );
  89. // Verify a match, and that no context was specified for #id
  90. if ( match && (match[1] || !context) ) {
  91. // HANDLE: $(html) -> $(array)
  92. if ( match[1] ) {
  93. doc = (context ? context.ownerDocument || context : document);
  94. // If a single string is passed in and it's a single tag
  95. // just do a createElement and skip the rest
  96. ret = rsingleTag.exec( selector );
  97. if ( ret ) {
  98. if ( jQuery.isPlainObject( context ) ) {
  99. selector = [ document.createElement( ret[1] ) ];
  100. jQuery.fn.attr.call( selector, context, true );
  101. } else {
  102. selector = [ doc.createElement( ret[1] ) ];
  103. }
  104. } else {
  105. ret = buildFragment( [ match[1] ], [ doc ] );
  106. selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
  107. }
  108. // HANDLE: $("#id")
  109. } else {
  110. elem = document.getElementById( match[2] );
  111. if ( elem ) {
  112. // Handle the case where IE and Opera return items
  113. // by name instead of ID
  114. if ( elem.id !== match[2] ) {
  115. return rootjQuery.find( selector );
  116. }
  117. // Otherwise, we inject the element directly into the jQuery object
  118. this.length = 1;
  119. this[0] = elem;
  120. }
  121. this.context = document;
  122. this.selector = selector;
  123. return this;
  124. }
  125. // HANDLE: $("TAG")
  126. } else if ( !context && /^\w+$/.test( selector ) ) {
  127. this.selector = selector;
  128. this.context = document;
  129. selector = document.getElementsByTagName( selector );
  130. // HANDLE: $(expr, $(...))
  131. } else if ( !context || context.jquery ) {
  132. return (context || rootjQuery).find( selector );
  133. // HANDLE: $(expr, context)
  134. // (which is just equivalent to: $(context).find(expr)
  135. } else {
  136. return jQuery( context ).find( selector );
  137. }
  138. // HANDLE: $(function)
  139. // Shortcut for document ready
  140. } else if ( jQuery.isFunction( selector ) ) {
  141. return rootjQuery.ready( selector );
  142. }
  143. if (selector.selector !== undefined) {
  144. this.selector = selector.selector;
  145. this.context = selector.context;
  146. }
  147. return jQuery.isArray( selector ) ?
  148. this.setArray( selector ) :
  149. jQuery.makeArray( selector, this );
  150. },
  151. // Start with an empty selector
  152. selector: "",
  153. // The current version of jQuery being used
  154. jquery: "1.4.1",
  155. // The default length of a jQuery object is 0
  156. length: 0,
  157. // The number of elements contained in the matched element set
  158. size: function() {
  159. return this.length;
  160. },
  161. toArray: function() {
  162. return slice.call( this, 0 );
  163. },
  164. // Get the Nth element in the matched element set OR
  165. // Get the whole matched element set as a clean array
  166. get: function( num ) {
  167. return num == null ?
  168. // Return a 'clean' array
  169. this.toArray() :
  170. // Return just the object
  171. ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
  172. },
  173. // Take an array of elements and push it onto the stack
  174. // (returning the new matched element set)
  175. pushStack: function( elems, name, selector ) {
  176. // Build a new jQuery matched element set
  177. var ret = jQuery( elems || null );
  178. // Add the old object onto the stack (as a reference)
  179. ret.prevObject = this;
  180. ret.context = this.context;
  181. if ( name === "find" ) {
  182. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  183. } else if ( name ) {
  184. ret.selector = this.selector + "." + name + "(" + selector + ")";
  185. }
  186. // Return the newly-formed element set
  187. return ret;
  188. },
  189. // Force the current matched set of elements to become
  190. // the specified array of elements (destroying the stack in the process)
  191. // You should use pushStack() in order to do this, but maintain the stack
  192. setArray: function( elems ) {
  193. // Resetting the length to 0, then using the native Array push
  194. // is a super-fast way to populate an object with array-like properties
  195. this.length = 0;
  196. push.apply( this, elems );
  197. return this;
  198. },
  199. // Execute a callback for every element in the matched set.
  200. // (You can seed the arguments with an array of args, but this is
  201. // only used internally.)
  202. each: function( callback, args ) {
  203. return jQuery.each( this, callback, args );
  204. },
  205. ready: function( fn ) {
  206. // Attach the listeners
  207. jQuery.bindReady();
  208. // If the DOM is already ready
  209. if ( jQuery.isReady ) {
  210. // Execute the function immediately
  211. fn.call( document, jQuery );
  212. // Otherwise, remember the function for later
  213. } else if ( readyList ) {
  214. // Add the function to the wait list
  215. readyList.push( fn );
  216. }
  217. return this;
  218. },
  219. eq: function( i ) {
  220. return i === -1 ?
  221. this.slice( i ) :
  222. this.slice( i, +i + 1 );
  223. },
  224. first: function() {
  225. return this.eq( 0 );
  226. },
  227. last: function() {
  228. return this.eq( -1 );
  229. },
  230. slice: function() {
  231. return this.pushStack( slice.apply( this, arguments ),
  232. "slice", slice.call(arguments).join(",") );
  233. },
  234. map: function( callback ) {
  235. return this.pushStack( jQuery.map(this, function( elem, i ) {
  236. return callback.call( elem, i, elem );
  237. }));
  238. },
  239. end: function() {
  240. return this.prevObject || jQuery(null);
  241. },
  242. // For internal use only.
  243. // Behaves like an Array's method, not like a jQuery method.
  244. push: push,
  245. sort: [].sort,
  246. splice: [].splice
  247. };
  248. // Give the init function the jQuery prototype for later instantiation
  249. jQuery.fn.init.prototype = jQuery.fn;
  250. jQuery.extend = jQuery.fn.extend = function() {
  251. // copy reference to target object
  252. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
  253. // Handle a deep copy situation
  254. if ( typeof target === "boolean" ) {
  255. deep = target;
  256. target = arguments[1] || {};
  257. // skip the boolean and the target
  258. i = 2;
  259. }
  260. // Handle case when target is a string or something (possible in deep copy)
  261. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  262. target = {};
  263. }
  264. // extend jQuery itself if only one argument is passed
  265. if ( length === i ) {
  266. target = this;
  267. --i;
  268. }
  269. for ( ; i < length; i++ ) {
  270. // Only deal with non-null/undefined values
  271. if ( (options = arguments[ i ]) != null ) {
  272. // Extend the base object
  273. for ( name in options ) {
  274. src = target[ name ];
  275. copy = options[ name ];
  276. // Prevent never-ending loop
  277. if ( target === copy ) {
  278. continue;
  279. }
  280. // Recurse if we're merging object literal values or arrays
  281. if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
  282. var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
  283. : jQuery.isArray(copy) ? [] : {};
  284. // Never move original objects, clone them
  285. target[ name ] = jQuery.extend( deep, clone, copy );
  286. // Don't bring in undefined values
  287. } else if ( copy !== undefined ) {
  288. target[ name ] = copy;
  289. }
  290. }
  291. }
  292. }
  293. // Return the modified object
  294. return target;
  295. };
  296. jQuery.extend({
  297. noConflict: function( deep ) {
  298. window.$ = _$;
  299. if ( deep ) {
  300. window.jQuery = _jQuery;
  301. }
  302. return jQuery;
  303. },
  304. // Is the DOM ready to be used? Set to true once it occurs.
  305. isReady: false,
  306. // Handle when the DOM is ready
  307. ready: function() {
  308. // Make sure that the DOM is not already loaded
  309. if ( !jQuery.isReady ) {
  310. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  311. if ( !document.body ) {
  312. return setTimeout( jQuery.ready, 13 );
  313. }
  314. // Remember that the DOM is ready
  315. jQuery.isReady = true;
  316. // If there are functions bound, to execute
  317. if ( readyList ) {
  318. // Execute all of them
  319. var fn, i = 0;
  320. while ( (fn = readyList[ i++ ]) ) {
  321. fn.call( document, jQuery );
  322. }
  323. // Reset the list of functions
  324. readyList = null;
  325. }
  326. // Trigger any bound ready events
  327. if ( jQuery.fn.triggerHandler ) {
  328. jQuery( document ).triggerHandler( "ready" );
  329. }
  330. }
  331. },
  332. bindReady: function() {
  333. if ( readyBound ) {
  334. return;
  335. }
  336. readyBound = true;
  337. // Catch cases where $(document).ready() is called after the
  338. // browser event has already occurred.
  339. if ( document.readyState === "complete" ) {
  340. return jQuery.ready();
  341. }
  342. // Mozilla, Opera and webkit nightlies currently support this event
  343. if ( document.addEventListener ) {
  344. // Use the handy event callback
  345. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  346. // A fallback to window.onload, that will always work
  347. window.addEventListener( "load", jQuery.ready, false );
  348. // If IE event model is used
  349. } else if ( document.attachEvent ) {
  350. // ensure firing before onload,
  351. // maybe late but safe also for iframes
  352. document.attachEvent("onreadystatechange", DOMContentLoaded);
  353. // A fallback to window.onload, that will always work
  354. window.attachEvent( "onload", jQuery.ready );
  355. // If IE and not a frame
  356. // continually check to see if the document is ready
  357. var toplevel = false;
  358. try {
  359. toplevel = window.frameElement == null;
  360. } catch(e) {}
  361. if ( document.documentElement.doScroll && toplevel ) {
  362. doScrollCheck();
  363. }
  364. }
  365. },
  366. // See test/unit/core.js for details concerning isFunction.
  367. // Since version 1.3, DOM methods and functions like alert
  368. // aren't supported. They return false on IE (#2968).
  369. isFunction: function( obj ) {
  370. return toString.call(obj) === "[object Function]";
  371. },
  372. isArray: function( obj ) {
  373. return toString.call(obj) === "[object Array]";
  374. },
  375. isPlainObject: function( obj ) {
  376. // Must be an Object.
  377. // Because of IE, we also have to check the presence of the constructor property.
  378. // Make sure that DOM nodes and window objects don't pass through, as well
  379. if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
  380. return false;
  381. }
  382. // Not own constructor property must be Object
  383. if ( obj.constructor
  384. && !hasOwnProperty.call(obj, "constructor")
  385. && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
  386. return false;
  387. }
  388. // Own properties are enumerated firstly, so to speed up,
  389. // if last one is own, then all properties are own.
  390. var key;
  391. for ( key in obj ) {}
  392. return key === undefined || hasOwnProperty.call( obj, key );
  393. },
  394. isEmptyObject: function( obj ) {
  395. for ( var name in obj ) {
  396. return false;
  397. }
  398. return true;
  399. },
  400. error: function( msg ) {
  401. throw msg;
  402. },
  403. parseJSON: function( data ) {
  404. if ( typeof data !== "string" || !data ) {
  405. return null;
  406. }
  407. // Make sure the incoming data is actual JSON
  408. // Logic borrowed from http://json.org/json2.js
  409. if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
  410. .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
  411. .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
  412. // Try to use the native JSON parser first
  413. return window.JSON && window.JSON.parse ?
  414. window.JSON.parse( data ) :
  415. (new Function("return " + data))();
  416. } else {
  417. jQuery.error( "Invalid JSON: " + data );
  418. }
  419. },
  420. noop: function() {},
  421. // Evalulates a script in a global context
  422. globalEval: function( data ) {
  423. if ( data && rnotwhite.test(data) ) {
  424. // Inspired by code by Andrea Giammarchi
  425. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  426. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  427. script = document.createElement("script");
  428. script.type = "text/javascript";
  429. if ( jQuery.support.scriptEval ) {
  430. script.appendChild( document.createTextNode( data ) );
  431. } else {
  432. script.text = data;
  433. }
  434. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  435. // This arises when a base node is used (#2709).
  436. head.insertBefore( script, head.firstChild );
  437. head.removeChild( script );
  438. }
  439. },
  440. nodeName: function( elem, name ) {
  441. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  442. },
  443. // args is for internal usage only
  444. each: function( object, callback, args ) {
  445. var name, i = 0,
  446. length = object.length,
  447. isObj = length === undefined || jQuery.isFunction(object);
  448. if ( args ) {
  449. if ( isObj ) {
  450. for ( name in object ) {
  451. if ( callback.apply( object[ name ], args ) === false ) {
  452. break;
  453. }
  454. }
  455. } else {
  456. for ( ; i < length; ) {
  457. if ( callback.apply( object[ i++ ], args ) === false ) {
  458. break;
  459. }
  460. }
  461. }
  462. // A special, fast, case for the most common use of each
  463. } else {
  464. if ( isObj ) {
  465. for ( name in object ) {
  466. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  467. break;
  468. }
  469. }
  470. } else {
  471. for ( var value = object[0];
  472. i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
  473. }
  474. }
  475. return object;
  476. },
  477. trim: function( text ) {
  478. return (text || "").replace( rtrim, "" );
  479. },
  480. // results is for internal usage only
  481. makeArray: function( array, results ) {
  482. var ret = results || [];
  483. if ( array != null ) {
  484. // The window, strings (and functions) also have 'length'
  485. // The extra typeof function check is to prevent crashes
  486. // in Safari 2 (See: #3039)
  487. if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
  488. push.call( ret, array );
  489. } else {
  490. jQuery.merge( ret, array );
  491. }
  492. }
  493. return ret;
  494. },
  495. inArray: function( elem, array ) {
  496. if ( array.indexOf ) {
  497. return array.indexOf( elem );
  498. }
  499. for ( var i = 0, length = array.length; i < length; i++ ) {
  500. if ( array[ i ] === elem ) {
  501. return i;
  502. }
  503. }
  504. return -1;
  505. },
  506. merge: function( first, second ) {
  507. var i = first.length, j = 0;
  508. if ( typeof second.length === "number" ) {
  509. for ( var l = second.length; j < l; j++ ) {
  510. first[ i++ ] = second[ j ];
  511. }
  512. } else {
  513. while ( second[j] !== undefined ) {
  514. first[ i++ ] = second[ j++ ];
  515. }
  516. }
  517. first.length = i;
  518. return first;
  519. },
  520. grep: function( elems, callback, inv ) {
  521. var ret = [];
  522. // Go through the array, only saving the items
  523. // that pass the validator function
  524. for ( var i = 0, length = elems.length; i < length; i++ ) {
  525. if ( !inv !== !callback( elems[ i ], i ) ) {
  526. ret.push( elems[ i ] );
  527. }
  528. }
  529. return ret;
  530. },
  531. // arg is for internal usage only
  532. map: function( elems, callback, arg ) {
  533. var ret = [], value;
  534. // Go through the array, translating each of the items to their
  535. // new value (or values).
  536. for ( var i = 0, length = elems.length; i < length; i++ ) {
  537. value = callback( elems[ i ], i, arg );
  538. if ( value != null ) {
  539. ret[ ret.length ] = value;
  540. }
  541. }
  542. return ret.concat.apply( [], ret );
  543. },
  544. // A global GUID counter for objects
  545. guid: 1,
  546. proxy: function( fn, proxy, thisObject ) {
  547. if ( arguments.length === 2 ) {
  548. if ( typeof proxy === "string" ) {
  549. thisObject = fn;
  550. fn = thisObject[ proxy ];
  551. proxy = undefined;
  552. } else if ( proxy && !jQuery.isFunction( proxy ) ) {
  553. thisObject = proxy;
  554. proxy = undefined;
  555. }
  556. }
  557. if ( !proxy && fn ) {
  558. proxy = function() {
  559. return fn.apply( thisObject || this, arguments );
  560. };
  561. }
  562. // Set the guid of unique handler to the same of original handler, so it can be removed
  563. if ( fn ) {
  564. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  565. }
  566. // So proxy can be declared as an argument
  567. return proxy;
  568. },
  569. // Use of jQuery.browser is frowned upon.
  570. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  571. uaMatch: function( ua ) {
  572. ua = ua.toLowerCase();
  573. var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
  574. /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
  575. /(msie) ([\w.]+)/.exec( ua ) ||
  576. !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
  577. [];
  578. return { browser: match[1] || "", version: match[2] || "0" };
  579. },
  580. browser: {}
  581. });
  582. browserMatch = jQuery.uaMatch( userAgent );
  583. if ( browserMatch.browser ) {
  584. jQuery.browser[ browserMatch.browser ] = true;
  585. jQuery.browser.version = browserMatch.version;
  586. }
  587. // Deprecated, use jQuery.browser.webkit instead
  588. if ( jQuery.browser.webkit ) {
  589. jQuery.browser.safari = true;
  590. }
  591. if ( indexOf ) {
  592. jQuery.inArray = function( elem, array ) {
  593. return indexOf.call( array, elem );
  594. };
  595. }
  596. // All jQuery objects should point back to these
  597. rootjQuery = jQuery(document);
  598. // Cleanup functions for the document ready method
  599. if ( document.addEventListener ) {
  600. DOMContentLoaded = function() {
  601. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  602. jQuery.ready();
  603. };
  604. } else if ( document.attachEvent ) {
  605. DOMContentLoaded = function() {
  606. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  607. if ( document.readyState === "complete" ) {
  608. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  609. jQuery.ready();
  610. }
  611. };
  612. }
  613. // The DOM ready check for Internet Explorer
  614. function doScrollCheck() {
  615. if ( jQuery.isReady ) {
  616. return;
  617. }
  618. try {
  619. // If IE is used, use the trick by Diego Perini
  620. // http://javascript.nwbox.com/IEContentLoaded/
  621. document.documentElement.doScroll("left");
  622. } catch( error ) {
  623. setTimeout( doScrollCheck, 1 );
  624. return;
  625. }
  626. // and execute any waiting functions
  627. jQuery.ready();
  628. }
  629. function evalScript( i, elem ) {
  630. if ( elem.src ) {
  631. jQuery.ajax({
  632. url: elem.src,
  633. async: false,
  634. dataType: "script"
  635. });
  636. } else {
  637. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  638. }
  639. if ( elem.parentNode ) {
  640. elem.parentNode.removeChild( elem );
  641. }
  642. }
  643. // Mutifunctional method to get and set values to a collection
  644. // The value/s can be optionally by executed if its a function
  645. function access( elems, key, value, exec, fn, pass ) {
  646. var length = elems.length;
  647. // Setting many attributes
  648. if ( typeof key === "object" ) {
  649. for ( var k in key ) {
  650. access( elems, k, key[k], exec, fn, value );
  651. }
  652. return elems;
  653. }
  654. // Setting one attribute
  655. if ( value !== undefined ) {
  656. // Optionally, function values get executed if exec is true
  657. exec = !pass && exec && jQuery.isFunction(value);
  658. for ( var i = 0; i < length; i++ ) {
  659. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  660. }
  661. return elems;
  662. }
  663. // Getting an attribute
  664. return length ? fn( elems[0], key ) : null;
  665. }
  666. function now() {
  667. return (new Date).getTime();
  668. }
  669. (function() {
  670. jQuery.support = {};
  671. var root = document.documentElement,
  672. script = document.createElement("script"),
  673. div = document.createElement("div"),
  674. id = "script" + now();
  675. div.style.display = "none";
  676. div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  677. var all = div.getElementsByTagName("*"),
  678. a = div.getElementsByTagName("a")[0];
  679. // Can't get basic test support
  680. if ( !all || !all.length || !a ) {
  681. return;
  682. }
  683. jQuery.support = {
  684. // IE strips leading whitespace when .innerHTML is used
  685. leadingWhitespace: div.firstChild.nodeType === 3,
  686. // Make sure that tbody elements aren't automatically inserted
  687. // IE will insert them into empty tables
  688. tbody: !div.getElementsByTagName("tbody").length,
  689. // Make sure that link elements get serialized correctly by innerHTML
  690. // This requires a wrapper element in IE
  691. htmlSerialize: !!div.getElementsByTagName("link").length,
  692. // Get the style information from getAttribute
  693. // (IE uses .cssText insted)
  694. style: /red/.test( a.getAttribute("style") ),
  695. // Make sure that URLs aren't manipulated
  696. // (IE normalizes it by default)
  697. hrefNormalized: a.getAttribute("href") === "/a",
  698. // Make sure that element opacity exists
  699. // (IE uses filter instead)
  700. // Use a regex to work around a WebKit issue. See #5145
  701. opacity: /^0.55$/.test( a.style.opacity ),
  702. // Verify style float existence
  703. // (IE uses styleFloat instead of cssFloat)
  704. cssFloat: !!a.style.cssFloat,
  705. // Make sure that if no value is specified for a checkbox
  706. // that it defaults to "on".
  707. // (WebKit defaults to "" instead)
  708. checkOn: div.getElementsByTagName("input")[0].value === "on",
  709. // Make sure that a selected-by-default option has a working selected property.
  710. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  711. optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
  712. // Will be defined later
  713. checkClone: false,
  714. scriptEval: false,
  715. noCloneEvent: true,
  716. boxModel: null
  717. };
  718. script.type = "text/javascript";
  719. try {
  720. script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
  721. } catch(e) {}
  722. root.insertBefore( script, root.firstChild );
  723. // Make sure that the execution of code works by injecting a script
  724. // tag with appendChild/createTextNode
  725. // (IE doesn't support this, fails, and uses .text instead)
  726. if ( window[ id ] ) {
  727. jQuery.support.scriptEval = true;
  728. delete window[ id ];
  729. }
  730. root.removeChild( script );
  731. if ( div.attachEvent && div.fireEvent ) {
  732. div.attachEvent("onclick", function click() {
  733. // Cloning a node shouldn't copy over any
  734. // bound event handlers (IE does this)
  735. jQuery.support.noCloneEvent = false;
  736. div.detachEvent("onclick", click);
  737. });
  738. div.cloneNode(true).fireEvent("onclick");
  739. }
  740. div = document.createElement("div");
  741. div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
  742. var fragment = document.createDocumentFragment();
  743. fragment.appendChild( div.firstChild );
  744. // WebKit doesn't clone checked state correctly in fragments
  745. jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
  746. // Figure out if the W3C box model works as expected
  747. // document.body must exist before we can do this
  748. jQuery(function() {
  749. var div = document.createElement("div");
  750. div.style.width = div.style.paddingLeft = "1px";
  751. document.body.appendChild( div );
  752. jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
  753. document.body.removeChild( div ).style.display = 'none';
  754. div = null;
  755. });
  756. // Technique from Juriy Zaytsev
  757. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  758. var eventSupported = function( eventName ) {
  759. var el = document.createElement("div");
  760. eventName = "on" + eventName;
  761. var isSupported = (eventName in el);
  762. if ( !isSupported ) {
  763. el.setAttribute(eventName, "return;");
  764. isSupported = typeof el[eventName] === "function";
  765. }
  766. el = null;
  767. return isSupported;
  768. };
  769. jQuery.support.submitBubbles = eventSupported("submit");
  770. jQuery.support.changeBubbles = eventSupported("change");
  771. // release memory in IE
  772. root = script = div = all = a = null;
  773. })();
  774. jQuery.props = {
  775. "for": "htmlFor",
  776. "class": "className",
  777. readonly: "readOnly",
  778. maxlength: "maxLength",
  779. cellspacing: "cellSpacing",
  780. rowspan: "rowSpan",
  781. colspan: "colSpan",
  782. tabindex: "tabIndex",
  783. usemap: "useMap",
  784. frameborder: "frameBorder"
  785. };
  786. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  787. var emptyObject = {};
  788. jQuery.extend({
  789. cache: {},
  790. expando:expando,
  791. // The following elements throw uncatchable exceptions if you
  792. // attempt to add expando properties to them.
  793. noData: {
  794. "embed": true,
  795. "object": true,
  796. "applet": true
  797. },
  798. data: function( elem, name, data ) {
  799. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  800. return;
  801. }
  802. elem = elem == window ?
  803. windowData :
  804. elem;
  805. var id = elem[ expando ], cache = jQuery.cache, thisCache;
  806. // Handle the case where there's no name immediately
  807. if ( !name && !id ) {
  808. return null;
  809. }
  810. // Compute a unique ID for the element
  811. if ( !id ) {
  812. id = ++uuid;
  813. }
  814. // Avoid generating a new cache unless none exists and we
  815. // want to manipulate it.
  816. if ( typeof name === "object" ) {
  817. elem[ expando ] = id;
  818. thisCache = cache[ id ] = jQuery.extend(true, {}, name);
  819. } else if ( cache[ id ] ) {
  820. thisCache = cache[ id ];
  821. } else if ( typeof data === "undefined" ) {
  822. thisCache = emptyObject;
  823. } else {
  824. thisCache = cache[ id ] = {};
  825. }
  826. // Prevent overriding the named cache with undefined values
  827. if ( data !== undefined ) {
  828. elem[ expando ] = id;
  829. thisCache[ name ] = data;
  830. }
  831. return typeof name === "string" ? thisCache[ name ] : thisCache;
  832. },
  833. removeData: function( elem, name ) {
  834. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  835. return;
  836. }
  837. elem = elem == window ?
  838. windowData :
  839. elem;
  840. var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
  841. // If we want to remove a specific section of the element's data
  842. if ( name ) {
  843. if ( thisCache ) {
  844. // Remove the section of cache data
  845. delete thisCache[ name ];
  846. // If we've removed all the data, remove the element's cache
  847. if ( jQuery.isEmptyObject(thisCache) ) {
  848. jQuery.removeData( elem );
  849. }
  850. }
  851. // Otherwise, we want to remove all of the element's data
  852. } else {
  853. // Clean up the element expando
  854. try {
  855. delete elem[ expando ];
  856. } catch( e ) {
  857. // IE has trouble directly removing the expando
  858. // but it's ok with using removeAttribute
  859. if ( elem.removeAttribute ) {
  860. elem.removeAttribute( expando );
  861. }
  862. }
  863. // Completely remove the data cache
  864. delete cache[ id ];
  865. }
  866. }
  867. });
  868. jQuery.fn.extend({
  869. data: function( key, value ) {
  870. if ( typeof key === "undefined" && this.length ) {
  871. return jQuery.data( this[0] );
  872. } else if ( typeof key === "object" ) {
  873. return this.each(function() {
  874. jQuery.data( this, key );
  875. });
  876. }
  877. var parts = key.split(".");
  878. parts[1] = parts[1] ? "." + parts[1] : "";
  879. if ( value === undefined ) {
  880. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  881. if ( data === undefined && this.length ) {
  882. data = jQuery.data( this[0], key );
  883. }
  884. return data === undefined && parts[1] ?
  885. this.data( parts[0] ) :
  886. data;
  887. } else {
  888. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
  889. jQuery.data( this, key, value );
  890. });
  891. }
  892. },
  893. removeData: function( key ) {
  894. return this.each(function() {
  895. jQuery.removeData( this, key );
  896. });
  897. }
  898. });
  899. jQuery.extend({
  900. queue: function( elem, type, data ) {
  901. if ( !elem ) {
  902. return;
  903. }
  904. type = (type || "fx") + "queue";
  905. var q = jQuery.data( elem, type );
  906. // Speed up dequeue by getting out quickly if this is just a lookup
  907. if ( !data ) {
  908. return q || [];
  909. }
  910. if ( !q || jQuery.isArray(data) ) {
  911. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  912. } else {
  913. q.push( data );
  914. }
  915. return q;
  916. },
  917. dequeue: function( elem, type ) {
  918. type = type || "fx";
  919. var queue = jQuery.queue( elem, type ), fn = queue.shift();
  920. // If the fx queue is dequeued, always remove the progress sentinel
  921. if ( fn === "inprogress" ) {
  922. fn = queue.shift();
  923. }
  924. if ( fn ) {
  925. // Add a progress sentinel to prevent the fx queue from being
  926. // automatically dequeued
  927. if ( type === "fx" ) {
  928. queue.unshift("inprogress");
  929. }
  930. fn.call(elem, function() {
  931. jQuery.dequeue(elem, type);
  932. });
  933. }
  934. }
  935. });
  936. jQuery.fn.extend({
  937. queue: function( type, data ) {
  938. if ( typeof type !== "string" ) {
  939. data = type;
  940. type = "fx";
  941. }
  942. if ( data === undefined ) {
  943. return jQuery.queue( this[0], type );
  944. }
  945. return this.each(function( i, elem ) {
  946. var queue = jQuery.queue( this, type, data );
  947. if ( type === "fx" && queue[0] !== "inprogress" ) {
  948. jQuery.dequeue( this, type );
  949. }
  950. });
  951. },
  952. dequeue: function( type ) {
  953. return this.each(function() {
  954. jQuery.dequeue( this, type );
  955. });
  956. },
  957. // Based off of the plugin by Clint Helfers, with permission.
  958. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  959. delay: function( time, type ) {
  960. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  961. type = type || "fx";
  962. return this.queue( type, function() {
  963. var elem = this;
  964. setTimeout(function() {
  965. jQuery.dequeue( elem, type );
  966. }, time );
  967. });
  968. },
  969. clearQueue: function( type ) {
  970. return this.queue( type || "fx", [] );
  971. }
  972. });
  973. var rclass = /[\n\t]/g,
  974. rspace = /\s+/,
  975. rreturn = /\r/g,
  976. rspecialurl = /href|src|style/,
  977. rtype = /(button|input)/i,
  978. rfocusable = /(button|input|object|select|textarea)/i,
  979. rclickable = /^(a|area)$/i,
  980. rradiocheck = /radio|checkbox/;
  981. jQuery.fn.extend({
  982. attr: function( name, value ) {
  983. return access( this, name, value, true, jQuery.attr );
  984. },
  985. removeAttr: function( name, fn ) {
  986. return this.each(function(){
  987. jQuery.attr( this, name, "" );
  988. if ( this.nodeType === 1 ) {
  989. this.removeAttribute( name );
  990. }
  991. });
  992. },
  993. addClass: function( value ) {
  994. if ( jQuery.isFunction(value) ) {
  995. return this.each(function(i) {
  996. var self = jQuery(this);
  997. self.addClass( value.call(this, i, self.attr("class")) );
  998. });
  999. }
  1000. if ( value && typeof value === "string" ) {
  1001. var classNames = (value || "").split( rspace );
  1002. for ( var i = 0, l = this.length; i < l; i++ ) {
  1003. var elem = this[i];
  1004. if ( elem.nodeType === 1 ) {
  1005. if ( !elem.className ) {
  1006. elem.className = value;
  1007. } else {
  1008. var className = " " + elem.className + " ";
  1009. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1010. if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
  1011. elem.className += " " + classNames[c];
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018. return this;
  1019. },
  1020. removeClass: function( value ) {
  1021. if ( jQuery.isFunction(value) ) {
  1022. return this.each(function(i) {
  1023. var self = jQuery(this);
  1024. self.removeClass( value.call(this, i, self.attr("class")) );
  1025. });
  1026. }
  1027. if ( (value && typeof value === "string") || value === undefined ) {
  1028. var classNames = (value || "").split(rspace);
  1029. for ( var i = 0, l = this.length; i < l; i++ ) {
  1030. var elem = this[i];
  1031. if ( elem.nodeType === 1 && elem.className ) {
  1032. if ( value ) {
  1033. var className = (" " + elem.className + " ").replace(rclass, " ");
  1034. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1035. className = className.replace(" " + classNames[c] + " ", " ");
  1036. }
  1037. elem.className = className.substring(1, className.length - 1);
  1038. } else {
  1039. elem.className = "";
  1040. }
  1041. }
  1042. }
  1043. }
  1044. return this;
  1045. },
  1046. toggleClass: function( value, stateVal ) {
  1047. var type = typeof value, isBool = typeof stateVal === "boolean";
  1048. if ( jQuery.isFunction( value ) ) {
  1049. return this.each(function(i) {
  1050. var self = jQuery(this);
  1051. self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
  1052. });
  1053. }
  1054. return this.each(function() {
  1055. if ( type === "string" ) {
  1056. // toggle individual class names
  1057. var className, i = 0, self = jQuery(this),
  1058. state = stateVal,
  1059. classNames = value.split( rspace );
  1060. while ( (className = classNames[ i++ ]) ) {
  1061. // check each className given, space seperated list
  1062. state = isBool ? state : !self.hasClass( className );
  1063. self[ state ? "addClass" : "removeClass" ]( className );
  1064. }
  1065. } else if ( type === "undefined" || type === "boolean" ) {
  1066. if ( this.className ) {
  1067. // store className if set
  1068. jQuery.data( this, "__className__", this.className );
  1069. }
  1070. // toggle whole className
  1071. this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
  1072. }
  1073. });
  1074. },
  1075. hasClass: function( selector ) {
  1076. var className = " " + selector + " ";
  1077. for ( var i = 0, l = this.length; i < l; i++ ) {
  1078. if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
  1079. return true;
  1080. }
  1081. }
  1082. return false;
  1083. },
  1084. val: function( value ) {
  1085. if ( value === undefined ) {
  1086. var elem = this[0];
  1087. if ( elem ) {
  1088. if ( jQuery.nodeName( elem, "option" ) ) {
  1089. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  1090. }
  1091. // We need to handle select boxes special
  1092. if ( jQuery.nodeName( elem, "select" ) ) {
  1093. var index = elem.selectedIndex,
  1094. values = [],
  1095. options = elem.options,
  1096. one = elem.type === "select-one";
  1097. // Nothing was selected
  1098. if ( index < 0 ) {
  1099. return null;
  1100. }
  1101. // Loop through all the selected options
  1102. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  1103. var option = options[ i ];
  1104. if ( option.selected ) {
  1105. // Get the specifc value for the option
  1106. value = jQuery(option).val();
  1107. // We don't need an array for one selects
  1108. if ( one ) {
  1109. return value;
  1110. }
  1111. // Multi-Selects return an array
  1112. values.push( value );
  1113. }
  1114. }
  1115. return values;
  1116. }
  1117. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  1118. if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
  1119. return elem.getAttribute("value") === null ? "on" : elem.value;
  1120. }
  1121. // Everything else, we just grab the value
  1122. return (elem.value || "").replace(rreturn, "");
  1123. }
  1124. return undefined;
  1125. }
  1126. var isFunction = jQuery.isFunction(value);
  1127. return this.each(function(i) {
  1128. var self = jQuery(this), val = value;
  1129. if ( this.nodeType !== 1 ) {
  1130. return;
  1131. }
  1132. if ( isFunction ) {
  1133. val = value.call(this, i, self.val());
  1134. }
  1135. // Typecast each time if the value is a Function and the appended
  1136. // value is therefore different each time.
  1137. if ( typeof val === "number" ) {
  1138. val += "";
  1139. }
  1140. if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
  1141. this.checked = jQuery.inArray( self.val(), val ) >= 0;
  1142. } else if ( jQuery.nodeName( this, "select" ) ) {
  1143. var values = jQuery.makeArray(val);
  1144. jQuery( "option", this ).each(function() {
  1145. this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
  1146. });
  1147. if ( !values.length ) {
  1148. this.selectedIndex = -1;
  1149. }
  1150. } else {
  1151. this.value = val;
  1152. }
  1153. });
  1154. }
  1155. });
  1156. jQuery.extend({
  1157. attrFn: {
  1158. val: true,
  1159. css: true,
  1160. html: true,
  1161. text: true,
  1162. data: true,
  1163. width: true,
  1164. height: true,
  1165. offset: true
  1166. },
  1167. attr: function( elem, name, value, pass ) {
  1168. // don't set attributes on text and comment nodes
  1169. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1170. return undefined;
  1171. }
  1172. if ( pass && name in jQuery.attrFn ) {
  1173. return jQuery(elem)[name](value);
  1174. }
  1175. var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
  1176. // Whether we are setting (or getting)
  1177. set = value !== undefined;
  1178. // Try to normalize/fix the name
  1179. name = notxml && jQuery.props[ name ] || name;
  1180. // Only do all the following if this is a node (faster for style)
  1181. if ( elem.nodeType === 1 ) {
  1182. // These attributes require special treatment
  1183. var special = rspecialurl.test( name );
  1184. // Safari mis-reports the default selected property of an option
  1185. // Accessing the parent's selectedIndex property fixes it
  1186. if ( name === "selected" && !jQuery.support.optSelected ) {
  1187. var parent = elem.parentNode;
  1188. if ( parent ) {
  1189. parent.selectedIndex;
  1190. // Make sure that it also works with optgroups, see #5701
  1191. if ( parent.parentNode ) {
  1192. parent.parentNode.selectedIndex;
  1193. }
  1194. }
  1195. }
  1196. // If applicable, access the attribute via the DOM 0 way
  1197. if ( name in elem && notxml && !special ) {
  1198. if ( set ) {
  1199. // We can't allow the type property to be changed (since it causes problems in IE)
  1200. if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
  1201. jQuery.error( "type property can't be changed" );
  1202. }
  1203. elem[ name ] = value;
  1204. }
  1205. // browsers index elements by id/name on forms, give priority to attributes.
  1206. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
  1207. return elem.getAttributeNode( name ).nodeValue;
  1208. }
  1209. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1210. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1211. if ( name === "tabIndex" ) {
  1212. var attributeNode = elem.getAttributeNode( "tabIndex" );
  1213. return attributeNode && attributeNode.specified ?
  1214. attributeNode.value :
  1215. rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
  1216. 0 :
  1217. undefined;
  1218. }
  1219. return elem[ name ];
  1220. }
  1221. if ( !jQuery.support.style && notxml && name === "style" ) {
  1222. if ( set ) {
  1223. elem.style.cssText = "" + value;
  1224. }
  1225. return elem.style.cssText;
  1226. }
  1227. if ( set ) {
  1228. // convert the value to a string (all browsers do this but IE) see #1070
  1229. elem.setAttribute( name, "" + value );
  1230. }
  1231. var attr = !jQuery.support.hrefNormalized && notxml && special ?
  1232. // Some attributes require a special call on IE
  1233. elem.getAttribute( name, 2 ) :
  1234. elem.getAttribute( name );
  1235. // Non-existent attributes return null, we normalize to undefined
  1236. return attr === null ? undefined : attr;
  1237. }
  1238. // elem is actually elem.style ... set the style
  1239. // Using attr for specific style information is now deprecated. Use style insead.
  1240. return jQuery.style( elem, name, value );
  1241. }
  1242. });
  1243. var fcleanup = function( nm ) {
  1244. return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
  1245. return "\\" + ch;
  1246. });
  1247. };
  1248. /*
  1249. * A number of helper functions used for managing events.
  1250. * Many of the ideas behind this code originated from
  1251. * Dean Edwards' addEvent library.
  1252. */
  1253. jQuery.event = {
  1254. // Bind an event to an element
  1255. // Original by Dean Edwards
  1256. add: function( elem, types, handler, data ) {
  1257. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1258. return;
  1259. }
  1260. // For whatever reason, IE has trouble passing the window object
  1261. // around, causing it to be cloned in the process
  1262. if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
  1263. elem = window;
  1264. }
  1265. // Make sure that the function being executed has a unique ID
  1266. if ( !handler.guid ) {
  1267. handler.guid = jQuery.guid++;
  1268. }
  1269. // if data is passed, bind to handler
  1270. if ( data !== undefined ) {
  1271. // Create temporary function pointer to original handler
  1272. var fn = handler;
  1273. // Create unique handler function, wrapped around original handler
  1274. handler = jQuery.proxy( fn );
  1275. // Store data in unique handler
  1276. handler.data = data;
  1277. }
  1278. // Init the element's event structure
  1279. var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ),
  1280. handle = jQuery.data( elem, "handle" ), eventHandle;
  1281. if ( !handle ) {
  1282. eventHandle = function() {
  1283. // Handle the second event of a trigger and when
  1284. // an event is called after a page has unloaded
  1285. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  1286. jQuery.event.handle.apply( eventHandle.elem, arguments ) :
  1287. undefined;
  1288. };
  1289. handle = jQuery.data( elem, "handle", eventHandle );
  1290. }
  1291. // If no handle is found then we must be trying to bind to one of the
  1292. // banned noData elements
  1293. if ( !handle ) {
  1294. return;
  1295. }
  1296. // Add elem as a property of the handle function
  1297. // This is to prevent a memory leak with non-native
  1298. // event in IE.
  1299. handle.elem = elem;
  1300. // Handle multiple events separated by a space
  1301. // jQuery(...).bind("mouseover mouseout", fn);
  1302. types = types.split( /\s+/ );
  1303. var type, i = 0;
  1304. while ( (type = types[ i++ ]) ) {
  1305. // Namespaced event handlers
  1306. var namespaces = type.split(".");
  1307. type = namespaces.shift();
  1308. if ( i > 1 ) {
  1309. handler = jQuery.proxy( handler );
  1310. if ( data !== undefined ) {
  1311. handler.data = data;
  1312. }
  1313. }
  1314. handler.type = namespaces.slice(0).sort().join(".");
  1315. // Get the current list of functions bound to this event
  1316. var handlers = events[ type ],
  1317. special = this.special[ type ] || {};
  1318. // Init the event handler queue
  1319. if ( !handlers ) {
  1320. handlers = events[ type ] = {};
  1321. // Check for a special event handler
  1322. // Only use addEventListener/attachEvent if the special
  1323. // events handler returns false
  1324. if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) {
  1325. // Bind the global event handler to the element
  1326. if ( elem.addEventListener ) {
  1327. elem.addEventListener( type, handle, false );
  1328. } else if ( elem.attachEvent ) {
  1329. elem.attachEvent( "on" + type, handle );
  1330. }
  1331. }
  1332. }
  1333. if ( special.add ) {
  1334. var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers );
  1335. if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) {
  1336. modifiedHandler.guid = modifiedHandler.guid || handler.guid;
  1337. modifiedHandler.data = modifiedHandler.data || handler.data;
  1338. modifiedHandler.type = modifiedHandler.type || handler.type;
  1339. handler = modifiedHandler;
  1340. }
  1341. }
  1342. // Add the function to the element's handler list
  1343. handlers[ handler.guid ] = handler;
  1344. // Keep track of which events have been used, for global triggering
  1345. this.global[ type ] = true;
  1346. }
  1347. // Nullify elem to prevent memory leaks in IE
  1348. elem = null;
  1349. },
  1350. global: {},
  1351. // Detach an event or set of events from an element
  1352. remove: function( elem, types, handler ) {
  1353. // don't do events on text and comment nodes
  1354. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1355. return;
  1356. }
  1357. var events = jQuery.data( elem, "events" ), ret, type, fn;
  1358. if ( events ) {
  1359. // Unbind all events for the element
  1360. if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) {
  1361. for ( type in events ) {
  1362. this.remove( elem, type + (types || "") );
  1363. }
  1364. } else {
  1365. // types is actually an event object here
  1366. if ( types.type ) {
  1367. handler = types.handler;
  1368. types = types.type;
  1369. }
  1370. // Handle multiple events separated by a space
  1371. // jQuery(...).unbind("mouseover mouseout", fn);
  1372. types = types.split(/\s+/);
  1373. var i = 0;
  1374. while ( (type = types[ i++ ]) ) {
  1375. // Namespaced event handlers
  1376. var namespaces = type.split(".");
  1377. type = namespaces.shift();
  1378. var all = !namespaces.length,
  1379. cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ),
  1380. namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"),
  1381. special = this.special[ type ] || {};
  1382. if ( events[ type ] ) {
  1383. // remove the given handler for the given type
  1384. if ( handler ) {
  1385. fn = events[ type ][ handler.guid ];
  1386. delete events[ type ][ handler.guid ];
  1387. // remove all handlers for the given type
  1388. } else {
  1389. for ( var handle in events[ type ] ) {
  1390. // Handle the removal of namespaced events
  1391. if ( all || namespace.test( events[ type ][ handle ].type ) ) {
  1392. delete events[ type ][ handle ];
  1393. }
  1394. }
  1395. }
  1396. if ( special.remove ) {
  1397. special.remove.call( elem, namespaces, fn);
  1398. }
  1399. // remove generic event handler if no more handlers exist
  1400. for ( ret in events[ type ] ) {
  1401. break;
  1402. }
  1403. if ( !ret ) {
  1404. if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
  1405. if ( elem.removeEventListener ) {
  1406. elem.removeEventListener( type, jQuery.data( elem, "handle" ), false );
  1407. } else if ( elem.detachEvent ) {
  1408. elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) );
  1409. }
  1410. }
  1411. ret = null;
  1412. delete events[ type ];
  1413. }
  1414. }
  1415. }
  1416. }
  1417. // Remove the expando if it's no longer used
  1418. for ( ret in events ) {
  1419. break;
  1420. }
  1421. if ( !ret ) {
  1422. var handle = jQuery.data( elem, "handle" );
  1423. if ( handle ) {
  1424. handle.elem = null;
  1425. }
  1426. jQuery.removeData( elem, "events" );
  1427. jQuery.removeData( elem, "handle" );
  1428. }
  1429. }
  1430. },
  1431. // bubbling is internal
  1432. trigger: function( event, data, elem /*, bubbling */ ) {
  1433. // Event object or event type
  1434. var type = event.type || event,
  1435. bubbling = arguments[3];
  1436. if ( !bubbling ) {
  1437. event = typeof event === "object" ?
  1438. // jQuery.Event object
  1439. event[expando] ? event :
  1440. // Object literal
  1441. jQuery.extend( jQuery.Event(type), event ) :
  1442. // Just the event type (string)
  1443. jQuery.Event(type);
  1444. if ( type.indexOf("!") >= 0 ) {
  1445. event.type = type = type.slice(0, -1);
  1446. event.exclusive = true;
  1447. }
  1448. // Handle a global trigger
  1449. if ( !elem ) {
  1450. // Don't bubble custom events when global (to avoid too much overhead)
  1451. event.stopPropagation();
  1452. // Only trigger if we've ever bound an event for it
  1453. if ( this.global[ type ] ) {
  1454. jQuery.each( jQuery.cache, function() {
  1455. if ( this.events && this.events[type] ) {
  1456. jQuery.event.trigger( event, data, this.handle.elem );
  1457. }
  1458. });
  1459. }
  1460. }
  1461. // Handle triggering a single element
  1462. // don't do events on text and comment nodes
  1463. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1464. return undefined;
  1465. }
  1466. // Clean up in case it is reused
  1467. event.result = undefined;
  1468. event.target = elem;
  1469. // Clone the incoming data, if any
  1470. data = jQuery.makeArray( data );
  1471. data.unshift( event );
  1472. }
  1473. event.currentTarget = elem;
  1474. // Trigger the event, it is assumed that "handle" is a function
  1475. var handle = jQuery.data( elem, "handle" );
  1476. if ( h…

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