PageRenderTime 102ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 1ms

/BlogEngine/BlogEngine.NET/Scripts/jquery-1.4.3-vsdoc.js

#
JavaScript | 8295 lines | 5904 code | 836 blank | 1555 comment | 880 complexity | b8df9c192618743de17330869a6cc6a0 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. /*
  2. * This file has been commented to support Visual Studio Intellisense.
  3. * You should not use this file at runtime inside the browser--it is only
  4. * intended to be used only for design-time IntelliSense. Please use the
  5. * standard jQuery library for all production use.
  6. *
  7. * Comment version: 1.4.3a
  8. */
  9. /*!
  10. * jQuery JavaScript Library v1.4.3
  11. * http://jquery.com/
  12. *
  13. * Copyright 2010, John Resig
  14. * Dual licensed under the MIT or GPL Version 2 licenses.
  15. * http://jquery.org/license
  16. *
  17. * Includes Sizzle.js
  18. * http://sizzlejs.com/
  19. * Copyright 2010, The Dojo Foundation
  20. * Released under the MIT, BSD, and GPL Licenses.
  21. *
  22. * Date: Thu Oct 14 23:10:06 2010 -0400
  23. */
  24. (function( window, undefined ) {
  25. // Use the correct document accordingly with window argument (sandbox)
  26. var document = window.document;
  27. var jQuery = (function() {
  28. // Define a local copy of jQuery
  29. var jQuery = function( selector, context ) {
  30. /// <summary>
  31. /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements.
  32. /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML.
  33. /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s).
  34. /// 4: $(callback) - A shorthand for $(document).ready().
  35. /// 5: $() - As of jQuery 1.4, if you pass no arguments in to the jQuery() method, an empty jQuery set will be returned.
  36. /// API: <see href="http://api.jquery.com/jQuery/">jQuery()</see>
  37. /// Categories: <see href="http://api.jquery.com/category/core/">Core</see>
  38. /// </summary>
  39. /// <param name="selector" type="String">
  40. /// 1: expression - An expression to search with.
  41. /// 2: html - A string of HTML to create on the fly.
  42. /// 3: elements - DOM element(s) to be encapsulated by a jQuery object.
  43. /// 4: callback - The function to execute when the DOM is ready.
  44. /// </param>
  45. /// <param name="context" type="jQuery">
  46. /// 1: context - A DOM Element, Document or jQuery to use as context.
  47. /// </param>
  48. /// <returns type="jQuery" />
  49. // The jQuery object is actually just the init constructor 'enhanced'
  50. return new jQuery.fn.init( selector, context );
  51. },
  52. // Map over jQuery in case of overwrite
  53. _jQuery = window.jQuery,
  54. // Map over the $ in case of overwrite
  55. _$ = window.$,
  56. // A central reference to the root jQuery(document)
  57. rootjQuery,
  58. // A simple way to check for HTML strings or ID strings
  59. // (both of which we optimize for)
  60. quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
  61. // Is it a simple selector
  62. isSimple = /^.[^:#\[\.,]*$/,
  63. // Check if a string has a non-whitespace character in it
  64. rnotwhite = /\S/,
  65. rwhite = /\s/,
  66. // Used for trimming whitespace
  67. trimLeft = /^\s+/,
  68. trimRight = /\s+$/,
  69. // Check for non-word characters
  70. rnonword = /\W/,
  71. // Check for digits
  72. rdigit = /\d/,
  73. // Match a standalone tag
  74. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  75. // JSON RegExp
  76. rvalidchars = /^[\],:{}\s]*$/,
  77. rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  78. rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  79. rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  80. // Useragent RegExp
  81. rwebkit = /(webkit)[ \/]([\w.]+)/,
  82. ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  83. rmsie = /(msie) ([\w.]+)/,
  84. rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
  85. // Keep a UserAgent string for use with jQuery.browser
  86. userAgent = navigator.userAgent,
  87. // For matching the engine and version of the browser
  88. browserMatch,
  89. // Has the ready events already been bound?
  90. readyBound = false,
  91. // The functions to execute on DOM ready
  92. readyList = [],
  93. // The ready event handler
  94. DOMContentLoaded,
  95. // Save a reference to some core methods
  96. toString = Object.prototype.toString,
  97. hasOwn = Object.prototype.hasOwnProperty,
  98. push = Array.prototype.push,
  99. slice = Array.prototype.slice,
  100. trim = String.prototype.trim,
  101. indexOf = Array.prototype.indexOf,
  102. // [[Class]] -> type pairs
  103. class2type = {};
  104. jQuery.fn = jQuery.prototype = {
  105. init: function( selector, context ) {
  106. var match, elem, ret, doc;
  107. // Handle $(""), $(null), or $(undefined)
  108. if ( !selector ) {
  109. return this;
  110. }
  111. // Handle $(DOMElement)
  112. if ( selector.nodeType ) {
  113. this.context = this[0] = selector;
  114. this.length = 1;
  115. return this;
  116. }
  117. // The body element only exists once, optimize finding it
  118. if ( selector === "body" && !context && document.body ) {
  119. this.context = document;
  120. this[0] = document.body;
  121. this.selector = "body";
  122. this.length = 1;
  123. return this;
  124. }
  125. // Handle HTML strings
  126. if ( typeof selector === "string" ) {
  127. // Are we dealing with HTML string or an ID?
  128. match = quickExpr.exec( selector );
  129. // Verify a match, and that no context was specified for #id
  130. if ( match && (match[1] || !context) ) {
  131. // HANDLE: $(html) -> $(array)
  132. if ( match[1] ) {
  133. doc = (context ? context.ownerDocument || context : document);
  134. // If a single string is passed in and it's a single tag
  135. // just do a createElement and skip the rest
  136. ret = rsingleTag.exec( selector );
  137. if ( ret ) {
  138. if ( jQuery.isPlainObject( context ) ) {
  139. selector = [ document.createElement( ret[1] ) ];
  140. jQuery.fn.attr.call( selector, context, true );
  141. } else {
  142. selector = [ doc.createElement( ret[1] ) ];
  143. }
  144. } else {
  145. ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
  146. selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
  147. }
  148. return jQuery.merge( this, selector );
  149. // HANDLE: $("#id")
  150. } else {
  151. elem = document.getElementById( match[2] );
  152. // Check parentNode to catch when Blackberry 4.6 returns
  153. // nodes that are no longer in the document #6963
  154. if ( elem && elem.parentNode ) {
  155. // Handle the case where IE and Opera return items
  156. // by name instead of ID
  157. if ( elem.id !== match[2] ) {
  158. return rootjQuery.find( selector );
  159. }
  160. // Otherwise, we inject the element directly into the jQuery object
  161. this.length = 1;
  162. this[0] = elem;
  163. }
  164. this.context = document;
  165. this.selector = selector;
  166. return this;
  167. }
  168. // HANDLE: $("TAG")
  169. } else if ( !context && !rnonword.test( selector ) ) {
  170. this.selector = selector;
  171. this.context = document;
  172. selector = document.getElementsByTagName( selector );
  173. return jQuery.merge( this, selector );
  174. // HANDLE: $(expr, $(...))
  175. } else if ( !context || context.jquery ) {
  176. return (context || rootjQuery).find( selector );
  177. // HANDLE: $(expr, context)
  178. // (which is just equivalent to: $(context).find(expr)
  179. } else {
  180. return jQuery( context ).find( selector );
  181. }
  182. // HANDLE: $(function)
  183. // Shortcut for document ready
  184. } else if ( jQuery.isFunction( selector ) ) {
  185. return rootjQuery.ready( selector );
  186. }
  187. if (selector.selector !== undefined) {
  188. this.selector = selector.selector;
  189. this.context = selector.context;
  190. }
  191. return jQuery.makeArray( selector, this );
  192. },
  193. // Start with an empty selector
  194. selector: "",
  195. // The current version of jQuery being used
  196. jquery: "1.4.3",
  197. // The default length of a jQuery object is 0
  198. length: 0,
  199. // The number of elements contained in the matched element set
  200. size: function() {
  201. /// <summary>
  202. /// The number of elements currently matched.
  203. /// API: <see href="http://api.jquery.com/size/">.size()</see>
  204. /// Categories: <see href="http://api.jquery.com/category/miscellaneous/">Miscellaneous</see> > <see href="http://api.jquery.com/category/miscellaneous/dom-element-methods/">DOM Element Methods</see>
  205. /// </summary>
  206. /// <returns type="Number" />
  207. return this.length;
  208. },
  209. toArray: function() {
  210. /// <summary>
  211. /// Retrieve all the DOM elements contained in the jQuery set, as an array.
  212. /// API: <see href="http://api.jquery.com/toArray/">.toArray()</see>
  213. /// Categories: <see href="http://api.jquery.com/category/miscellaneous/">Miscellaneous</see> > <see href="http://api.jquery.com/category/miscellaneous/dom-element-methods/">DOM Element Methods</see>
  214. /// </summary>
  215. /// <returns type="Array" />
  216. return slice.call( this, 0 );
  217. },
  218. // Get the Nth element in the matched element set OR
  219. // Get the whole matched element set as a clean array
  220. get: function( num ) {
  221. /// <summary>
  222. /// Access a single matched element. num is used to access the
  223. /// Nth element matched.
  224. /// API: <see href="http://api.jquery.com/get/">.get()</see>
  225. /// Categories: <see href="http://api.jquery.com/category/miscellaneous/">Miscellaneous</see> > <see href="http://api.jquery.com/category/miscellaneous/dom-element-methods/">DOM Element Methods</see>
  226. /// </summary>
  227. /// <returns type="Element" />
  228. /// <param name="num" type="Number">
  229. /// Access the element in the Nth position.
  230. /// </param>
  231. return num == null ?
  232. // Return a 'clean' array
  233. this.toArray() :
  234. // Return just the object
  235. ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
  236. },
  237. // Take an array of elements and push it onto the stack
  238. // (returning the new matched element set)
  239. pushStack: function( elems, name, selector ) {
  240. /// <summary>
  241. /// Set the jQuery object to an array of elements, while maintaining the stack.
  242. /// API: <see href="http://api.jquery.com/pushStack/">.pushStack()</see>
  243. /// Categories: <see href="http://api.jquery.com/category/plugin-authoring/">Plugin Authoring</see>
  244. /// </summary>
  245. /// <returns type="jQuery" />
  246. /// <param name="elems" type="Elements">
  247. /// An array of elements
  248. /// </param>
  249. // Build a new jQuery matched element set
  250. var ret = jQuery();
  251. if ( jQuery.isArray( elems ) ) {
  252. push.apply( ret, elems );
  253. } else {
  254. jQuery.merge( ret, elems );
  255. }
  256. // Add the old object onto the stack (as a reference)
  257. ret.prevObject = this;
  258. ret.context = this.context;
  259. if ( name === "find" ) {
  260. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  261. } else if ( name ) {
  262. ret.selector = this.selector + "." + name + "(" + selector + ")";
  263. }
  264. // Return the newly-formed element set
  265. return ret;
  266. },
  267. // Execute a callback for every element in the matched set.
  268. // (You can seed the arguments with an array of args, but this is
  269. // only used internally.)
  270. each: function( callback, args ) {
  271. /// <summary>
  272. /// Execute a function within the context of every matched element.
  273. /// This means that every time the passed-in function is executed
  274. /// (which is once for every element matched) the 'this' keyword
  275. /// points to the specific element.
  276. /// Additionally, the function, when executed, is passed a single
  277. /// argument representing the position of the element in the matched
  278. /// set.
  279. /// API: <see href="http://api.jquery.com/each/">.each()</see>
  280. /// Categories: <see href="http://api.jquery.com/category/core/">Core</see>
  281. /// </summary>
  282. /// <returns type="jQuery" />
  283. /// <param name="callback" type="Function">
  284. /// A function to execute
  285. /// </param>
  286. return jQuery.each( this, callback, args );
  287. },
  288. ready: function( fn ) {
  289. /// <summary>
  290. /// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.
  291. /// API: <see href="http://api.jquery.com/ready/">.ready()</see>
  292. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see> > <see href="http://api.jquery.com/category/document-loading/">Document Loading</see>
  293. /// </summary>
  294. /// <param name="fn" type="Function">
  295. /// The function to be executed when the DOM is ready.
  296. /// </param>
  297. // Attach the listeners
  298. jQuery.bindReady();
  299. // If the DOM is already ready
  300. if ( jQuery.isReady ) {
  301. // Execute the function immediately
  302. fn.call( document, jQuery );
  303. // Otherwise, remember the function for later
  304. } else if ( readyList ) {
  305. // Add the function to the wait list
  306. readyList.push( fn );
  307. }
  308. return this;
  309. },
  310. eq: function( i ) {
  311. /// <summary>
  312. /// Reduce the set of matched elements to a single element.
  313. /// The position of the element in the set of matched elements
  314. /// starts at 0 and goes to length - 1.
  315. /// API: <see href="http://api.jquery.com/filter/">.filter()</see>
  316. /// Categories: <see href="http://api.jquery.com/category/filtering/">Filtering</see>
  317. /// </summary>
  318. /// <returns type="jQuery" />
  319. /// <param name="index" type="Number">
  320. /// An integer indicating the 0-based position of the element.
  321. /// If the index is a negative value, the index indicates the
  322. /// position of the element, counting backwards from the last element in the set.
  323. /// </param>
  324. return i === -1 ?
  325. this.slice( i ) :
  326. this.slice( i, +i + 1 );
  327. },
  328. first: function() {
  329. /// <summary>
  330. /// Reduce the set of matched elements to the first in the set.
  331. /// API: <see href="http://api.jquery.com/first/">.first()</see>
  332. /// Categories: <see href="http://api.jquery.com/category/filtering/">Filtering</see>
  333. /// </summary>
  334. /// <returns type="jQuery" />
  335. return this.eq( 0 );
  336. },
  337. last: function() {
  338. /// <summary>
  339. /// Reduce the set of matched elements to the final one in the set.
  340. /// API: <see href="http://api.jquery.com/last/">.last()</see>
  341. /// Categories: <see href="http://api.jquery.com/category/filtering/">Filtering</see>
  342. /// </summary>
  343. /// <returns type="jQuery" />
  344. return this.eq( -1 );
  345. },
  346. slice: function() {
  347. /// <summary>
  348. /// Reduce the set of matched elements to a subset specified by a range of indices.
  349. /// Behaves exactly like the built-in Array slice method.
  350. /// API: <see href="http://api.jquery.com/slice/">.slice()</see>
  351. /// Categories: <see href="http://api.jquery.com/category/filtering/">Filtering</see>
  352. /// </summary>
  353. /// <param name="start" type="Number" integer="true">
  354. /// An integer indicating the 0-based position at which the elements begin to be
  355. /// selected. If negative, it indicates an offset from the end of the set.
  356. /// </param>
  357. /// <param name="end" optional="true" type="Number" integer="true">
  358. /// An integer indicating the 0-based position at which the elements stop being
  359. /// selected. If negative, it indicates an offset from the end of the set.
  360. /// If omitted, the range continues until the end of the set.
  361. /// </param>
  362. /// <returns type="jQuery">The sliced elements</returns>
  363. return this.pushStack( slice.apply( this, arguments ),
  364. "slice", slice.call(arguments).join(",") );
  365. },
  366. map: function( callback ) {
  367. /// <summary>
  368. /// This member is internal.
  369. /// </summary>
  370. /// <private />
  371. /// <returns type="jQuery" />
  372. return this.pushStack( jQuery.map(this, function( elem, i ) {
  373. return callback.call( elem, i, elem );
  374. }));
  375. },
  376. end: function() {
  377. /// <summary>
  378. /// End the most recent 'destructive' filtering operation, reverting the list of matched elements
  379. /// back to its previous state. After an end operation, the list of matched elements will
  380. /// revert to the last state of matched elements.
  381. /// If there was no destructive operation before, an empty set is returned.
  382. /// API: <see href="http://api.jquery.com/end/">.end()</see>
  383. /// Categories: <see href="http://api.jquery.com/category/traversing/traversal/">Traversal/</see> > <see href="http://api.jquery.com/category/traversing/miscellaneous-traversal/">Miscellaneous Traversal/</see>
  384. /// </summary>
  385. /// <returns type="jQuery" />
  386. return this.prevObject || jQuery(null);
  387. },
  388. // For internal use only.
  389. // Behaves like an Array's method, not like a jQuery method.
  390. push: push,
  391. sort: [].sort,
  392. splice: [].splice
  393. };
  394. // Give the init function the jQuery prototype for later instantiation
  395. jQuery.fn.init.prototype = jQuery.fn;
  396. jQuery.extend = jQuery.fn.extend = function() {
  397. /// <summary>
  398. /// Merge the contents of two or more objects together into the first
  399. /// object and returns the original, modified object.
  400. /// API: <see href="http://api.jquery.com/jQuery.extend/">jQuery.extend()</see>
  401. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  402. /// </summary>
  403. /// <remarks>
  404. /// This is a great utility for simple inheritance.
  405. /// jQuery.extend(settings, options);
  406. /// var settings = jQuery.extend({}, defaults, options);
  407. /// </remarks>
  408. /// <param name="target" type="Object">
  409. /// The object to extend
  410. /// </param>
  411. /// <param name="prop1" type="Object">
  412. /// The object that will be merged into the first.
  413. /// </param>
  414. /// <param name="propN" type="Object" optional="true" parameterArray="true">
  415. /// (optional) More objects to merge into the first
  416. /// </param>
  417. /// <returns type="Object" />
  418. // copy reference to target object
  419. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray;
  420. // Handle a deep copy situation
  421. if ( typeof target === "boolean" ) {
  422. deep = target;
  423. target = arguments[1] || {};
  424. // skip the boolean and the target
  425. i = 2;
  426. }
  427. // Handle case when target is a string or something (possible in deep copy)
  428. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  429. target = {};
  430. }
  431. // extend jQuery itself if only one argument is passed
  432. if ( length === i ) {
  433. target = this;
  434. --i;
  435. }
  436. for ( ; i < length; i++ ) {
  437. // Only deal with non-null/undefined values
  438. if ( (options = arguments[ i ]) != null ) {
  439. // Extend the base object
  440. for ( name in options ) {
  441. src = target[ name ];
  442. copy = options[ name ];
  443. // Prevent never-ending loop
  444. if ( target === copy ) {
  445. continue;
  446. }
  447. // Recurse if we're merging plain objects or arrays
  448. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  449. if ( copyIsArray ) {
  450. copyIsArray = false;
  451. clone = src && jQuery.isArray(src) ? src : [];
  452. } else {
  453. clone = src && jQuery.isPlainObject(src) ? src : {};
  454. }
  455. // Never move original objects, clone them
  456. target[ name ] = jQuery.extend( deep, clone, copy );
  457. // Don't bring in undefined values
  458. } else if ( copy !== undefined ) {
  459. target[ name ] = copy;
  460. }
  461. }
  462. }
  463. }
  464. // Return the modified object
  465. return target;
  466. };
  467. jQuery.extend({
  468. noConflict: function( deep ) {
  469. /// <summary>
  470. /// Relinquish jQuery's control of the $ variable.
  471. /// Run this function to give control of the $ variable back
  472. /// to whichever library first implemented it.
  473. /// API: <see href="http://api.jquery.com/jQuery.noConflict/">jQuery.noConflict()</see>
  474. /// Categories: <see href="http://api.jquery.com/category/core/">Core</see>
  475. /// </summary>
  476. /// <remarks>
  477. /// This helps to make sure that jQuery doesn't conflict with the $ object
  478. /// of other libraries.
  479. /// By using this function, you will only be able to access jQuery
  480. /// using the 'jQuery' variable. For example, where you used to do
  481. /// $(&quot;div p&quot;), you now must do jQuery(&quot;div p&quot;).
  482. /// </remarks>
  483. /// <param name="removeAll" type="Boolean" optional="true">
  484. /// (optional) A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
  485. /// </param>
  486. /// <returns type="Object" />
  487. window.$ = _$;
  488. if ( deep ) {
  489. window.jQuery = _jQuery;
  490. }
  491. return jQuery;
  492. },
  493. // Is the DOM ready to be used? Set to true once it occurs.
  494. isReady: false,
  495. // A counter to track how many items to wait for before
  496. // the ready event fires. See #6781
  497. readyWait: 1,
  498. // Handle when the DOM is ready
  499. ready: function( wait ) {
  500. /// <summary>
  501. /// This method is internal.
  502. /// </summary>
  503. /// <private />
  504. // A third-party is pushing the ready event forwards
  505. if ( wait === true ) {
  506. jQuery.readyWait--;
  507. }
  508. // Make sure that the DOM is not already loaded
  509. if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
  510. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  511. if ( !document.body ) {
  512. return setTimeout( jQuery.ready, 1 );
  513. }
  514. // Remember that the DOM is ready
  515. jQuery.isReady = true;
  516. // If a normal DOM Ready event fired, decrement, and wait if need be
  517. if ( wait !== true && --jQuery.readyWait > 0 ) {
  518. return;
  519. }
  520. // If there are functions bound, to execute
  521. if ( readyList ) {
  522. // Execute all of them
  523. var fn, i = 0;
  524. while ( (fn = readyList[ i++ ]) ) {
  525. fn.call( document, jQuery );
  526. }
  527. // Reset the list of functions
  528. readyList = null;
  529. }
  530. // Trigger any bound ready events
  531. if ( jQuery.fn.triggerHandler ) {
  532. jQuery( document ).triggerHandler( "ready" );
  533. }
  534. }
  535. },
  536. bindReady: function() {
  537. /// <summary>
  538. /// This method is internal.
  539. /// </summary>
  540. /// <private />
  541. if ( readyBound ) {
  542. return;
  543. }
  544. readyBound = true;
  545. // Catch cases where $(document).ready() is called after the
  546. // browser event has already occurred.
  547. if ( document.readyState === "complete" ) {
  548. // Handle it asynchronously to allow scripts the opportunity to delay ready
  549. return setTimeout( jQuery.ready, 1 );
  550. }
  551. // Mozilla, Opera and webkit nightlies currently support this event
  552. if ( document.addEventListener ) {
  553. // Use the handy event callback
  554. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  555. // A fallback to window.onload, that will always work
  556. window.addEventListener( "load", jQuery.ready, false );
  557. // If IE event model is used
  558. } else if ( document.attachEvent ) {
  559. // ensure firing before onload,
  560. // maybe late but safe also for iframes
  561. document.attachEvent("onreadystatechange", DOMContentLoaded);
  562. // A fallback to window.onload, that will always work
  563. window.attachEvent( "onload", jQuery.ready );
  564. // If IE and not a frame
  565. // continually check to see if the document is ready
  566. var toplevel = false;
  567. try {
  568. toplevel = window.frameElement == null;
  569. } catch(e) {}
  570. if ( document.documentElement.doScroll && toplevel ) {
  571. doScrollCheck();
  572. }
  573. }
  574. },
  575. // See test/unit/core.js for details concerning isFunction.
  576. // Since version 1.3, DOM methods and functions like alert
  577. // aren't supported. They return false on IE (#2968).
  578. isFunction: function( obj ) {
  579. /// <summary>
  580. /// Determine if the argument passed is a Javascript function object.
  581. /// API: <see href="http://api.jquery.com/jQuery.isFunction/">jQuery.isFunction()</see>
  582. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  583. /// </summary>
  584. /// <param name="obj" type="Object">
  585. /// Object to test whether or not it is a function.
  586. /// </param>
  587. /// <returns type="Boolean">
  588. /// True if the parameter is a function; otherwise false.
  589. /// </returns>
  590. return jQuery.type(obj) === "function";
  591. },
  592. isArray: Array.isArray || function( obj ) {
  593. /// <summary>
  594. /// Determine if the argument is an array.
  595. /// API: <see href="http://api.jquery.com/jQuery.isArray/">jQuery.isArray()</see>
  596. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  597. /// </summary>
  598. /// <param name="obj" type="Object">
  599. /// Object to test whether or not it is an array.
  600. /// </param>
  601. /// <returns type="Boolean">
  602. /// True if the parameter is an array; otherwise false.
  603. /// </returns>
  604. return jQuery.type(obj) === "array";
  605. },
  606. // A crude way of determining if an object is a window
  607. isWindow: function( obj ) {
  608. /// <summary>
  609. /// Determine whether the argument is a window.
  610. /// API: <see href="http://api.jquery.com/jQuery.isWindow/">jQuery.isWindow()</see>
  611. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  612. /// </summary>
  613. /// <param name="obj" type="Object">
  614. /// Object to test whether or not it is a window.
  615. /// </param>
  616. /// <returns type="Boolean">
  617. /// True if the parameter is a window; otherwise false.
  618. /// </returns>
  619. return obj && typeof obj === "object" && "setInterval" in obj;
  620. },
  621. isNaN: function( obj ) {
  622. /// <summary>
  623. /// Determine whether the argument is a number.
  624. /// API: <see href="http://api.jquery.com/jQuery.isNaN/">jQuery.isNaN()</see>
  625. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  626. /// </summary>
  627. /// <param name="obj" type="Object">
  628. /// Object to test whether or not it is a number.
  629. /// </param>
  630. /// <returns type="Boolean">
  631. /// True if the parameter is a number; otherwise false.
  632. /// </returns>
  633. return obj == null || !rdigit.test( obj ) || isNaN( obj );
  634. },
  635. type: function( obj ) {
  636. /// <summary>
  637. /// Determine whether the argument is a number.
  638. /// API: <see href="http://api.jquery.com/jQuery.type/">jQuery.type()</see>
  639. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  640. /// </summary>
  641. /// <param name="obj" type="Object">
  642. /// Object to get the internal JavaScript [[Class]] of.
  643. /// </param>
  644. /// <returns type="String">
  645. /// True if the parameter is a number; otherwise false.
  646. /// </returns>
  647. return obj == null ?
  648. String( obj ) :
  649. class2type[ toString.call(obj) ] || "object";
  650. },
  651. isPlainObject: function( obj ) {
  652. /// <summary>
  653. /// Check to see if an object is a plain object (created using "{}" or "new Object").
  654. /// API: <see href="http://api.jquery.com/jQuery.isPlainObject/">jQuery.isPlainObject()</see>
  655. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  656. /// </summary>
  657. /// <param name="obj" type="Object">
  658. /// The object that will be checked to see if it's a plain object.
  659. /// </param>
  660. /// <returns type="Boolean" />
  661. // Must be an Object.
  662. // Because of IE, we also have to check the presence of the constructor property.
  663. // Make sure that DOM nodes and window objects don't pass through, as well
  664. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  665. return false;
  666. }
  667. // Not own constructor property must be Object
  668. if ( obj.constructor &&
  669. !hasOwn.call(obj, "constructor") &&
  670. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  671. return false;
  672. }
  673. // Own properties are enumerated firstly, so to speed up,
  674. // if last one is own, then all properties are own.
  675. var key;
  676. for ( key in obj ) {}
  677. return key === undefined || hasOwn.call( obj, key );
  678. },
  679. isEmptyObject: function( obj ) {
  680. /// <summary>
  681. /// Check to see if an object is empty (contains no properties).
  682. /// API: <see href="http://api.jquery.com/jQuery.isEmptyObject/">jQuery.isEmptyObject()</see>
  683. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  684. /// </summary>
  685. /// <param name="obj" type="Object">
  686. /// The object that will be checked to see if it's empty.
  687. /// </param>
  688. /// <returns type="Boolean" />
  689. for ( var name in obj ) {
  690. return false;
  691. }
  692. return true;
  693. },
  694. error: function( msg ) {
  695. throw msg;
  696. },
  697. parseJSON: function( data ) {
  698. /// <summary>
  699. /// Takes a well-formed JSON string and returns the resulting JavaScript object.
  700. /// API: <see href="http://api.jquery.com/jQuery.parseJSON/">jQuery.parseJSON()</see>
  701. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  702. /// </summary>
  703. /// <param name="obj" type="Object">
  704. /// The object that will be checked to see if it's empty.
  705. /// </param>
  706. /// <returns type="Object" />
  707. if ( typeof data !== "string" || !data ) {
  708. return null;
  709. }
  710. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  711. data = jQuery.trim( data );
  712. // Make sure the incoming data is actual JSON
  713. // Logic borrowed from http://json.org/json2.js
  714. if ( rvalidchars.test(data.replace(rvalidescape, "@")
  715. .replace(rvalidtokens, "]")
  716. .replace(rvalidbraces, "")) ) {
  717. // Try to use the native JSON parser first
  718. return window.JSON && window.JSON.parse ?
  719. window.JSON.parse( data ) :
  720. (new Function("return " + data))();
  721. } else {
  722. jQuery.error( "Invalid JSON: " + data );
  723. }
  724. },
  725. noop: function() {
  726. /// <summary>
  727. /// An empty function.
  728. /// API: <see href="http://api.jquery.com/jQuery.noop/">jQuery.noop()</see>
  729. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  730. /// </summary>
  731. /// <returns type="Function" />
  732. },
  733. // Evalulates a script in a global context
  734. globalEval: function( data ) {
  735. /// <summary>
  736. /// Execute some JavaScript code globally.
  737. /// API: <see href="http://api.jquery.com/jQuery.globalEval/">jQuery.globalEval()</see>
  738. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  739. /// </summary>
  740. if ( data && rnotwhite.test(data) ) {
  741. // Inspired by code by Andrea Giammarchi
  742. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  743. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  744. script = document.createElement("script");
  745. script.type = "text/javascript";
  746. if ( jQuery.support.scriptEval ) {
  747. script.appendChild( document.createTextNode( data ) );
  748. } else {
  749. script.text = data;
  750. }
  751. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  752. // This arises when a base node is used (#2709).
  753. head.insertBefore( script, head.firstChild );
  754. head.removeChild( script );
  755. }
  756. },
  757. nodeName: function( elem, name ) {
  758. /// <summary>
  759. /// Checks whether the specified element has the specified DOM node name.
  760. /// </summary>
  761. /// <param name="elem" type="Element">
  762. /// The element to examine
  763. /// </param>
  764. /// <param name="name" type="String">
  765. /// The node name to check
  766. /// </param>
  767. /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns>
  768. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  769. },
  770. // args is for internal usage only
  771. each: function( object, callback, args ) {
  772. /// <summary>
  773. /// A generic iterator function, which can be used to seamlessly iterate over both objects and arrays.
  774. /// Arrays and array-like objects with a length property (such as a function's arguments object) are
  775. /// iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
  776. /// the first, and the value as the second.
  777. /// API: <see href="http://api.jquery.com/jQuery.each/">jQuery.each()</see>
  778. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  779. /// </summary>
  780. /// <param name="obj" type="Object">
  781. /// The object, or array, to iterate over.
  782. /// </param>
  783. /// <param name="fn" type="Function">
  784. /// The function that will be executed on every object.
  785. /// </param>
  786. /// <returns type="Object" />
  787. var name, i = 0,
  788. length = object.length,
  789. isObj = length === undefined || jQuery.isFunction(object);
  790. if ( args ) {
  791. if ( isObj ) {
  792. for ( name in object ) {
  793. if ( callback.apply( object[ name ], args ) === false ) {
  794. break;
  795. }
  796. }
  797. } else {
  798. for ( ; i < length; ) {
  799. if ( callback.apply( object[ i++ ], args ) === false ) {
  800. break;
  801. }
  802. }
  803. }
  804. // A special, fast, case for the most common use of each
  805. } else {
  806. if ( isObj ) {
  807. for ( name in object ) {
  808. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  809. break;
  810. }
  811. }
  812. } else {
  813. for ( var value = object[0];
  814. i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
  815. }
  816. }
  817. return object;
  818. },
  819. // Use native String.trim function wherever possible
  820. trim: trim ?
  821. function( text ) {
  822. /// <summary>
  823. /// Remove the whitespace from the beginning and end of a string.
  824. /// API: <see href="http://api.jquery.com/jQuery.trim/">jQuery.trim()</see>
  825. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  826. /// </summary>
  827. /// <returns type="String" />
  828. /// <param name="text" type="String">
  829. /// The string to trim.
  830. /// </param>
  831. return text == null ?
  832. "" :
  833. trim.call( text );
  834. } :
  835. // Otherwise use our own trimming functionality
  836. function( text ) {
  837. return text == null ?
  838. "" :
  839. text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
  840. },
  841. // results is for internal usage only
  842. makeArray: function( array, results ) {
  843. /// <summary>
  844. /// Convert an array-like object into a true JavaScript array.
  845. /// API: <see href="http://api.jquery.com/jQuery.makeArray/">jQuery.makeArray()</see>
  846. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  847. /// </summary>
  848. /// <param name="array" type="Object">
  849. /// Any object to turn into a native Array.
  850. /// </param>
  851. /// <returns type="Array" />
  852. var ret = results || [];
  853. if ( array != null ) {
  854. // The window, strings (and functions) also have 'length'
  855. // The extra typeof function check is to prevent crashes
  856. // in Safari 2 (See: #3039)
  857. // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
  858. var type = jQuery.type(array);
  859. if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
  860. push.call( ret, array );
  861. } else {
  862. jQuery.merge( ret, array );
  863. }
  864. }
  865. return ret;
  866. },
  867. inArray: function( elem, array ) {
  868. /// <summary>
  869. /// Search for a specified value within an array and return its index (or -1 if not found).
  870. /// API: <see href="http://api.jquery.com/jQuery.inArray/">jQuery.inArray()</see>
  871. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  872. /// Part of JavaScript
  873. /// </summary>
  874. /// <param name="value" type="Any">
  875. /// The value to search for.
  876. /// </param>
  877. /// <param name="array" type="Array">
  878. /// An array through which to search.
  879. /// </param>
  880. /// <returns type="Array" />
  881. if ( array.indexOf ) {
  882. return array.indexOf( elem );
  883. }
  884. for ( var i = 0, length = array.length; i < length; i++ ) {
  885. if ( array[ i ] === elem ) {
  886. return i;
  887. }
  888. }
  889. return -1;
  890. },
  891. merge: function( first, second ) {
  892. /// <summary>
  893. /// Merge the contents of two arrays together into the first array.
  894. /// API: <see href="http://api.jquery.com/jQuery.merge/">jQuery.merge()</see>
  895. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  896. /// </summary>
  897. /// <param name="first" type="Array">
  898. /// The first array to merge.
  899. /// </param>
  900. /// <param name="second" type="Array">
  901. /// The second array to merge.
  902. /// </param>
  903. /// <returns type="Array" />
  904. var i = first.length, j = 0;
  905. if ( typeof second.length === "number" ) {
  906. for ( var l = second.length; j < l; j++ ) {
  907. first[ i++ ] = second[ j ];
  908. }
  909. } else {
  910. while ( second[j] !== undefined ) {
  911. first[ i++ ] = second[ j++ ];
  912. }
  913. }
  914. first.length = i;
  915. return first;
  916. },
  917. grep: function( elems, callback, inv ) {
  918. /// <summary>
  919. /// Finds the elements of an array which satisfy a filter function. The original array is not affected.
  920. /// API: <see href="http://api.jquery.com/jQuery.grep/">jQuery.grep()</see>
  921. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  922. /// </summary>
  923. /// <remarks>
  924. /// The specified function will be passed two arguments: The
  925. /// current array item and the index of the item in the array. The
  926. /// function must return 'true' to keep the item in the array,
  927. /// false to remove it.
  928. /// });
  929. /// Part of JavaScript
  930. /// </remarks>
  931. /// <param name="array" type="Array">
  932. /// The array to search through.
  933. /// </param>
  934. /// <param name="function(elementOfArray, indexInArray)" type="Function">
  935. /// The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
  936. /// </param>
  937. /// <param name="inv" type="Boolean">
  938. /// If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
  939. /// </param>
  940. /// <returns type="Array" />
  941. var ret = [], retVal;
  942. inv = !!inv;
  943. // Go through the array, only saving the items
  944. // that pass the validator function
  945. for ( var i = 0, length = elems.length; i < length; i++ ) {
  946. retVal = !!callback( elems[ i ], i );
  947. if ( inv !== retVal ) {
  948. ret.push( elems[ i ] );
  949. }
  950. }
  951. return ret;
  952. },
  953. // arg is for internal usage only
  954. map: function( elems, callback, arg ) {
  955. /// <summary>
  956. /// Translate all items in an array or array-like object to another array of items.
  957. /// API: <see href="http://api.jquery.com/jQuery.map/">jQuery.map()</see>
  958. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  959. /// </summary>
  960. /// <remarks>
  961. /// The translation function that is provided to this method is
  962. /// called for each item in the array and is passed one argument:
  963. /// The item to be translated.
  964. /// The function can then return the translated value, 'null'
  965. /// (to remove the item), or an array of values - which will
  966. /// be flattened into the full array.
  967. /// </remarks>
  968. /// <returns type="Array" />
  969. /// <param name="elems" type="Array">
  970. /// array The Array to translate.
  971. /// </param>
  972. /// <param name="fn" type="Function">
  973. /// The function to process each item against.
  974. /// </param>
  975. var ret = [], value;
  976. // Go through the array, translating each of the items to their
  977. // new value (or values).
  978. for ( var i = 0, length = elems.length; i < length; i++ ) {
  979. value = callback( elems[ i ], i, arg );
  980. if ( value != null ) {
  981. ret[ ret.length ] = value;
  982. }
  983. }
  984. return ret.concat.apply( [], ret );
  985. },
  986. // A global GUID counter for objects
  987. guid: 1,
  988. proxy: function( fn, proxy, thisObject ) {
  989. /// <summary>
  990. /// Takes a function and returns a new one that will always have a particular scope.
  991. /// API: <see href="http://api.jquery.com/jQuery.proxy/">jQuery.proxy()</see>
  992. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  993. /// </summary>
  994. /// <param name="fn" type="Function">
  995. /// The function whose scope will be changed.
  996. /// </param>
  997. /// <param name="proxy" type="Object">
  998. /// The object to which the scope of the function should be set.
  999. /// </param>
  1000. /// <returns type="Function" />
  1001. if ( arguments.length === 2 ) {
  1002. if ( typeof proxy === "string" ) {
  1003. thisObject = fn;
  1004. fn = thisObject[ proxy ];
  1005. proxy = undefined;
  1006. } else if ( proxy && !jQuery.isFunction( proxy ) ) {
  1007. thisObject = proxy;
  1008. proxy = undefined;
  1009. }
  1010. }
  1011. if ( !proxy && fn ) {
  1012. proxy = function() {
  1013. return fn.apply( thisObject || this, arguments );
  1014. };
  1015. }
  1016. // Set the guid of unique handler to the same of original handler, so it can be removed
  1017. if ( fn ) {
  1018. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  1019. }
  1020. // So proxy can be declared as an argument
  1021. return proxy;
  1022. },
  1023. // Mutifunctional method to get and set values to a collection
  1024. // The value/s can be optionally by executed if its a function
  1025. access: function( elems, key, value, exec, fn, pass ) {
  1026. /// <summary>
  1027. /// This member is internal.
  1028. /// </summary>
  1029. /// <private />
  1030. var length = elems.length;
  1031. // Setting many attributes
  1032. if ( typeof key === "object" ) {
  1033. for ( var k in key ) {
  1034. jQuery.access( elems, k, key[k], exec, fn, value );
  1035. }
  1036. return elems;
  1037. }
  1038. // Setting one attribute
  1039. if ( value !== undefined ) {
  1040. // Optionally, function values get executed if exec is true
  1041. exec = !pass && exec && jQuery.isFunction(value);
  1042. for ( var i = 0; i < length; i++ ) {
  1043. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  1044. }
  1045. return elems;
  1046. }
  1047. // Getting an attribute
  1048. return length ? fn( elems[0], key ) : undefined;
  1049. },
  1050. now: function() {
  1051. /// <summary>
  1052. /// Returns the number of milliseconds since midnight of January 1, 1970 and the current date and time.
  1053. /// </summary>
  1054. /// <returns type="Number" integer="true" />
  1055. return (new Date()).getTime();
  1056. },
  1057. // Use of jQuery.browser is frowned upon.
  1058. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  1059. uaMatch: function( ua ) {
  1060. ua = ua.toLowerCase();
  1061. var match = rwebkit.exec( ua ) ||
  1062. ropera.exec( ua ) ||
  1063. rmsie.exec( ua ) ||
  1064. ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
  1065. [];
  1066. return { browser: match[1] || "", version: match[2] || "0" };
  1067. },
  1068. browser: {}
  1069. });
  1070. // Populate the class2type map
  1071. jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
  1072. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1073. });
  1074. browserMatch = jQuery.uaMatch( userAgent );
  1075. if ( browserMatch.browser ) {
  1076. jQuery.browser[ browserMatch.browser ] = true;
  1077. jQuery.browser.version = browserMatch.version;
  1078. }
  1079. // Deprecated, use jQuery.browser.webkit instead
  1080. if ( jQuery.browser.webkit ) {
  1081. jQuery.browser.safari = true;
  1082. }
  1083. if ( indexOf ) {
  1084. jQuery.inArray = function( elem, array ) {
  1085. /// <summary>
  1086. /// Search for a specified value within an array and return its index (or -1 if not found).
  1087. /// API: <see href="http://api.jquery.com/jQuery.inArray/">jQuery.inArray()</see>
  1088. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1089. /// </summary>
  1090. /// <param name="value">
  1091. /// The value to search for.
  1092. // </param>
  1093. /// <param name="array" type="Array">
  1094. /// An array through which to search.
  1095. /// </param>
  1096. /// <returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns>
  1097. return indexOf.call( array, elem );
  1098. };
  1099. }
  1100. // Verify that \s matches non-breaking spaces
  1101. // (IE fails on this test)
  1102. if ( !rwhite.test( "\xA0" ) ) {
  1103. trimLeft = /^[\s\xA0]+/;
  1104. trimRight = /[\s\xA0]+$/;
  1105. }
  1106. // All jQuery objects should point back to these
  1107. rootjQuery = jQuery(document);
  1108. // Cleanup functions for the document ready method
  1109. if ( document.addEventListener ) {
  1110. DOMContentLoaded = function() {
  1111. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  1112. jQuery.ready();
  1113. };
  1114. } else if ( document.attachEvent ) {
  1115. DOMContentLoaded = function() {
  1116. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  1117. if ( document.readyState === "complete" ) {
  1118. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  1119. jQuery.ready();
  1120. }
  1121. };
  1122. }
  1123. // The DOM ready check for Internet Explorer
  1124. function doScrollCheck() {
  1125. if ( jQuery.isReady ) {
  1126. return;
  1127. }
  1128. try {
  1129. // If IE is used, use the trick by Diego Perini
  1130. // http://javascript.nwbox.com/IEContentLoaded/
  1131. document.documentElement.doScroll("left");
  1132. } catch(e) {
  1133. setTimeout( doScrollCheck, 1 );
  1134. return;
  1135. }
  1136. // and execute any waiting functions
  1137. jQuery.ready();
  1138. }
  1139. // Expose jQuery to the global object
  1140. return (window.jQuery = window.$ = jQuery);
  1141. })();
  1142. // [vsdoc] The following function has been modified for IntelliSense.
  1143. // [vsdoc] Stubbing support properties to "false" for IntelliSense compat.
  1144. (function() {
  1145. jQuery.support = {};
  1146. var root = document.documentElement,
  1147. script = document.createElement("script"),
  1148. div = document.createElement("div"),
  1149. id = "script" + jQuery.now();
  1150. div.style.display = "none";
  1151. div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  1152. var all = div.getElementsByTagName("*"),
  1153. a = div.getElementsByTagName("a")[0],
  1154. select = document.createElement("select"),
  1155. opt = select.appendChild( document.createElement("option") );
  1156. // Can't get basic test support
  1157. if ( !all || !all.length || !a ) {
  1158. return;
  1159. }
  1160. jQuery.support = {
  1161. // IE strips leading whitespace when .innerHTML is used
  1162. leadingWhitespace: div.firstChild.nodeType === 3,
  1163. // Make sure that tbody elements aren't automatically inserted
  1164. // IE will insert them into empty tables
  1165. tbody: !div.getElementsByTagName("tbody").length,
  1166. // Make sure that link elements get serialized correctly by innerHTML
  1167. // This requires a wrapper element in IE
  1168. htmlSerialize: !!div.getElementsByTagName("link").length,
  1169. // Get the style information from getAttribute
  1170. // (IE uses .cssText insted)
  1171. style: /red/.test( a.getAttribute("style") ),
  1172. // Make sure that URLs aren't manipulated
  1173. // (IE normalizes it by default)
  1174. hrefNormalized: a.getAttribute("href") === "/a",
  1175. // Make sure that element opacity exists
  1176. // (IE uses filter instead)
  1177. // Use a regex to work around a WebKit issue. See #5145
  1178. opacity: /^0.55$/.test( a.style.opacity ),
  1179. // Verify style float existence
  1180. // (IE uses styleFloat instead of cssFloat)
  1181. cssFloat: !!a.style.cssFloat,
  1182. // Make sure that if no value is specified for a checkbox
  1183. // that it defaults to "on".
  1184. // (WebKit defaults to "" instead)
  1185. checkOn: div.getElementsByTagName("input")[0].value === "on",
  1186. // Make sure that a selected-by-default option has a working selected property.
  1187. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  1188. optSelected: opt.selected,
  1189. // Will be defined later
  1190. optDisabled: false,
  1191. checkClone: false,
  1192. scriptEval: false,
  1193. noCloneEvent: true,
  1194. boxModel: null,
  1195. inlineBlockNeedsLayout: false,
  1196. shrinkWrapBlocks: false,
  1197. reliableHiddenOffsets: true
  1198. };
  1199. // Make sure that the options inside disabled selects aren't marked as disabled
  1200. // (WebKit marks them as diabled)
  1201. select.disabled = true;
  1202. jQuery.support.optDisabled = !opt.disabled;
  1203. script.type = "text/javascript";
  1204. try {
  1205. script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
  1206. } catch(e) {}
  1207. root.insertBefore( script, root.firstChild );
  1208. // Make sure that the execution of code works by injecting a script
  1209. // tag with appendChild/createTextNode
  1210. // (IE doesn't support this, fails, and uses .text instead)
  1211. if ( window[ id ] ) {
  1212. jQuery.support.scriptEval = true;
  1213. delete window[ id ];
  1214. }
  1215. root.removeChild( script );
  1216. if ( div.attachEvent && div.fireEvent ) {
  1217. div.attachEvent("onclick", function click() {
  1218. // Cloning a node shouldn't copy over any
  1219. // bound event handlers (IE does this)
  1220. jQuery.support.noCloneEvent = false;
  1221. div.detachEvent("onclick", click);
  1222. });
  1223. div.cloneNode(true).fireEvent("onclick");
  1224. }
  1225. div = document.createElement("div");
  1226. div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
  1227. var fragment = document.createDocumentFragment();
  1228. fragment.appendChild( div.firstChild );
  1229. // WebKit doesn't clone checked state correctly in fragments
  1230. jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
  1231. // Figure out if the W3C box model works as expected
  1232. // document.body must exist before we can do this
  1233. jQuery(function() {
  1234. var div = document.createElement("div");
  1235. div.style.width = div.style.paddingLeft = "1px";
  1236. document.body.appendChild( div );
  1237. jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
  1238. if ( "zoom" in div.style ) {
  1239. // Check if natively block-level elements act like inline-block
  1240. // elements when setting their display to 'inline' and giving
  1241. // them layout
  1242. // (IE < 8 does this)
  1243. div.style.display = "inline";
  1244. div.style.zoom = 1;
  1245. jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
  1246. // Check if elements with layout shrink-wrap their children
  1247. // (IE 6 does this)
  1248. div.style.display = "";
  1249. div.innerHTML = "<div style='width:4px;'></div>";
  1250. jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
  1251. }
  1252. div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
  1253. var tds = div.getElementsByTagName("td");
  1254. // Check if table cells still have offsetWidth/Height when they are set
  1255. // to display:none and there are still other visible table cells in a
  1256. // table row; if so, offsetWidth/Height are not reliable for use when
  1257. // determining if an element has been hidden directly using
  1258. // display:none (it is still safe to use offsets if a parent element is
  1259. // hidden; don safety goggles and see bug #4512 for more information).
  1260. // (only IE 8 fails this test)
  1261. jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
  1262. tds[0].style.display = "";
  1263. tds[1].style.display = "none";
  1264. // Check if empty table cells still have offsetWidth/Height
  1265. // (IE < 8 fail this test)
  1266. jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
  1267. div.innerHTML = "";
  1268. document.body.removeChild( div ).style.display = "none";
  1269. div = tds = null;
  1270. });
  1271. // Technique from Juriy Zaytsev
  1272. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  1273. var eventSupported = function( eventName ) {
  1274. var el = document.createElement("div");
  1275. eventName = "on" + eventName;
  1276. var isSupported = (eventName in el);
  1277. if ( !isSupported ) {
  1278. el.setAttribute(eventName, "return;");
  1279. isSupported = typeof el[eventName] === "function";
  1280. }
  1281. el = null;
  1282. return isSupported;
  1283. };
  1284. jQuery.support.submitBubbles = eventSupported("submit");
  1285. jQuery.support.changeBubbles = eventSupported("change");
  1286. // release memory in IE
  1287. root = script = div = all = a = null;
  1288. })();
  1289. jQuery.props = {
  1290. "for": "htmlFor",
  1291. "class": "className",
  1292. readonly: "readOnly",
  1293. maxlength: "maxLength",
  1294. cellspacing: "cellSpacing",
  1295. rowspan: "rowSpan",
  1296. colspan: "colSpan",
  1297. tabindex: "tabIndex",
  1298. usemap: "useMap",
  1299. frameborder: "frameBorder"
  1300. };
  1301. var windowData = {},
  1302. rbrace = /^(?:\{.*\}|\[.*\])$/;
  1303. jQuery.extend({
  1304. cache: {},
  1305. // Please use with caution
  1306. uuid: 0,
  1307. // Unique for each copy of jQuery on the page
  1308. expando: "jQuery" + jQuery.now(),
  1309. // The following elements throw uncatchable exceptions if you
  1310. // attempt to add expando properties to them.
  1311. noData: {
  1312. "embed": true,
  1313. // Ban all objects except for Flash (which handle expandos)
  1314. "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  1315. "applet": true
  1316. },
  1317. data: function( elem, name, data ) {
  1318. /// <summary>
  1319. /// Store arbitrary data associated with the specified element.
  1320. /// API: <see href="http://api.jquery.com/jQuery.data/">jQuery.data()</see>
  1321. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1322. /// </summary>
  1323. /// <param name="elem" type="Element">
  1324. /// The DOM element to associate with the data.
  1325. /// </param>
  1326. /// <param name="name" type="String">
  1327. /// A string naming the piece of data to set.
  1328. /// </param>
  1329. /// <param name="value" type="Object">
  1330. /// The new data value.
  1331. /// </param>
  1332. /// <returns type="jQuery" />
  1333. if ( !jQuery.acceptData( elem ) ) {
  1334. return;
  1335. }
  1336. elem = elem == window ?
  1337. windowData :
  1338. elem;
  1339. var isNode = elem.nodeType,
  1340. id = isNode ? elem[ jQuery.expando ] : null,
  1341. cache = jQuery.cache, thisCache;
  1342. if ( isNode && !id && typeof name === "string" && data === undefined ) {
  1343. return;
  1344. }
  1345. // Get the data from the object directly
  1346. if ( !isNode ) {
  1347. cache = elem;
  1348. // Compute a unique ID for the element
  1349. } else if ( !id ) {
  1350. elem[ jQuery.expando ] = id = ++jQuery.uuid;
  1351. }
  1352. // Avoid generating a new cache unless none exists and we
  1353. // want to manipulate it.
  1354. if ( typeof name === "object" ) {
  1355. if ( isNode ) {
  1356. cache[ id ] = jQuery.extend(cache[ id ], name);
  1357. } else {
  1358. jQuery.extend( cache, name );
  1359. }
  1360. } else if ( isNode && !cache[ id ] ) {
  1361. cache[ id ] = {};
  1362. }
  1363. thisCache = isNode ? cache[ id ] : cache;
  1364. // Prevent overriding the named cache with undefined values
  1365. if ( data !== undefined ) {
  1366. thisCache[ name ] = data;
  1367. }
  1368. return typeof name === "string" ? thisCache[ name ] : thisCache;
  1369. },
  1370. removeData: function( elem, name ) {
  1371. /// <summary>
  1372. /// Remove a previously-stored piece of data.
  1373. /// API: <see href="http://api.jquery.com/jQuery.removeData/">jQuery.removeData()</see>
  1374. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1375. /// </summary>
  1376. /// <param name="elem" type="Element">
  1377. /// A DOM element from which to remove data.
  1378. /// </param>
  1379. /// <param name="name" type="String">
  1380. /// A string naming the piece of data to remove.
  1381. /// </param>
  1382. /// <returns type="jQuery" />
  1383. if ( !jQuery.acceptData( elem ) ) {
  1384. return;
  1385. }
  1386. elem = elem == window ?
  1387. windowData :
  1388. elem;
  1389. var isNode = elem.nodeType,
  1390. id = isNode ? elem[ jQuery.expando ] : elem,
  1391. cache = jQuery.cache,
  1392. thisCache = isNode ? cache[ id ] : id;
  1393. // If we want to remove a specific section of the element's data
  1394. if ( name ) {
  1395. if ( thisCache ) {
  1396. // Remove the section of cache data
  1397. delete thisCache[ name ];
  1398. // If we've removed all the data, remove the element's cache
  1399. if ( isNode && jQuery.isEmptyObject(thisCache) ) {
  1400. jQuery.removeData( elem );
  1401. }
  1402. }
  1403. // Otherwise, we want to remove all of the element's data
  1404. } else {
  1405. if ( isNode && jQuery.support.deleteExpando ) {
  1406. delete elem[ jQuery.expando ];
  1407. } else if ( elem.removeAttribute ) {
  1408. elem.removeAttribute( jQuery.expando );
  1409. // Completely remove the data cache
  1410. } else if ( isNode ) {
  1411. delete cache[ id ];
  1412. // Remove all fields from the object
  1413. } else {
  1414. for ( var n in elem ) {
  1415. delete elem[ n ];
  1416. }
  1417. }
  1418. }
  1419. },
  1420. // A method for determining if a DOM node can handle the data expando
  1421. acceptData: function( elem ) {
  1422. if ( elem.nodeName ) {
  1423. var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
  1424. if ( match ) {
  1425. return !(match === true || elem.getAttribute("classid") !== match);
  1426. }
  1427. }
  1428. return true;
  1429. }
  1430. });
  1431. jQuery.fn.extend({
  1432. data: function( key, value ) {
  1433. /// <summary>
  1434. /// Store arbitrary data associated with the matched elements.
  1435. /// API: <see href="http://api.jquery.com/data/">.data()</see>
  1436. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/miscellaneous/data-storage/">Data Storage</see>
  1437. /// </summary>
  1438. /// <param name="key" type="String">
  1439. /// A string naming the piece of data to set.
  1440. /// </param>
  1441. /// <param name="value" type="Object">
  1442. /// The new data value; it can be any Javascript type including Array or Object.
  1443. /// </param>
  1444. /// <returns type="jQuery" />
  1445. if ( typeof key === "undefined" ) {
  1446. return this.length ? jQuery.data( this[0] ) : null;
  1447. } else if ( typeof key === "object" ) {
  1448. return this.each(function() {
  1449. jQuery.data( this, key );
  1450. });
  1451. }
  1452. var parts = key.split(".");
  1453. parts[1] = parts[1] ? "." + parts[1] : "";
  1454. if ( value === undefined ) {
  1455. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1456. // Try to fetch any internally stored data first
  1457. if ( data === undefined && this.length ) {
  1458. data = jQuery.data( this[0], key );
  1459. // If nothing was found internally, try to fetch any
  1460. // data from the HTML5 data-* attribute
  1461. if ( data === undefined && this[0].nodeType === 1 ) {
  1462. data = this[0].getAttribute( "data-" + key );
  1463. if ( typeof data === "string" ) {
  1464. try {
  1465. data = data === "true" ? true :
  1466. data === "false" ? false :
  1467. data === "null" ? null :
  1468. !jQuery.isNaN( data ) ? parseFloat( data ) :
  1469. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  1470. data;
  1471. } catch( e ) {}
  1472. } else {
  1473. data = undefined;
  1474. }
  1475. }
  1476. }
  1477. return data === undefined && parts[1] ?
  1478. this.data( parts[0] ) :
  1479. data;
  1480. } else {
  1481. return this.each(function() {
  1482. var $this = jQuery( this ), args = [ parts[0], value ];
  1483. $this.triggerHandler( "setData" + parts[1] + "!", args );
  1484. jQuery.data( this, key, value );
  1485. $this.triggerHandler( "changeData" + parts[1] + "!", args );
  1486. });
  1487. }
  1488. },
  1489. removeData: function( key ) {
  1490. /// <summary>
  1491. /// Remove a previously-stored piece of data associated with the matched elements.
  1492. /// API: <see href="http://api.jquery.com/removedata/">.removeData()</see>
  1493. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/miscellaneous/data-storage/">Data Storage</see>
  1494. /// </summary>
  1495. /// <param name="key" type="String">
  1496. /// A string naming the piece of data to delete.
  1497. /// </param>
  1498. /// <returns type="jQuery" />
  1499. return this.each(function() {
  1500. jQuery.removeData( this, key );
  1501. });
  1502. }
  1503. });
  1504. jQuery.extend({
  1505. queue: function( elem, type, data ) {
  1506. /// <summary>
  1507. /// Show the queue of functions to be executed on the matched element.
  1508. /// API: <see href="http://api.jquery.com/jQuery.queue/">jQuery.queue()</see>
  1509. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1510. /// </summary>
  1511. /// <param name="element" type="Element">
  1512. /// A DOM element to inspect for an attached queue.
  1513. /// </param>
  1514. /// <param name="queueName" type="String" optional="true">
  1515. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1516. /// </param>
  1517. /// <returns type="Array" />
  1518. if ( !elem ) {
  1519. return;
  1520. }
  1521. type = (type || "fx") + "queue";
  1522. var q = jQuery.data( elem, type );
  1523. // Speed up dequeue by getting out quickly if this is just a lookup
  1524. if ( !data ) {
  1525. return q || [];
  1526. }
  1527. if ( !q || jQuery.isArray(data) ) {
  1528. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  1529. } else {
  1530. q.push( data );
  1531. }
  1532. return q;
  1533. },
  1534. dequeue: function( elem, type ) {
  1535. /// <summary>
  1536. /// Execute the next function on the queue for the matched element.
  1537. /// API: <see href="http://api.jquery.com/jQuery.dequeue/">jQuery.dequeue()</see>
  1538. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1539. /// </summary>
  1540. /// <param name="element" type="Element">
  1541. /// A DOM element from which to remove and execute a queued function.
  1542. /// </param>
  1543. /// <param name="queueName" type="String" optional="true">
  1544. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1545. /// </param>
  1546. /// <returns type="Array" />
  1547. type = type || "fx";
  1548. var queue = jQuery.queue( elem, type ), fn = queue.shift();
  1549. // If the fx queue is dequeued, always remove the progress sentinel
  1550. if ( fn === "inprogress" ) {
  1551. fn = queue.shift();
  1552. }
  1553. if ( fn ) {
  1554. // Add a progress sentinel to prevent the fx queue from being
  1555. // automatically dequeued
  1556. if ( type === "fx" ) {
  1557. queue.unshift("inprogress");
  1558. }
  1559. fn.call(elem, function() {
  1560. jQuery.dequeue(elem, type);
  1561. });
  1562. }
  1563. }
  1564. });
  1565. jQuery.fn.extend({
  1566. queue: function( type, data ) {
  1567. /// <summary>
  1568. /// Show the queue of functions to be executed on the matched element.
  1569. /// API: <see href="http://api.jquery.com/queue/">.queue()</see>
  1570. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1571. /// </summary>
  1572. /// <remarks>
  1573. /// .queue( [ queueName ] )
  1574. /// .queue( [ queueName ], newQueue )
  1575. /// .queue( [ queueName ], callback( next ) )
  1576. /// </remarks>
  1577. /// <param name="queueName" type="String" optional="true">
  1578. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1579. /// </param>
  1580. /// <param name="newQueue" type="String" optional="true">
  1581. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1582. /// </param>
  1583. /// <param name="callback( next )" type="Function" optional="true">
  1584. /// The new function to add to the queue, with a function to call that will dequeue the next item.
  1585. /// </param>
  1586. /// <returns type="jQuery" />
  1587. if ( typeof type !== "string" ) {
  1588. data = type;
  1589. type = "fx";
  1590. }
  1591. if ( data === undefined ) {
  1592. return jQuery.queue( this[0], type );
  1593. }
  1594. return this.each(function( i ) {
  1595. var queue = jQuery.queue( this, type, data );
  1596. if ( type === "fx" && queue[0] !== "inprogress" ) {
  1597. jQuery.dequeue( this, type );
  1598. }
  1599. });
  1600. },
  1601. dequeue: function( type ) {
  1602. /// <summary>
  1603. /// Execute the next function on the queue for the matched element.
  1604. /// API: <see href="http://api.jquery.com/dequeue/">.dequeue()</see>
  1605. /// Categories: <see href="http://api.jquery.com/category/data/">Data</see>, <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  1606. /// </summary>
  1607. /// <param name="queueName" type="String" optional="true">
  1608. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1609. /// </param>
  1610. /// <returns type="jQuery" />
  1611. return this.each(function() {
  1612. jQuery.dequeue( this, type );
  1613. });
  1614. },
  1615. // Based off of the plugin by Clint Helfers, with permission.
  1616. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  1617. delay: function( time, type ) {
  1618. /// <summary>
  1619. /// Set a timer to delay execution of subsequent items in the queue.
  1620. /// API: <see href="http://api.jquery.com/delay/">.delay()</see>
  1621. /// Categories: <see href="http://api.jquery.com/category/effects/custom-effects/">Custom</see>
  1622. /// </summary>
  1623. /// <param name="time" type="Number">
  1624. /// An integer indicating the number of milliseconds to delay execution of the next item in the queue.
  1625. /// </param>
  1626. /// <param name="type" type="String">
  1627. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1628. /// </param>
  1629. /// <returns type="jQuery" />
  1630. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  1631. type = type || "fx";
  1632. return this.queue( type, function() {
  1633. var elem = this;
  1634. setTimeout(function() {
  1635. jQuery.dequeue( elem, type );
  1636. }, time );
  1637. });
  1638. },
  1639. clearQueue: function( type ) {
  1640. /// <summary>
  1641. /// Remove from the queue all items that have not yet been run.
  1642. /// API: <see href="http://api.jquery.com/clearQueue/">.clearQueue()</see>
  1643. /// Categories: <see href="http://api.jquery.com/category/effects/custom-effects/">Custom</see>
  1644. /// </summary>
  1645. /// <param name="type" type="String" optional="true">
  1646. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1647. /// </param>
  1648. /// <returns type="jQuery" />
  1649. return this.queue( type || "fx", [] );
  1650. }
  1651. });
  1652. var rclass = /[\n\t]/g,
  1653. rspaces = /\s+/,
  1654. rreturn = /\r/g,
  1655. rspecialurl = /^(?:href|src|style)$/,
  1656. rtype = /^(?:button|input)$/i,
  1657. rfocusable = /^(?:button|input|object|select|textarea)$/i,
  1658. rclickable = /^a(?:rea)?$/i,
  1659. rradiocheck = /^(?:radio|checkbox)$/i;
  1660. jQuery.fn.extend({
  1661. attr: function( name, value ) {
  1662. /// <summary>
  1663. /// Set a single property to a computed value, on all matched elements.
  1664. /// Instead of a value, a function is provided, that computes the value.
  1665. /// API: <see href="http://api.jquery.com/attr/">.attr()</see>
  1666. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1667. /// </summary>
  1668. /// <param name="name" type="String">
  1669. /// The name of the property to get or set. If the "value" parameter is not set, .attr() will return the value of the attribute.
  1670. /// </param>
  1671. /// <param name="value" type="Function" optional="true">
  1672. /// A function returning the value to set.
  1673. /// </param>
  1674. /// <returns type="jQuery" />
  1675. return jQuery.access( this, name, value, true, jQuery.attr );
  1676. },
  1677. removeAttr: function( name, fn ) {
  1678. /// <summary>
  1679. /// Remove an attribute from each of the matched elements.
  1680. /// API: <see href="http://api.jquery.com/removeAttr/">.removeAttr()</see>
  1681. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1682. /// </summary>
  1683. /// <param name="name" type="String">
  1684. /// An attribute to remove.
  1685. /// </param>
  1686. /// <returns type="jQuery" />
  1687. return this.each(function(){
  1688. jQuery.attr( this, name, "" );
  1689. if ( this.nodeType === 1 ) {
  1690. this.removeAttribute( name );
  1691. }
  1692. });
  1693. },
  1694. addClass: function( value ) {
  1695. /// <summary>
  1696. /// Adds the specified class(es) to each of the set of matched elements.
  1697. /// API: <see href="http://api.jquery.com/addClass/">.addClass()</see>
  1698. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1699. /// </summary>
  1700. /// <param name="className" type="String">
  1701. /// One or more class names to be added to the class attribute of each matched element.
  1702. /// </param>
  1703. /// <returns type="jQuery" />
  1704. if ( jQuery.isFunction(value) ) {
  1705. return this.each(function(i) {
  1706. var self = jQuery(this);
  1707. self.addClass( value.call(this, i, self.attr("class")) );
  1708. });
  1709. }
  1710. if ( value && typeof value === "string" ) {
  1711. var classNames = (value || "").split( rspaces );
  1712. for ( var i = 0, l = this.length; i < l; i++ ) {
  1713. var elem = this[i];
  1714. if ( elem.nodeType === 1 ) {
  1715. if ( !elem.className ) {
  1716. elem.className = value;
  1717. } else {
  1718. var className = " " + elem.className + " ", setClass = elem.className;
  1719. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1720. if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
  1721. setClass += " " + classNames[c];
  1722. }
  1723. }
  1724. elem.className = jQuery.trim( setClass );
  1725. }
  1726. }
  1727. }
  1728. }
  1729. return this;
  1730. },
  1731. removeClass: function( value ) {
  1732. /// <summary>
  1733. /// Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
  1734. /// API: <see href="http://api.jquery.com/removeClass/">.removeClass()</see>
  1735. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1736. /// </summary>
  1737. /// <param name="className" type="String" optional="true">
  1738. /// A class name to be removed from the class attribute of each matched element.
  1739. /// </param>
  1740. /// <returns type="jQuery" />
  1741. if ( jQuery.isFunction(value) ) {
  1742. return this.each(function(i) {
  1743. var self = jQuery(this);
  1744. self.removeClass( value.call(this, i, self.attr("class")) );
  1745. });
  1746. }
  1747. if ( (value && typeof value === "string") || value === undefined ) {
  1748. var classNames = (value || "").split( rspaces );
  1749. for ( var i = 0, l = this.length; i < l; i++ ) {
  1750. var elem = this[i];
  1751. if ( elem.nodeType === 1 && elem.className ) {
  1752. if ( value ) {
  1753. var className = (" " + elem.className + " ").replace(rclass, " ");
  1754. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1755. className = className.replace(" " + classNames[c] + " ", " ");
  1756. }
  1757. elem.className = jQuery.trim( className );
  1758. } else {
  1759. elem.className = "";
  1760. }
  1761. }
  1762. }
  1763. }
  1764. return this;
  1765. },
  1766. toggleClass: function( value, stateVal ) {
  1767. /// <summary>
  1768. /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
  1769. /// API: <see href="http://api.jquery.com/toggleClass/">.toggleClass()</see>
  1770. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1771. /// </summary>
  1772. /// <param name="className" type="String">
  1773. /// One or more class names (separated by spaces) to be toggled for each element in the matched set.
  1774. /// </param>
  1775. /// <param name="switch" type="Boolean" optional="true">
  1776. /// A boolean value to determine whether the class should be added or removed.
  1777. /// </param>
  1778. /// <returns type="jQuery" />
  1779. var type = typeof value, isBool = typeof stateVal === "boolean";
  1780. if ( jQuery.isFunction( value ) ) {
  1781. return this.each(function(i) {
  1782. var self = jQuery(this);
  1783. self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
  1784. });
  1785. }
  1786. return this.each(function() {
  1787. if ( type === "string" ) {
  1788. // toggle individual class names
  1789. var className, i = 0, self = jQuery(this),
  1790. state = stateVal,
  1791. classNames = value.split( rspaces );
  1792. while ( (className = classNames[ i++ ]) ) {
  1793. // check each className given, space seperated list
  1794. state = isBool ? state : !self.hasClass( className );
  1795. self[ state ? "addClass" : "removeClass" ]( className );
  1796. }
  1797. } else if ( type === "undefined" || type === "boolean" ) {
  1798. if ( this.className ) {
  1799. // store className if set
  1800. jQuery.data( this, "__className__", this.className );
  1801. }
  1802. // toggle whole className
  1803. this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
  1804. }
  1805. });
  1806. },
  1807. hasClass: function( selector ) {
  1808. /// <summary>
  1809. /// Determine whether any of the matched elements are assigned the given class.
  1810. /// API: <see href="http://api.jquery.com/toggleClass/">.toggleClass()</see>
  1811. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1812. /// </summary>
  1813. /// <param name="className" type="String">
  1814. /// The class name to search for.
  1815. /// </param>
  1816. /// <returns type="Boolean" />
  1817. var className = " " + selector + " ";
  1818. for ( var i = 0, l = this.length; i < l; i++ ) {
  1819. if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
  1820. return true;
  1821. }
  1822. }
  1823. return false;
  1824. },
  1825. val: function( value ) {
  1826. /// <summary>
  1827. /// Set the value of each element in the set of matched elements.
  1828. /// API: <see href="http://api.jquery.com/val/">.val()</see>
  1829. /// Categories: <see href="http://api.jquery.com/category/attributes/">Attributes</see>
  1830. /// </summary>
  1831. /// <param name="value" type="String">
  1832. /// A string of text or an array of strings to set as the value property of each matched element.
  1833. /// </param>
  1834. /// <returns type="jQuery" />
  1835. if ( !arguments.length ) {
  1836. var elem = this[0];
  1837. if ( elem ) {
  1838. if ( jQuery.nodeName( elem, "option" ) ) {
  1839. // attributes.value is undefined in Blackberry 4.7 but
  1840. // uses .value. See #6932
  1841. var val = elem.attributes.value;
  1842. return !val || val.specified ? elem.value : elem.text;
  1843. }
  1844. // We need to handle select boxes special
  1845. if ( jQuery.nodeName( elem, "select" ) ) {
  1846. var index = elem.selectedIndex,
  1847. values = [],
  1848. options = elem.options,
  1849. one = elem.type === "select-one";
  1850. // Nothing was selected
  1851. if ( index < 0 ) {
  1852. return null;
  1853. }
  1854. // Loop through all the selected options
  1855. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  1856. var option = options[ i ];
  1857. // Don't return options that are disabled or in a disabled optgroup
  1858. if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
  1859. (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
  1860. // Get the specific value for the option
  1861. value = jQuery(option).val();
  1862. // We don't need an array for one selects
  1863. if ( one ) {
  1864. return value;
  1865. }
  1866. // Multi-Selects return an array
  1867. values.push( value );
  1868. }
  1869. }
  1870. return values;
  1871. }
  1872. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  1873. if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
  1874. return elem.getAttribute("value") === null ? "on" : elem.value;
  1875. }
  1876. // Everything else, we just grab the value
  1877. return (elem.value || "").replace(rreturn, "");
  1878. }
  1879. return undefined;
  1880. }
  1881. var isFunction = jQuery.isFunction(value);
  1882. return this.each(function(i) {
  1883. var self = jQuery(this), val = value;
  1884. if ( this.nodeType !== 1 ) {
  1885. return;
  1886. }
  1887. if ( isFunction ) {
  1888. val = value.call(this, i, self.val());
  1889. }
  1890. // Treat null/undefined as ""; convert numbers to string
  1891. if ( val == null ) {
  1892. val = "";
  1893. } else if ( typeof val === "number" ) {
  1894. val += "";
  1895. } else if ( jQuery.isArray(val) ) {
  1896. val = jQuery.map(val, function (value) {
  1897. return value == null ? "" : value + "";
  1898. });
  1899. }
  1900. if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
  1901. this.checked = jQuery.inArray( self.val(), val ) >= 0;
  1902. } else if ( jQuery.nodeName( this, "select" ) ) {
  1903. var values = jQuery.makeArray(val);
  1904. jQuery( "option", this ).each(function() {
  1905. this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
  1906. });
  1907. if ( !values.length ) {
  1908. this.selectedIndex = -1;
  1909. }
  1910. } else {
  1911. this.value = val;
  1912. }
  1913. });
  1914. }
  1915. });
  1916. jQuery.extend({
  1917. attrFn: {
  1918. val: true,
  1919. css: true,
  1920. html: true,
  1921. text: true,
  1922. data: true,
  1923. width: true,
  1924. height: true,
  1925. offset: true
  1926. },
  1927. attr: function( elem, name, value, pass ) {
  1928. /// <summary>
  1929. /// This method is internal.
  1930. /// </summary>
  1931. /// <private />
  1932. // don't set attributes on text and comment nodes
  1933. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1934. return undefined;
  1935. }
  1936. if ( pass && name in jQuery.attrFn ) {
  1937. return jQuery(elem)[name](value);
  1938. }
  1939. var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
  1940. // Whether we are setting (or getting)
  1941. set = value !== undefined;
  1942. // Try to normalize/fix the name
  1943. name = notxml && jQuery.props[ name ] || name;
  1944. // Only do all the following if this is a node (faster for style)
  1945. if ( elem.nodeType === 1 ) {
  1946. // These attributes require special treatment
  1947. var special = rspecialurl.test( name );
  1948. // Safari mis-reports the default selected property of an option
  1949. // Accessing the parent's selectedIndex property fixes it
  1950. if ( name === "selected" && !jQuery.support.optSelected ) {
  1951. var parent = elem.parentNode;
  1952. if ( parent ) {
  1953. parent.selectedIndex;
  1954. // Make sure that it also works with optgroups, see #5701
  1955. if ( parent.parentNode ) {
  1956. parent.parentNode.selectedIndex;
  1957. }
  1958. }
  1959. }
  1960. // If applicable, access the attribute via the DOM 0 way
  1961. // 'in' checks fail in Blackberry 4.7 #6931
  1962. if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
  1963. if ( set ) {
  1964. // We can't allow the type property to be changed (since it causes problems in IE)
  1965. if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
  1966. jQuery.error( "type property can't be changed" );
  1967. }
  1968. if ( value === null ) {
  1969. if ( elem.nodeType === 1 ) {
  1970. elem.removeAttribute( name );
  1971. }
  1972. } else {
  1973. elem[ name ] = value;
  1974. }
  1975. }
  1976. // browsers index elements by id/name on forms, give priority to attributes.
  1977. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
  1978. return elem.getAttributeNode( name ).nodeValue;
  1979. }
  1980. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1981. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1982. if ( name === "tabIndex" ) {
  1983. var attributeNode = elem.getAttributeNode( "tabIndex" );
  1984. return attributeNode && attributeNode.specified ?
  1985. attributeNode.value :
  1986. rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
  1987. 0 :
  1988. undefined;
  1989. }
  1990. return elem[ name ];
  1991. }
  1992. if ( !jQuery.support.style && notxml && name === "style" ) {
  1993. if ( set ) {
  1994. elem.style.cssText = "" + value;
  1995. }
  1996. return elem.style.cssText;
  1997. }
  1998. if ( set ) {
  1999. // convert the value to a string (all browsers do this but IE) see #1070
  2000. elem.setAttribute( name, "" + value );
  2001. }
  2002. // Ensure that missing attributes return undefined
  2003. // Blackberry 4.7 returns "" from getAttribute #6938
  2004. if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
  2005. return undefined;
  2006. }
  2007. var attr = !jQuery.support.hrefNormalized && notxml && special ?
  2008. // Some attributes require a special call on IE
  2009. elem.getAttribute( name, 2 ) :
  2010. elem.getAttribute( name );
  2011. // Non-existent attributes return null, we normalize to undefined
  2012. return attr === null ? undefined : attr;
  2013. }
  2014. }
  2015. });
  2016. var rnamespaces = /\.(.*)$/,
  2017. rformElems = /^(?:textarea|input|select)$/i,
  2018. rperiod = /\./g,
  2019. rspace = / /g,
  2020. rescape = /[^\w\s.|`]/g,
  2021. fcleanup = function( nm ) {
  2022. return nm.replace(rescape, "\\$&");
  2023. },
  2024. focusCounts = { focusin: 0, focusout: 0 };
  2025. /*
  2026. * A number of helper functions used for managing events.
  2027. * Many of the ideas behind this code originated from
  2028. * Dean Edwards' addEvent library.
  2029. */
  2030. jQuery.event = {
  2031. // Bind an event to an element
  2032. // Original by Dean Edwards
  2033. add: function( elem, types, handler, data ) {
  2034. /// <summary>
  2035. /// This method is internal.
  2036. /// </summary>
  2037. /// <private />
  2038. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  2039. return;
  2040. }
  2041. // For whatever reason, IE has trouble passing the window object
  2042. // around, causing it to be cloned in the process
  2043. if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
  2044. elem = window;
  2045. }
  2046. if ( handler === false ) {
  2047. handler = returnFalse;
  2048. }
  2049. var handleObjIn, handleObj;
  2050. if ( handler.handler ) {
  2051. handleObjIn = handler;
  2052. handler = handleObjIn.handler;
  2053. }
  2054. // Make sure that the function being executed has a unique ID
  2055. if ( !handler.guid ) {
  2056. handler.guid = jQuery.guid++;
  2057. }
  2058. // Init the element's event structure
  2059. var elemData = jQuery.data( elem );
  2060. // If no elemData is found then we must be trying to bind to one of the
  2061. // banned noData elements
  2062. if ( !elemData ) {
  2063. return;
  2064. }
  2065. // Use a key less likely to result in collisions for plain JS objects.
  2066. // Fixes bug #7150.
  2067. var eventKey = elem.nodeType ? "events" : "__events__",
  2068. events = elemData[ eventKey ],
  2069. eventHandle = elemData.handle;
  2070. if ( typeof events === "function" ) {
  2071. // On plain objects events is a fn that holds the the data
  2072. // which prevents this data from being JSON serialized
  2073. // the function does not need to be called, it just contains the data
  2074. eventHandle = events.handle;
  2075. events = events.events;
  2076. } else if ( !events ) {
  2077. if ( !elem.nodeType ) {
  2078. // On plain objects, create a fn that acts as the holder
  2079. // of the values to avoid JSON serialization of event data
  2080. elemData[ eventKey ] = elemData = function(){};
  2081. }
  2082. elemData.events = events = {};
  2083. }
  2084. if ( !eventHandle ) {
  2085. elemData.handle = eventHandle = function() {
  2086. // Handle the second event of a trigger and when
  2087. // an event is called after a page has unloaded
  2088. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  2089. jQuery.event.handle.apply( eventHandle.elem, arguments ) :
  2090. undefined;
  2091. };
  2092. }
  2093. // Add elem as a property of the handle function
  2094. // This is to prevent a memory leak with non-native events in IE.
  2095. eventHandle.elem = elem;
  2096. // Handle multiple events separated by a space
  2097. // jQuery(...).bind("mouseover mouseout", fn);
  2098. types = types.split(" ");
  2099. var type, i = 0, namespaces;
  2100. while ( (type = types[ i++ ]) ) {
  2101. handleObj = handleObjIn ?
  2102. jQuery.extend({}, handleObjIn) :
  2103. { handler: handler, data: data };
  2104. // Namespaced event handlers
  2105. if ( type.indexOf(".") > -1 ) {
  2106. namespaces = type.split(".");
  2107. type = namespaces.shift();
  2108. handleObj.namespace = namespaces.slice(0).sort().join(".");
  2109. } else {
  2110. namespaces = [];
  2111. handleObj.namespace = "";
  2112. }
  2113. handleObj.type = type;
  2114. if ( !handleObj.guid ) {
  2115. handleObj.guid = handler.guid;
  2116. }
  2117. // Get the current list of functions bound to this event
  2118. var handlers = events[ type ],
  2119. special = jQuery.event.special[ type ] || {};
  2120. // Init the event handler queue
  2121. if ( !handlers ) {
  2122. handlers = events[ type ] = [];
  2123. // Check for a special event handler
  2124. // Only use addEventListener/attachEvent if the special
  2125. // events handler returns false
  2126. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  2127. // Bind the global event handler to the element
  2128. if ( elem.addEventListener ) {
  2129. elem.addEventListener( type, eventHandle, false );
  2130. } else if ( elem.attachEvent ) {
  2131. elem.attachEvent( "on" + type, eventHandle );
  2132. }
  2133. }
  2134. }
  2135. if ( special.add ) {
  2136. special.add.call( elem, handleObj );
  2137. if ( !handleObj.handler.guid ) {
  2138. handleObj.handler.guid = handler.guid;
  2139. }
  2140. }
  2141. // Add the function to the element's handler list
  2142. handlers.push( handleObj );
  2143. // Keep track of which events have been used, for global triggering
  2144. jQuery.event.global[ type ] = true;
  2145. }
  2146. // Nullify elem to prevent memory leaks in IE
  2147. elem = null;
  2148. },
  2149. global: {},
  2150. // Detach an event or set of events from an element
  2151. remove: function( elem, types, handler, pos ) {
  2152. /// <summary>
  2153. /// This method is internal.
  2154. /// </summary>
  2155. /// <private />
  2156. // don't do events on text and comment nodes
  2157. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  2158. return;
  2159. }
  2160. if ( handler === false ) {
  2161. handler = returnFalse;
  2162. }
  2163. var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
  2164. eventKey = elem.nodeType ? "events" : "__events__",
  2165. elemData = jQuery.data( elem ),
  2166. events = elemData && elemData[ eventKey ];
  2167. if ( !elemData || !events ) {
  2168. return;
  2169. }
  2170. if ( typeof events === "function" ) {
  2171. elemData = events;
  2172. events = events.events;
  2173. }
  2174. // types is actually an event object here
  2175. if ( types && types.type ) {
  2176. handler = types.handler;
  2177. types = types.type;
  2178. }
  2179. // Unbind all events for the element
  2180. if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
  2181. types = types || "";
  2182. for ( type in events ) {
  2183. jQuery.event.remove( elem, type + types );
  2184. }
  2185. return;
  2186. }
  2187. // Handle multiple events separated by a space
  2188. // jQuery(...).unbind("mouseover mouseout", fn);
  2189. types = types.split(" ");
  2190. while ( (type = types[ i++ ]) ) {
  2191. origType = type;
  2192. handleObj = null;
  2193. all = type.indexOf(".") < 0;
  2194. namespaces = [];
  2195. if ( !all ) {
  2196. // Namespaced event handlers
  2197. namespaces = type.split(".");
  2198. type = namespaces.shift();
  2199. namespace = new RegExp("(^|\\.)" +
  2200. jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
  2201. }
  2202. eventType = events[ type ];
  2203. if ( !eventType ) {
  2204. continue;
  2205. }
  2206. if ( !handler ) {
  2207. for ( j = 0; j < eventType.length; j++ ) {
  2208. handleObj = eventType[ j ];
  2209. if ( all || namespace.test( handleObj.namespace ) ) {
  2210. jQuery.event.remove( elem, origType, handleObj.handler, j );
  2211. eventType.splice( j--, 1 );
  2212. }
  2213. }
  2214. continue;
  2215. }
  2216. special = jQuery.event.special[ type ] || {};
  2217. for ( j = pos || 0; j < eventType.length; j++ ) {
  2218. handleObj = eventType[ j ];
  2219. if ( handler.guid === handleObj.guid ) {
  2220. // remove the given handler for the given type
  2221. if ( all || namespace.test( handleObj.namespace ) ) {
  2222. if ( pos == null ) {
  2223. eventType.splice( j--, 1 );
  2224. }
  2225. if ( special.remove ) {
  2226. special.remove.call( elem, handleObj );
  2227. }
  2228. }
  2229. if ( pos != null ) {
  2230. break;
  2231. }
  2232. }
  2233. }
  2234. // remove generic event handler if no more handlers exist
  2235. if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
  2236. if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
  2237. jQuery.removeEvent( elem, type, elemData.handle );
  2238. }
  2239. ret = null;
  2240. delete events[ type ];
  2241. }
  2242. }
  2243. // Remove the expando if it's no longer used
  2244. if ( jQuery.isEmptyObject( events ) ) {
  2245. var handle = elemData.handle;
  2246. if ( handle ) {
  2247. handle.elem = null;
  2248. }
  2249. delete elemData.events;
  2250. delete elemData.handle;
  2251. if ( typeof elemData === "function" ) {
  2252. jQuery.removeData( elem, eventKey );
  2253. } else if ( jQuery.isEmptyObject( elemData ) ) {
  2254. jQuery.removeData( elem );
  2255. }
  2256. }
  2257. },
  2258. // bubbling is internal
  2259. trigger: function( event, data, elem /*, bubbling */ ) {
  2260. /// <summary>
  2261. /// This method is internal.
  2262. /// </summary>
  2263. /// <private />
  2264. // Event object or event type
  2265. var type = event.type || event,
  2266. bubbling = arguments[3];
  2267. if ( !bubbling ) {
  2268. event = typeof event === "object" ?
  2269. // jQuery.Event object
  2270. event[ jQuery.expando ] ? event :
  2271. // Object literal
  2272. jQuery.extend( jQuery.Event(type), event ) :
  2273. // Just the event type (string)
  2274. jQuery.Event(type);
  2275. if ( type.indexOf("!") >= 0 ) {
  2276. event.type = type = type.slice(0, -1);
  2277. event.exclusive = true;
  2278. }
  2279. // Handle a global trigger
  2280. if ( !elem ) {
  2281. // Don't bubble custom events when global (to avoid too much overhead)
  2282. event.stopPropagation();
  2283. // Only trigger if we've ever bound an event for it
  2284. if ( jQuery.event.global[ type ] ) {
  2285. jQuery.each( jQuery.cache, function() {
  2286. if ( this.events && this.events[type] ) {
  2287. jQuery.event.trigger( event, data, this.handle.elem );
  2288. }
  2289. });
  2290. }
  2291. }
  2292. // Handle triggering a single element
  2293. // don't do events on text and comment nodes
  2294. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  2295. return undefined;
  2296. }
  2297. // Clean up in case it is reused
  2298. event.result = undefined;
  2299. event.target = elem;
  2300. // Clone the incoming data, if any
  2301. data = jQuery.makeArray( data );
  2302. data.unshift( event );
  2303. }
  2304. event.currentTarget = elem;
  2305. // Trigger the event, it is assumed that "handle" is a function
  2306. var handle = elem.nodeType ?
  2307. jQuery.data( elem, "handle" ) :
  2308. (jQuery.data( elem, "__events__" ) || {}).handle;
  2309. if ( handle ) {
  2310. handle.apply( elem, data );
  2311. }
  2312. var parent = elem.parentNode || elem.ownerDocument;
  2313. // Trigger an inline bound script
  2314. try {
  2315. if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
  2316. if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
  2317. event.result = false;
  2318. event.preventDefault();
  2319. }
  2320. }
  2321. // prevent IE from throwing an error for some elements with some event types, see #3533
  2322. } catch (inlineError) {}
  2323. if ( !event.isPropagationStopped() && parent ) {
  2324. jQuery.event.trigger( event, data, parent, true );
  2325. } else if ( !event.isDefaultPrevented() ) {
  2326. var target = event.target, old, targetType = type.replace(rnamespaces, ""),
  2327. isClick = jQuery.nodeName(target, "a") && targetType === "click",
  2328. special = jQuery.event.special[ targetType ] || {};
  2329. if ( (!special._default || special._default.call( elem, event ) === false) &&
  2330. !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
  2331. try {
  2332. if ( target[ targetType ] ) {
  2333. // Make sure that we don't accidentally re-trigger the onFOO events
  2334. old = target[ "on" + targetType ];
  2335. if ( old ) {
  2336. target[ "on" + targetType ] = null;
  2337. }
  2338. jQuery.event.triggered = true;
  2339. target[ targetType ]();
  2340. }
  2341. // prevent IE from throwing an error for some elements with some event types, see #3533
  2342. } catch (triggerError) {}
  2343. if ( old ) {
  2344. target[ "on" + targetType ] = old;
  2345. }
  2346. jQuery.event.triggered = false;
  2347. }
  2348. }
  2349. },
  2350. handle: function( event ) {
  2351. /// <summary>
  2352. /// This method is internal.
  2353. /// </summary>
  2354. /// <private />
  2355. var all, handlers, namespaces, namespace_sort = [], namespace_re, events, args = jQuery.makeArray( arguments );
  2356. event = args[0] = jQuery.event.fix( event || window.event );
  2357. event.currentTarget = this;
  2358. // Namespaced event handlers
  2359. all = event.type.indexOf(".") < 0 && !event.exclusive;
  2360. if ( !all ) {
  2361. namespaces = event.type.split(".");
  2362. event.type = namespaces.shift();
  2363. namespace_sort = namespaces.slice(0).sort();
  2364. namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
  2365. }
  2366. event.namespace = event.namespace || namespace_sort.join(".");
  2367. events = jQuery.data(this, this.nodeType ? "events" : "__events__");
  2368. if ( typeof events === "function" ) {
  2369. events = events.events;
  2370. }
  2371. handlers = (events || {})[ event.type ];
  2372. if ( events && handlers ) {
  2373. // Clone the handlers to prevent manipulation
  2374. handlers = handlers.slice(0);
  2375. for ( var j = 0, l = handlers.length; j < l; j++ ) {
  2376. var handleObj = handlers[ j ];
  2377. // Filter the functions by class
  2378. if ( all || namespace_re.test( handleObj.namespace ) ) {
  2379. // Pass in a reference to the handler function itself
  2380. // So that we can later remove it
  2381. event.handler = handleObj.handler;
  2382. event.data = handleObj.data;
  2383. event.handleObj = handleObj;
  2384. var ret = handleObj.handler.apply( this, args );
  2385. if ( ret !== undefined ) {
  2386. event.result = ret;
  2387. if ( ret === false ) {
  2388. event.preventDefault();
  2389. event.stopPropagation();
  2390. }
  2391. }
  2392. if ( event.isImmediatePropagationStopped() ) {
  2393. break;
  2394. }
  2395. }
  2396. }
  2397. }
  2398. return event.result;
  2399. },
  2400. props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
  2401. fix: function( event ) {
  2402. /// <summary>
  2403. /// This method is internal.
  2404. /// </summary>
  2405. /// <private />
  2406. if ( event[ jQuery.expando ] ) {
  2407. return event;
  2408. }
  2409. // store a copy of the original event object
  2410. // and "clone" to set read-only properties
  2411. var originalEvent = event;
  2412. event = jQuery.Event( originalEvent );
  2413. for ( var i = this.props.length, prop; i; ) {
  2414. prop = this.props[ --i ];
  2415. event[ prop ] = originalEvent[ prop ];
  2416. }
  2417. // Fix target property, if necessary
  2418. if ( !event.target ) {
  2419. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  2420. }
  2421. // check if target is a textnode (safari)
  2422. if ( event.target.nodeType === 3 ) {
  2423. event.target = event.target.parentNode;
  2424. }
  2425. // Add relatedTarget, if necessary
  2426. if ( !event.relatedTarget && event.fromElement ) {
  2427. event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
  2428. }
  2429. // Calculate pageX/Y if missing and clientX/Y available
  2430. if ( event.pageX == null && event.clientX != null ) {
  2431. var doc = document.documentElement, body = document.body;
  2432. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  2433. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  2434. }
  2435. // Add which for key events
  2436. if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
  2437. event.which = event.charCode != null ? event.charCode : event.keyCode;
  2438. }
  2439. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  2440. if ( !event.metaKey && event.ctrlKey ) {
  2441. event.metaKey = event.ctrlKey;
  2442. }
  2443. // Add which for click: 1 === left; 2 === middle; 3 === right
  2444. // Note: button is not normalized, so don't use it
  2445. if ( !event.which && event.button !== undefined ) {
  2446. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  2447. }
  2448. return event;
  2449. },
  2450. // Deprecated, use jQuery.guid instead
  2451. guid: 1E8,
  2452. // Deprecated, use jQuery.proxy instead
  2453. proxy: jQuery.proxy,
  2454. special: {
  2455. ready: {
  2456. // Make sure the ready event is setup
  2457. setup: jQuery.bindReady,
  2458. teardown: jQuery.noop
  2459. },
  2460. live: {
  2461. add: function( handleObj ) {
  2462. jQuery.event.add( this,
  2463. liveConvert( handleObj.origType, handleObj.selector ),
  2464. jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
  2465. },
  2466. remove: function( handleObj ) {
  2467. jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
  2468. }
  2469. },
  2470. beforeunload: {
  2471. setup: function( data, namespaces, eventHandle ) {
  2472. // We only want to do this special case on windows
  2473. if ( jQuery.isWindow( this ) ) {
  2474. this.onbeforeunload = eventHandle;
  2475. }
  2476. },
  2477. teardown: function( namespaces, eventHandle ) {
  2478. if ( this.onbeforeunload === eventHandle ) {
  2479. this.onbeforeunload = null;
  2480. }
  2481. }
  2482. }
  2483. }
  2484. };
  2485. jQuery.removeEvent = document.removeEventListener ?
  2486. function( elem, type, handle ) {
  2487. if ( elem.removeEventListener ) {
  2488. elem.removeEventListener( type, handle, false );
  2489. }
  2490. } :
  2491. function( elem, type, handle ) {
  2492. if ( elem.detachEvent ) {
  2493. elem.detachEvent( "on" + type, handle );
  2494. }
  2495. };
  2496. jQuery.Event = function( src ) {
  2497. // Allow instantiation without the 'new' keyword
  2498. if ( !this.preventDefault ) {
  2499. return new jQuery.Event( src );
  2500. }
  2501. // Event object
  2502. if ( src && src.type ) {
  2503. this.originalEvent = src;
  2504. this.type = src.type;
  2505. // Event type
  2506. } else {
  2507. this.type = src;
  2508. }
  2509. // timeStamp is buggy for some events on Firefox(#3843)
  2510. // So we won't rely on the native value
  2511. this.timeStamp = jQuery.now();
  2512. // Mark it as fixed
  2513. this[ jQuery.expando ] = true;
  2514. };
  2515. function returnFalse() {
  2516. return false;
  2517. }
  2518. function returnTrue() {
  2519. return true;
  2520. }
  2521. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  2522. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  2523. jQuery.Event.prototype = {
  2524. preventDefault: function() {
  2525. this.isDefaultPrevented = returnTrue;
  2526. var e = this.originalEvent;
  2527. if ( !e ) {
  2528. return;
  2529. }
  2530. // if preventDefault exists run it on the original event
  2531. if ( e.preventDefault ) {
  2532. e.preventDefault();
  2533. // otherwise set the returnValue property of the original event to false (IE)
  2534. } else {
  2535. e.returnValue = false;
  2536. }
  2537. },
  2538. stopPropagation: function() {
  2539. this.isPropagationStopped = returnTrue;
  2540. var e = this.originalEvent;
  2541. if ( !e ) {
  2542. return;
  2543. }
  2544. // if stopPropagation exists run it on the original event
  2545. if ( e.stopPropagation ) {
  2546. e.stopPropagation();
  2547. }
  2548. // otherwise set the cancelBubble property of the original event to true (IE)
  2549. e.cancelBubble = true;
  2550. },
  2551. stopImmediatePropagation: function() {
  2552. this.isImmediatePropagationStopped = returnTrue;
  2553. this.stopPropagation();
  2554. },
  2555. isDefaultPrevented: returnFalse,
  2556. isPropagationStopped: returnFalse,
  2557. isImmediatePropagationStopped: returnFalse
  2558. };
  2559. // Checks if an event happened on an element within another element
  2560. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  2561. var withinElement = function( event ) {
  2562. // Check if mouse(over|out) are still within the same parent element
  2563. var parent = event.relatedTarget;
  2564. // Firefox sometimes assigns relatedTarget a XUL element
  2565. // which we cannot access the parentNode property of
  2566. try {
  2567. // Traverse up the tree
  2568. while ( parent && parent !== this ) {
  2569. parent = parent.parentNode;
  2570. }
  2571. if ( parent !== this ) {
  2572. // set the correct event type
  2573. event.type = event.data;
  2574. // handle event if we actually just moused on to a non sub-element
  2575. jQuery.event.handle.apply( this, arguments );
  2576. }
  2577. // assuming we've left the element since we most likely mousedover a xul element
  2578. } catch(e) { }
  2579. },
  2580. // In case of event delegation, we only need to rename the event.type,
  2581. // liveHandler will take care of the rest.
  2582. delegate = function( event ) {
  2583. event.type = event.data;
  2584. jQuery.event.handle.apply( this, arguments );
  2585. };
  2586. // Create mouseenter and mouseleave events
  2587. jQuery.each({
  2588. mouseenter: "mouseover",
  2589. mouseleave: "mouseout"
  2590. }, function( orig, fix ) {
  2591. jQuery.event.special[ orig ] = {
  2592. setup: function( data ) {
  2593. /// <summary>
  2594. /// This method is internal.
  2595. /// </summary>
  2596. /// <private />
  2597. jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
  2598. },
  2599. teardown: function( data ) {
  2600. /// <summary>
  2601. /// This method is internal.
  2602. /// </summary>
  2603. /// <private />
  2604. jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
  2605. }
  2606. };
  2607. });
  2608. // submit delegation
  2609. if ( !jQuery.support.submitBubbles ) {
  2610. jQuery.event.special.submit = {
  2611. setup: function( data, namespaces ) {
  2612. if ( this.nodeName.toLowerCase() !== "form" ) {
  2613. jQuery.event.add(this, "click.specialSubmit", function( e ) {
  2614. var elem = e.target, type = elem.type;
  2615. if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
  2616. e.liveFired = undefined;
  2617. return trigger( "submit", this, arguments );
  2618. }
  2619. });
  2620. jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
  2621. var elem = e.target, type = elem.type;
  2622. if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
  2623. e.liveFired = undefined;
  2624. return trigger( "submit", this, arguments );
  2625. }
  2626. });
  2627. } else {
  2628. return false;
  2629. }
  2630. },
  2631. teardown: function( namespaces ) {
  2632. jQuery.event.remove( this, ".specialSubmit" );
  2633. }
  2634. };
  2635. }
  2636. // change delegation, happens here so we have bind.
  2637. if ( !jQuery.support.changeBubbles ) {
  2638. var changeFilters,
  2639. getVal = function( elem ) {
  2640. var type = elem.type, val = elem.value;
  2641. if ( type === "radio" || type === "checkbox" ) {
  2642. val = elem.checked;
  2643. } else if ( type === "select-multiple" ) {
  2644. val = elem.selectedIndex > -1 ?
  2645. jQuery.map( elem.options, function( elem ) {
  2646. return elem.selected;
  2647. }).join("-") :
  2648. "";
  2649. } else if ( elem.nodeName.toLowerCase() === "select" ) {
  2650. val = elem.selectedIndex;
  2651. }
  2652. return val;
  2653. },
  2654. testChange = function testChange( e ) {
  2655. var elem = e.target, data, val;
  2656. if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
  2657. return;
  2658. }
  2659. data = jQuery.data( elem, "_change_data" );
  2660. val = getVal(elem);
  2661. // the current data will be also retrieved by beforeactivate
  2662. if ( e.type !== "focusout" || elem.type !== "radio" ) {
  2663. jQuery.data( elem, "_change_data", val );
  2664. }
  2665. if ( data === undefined || val === data ) {
  2666. return;
  2667. }
  2668. if ( data != null || val ) {
  2669. e.type = "change";
  2670. e.liveFired = undefined;
  2671. return jQuery.event.trigger( e, arguments[1], elem );
  2672. }
  2673. };
  2674. jQuery.event.special.change = {
  2675. filters: {
  2676. focusout: testChange,
  2677. beforedeactivate: testChange,
  2678. click: function( e ) {
  2679. var elem = e.target, type = elem.type;
  2680. if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
  2681. return testChange.call( this, e );
  2682. }
  2683. },
  2684. // Change has to be called before submit
  2685. // Keydown will be called before keypress, which is used in submit-event delegation
  2686. keydown: function( e ) {
  2687. var elem = e.target, type = elem.type;
  2688. if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
  2689. (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
  2690. type === "select-multiple" ) {
  2691. return testChange.call( this, e );
  2692. }
  2693. },
  2694. // Beforeactivate happens also before the previous element is blurred
  2695. // with this event you can't trigger a change event, but you can store
  2696. // information
  2697. beforeactivate: function( e ) {
  2698. var elem = e.target;
  2699. jQuery.data( elem, "_change_data", getVal(elem) );
  2700. }
  2701. },
  2702. setup: function( data, namespaces ) {
  2703. if ( this.type === "file" ) {
  2704. return false;
  2705. }
  2706. for ( var type in changeFilters ) {
  2707. jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
  2708. }
  2709. return rformElems.test( this.nodeName );
  2710. },
  2711. teardown: function( namespaces ) {
  2712. jQuery.event.remove( this, ".specialChange" );
  2713. return rformElems.test( this.nodeName );
  2714. }
  2715. };
  2716. changeFilters = jQuery.event.special.change.filters;
  2717. // Handle when the input is .focus()'d
  2718. changeFilters.focus = changeFilters.beforeactivate;
  2719. }
  2720. function trigger( type, elem, args ) {
  2721. args[0].type = type;
  2722. return jQuery.event.handle.apply( elem, args );
  2723. }
  2724. // Create "bubbling" focus and blur events
  2725. if ( document.addEventListener ) {
  2726. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  2727. jQuery.event.special[ fix ] = {
  2728. setup: function() {
  2729. if ( focusCounts[fix]++ === 0 ) {
  2730. document.addEventListener( orig, handler, true );
  2731. }
  2732. },
  2733. teardown: function() {
  2734. if ( --focusCounts[fix] === 0 ) {
  2735. document.removeEventListener( orig, handler, true );
  2736. }
  2737. }
  2738. };
  2739. function handler( e ) {
  2740. e = jQuery.event.fix( e );
  2741. e.type = fix;
  2742. return jQuery.event.trigger( e, null, e.target );
  2743. }
  2744. });
  2745. }
  2746. jQuery.each(["bind", "one"], function( i, name ) {
  2747. /// <summary>
  2748. /// Attach a handler to an event for the elements.
  2749. /// API: <see href="http://api.jquery.com/bind/">.bind()</see>
  2750. /// See Also: <see href="http://api.jquery.com/one/">.one()</see>
  2751. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>
  2752. /// </summary>
  2753. /// <param name="type" type="String">
  2754. /// A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
  2755. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2756. /// </param>
  2757. /// <param name="eventData" optional="true" type="Object">
  2758. /// A map of data that will be passed to the event handler.
  2759. /// </param>
  2760. /// <param name="handler(eventObject)" type="Function">
  2761. /// A function to execute each time the event is triggered.
  2762. /// </param>
  2763. /// <returns type="jQuery" />
  2764. jQuery.fn[ name ] = function( type, data, fn ) {
  2765. // Handle object literals
  2766. if ( typeof type === "object" ) {
  2767. for ( var key in type ) {
  2768. this[ name ](key, data, type[key], fn);
  2769. }
  2770. return this;
  2771. }
  2772. if ( jQuery.isFunction( data ) || data === false ) {
  2773. fn = data;
  2774. data = undefined;
  2775. }
  2776. var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
  2777. jQuery( this ).unbind( event, handler );
  2778. return fn.apply( this, arguments );
  2779. }) : fn;
  2780. if ( type === "unload" && name !== "one" ) {
  2781. this.one( type, data, fn );
  2782. } else {
  2783. for ( var i = 0, l = this.length; i < l; i++ ) {
  2784. jQuery.event.add( this[i], type, handler, data );
  2785. }
  2786. }
  2787. return this;
  2788. };
  2789. });
  2790. jQuery.fn.extend({
  2791. unbind: function( type, fn ) {
  2792. /// <summary>
  2793. /// Remove a previously-attached event handler from the matched elements.
  2794. /// API: <see href="http://api.jquery.com/unbind/">.unbind()</see>
  2795. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2796. /// </summary>
  2797. /// <param name="eventType" type="String" optional="true">
  2798. /// A string containing one or more JavaScript event types, which will be unbound from the set of matched elements. Types include "click" or "submit," or custom event names.
  2799. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2800. /// </param>
  2801. /// <param name="handler(eventObject)" type="Function" optional="true">
  2802. /// The function that is to be no longer executed.
  2803. /// </param>
  2804. /// <returns type="jQuery" />
  2805. // Handle object literals
  2806. if ( typeof type === "object" && !type.preventDefault ) {
  2807. for ( var key in type ) {
  2808. this.unbind(key, type[key]);
  2809. }
  2810. } else {
  2811. for ( var i = 0, l = this.length; i < l; i++ ) {
  2812. jQuery.event.remove( this[i], type, fn );
  2813. }
  2814. }
  2815. return this;
  2816. },
  2817. delegate: function( selector, types, data, fn ) {
  2818. /// <summary>
  2819. /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
  2820. /// API: <see href="http://api.jquery.com/delegate/">.delegate()</see>
  2821. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2822. /// </summary>
  2823. /// <param name="selector" type="String">
  2824. /// A selector which will be used to filter the event results.
  2825. /// </param>
  2826. /// <param name="eventType" type="String">
  2827. /// A string containing one or more JavaScript event types such as "click" or "submit," or custom event names.
  2828. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2829. /// </param>
  2830. /// <param name="handler(eventObject)" type="Function">
  2831. /// A function to execute at the time the event is triggered.
  2832. /// </param>
  2833. /// <returns type="jQuery" />
  2834. return this.live( types, data, fn, selector );
  2835. },
  2836. undelegate: function( selector, types, fn ) {
  2837. /// <summary>
  2838. /// Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements.
  2839. /// API: <see href="http://api.jquery.com/undelegate/">.undelegate()</see>
  2840. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2841. /// </summary>
  2842. /// <param name="selector" type="String">
  2843. /// A selector which will be used to filter the event results.
  2844. /// </param>
  2845. /// <param name="eventType" type="String">
  2846. /// A string containing one or more JavaScript event types such as "click" or "submit," or custom event names.
  2847. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2848. /// </param>
  2849. /// <param name="handler(eventObject)" type="Function" optional="true">
  2850. /// A function to execute at the time the event is triggered.
  2851. /// </param>
  2852. /// <returns type="jQuery" />
  2853. if ( arguments.length === 0 ) {
  2854. return this.unbind( "live" );
  2855. } else {
  2856. return this.die( types, null, fn, selector );
  2857. }
  2858. },
  2859. trigger: function( type, data ) {
  2860. /// <summary>
  2861. /// Execute all handlers and behaviors attached to the matched elements for the given event type.
  2862. /// API: <see href="http://api.jquery.com/trigger/">.trigger()</see>
  2863. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2864. /// </summary>
  2865. /// <param name="eventType" type="String">
  2866. /// A string containing one or more JavaScript event types such as "click" or "submit," or custom event names.
  2867. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2868. /// </param>
  2869. /// <param name="extraParameters" type="Array" optional="true">
  2870. /// An array of additional parameters to pass along to the event handler.
  2871. /// </param>
  2872. /// <returns type="jQuery" />
  2873. return this.each(function() {
  2874. jQuery.event.trigger( type, data, this );
  2875. });
  2876. },
  2877. triggerHandler: function( type, data ) {
  2878. /// <summary>
  2879. /// Execute all handlers attached to an element for an event.
  2880. /// API: <see href="http://api.jquery.com/triggerHandler/">.triggerHandler()</see>
  2881. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2882. /// </summary>
  2883. /// <param name="eventType" type="String">
  2884. /// A string containing one or more JavaScript event types such as "click" or "submit," or custom event names.
  2885. /// blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .
  2886. /// </param>
  2887. /// <param name="extraParameters" type="Array" optional="true">
  2888. /// An array of additional parameters to pass along to the event handler.
  2889. /// </param>
  2890. /// <returns type="jQuery" />
  2891. if ( this[0] ) {
  2892. var event = jQuery.Event( type );
  2893. event.preventDefault();
  2894. event.stopPropagation();
  2895. jQuery.event.trigger( event, data, this[0] );
  2896. return event.result;
  2897. }
  2898. },
  2899. toggle: function( fn ) {
  2900. /// <summary>
  2901. /// Display or hide the matched elements.
  2902. /// API: <see href="http://api.jquery.com/toggle/">.toggle()</see>
  2903. /// Categories: <see href="http://api.jquery.com/category/effects/">Effects</see>, <see href="http://api.jquery.com/category/effects/basics/">Basics</see>
  2904. /// </summary>
  2905. /// <param name="duration" type="String" optional="true">
  2906. /// A string or number determining how long the animation will run.
  2907. /// </param>
  2908. /// <param name="easing" type="String" optional="true">
  2909. /// A string indicating which easing function to use for the transition.
  2910. /// </param>
  2911. /// <param name="callback" type="Function" optional="true">
  2912. /// A function to call once the animation is complete.
  2913. /// </param>
  2914. /// <returns type="jQuery" />
  2915. // Save reference to arguments for access in closure
  2916. var args = arguments, i = 1;
  2917. // link all the functions, so any of them can unbind this click handler
  2918. while ( i < args.length ) {
  2919. jQuery.proxy( fn, args[ i++ ] );
  2920. }
  2921. return this.click( jQuery.proxy( fn, function( event ) {
  2922. // Figure out which function to execute
  2923. var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
  2924. jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
  2925. // Make sure that clicks stop
  2926. event.preventDefault();
  2927. // and execute the function
  2928. return args[ lastToggle ].apply( this, arguments ) || false;
  2929. }));
  2930. },
  2931. hover: function( fnOver, fnOut ) {
  2932. /// <summary>
  2933. /// Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
  2934. /// API: <see href="http://api.jquery.com/hover/">.hover()</see>
  2935. /// Categories: <see href="http://api.jquery.com/category/effects/">Effects</see>, <see href="http://api.jquery.com/category/effects/mouse-events/">Mouse Events</see>
  2936. /// </summary>
  2937. /// <param name="handlerIn(eventObject)" type="Function">
  2938. /// A function to execute when the mouse pointer enters the element.
  2939. /// </param>
  2940. /// <param name="handlerOut(eventObject)" type="Function" optional="true">
  2941. /// A function to execute when the mouse pointer leaves the element.
  2942. /// </param>
  2943. /// <returns type="jQuery" />
  2944. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  2945. }
  2946. });
  2947. var liveMap = {
  2948. focus: "focusin",
  2949. blur: "focusout",
  2950. mouseenter: "mouseover",
  2951. mouseleave: "mouseout"
  2952. };
  2953. jQuery.each(["live", "die"], function( i, name ) {
  2954. /// <summary>
  2955. /// Attach a handler to the event for all elements which match the current selector, now or
  2956. /// in the future.
  2957. /// API: <see href="http://api.jquery.com/live/">.live()</see>
  2958. /// See also: <see href="http://api.jquery.com/die/">.die()</see>
  2959. /// Categories: <see href="http://api.jquery.com/category/events/">Events</see>, <see href="http://api.jquery.com/category/events/event-handler-attachment/">Event Handler Attatchment</see>
  2960. /// </summary>
  2961. /// <param name="eventType" type="String">
  2962. /// A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names, as well.
  2963. /// </param>
  2964. /// <param name="eventData" type="Object" optional="true">
  2965. /// A map of data that will be passed to the event handler.
  2966. /// </param>
  2967. /// <param name="handler" type="Function">
  2968. /// A function to execute at the time the event is triggered.
  2969. /// </param>
  2970. /// <returns type="jQuery" />
  2971. jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
  2972. var type, i = 0, match, namespaces, preType,
  2973. selector = origSelector || this.selector,
  2974. context = origSelector ? this : jQuery( this.context );
  2975. if ( typeof types === "object" && !types.preventDefault ) {
  2976. for ( var key in types ) {
  2977. context[ name ]( key, data, types[key], selector );
  2978. }
  2979. return this;
  2980. }
  2981. if ( jQuery.isFunction( data ) ) {
  2982. fn = data;
  2983. data = undefined;
  2984. }
  2985. types = (types || "").split(" ");
  2986. while ( (type = types[ i++ ]) != null ) {
  2987. match = rnamespaces.exec( type );
  2988. namespaces = "";
  2989. if ( match ) {
  2990. namespaces = match[0];
  2991. type = type.replace( rnamespaces, "" );
  2992. }
  2993. if ( type === "hover" ) {
  2994. types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
  2995. continue;
  2996. }
  2997. preType = type;
  2998. if ( type === "focus" || type === "blur" ) {
  2999. types.push( liveMap[ type ] + namespaces );
  3000. type = type + namespaces;
  3001. } else {
  3002. type = (liveMap[ type ] || type) + namespaces;
  3003. }
  3004. if ( name === "live" ) {
  3005. // bind live handler
  3006. for ( var j = 0, l = context.length; j < l; j++ ) {
  3007. jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
  3008. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
  3009. }
  3010. } else {
  3011. // unbind live handler
  3012. context.unbind( "live." + liveConvert( type, selector ), fn );
  3013. }
  3014. }
  3015. return this;
  3016. };
  3017. });
  3018. function liveHandler( event ) {
  3019. var stop, maxLevel, elems = [], selectors = [],
  3020. related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
  3021. events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
  3022. if ( typeof events === "function" ) {
  3023. events = events.events;
  3024. }
  3025. // Make sure we avoid non-left-click bubbling in Firefox (#3861)
  3026. if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
  3027. return;
  3028. }
  3029. if ( event.namespace ) {
  3030. namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
  3031. }
  3032. event.liveFired = this;
  3033. var live = events.live.slice(0);
  3034. for ( j = 0; j < live.length; j++ ) {
  3035. handleObj = live[j];
  3036. if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
  3037. selectors.push( handleObj.selector );
  3038. } else {
  3039. live.splice( j--, 1 );
  3040. }
  3041. }
  3042. match = jQuery( event.target ).closest( selectors, event.currentTarget );
  3043. for ( i = 0, l = match.length; i < l; i++ ) {
  3044. close = match[i];
  3045. for ( j = 0; j < live.length; j++ ) {
  3046. handleObj = live[j];
  3047. if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
  3048. elem = close.elem;
  3049. related = null;
  3050. // Those two events require additional checking
  3051. if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
  3052. event.type = handleObj.preType;
  3053. related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
  3054. }
  3055. if ( !related || related !== elem ) {
  3056. elems.push({ elem: elem, handleObj: handleObj, level: close.level });
  3057. }
  3058. }
  3059. }
  3060. }
  3061. for ( i = 0, l = elems.length; i < l; i++ ) {
  3062. match = elems[i];
  3063. if ( maxLevel && match.level > maxLevel ) {
  3064. break;
  3065. }
  3066. event.currentTarget = match.elem;
  3067. event.data = match.handleObj.data;
  3068. event.handleObj = match.handleObj;
  3069. ret = match.handleObj.origHandler.apply( match.elem, arguments );
  3070. if ( ret === false || event.isPropagationStopped() ) {
  3071. maxLevel = match.level;
  3072. if ( ret === false ) {
  3073. stop = false;
  3074. }
  3075. }
  3076. }
  3077. return stop;
  3078. }
  3079. function liveConvert( type, selector ) {
  3080. return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
  3081. }
  3082. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  3083. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  3084. "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
  3085. // Handle event binding
  3086. jQuery.fn[ name ] = function( data, fn ) {
  3087. if ( fn == null ) {
  3088. fn = data;
  3089. data = null;
  3090. }
  3091. return arguments.length > 0 ?
  3092. this.bind( name, data, fn ) :
  3093. this.trigger( name );
  3094. };
  3095. if ( jQuery.attrFn ) {
  3096. jQuery.attrFn[ name ] = true;
  3097. }
  3098. });
  3099. // Prevent memory leaks in IE
  3100. // Window isn't included so as not to unbind existing unload events
  3101. // More info:
  3102. // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
  3103. if ( window.attachEvent && !window.addEventListener ) {
  3104. jQuery(window).bind("unload", function() {
  3105. for ( var id in jQuery.cache ) {
  3106. if ( jQuery.cache[ id ].handle ) {
  3107. // Try/Catch is to handle iframes being unloaded, see #4280
  3108. try {
  3109. jQuery.event.remove( jQuery.cache[ id ].handle.elem );
  3110. } catch(e) {}
  3111. }
  3112. }
  3113. });
  3114. }
  3115. /*!
  3116. * Sizzle CSS Selector Engine - v1.0
  3117. * Copyright 2009, The Dojo Foundation
  3118. * Released under the MIT, BSD, and GPL Licenses.
  3119. * More information: http://sizzlejs.com/
  3120. */
  3121. (function(){
  3122. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
  3123. done = 0,
  3124. toString = Object.prototype.toString,
  3125. hasDuplicate = false,
  3126. baseHasDuplicate = true;
  3127. // Here we check if the JavaScript engine is using some sort of
  3128. // optimization where it does not always call our comparision
  3129. // function. If that is the case, discard the hasDuplicate value.
  3130. // Thus far that includes Google Chrome.
  3131. [0, 0].sort(function(){
  3132. baseHasDuplicate = false;
  3133. return 0;
  3134. });
  3135. var Sizzle = function(selector, context, results, seed) {
  3136. results = results || [];
  3137. context = context || document;
  3138. var origContext = context;
  3139. if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
  3140. return [];
  3141. }
  3142. if ( !selector || typeof selector !== "string" ) {
  3143. return results;
  3144. }
  3145. var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
  3146. soFar = selector, ret, cur, pop, i;
  3147. // Reset the position of the chunker regexp (start from head)
  3148. do {
  3149. chunker.exec("");
  3150. m = chunker.exec(soFar);
  3151. if ( m ) {
  3152. soFar = m[3];
  3153. parts.push( m[1] );
  3154. if ( m[2] ) {
  3155. extra = m[3];
  3156. break;
  3157. }
  3158. }
  3159. } while ( m );
  3160. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  3161. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  3162. set = posProcess( parts[0] + parts[1], context );
  3163. } else {
  3164. set = Expr.relative[ parts[0] ] ?
  3165. [ context ] :
  3166. Sizzle( parts.shift(), context );
  3167. while ( parts.length ) {
  3168. selector = parts.shift();
  3169. if ( Expr.relative[ selector ] ) {
  3170. selector += parts.shift();
  3171. }
  3172. set = posProcess( selector, set );
  3173. }
  3174. }
  3175. } else {
  3176. // Take a shortcut and set the context if the root selector is an ID
  3177. // (but not if it'll be faster if the inner selector is an ID)
  3178. if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
  3179. Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
  3180. ret = Sizzle.find( parts.shift(), context, contextXML );
  3181. context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
  3182. }
  3183. if ( context ) {
  3184. ret = seed ?
  3185. { expr: parts.pop(), set: makeArray(seed) } :
  3186. Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
  3187. set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
  3188. if ( parts.length > 0 ) {
  3189. checkSet = makeArray(set);
  3190. } else {
  3191. prune = false;
  3192. }
  3193. while ( parts.length ) {
  3194. cur = parts.pop();
  3195. pop = cur;
  3196. if ( !Expr.relative[ cur ] ) {
  3197. cur = "";
  3198. } else {
  3199. pop = parts.pop();
  3200. }
  3201. if ( pop == null ) {
  3202. pop = context;
  3203. }
  3204. Expr.relative[ cur ]( checkSet, pop, contextXML );
  3205. }
  3206. } else {
  3207. checkSet = parts = [];
  3208. }
  3209. }
  3210. if ( !checkSet ) {
  3211. checkSet = set;
  3212. }
  3213. if ( !checkSet ) {
  3214. Sizzle.error( cur || selector );
  3215. }
  3216. if ( toString.call(checkSet) === "[object Array]" ) {
  3217. if ( !prune ) {
  3218. results.push.apply( results, checkSet );
  3219. } else if ( context && context.nodeType === 1 ) {
  3220. for ( i = 0; checkSet[i] != null; i++ ) {
  3221. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
  3222. results.push( set[i] );
  3223. }
  3224. }
  3225. } else {
  3226. for ( i = 0; checkSet[i] != null; i++ ) {
  3227. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  3228. results.push( set[i] );
  3229. }
  3230. }
  3231. }
  3232. } else {
  3233. makeArray( checkSet, results );
  3234. }
  3235. if ( extra ) {
  3236. Sizzle( extra, origContext, results, seed );
  3237. Sizzle.uniqueSort( results );
  3238. }
  3239. return results;
  3240. };
  3241. Sizzle.uniqueSort = function(results){
  3242. /// <summary>
  3243. /// Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
  3244. /// API: <see href="http://api.jquery.com/jQuery.unique/">jQuery.unique()</see>
  3245. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  3246. /// </summary>
  3247. /// <param name="array" type="Array">
  3248. /// The Array of DOM elements.
  3249. /// </param>
  3250. /// <returns type="Array" />
  3251. if ( sortOrder ) {
  3252. hasDuplicate = baseHasDuplicate;
  3253. results.sort(sortOrder);
  3254. if ( hasDuplicate ) {
  3255. for ( var i = 1; i < results.length; i++ ) {
  3256. if ( results[i] === results[i-1] ) {
  3257. results.splice(i--, 1);
  3258. }
  3259. }
  3260. }
  3261. }
  3262. return results;
  3263. };
  3264. Sizzle.matches = function(expr, set){
  3265. return Sizzle(expr, null, null, set);
  3266. };
  3267. Sizzle.matchesSelector = function(node, expr){
  3268. return Sizzle(expr, null, null, [node]).length > 0;
  3269. };
  3270. Sizzle.find = function(expr, context, isXML){
  3271. var set;
  3272. if ( !expr ) {
  3273. return [];
  3274. }
  3275. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  3276. var type = Expr.order[i], match;
  3277. if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
  3278. var left = match[1];
  3279. match.splice(1,1);
  3280. if ( left.substr( left.length - 1 ) !== "\\" ) {
  3281. match[1] = (match[1] || "").replace(/\\/g, "");
  3282. set = Expr.find[ type ]( match, context, isXML );
  3283. if ( set != null ) {
  3284. expr = expr.replace( Expr.match[ type ], "" );
  3285. break;
  3286. }
  3287. }
  3288. }
  3289. }
  3290. if ( !set ) {
  3291. set = context.getElementsByTagName("*");
  3292. }
  3293. return {set: set, expr: expr};
  3294. };
  3295. Sizzle.filter = function(expr, set, inplace, not){
  3296. var old = expr, result = [], curLoop = set, match, anyFound,
  3297. isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);
  3298. while ( expr && set.length ) {
  3299. for ( var type in Expr.filter ) {
  3300. if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
  3301. var filter = Expr.filter[ type ], found, item, left = match[1];
  3302. anyFound = false;
  3303. match.splice(1,1);
  3304. if ( left.substr( left.length - 1 ) === "\\" ) {
  3305. continue;
  3306. }
  3307. if ( curLoop === result ) {
  3308. result = [];
  3309. }
  3310. if ( Expr.preFilter[ type ] ) {
  3311. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  3312. if ( !match ) {
  3313. anyFound = found = true;
  3314. } else if ( match === true ) {
  3315. continue;
  3316. }
  3317. }
  3318. if ( match ) {
  3319. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  3320. if ( item ) {
  3321. found = filter( item, match, i, curLoop );
  3322. var pass = not ^ !!found;
  3323. if ( inplace && found != null ) {
  3324. if ( pass ) {
  3325. anyFound = true;
  3326. } else {
  3327. curLoop[i] = false;
  3328. }
  3329. } else if ( pass ) {
  3330. result.push( item );
  3331. anyFound = true;
  3332. }
  3333. }
  3334. }
  3335. }
  3336. if ( found !== undefined ) {
  3337. if ( !inplace ) {
  3338. curLoop = result;
  3339. }
  3340. expr = expr.replace( Expr.match[ type ], "" );
  3341. if ( !anyFound ) {
  3342. return [];
  3343. }
  3344. break;
  3345. }
  3346. }
  3347. }
  3348. // Improper expression
  3349. if ( expr === old ) {
  3350. if ( anyFound == null ) {
  3351. Sizzle.error( expr );
  3352. } else {
  3353. break;
  3354. }
  3355. }
  3356. old = expr;
  3357. }
  3358. return curLoop;
  3359. };
  3360. Sizzle.error = function( msg ) {
  3361. throw "Syntax error, unrecognized expression: " + msg;
  3362. };
  3363. var Expr = Sizzle.selectors = {
  3364. order: [ "ID", "NAME", "TAG" ],
  3365. match: {
  3366. ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  3367. CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  3368. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
  3369. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  3370. TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
  3371. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
  3372. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
  3373. PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
  3374. },
  3375. leftMatch: {},
  3376. attrMap: {
  3377. "class": "className",
  3378. "for": "htmlFor"
  3379. },
  3380. attrHandle: {
  3381. href: function(elem){
  3382. return elem.getAttribute("href");
  3383. }
  3384. },
  3385. relative: {
  3386. "+": function(checkSet, part){
  3387. var isPartStr = typeof part === "string",
  3388. isTag = isPartStr && !/\W/.test(part),
  3389. isPartStrNotTag = isPartStr && !isTag;
  3390. if ( isTag ) {
  3391. part = part.toLowerCase();
  3392. }
  3393. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  3394. if ( (elem = checkSet[i]) ) {
  3395. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  3396. checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
  3397. elem || false :
  3398. elem === part;
  3399. }
  3400. }
  3401. if ( isPartStrNotTag ) {
  3402. Sizzle.filter( part, checkSet, true );
  3403. }
  3404. },
  3405. ">": function(checkSet, part){
  3406. var isPartStr = typeof part === "string",
  3407. elem, i = 0, l = checkSet.length;
  3408. if ( isPartStr && !/\W/.test(part) ) {
  3409. part = part.toLowerCase();
  3410. for ( ; i < l; i++ ) {
  3411. elem = checkSet[i];
  3412. if ( elem ) {
  3413. var parent = elem.parentNode;
  3414. checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
  3415. }
  3416. }
  3417. } else {
  3418. for ( ; i < l; i++ ) {
  3419. elem = checkSet[i];
  3420. if ( elem ) {
  3421. checkSet[i] = isPartStr ?
  3422. elem.parentNode :
  3423. elem.parentNode === part;
  3424. }
  3425. }
  3426. if ( isPartStr ) {
  3427. Sizzle.filter( part, checkSet, true );
  3428. }
  3429. }
  3430. },
  3431. "": function(checkSet, part, isXML){
  3432. var doneName = done++, checkFn = dirCheck, nodeCheck;
  3433. if ( typeof part === "string" && !/\W/.test(part) ) {
  3434. part = part.toLowerCase();
  3435. nodeCheck = part;
  3436. checkFn = dirNodeCheck;
  3437. }
  3438. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  3439. },
  3440. "~": function(checkSet, part, isXML){
  3441. var doneName = done++, checkFn = dirCheck, nodeCheck;
  3442. if ( typeof part === "string" && !/\W/.test(part) ) {
  3443. part = part.toLowerCase();
  3444. nodeCheck = part;
  3445. checkFn = dirNodeCheck;
  3446. }
  3447. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  3448. }
  3449. },
  3450. find: {
  3451. ID: function(match, context, isXML){
  3452. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  3453. var m = context.getElementById(match[1]);
  3454. // Check parentNode to catch when Blackberry 4.6 returns
  3455. // nodes that are no longer in the document #6963
  3456. return m && m.parentNode ? [m] : [];
  3457. }
  3458. },
  3459. NAME: function(match, context){
  3460. if ( typeof context.getElementsByName !== "undefined" ) {
  3461. var ret = [], results = context.getElementsByName(match[1]);
  3462. for ( var i = 0, l = results.length; i < l; i++ ) {
  3463. if ( results[i].getAttribute("name") === match[1] ) {
  3464. ret.push( results[i] );
  3465. }
  3466. }
  3467. return ret.length === 0 ? null : ret;
  3468. }
  3469. },
  3470. TAG: function(match, context){
  3471. return context.getElementsByTagName(match[1]);
  3472. }
  3473. },
  3474. preFilter: {
  3475. CLASS: function(match, curLoop, inplace, result, not, isXML){
  3476. match = " " + match[1].replace(/\\/g, "") + " ";
  3477. if ( isXML ) {
  3478. return match;
  3479. }
  3480. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  3481. if ( elem ) {
  3482. if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
  3483. if ( !inplace ) {
  3484. result.push( elem );
  3485. }
  3486. } else if ( inplace ) {
  3487. curLoop[i] = false;
  3488. }
  3489. }
  3490. }
  3491. return false;
  3492. },
  3493. ID: function(match){
  3494. return match[1].replace(/\\/g, "");
  3495. },
  3496. TAG: function(match, curLoop){
  3497. return match[1].toLowerCase();
  3498. },
  3499. CHILD: function(match){
  3500. if ( match[1] === "nth" ) {
  3501. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  3502. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  3503. match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
  3504. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  3505. // calculate the numbers (first)n+(last) including if they are negative
  3506. match[2] = (test[1] + (test[2] || 1)) - 0;
  3507. match[3] = test[3] - 0;
  3508. }
  3509. // TODO: Move to normal caching system
  3510. match[0] = done++;
  3511. return match;
  3512. },
  3513. ATTR: function(match, curLoop, inplace, result, not, isXML){
  3514. var name = match[1].replace(/\\/g, "");
  3515. if ( !isXML && Expr.attrMap[name] ) {
  3516. match[1] = Expr.attrMap[name];
  3517. }
  3518. if ( match[2] === "~=" ) {
  3519. match[4] = " " + match[4] + " ";
  3520. }
  3521. return match;
  3522. },
  3523. PSEUDO: function(match, curLoop, inplace, result, not){
  3524. if ( match[1] === "not" ) {
  3525. // If we're dealing with a complex expression, or a simple one
  3526. if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
  3527. match[3] = Sizzle(match[3], null, null, curLoop);
  3528. } else {
  3529. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  3530. if ( !inplace ) {
  3531. result.push.apply( result, ret );
  3532. }
  3533. return false;
  3534. }
  3535. } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
  3536. return true;
  3537. }
  3538. return match;
  3539. },
  3540. POS: function(match){
  3541. match.unshift( true );
  3542. return match;
  3543. }
  3544. },
  3545. filters: {
  3546. enabled: function(elem){
  3547. return elem.disabled === false && elem.type !== "hidden";
  3548. },
  3549. disabled: function(elem){
  3550. return elem.disabled === true;
  3551. },
  3552. checked: function(elem){
  3553. return elem.checked === true;
  3554. },
  3555. selected: function(elem){
  3556. // Accessing this property makes selected-by-default
  3557. // options in Safari work properly
  3558. elem.parentNode.selectedIndex;
  3559. return elem.selected === true;
  3560. },
  3561. parent: function(elem){
  3562. return !!elem.firstChild;
  3563. },
  3564. empty: function(elem){
  3565. return !elem.firstChild;
  3566. },
  3567. has: function(elem, i, match){
  3568. /// <summary>
  3569. /// Internal use only; use hasClass('class')
  3570. /// </summary>
  3571. /// <private />
  3572. return !!Sizzle( match[3], elem ).length;
  3573. },
  3574. header: function(elem){
  3575. return (/h\d/i).test( elem.nodeName );
  3576. },
  3577. text: function(elem){
  3578. return "text" === elem.type;
  3579. },
  3580. radio: function(elem){
  3581. return "radio" === elem.type;
  3582. },
  3583. checkbox: function(elem){
  3584. return "checkbox" === elem.type;
  3585. },
  3586. file: function(elem){
  3587. return "file" === elem.type;
  3588. },
  3589. password: function(elem){
  3590. return "password" === elem.type;
  3591. },
  3592. submit: function(elem){
  3593. return "submit" === elem.type;
  3594. },
  3595. image: function(elem){
  3596. return "image" === elem.type;
  3597. },
  3598. reset: function(elem){
  3599. return "reset" === elem.type;
  3600. },
  3601. button: function(elem){
  3602. return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
  3603. },
  3604. input: function(elem){
  3605. return (/input|select|textarea|button/i).test(elem.nodeName);
  3606. }
  3607. },
  3608. setFilters: {
  3609. first: function(elem, i){
  3610. return i === 0;
  3611. },
  3612. last: function(elem, i, match, array){
  3613. return i === array.length - 1;
  3614. },
  3615. even: function(elem, i){
  3616. return i % 2 === 0;
  3617. },
  3618. odd: function(elem, i){
  3619. return i % 2 === 1;
  3620. },
  3621. lt: function(elem, i, match){
  3622. return i < match[3] - 0;
  3623. },
  3624. gt: function(elem, i, match){
  3625. return i > match[3] - 0;
  3626. },
  3627. nth: function(elem, i, match){
  3628. return match[3] - 0 === i;
  3629. },
  3630. eq: function(elem, i, match){
  3631. return match[3] - 0 === i;
  3632. }
  3633. },
  3634. filter: {
  3635. PSEUDO: function(elem, match, i, array){
  3636. var name = match[1], filter = Expr.filters[ name ];
  3637. if ( filter ) {
  3638. return filter( elem, i, match, array );
  3639. } else if ( name === "contains" ) {
  3640. return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
  3641. } else if ( name === "not" ) {
  3642. var not = match[3];
  3643. for ( var j = 0, l = not.length; j < l; j++ ) {
  3644. if ( not[j] === elem ) {
  3645. return false;
  3646. }
  3647. }
  3648. return true;
  3649. } else {
  3650. Sizzle.error( "Syntax error, unrecognized expression: " + name );
  3651. }
  3652. },
  3653. CHILD: function(elem, match){
  3654. var type = match[1], node = elem;
  3655. switch (type) {
  3656. case 'only':
  3657. case 'first':
  3658. while ( (node = node.previousSibling) ) {
  3659. if ( node.nodeType === 1 ) {
  3660. return false;
  3661. }
  3662. }
  3663. if ( type === "first" ) {
  3664. return true;
  3665. }
  3666. node = elem;
  3667. case 'last':
  3668. while ( (node = node.nextSibling) ) {
  3669. if ( node.nodeType === 1 ) {
  3670. return false;
  3671. }
  3672. }
  3673. return true;
  3674. case 'nth':
  3675. var first = match[2], last = match[3];
  3676. if ( first === 1 && last === 0 ) {
  3677. return true;
  3678. }
  3679. var doneName = match[0],
  3680. parent = elem.parentNode;
  3681. if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
  3682. var count = 0;
  3683. for ( node = parent.firstChild; node; node = node.nextSibling ) {
  3684. if ( node.nodeType === 1 ) {
  3685. node.nodeIndex = ++count;
  3686. }
  3687. }
  3688. parent.sizcache = doneName;
  3689. }
  3690. var diff = elem.nodeIndex - last;
  3691. if ( first === 0 ) {
  3692. return diff === 0;
  3693. } else {
  3694. return ( diff % first === 0 && diff / first >= 0 );
  3695. }
  3696. }
  3697. },
  3698. ID: function(elem, match){
  3699. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  3700. },
  3701. TAG: function(elem, match){
  3702. return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
  3703. },
  3704. CLASS: function(elem, match){
  3705. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  3706. .indexOf( match ) > -1;
  3707. },
  3708. ATTR: function(elem, match){
  3709. var name = match[1],
  3710. result = Expr.attrHandle[ name ] ?
  3711. Expr.attrHandle[ name ]( elem ) :
  3712. elem[ name ] != null ?
  3713. elem[ name ] :
  3714. elem.getAttribute( name ),
  3715. value = result + "",
  3716. type = match[2],
  3717. check = match[4];
  3718. return result == null ?
  3719. type === "!=" :
  3720. type === "=" ?
  3721. value === check :
  3722. type === "*=" ?
  3723. value.indexOf(check) >= 0 :
  3724. type === "~=" ?
  3725. (" " + value + " ").indexOf(check) >= 0 :
  3726. !check ?
  3727. value && result !== false :
  3728. type === "!=" ?
  3729. value !== check :
  3730. type === "^=" ?
  3731. value.indexOf(check) === 0 :
  3732. type === "$=" ?
  3733. value.substr(value.length - check.length) === check :
  3734. type === "|=" ?
  3735. value === check || value.substr(0, check.length + 1) === check + "-" :
  3736. false;
  3737. },
  3738. POS: function(elem, match, i, array){
  3739. var name = match[2], filter = Expr.setFilters[ name ];
  3740. if ( filter ) {
  3741. return filter( elem, i, match, array );
  3742. }
  3743. }
  3744. }
  3745. };
  3746. var origPOS = Expr.match.POS,
  3747. fescape = function(all, num){
  3748. return "\\" + (num - 0 + 1);
  3749. };
  3750. for ( var type in Expr.match ) {
  3751. Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
  3752. Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
  3753. }
  3754. var makeArray = function(array, results) {
  3755. array = Array.prototype.slice.call( array, 0 );
  3756. if ( results ) {
  3757. results.push.apply( results, array );
  3758. return results;
  3759. }
  3760. return array;
  3761. };
  3762. // Perform a simple check to determine if the browser is capable of
  3763. // converting a NodeList to an array using builtin methods.
  3764. // Also verifies that the returned array holds DOM nodes
  3765. // (which is not the case in the Blackberry browser)
  3766. try {
  3767. Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
  3768. // Provide a fallback method if it does not work
  3769. } catch(e){
  3770. makeArray = function(array, results) {
  3771. var ret = results || [], i = 0;
  3772. if ( toString.call(array) === "[object Array]" ) {
  3773. Array.prototype.push.apply( ret, array );
  3774. } else {
  3775. if ( typeof array.length === "number" ) {
  3776. for ( var l = array.length; i < l; i++ ) {
  3777. ret.push( array[i] );
  3778. }
  3779. } else {
  3780. for ( ; array[i]; i++ ) {
  3781. ret.push( array[i] );
  3782. }
  3783. }
  3784. }
  3785. return ret;
  3786. };
  3787. }
  3788. var sortOrder, siblingCheck;
  3789. if ( document.documentElement.compareDocumentPosition ) {
  3790. sortOrder = function( a, b ) {
  3791. if ( a === b ) {
  3792. hasDuplicate = true;
  3793. return 0;
  3794. }
  3795. if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
  3796. return a.compareDocumentPosition ? -1 : 1;
  3797. }
  3798. return a.compareDocumentPosition(b) & 4 ? -1 : 1;
  3799. };
  3800. } else {
  3801. sortOrder = function( a, b ) {
  3802. var ap = [], bp = [], aup = a.parentNode, bup = b.parentNode,
  3803. cur = aup, al, bl;
  3804. // The nodes are identical, we can exit early
  3805. if ( a === b ) {
  3806. hasDuplicate = true;
  3807. return 0;
  3808. // If the nodes are siblings (or identical) we can do a quick check
  3809. } else if ( aup === bup ) {
  3810. return siblingCheck( a, b );
  3811. // If no parents were found then the nodes are disconnected
  3812. } else if ( !aup ) {
  3813. return -1;
  3814. } else if ( !bup ) {
  3815. return 1;
  3816. }
  3817. // Otherwise they're somewhere else in the tree so we need
  3818. // to build up a full list of the parentNodes for comparison
  3819. while ( cur ) {
  3820. ap.unshift( cur );
  3821. cur = cur.parentNode;
  3822. }
  3823. cur = bup;
  3824. while ( cur ) {
  3825. bp.unshift( cur );
  3826. cur = cur.parentNode;
  3827. }
  3828. al = ap.length;
  3829. bl = bp.length;
  3830. // Start walking down the tree looking for a discrepancy
  3831. for ( var i = 0; i < al && i < bl; i++ ) {
  3832. if ( ap[i] !== bp[i] ) {
  3833. return siblingCheck( ap[i], bp[i] );
  3834. }
  3835. }
  3836. // We ended someplace up the tree so do a sibling check
  3837. return i === al ?
  3838. siblingCheck( a, bp[i], -1 ) :
  3839. siblingCheck( ap[i], b, 1 );
  3840. };
  3841. siblingCheck = function( a, b, ret ) {
  3842. if ( a === b ) {
  3843. return ret;
  3844. }
  3845. var cur = a.nextSibling;
  3846. while ( cur ) {
  3847. if ( cur === b ) {
  3848. return -1;
  3849. }
  3850. cur = cur.nextSibling;
  3851. }
  3852. return 1;
  3853. };
  3854. }
  3855. // Utility function for retreiving the text value of an array of DOM nodes
  3856. Sizzle.getText = function( elems ) {
  3857. var ret = "", elem;
  3858. for ( var i = 0; elems[i]; i++ ) {
  3859. elem = elems[i];
  3860. // Get the text from text nodes and CDATA nodes
  3861. if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
  3862. ret += elem.nodeValue;
  3863. // Traverse everything else, except comment nodes
  3864. } else if ( elem.nodeType !== 8 ) {
  3865. ret += Sizzle.getText( elem.childNodes );
  3866. }
  3867. }
  3868. return ret;
  3869. };
  3870. // Check to see if the browser returns elements by name when
  3871. // querying by getElementById (and provide a workaround)
  3872. (function(){
  3873. // We're going to inject a fake input element with a specified name
  3874. var form = document.createElement("div"),
  3875. id = "script" + (new Date()).getTime();
  3876. form.innerHTML = "<a name='" + id + "'/>";
  3877. // Inject it into the root element, check its status, and remove it quickly
  3878. var root = document.documentElement;
  3879. root.insertBefore( form, root.firstChild );
  3880. // The workaround has to do additional checks after a getElementById
  3881. // Which slows things down for other browsers (hence the branching)
  3882. if ( document.getElementById( id ) ) {
  3883. Expr.find.ID = function(match, context, isXML){
  3884. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  3885. var m = context.getElementById(match[1]);
  3886. return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
  3887. }
  3888. };
  3889. Expr.filter.ID = function(elem, match){
  3890. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  3891. return elem.nodeType === 1 && node && node.nodeValue === match;
  3892. };
  3893. }
  3894. root.removeChild( form );
  3895. root = form = null; // release memory in IE
  3896. })();
  3897. (function(){
  3898. // Check to see if the browser returns only elements
  3899. // when doing getElementsByTagName("*")
  3900. // Create a fake element
  3901. var div = document.createElement("div");
  3902. div.appendChild( document.createComment("") );
  3903. // Make sure no comments are found
  3904. if ( div.getElementsByTagName("*").length > 0 ) {
  3905. Expr.find.TAG = function(match, context){
  3906. var results = context.getElementsByTagName(match[1]);
  3907. // Filter out possible comments
  3908. if ( match[1] === "*" ) {
  3909. var tmp = [];
  3910. for ( var i = 0; results[i]; i++ ) {
  3911. if ( results[i].nodeType === 1 ) {
  3912. tmp.push( results[i] );
  3913. }
  3914. }
  3915. results = tmp;
  3916. }
  3917. return results;
  3918. };
  3919. }
  3920. // Check to see if an attribute returns normalized href attributes
  3921. div.innerHTML = "<a href='#'></a>";
  3922. if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  3923. div.firstChild.getAttribute("href") !== "#" ) {
  3924. Expr.attrHandle.href = function(elem){
  3925. return elem.getAttribute("href", 2);
  3926. };
  3927. }
  3928. div = null; // release memory in IE
  3929. })();
  3930. if ( document.querySelectorAll ) {
  3931. (function(){
  3932. var oldSizzle = Sizzle, div = document.createElement("div");
  3933. div.innerHTML = "<p class='TEST'></p>";
  3934. // Safari can't handle uppercase or unicode characters when
  3935. // in quirks mode.
  3936. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
  3937. return;
  3938. }
  3939. Sizzle = function(query, context, extra, seed){
  3940. context = context || document;
  3941. // Only use querySelectorAll on non-XML documents
  3942. // (ID selectors don't work in non-HTML documents)
  3943. if ( !seed && !Sizzle.isXML(context) ) {
  3944. if ( context.nodeType === 9 ) {
  3945. try {
  3946. return makeArray( context.querySelectorAll(query), extra );
  3947. } catch(qsaError) {}
  3948. // qSA works strangely on Element-rooted queries
  3949. // We can work around this by specifying an extra ID on the root
  3950. // and working up from there (Thanks to Andrew Dupont for the technique)
  3951. // IE 8 doesn't work on object elements
  3952. } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  3953. var old = context.id, id = context.id = "__sizzle__";
  3954. try {
  3955. return makeArray( context.querySelectorAll( "#" + id + " " + query ), extra );
  3956. } catch(pseudoError) {
  3957. } finally {
  3958. if ( old ) {
  3959. context.id = old;
  3960. } else {
  3961. context.removeAttribute( "id" );
  3962. }
  3963. }
  3964. }
  3965. }
  3966. return oldSizzle(query, context, extra, seed);
  3967. };
  3968. for ( var prop in oldSizzle ) {
  3969. Sizzle[ prop ] = oldSizzle[ prop ];
  3970. }
  3971. div = null; // release memory in IE
  3972. })();
  3973. }
  3974. (function(){
  3975. var html = document.documentElement,
  3976. matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
  3977. pseudoWorks = false;
  3978. try {
  3979. // This should fail with an exception
  3980. // Gecko does not error, returns false instead
  3981. matches.call( document.documentElement, ":sizzle" );
  3982. } catch( pseudoError ) {
  3983. pseudoWorks = true;
  3984. }
  3985. if ( matches ) {
  3986. Sizzle.matchesSelector = function( node, expr ) {
  3987. try {
  3988. if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) ) {
  3989. return matches.call( node, expr );
  3990. }
  3991. } catch(e) {}
  3992. return Sizzle(expr, null, null, [node]).length > 0;
  3993. };
  3994. }
  3995. })();
  3996. (function(){
  3997. var div = document.createElement("div");
  3998. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  3999. // Opera can't find a second classname (in 9.6)
  4000. // Also, make sure that getElementsByClassName actually exists
  4001. if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
  4002. return;
  4003. }
  4004. // Safari caches class attributes, doesn't catch changes (in 3.2)
  4005. div.lastChild.className = "e";
  4006. if ( div.getElementsByClassName("e").length === 1 ) {
  4007. return;
  4008. }
  4009. Expr.order.splice(1, 0, "CLASS");
  4010. Expr.find.CLASS = function(match, context, isXML) {
  4011. if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
  4012. return context.getElementsByClassName(match[1]);
  4013. }
  4014. };
  4015. div = null; // release memory in IE
  4016. })();
  4017. function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  4018. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  4019. var elem = checkSet[i];
  4020. if ( elem ) {
  4021. elem = elem[dir];
  4022. var match = false;
  4023. while ( elem ) {
  4024. if ( elem.sizcache === doneName ) {
  4025. match = checkSet[elem.sizset];
  4026. break;
  4027. }
  4028. if ( elem.nodeType === 1 && !isXML ){
  4029. elem.sizcache = doneName;
  4030. elem.sizset = i;
  4031. }
  4032. if ( elem.nodeName.toLowerCase() === cur ) {
  4033. match = elem;
  4034. break;
  4035. }
  4036. elem = elem[dir];
  4037. }
  4038. checkSet[i] = match;
  4039. }
  4040. }
  4041. }
  4042. function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  4043. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  4044. var elem = checkSet[i];
  4045. if ( elem ) {
  4046. elem = elem[dir];
  4047. var match = false;
  4048. while ( elem ) {
  4049. if ( elem.sizcache === doneName ) {
  4050. match = checkSet[elem.sizset];
  4051. break;
  4052. }
  4053. if ( elem.nodeType === 1 ) {
  4054. if ( !isXML ) {
  4055. elem.sizcache = doneName;
  4056. elem.sizset = i;
  4057. }
  4058. if ( typeof cur !== "string" ) {
  4059. if ( elem === cur ) {
  4060. match = true;
  4061. break;
  4062. }
  4063. } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
  4064. match = elem;
  4065. break;
  4066. }
  4067. }
  4068. elem = elem[dir];
  4069. }
  4070. checkSet[i] = match;
  4071. }
  4072. }
  4073. }
  4074. Sizzle.contains = document.documentElement.contains ? function(a, b){
  4075. /// <summary>
  4076. /// Check to see if a DOM node is within another DOM node.
  4077. /// API: <see href="http://api.jquery.com/jQuery.contains/">jQuery.contains()</see>
  4078. /// Categories: <see href="http://api.jquery.com/category/utilities/">Utilities</see>
  4079. /// </summary>
  4080. /// <param name="container" type="Object">
  4081. /// The DOM element that may contain the other element.
  4082. /// </param>
  4083. /// <param name="contains" type="Object">
  4084. /// The DOM node that may be contained by the other element.
  4085. /// </param>
  4086. /// <returns type="Boolean" />
  4087. return a !== b && (a.contains ? a.contains(b) : true);
  4088. } : function(a, b){
  4089. return !!(a.compareDocumentPosition(b) & 16);
  4090. };
  4091. Sizzle.isXML = function(elem){
  4092. /// <summary>
  4093. /// Determines if the parameter passed is an XML document.
  4094. /// </summary>
  4095. /// <param name="elem" type="Object">
  4096. /// The object to test.
  4097. /// </param>
  4098. /// <returns type="Boolean">
  4099. /// True if the parameter is an XML document; otherwise false.
  4100. // </returns>
  4101. // documentElement is verified for cases where it doesn't yet exist
  4102. // (such as loading iframes in IE - #4833)
  4103. var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
  4104. return documentElement ? documentElement.nodeName !== "HTML" : false;
  4105. };
  4106. var posProcess = function(selector, context){
  4107. var tmpSet = [], later = "", match,
  4108. root = context.nodeType ? [context] : context;
  4109. // Position selectors must be done after the filter
  4110. // And so must :not(positional) so we move all PSEUDOs to the end
  4111. while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
  4112. later += match[0];
  4113. selector = selector.replace( Expr.match.PSEUDO, "" );
  4114. }
  4115. selector = Expr.relative[selector] ? selector + "*" : selector;
  4116. for ( var i = 0, l = root.length; i < l; i++ ) {
  4117. Sizzle( selector, root[i], tmpSet );
  4118. }
  4119. return Sizzle.filter( later, tmpSet );
  4120. };
  4121. // EXPOSE
  4122. jQuery.find = Sizzle;
  4123. jQuery.expr = Sizzle.selectors;
  4124. jQuery.expr[":"] = jQuery.expr.filters;
  4125. jQuery.unique = Sizzle.uniqueSort;
  4126. jQuery.text = Sizzle.getText;
  4127. jQuery.isXMLDoc = Sizzle.isXML;
  4128. jQuery.contains = Sizzle.contains;
  4129. })();
  4130. var runtil = /Until$/,
  4131. rparentsprev = /^(?:parents|prevUntil|prevAll)/,
  4132. // Note: This RegExp should be improved, or likely pulled from Sizzle
  4133. rmultiselector = /,/,
  4134. isSimple = /^.[^:#\[\.,]*$/,
  4135. slice = Array.prototype.slice,
  4136. POS = jQuery.expr.match.POS;
  4137. jQuery.fn.extend({
  4138. find: function( selector ) {
  4139. /// <summary>
  4140. /// Searches for all elements that match the specified expression.
  4141. /// This method is a good way to find additional descendant
  4142. /// elements with which to process.
  4143. /// All searching is done using a jQuery expression. The expression can be
  4144. /// written using CSS 1-3 Selector syntax, or basic XPath.
  4145. /// API: <see href="http://api.jquery.com/find/">.find()</see>
  4146. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4147. /// </summary>
  4148. /// <param name="selector" type="String">
  4149. /// A string containing a selector expression to match elements against.
  4150. /// </param>
  4151. /// <returns type="jQuery" />
  4152. var ret = this.pushStack( "", "find", selector ), length = 0;
  4153. for ( var i = 0, l = this.length; i < l; i++ ) {
  4154. length = ret.length;
  4155. jQuery.find( selector, this[i], ret );
  4156. if ( i > 0 ) {
  4157. // Make sure that the results are unique
  4158. for ( var n = length; n < ret.length; n++ ) {
  4159. for ( var r = 0; r < length; r++ ) {
  4160. if ( ret[r] === ret[n] ) {
  4161. ret.splice(n--, 1);
  4162. break;
  4163. }
  4164. }
  4165. }
  4166. }
  4167. }
  4168. return ret;
  4169. },
  4170. has: function( target ) {
  4171. /// <summary>
  4172. /// Reduce the set of matched elements to those that have a descendant that matches the
  4173. /// selector or DOM element.
  4174. /// API: <see href="http://api.jquery.com/has/">.has()</see>
  4175. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4176. /// </summary>
  4177. /// <param name="selector" type="String">
  4178. /// A string containing a selector expression to match elements against.
  4179. /// </param>
  4180. /// <returns type="jQuery" />
  4181. var targets = jQuery( target );
  4182. return this.filter(function() {
  4183. for ( var i = 0, l = targets.length; i < l; i++ ) {
  4184. if ( jQuery.contains( this, targets[i] ) ) {
  4185. return true;
  4186. }
  4187. }
  4188. });
  4189. },
  4190. not: function( selector ) {
  4191. /// <summary>
  4192. /// Remove elements from the set of matched elements.
  4193. /// API: <see href="http://api.jquery.com/not/">.not()</see>
  4194. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4195. /// </summary>
  4196. /// <param name="selector" type="jQuery">
  4197. /// A string containing a selector expression to match elements against.
  4198. /// </param>
  4199. /// <returns type="jQuery" />
  4200. return this.pushStack( winnow(this, selector, false), "not", selector);
  4201. },
  4202. filter: function( selector ) {
  4203. /// <summary>
  4204. /// Reduce the set of matched elements to those that match the selector or pass the function's test.
  4205. /// API: <see href="http://api.jquery.com/filter/">.filter()</see>
  4206. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4207. /// </summary>
  4208. /// <param name="selector" type="Function">
  4209. /// A string containing a selector expression to match the current set of elements against.
  4210. /// </param>
  4211. /// <returns type="jQuery" />
  4212. return this.pushStack( winnow(this, selector, true), "filter", selector );
  4213. },
  4214. is: function( selector ) {
  4215. /// <summary>
  4216. /// Check the current matched set of elements against a selector and return true if at least one of these elements matches the selector.
  4217. /// API: <see href="http://api.jquery.com/is/">.is()</see>
  4218. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4219. /// </summary>
  4220. /// <param name="selector " type="String">
  4221. /// A string containing a selector expression to match elements against.
  4222. /// </param>
  4223. /// <returns type="Boolean" />
  4224. return !!selector && jQuery.filter( selector, this ).length > 0;
  4225. },
  4226. closest: function( selectors, context ) {
  4227. /// <summary>
  4228. /// Get a set of elements containing the closest parent element that matches the specified selector, the starting element included.
  4229. /// API: <see href="http://api.jquery.com/closest/">.closest()</see>
  4230. /// Categories: <see href="http://api.jquery.com/category/traversing/">Traversing</see>
  4231. /// </summary>
  4232. /// <param name="selector" type="String">
  4233. /// A string containing a selector expression to match elements against.
  4234. /// </param>
  4235. /// <param name="context" type="Element" optional="true">
  4236. /// A DOM element within which a matching element may be found. If no context is passed
  4237. /// in then the context of the jQuery set will be used instead.
  4238. /// </param>
  4239. /// <returns type="jQuery" />
  4240. var ret = [], i, l, cur = this[0];
  4241. if ( jQuery.isArray( selectors ) ) {
  4242. var match, matches = {}, selector, level = 1;
  4243. if ( cur && selectors.length ) {
  4244. for ( i = 0, l = selectors.length; i < l; i++ ) {
  4245. selector = selectors[i];
  4246. if ( !matches[selector] ) {
  4247. matches[selector] = jQuery.expr.match.POS.test( selector ) ?
  4248. jQuery( selector, context || this.context ) :
  4249. selector;
  4250. }
  4251. }
  4252. while ( cur && cur.ownerDocument && cur !== context ) {
  4253. for ( selector in matches ) {
  4254. match = matches[selector];
  4255. if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
  4256. ret.push({ selector: selector, elem: cur, level: level });
  4257. }
  4258. }
  4259. cur = cur.parentNode;
  4260. level++;
  4261. }
  4262. }
  4263. return ret;
  4264. }
  4265. var pos = POS.test( selectors ) ?
  4266. jQuery( selectors, context || this.context ) : null;
  4267. for ( i = 0, l = this.length; i < l; i++ ) {
  4268. cur = this[i];
  4269. while ( cur ) {
  4270. if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
  4271. ret.push( cur );
  4272. break;
  4273. } else {
  4274. cur = cur.parentNode;
  4275. if ( !cur || !cur.ownerDocument || cur === context ) {
  4276. break;
  4277. }
  4278. }
  4279. }
  4280. }
  4281. ret = ret.length > 1 ? jQuery.unique(ret) : ret;
  4282. return this.pushStack( ret, "closest", selectors );
  4283. },
  4284. // Determine the position of an element within
  4285. // the matched set of elements
  4286. index: function( elem ) {
  4287. /// <summary>
  4288. /// Searches every matched element for the object and returns
  4289. /// the index of the element, if found, starting with zero.
  4290. /// Returns -1 if the object wasn't found.
  4291. /// API: <see href="http://api.jquery.com/index/">.index()</see>
  4292. /// Categories: <see href="http://api.jquery.com/category/miscellaneous/dom-element-methods/">DOM Element Methods</see>
  4293. /// </summary>
  4294. /// <param name="selector type="String">
  4295. /// A selector representing a jQuery collection in which to look for an element.
  4296. /// </param>
  4297. /// <returns type="Number" />
  4298. if ( !elem || typeof elem === "string" ) {
  4299. return jQuery.inArray( this[0],
  4300. // If it receives a string, the selector is used
  4301. // If it receives nothing, the siblings are used
  4302. elem ? jQuery( elem ) : this.parent().children() );
  4303. }
  4304. // Locate the position of the desired element
  4305. return jQuery.inArray(
  4306. // If it receives a jQuery object, the first element is used
  4307. elem.jquery ? elem[0] : elem, this );
  4308. },
  4309. add: function( selector, context ) {
  4310. /// <summary>
  4311. /// Add elements to the set of matched elements.
  4312. /// API: <see href="http://api.jquery.com/add/">.add()</see>
  4313. /// Categories: <see href="http://api.jquery.com/category/traversing/miscellaneous-traversal/">Miscellaneous Traversing</see>
  4314. /// </summary>
  4315. /// <param name="selector" type="String">
  4316. /// A string containing a selector expression to match additional elements against.
  4317. /// </param>
  4318. /// <param name="context" type="Element">
  4319. /// Add some elements rooted against the specified context.
  4320. /// </param>
  4321. /// <returns type="jQuery" />
  4322. var set = typeof selector === "string" ?
  4323. jQuery( selector, context || this.context ) :
  4324. jQuery.makeArray( selector ),
  4325. all = jQuery.merge( this.get(), set );
  4326. return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
  4327. all :
  4328. jQuery.unique( all ) );
  4329. },
  4330. andSelf: function() {
  4331. /// <summary>
  4332. /// Add the previous set of elements on the stack to the current set.
  4333. /// API: <see href="http://api.jquery.com/andSelf/">.andSelf()</see>
  4334. /// Categories: <see href="http://api.jquery.com/category/traversing/miscellaneous-traversal/">Miscellaneous Traversing</see>
  4335. /// </summary>
  4336. /// <returns type="jQuery" />
  4337. return this.add( this.prevObject );
  4338. }
  4339. });
  4340. // A painfully simple check to see if an element is disconnected
  4341. // from a document (should be improved, where feasible).
  4342. function isDisconnected( node ) {
  4343. return !node || !node.parentNode || node.parentNode.nodeType === 11;
  4344. }
  4345. // [vsdoc] Each of the following need to be documented.
  4346. jQuery.each({
  4347. parent: function( elem ) {
  4348. var parent = elem.parentNode;
  4349. return parent && parent.nodeType !== 11 ? parent : null;
  4350. },
  4351. parents: function( elem ) {
  4352. return jQuery.dir( elem, "parentNode" );
  4353. },
  4354. parentsUntil: function( elem, i, until ) {
  4355. return jQuery.dir( elem, "parentNode", until );
  4356. },
  4357. next: function( elem ) {
  4358. return jQuery.nth( elem, 2, "nextSibling" );
  4359. },
  4360. prev: function( elem ) {
  4361. return jQuery.nth( elem, 2, "previousSibling" );
  4362. },
  4363. nextAll: function( elem ) {
  4364. return jQuery.dir( elem, "nextSibling" );
  4365. },
  4366. prevAll: function( elem ) {
  4367. return jQuery.dir( elem, "previousSibling" );
  4368. },
  4369. nextUntil: function( elem, i, until ) {
  4370. return jQuery.dir( elem, "nextSibling", until );
  4371. },
  4372. prevUntil: function( elem, i, until ) {
  4373. return jQuery.dir( elem, "previousSibling", until );
  4374. },
  4375. siblings: function( elem ) {
  4376. return jQuery.sibling( elem.parentNode.firstChild, elem );
  4377. },
  4378. children: function( elem ) {
  4379. return jQuery.sibling( elem.firstChild );
  4380. },
  4381. contents: function( elem ) {
  4382. return jQuery.nodeName( elem, "iframe" ) ?
  4383. elem.contentDocument || elem.contentWindow.document :
  4384. jQuery.makeArray( elem.childNodes );
  4385. }
  4386. }, function( name, fn ) {
  4387. jQuery.fn[ name ] = function( until, selector ) {
  4388. var ret = jQuery.map( this, fn, until );
  4389. if ( !runtil.test( name ) ) {
  4390. selector = until;
  4391. }
  4392. if ( selector && typeof selector === "string" ) {
  4393. ret = jQuery.filter( selector, ret );
  4394. }
  4395. ret = this.length > 1 ? jQuery.unique( ret ) : ret;
  4396. if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
  4397. ret = ret.reverse();
  4398. }
  4399. return this.pushStack( ret, name, slice.call(arguments).join(",") );
  4400. };
  4401. });
  4402. jQuery.extend({
  4403. filter: function( expr, elems, not ) {
  4404. if ( not ) {
  4405. expr = ":not(" + expr + ")";
  4406. }
  4407. return elems.length === 1 ?
  4408. jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
  4409. jQuery.find.matches(expr, elems);
  4410. },
  4411. dir: function( elem, dir, until ) {
  4412. /// <summary>
  4413. /// Internal use only.
  4414. /// </summary>
  4415. /// <private />
  4416. var matched = [], cur = elem[dir];
  4417. while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
  4418. if ( cur.nodeType === 1 ) {
  4419. matched.push( cur );
  4420. }
  4421. cur = cur[dir];
  4422. }
  4423. return matched;
  4424. },
  4425. nth: function( cur, result, dir, elem ) {
  4426. /// <summary>
  4427. /// Internal use only.
  4428. /// </summary>
  4429. /// <private />
  4430. result = result || 1;
  4431. var num = 0;
  4432. for ( ; cur; cur = cur[dir] ) {
  4433. if ( cur.nodeType === 1 && ++num === result ) {
  4434. break;
  4435. }
  4436. }
  4437. return cur;
  4438. },
  4439. sibling: function( n, elem ) {
  4440. /// <summary>
  4441. /// Internal use only.
  4442. /// </summary>
  4443. /// <private />
  4444. var r = [];
  4445. for ( ; n; n = n.nextSibling ) {
  4446. if ( n.nodeType === 1 && n !== elem ) {
  4447. r.push( n );
  4448. }
  4449. }
  4450. return r;
  4451. }
  4452. });
  4453. // Implement the identical functionality for filter and not
  4454. function winnow( elements, qualifier, keep ) {
  4455. if ( jQuery.isFunction( qualifier ) ) {
  4456. return jQuery.grep(elements, function( elem, i ) {
  4457. var retVal = !!qualifier.call( elem, i, elem );
  4458. return retVal === keep;
  4459. });
  4460. } else if ( qualifier.nodeType ) {
  4461. return jQuery.grep(elements, function( elem, i ) {
  4462. return (elem === qualifier) === keep;
  4463. });
  4464. } else if ( typeof qualifier === "string" ) {
  4465. var filtered = jQuery.grep(elements, function( elem ) {
  4466. return elem.nodeType === 1;
  4467. });
  4468. if ( isSimple.test( qualifier ) ) {
  4469. return jQuery.filter(qualifier, filtered, !keep);
  4470. } else {
  4471. qualifier = jQuery.filter( qualifier, filtered );
  4472. }
  4473. }
  4474. return jQuery.grep(elements, function( elem, i ) {
  4475. return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  4476. });
  4477. }
  4478. var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
  4479. rleadingWhitespace = /^\s+/,
  4480. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  4481. rtagName = /<([\w:]+)/,
  4482. rtbody = /<tbody/i,
  4483. rhtml = /<|&#?\w+;/,
  4484. rnocache = /<(?:script|object|embed|option|style)/i,
  4485. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
  4486. raction = /\=([^="'>\s]+\/)>/g,
  4487. wrapMap = {
  4488. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4489. legend: [ 1, "<fieldset>", "</fieldset>" ],
  4490. thead: [ 1, "<table>", "</table>" ],
  4491. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4492. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4493. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  4494. area: [ 1, "<map>", "</map>" ],
  4495. _default: [ 0, "", "" ]
  4496. };
  4497. wrapMap.optgroup = wrapMap.option;
  4498. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4499. wrapMap.th = wrapMap.td;
  4500. // IE can't serialize <link> and <script> tags normally
  4501. if ( !jQuery.support.htmlSerialize ) {
  4502. wrapMap._default = [ 1, "div<div>", "</div>" ];
  4503. }
  4504. jQuery.fn.extend({
  4505. text: function( text ) {
  4506. /// <summary>
  4507. /// Set the text contents of all matched elements.
  4508. /// Similar to html(), but escapes HTML (replace &quot;&lt;&quot; and &quot;&gt;&quot; with their
  4509. /// HTML entities).
  4510. /// Part of DOM/Attributes
  4511. /// </summary>
  4512. /// <param name="text" type="String">
  4513. /// The text value to set the contents of the element to.
  4514. /// </param>
  4515. /// <returns type="jQuery" />
  4516. if ( jQuery.isFunction(text) ) {
  4517. return this.each(function(i) {
  4518. var self = jQuery(this);
  4519. self.text( text.call(this, i, self.text()) );
  4520. });
  4521. }
  4522. if ( typeof text !== "object" && text !== undefined ) {
  4523. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  4524. }
  4525. return jQuery.text( this );
  4526. },
  4527. wrapAll: function( html ) {
  4528. /// <summary>
  4529. /// Wrap all matched elements with a structure of other elements.
  4530. /// This wrapping process is most useful for injecting additional
  4531. /// stucture into a document, without ruining the original semantic
  4532. /// qualities of a document.
  4533. /// This works by going through the first element
  4534. /// provided and finding the deepest ancestor element within its
  4535. /// structure - it is that element that will en-wrap everything else.
  4536. /// This does not work with elements that contain text. Any necessary text
  4537. /// must be added after the wrapping is done.
  4538. /// Part of DOM/Manipulation
  4539. /// </summary>
  4540. /// <returns type="jQuery" />
  4541. /// <param name="html" type="Element">
  4542. /// A DOM element that will be wrapped around the target.
  4543. /// </param>
  4544. if ( jQuery.isFunction( html ) ) {
  4545. return this.each(function(i) {
  4546. jQuery(this).wrapAll( html.call(this, i) );
  4547. });
  4548. }
  4549. if ( this[0] ) {
  4550. // The elements to wrap the target around
  4551. var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
  4552. if ( this[0].parentNode ) {
  4553. wrap.insertBefore( this[0] );
  4554. }
  4555. wrap.map(function() {
  4556. var elem = this;
  4557. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  4558. elem = elem.firstChild;
  4559. }
  4560. return elem;
  4561. }).append(this);
  4562. }
  4563. return this;
  4564. },
  4565. wrapInner: function( html ) {
  4566. /// <summary>
  4567. /// Wraps the inner child contents of each matched elemenht (including text nodes) with an HTML structure.
  4568. /// </summary>
  4569. /// <param name="html" type="String">
  4570. /// A string of HTML or a DOM element that will be wrapped around the target contents.
  4571. /// </param>
  4572. /// <returns type="jQuery" />
  4573. if ( jQuery.isFunction( html ) ) {
  4574. return this.each(function(i) {
  4575. jQuery(this).wrapInner( html.call(this, i) );
  4576. });
  4577. }
  4578. return this.each(function() {
  4579. var self = jQuery( this ), contents = self.contents();
  4580. if ( contents.length ) {
  4581. contents.wrapAll( html );
  4582. } else {
  4583. self.append( html );
  4584. }
  4585. });
  4586. },
  4587. wrap: function( html ) {
  4588. /// <summary>
  4589. /// Wrap all matched elements with a structure of other elements.
  4590. /// This wrapping process is most useful for injecting additional
  4591. /// stucture into a document, without ruining the original semantic
  4592. /// qualities of a document.
  4593. /// This works by going through the first element
  4594. /// provided and finding the deepest ancestor element within its
  4595. /// structure - it is that element that will en-wrap everything else.
  4596. /// This does not work with elements that contain text. Any necessary text
  4597. /// must be added after the wrapping is done.
  4598. /// Part of DOM/Manipulation
  4599. /// </summary>
  4600. /// <returns type="jQuery" />
  4601. /// <param name="html" type="Element">
  4602. /// A DOM element that will be wrapped around the target.
  4603. /// </param>
  4604. return this.each(function() {
  4605. jQuery( this ).wrapAll( html );
  4606. });
  4607. },
  4608. unwrap: function() {
  4609. /// <summary>
  4610. /// Remove the parents of the set of matched elements from the DOM, leaving the matched
  4611. /// elements in their place.
  4612. /// </summary>
  4613. /// <returns type="jQuery" />
  4614. return this.parent().each(function() {
  4615. if ( !jQuery.nodeName( this, "body" ) ) {
  4616. jQuery( this ).replaceWith( this.childNodes );
  4617. }
  4618. }).end();
  4619. },
  4620. append: function() {
  4621. /// <summary>
  4622. /// Append content to the inside of every matched element.
  4623. /// This operation is similar to doing an appendChild to all the
  4624. /// specified elements, adding them into the document.
  4625. /// Part of DOM/Manipulation
  4626. /// </summary>
  4627. /// <returns type="jQuery" />
  4628. return this.domManip(arguments, true, function( elem ) {
  4629. if ( this.nodeType === 1 ) {
  4630. this.appendChild( elem );
  4631. }
  4632. });
  4633. },
  4634. prepend: function() {
  4635. /// <summary>
  4636. /// Prepend content to the inside of every matched element.
  4637. /// This operation is the best way to insert elements
  4638. /// inside, at the beginning, of all matched elements.
  4639. /// Part of DOM/Manipulation
  4640. /// </summary>
  4641. /// <returns type="jQuery" />
  4642. return this.domManip(arguments, true, function( elem ) {
  4643. if ( this.nodeType === 1 ) {
  4644. this.insertBefore( elem, this.firstChild );
  4645. }
  4646. });
  4647. },
  4648. before: function() {
  4649. /// <summary>
  4650. /// Insert content before each of the matched elements.
  4651. /// Part of DOM/Manipulation
  4652. /// </summary>
  4653. /// <returns type="jQuery" />
  4654. if ( this[0] && this[0].parentNode ) {
  4655. return this.domManip(arguments, false, function( elem ) {
  4656. this.parentNode.insertBefore( elem, this );
  4657. });
  4658. } else if ( arguments.length ) {
  4659. var set = jQuery(arguments[0]);
  4660. set.push.apply( set, this.toArray() );
  4661. return this.pushStack( set, "before", arguments );
  4662. }
  4663. },
  4664. after: function() {
  4665. /// <summary>
  4666. /// Insert content after each of the matched elements.
  4667. /// Part of DOM/Manipulation
  4668. /// </summary>
  4669. /// <returns type="jQuery" />
  4670. if ( this[0] && this[0].parentNode ) {
  4671. return this.domManip(arguments, false, function( elem ) {
  4672. this.parentNode.insertBefore( elem, this.nextSibling );
  4673. });
  4674. } else if ( arguments.length ) {
  4675. var set = this.pushStack( this, "after", arguments );
  4676. set.push.apply( set, jQuery(arguments[0]).toArray() );
  4677. return set;
  4678. }
  4679. },
  4680. // [vsdoc] todo
  4681. // keepData is for internal use only--do not document
  4682. remove: function( selector, keepData ) {
  4683. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4684. if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
  4685. if ( !keepData && elem.nodeType === 1 ) {
  4686. jQuery.cleanData( elem.getElementsByTagName("*") );
  4687. jQuery.cleanData( [ elem ] );
  4688. }
  4689. if ( elem.parentNode ) {
  4690. elem.parentNode.removeChild( elem );
  4691. }
  4692. }
  4693. }
  4694. return this;
  4695. },
  4696. // [vsdoc] todo
  4697. empty: function() {
  4698. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4699. // Remove element nodes and prevent memory leaks
  4700. if ( elem.nodeType === 1 ) {
  4701. jQuery.cleanData( elem.getElementsByTagName("*") );
  4702. }
  4703. // Remove any remaining nodes
  4704. while ( elem.firstChild ) {
  4705. elem.removeChild( elem.firstChild );
  4706. }
  4707. }
  4708. return this;
  4709. },
  4710. clone: function( events ) {
  4711. /// <summary>
  4712. /// Clone matched DOM Elements and select the clones.
  4713. /// This is useful for moving copies of the elements to another
  4714. /// location in the DOM.
  4715. /// Part of DOM/Manipulation
  4716. /// </summary>
  4717. /// <returns type="jQuery" />
  4718. /// <param name="deep" type="Boolean" optional="true">
  4719. /// (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself.
  4720. /// </param>
  4721. // Do the clone
  4722. var ret = this.map(function() {
  4723. if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
  4724. // IE copies events bound via attachEvent when
  4725. // using cloneNode. Calling detachEvent on the
  4726. // clone will also remove the events from the orignal
  4727. // In order to get around this, we use innerHTML.
  4728. // Unfortunately, this means some modifications to
  4729. // attributes in IE that are actually only stored
  4730. // as properties will not be copied (such as the
  4731. // the name attribute on an input).
  4732. var html = this.outerHTML, ownerDocument = this.ownerDocument;
  4733. if ( !html ) {
  4734. var div = ownerDocument.createElement("div");
  4735. div.appendChild( this.cloneNode(true) );
  4736. html = div.innerHTML;
  4737. }
  4738. return jQuery.clean([html.replace(rinlinejQuery, "")
  4739. // Handle the case in IE 8 where action=/test/> self-closes a tag
  4740. .replace(raction, '="$1">')
  4741. .replace(rleadingWhitespace, "")], ownerDocument)[0];
  4742. } else {
  4743. return this.cloneNode(true);
  4744. }
  4745. });
  4746. // Copy the events from the original to the clone
  4747. if ( events === true ) {
  4748. cloneCopyEvent( this, ret );
  4749. cloneCopyEvent( this.find("*"), ret.find("*") );
  4750. }
  4751. // Return the cloned set
  4752. return ret;
  4753. },
  4754. html: function( value ) {
  4755. /// <summary>
  4756. /// Set the html contents of every matched element.
  4757. /// This property is not available on XML documents.
  4758. /// Part of DOM/Attributes
  4759. /// </summary>
  4760. /// <returns type="jQuery" />
  4761. /// <param name="value" type="String">
  4762. /// A string of HTML to set as the content of each matched element.
  4763. /// </param>
  4764. if ( value === undefined ) {
  4765. return this[0] && this[0].nodeType === 1 ?
  4766. this[0].innerHTML.replace(rinlinejQuery, "") :
  4767. null;
  4768. // See if we can take a shortcut and just use innerHTML
  4769. } else if ( typeof value === "string" && !rnocache.test( value ) &&
  4770. (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
  4771. !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
  4772. value = value.replace(rxhtmlTag, "<$1></$2>");
  4773. try {
  4774. for ( var i = 0, l = this.length; i < l; i++ ) {
  4775. // Remove element nodes and prevent memory leaks
  4776. if ( this[i].nodeType === 1 ) {
  4777. jQuery.cleanData( this[i].getElementsByTagName("*") );
  4778. this[i].innerHTML = value;
  4779. }
  4780. }
  4781. // If using innerHTML throws an exception, use the fallback method
  4782. } catch(e) {
  4783. this.empty().append( value );
  4784. }
  4785. } else if ( jQuery.isFunction( value ) ) {
  4786. this.each(function(i){
  4787. var self = jQuery(this);
  4788. self.html( value.call(this, i, self.html()) );
  4789. });
  4790. } else {
  4791. this.empty().append( value );
  4792. }
  4793. return this;
  4794. },
  4795. replaceWith: function( value ) {
  4796. /// <summary>
  4797. /// Replaces all matched element with the specified HTML or DOM elements.
  4798. /// </summary>
  4799. /// <param name="value" type="Object">
  4800. /// The content to insert. May be an HTML string, DOM element, or jQuery object.
  4801. /// </param>
  4802. /// <returns type="jQuery">The element that was just replaced.</returns>
  4803. if ( this[0] && this[0].parentNode ) {
  4804. // Make sure that the elements are removed from the DOM before they are inserted
  4805. // this can help fix replacing a parent with child elements
  4806. if ( jQuery.isFunction( value ) ) {
  4807. return this.each(function(i) {
  4808. var self = jQuery(this), old = self.html();
  4809. self.replaceWith( value.call( this, i, old ) );
  4810. });
  4811. }
  4812. if ( typeof value !== "string" ) {
  4813. value = jQuery(value).detach();
  4814. }
  4815. return this.each(function() {
  4816. var next = this.nextSibling, parent = this.parentNode;
  4817. jQuery(this).remove();
  4818. if ( next ) {
  4819. jQuery(next).before( value );
  4820. } else {
  4821. jQuery(parent).append( value );
  4822. }
  4823. });
  4824. } else {
  4825. return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
  4826. }
  4827. },
  4828. detach: function( selector ) {
  4829. /// <summary>
  4830. /// Remove the set of matched elements from the DOM.
  4831. /// </summary>
  4832. /// <param name="selector" type="String">
  4833. /// A selector expression that filters the set of matched elements to be removed.
  4834. /// </param>
  4835. /// <returns type="jQuery" />
  4836. return this.remove( selector, true );
  4837. },
  4838. domManip: function( args, table, callback ) {
  4839. /// <param name="args" type="Array">
  4840. /// Args
  4841. /// </param>
  4842. /// <param name="table" type="Boolean">
  4843. /// Insert TBODY in TABLEs if one is not found.
  4844. /// </param>
  4845. /// <param name="dir" type="Number">
  4846. /// If dir&lt;0, process args in reverse order.
  4847. /// </param>
  4848. /// <param name="fn" type="Function">
  4849. /// The function doing the DOM manipulation.
  4850. /// </param>
  4851. /// <returns type="jQuery" />
  4852. /// <summary>
  4853. /// Part of Core
  4854. /// </summary>
  4855. var results, first, value = args[0], scripts = [], fragment, parent;
  4856. // We can't cloneNode fragments that contain checked, in WebKit
  4857. if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
  4858. return this.each(function() {
  4859. jQuery(this).domManip( args, table, callback, true );
  4860. });
  4861. }
  4862. if ( jQuery.isFunction(value) ) {
  4863. return this.each(function(i) {
  4864. var self = jQuery(this);
  4865. args[0] = value.call(this, i, table ? self.html() : undefined);
  4866. self.domManip( args, table, callback );
  4867. });
  4868. }
  4869. if ( this[0] ) {
  4870. parent = value && value.parentNode;
  4871. // If we're in a fragment, just use that instead of building a new one
  4872. if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
  4873. results = { fragment: parent };
  4874. } else {
  4875. results = jQuery.buildFragment( args, this, scripts );
  4876. }
  4877. fragment = results.fragment;
  4878. if ( fragment.childNodes.length === 1 ) {
  4879. first = fragment = fragment.firstChild;
  4880. } else {
  4881. first = fragment.firstChild;
  4882. }
  4883. if ( first ) {
  4884. table = table && jQuery.nodeName( first, "tr" );
  4885. for ( var i = 0, l = this.length; i < l; i++ ) {
  4886. callback.call(
  4887. table ?
  4888. root(this[i], first) :
  4889. this[i],
  4890. i > 0 || results.cacheable || this.length > 1 ?
  4891. fragment.cloneNode(true) :
  4892. fragment
  4893. );
  4894. }
  4895. }
  4896. if ( scripts.length ) {
  4897. jQuery.each( scripts, evalScript );
  4898. }
  4899. }
  4900. return this;
  4901. }
  4902. });
  4903. function root( elem, cur ) {
  4904. return jQuery.nodeName(elem, "table") ?
  4905. (elem.getElementsByTagName("tbody")[0] ||
  4906. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  4907. elem;
  4908. }
  4909. function cloneCopyEvent(orig, ret) {
  4910. var i = 0;
  4911. ret.each(function() {
  4912. if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
  4913. return;
  4914. }
  4915. var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
  4916. if ( events ) {
  4917. delete curData.handle;
  4918. curData.events = {};
  4919. for ( var type in events ) {
  4920. for ( var handler in events[ type ] ) {
  4921. jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
  4922. }
  4923. }
  4924. }
  4925. });
  4926. }
  4927. jQuery.buildFragment = function( args, nodes, scripts ) {
  4928. var fragment, cacheable, cacheresults,
  4929. doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
  4930. // Only cache "small" (1/2 KB) strings that are associated with the main document
  4931. // Cloning options loses the selected state, so don't cache them
  4932. // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
  4933. // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
  4934. if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
  4935. !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
  4936. cacheable = true;
  4937. cacheresults = jQuery.fragments[ args[0] ];
  4938. if ( cacheresults ) {
  4939. if ( cacheresults !== 1 ) {
  4940. fragment = cacheresults;
  4941. }
  4942. }
  4943. }
  4944. if ( !fragment ) {
  4945. fragment = doc.createDocumentFragment();
  4946. jQuery.clean( args, doc, fragment, scripts );
  4947. }
  4948. if ( cacheable ) {
  4949. jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
  4950. }
  4951. return { fragment: fragment, cacheable: cacheable };
  4952. };
  4953. jQuery.fragments = {};
  4954. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  4955. jQuery.each({
  4956. appendTo: "append",
  4957. prependTo: "prepend",
  4958. insertBefore: "before",
  4959. insertAfter: "after",
  4960. replaceAll: "replaceWith"
  4961. }, function( name, original ) {
  4962. jQuery.fn[ name ] = function( selector ) {
  4963. var ret = [], insert = jQuery( selector ),
  4964. parent = this.length === 1 && this[0].parentNode;
  4965. if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
  4966. insert[ original ]( this[0] );
  4967. return this;
  4968. } else {
  4969. for ( var i = 0, l = insert.length; i < l; i++ ) {
  4970. var elems = (i > 0 ? this.clone(true) : this).get();
  4971. jQuery( insert[i] )[ original ]( elems );
  4972. ret = ret.concat( elems );
  4973. }
  4974. return this.pushStack( ret, name, insert.selector );
  4975. }
  4976. };
  4977. });
  4978. jQuery.extend({
  4979. clean: function( elems, context, fragment, scripts ) {
  4980. /// <summary>
  4981. /// This method is internal only.
  4982. /// </summary>
  4983. /// <private />
  4984. context = context || document;
  4985. // !context.createElement fails in IE with an error but returns typeof 'object'
  4986. if ( typeof context.createElement === "undefined" ) {
  4987. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  4988. }
  4989. var ret = [];
  4990. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  4991. if ( typeof elem === "number" ) {
  4992. elem += "";
  4993. }
  4994. if ( !elem ) {
  4995. continue;
  4996. }
  4997. // Convert html string into DOM nodes
  4998. if ( typeof elem === "string" && !rhtml.test( elem ) ) {
  4999. elem = context.createTextNode( elem );
  5000. } else if ( typeof elem === "string" ) {
  5001. // Fix "XHTML"-style tags in all browsers
  5002. elem = elem.replace(rxhtmlTag, "<$1></$2>");
  5003. // Trim whitespace, otherwise indexOf won't work as expected
  5004. var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
  5005. wrap = wrapMap[ tag ] || wrapMap._default,
  5006. depth = wrap[0],
  5007. div = context.createElement("div");
  5008. // Go to html and back, then peel off extra wrappers
  5009. div.innerHTML = wrap[1] + elem + wrap[2];
  5010. // Move to the right depth
  5011. while ( depth-- ) {
  5012. div = div.lastChild;
  5013. }
  5014. // Remove IE's autoinserted <tbody> from table fragments
  5015. if ( !jQuery.support.tbody ) {
  5016. // String was a <table>, *may* have spurious <tbody>
  5017. var hasBody = rtbody.test(elem),
  5018. tbody = tag === "table" && !hasBody ?
  5019. div.firstChild && div.firstChild.childNodes :
  5020. // String was a bare <thead> or <tfoot>
  5021. wrap[1] === "<table>" && !hasBody ?
  5022. div.childNodes :
  5023. [];
  5024. for ( var j = tbody.length - 1; j >= 0 ; --j ) {
  5025. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
  5026. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  5027. }
  5028. }
  5029. }
  5030. // IE completely kills leading whitespace when innerHTML is used
  5031. if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  5032. div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
  5033. }
  5034. elem = div.childNodes;
  5035. }
  5036. if ( elem.nodeType ) {
  5037. ret.push( elem );
  5038. } else {
  5039. ret = jQuery.merge( ret, elem );
  5040. }
  5041. }
  5042. if ( fragment ) {
  5043. for ( i = 0; ret[i]; i++ ) {
  5044. if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  5045. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  5046. } else {
  5047. if ( ret[i].nodeType === 1 ) {
  5048. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  5049. }
  5050. fragment.appendChild( ret[i] );
  5051. }
  5052. }
  5053. }
  5054. return ret;
  5055. },
  5056. cleanData: function( elems ) {
  5057. var data, id, cache = jQuery.cache,
  5058. special = jQuery.event.special,
  5059. deleteExpando = jQuery.support.deleteExpando;
  5060. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  5061. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  5062. continue;
  5063. }
  5064. id = elem[ jQuery.expando ];
  5065. if ( id ) {
  5066. data = cache[ id ];
  5067. if ( data && data.events ) {
  5068. for ( var type in data.events ) {
  5069. if ( special[ type ] ) {
  5070. jQuery.event.remove( elem, type );
  5071. } else {
  5072. jQuery.removeEvent( elem, type, data.handle );
  5073. }
  5074. }
  5075. }
  5076. if ( deleteExpando ) {
  5077. delete elem[ jQuery.expando ];
  5078. } else if ( elem.removeAttribute ) {
  5079. elem.removeAttribute( jQuery.expando );
  5080. }
  5081. delete cache[ id ];
  5082. }
  5083. }
  5084. }
  5085. });
  5086. function evalScript( i, elem ) {
  5087. /// <summary>
  5088. /// This method is internal.
  5089. /// </summary>
  5090. /// <private />
  5091. if ( elem.src ) {
  5092. jQuery.ajax({
  5093. url: elem.src,
  5094. async: false,
  5095. dataType: "script"
  5096. });
  5097. } else {
  5098. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  5099. }
  5100. if ( elem.parentNode ) {
  5101. elem.parentNode.removeChild( elem );
  5102. }
  5103. }
  5104. var ralpha = /alpha\([^)]*\)/i,
  5105. ropacity = /opacity=([^)]*)/,
  5106. rdashAlpha = /-([a-z])/ig,
  5107. rupper = /([A-Z])/g,
  5108. rnumpx = /^-?\d+(?:px)?$/i,
  5109. rnum = /^-?\d/,
  5110. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5111. cssWidth = [ "Left", "Right" ],
  5112. cssHeight = [ "Top", "Bottom" ],
  5113. curCSS,
  5114. // cache check for defaultView.getComputedStyle
  5115. getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
  5116. fcamelCase = function( all, letter ) {
  5117. return letter.toUpperCase();
  5118. };
  5119. jQuery.fn.css = function( name, value ) {
  5120. /// <summary>
  5121. /// Set a single style property to a value, on all matched elements.
  5122. /// If a number is provided, it is automatically converted into a pixel value.
  5123. /// Part of CSS
  5124. /// </summary>
  5125. /// <param name="name" type="String">
  5126. /// A CSS property name.
  5127. /// </param>
  5128. /// <param name="value" type="String">
  5129. /// A value to set for the property.
  5130. /// </param>
  5131. /// <returns type="jQuery" />
  5132. // Setting 'undefined' is a no-op
  5133. if ( arguments.length === 2 && value === undefined ) {
  5134. return this;
  5135. }
  5136. return jQuery.access( this, name, value, true, function( elem, name, value ) {
  5137. return value !== undefined ?
  5138. jQuery.style( elem, name, value ) :
  5139. jQuery.css( elem, name );
  5140. });
  5141. };
  5142. jQuery.extend({
  5143. // Add in style property hooks for overriding the default
  5144. // behavior of getting and setting a style property
  5145. cssHooks: {
  5146. opacity: {
  5147. get: function( elem, computed ) {
  5148. if ( computed ) {
  5149. // We should always get a number back from opacity
  5150. var ret = curCSS( elem, "opacity", "opacity" );
  5151. return ret === "" ? "1" : ret;
  5152. } else {
  5153. return elem.style.opacity;
  5154. }
  5155. }
  5156. }
  5157. },
  5158. // Exclude the following css properties to add px
  5159. cssNumber: {
  5160. "zIndex": true,
  5161. "fontWeight": true,
  5162. "opacity": true,
  5163. "zoom": true,
  5164. "lineHeight": true
  5165. },
  5166. // Add in properties whose names you wish to fix before
  5167. // setting or getting the value
  5168. cssProps: {
  5169. // normalize float css property
  5170. "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
  5171. },
  5172. // [vsdoc] todo
  5173. // Get and set the style property on a DOM Node
  5174. style: function( elem, name, value, extra ) {
  5175. // Don't set styles on text and comment nodes
  5176. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5177. return;
  5178. }
  5179. // Make sure that we're working with the right name
  5180. var ret, origName = jQuery.camelCase( name ),
  5181. style = elem.style, hooks = jQuery.cssHooks[ origName ];
  5182. name = jQuery.cssProps[ origName ] || origName;
  5183. // Check if we're setting a value
  5184. if ( value !== undefined ) {
  5185. // Make sure that NaN and null values aren't set. See: #7116
  5186. if ( typeof value === "number" && isNaN( value ) || value == null ) {
  5187. return;
  5188. }
  5189. // If a number was passed in, add 'px' to the (except for certain CSS properties)
  5190. if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
  5191. value += "px";
  5192. }
  5193. // If a hook was provided, use that value, otherwise just set the specified value
  5194. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
  5195. // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
  5196. // Fixes bug #5509
  5197. try {
  5198. style[ name ] = value;
  5199. } catch(e) {}
  5200. }
  5201. } else {
  5202. // If a hook was provided get the non-computed value from there
  5203. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  5204. return ret;
  5205. }
  5206. // Otherwise just get the value from the style object
  5207. return style[ name ];
  5208. }
  5209. },
  5210. css: function( elem, name, extra ) {
  5211. /// <summary>
  5212. /// This method is internal only.
  5213. /// </summary>
  5214. /// <private />
  5215. // Make sure that we're working with the right name
  5216. var ret, origName = jQuery.camelCase( name ),
  5217. hooks = jQuery.cssHooks[ origName ];
  5218. name = jQuery.cssProps[ origName ] || origName;
  5219. // If a hook was provided get the computed value from there
  5220. if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
  5221. return ret;
  5222. // Otherwise, if a way to get the computed value exists, use that
  5223. } else if ( curCSS ) {
  5224. return curCSS( elem, name, origName );
  5225. }
  5226. },
  5227. // A method for quickly swapping in/out CSS properties to get correct calculations
  5228. swap: function( elem, options, callback ) {
  5229. var old = {};
  5230. // Remember the old values, and insert the new ones
  5231. for ( var name in options ) {
  5232. old[ name ] = elem.style[ name ];
  5233. elem.style[ name ] = options[ name ];
  5234. }
  5235. callback.call( elem );
  5236. // Revert the old values
  5237. for ( name in options ) {
  5238. elem.style[ name ] = old[ name ];
  5239. }
  5240. },
  5241. camelCase: function( string ) {
  5242. return string.replace( rdashAlpha, fcamelCase );
  5243. }
  5244. });
  5245. // DEPRECATED, Use jQuery.css() instead
  5246. jQuery.curCSS = jQuery.css;
  5247. jQuery.each(["height", "width"], function( i, name ) {
  5248. jQuery.cssHooks[ name ] = {
  5249. get: function( elem, computed, extra ) {
  5250. var val;
  5251. if ( computed ) {
  5252. if ( elem.offsetWidth !== 0 ) {
  5253. val = getWH( elem, name, extra );
  5254. } else {
  5255. jQuery.swap( elem, cssShow, function() {
  5256. val = getWH( elem, name, extra );
  5257. });
  5258. }
  5259. return val + "px";
  5260. }
  5261. },
  5262. set: function( elem, value ) {
  5263. if ( rnumpx.test( value ) ) {
  5264. // ignore negative width and height values #1599
  5265. value = parseFloat(value);
  5266. if ( value >= 0 ) {
  5267. return value + "px";
  5268. }
  5269. } else {
  5270. return value;
  5271. }
  5272. }
  5273. };
  5274. });
  5275. if ( !jQuery.support.opacity ) {
  5276. jQuery.cssHooks.opacity = {
  5277. get: function( elem, computed ) {
  5278. // IE uses filters for opacity
  5279. return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
  5280. (parseFloat(RegExp.$1) / 100) + "" :
  5281. computed ? "1" : "";
  5282. },
  5283. set: function( elem, value ) {
  5284. var style = elem.style;
  5285. // IE has trouble with opacity if it does not have layout
  5286. // Force it by setting the zoom level
  5287. style.zoom = 1;
  5288. // Set the alpha filter to set the opacity
  5289. var opacity = jQuery.isNaN(value) ?
  5290. "" :
  5291. "alpha(opacity=" + value * 100 + ")",
  5292. filter = style.filter || "";
  5293. style.filter = ralpha.test(filter) ?
  5294. filter.replace(ralpha, opacity) :
  5295. style.filter + ' ' + opacity;
  5296. }
  5297. };
  5298. }
  5299. if ( getComputedStyle ) {
  5300. curCSS = function( elem, newName, name ) {
  5301. var ret, defaultView, computedStyle;
  5302. name = name.replace( rupper, "-$1" ).toLowerCase();
  5303. if ( !(defaultView = elem.ownerDocument.defaultView) ) {
  5304. return undefined;
  5305. }
  5306. if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
  5307. ret = computedStyle.getPropertyValue( name );
  5308. if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
  5309. ret = jQuery.style( elem, name );
  5310. }
  5311. }
  5312. return ret;
  5313. };
  5314. } else if ( document.documentElement.currentStyle ) {
  5315. curCSS = function( elem, name ) {
  5316. var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;
  5317. // From the awesome hack by Dean Edwards
  5318. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  5319. // If we're not dealing with a regular pixel number
  5320. // but a number that has a weird ending, we need to convert it to pixels
  5321. if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
  5322. // Remember the original values
  5323. left = style.left;
  5324. rsLeft = elem.runtimeStyle.left;
  5325. // Put in the new values to get a computed value out
  5326. elem.runtimeStyle.left = elem.currentStyle.left;
  5327. style.left = name === "fontSize" ? "1em" : (ret || 0);
  5328. ret = style.pixelLeft + "px";
  5329. // Revert the changed values
  5330. style.left = left;
  5331. elem.runtimeStyle.left = rsLeft;
  5332. }
  5333. return ret;
  5334. };
  5335. }
  5336. function getWH( elem, name, extra ) {
  5337. var which = name === "width" ? cssWidth : cssHeight,
  5338. val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
  5339. if ( extra === "border" ) {
  5340. return val;
  5341. }
  5342. jQuery.each( which, function() {
  5343. if ( !extra ) {
  5344. val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
  5345. }
  5346. if ( extra === "margin" ) {
  5347. val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
  5348. } else {
  5349. val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
  5350. }
  5351. });
  5352. return val;
  5353. }
  5354. if ( jQuery.expr && jQuery.expr.filters ) {
  5355. jQuery.expr.filters.hidden = function( elem ) {
  5356. var width = elem.offsetWidth, height = elem.offsetHeight;
  5357. return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
  5358. };
  5359. jQuery.expr.filters.visible = function( elem ) {
  5360. return !jQuery.expr.filters.hidden( elem );
  5361. };
  5362. }
  5363. var jsc = jQuery.now(),
  5364. rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  5365. rselectTextarea = /^(?:select|textarea)/i,
  5366. rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
  5367. rnoContent = /^(?:GET|HEAD|DELETE)$/,
  5368. rbracket = /\[\]$/,
  5369. jsre = /\=\?(&|$)/,
  5370. rquery = /\?/,
  5371. rts = /([?&])_=[^&]*/,
  5372. rurl = /^(\w+:)?\/\/([^\/?#]+)/,
  5373. r20 = /%20/g,
  5374. rhash = /#.*$/,
  5375. // Keep a copy of the old load method
  5376. _load = jQuery.fn.load;
  5377. jQuery.fn.extend({
  5378. load: function( url, params, callback ) {
  5379. /// <summary>
  5380. /// Loads HTML from a remote file and injects it into the DOM. By default performs a GET request, but if parameters are included
  5381. /// then a POST will be performed.
  5382. /// </summary>
  5383. /// <param name="url" type="String">
  5384. /// The URL of the HTML page to load.
  5385. /// </param>
  5386. /// <param name="data" optional="true" type="Map">
  5387. /// Key/value pairs that will be sent to the server.
  5388. /// </param>
  5389. /// <param name="callback" optional="true" type="Function">
  5390. /// The function called when the AJAX request is complete. It should map function(responseText, textStatus, XMLHttpRequest) such that this maps the injected DOM element.
  5391. /// </param>
  5392. /// <returns type="jQuery" />
  5393. if ( typeof url !== "string" && _load ) {
  5394. return _load.apply( this, arguments );
  5395. // Don't do a request if no elements are being requested
  5396. } else if ( !this.length ) {
  5397. return this;
  5398. }
  5399. var off = url.indexOf(" ");
  5400. if ( off >= 0 ) {
  5401. var selector = url.slice(off, url.length);
  5402. url = url.slice(0, off);
  5403. }
  5404. // Default to a GET request
  5405. var type = "GET";
  5406. // If the second parameter was provided
  5407. if ( params ) {
  5408. // If it's a function
  5409. if ( jQuery.isFunction( params ) ) {
  5410. // We assume that it's the callback
  5411. callback = params;
  5412. params = null;
  5413. // Otherwise, build a param string
  5414. } else if ( typeof params === "object" ) {
  5415. params = jQuery.param( params, jQuery.ajaxSettings.traditional );
  5416. type = "POST";
  5417. }
  5418. }
  5419. var self = this;
  5420. // Request the remote document
  5421. jQuery.ajax({
  5422. url: url,
  5423. type: type,
  5424. dataType: "html",
  5425. data: params,
  5426. complete: function( res, status ) {
  5427. // If successful, inject the HTML into all the matched elements
  5428. if ( status === "success" || status === "notmodified" ) {
  5429. // See if a selector was specified
  5430. self.html( selector ?
  5431. // Create a dummy div to hold the results
  5432. jQuery("<div>")
  5433. // inject the contents of the document in, removing the scripts
  5434. // to avoid any 'Permission Denied' errors in IE
  5435. .append(res.responseText.replace(rscript, ""))
  5436. // Locate the specified elements
  5437. .find(selector) :
  5438. // If not, just inject the full result
  5439. res.responseText );
  5440. }
  5441. if ( callback ) {
  5442. self.each( callback, [res.responseText, status, res] );
  5443. }
  5444. }
  5445. });
  5446. return this;
  5447. },
  5448. serialize: function() {
  5449. /// <summary>
  5450. /// Serializes a set of input elements into a string of data.
  5451. /// </summary>
  5452. /// <returns type="String">
  5453. /// The serialized result.
  5454. /// </returns>
  5455. return jQuery.param(this.serializeArray());
  5456. },
  5457. serializeArray: function() {
  5458. /// <summary>
  5459. /// Serializes all forms and form elements but returns a JSON data structure.
  5460. /// </summary>
  5461. /// <returns type="String">
  5462. /// A JSON data structure representing the serialized items.
  5463. /// </returns>
  5464. return this.map(function() {
  5465. return this.elements ? jQuery.makeArray(this.elements) : this;
  5466. })
  5467. .filter(function() {
  5468. return this.name && !this.disabled &&
  5469. (this.checked || rselectTextarea.test(this.nodeName) ||
  5470. rinput.test(this.type));
  5471. })
  5472. .map(function( i, elem ) {
  5473. var val = jQuery(this).val();
  5474. return val == null ?
  5475. null :
  5476. jQuery.isArray(val) ?
  5477. jQuery.map( val, function( val, i ) {
  5478. return { name: elem.name, value: val };
  5479. }) :
  5480. { name: elem.name, value: val };
  5481. }).get();
  5482. }
  5483. });
  5484. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  5485. // Attach a bunch of functions for handling common AJAX events
  5486. jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
  5487. jQuery.fn[o] = function( f ) {
  5488. return this.bind(o, f);
  5489. };
  5490. });
  5491. jQuery.extend({
  5492. get: function( url, data, callback, type ) {
  5493. /// <summary>
  5494. /// Loads a remote page using an HTTP GET request.
  5495. /// </summary>
  5496. /// <param name="url" type="String">The URL of the HTML page to load.</param>
  5497. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  5498. /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
  5499. /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
  5500. /// <returns type="XMLHttpRequest" />
  5501. // shift arguments if data argument was omited
  5502. if ( jQuery.isFunction( data ) ) {
  5503. type = type || callback;
  5504. callback = data;
  5505. data = null;
  5506. }
  5507. return jQuery.ajax({
  5508. type: "GET",
  5509. url: url,
  5510. data: data,
  5511. success: callback,
  5512. dataType: type
  5513. });
  5514. },
  5515. getScript: function( url, callback ) {
  5516. /// <summary>
  5517. /// Loads and executes a local JavaScript file using an HTTP GET request.
  5518. /// </summary>
  5519. /// <param name="url" type="String">The URL of the script to load.</param>
  5520. /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(data, textStatus) such that this maps the options for the AJAX request.</param>
  5521. /// <returns type="XMLHttpRequest" />
  5522. return jQuery.get(url, null, callback, "script");
  5523. },
  5524. getJSON: function( url, data, callback ) {
  5525. /// <summary>
  5526. /// Loads JSON data using an HTTP GET request.
  5527. /// </summary>
  5528. /// <param name="url" type="String">The URL of the JSON data to load.</param>
  5529. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  5530. /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete if the data is loaded successfully. It should map function(data, textStatus) such that this maps the options for this AJAX request.</param>
  5531. /// <returns type="XMLHttpRequest" />
  5532. return jQuery.get(url, data, callback, "json");
  5533. },
  5534. post: function( url, data, callback, type ) {
  5535. /// <summary>
  5536. /// Loads a remote page using an HTTP POST request.
  5537. /// </summary>
  5538. /// <param name="url" type="String">The URL of the HTML page to load.</param>
  5539. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  5540. /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
  5541. /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
  5542. /// <returns type="XMLHttpRequest" />
  5543. // shift arguments if data argument was omited
  5544. if ( jQuery.isFunction( data ) ) {
  5545. type = type || callback;
  5546. callback = data;
  5547. data = {};
  5548. }
  5549. return jQuery.ajax({
  5550. type: "POST",
  5551. url: url,
  5552. data: data,
  5553. success: callback,
  5554. dataType: type
  5555. });
  5556. },
  5557. ajaxSetup: function( settings ) {
  5558. /// <summary>
  5559. /// Sets up global settings for AJAX requests.
  5560. /// </summary>
  5561. /// <param name="settings" type="Options">A set of key/value pairs that configure the default Ajax request.</param>
  5562. jQuery.extend( jQuery.ajaxSettings, settings );
  5563. },
  5564. ajaxSettings: {
  5565. url: location.href,
  5566. global: true,
  5567. type: "GET",
  5568. contentType: "application/x-www-form-urlencoded",
  5569. processData: true,
  5570. async: true,
  5571. /*
  5572. timeout: 0,
  5573. data: null,
  5574. username: null,
  5575. password: null,
  5576. traditional: false,
  5577. */
  5578. // This function can be overriden by calling jQuery.ajaxSetup
  5579. xhr: function() {
  5580. return new window.XMLHttpRequest();
  5581. },
  5582. accepts: {
  5583. xml: "application/xml, text/xml",
  5584. html: "text/html",
  5585. script: "text/javascript, application/javascript",
  5586. json: "application/json, text/javascript",
  5587. text: "text/plain",
  5588. _default: "*/*"
  5589. }
  5590. },
  5591. ajax: function( origSettings ) {
  5592. /// <summary>
  5593. /// Load a remote page using an HTTP request.
  5594. /// </summary>
  5595. /// <private />
  5596. var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
  5597. jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
  5598. s.url = s.url.replace( rhash, "" );
  5599. // Use original (not extended) context object if it was provided
  5600. s.context = origSettings && origSettings.context != null ? origSettings.context : s;
  5601. // convert data if not already a string
  5602. if ( s.data && s.processData && typeof s.data !== "string" ) {
  5603. s.data = jQuery.param( s.data, s.traditional );
  5604. }
  5605. // Handle JSONP Parameter Callbacks
  5606. if ( s.dataType === "jsonp" ) {
  5607. if ( type === "GET" ) {
  5608. if ( !jsre.test( s.url ) ) {
  5609. s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  5610. }
  5611. } else if ( !s.data || !jsre.test(s.data) ) {
  5612. s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  5613. }
  5614. s.dataType = "json";
  5615. }
  5616. // Build temporary JSONP function
  5617. if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
  5618. jsonp = s.jsonpCallback || ("jsonp" + jsc++);
  5619. // Replace the =? sequence both in the query string and the data
  5620. if ( s.data ) {
  5621. s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  5622. }
  5623. s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  5624. // We need to make sure
  5625. // that a JSONP style response is executed properly
  5626. s.dataType = "script";
  5627. // Handle JSONP-style loading
  5628. var customJsonp = window[ jsonp ];
  5629. window[ jsonp ] = function( tmp ) {
  5630. data = tmp;
  5631. jQuery.handleSuccess( s, xhr, status, data );
  5632. jQuery.handleComplete( s, xhr, status, data );
  5633. if ( jQuery.isFunction( customJsonp ) ) {
  5634. customJsonp( tmp );
  5635. } else {
  5636. // Garbage collect
  5637. window[ jsonp ] = undefined;
  5638. try {
  5639. delete window[ jsonp ];
  5640. } catch( jsonpError ) {}
  5641. }
  5642. if ( head ) {
  5643. head.removeChild( script );
  5644. }
  5645. };
  5646. }
  5647. if ( s.dataType === "script" && s.cache === null ) {
  5648. s.cache = false;
  5649. }
  5650. if ( s.cache === false && type === "GET" ) {
  5651. var ts = jQuery.now();
  5652. // try replacing _= if it is there
  5653. var ret = s.url.replace(rts, "$1_=" + ts);
  5654. // if nothing was replaced, add timestamp to the end
  5655. s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
  5656. }
  5657. // If data is available, append data to url for get requests
  5658. if ( s.data && type === "GET" ) {
  5659. s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
  5660. }
  5661. // Watch for a new set of requests
  5662. if ( s.global && jQuery.active++ === 0 ) {
  5663. jQuery.event.trigger( "ajaxStart" );
  5664. }
  5665. // Matches an absolute URL, and saves the domain
  5666. var parts = rurl.exec( s.url ),
  5667. remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
  5668. // If we're requesting a remote document
  5669. // and trying to load JSON or Script with a GET
  5670. if ( s.dataType === "script" && type === "GET" && remote ) {
  5671. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  5672. var script = document.createElement("script");
  5673. if ( s.scriptCharset ) {
  5674. script.charset = s.scriptCharset;
  5675. }
  5676. script.src = s.url;
  5677. // Handle Script loading
  5678. if ( !jsonp ) {
  5679. var done = false;
  5680. // Attach handlers for all browsers
  5681. script.onload = script.onreadystatechange = function() {
  5682. if ( !done && (!this.readyState ||
  5683. this.readyState === "loaded" || this.readyState === "complete") ) {
  5684. done = true;
  5685. jQuery.handleSuccess( s, xhr, status, data );
  5686. jQuery.handleComplete( s, xhr, status, data );
  5687. // Handle memory leak in IE
  5688. script.onload = script.onreadystatechange = null;
  5689. if ( head && script.parentNode ) {
  5690. head.removeChild( script );
  5691. }
  5692. }
  5693. };
  5694. }
  5695. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  5696. // This arises when a base node is used (#2709 and #4378).
  5697. head.insertBefore( script, head.firstChild );
  5698. // We handle everything using the script element injection
  5699. return undefined;
  5700. }
  5701. var requestDone = false;
  5702. // Create the request object
  5703. var xhr = s.xhr();
  5704. if ( !xhr ) {
  5705. return;
  5706. }
  5707. // Open the socket
  5708. // Passing null username, generates a login popup on Opera (#2865)
  5709. if ( s.username ) {
  5710. xhr.open(type, s.url, s.async, s.username, s.password);
  5711. } else {
  5712. xhr.open(type, s.url, s.async);
  5713. }
  5714. // Need an extra try/catch for cross domain requests in Firefox 3
  5715. try {
  5716. // Set content-type if data specified and content-body is valid for this type
  5717. if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
  5718. xhr.setRequestHeader("Content-Type", s.contentType);
  5719. }
  5720. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  5721. if ( s.ifModified ) {
  5722. if ( jQuery.lastModified[s.url] ) {
  5723. xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
  5724. }
  5725. if ( jQuery.etag[s.url] ) {
  5726. xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
  5727. }
  5728. }
  5729. // Set header so the called script knows that it's an XMLHttpRequest
  5730. // Only send the header if it's not a remote XHR
  5731. if ( !remote ) {
  5732. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  5733. }
  5734. // Set the Accepts header for the server, depending on the dataType
  5735. xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
  5736. s.accepts[ s.dataType ] + ", */*; q=0.01" :
  5737. s.accepts._default );
  5738. } catch( headerError ) {}
  5739. // Allow custom headers/mimetypes and early abort
  5740. if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
  5741. // Handle the global AJAX counter
  5742. if ( s.global && jQuery.active-- === 1 ) {
  5743. jQuery.event.trigger( "ajaxStop" );
  5744. }
  5745. // close opended socket
  5746. xhr.abort();
  5747. return false;
  5748. }
  5749. if ( s.global ) {
  5750. jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
  5751. }
  5752. // Wait for a response to come back
  5753. var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
  5754. // The request was aborted
  5755. if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
  5756. // Opera doesn't call onreadystatechange before this point
  5757. // so we simulate the call
  5758. if ( !requestDone ) {
  5759. jQuery.handleComplete( s, xhr, status, data );
  5760. }
  5761. requestDone = true;
  5762. if ( xhr ) {
  5763. xhr.onreadystatechange = jQuery.noop;
  5764. }
  5765. // The transfer is complete and the data is available, or the request timed out
  5766. } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
  5767. requestDone = true;
  5768. xhr.onreadystatechange = jQuery.noop;
  5769. status = isTimeout === "timeout" ?
  5770. "timeout" :
  5771. !jQuery.httpSuccess( xhr ) ?
  5772. "error" :
  5773. s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
  5774. "notmodified" :
  5775. "success";
  5776. var errMsg;
  5777. if ( status === "success" ) {
  5778. // Watch for, and catch, XML document parse errors
  5779. try {
  5780. // process the data (runs the xml through httpData regardless of callback)
  5781. data = jQuery.httpData( xhr, s.dataType, s );
  5782. } catch( parserError ) {
  5783. status = "parsererror";
  5784. errMsg = parserError;
  5785. }
  5786. }
  5787. // Make sure that the request was successful or notmodified
  5788. if ( status === "success" || status === "notmodified" ) {
  5789. // JSONP handles its own success callback
  5790. if ( !jsonp ) {
  5791. jQuery.handleSuccess( s, xhr, status, data );
  5792. }
  5793. } else {
  5794. jQuery.handleError( s, xhr, status, errMsg );
  5795. }
  5796. // Fire the complete handlers
  5797. if ( !jsonp ) {
  5798. jQuery.handleComplete( s, xhr, status, data );
  5799. }
  5800. if ( isTimeout === "timeout" ) {
  5801. xhr.abort();
  5802. }
  5803. // Stop memory leaks
  5804. if ( s.async ) {
  5805. xhr = null;
  5806. }
  5807. }
  5808. };
  5809. // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
  5810. // Opera doesn't fire onreadystatechange at all on abort
  5811. try {
  5812. var oldAbort = xhr.abort;
  5813. xhr.abort = function() {
  5814. // xhr.abort in IE7 is not a native JS function
  5815. // and does not have a call property
  5816. if ( xhr && oldAbort.call ) {
  5817. oldAbort.call( xhr );
  5818. }
  5819. onreadystatechange( "abort" );
  5820. };
  5821. } catch( abortError ) {}
  5822. // Timeout checker
  5823. if ( s.async && s.timeout > 0 ) {
  5824. setTimeout(function() {
  5825. // Check to see if the request is still happening
  5826. if ( xhr && !requestDone ) {
  5827. onreadystatechange( "timeout" );
  5828. }
  5829. }, s.timeout);
  5830. }
  5831. // Send the data
  5832. try {
  5833. xhr.send( noContent || s.data == null ? null : s.data );
  5834. } catch( sendError ) {
  5835. jQuery.handleError( s, xhr, null, sendError );
  5836. // Fire the complete handlers
  5837. jQuery.handleComplete( s, xhr, status, data );
  5838. }
  5839. // firefox 1.5 doesn't fire statechange for sync requests
  5840. if ( !s.async ) {
  5841. onreadystatechange();
  5842. }
  5843. // return XMLHttpRequest to allow aborting the request etc.
  5844. return xhr;
  5845. },
  5846. // Serialize an array of form elements or a set of
  5847. // key/values into a query string
  5848. param: function( a, traditional ) {
  5849. /// <summary>
  5850. /// Create a serialized representation of an array or object, suitable for use in a URL
  5851. /// query string or Ajax request.
  5852. /// </summary>
  5853. /// <param name="a" type="Object">
  5854. /// An array or object to serialize.
  5855. /// </param>
  5856. /// <param name="traditional" type="Boolean">
  5857. /// A Boolean indicating whether to perform a traditional "shallow" serialization.
  5858. /// </param>
  5859. /// <returns type="String" />
  5860. var s = [], add = function( key, value ) {
  5861. // If value is a function, invoke it and return its value
  5862. value = jQuery.isFunction(value) ? value() : value;
  5863. s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
  5864. };
  5865. // Set traditional to true for jQuery <= 1.3.2 behavior.
  5866. if ( traditional === undefined ) {
  5867. traditional = jQuery.ajaxSettings.traditional;
  5868. }
  5869. // If an array was passed in, assume that it is an array of form elements.
  5870. if ( jQuery.isArray(a) || a.jquery ) {
  5871. // Serialize the form elements
  5872. jQuery.each( a, function() {
  5873. add( this.name, this.value );
  5874. });
  5875. } else {
  5876. // If traditional, encode the "old" way (the way 1.3.2 or older
  5877. // did it), otherwise encode params recursively.
  5878. for ( var prefix in a ) {
  5879. buildParams( prefix, a[prefix], traditional, add );
  5880. }
  5881. }
  5882. // Return the resulting serialization
  5883. return s.join("&").replace(r20, "+");
  5884. }
  5885. });
  5886. function buildParams( prefix, obj, traditional, add ) {
  5887. if ( jQuery.isArray(obj) && obj.length ) {
  5888. // Serialize array item.
  5889. jQuery.each( obj, function( i, v ) {
  5890. if ( traditional || rbracket.test( prefix ) ) {
  5891. // Treat each array item as a scalar.
  5892. add( prefix, v );
  5893. } else {
  5894. // If array item is non-scalar (array or object), encode its
  5895. // numeric index to resolve deserialization ambiguity issues.
  5896. // Note that rack (as of 1.0.0) can't currently deserialize
  5897. // nested arrays properly, and attempting to do so may cause
  5898. // a server error. Possible fixes are to modify rack's
  5899. // deserialization algorithm or to provide an option or flag
  5900. // to force array serialization to be shallow.
  5901. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
  5902. }
  5903. });
  5904. } else if ( !traditional && obj != null && typeof obj === "object" ) {
  5905. if ( jQuery.isEmptyObject( obj ) ) {
  5906. add( prefix, "" );
  5907. // Serialize object item.
  5908. } else {
  5909. jQuery.each( obj, function( k, v ) {
  5910. buildParams( prefix + "[" + k + "]", v, traditional, add );
  5911. });
  5912. }
  5913. } else {
  5914. // Serialize scalar item.
  5915. add( prefix, obj );
  5916. }
  5917. }
  5918. // This is still on the jQuery object... for now
  5919. // Want to move this to jQuery.ajax some day
  5920. jQuery.extend({
  5921. // Counter for holding the number of active queries
  5922. active: 0,
  5923. // Last-Modified header cache for next request
  5924. lastModified: {},
  5925. etag: {},
  5926. handleError: function( s, xhr, status, e ) {
  5927. /// <summary>
  5928. /// This method is internal.
  5929. /// </summary>
  5930. /// <private />
  5931. // If a local callback was specified, fire it
  5932. if ( s.error ) {
  5933. s.error.call( s.context, xhr, status, e );
  5934. }
  5935. // Fire the global callback
  5936. if ( s.global ) {
  5937. jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
  5938. }
  5939. },
  5940. handleSuccess: function( s, xhr, status, data ) {
  5941. /// <summary>
  5942. /// This method is internal.
  5943. /// </summary>
  5944. /// <private />
  5945. // If a local callback was specified, fire it and pass it the data
  5946. if ( s.success ) {
  5947. s.success.call( s.context, data, status, xhr );
  5948. }
  5949. // Fire the global callback
  5950. if ( s.global ) {
  5951. jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
  5952. }
  5953. },
  5954. handleComplete: function( s, xhr, status ) {
  5955. // Process result
  5956. if ( s.complete ) {
  5957. s.complete.call( s.context, xhr, status );
  5958. }
  5959. // The request was completed
  5960. if ( s.global ) {
  5961. jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
  5962. }
  5963. // Handle the global AJAX counter
  5964. if ( s.global && jQuery.active-- === 1 ) {
  5965. jQuery.event.trigger( "ajaxStop" );
  5966. }
  5967. },
  5968. triggerGlobal: function( s, type, args ) {
  5969. (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
  5970. },
  5971. // Determines if an XMLHttpRequest was successful or not
  5972. httpSuccess: function( xhr ) {
  5973. try {
  5974. // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  5975. return !xhr.status && location.protocol === "file:" ||
  5976. xhr.status >= 200 && xhr.status < 300 ||
  5977. xhr.status === 304 || xhr.status === 1223;
  5978. } catch(e) {}
  5979. return false;
  5980. },
  5981. // Determines if an XMLHttpRequest returns NotModified
  5982. httpNotModified: function( xhr, url ) {
  5983. /// <summary>
  5984. /// This method is internal.
  5985. /// </summary>
  5986. /// <private />
  5987. var lastModified = xhr.getResponseHeader("Last-Modified"),
  5988. etag = xhr.getResponseHeader("Etag");
  5989. if ( lastModified ) {
  5990. jQuery.lastModified[url] = lastModified;
  5991. }
  5992. if ( etag ) {
  5993. jQuery.etag[url] = etag;
  5994. }
  5995. return xhr.status === 304;
  5996. },
  5997. httpData: function( xhr, type, s ) {
  5998. /// <summary>
  5999. /// This method is internal.
  6000. /// </summary>
  6001. /// <private />
  6002. var ct = xhr.getResponseHeader("content-type") || "",
  6003. xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
  6004. data = xml ? xhr.responseXML : xhr.responseText;
  6005. if ( xml && data.documentElement.nodeName === "parsererror" ) {
  6006. jQuery.error( "parsererror" );
  6007. }
  6008. // Allow a pre-filtering function to sanitize the response
  6009. // s is checked to keep backwards compatibility
  6010. if ( s && s.dataFilter ) {
  6011. data = s.dataFilter( data, type );
  6012. }
  6013. // The filter can actually parse the response
  6014. if ( typeof data === "string" ) {
  6015. // Get the JavaScript object, if JSON is used.
  6016. if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
  6017. data = jQuery.parseJSON( data );
  6018. // If the type is "script", eval it in global context
  6019. } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
  6020. jQuery.globalEval( data );
  6021. }
  6022. }
  6023. return data;
  6024. }
  6025. });
  6026. /*
  6027. * Create the request object; Microsoft failed to properly
  6028. * implement the XMLHttpRequest in IE7 (can't request local files),
  6029. * so we use the ActiveXObject when it is available
  6030. * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
  6031. * we need a fallback.
  6032. */
  6033. if ( window.ActiveXObject ) {
  6034. jQuery.ajaxSettings.xhr = function() {
  6035. if ( window.location.protocol !== "file:" ) {
  6036. try {
  6037. return new window.XMLHttpRequest();
  6038. } catch(xhrError) {}
  6039. }
  6040. try {
  6041. return new window.ActiveXObject("Microsoft.XMLHTTP");
  6042. } catch(activeError) {}
  6043. };
  6044. }
  6045. // Does this browser support XHR requests?
  6046. jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
  6047. var elemdisplay = {},
  6048. rfxtypes = /^(?:toggle|show|hide)$/,
  6049. rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
  6050. timerId,
  6051. fxAttrs = [
  6052. // height animations
  6053. [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  6054. // width animations
  6055. [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  6056. // opacity animations
  6057. [ "opacity" ]
  6058. ];
  6059. jQuery.fn.extend({
  6060. show: function( speed, easing, callback ) {
  6061. /// <summary>
  6062. /// Show all matched elements using a graceful animation and firing an optional callback after completion.
  6063. /// </summary>
  6064. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  6065. /// the number of milliseconds to run the animation</param>
  6066. /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
  6067. /// <returns type="jQuery" />
  6068. if ( speed || speed === 0 ) {
  6069. return this.animate( genFx("show", 3), speed, easing, callback);
  6070. } else {
  6071. for ( var i = 0, j = this.length; i < j; i++ ) {
  6072. // Reset the inline display of this element to learn if it is
  6073. // being hidden by cascaded rules or not
  6074. if ( !jQuery.data(this[i], "olddisplay") && this[i].style.display === "none" ) {
  6075. this[i].style.display = "";
  6076. }
  6077. // Set elements which have been overridden with display: none
  6078. // in a stylesheet to whatever the default browser style is
  6079. // for such an element
  6080. if ( this[i].style.display === "" && jQuery.css( this[i], "display" ) === "none" ) {
  6081. jQuery.data(this[i], "olddisplay", defaultDisplay(this[i].nodeName));
  6082. }
  6083. }
  6084. // Set the display of most of the elements in a second loop
  6085. // to avoid the constant reflow
  6086. for ( i = 0; i < j; i++ ) {
  6087. this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
  6088. }
  6089. return this;
  6090. }
  6091. },
  6092. hide: function( speed, easing, callback ) {
  6093. /// <summary>
  6094. /// Hides all matched elements using a graceful animation and firing an optional callback after completion.
  6095. /// </summary>
  6096. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  6097. /// the number of milliseconds to run the animation</param>
  6098. /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
  6099. /// <returns type="jQuery" />
  6100. if ( speed || speed === 0 ) {
  6101. return this.animate( genFx("hide", 3), speed, easing, callback);
  6102. } else {
  6103. for ( var i = 0, j = this.length; i < j; i++ ) {
  6104. var display = jQuery.css( this[i], "display" );
  6105. if ( display !== "none" ) {
  6106. jQuery.data( this[i], "olddisplay", display );
  6107. }
  6108. }
  6109. // Set the display of the elements in a second loop
  6110. // to avoid the constant reflow
  6111. for ( i = 0; i < j; i++ ) {
  6112. this[i].style.display = "none";
  6113. }
  6114. return this;
  6115. }
  6116. },
  6117. // Save the old toggle function
  6118. _toggle: jQuery.fn.toggle,
  6119. toggle: function( fn, fn2, callback ) {
  6120. /// <summary>
  6121. /// Toggles displaying each of the set of matched elements.
  6122. /// </summary>
  6123. /// <returns type="jQuery" />
  6124. var bool = typeof fn === "boolean";
  6125. if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
  6126. this._toggle.apply( this, arguments );
  6127. } else if ( fn == null || bool ) {
  6128. this.each(function() {
  6129. var state = bool ? fn : jQuery(this).is(":hidden");
  6130. jQuery(this)[ state ? "show" : "hide" ]();
  6131. });
  6132. } else {
  6133. this.animate(genFx("toggle", 3), fn, fn2, callback);
  6134. }
  6135. return this;
  6136. },
  6137. fadeTo: function( speed, to, easing, callback ) {
  6138. /// <summary>
  6139. /// Fades the opacity of all matched elements to a specified opacity.
  6140. /// </summary>
  6141. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  6142. /// the number of milliseconds to run the animation</param>
  6143. /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
  6144. /// <returns type="jQuery" />
  6145. return this.filter(":hidden").css("opacity", 0).show().end()
  6146. .animate({opacity: to}, speed, easing, callback);
  6147. },
  6148. animate: function( prop, speed, easing, callback ) {
  6149. /// <summary>
  6150. /// A function for making custom animations.
  6151. /// </summary>
  6152. /// <param name="prop" type="Options">A set of style attributes that you wish to animate and to what end.</param>
  6153. /// <param name="speed" optional="true" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  6154. /// the number of milliseconds to run the animation</param>
  6155. /// <param name="easing" optional="true" type="String">The name of the easing effect that you want to use. There are two built-in values, 'linear' and 'swing'.</param>
  6156. /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
  6157. /// <returns type="jQuery" />
  6158. var optall = jQuery.speed(speed, easing, callback);
  6159. if ( jQuery.isEmptyObject( prop ) ) {
  6160. return this.each( optall.complete );
  6161. }
  6162. return this[ optall.queue === false ? "each" : "queue" ](function() {
  6163. // XXX ‘this’ does not always have a nodeName when running the
  6164. // test suite
  6165. var opt = jQuery.extend({}, optall), p,
  6166. isElement = this.nodeType === 1,
  6167. hidden = isElement && jQuery(this).is(":hidden"),
  6168. self = this;
  6169. for ( p in prop ) {
  6170. var name = jQuery.camelCase( p );
  6171. if ( p !== name ) {
  6172. prop[ name ] = prop[ p ];
  6173. delete prop[ p ];
  6174. p = name;
  6175. }
  6176. if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
  6177. return opt.complete.call(this);
  6178. }
  6179. if ( isElement && ( p === "height" || p === "width" ) ) {
  6180. // Make sure that nothing sneaks out
  6181. // Record all 3 overflow attributes because IE does not
  6182. // change the overflow attribute when overflowX and
  6183. // overflowY are set to the same value
  6184. opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
  6185. // Set display property to inline-block for height/width
  6186. // animations on inline elements that are having width/height
  6187. // animated
  6188. if ( jQuery.css( this, "display" ) === "inline" &&
  6189. jQuery.css( this, "float" ) === "none" ) {
  6190. if ( !jQuery.support.inlineBlockNeedsLayout ) {
  6191. this.style.display = "inline-block";
  6192. } else {
  6193. var display = defaultDisplay(this.nodeName);
  6194. // inline-level elements accept inline-block;
  6195. // block-level elements need to be inline with layout
  6196. if ( display === "inline" ) {
  6197. this.style.display = "inline-block";
  6198. } else {
  6199. this.style.display = "inline";
  6200. this.style.zoom = 1;
  6201. }
  6202. }
  6203. }
  6204. }
  6205. if ( jQuery.isArray( prop[p] ) ) {
  6206. // Create (if needed) and add to specialEasing
  6207. (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
  6208. prop[p] = prop[p][0];
  6209. }
  6210. }
  6211. if ( opt.overflow != null ) {
  6212. this.style.overflow = "hidden";
  6213. }
  6214. opt.curAnim = jQuery.extend({}, prop);
  6215. jQuery.each( prop, function( name, val ) {
  6216. var e = new jQuery.fx( self, opt, name );
  6217. if ( rfxtypes.test(val) ) {
  6218. e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  6219. } else {
  6220. var parts = rfxnum.exec(val),
  6221. start = e.cur(true) || 0;
  6222. if ( parts ) {
  6223. var end = parseFloat( parts[2] ),
  6224. unit = parts[3] || "px";
  6225. // We need to compute starting value
  6226. if ( unit !== "px" ) {
  6227. jQuery.style( self, name, (end || 1) + unit);
  6228. start = ((end || 1) / e.cur(true)) * start;
  6229. jQuery.style( self, name, start + unit);
  6230. }
  6231. // If a +=/-= token was provided, we're doing a relative animation
  6232. if ( parts[1] ) {
  6233. end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
  6234. }
  6235. e.custom( start, end, unit );
  6236. } else {
  6237. e.custom( start, val, "" );
  6238. }
  6239. }
  6240. });
  6241. // For JS strict compliance
  6242. return true;
  6243. });
  6244. },
  6245. stop: function( clearQueue, gotoEnd ) {
  6246. /// <summary>
  6247. /// Stops all currently animations on the specified elements.
  6248. /// </summary>
  6249. /// <param name="clearQueue" optional="true" type="Boolean">True to clear animations that are queued to run.</param>
  6250. /// <param name="gotoEnd" optional="true" type="Boolean">True to move the element value to the end of its animation target.</param>
  6251. /// <returns type="jQuery" />
  6252. var timers = jQuery.timers;
  6253. if ( clearQueue ) {
  6254. this.queue([]);
  6255. }
  6256. this.each(function() {
  6257. // go in reverse order so anything added to the queue during the loop is ignored
  6258. for ( var i = timers.length - 1; i >= 0; i-- ) {
  6259. if ( timers[i].elem === this ) {
  6260. if (gotoEnd) {
  6261. // force the next step to be the last
  6262. timers[i](true);
  6263. }
  6264. timers.splice(i, 1);
  6265. }
  6266. }
  6267. });
  6268. // start the next in the queue if the last step wasn't forced
  6269. if ( !gotoEnd ) {
  6270. this.dequeue();
  6271. }
  6272. return this;
  6273. }
  6274. });
  6275. function genFx( type, num ) {
  6276. var obj = {};
  6277. jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
  6278. obj[ this ] = type;
  6279. });
  6280. return obj;
  6281. }
  6282. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  6283. // Generate shortcuts for custom animations
  6284. jQuery.each({
  6285. slideDown: genFx("show", 1),
  6286. slideUp: genFx("hide", 1),
  6287. slideToggle: genFx("toggle", 1),
  6288. fadeIn: { opacity: "show" },
  6289. fadeOut: { opacity: "hide" }
  6290. }, function( name, props ) {
  6291. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6292. return this.animate( props, speed, easing, callback );
  6293. };
  6294. });
  6295. jQuery.extend({
  6296. speed: function( speed, easing, fn ) {
  6297. /// <summary>
  6298. /// This member is internal.
  6299. /// </summary>
  6300. /// <private />
  6301. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  6302. complete: fn || !fn && easing ||
  6303. jQuery.isFunction( speed ) && speed,
  6304. duration: speed,
  6305. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  6306. };
  6307. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  6308. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
  6309. // Queueing
  6310. opt.old = opt.complete;
  6311. opt.complete = function() {
  6312. if ( opt.queue !== false ) {
  6313. jQuery(this).dequeue();
  6314. }
  6315. if ( jQuery.isFunction( opt.old ) ) {
  6316. opt.old.call( this );
  6317. }
  6318. };
  6319. return opt;
  6320. },
  6321. easing: {
  6322. linear: function( p, n, firstNum, diff ) {
  6323. /// <summary>
  6324. /// This member is internal.
  6325. /// </summary>
  6326. /// <private />
  6327. return firstNum + diff * p;
  6328. },
  6329. swing: function( p, n, firstNum, diff ) {
  6330. /// <summary>
  6331. /// This member is internal.
  6332. /// </summary>
  6333. /// <private />
  6334. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  6335. }
  6336. },
  6337. timers: [],
  6338. fx: function( elem, options, prop ) {
  6339. /// <summary>
  6340. /// This member is internal.
  6341. /// </summary>
  6342. /// <private />
  6343. this.options = options;
  6344. this.elem = elem;
  6345. this.prop = prop;
  6346. if ( !options.orig ) {
  6347. options.orig = {};
  6348. }
  6349. }
  6350. });
  6351. jQuery.fx.prototype = {
  6352. // Simple function for setting a style value
  6353. update: function() {
  6354. /// <summary>
  6355. /// This member is internal.
  6356. /// </summary>
  6357. /// <private />
  6358. if ( this.options.step ) {
  6359. this.options.step.call( this.elem, this.now, this );
  6360. }
  6361. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  6362. },
  6363. // Get the current size
  6364. cur: function() {
  6365. /// <summary>
  6366. /// This member is internal.
  6367. /// </summary>
  6368. /// <private />
  6369. if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
  6370. return this.elem[ this.prop ];
  6371. }
  6372. var r = parseFloat( jQuery.css( this.elem, this.prop ) );
  6373. return r && r > -10000 ? r : 0;
  6374. },
  6375. // Start an animation from one number to another
  6376. custom: function( from, to, unit ) {
  6377. /// <summary>
  6378. /// This member is internal.
  6379. /// </summary>
  6380. /// <private />
  6381. this.startTime = jQuery.now();
  6382. this.start = from;
  6383. this.end = to;
  6384. this.unit = unit || this.unit || "px";
  6385. this.now = this.start;
  6386. this.pos = this.state = 0;
  6387. var self = this, fx = jQuery.fx;
  6388. function t( gotoEnd ) {
  6389. return self.step(gotoEnd);
  6390. }
  6391. t.elem = this.elem;
  6392. if ( t() && jQuery.timers.push(t) && !timerId ) {
  6393. timerId = setInterval(fx.tick, fx.interval);
  6394. }
  6395. },
  6396. // Simple 'show' function
  6397. show: function() {
  6398. /// <summary>
  6399. /// Displays each of the set of matched elements if they are hidden.
  6400. /// </summary>
  6401. // Remember where we started, so that we can go back to it later
  6402. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6403. this.options.show = true;
  6404. // Begin the animation
  6405. // Make sure that we start at a small width/height to avoid any
  6406. // flash of content
  6407. this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
  6408. // Start by showing the element
  6409. jQuery( this.elem ).show();
  6410. },
  6411. // Simple 'hide' function
  6412. hide: function() {
  6413. /// <summary>
  6414. /// Hides each of the set of matched elements if they are shown.
  6415. /// </summary>
  6416. // Remember where we started, so that we can go back to it later
  6417. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6418. this.options.hide = true;
  6419. // Begin the animation
  6420. this.custom(this.cur(), 0);
  6421. },
  6422. // Each step of an animation
  6423. step: function( gotoEnd ) {
  6424. /// <summary>
  6425. /// This member is internal.
  6426. /// </summary>
  6427. /// <private />
  6428. var t = jQuery.now(), done = true;
  6429. if ( gotoEnd || t >= this.options.duration + this.startTime ) {
  6430. this.now = this.end;
  6431. this.pos = this.state = 1;
  6432. this.update();
  6433. this.options.curAnim[ this.prop ] = true;
  6434. for ( var i in this.options.curAnim ) {
  6435. if ( this.options.curAnim[i] !== true ) {
  6436. done = false;
  6437. }
  6438. }
  6439. if ( done ) {
  6440. // Reset the overflow
  6441. if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
  6442. var elem = this.elem, options = this.options;
  6443. jQuery.each( [ "", "X", "Y" ], function (index, value) {
  6444. elem.style[ "overflow" + value ] = options.overflow[index];
  6445. } );
  6446. }
  6447. // Hide the element if the "hide" operation was done
  6448. if ( this.options.hide ) {
  6449. jQuery(this.elem).hide();
  6450. }
  6451. // Reset the properties, if the item has been hidden or shown
  6452. if ( this.options.hide || this.options.show ) {
  6453. for ( var p in this.options.curAnim ) {
  6454. jQuery.style( this.elem, p, this.options.orig[p] );
  6455. }
  6456. }
  6457. // Execute the complete function
  6458. this.options.complete.call( this.elem );
  6459. }
  6460. return false;
  6461. } else {
  6462. var n = t - this.startTime;
  6463. this.state = n / this.options.duration;
  6464. // Perform the easing function, defaults to swing
  6465. var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
  6466. var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
  6467. this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
  6468. this.now = this.start + ((this.end - this.start) * this.pos);
  6469. // Perform the next step of the animation
  6470. this.update();
  6471. }
  6472. return true;
  6473. }
  6474. };
  6475. jQuery.extend( jQuery.fx, {
  6476. tick: function() {
  6477. var timers = jQuery.timers;
  6478. for ( var i = 0; i < timers.length; i++ ) {
  6479. if ( !timers[i]() ) {
  6480. timers.splice(i--, 1);
  6481. }
  6482. }
  6483. if ( !timers.length ) {
  6484. jQuery.fx.stop();
  6485. }
  6486. },
  6487. interval: 13,
  6488. stop: function() {
  6489. clearInterval( timerId );
  6490. timerId = null;
  6491. },
  6492. speeds: {
  6493. slow: 600,
  6494. fast: 200,
  6495. // Default speed
  6496. _default: 400
  6497. },
  6498. step: {
  6499. opacity: function( fx ) {
  6500. jQuery.style( fx.elem, "opacity", fx.now );
  6501. },
  6502. _default: function( fx ) {
  6503. if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
  6504. fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
  6505. } else {
  6506. fx.elem[ fx.prop ] = fx.now;
  6507. }
  6508. }
  6509. }
  6510. });
  6511. if ( jQuery.expr && jQuery.expr.filters ) {
  6512. jQuery.expr.filters.animated = function( elem ) {
  6513. return jQuery.grep(jQuery.timers, function( fn ) {
  6514. return elem === fn.elem;
  6515. }).length;
  6516. };
  6517. }
  6518. function defaultDisplay( nodeName ) {
  6519. if ( !elemdisplay[ nodeName ] ) {
  6520. var elem = jQuery("<" + nodeName + ">").appendTo("body"),
  6521. display = elem.css("display");
  6522. elem.remove();
  6523. if ( display === "none" || display === "" ) {
  6524. display = "block";
  6525. }
  6526. elemdisplay[ nodeName ] = display;
  6527. }
  6528. return elemdisplay[ nodeName ];
  6529. }
  6530. var rtable = /^t(?:able|d|h)$/i,
  6531. rroot = /^(?:body|html)$/i;
  6532. if ( "getBoundingClientRect" in document.documentElement ) {
  6533. jQuery.fn.offset = function( options ) {
  6534. /// <summary>
  6535. /// Set the current coordinates of every element in the set of matched elements,
  6536. /// relative to the document.
  6537. /// </summary>
  6538. /// <param name="options" type="Object">
  6539. /// An object containing the properties top and left, which are integers indicating the
  6540. /// new top and left coordinates for the elements.
  6541. /// </param>
  6542. /// <returns type="jQuery" />
  6543. var elem = this[0], box;
  6544. if ( options ) {
  6545. return this.each(function( i ) {
  6546. jQuery.offset.setOffset( this, options, i );
  6547. });
  6548. }
  6549. if ( !elem || !elem.ownerDocument ) {
  6550. return null;
  6551. }
  6552. if ( elem === elem.ownerDocument.body ) {
  6553. return jQuery.offset.bodyOffset( elem );
  6554. }
  6555. try {
  6556. box = elem.getBoundingClientRect();
  6557. } catch(e) {}
  6558. var doc = elem.ownerDocument,
  6559. docElem = doc.documentElement;
  6560. // Make sure we're not dealing with a disconnected DOM node
  6561. if ( !box || !jQuery.contains( docElem, elem ) ) {
  6562. return box || { top: 0, left: 0 };
  6563. }
  6564. var body = doc.body,
  6565. win = getWindow(doc),
  6566. clientTop = docElem.clientTop || body.clientTop || 0,
  6567. clientLeft = docElem.clientLeft || body.clientLeft || 0,
  6568. scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
  6569. scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
  6570. top = box.top + scrollTop - clientTop,
  6571. left = box.left + scrollLeft - clientLeft;
  6572. return { top: top, left: left };
  6573. };
  6574. } else {
  6575. jQuery.fn.offset = function( options ) {
  6576. /// <summary>
  6577. /// Set the current coordinates of every element in the set of matched elements,
  6578. /// relative to the document.
  6579. /// </summary>
  6580. /// <param name="options" type="Object">
  6581. /// An object containing the properties top and left, which are integers indicating the
  6582. /// new top and left coordinates for the elements.
  6583. /// </param>
  6584. /// <returns type="jQuery" />
  6585. var elem = this[0];
  6586. if ( options ) {
  6587. return this.each(function( i ) {
  6588. jQuery.offset.setOffset( this, options, i );
  6589. });
  6590. }
  6591. if ( !elem || !elem.ownerDocument ) {
  6592. return null;
  6593. }
  6594. if ( elem === elem.ownerDocument.body ) {
  6595. return jQuery.offset.bodyOffset( elem );
  6596. }
  6597. jQuery.offset.initialize();
  6598. var offsetParent = elem.offsetParent, prevOffsetParent = elem,
  6599. doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
  6600. body = doc.body, defaultView = doc.defaultView,
  6601. prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
  6602. top = elem.offsetTop, left = elem.offsetLeft;
  6603. while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
  6604. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  6605. break;
  6606. }
  6607. computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
  6608. top -= elem.scrollTop;
  6609. left -= elem.scrollLeft;
  6610. if ( elem === offsetParent ) {
  6611. top += elem.offsetTop;
  6612. left += elem.offsetLeft;
  6613. if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
  6614. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  6615. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  6616. }
  6617. prevOffsetParent = offsetParent;
  6618. offsetParent = elem.offsetParent;
  6619. }
  6620. if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
  6621. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  6622. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  6623. }
  6624. prevComputedStyle = computedStyle;
  6625. }
  6626. if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
  6627. top += body.offsetTop;
  6628. left += body.offsetLeft;
  6629. }
  6630. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  6631. top += Math.max( docElem.scrollTop, body.scrollTop );
  6632. left += Math.max( docElem.scrollLeft, body.scrollLeft );
  6633. }
  6634. return { top: top, left: left };
  6635. };
  6636. }
  6637. jQuery.offset = {
  6638. initialize: function() {
  6639. var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
  6640. html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
  6641. jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
  6642. container.innerHTML = html;
  6643. body.insertBefore( container, body.firstChild );
  6644. innerDiv = container.firstChild;
  6645. checkDiv = innerDiv.firstChild;
  6646. td = innerDiv.nextSibling.firstChild.firstChild;
  6647. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  6648. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  6649. checkDiv.style.position = "fixed";
  6650. checkDiv.style.top = "20px";
  6651. // safari subtracts parent border width here which is 5px
  6652. this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
  6653. checkDiv.style.position = checkDiv.style.top = "";
  6654. innerDiv.style.overflow = "hidden";
  6655. innerDiv.style.position = "relative";
  6656. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  6657. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
  6658. body.removeChild( container );
  6659. body = container = innerDiv = checkDiv = table = td = null;
  6660. jQuery.offset.initialize = jQuery.noop;
  6661. },
  6662. bodyOffset: function( body ) {
  6663. var top = body.offsetTop, left = body.offsetLeft;
  6664. jQuery.offset.initialize();
  6665. if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
  6666. top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
  6667. left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
  6668. }
  6669. return { top: top, left: left };
  6670. },
  6671. setOffset: function( elem, options, i ) {
  6672. var position = jQuery.css( elem, "position" );
  6673. // set position first, in-case top/left are set even on static elem
  6674. if ( position === "static" ) {
  6675. elem.style.position = "relative";
  6676. }
  6677. var curElem = jQuery( elem ),
  6678. curOffset = curElem.offset(),
  6679. curCSSTop = jQuery.css( elem, "top" ),
  6680. curCSSLeft = jQuery.css( elem, "left" ),
  6681. calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
  6682. props = {}, curPosition = {}, curTop, curLeft;
  6683. // need to be able to calculate position if either top or left is auto and position is absolute
  6684. if ( calculatePosition ) {
  6685. curPosition = curElem.position();
  6686. }
  6687. curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
  6688. curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
  6689. if ( jQuery.isFunction( options ) ) {
  6690. options = options.call( elem, i, curOffset );
  6691. }
  6692. if (options.top != null) {
  6693. props.top = (options.top - curOffset.top) + curTop;
  6694. }
  6695. if (options.left != null) {
  6696. props.left = (options.left - curOffset.left) + curLeft;
  6697. }
  6698. if ( "using" in options ) {
  6699. options.using.call( elem, props );
  6700. } else {
  6701. curElem.css( props );
  6702. }
  6703. }
  6704. };
  6705. jQuery.fn.extend({
  6706. position: function() {
  6707. if ( !this[0] ) {
  6708. return null;
  6709. }
  6710. var elem = this[0],
  6711. // Get *real* offsetParent
  6712. offsetParent = this.offsetParent(),
  6713. // Get correct offsets
  6714. offset = this.offset(),
  6715. parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
  6716. // Subtract element margins
  6717. // note: when an element has margin: auto the offsetLeft and marginLeft
  6718. // are the same in Safari causing offset.left to incorrectly be 0
  6719. offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
  6720. offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
  6721. // Add offsetParent borders
  6722. parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
  6723. parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
  6724. // Subtract the two offsets
  6725. return {
  6726. top: offset.top - parentOffset.top,
  6727. left: offset.left - parentOffset.left
  6728. };
  6729. },
  6730. offsetParent: function() {
  6731. /// <summary>
  6732. /// This member is internal.
  6733. /// </summary>
  6734. /// <private />
  6735. return this.map(function() {
  6736. var offsetParent = this.offsetParent || document.body;
  6737. while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
  6738. offsetParent = offsetParent.offsetParent;
  6739. }
  6740. return offsetParent;
  6741. });
  6742. }
  6743. });
  6744. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  6745. // Create scrollLeft and scrollTop methods
  6746. jQuery.each( ["Left", "Top"], function( i, name ) {
  6747. var method = "scroll" + name;
  6748. jQuery.fn[ method ] = function(val) {
  6749. /// <summary>
  6750. /// Gets and optionally sets the scroll left offset of the first matched element.
  6751. /// </summary>
  6752. /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll left offset.</param>
  6753. /// <returns type="Number" integer="true">The scroll left offset of the first matched element.</returns>
  6754. var elem = this[0], win;
  6755. if ( !elem ) {
  6756. return null;
  6757. }
  6758. if ( val !== undefined ) {
  6759. // Set the scroll offset
  6760. return this.each(function() {
  6761. win = getWindow( this );
  6762. if ( win ) {
  6763. win.scrollTo(
  6764. !i ? val : jQuery(win).scrollLeft(),
  6765. i ? val : jQuery(win).scrollTop()
  6766. );
  6767. } else {
  6768. this[ method ] = val;
  6769. }
  6770. });
  6771. } else {
  6772. win = getWindow( elem );
  6773. // Return the scroll offset
  6774. return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
  6775. jQuery.support.boxModel && win.document.documentElement[ method ] ||
  6776. win.document.body[ method ] :
  6777. elem[ method ];
  6778. }
  6779. };
  6780. });
  6781. function getWindow( elem ) {
  6782. return jQuery.isWindow( elem ) ?
  6783. elem :
  6784. elem.nodeType === 9 ?
  6785. elem.defaultView || elem.parentWindow :
  6786. false;
  6787. }
  6788. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  6789. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  6790. jQuery.each([ "Height", "Width" ], function( i, name ) {
  6791. var type = name.toLowerCase();
  6792. // innerHeight and innerWidth
  6793. jQuery.fn["inner" + name] = function() {
  6794. return this[0] ?
  6795. parseFloat( jQuery.css( this[0], type, "padding" ) ) :
  6796. null;
  6797. };
  6798. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  6799. // outerHeight and outerWidth
  6800. jQuery.fn["outer" + name] = function( margin ) {
  6801. return this[0] ?
  6802. parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
  6803. null;
  6804. };
  6805. // [vsdoc] todo - we need some mechanmism to doc these methods without modifying the source
  6806. jQuery.fn[ type ] = function( size ) {
  6807. // Get window width or height
  6808. var elem = this[0];
  6809. if ( !elem ) {
  6810. return size == null ? null : this;
  6811. }
  6812. if ( jQuery.isFunction( size ) ) {
  6813. return this.each(function( i ) {
  6814. var self = jQuery( this );
  6815. self[ type ]( size.call( this, i, self[ type ]() ) );
  6816. });
  6817. }
  6818. return jQuery.isWindow( elem ) ?
  6819. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  6820. elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
  6821. elem.document.body[ "client" + name ] :
  6822. // Get document width or height
  6823. (elem.nodeType === 9) ? // is it a document
  6824. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  6825. Math.max(
  6826. elem.documentElement["client" + name],
  6827. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  6828. elem.body["offset" + name], elem.documentElement["offset" + name]
  6829. ) :
  6830. // Get or set width or height on the element
  6831. size === undefined ?
  6832. // Get width or height on the element
  6833. parseFloat( jQuery.css( elem, type ) ) :
  6834. // Set the width or height on the element (default to pixels if value is unitless)
  6835. this.css( type, typeof size === "string" ? size : size + "px" );
  6836. };
  6837. });
  6838. })(window);