You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6138 lines
245 KiB

4 years ago
  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.3.2b
  8. */
  9. /*
  10. * jQuery JavaScript Library v1.3.2
  11. * http://jquery.com/
  12. *
  13. * Copyright (c) 2009 John Resig
  14. *
  15. * Permission is hereby granted, free of charge, to any person obtaining
  16. * a copy of this software and associated documentation files (the
  17. * "Software"), to deal in the Software without restriction, including
  18. * without limitation the rights to use, copy, modify, merge, publish,
  19. * distribute, sublicense, and/or sell copies of the Software, and to
  20. * permit persons to whom the Software is furnished to do so, subject to
  21. * the following conditions:
  22. *
  23. * The above copyright notice and this permission notice shall be
  24. * included in all copies or substantial portions of the Software.
  25. *
  26. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  27. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  29. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  30. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  31. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  32. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  33. *
  34. * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
  35. * Revision: 6246
  36. */
  37. (function () {
  38. var
  39. // Will speed up references to window, and allows munging its name.
  40. window = this,
  41. // Will speed up references to undefined, and allows munging its name.
  42. undefined,
  43. // Map over jQuery in case of overwrite
  44. _jQuery = window.jQuery,
  45. // Map over the $ in case of overwrite
  46. _$ = window.$,
  47. jQuery = window.jQuery = window.$ = function (selector, context) {
  48. /// <summary>
  49. /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements.
  50. /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML.
  51. /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s).
  52. /// 4: $(callback) - A shorthand for $(document).ready().
  53. /// </summary>
  54. /// <param name="selector" type="String">
  55. /// 1: expression - An expression to search with.
  56. /// 2: html - A string of HTML to create on the fly.
  57. /// 3: elements - DOM element(s) to be encapsulated by a jQuery object.
  58. /// 4: callback - The function to execute when the DOM is ready.
  59. /// </param>
  60. /// <param name="context" type="jQuery">
  61. /// 1: context - A DOM Element, Document or jQuery to use as context.
  62. /// </param>
  63. /// <field name="selector" Type="Object">
  64. /// The DOM node context originally passed to jQuery() (if none was passed then context will be equal to the document).
  65. /// </field>
  66. /// <field name="context" Type="String">
  67. /// A selector representing selector originally passed to jQuery().
  68. /// </field>
  69. /// <returns type="jQuery" />
  70. // The jQuery object is actually just the init constructor 'enhanced'
  71. return new jQuery.fn.init(selector, context);
  72. },
  73. // A simple way to check for HTML strings or ID strings
  74. // (both of which we optimize for)
  75. quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
  76. // Is it a simple selector
  77. isSimple = /^.[^:#\[\.,]*$/;
  78. jQuery.fn = jQuery.prototype = {
  79. init: function (selector, context) {
  80. /// <summary>
  81. /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements.
  82. /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML.
  83. /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s).
  84. /// 4: $(callback) - A shorthand for $(document).ready().
  85. /// </summary>
  86. /// <param name="selector" type="String">
  87. /// 1: expression - An expression to search with.
  88. /// 2: html - A string of HTML to create on the fly.
  89. /// 3: elements - DOM element(s) to be encapsulated by a jQuery object.
  90. /// 4: callback - The function to execute when the DOM is ready.
  91. /// </param>
  92. /// <param name="context" type="jQuery">
  93. /// 1: context - A DOM Element, Document or jQuery to use as context.
  94. /// </param>
  95. /// <returns type="jQuery" />
  96. // Make sure that a selection was provided
  97. selector = selector || document;
  98. // Handle $(DOMElement)
  99. if (selector.nodeType) {
  100. this[0] = selector;
  101. this.length = 1;
  102. this.context = selector;
  103. return this;
  104. }
  105. // Handle HTML strings
  106. if (typeof selector === "string") {
  107. // Are we dealing with HTML string or an ID?
  108. var match = quickExpr.exec(selector);
  109. // Verify a match, and that no context was specified for #id
  110. if (match && (match[1] || !context)) {
  111. // HANDLE: $(html) -> $(array)
  112. if (match[1])
  113. selector = jQuery.clean([match[1]], context);
  114. // HANDLE: $("#id")
  115. else {
  116. var elem = document.getElementById(match[3]);
  117. // Handle the case where IE and Opera return items
  118. // by name instead of ID
  119. if (elem && elem.id != match[3])
  120. return jQuery().find(selector);
  121. // Otherwise, we inject the element directly into the jQuery object
  122. var ret = jQuery(elem || []);
  123. ret.context = document;
  124. ret.selector = selector;
  125. return ret;
  126. }
  127. // HANDLE: $(expr, [context])
  128. // (which is just equivalent to: $(content).find(expr)
  129. } else
  130. return jQuery(context).find(selector);
  131. // HANDLE: $(function)
  132. // Shortcut for document ready
  133. } else if (jQuery.isFunction(selector))
  134. return jQuery(document).ready(selector);
  135. // Make sure that old selector state is passed along
  136. if (selector.selector && selector.context) {
  137. this.selector = selector.selector;
  138. this.context = selector.context;
  139. }
  140. return this.setArray(jQuery.isArray(selector) ?
  141. selector :
  142. jQuery.makeArray(selector));
  143. },
  144. // Start with an empty selector
  145. selector: "",
  146. // The current version of jQuery being used
  147. jquery: "1.3.2",
  148. // The number of elements contained in the matched element set
  149. size: function () {
  150. /// <summary>
  151. /// The number of elements currently matched.
  152. /// Part of Core
  153. /// </summary>
  154. /// <returns type="Number" />
  155. return this.length;
  156. },
  157. // Get the Nth element in the matched element set OR
  158. // Get the whole matched element set as a clean array
  159. get: function (num) {
  160. /// <summary>
  161. /// Access a single matched element. num is used to access the
  162. /// Nth element matched.
  163. /// Part of Core
  164. /// </summary>
  165. /// <returns type="Element" />
  166. /// <param name="num" type="Number">
  167. /// Access the element in the Nth position.
  168. /// </param>
  169. return num == undefined ?
  170. // Return a 'clean' array
  171. Array.prototype.slice.call(this) :
  172. // Return just the object
  173. this[num];
  174. },
  175. // Take an array of elements and push it onto the stack
  176. // (returning the new matched element set)
  177. pushStack: function (elems, name, selector) {
  178. /// <summary>
  179. /// Set the jQuery object to an array of elements, while maintaining
  180. /// the stack.
  181. /// Part of Core
  182. /// </summary>
  183. /// <returns type="jQuery" />
  184. /// <param name="elems" type="Elements">
  185. /// An array of elements
  186. /// </param>
  187. // Build a new jQuery matched element set
  188. var ret = jQuery(elems);
  189. // Add the old object onto the stack (as a reference)
  190. ret.prevObject = this;
  191. ret.context = this.context;
  192. if (name === "find")
  193. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  194. else if (name)
  195. ret.selector = this.selector + "." + name + "(" + selector + ")";
  196. // Return the newly-formed element set
  197. return ret;
  198. },
  199. // Force the current matched set of elements to become
  200. // the specified array of elements (destroying the stack in the process)
  201. // You should use pushStack() in order to do this, but maintain the stack
  202. setArray: function (elems) {
  203. /// <summary>
  204. /// Set the jQuery object to an array of elements. This operation is
  205. /// completely destructive - be sure to use .pushStack() if you wish to maintain
  206. /// the jQuery stack.
  207. /// Part of Core
  208. /// </summary>
  209. /// <returns type="jQuery" />
  210. /// <param name="elems" type="Elements">
  211. /// An array of elements
  212. /// </param>
  213. // Resetting the length to 0, then using the native Array push
  214. // is a super-fast way to populate an object with array-like properties
  215. this.length = 0;
  216. Array.prototype.push.apply(this, elems);
  217. return this;
  218. },
  219. // Execute a callback for every element in the matched set.
  220. // (You can seed the arguments with an array of args, but this is
  221. // only used internally.)
  222. each: function (callback, args) {
  223. /// <summary>
  224. /// Execute a function within the context of every matched element.
  225. /// This means that every time the passed-in function is executed
  226. /// (which is once for every element matched) the 'this' keyword
  227. /// points to the specific element.
  228. /// Additionally, the function, when executed, is passed a single
  229. /// argument representing the position of the element in the matched
  230. /// set.
  231. /// Part of Core
  232. /// </summary>
  233. /// <returns type="jQuery" />
  234. /// <param name="callback" type="Function">
  235. /// A function to execute
  236. /// </param>
  237. return jQuery.each(this, callback, args);
  238. },
  239. // Determine the position of an element within
  240. // the matched set of elements
  241. index: function (elem) {
  242. /// <summary>
  243. /// Searches every matched element for the object and returns
  244. /// the index of the element, if found, starting with zero.
  245. /// Returns -1 if the object wasn't found.
  246. /// Part of Core
  247. /// </summary>
  248. /// <returns type="Number" />
  249. /// <param name="elem" type="Element">
  250. /// Object to search for
  251. /// </param>
  252. // Locate the position of the desired element
  253. return jQuery.inArray(
  254. // If it receives a jQuery object, the first element is used
  255. elem && elem.jquery ? elem[0] : elem
  256. , this);
  257. },
  258. attr: function (name, value, type) {
  259. /// <summary>
  260. /// Set a single property to a computed value, on all matched elements.
  261. /// Instead of a value, a function is provided, that computes the value.
  262. /// Part of DOM/Attributes
  263. /// </summary>
  264. /// <returns type="jQuery" />
  265. /// <param name="name" type="String">
  266. /// The name of the property to set.
  267. /// </param>
  268. /// <param name="value" type="Function">
  269. /// A function returning the value to set.
  270. /// </param>
  271. var options = name;
  272. // Look for the case where we're accessing a style value
  273. if (typeof name === "string")
  274. if (value === undefined)
  275. return this[0] && jQuery[type || "attr"](this[0], name);
  276. else {
  277. options = {};
  278. options[name] = value;
  279. }
  280. // Check to see if we're setting style values
  281. return this.each(function (i) {
  282. // Set all the styles
  283. for (name in options)
  284. jQuery.attr(
  285. type ?
  286. this.style :
  287. this,
  288. name, jQuery.prop(this, options[name], type, i, name)
  289. );
  290. });
  291. },
  292. css: function (key, value) {
  293. /// <summary>
  294. /// Set a single style property to a value, on all matched elements.
  295. /// If a number is provided, it is automatically converted into a pixel value.
  296. /// Part of CSS
  297. /// </summary>
  298. /// <returns type="jQuery" />
  299. /// <param name="key" type="String">
  300. /// The name of the property to set.
  301. /// </param>
  302. /// <param name="value" type="String">
  303. /// The value to set the property to.
  304. /// </param>
  305. // ignore negative width and height values
  306. if ((key == 'width' || key == 'height') && parseFloat(value) < 0)
  307. value = undefined;
  308. return this.attr(key, value, "curCSS");
  309. },
  310. text: function (text) {
  311. /// <summary>
  312. /// Set the text contents of all matched elements.
  313. /// Similar to html(), but escapes HTML (replace &quot;&lt;&quot; and &quot;&gt;&quot; with their
  314. /// HTML entities).
  315. /// Part of DOM/Attributes
  316. /// </summary>
  317. /// <returns type="String" />
  318. /// <param name="text" type="String">
  319. /// The text value to set the contents of the element to.
  320. /// </param>
  321. if (typeof text !== "object" && text != null)
  322. return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
  323. var ret = "";
  324. jQuery.each(text || this, function () {
  325. jQuery.each(this.childNodes, function () {
  326. if (this.nodeType != 8)
  327. ret += this.nodeType != 1 ?
  328. this.nodeValue :
  329. jQuery.fn.text([this]);
  330. });
  331. });
  332. return ret;
  333. },
  334. wrapAll: function (html) {
  335. /// <summary>
  336. /// Wrap all matched elements with a structure of other elements.
  337. /// This wrapping process is most useful for injecting additional
  338. /// stucture into a document, without ruining the original semantic
  339. /// qualities of a document.
  340. /// This works by going through the first element
  341. /// provided and finding the deepest ancestor element within its
  342. /// structure - it is that element that will en-wrap everything else.
  343. /// This does not work with elements that contain text. Any necessary text
  344. /// must be added after the wrapping is done.
  345. /// Part of DOM/Manipulation
  346. /// </summary>
  347. /// <returns type="jQuery" />
  348. /// <param name="html" type="Element">
  349. /// A DOM element that will be wrapped around the target.
  350. /// </param>
  351. if (this[0]) {
  352. // The elements to wrap the target around
  353. var wrap = jQuery(html, this[0].ownerDocument).clone();
  354. if (this[0].parentNode)
  355. wrap.insertBefore(this[0]);
  356. wrap.map(function () {
  357. var elem = this;
  358. while (elem.firstChild)
  359. elem = elem.firstChild;
  360. return elem;
  361. }).append(this);
  362. }
  363. return this;
  364. },
  365. wrapInner: function (html) {
  366. /// <summary>
  367. /// Wraps the inner child contents of each matched elemenht (including text nodes) with an HTML structure.
  368. /// </summary>
  369. /// <param name="html" type="String">
  370. /// A string of HTML or a DOM element that will be wrapped around the target contents.
  371. /// </param>
  372. /// <returns type="jQuery" />
  373. return this.each(function () {
  374. jQuery(this).contents().wrapAll(html);
  375. });
  376. },
  377. wrap: function (html) {
  378. /// <summary>
  379. /// Wrap all matched elements with a structure of other elements.
  380. /// This wrapping process is most useful for injecting additional
  381. /// stucture into a document, without ruining the original semantic
  382. /// qualities of a document.
  383. /// This works by going through the first element
  384. /// provided and finding the deepest ancestor element within its
  385. /// structure - it is that element that will en-wrap everything else.
  386. /// This does not work with elements that contain text. Any necessary text
  387. /// must be added after the wrapping is done.
  388. /// Part of DOM/Manipulation
  389. /// </summary>
  390. /// <returns type="jQuery" />
  391. /// <param name="html" type="Element">
  392. /// A DOM element that will be wrapped around the target.
  393. /// </param>
  394. return this.each(function () {
  395. jQuery(this).wrapAll(html);
  396. });
  397. },
  398. append: function () {
  399. /// <summary>
  400. /// Append content to the inside of every matched element.
  401. /// This operation is similar to doing an appendChild to all the
  402. /// specified elements, adding them into the document.
  403. /// Part of DOM/Manipulation
  404. /// </summary>
  405. /// <returns type="jQuery" />
  406. /// <param name="content" type="Content">
  407. /// Content to append to the target
  408. /// </param>
  409. return this.domManip(arguments, true, function (elem) {
  410. if (this.nodeType == 1)
  411. this.appendChild(elem);
  412. });
  413. },
  414. prepend: function () {
  415. /// <summary>
  416. /// Prepend content to the inside of every matched element.
  417. /// This operation is the best way to insert elements
  418. /// inside, at the beginning, of all matched elements.
  419. /// Part of DOM/Manipulation
  420. /// </summary>
  421. /// <returns type="jQuery" />
  422. /// <param name="" type="Content">
  423. /// Content to prepend to the target.
  424. /// </param>
  425. return this.domManip(arguments, true, function (elem) {
  426. if (this.nodeType == 1)
  427. this.insertBefore(elem, this.firstChild);
  428. });
  429. },
  430. before: function () {
  431. /// <summary>
  432. /// Insert content before each of the matched elements.
  433. /// Part of DOM/Manipulation
  434. /// </summary>
  435. /// <returns type="jQuery" />
  436. /// <param name="" type="Content">
  437. /// Content to insert before each target.
  438. /// </param>
  439. return this.domManip(arguments, false, function (elem) {
  440. this.parentNode.insertBefore(elem, this);
  441. });
  442. },
  443. after: function () {
  444. /// <summary>
  445. /// Insert content after each of the matched elements.
  446. /// Part of DOM/Manipulation
  447. /// </summary>
  448. /// <returns type="jQuery" />
  449. /// <param name="" type="Content">
  450. /// Content to insert after each target.
  451. /// </param>
  452. return this.domManip(arguments, false, function (elem) {
  453. this.parentNode.insertBefore(elem, this.nextSibling);
  454. });
  455. },
  456. end: function () {
  457. /// <summary>
  458. /// End the most recent 'destructive' operation, reverting the list of matched elements
  459. /// back to its previous state. After an end operation, the list of matched elements will
  460. /// revert to the last state of matched elements.
  461. /// If there was no destructive operation before, an empty set is returned.
  462. /// Part of DOM/Traversing
  463. /// </summary>
  464. /// <returns type="jQuery" />
  465. return this.prevObject || jQuery([]);
  466. },
  467. // For internal use only.
  468. // Behaves like an Array's method, not like a jQuery method.
  469. push: [].push,
  470. sort: [].sort,
  471. splice: [].splice,
  472. find: function (selector) {
  473. /// <summary>
  474. /// Searches for all elements that match the specified expression.
  475. /// This method is a good way to find additional descendant
  476. /// elements with which to process.
  477. /// All searching is done using a jQuery expression. The expression can be
  478. /// written using CSS 1-3 Selector syntax, or basic XPath.
  479. /// Part of DOM/Traversing
  480. /// </summary>
  481. /// <returns type="jQuery" />
  482. /// <param name="selector" type="String">
  483. /// An expression to search with.
  484. /// </param>
  485. /// <returns type="jQuery" />
  486. if (this.length === 1) {
  487. var ret = this.pushStack([], "find", selector);
  488. ret.length = 0;
  489. jQuery.find(selector, this[0], ret);
  490. return ret;
  491. } else {
  492. return this.pushStack(jQuery.unique(jQuery.map(this, function (elem) {
  493. return jQuery.find(selector, elem);
  494. })), "find", selector);
  495. }
  496. },
  497. clone: function (events) {
  498. /// <summary>
  499. /// Clone matched DOM Elements and select the clones.
  500. /// This is useful for moving copies of the elements to another
  501. /// location in the DOM.
  502. /// Part of DOM/Manipulation
  503. /// </summary>
  504. /// <returns type="jQuery" />
  505. /// <param name="deep" type="Boolean" optional="true">
  506. /// (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself.
  507. /// </param>
  508. // Do the clone
  509. var ret = this.map(function () {
  510. if (!jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this)) {
  511. // IE copies events bound via attachEvent when
  512. // using cloneNode. Calling detachEvent on the
  513. // clone will also remove the events from the orignal
  514. // In order to get around this, we use innerHTML.
  515. // Unfortunately, this means some modifications to
  516. // attributes in IE that are actually only stored
  517. // as properties will not be copied (such as the
  518. // the name attribute on an input).
  519. var html = this.outerHTML;
  520. if (!html) {
  521. var div = this.ownerDocument.createElement("div");
  522. div.appendChild(this.cloneNode(true));
  523. html = div.innerHTML;
  524. }
  525. return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
  526. } else
  527. return this.cloneNode(true);
  528. });
  529. // Copy the events from the original to the clone
  530. if (events === true) {
  531. var orig = this.find("*").andSelf(), i = 0;
  532. ret.find("*").andSelf().each(function () {
  533. if (this.nodeName !== orig[i].nodeName)
  534. return;
  535. var events = jQuery.data(orig[i], "events");
  536. for (var type in events) {
  537. for (var handler in events[type]) {
  538. jQuery.event.add(this, type, events[type][handler], events[type][handler].data);
  539. }
  540. }
  541. i++;
  542. });
  543. }
  544. // Return the cloned set
  545. return ret;
  546. },
  547. filter: function (selector) {
  548. /// <summary>
  549. /// Removes all elements from the set of matched elements that do not
  550. /// pass the specified filter. This method is used to narrow down
  551. /// the results of a search.
  552. /// })
  553. /// Part of DOM/Traversing
  554. /// </summary>
  555. /// <returns type="jQuery" />
  556. /// <param name="selector" type="Function">
  557. /// A function to use for filtering
  558. /// </param>
  559. /// <returns type="jQuery" />
  560. return this.pushStack(
  561. jQuery.isFunction(selector) &&
  562. jQuery.grep(this, function (elem, i) {
  563. return selector.call(elem, i);
  564. }) ||
  565. jQuery.multiFilter(selector, jQuery.grep(this, function (elem) {
  566. return elem.nodeType === 1;
  567. })), "filter", selector);
  568. },
  569. closest: function (selector) {
  570. /// <summary>
  571. /// Get a set of elements containing the closest parent element that matches the specified selector, the starting element included.
  572. /// </summary>
  573. /// <returns type="jQuery" />
  574. /// <param name="selector" type="Function">
  575. /// An expression to filter the elements with.
  576. /// </param>
  577. /// <returns type="jQuery" />
  578. var pos = jQuery.expr.match.POS.test(selector) ? jQuery(selector) : null,
  579. closer = 0;
  580. return this.map(function () {
  581. var cur = this;
  582. while (cur && cur.ownerDocument) {
  583. if (pos ? pos.index(cur) > -1 : jQuery(cur).is(selector)) {
  584. jQuery.data(cur, "closest", closer);
  585. return cur;
  586. }
  587. cur = cur.parentNode;
  588. closer++;
  589. }
  590. });
  591. },
  592. not: function (selector) {
  593. /// <summary>
  594. /// Removes any elements inside the array of elements from the set
  595. /// of matched elements. This method is used to remove one or more
  596. /// elements from a jQuery object.
  597. /// Part of DOM/Traversing
  598. /// </summary>
  599. /// <param name="selector" type="jQuery">
  600. /// A set of elements to remove from the jQuery set of matched elements.
  601. /// </param>
  602. /// <returns type="jQuery" />
  603. if (typeof selector === "string")
  604. // test special case where just one selector is passed in
  605. if (isSimple.test(selector))
  606. return this.pushStack(jQuery.multiFilter(selector, this, true), "not", selector);
  607. else
  608. selector = jQuery.multiFilter(selector, this);
  609. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  610. return this.filter(function () {
  611. return isArrayLike ? jQuery.inArray(this, selector) < 0 : this != selector;
  612. });
  613. },
  614. add: function (selector) {
  615. /// <summary>
  616. /// Adds one or more Elements to the set of matched elements.
  617. /// Part of DOM/Traversing
  618. /// </summary>
  619. /// <param name="elements" type="Element">
  620. /// One or more Elements to add
  621. /// </param>
  622. /// <returns type="jQuery" />
  623. return this.pushStack(jQuery.unique(jQuery.merge(
  624. this.get(),
  625. typeof selector === "string" ?
  626. jQuery(selector) :
  627. jQuery.makeArray(selector)
  628. )));
  629. },
  630. is: function (selector) {
  631. /// <summary>
  632. /// Checks the current selection against an expression and returns true,
  633. /// if at least one element of the selection fits the given expression.
  634. /// Does return false, if no element fits or the expression is not valid.
  635. /// filter(String) is used internally, therefore all rules that apply there
  636. /// apply here, too.
  637. /// Part of DOM/Traversing
  638. /// </summary>
  639. /// <returns type="Boolean" />
  640. /// <param name="expr" type="String">
  641. /// The expression with which to filter
  642. /// </param>
  643. return !!selector && jQuery.multiFilter(selector, this).length > 0;
  644. },
  645. hasClass: function (selector) {
  646. /// <summary>
  647. /// Checks the current selection against a class and returns whether at least one selection has a given class.
  648. /// </summary>
  649. /// <param name="selector" type="String">The class to check against</param>
  650. /// <returns type="Boolean">True if at least one element in the selection has the class, otherwise false.</returns>
  651. return !!selector && this.is("." + selector);
  652. },
  653. val: function (value) {
  654. /// <summary>
  655. /// Set the value of every matched element.
  656. /// Part of DOM/Attributes
  657. /// </summary>
  658. /// <returns type="jQuery" />
  659. /// <param name="val" type="String">
  660. /// Set the property to the specified value.
  661. /// </param>
  662. if (value === undefined) {
  663. var elem = this[0];
  664. if (elem) {
  665. if (jQuery.nodeName(elem, 'option'))
  666. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  667. // We need to handle select boxes special
  668. if (jQuery.nodeName(elem, "select")) {
  669. var index = elem.selectedIndex,
  670. values = [],
  671. options = elem.options,
  672. one = elem.type == "select-one";
  673. // Nothing was selected
  674. if (index < 0)
  675. return null;
  676. // Loop through all the selected options
  677. for (var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++) {
  678. var option = options[i];
  679. if (option.selected) {
  680. // Get the specifc value for the option
  681. value = jQuery(option).val();
  682. // We don't need an array for one selects
  683. if (one)
  684. return value;
  685. // Multi-Selects return an array
  686. values.push(value);
  687. }
  688. }
  689. return values;
  690. }
  691. // Everything else, we just grab the value
  692. return (elem.value || "").replace(/\r/g, "");
  693. }
  694. return undefined;
  695. }
  696. if (typeof value === "number")
  697. value += '';
  698. return this.each(function () {
  699. if (this.nodeType != 1)
  700. return;
  701. if (jQuery.isArray(value) && /radio|checkbox/.test(this.type))
  702. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  703. jQuery.inArray(this.name, value) >= 0);
  704. else if (jQuery.nodeName(this, "select")) {
  705. var values = jQuery.makeArray(value);
  706. jQuery("option", this).each(function () {
  707. this.selected = (jQuery.inArray(this.value, values) >= 0 ||
  708. jQuery.inArray(this.text, values) >= 0);
  709. });
  710. if (!values.length)
  711. this.selectedIndex = -1;
  712. } else
  713. this.value = value;
  714. });
  715. },
  716. html: function (value) {
  717. /// <summary>
  718. /// Set the html contents of every matched element.
  719. /// This property is not available on XML documents.
  720. /// Part of DOM/Attributes
  721. /// </summary>
  722. /// <returns type="jQuery" />
  723. /// <param name="val" type="String">
  724. /// Set the html contents to the specified value.
  725. /// </param>
  726. return value === undefined ?
  727. (this[0] ?
  728. this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
  729. null) :
  730. this.empty().append(value);
  731. },
  732. replaceWith: function (value) {
  733. /// <summary>
  734. /// Replaces all matched element with the specified HTML or DOM elements.
  735. /// </summary>
  736. /// <param name="value" type="String">
  737. /// The content with which to replace the matched elements.
  738. /// </param>
  739. /// <returns type="jQuery">The element that was just replaced.</returns>
  740. return this.after(value).remove();
  741. },
  742. eq: function (i) {
  743. /// <summary>
  744. /// Reduce the set of matched elements to a single element.
  745. /// The position of the element in the set of matched elements
  746. /// starts at 0 and goes to length - 1.
  747. /// Part of Core
  748. /// </summary>
  749. /// <returns type="jQuery" />
  750. /// <param name="num" type="Number">
  751. /// pos The index of the element that you wish to limit to.
  752. /// </param>
  753. return this.slice(i, +i + 1);
  754. },
  755. slice: function () {
  756. /// <summary>
  757. /// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method.
  758. /// </summary>
  759. /// <param name="start" type="Number" integer="true">Where to start the subset (0-based).</param>
  760. /// <param name="end" optional="true" type="Number" integer="true">Where to end the subset (not including the end element itself).
  761. /// If omitted, ends at the end of the selection</param>
  762. /// <returns type="jQuery">The sliced elements</returns>
  763. return this.pushStack(Array.prototype.slice.apply(this, arguments),
  764. "slice", Array.prototype.slice.call(arguments).join(","));
  765. },
  766. map: function (callback) {
  767. /// <summary>
  768. /// This member is internal.
  769. /// </summary>
  770. /// <private />
  771. /// <returns type="jQuery" />
  772. return this.pushStack(jQuery.map(this, function (elem, i) {
  773. return callback.call(elem, i, elem);
  774. }));
  775. },
  776. andSelf: function () {
  777. /// <summary>
  778. /// Adds the previous selection to the current selection.
  779. /// </summary>
  780. /// <returns type="jQuery" />
  781. return this.add(this.prevObject);
  782. },
  783. domManip: function (args, table, callback) {
  784. /// <param name="args" type="Array">
  785. /// Args
  786. /// </param>
  787. /// <param name="table" type="Boolean">
  788. /// Insert TBODY in TABLEs if one is not found.
  789. /// </param>
  790. /// <param name="dir" type="Number">
  791. /// If dir&lt;0, process args in reverse order.
  792. /// </param>
  793. /// <param name="fn" type="Function">
  794. /// The function doing the DOM manipulation.
  795. /// </param>
  796. /// <returns type="jQuery" />
  797. /// <summary>
  798. /// Part of Core
  799. /// </summary>
  800. if (this[0]) {
  801. var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
  802. scripts = jQuery.clean(args, (this[0].ownerDocument || this[0]), fragment),
  803. first = fragment.firstChild;
  804. if (first)
  805. for (var i = 0, l = this.length; i < l; i++)
  806. callback.call(root(this[i], first), this.length > 1 || i > 0 ?
  807. fragment.cloneNode(true) : fragment);
  808. if (scripts)
  809. jQuery.each(scripts, evalScript);
  810. }
  811. return this;
  812. function root(elem, cur) {
  813. return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
  814. (elem.getElementsByTagName("tbody")[0] ||
  815. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  816. elem;
  817. }
  818. }
  819. };
  820. // Give the init function the jQuery prototype for later instantiation
  821. jQuery.fn.init.prototype = jQuery.fn;
  822. function evalScript(i, elem) {
  823. /// <summary>
  824. /// This method is internal.
  825. /// </summary>
  826. /// <private />
  827. if (elem.src)
  828. jQuery.ajax({
  829. url: elem.src,
  830. async: false,
  831. dataType: "script"
  832. });
  833. else
  834. jQuery.globalEval(elem.text || elem.textContent || elem.innerHTML || "");
  835. if (elem.parentNode)
  836. elem.parentNode.removeChild(elem);
  837. }
  838. function now() {
  839. /// <summary>
  840. /// Gets the current date.
  841. /// </summary>
  842. /// <returns type="Date">The current date.</returns>
  843. return +new Date;
  844. }
  845. jQuery.extend = jQuery.fn.extend = function () {
  846. /// <summary>
  847. /// Extend one object with one or more others, returning the original,
  848. /// modified, object. This is a great utility for simple inheritance.
  849. /// jQuery.extend(settings, options);
  850. /// var settings = jQuery.extend({}, defaults, options);
  851. /// Part of JavaScript
  852. /// </summary>
  853. /// <param name="target" type="Object">
  854. /// The object to extend
  855. /// </param>
  856. /// <param name="prop1" type="Object">
  857. /// The object that will be merged into the first.
  858. /// </param>
  859. /// <param name="propN" type="Object" optional="true" parameterArray="true">
  860. /// (optional) More objects to merge into the first
  861. /// </param>
  862. /// <returns type="Object" />
  863. // copy reference to target object
  864. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  865. // Handle a deep copy situation
  866. if (typeof target === "boolean") {
  867. deep = target;
  868. target = arguments[1] || {};
  869. // skip the boolean and the target
  870. i = 2;
  871. }
  872. // Handle case when target is a string or something (possible in deep copy)
  873. if (typeof target !== "object" && !jQuery.isFunction(target))
  874. target = {};
  875. // extend jQuery itself if only one argument is passed
  876. if (length == i) {
  877. target = this;
  878. --i;
  879. }
  880. for (; i < length; i++)
  881. // Only deal with non-null/undefined values
  882. if ((options = arguments[i]) != null)
  883. // Extend the base object
  884. for (var name in options) {
  885. var src = target[name], copy = options[name];
  886. // Prevent never-ending loop
  887. if (target === copy)
  888. continue;
  889. // Recurse if we're merging object values
  890. if (deep && copy && typeof copy === "object" && !copy.nodeType)
  891. target[name] = jQuery.extend(deep,
  892. // Never move original objects, clone them
  893. src || (copy.length != null ? [] : {})
  894. , copy);
  895. // Don't bring in undefined values
  896. else if (copy !== undefined)
  897. target[name] = copy;
  898. }
  899. // Return the modified object
  900. return target;
  901. };
  902. // exclude the following css properties to add px
  903. var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  904. // cache defaultView
  905. defaultView = document.defaultView || {},
  906. toString = Object.prototype.toString;
  907. jQuery.extend({
  908. noConflict: function (deep) {
  909. /// <summary>
  910. /// Run this function to give control of the $ variable back
  911. /// to whichever library first implemented it. This helps to make
  912. /// sure that jQuery doesn't conflict with the $ object
  913. /// of other libraries.
  914. /// By using this function, you will only be able to access jQuery
  915. /// using the 'jQuery' variable. For example, where you used to do
  916. /// $(&quot;div p&quot;), you now must do jQuery(&quot;div p&quot;).
  917. /// Part of Core
  918. /// </summary>
  919. /// <returns type="undefined" />
  920. window.$ = _$;
  921. if (deep)
  922. window.jQuery = _jQuery;
  923. return jQuery;
  924. },
  925. // See test/unit/core.js for details concerning isFunction.
  926. // Since version 1.3, DOM methods and functions like alert
  927. // aren't supported. They return false on IE (#2968).
  928. isFunction: function (obj) {
  929. /// <summary>
  930. /// Determines if the parameter passed is a function.
  931. /// </summary>
  932. /// <param name="obj" type="Object">The object to check</param>
  933. /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
  934. return toString.call(obj) === "[object Function]";
  935. },
  936. isArray: function (obj) {
  937. /// <summary>
  938. /// Determine if the parameter passed is an array.
  939. /// </summary>
  940. /// <param name="obj" type="Object">Object to test whether or not it is an array.</param>
  941. /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
  942. return toString.call(obj) === "[object Array]";
  943. },
  944. // check if an element is in a (or is an) XML document
  945. isXMLDoc: function (elem) {
  946. /// <summary>
  947. /// Determines if the parameter passed is an XML document.
  948. /// </summary>
  949. /// <param name="elem" type="Object">The object to test</param>
  950. /// <returns type="Boolean">True if the parameter is an XML document; otherwise false.</returns>
  951. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  952. !!elem.ownerDocument && jQuery.isXMLDoc(elem.ownerDocument);
  953. },
  954. // Evalulates a script in a global context
  955. globalEval: function (data) {
  956. /// <summary>
  957. /// Internally evaluates a script in a global context.
  958. /// </summary>
  959. /// <private />
  960. if (data && /\S/.test(data)) {
  961. // Inspired by code by Andrea Giammarchi
  962. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  963. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  964. script = document.createElement("script");
  965. script.type = "text/javascript";
  966. if (jQuery.support.scriptEval)
  967. script.appendChild(document.createTextNode(data));
  968. else
  969. script.text = data;
  970. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  971. // This arises when a base node is used (#2709).
  972. head.insertBefore(script, head.firstChild);
  973. head.removeChild(script);
  974. }
  975. },
  976. nodeName: function (elem, name) {
  977. /// <summary>
  978. /// Checks whether the specified element has the specified DOM node name.
  979. /// </summary>
  980. /// <param name="elem" type="Element">The element to examine</param>
  981. /// <param name="name" type="String">The node name to check</param>
  982. /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns>
  983. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  984. },
  985. // args is for internal usage only
  986. each: function (object, callback, args) {
  987. /// <summary>
  988. /// A generic iterator function, which can be used to seemlessly
  989. /// iterate over both objects and arrays. This function is not the same
  990. /// as $().each() - which is used to iterate, exclusively, over a jQuery
  991. /// object. This function can be used to iterate over anything.
  992. /// The callback has two arguments:the key (objects) or index (arrays) as first
  993. /// the first, and the value as the second.
  994. /// Part of JavaScript
  995. /// </summary>
  996. /// <param name="obj" type="Object">
  997. /// The object, or array, to iterate over.
  998. /// </param>
  999. /// <param name="fn" type="Function">
  1000. /// The function that will be executed on every object.
  1001. /// </param>
  1002. /// <returns type="Object" />
  1003. var name, i = 0, length = object.length;
  1004. if (args) {
  1005. if (length === undefined) {
  1006. for (name in object)
  1007. if (callback.apply(object[name], args) === false)
  1008. break;
  1009. } else
  1010. for (; i < length;)
  1011. if (callback.apply(object[i++], args) === false)
  1012. break;
  1013. // A special, fast, case for the most common use of each
  1014. } else {
  1015. if (length === undefined) {
  1016. for (name in object)
  1017. if (callback.call(object[name], name, object[name]) === false)
  1018. break;
  1019. } else
  1020. for (var value = object[0];
  1021. i < length && callback.call(value, i, value) !== false; value = object[++i]) { }
  1022. }
  1023. return object;
  1024. },
  1025. prop: function (elem, value, type, i, name) {
  1026. /// <summary>
  1027. /// This method is internal.
  1028. /// </summary>
  1029. /// <private />
  1030. // This member is not documented within the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.prop
  1031. // Handle executable functions
  1032. if (jQuery.isFunction(value))
  1033. value = value.call(elem, i);
  1034. // Handle passing in a number to a CSS property
  1035. return typeof value === "number" && type == "curCSS" && !exclude.test(name) ?
  1036. value + "px" :
  1037. value;
  1038. },
  1039. className: {
  1040. // internal only, use addClass("class")
  1041. add: function (elem, classNames) {
  1042. /// <summary>
  1043. /// Internal use only; use addClass('class')
  1044. /// </summary>
  1045. /// <private />
  1046. jQuery.each((classNames || "").split(/\s+/), function (i, className) {
  1047. if (elem.nodeType == 1 && !jQuery.className.has(elem.className, className))
  1048. elem.className += (elem.className ? " " : "") + className;
  1049. });
  1050. },
  1051. // internal only, use removeClass("class")
  1052. remove: function (elem, classNames) {
  1053. /// <summary>
  1054. /// Internal use only; use removeClass('class')
  1055. /// </summary>
  1056. /// <private />
  1057. if (elem.nodeType == 1)
  1058. elem.className = classNames !== undefined ?
  1059. jQuery.grep(elem.className.split(/\s+/), function (className) {
  1060. return !jQuery.className.has(classNames, className);
  1061. }).join(" ") :
  1062. "";
  1063. },
  1064. // internal only, use hasClass("class")
  1065. has: function (elem, className) {
  1066. /// <summary>
  1067. /// Internal use only; use hasClass('class')
  1068. /// </summary>
  1069. /// <private />
  1070. return elem && jQuery.inArray(className, (elem.className || elem).toString().split(/\s+/)) > -1;
  1071. }
  1072. },
  1073. // A method for quickly swapping in/out CSS properties to get correct calculations
  1074. swap: function (elem, options, callback) {
  1075. /// <summary>
  1076. /// Swap in/out style options.
  1077. /// </summary>
  1078. var old = {};
  1079. // Remember the old values, and insert the new ones
  1080. for (var name in options) {
  1081. old[name] = elem.style[name];
  1082. elem.style[name] = options[name];
  1083. }
  1084. callback.call(elem);
  1085. // Revert the old values
  1086. for (var name in options)
  1087. elem.style[name] = old[name];
  1088. },
  1089. css: function (elem, name, force, extra) {
  1090. /// <summary>
  1091. /// This method is internal only.
  1092. /// </summary>
  1093. /// <private />
  1094. // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.css
  1095. if (name == "width" || name == "height") {
  1096. var val, props = { position: "absolute", visibility: "hidden", display: "block" }, which = name == "width" ? ["Left", "Right"] : ["Top", "Bottom"];
  1097. function getWH() {
  1098. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  1099. if (extra === "border")
  1100. return;
  1101. jQuery.each(which, function () {
  1102. if (!extra)
  1103. val -= parseFloat(jQuery.curCSS(elem, "padding" + this, true)) || 0;
  1104. if (extra === "margin")
  1105. val += parseFloat(jQuery.curCSS(elem, "margin" + this, true)) || 0;
  1106. else
  1107. val -= parseFloat(jQuery.curCSS(elem, "border" + this + "Width", true)) || 0;
  1108. });
  1109. }
  1110. if (elem.offsetWidth !== 0)
  1111. getWH();
  1112. else
  1113. jQuery.swap(elem, props, getWH);
  1114. return Math.max(0, Math.round(val));
  1115. }
  1116. return jQuery.curCSS(elem, name, force);
  1117. },
  1118. curCSS: function (elem, name, force) {
  1119. /// <summary>
  1120. /// This method is internal only.
  1121. /// </summary>
  1122. /// <private />
  1123. // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.curCSS
  1124. var ret, style = elem.style;
  1125. // We need to handle opacity special in IE
  1126. if (name == "opacity" && !jQuery.support.opacity) {
  1127. ret = jQuery.attr(style, "opacity");
  1128. return ret == "" ?
  1129. "1" :
  1130. ret;
  1131. }
  1132. // Make sure we're using the right name for getting the float value
  1133. if (name.match(/float/i))
  1134. name = styleFloat;
  1135. if (!force && style && style[name])
  1136. ret = style[name];
  1137. else if (defaultView.getComputedStyle) {
  1138. // Only "float" is needed here
  1139. if (name.match(/float/i))
  1140. name = "float";
  1141. name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
  1142. var computedStyle = defaultView.getComputedStyle(elem, null);
  1143. if (computedStyle)
  1144. ret = computedStyle.getPropertyValue(name);
  1145. // We should always get a number back from opacity
  1146. if (name == "opacity" && ret == "")
  1147. ret = "1";
  1148. } else if (elem.currentStyle) {
  1149. var camelCase = name.replace(/\-(\w)/g, function (all, letter) {
  1150. return letter.toUpperCase();
  1151. });
  1152. ret = elem.currentStyle[name] || elem.currentStyle[camelCase];
  1153. // From the awesome hack by Dean Edwards
  1154. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  1155. // If we're not dealing with a regular pixel number
  1156. // but a number that has a weird ending, we need to convert it to pixels
  1157. if (!/^\d+(px)?$/i.test(ret) && /^\d/.test(ret)) {
  1158. // Remember the original values
  1159. var left = style.left, rsLeft = elem.runtimeStyle.left;
  1160. // Put in the new values to get a computed value out
  1161. elem.runtimeStyle.left = elem.currentStyle.left;
  1162. style.left = ret || 0;
  1163. ret = style.pixelLeft + "px";
  1164. // Revert the changed values
  1165. style.left = left;
  1166. elem.runtimeStyle.left = rsLeft;
  1167. }
  1168. }
  1169. return ret;
  1170. },
  1171. clean: function (elems, context, fragment) {
  1172. /// <summary>
  1173. /// This method is internal only.
  1174. /// </summary>
  1175. /// <private />
  1176. // This method is undocumented in the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.clean
  1177. context = context || document;
  1178. // !context.createElement fails in IE with an error but returns typeof 'object'
  1179. if (typeof context.createElement === "undefined")
  1180. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  1181. // If a single string is passed in and it's a single tag
  1182. // just do a createElement and skip the rest
  1183. if (!fragment && elems.length === 1 && typeof elems[0] === "string") {
  1184. var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
  1185. if (match)
  1186. return [context.createElement(match[1])];
  1187. }
  1188. var ret = [], scripts = [], div = context.createElement("div");
  1189. jQuery.each(elems, function (i, elem) {
  1190. if (typeof elem === "number")
  1191. elem += '';
  1192. if (!elem)
  1193. return;
  1194. // Convert html string into DOM nodes
  1195. if (typeof elem === "string") {
  1196. // Fix "XHTML"-style tags in all browsers
  1197. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function (all, front, tag) {
  1198. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  1199. all :
  1200. front + "></" + tag + ">";
  1201. });
  1202. // Trim whitespace, otherwise indexOf won't work as expected
  1203. var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
  1204. var wrap =
  1205. // option or optgroup
  1206. !tags.indexOf("<opt") &&
  1207. [1, "<select multiple='multiple'>", "</select>"] ||
  1208. !tags.indexOf("<leg") &&
  1209. [1, "<fieldset>", "</fieldset>"] ||
  1210. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  1211. [1, "<table>", "</table>"] ||
  1212. !tags.indexOf("<tr") &&
  1213. [2, "<table><tbody>", "</tbody></table>"] ||
  1214. // <thead> matched above
  1215. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  1216. [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
  1217. !tags.indexOf("<col") &&
  1218. [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
  1219. // IE can't serialize <link> and <script> tags normally
  1220. !jQuery.support.htmlSerialize &&
  1221. [1, "div<div>", "</div>"] ||
  1222. [0, "", ""];
  1223. // Go to html and back, then peel off extra wrappers
  1224. div.innerHTML = wrap[1] + elem + wrap[2];
  1225. // Move to the right depth
  1226. while (wrap[0]--)
  1227. div = div.lastChild;
  1228. // Remove IE's autoinserted <tbody> from table fragments
  1229. if (!jQuery.support.tbody) {
  1230. // String was a <table>, *may* have spurious <tbody>
  1231. var hasBody = /<tbody/i.test(elem),
  1232. tbody = !tags.indexOf("<table") && !hasBody ?
  1233. div.firstChild && div.firstChild.childNodes :
  1234. // String was a bare <thead> or <tfoot>
  1235. wrap[1] == "<table>" && !hasBody ?
  1236. div.childNodes :
  1237. [];
  1238. for (var j = tbody.length - 1; j >= 0; --j)
  1239. if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length)
  1240. tbody[j].parentNode.removeChild(tbody[j]);
  1241. }
  1242. // IE completely kills leading whitespace when innerHTML is used
  1243. if (!jQuery.support.leadingWhitespace && /^\s/.test(elem))
  1244. div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]), div.firstChild);
  1245. elem = jQuery.makeArray(div.childNodes);
  1246. }
  1247. if (elem.nodeType)
  1248. ret.push(elem);
  1249. else
  1250. ret = jQuery.merge(ret, elem);
  1251. });
  1252. if (fragment) {
  1253. for (var i = 0; ret[i]; i++) {
  1254. if (jQuery.nodeName(ret[i], "script") && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript")) {
  1255. scripts.push(ret[i].parentNode ? ret[i].parentNode.removeChild(ret[i]) : ret[i]);
  1256. } else {
  1257. if (ret[i].nodeType === 1)
  1258. ret.splice.apply(ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));
  1259. fragment.appendChild(ret[i]);
  1260. }
  1261. }
  1262. return scripts;
  1263. }
  1264. return ret;
  1265. },
  1266. attr: function (elem, name, value) {
  1267. /// <summary>
  1268. /// This method is internal.
  1269. /// </summary>
  1270. /// <private />
  1271. // don't set attributes on text and comment nodes
  1272. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  1273. return undefined;
  1274. var notxml = !jQuery.isXMLDoc(elem),
  1275. // Whether we are setting (or getting)
  1276. set = value !== undefined;
  1277. // Try to normalize/fix the name
  1278. name = notxml && jQuery.props[name] || name;
  1279. // Only do all the following if this is a node (faster for style)
  1280. // IE elem.getAttribute passes even for style
  1281. if (elem.tagName) {
  1282. // These attributes require special treatment
  1283. var special = /href|src|style/.test(name);
  1284. // Safari mis-reports the default selected property of a hidden option
  1285. // Accessing the parent's selectedIndex property fixes it
  1286. if (name == "selected" && elem.parentNode)
  1287. elem.parentNode.selectedIndex;
  1288. // If applicable, access the attribute via the DOM 0 way
  1289. if (name in elem && notxml && !special) {
  1290. if (set) {
  1291. // We can't allow the type property to be changed (since it causes problems in IE)
  1292. if (name == "type" && jQuery.nodeName(elem, "input") && elem.parentNode)
  1293. throw "type property can't be changed";
  1294. elem[name] = value;
  1295. }
  1296. // browsers index elements by id/name on forms, give priority to attributes.
  1297. if (jQuery.nodeName(elem, "form") && elem.getAttributeNode(name))
  1298. return elem.getAttributeNode(name).nodeValue;
  1299. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1300. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1301. if (name == "tabIndex") {
  1302. var attributeNode = elem.getAttributeNode("tabIndex");
  1303. return attributeNode && attributeNode.specified
  1304. ? attributeNode.value
  1305. : elem.nodeName.match(/(button|input|object|select|textarea)/i)
  1306. ? 0
  1307. : elem.nodeName.match(/^(a|area)$/i) && elem.href
  1308. ? 0
  1309. : undefined;
  1310. }
  1311. return elem[name];
  1312. }
  1313. if (!jQuery.support.style && notxml && name == "style")
  1314. return jQuery.attr(elem.style, "cssText", value);
  1315. if (set)
  1316. // convert the value to a string (all browsers do this but IE) see #1070
  1317. elem.setAttribute(name, "" + value);
  1318. var attr = !jQuery.support.hrefNormalized && notxml && special
  1319. // Some attributes require a special call on IE
  1320. ? elem.getAttribute(name, 2)
  1321. : elem.getAttribute(name);
  1322. // Non-existent attributes return null, we normalize to undefined
  1323. return attr === null ? undefined : attr;
  1324. }
  1325. // elem is actually elem.style ... set the style
  1326. // IE uses filters for opacity
  1327. if (!jQuery.support.opacity && name == "opacity") {
  1328. if (set) {
  1329. // IE has trouble with opacity if it does not have layout
  1330. // Force it by setting the zoom level
  1331. elem.zoom = 1;
  1332. // Set the alpha filter to set the opacity
  1333. elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/, "") +
  1334. (parseInt(value) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  1335. }
  1336. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  1337. (parseFloat(elem.filter.match(/opacity=([^)]*)/)[1]) / 100) + '' :
  1338. "";
  1339. }
  1340. name = name.replace(/-([a-z])/ig, function (all, letter) {
  1341. return letter.toUpperCase();
  1342. });
  1343. if (set)
  1344. elem[name] = value;
  1345. return elem[name];
  1346. },
  1347. trim: function (text) {
  1348. /// <summary>
  1349. /// Remove the whitespace from the beginning and end of a string.
  1350. /// Part of JavaScript
  1351. /// </summary>
  1352. /// <returns type="String" />
  1353. /// <param name="text" type="String">
  1354. /// The string to trim.
  1355. /// </param>
  1356. return (text || "").replace(/^\s+|\s+$/g, "");
  1357. },
  1358. makeArray: function (array) {
  1359. /// <summary>
  1360. /// Turns anything into a true array. This is an internal method.
  1361. /// </summary>
  1362. /// <param name="array" type="Object">Anything to turn into an actual Array</param>
  1363. /// <returns type="Array" />
  1364. /// <private />
  1365. var ret = [];
  1366. if (array != null) {
  1367. var i = array.length;
  1368. // The window, strings (and functions) also have 'length'
  1369. if (i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval)
  1370. ret[0] = array;
  1371. else
  1372. while (i)
  1373. ret[--i] = array[i];
  1374. }
  1375. return ret;
  1376. },
  1377. inArray: function (elem, array) {
  1378. /// <summary>
  1379. /// Determines the index of the first parameter in the array.
  1380. /// </summary>
  1381. /// <param name="elem">The value to see if it exists in the array.</param>
  1382. /// <param name="array" type="Array">The array to look through for the value</param>
  1383. /// <returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns>
  1384. for (var i = 0, length = array.length; i < length; i++)
  1385. // Use === because on IE, window == document
  1386. if (array[i] === elem)
  1387. return i;
  1388. return -1;
  1389. },
  1390. merge: function (first, second) {
  1391. /// <summary>
  1392. /// Merge two arrays together, removing all duplicates.
  1393. /// The new array is: All the results from the first array, followed
  1394. /// by the unique results from the second array.
  1395. /// Part of JavaScript
  1396. /// </summary>
  1397. /// <returns type="Array" />
  1398. /// <param name="first" type="Array">
  1399. /// The first array to merge.
  1400. /// </param>
  1401. /// <param name="second" type="Array">
  1402. /// The second array to merge.
  1403. /// </param>
  1404. // We have to loop this way because IE & Opera overwrite the length
  1405. // expando of getElementsByTagName
  1406. var i = 0, elem, pos = first.length;
  1407. // Also, we need to make sure that the correct elements are being returned
  1408. // (IE returns comment nodes in a '*' query)
  1409. if (!jQuery.support.getAll) {
  1410. while ((elem = second[i++]) != null)
  1411. if (elem.nodeType != 8)
  1412. first[pos++] = elem;
  1413. } else
  1414. while ((elem = second[i++]) != null)
  1415. first[pos++] = elem;
  1416. return first;
  1417. },
  1418. unique: function (array) {
  1419. /// <summary>
  1420. /// Removes all duplicate elements from an array of elements.
  1421. /// </summary>
  1422. /// <param name="array" type="Array&lt;Element&gt;">The array to translate</param>
  1423. /// <returns type="Array&lt;Element&gt;">The array after translation.</returns>
  1424. var ret = [], done = {};
  1425. try {
  1426. for (var i = 0, length = array.length; i < length; i++) {
  1427. var id = jQuery.data(array[i]);
  1428. if (!done[id]) {
  1429. done[id] = true;
  1430. ret.push(array[i]);
  1431. }
  1432. }
  1433. } catch (e) {
  1434. ret = array;
  1435. }
  1436. return ret;
  1437. },
  1438. grep: function (elems, callback, inv) {
  1439. /// <summary>
  1440. /// Filter items out of an array, by using a filter function.
  1441. /// The specified function will be passed two arguments: The
  1442. /// current array item and the index of the item in the array. The
  1443. /// function must return 'true' to keep the item in the array,
  1444. /// false to remove it.
  1445. /// });
  1446. /// Part of JavaScript
  1447. /// </summary>
  1448. /// <returns type="Array" />
  1449. /// <param name="elems" type="Array">
  1450. /// array The Array to find items in.
  1451. /// </param>
  1452. /// <param name="fn" type="Function">
  1453. /// The function to process each item against.
  1454. /// </param>
  1455. /// <param name="inv" type="Boolean">
  1456. /// Invert the selection - select the opposite of the function.
  1457. /// </param>
  1458. var ret = [];
  1459. // Go through the array, only saving the items
  1460. // that pass the validator function
  1461. for (var i = 0, length = elems.length; i < length; i++)
  1462. if (!inv != !callback(elems[i], i))
  1463. ret.push(elems[i]);
  1464. return ret;
  1465. },
  1466. map: function (elems, callback) {
  1467. /// <summary>
  1468. /// Translate all items in an array to another array of items.
  1469. /// The translation function that is provided to this method is
  1470. /// called for each item in the array and is passed one argument:
  1471. /// The item to be translated.
  1472. /// The function can then return the translated value, 'null'
  1473. /// (to remove the item), or an array of values - which will
  1474. /// be flattened into the full array.
  1475. /// Part of JavaScript
  1476. /// </summary>
  1477. /// <returns type="Array" />
  1478. /// <param name="elems" type="Array">
  1479. /// array The Array to translate.
  1480. /// </param>
  1481. /// <param name="fn" type="Function">
  1482. /// The function to process each item against.
  1483. /// </param>
  1484. var ret = [];
  1485. // Go through the array, translating each of the items to their
  1486. // new value (or values).
  1487. for (var i = 0, length = elems.length; i < length; i++) {
  1488. var value = callback(elems[i], i);
  1489. if (value != null)
  1490. ret[ret.length] = value;
  1491. }
  1492. return ret.concat.apply([], ret);
  1493. }
  1494. });
  1495. // Use of jQuery.browser is deprecated.
  1496. // It's included for backwards compatibility and plugins,
  1497. // although they should work to migrate away.
  1498. var userAgent = navigator.userAgent.toLowerCase();
  1499. // Figure out what browser is being used
  1500. jQuery.browser = {
  1501. version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, '0'])[1],
  1502. safari: /webkit/.test(userAgent),
  1503. opera: /opera/.test(userAgent),
  1504. msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
  1505. mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
  1506. };
  1507. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  1508. // jQuery.each({
  1509. // parent: function(elem){return elem.parentNode;},
  1510. // parents: function(elem){return jQuery.dir(elem,"parentNode");},
  1511. // next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
  1512. // prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
  1513. // nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
  1514. // prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
  1515. // siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
  1516. // children: function(elem){return jQuery.sibling(elem.firstChild);},
  1517. // contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
  1518. // }, function(name, fn){
  1519. // jQuery.fn[ name ] = function( selector ) {
  1520. // /// <summary>
  1521. // /// Get a set of elements containing the unique parents of the matched
  1522. // /// set of elements.
  1523. // /// Can be filtered with an optional expressions.
  1524. // /// Part of DOM/Traversing
  1525. // /// </summary>
  1526. // /// <param name="expr" type="String" optional="true">
  1527. // /// (optional) An expression to filter the parents with
  1528. // /// </param>
  1529. // /// <returns type="jQuery" />
  1530. //
  1531. // var ret = jQuery.map( this, fn );
  1532. //
  1533. // if ( selector && typeof selector == "string" )
  1534. // ret = jQuery.multiFilter( selector, ret );
  1535. //
  1536. // return this.pushStack( jQuery.unique( ret ), name, selector );
  1537. // };
  1538. // });
  1539. jQuery.each({
  1540. parent: function (elem) { return elem.parentNode; }
  1541. }, function (name, fn) {
  1542. jQuery.fn[name] = function (selector) {
  1543. /// <summary>
  1544. /// Get a set of elements containing the unique parents of the matched
  1545. /// set of elements.
  1546. /// Can be filtered with an optional expressions.
  1547. /// Part of DOM/Traversing
  1548. /// </summary>
  1549. /// <param name="expr" type="String" optional="true">
  1550. /// (optional) An expression to filter the parents with
  1551. /// </param>
  1552. /// <returns type="jQuery" />
  1553. var ret = jQuery.map(this, fn);
  1554. if (selector && typeof selector == "string")
  1555. ret = jQuery.multiFilter(selector, ret);
  1556. return this.pushStack(jQuery.unique(ret), name, selector);
  1557. };
  1558. });
  1559. jQuery.each({
  1560. parents: function (elem) { return jQuery.dir(elem, "parentNode"); }
  1561. }, function (name, fn) {
  1562. jQuery.fn[name] = function (selector) {
  1563. /// <summary>
  1564. /// Get a set of elements containing the unique ancestors of the matched
  1565. /// set of elements (except for the root element).
  1566. /// Can be filtered with an optional expressions.
  1567. /// Part of DOM/Traversing
  1568. /// </summary>
  1569. /// <param name="expr" type="String" optional="true">
  1570. /// (optional) An expression to filter the ancestors with
  1571. /// </param>
  1572. /// <returns type="jQuery" />
  1573. var ret = jQuery.map(this, fn);
  1574. if (selector && typeof selector == "string")
  1575. ret = jQuery.multiFilter(selector, ret);
  1576. return this.pushStack(jQuery.unique(ret), name, selector);
  1577. };
  1578. });
  1579. jQuery.each({
  1580. next: function (elem) { return jQuery.nth(elem, 2, "nextSibling"); }
  1581. }, function (name, fn) {
  1582. jQuery.fn[name] = function (selector) {
  1583. /// <summary>
  1584. /// Get a set of elements containing the unique next siblings of each of the
  1585. /// matched set of elements.
  1586. /// It only returns the very next sibling, not all next siblings.
  1587. /// Can be filtered with an optional expressions.
  1588. /// Part of DOM/Traversing
  1589. /// </summary>
  1590. /// <param name="expr" type="String" optional="true">
  1591. /// (optional) An expression to filter the next Elements with
  1592. /// </param>
  1593. /// <returns type="jQuery" />
  1594. var ret = jQuery.map(this, fn);
  1595. if (selector && typeof selector == "string")
  1596. ret = jQuery.multiFilter(selector, ret);
  1597. return this.pushStack(jQuery.unique(ret), name, selector);
  1598. };
  1599. });
  1600. jQuery.each({
  1601. prev: function (elem) { return jQuery.nth(elem, 2, "previousSibling"); }
  1602. }, function (name, fn) {
  1603. jQuery.fn[name] = function (selector) {
  1604. /// <summary>
  1605. /// Get a set of elements containing the unique previous siblings of each of the
  1606. /// matched set of elements.
  1607. /// Can be filtered with an optional expressions.
  1608. /// It only returns the immediately previous sibling, not all previous siblings.
  1609. /// Part of DOM/Traversing
  1610. /// </summary>
  1611. /// <param name="expr" type="String" optional="true">
  1612. /// (optional) An expression to filter the previous Elements with
  1613. /// </param>
  1614. /// <returns type="jQuery" />
  1615. var ret = jQuery.map(this, fn);
  1616. if (selector && typeof selector == "string")
  1617. ret = jQuery.multiFilter(selector, ret);
  1618. return this.pushStack(jQuery.unique(ret), name, selector);
  1619. };
  1620. });
  1621. jQuery.each({
  1622. nextAll: function (elem) { return jQuery.dir(elem, "nextSibling"); }
  1623. }, function (name, fn) {
  1624. jQuery.fn[name] = function (selector) {
  1625. /// <summary>
  1626. /// Finds all sibling elements after the current element.
  1627. /// Can be filtered with an optional expressions.
  1628. /// Part of DOM/Traversing
  1629. /// </summary>
  1630. /// <param name="expr" type="String" optional="true">
  1631. /// (optional) An expression to filter the next Elements with
  1632. /// </param>
  1633. /// <returns type="jQuery" />
  1634. var ret = jQuery.map(this, fn);
  1635. if (selector && typeof selector == "string")
  1636. ret = jQuery.multiFilter(selector, ret);
  1637. return this.pushStack(jQuery.unique(ret), name, selector);
  1638. };
  1639. });
  1640. jQuery.each({
  1641. prevAll: function (elem) { return jQuery.dir(elem, "previousSibling"); }
  1642. }, function (name, fn) {
  1643. jQuery.fn[name] = function (selector) {
  1644. /// <summary>
  1645. /// Finds all sibling elements before the current element.
  1646. /// Can be filtered with an optional expressions.
  1647. /// Part of DOM/Traversing
  1648. /// </summary>
  1649. /// <param name="expr" type="String" optional="true">
  1650. /// (optional) An expression to filter the previous Elements with
  1651. /// </param>
  1652. /// <returns type="jQuery" />
  1653. var ret = jQuery.map(this, fn);
  1654. if (selector && typeof selector == "string")
  1655. ret = jQuery.multiFilter(selector, ret);
  1656. return this.pushStack(jQuery.unique(ret), name, selector);
  1657. };
  1658. });
  1659. jQuery.each({
  1660. siblings: function (elem) { return jQuery.sibling(elem.parentNode.firstChild, elem); }
  1661. }, function (name, fn) {
  1662. jQuery.fn[name] = function (selector) {
  1663. /// <summary>
  1664. /// Get a set of elements containing all of the unique siblings of each of the
  1665. /// matched set of elements.
  1666. /// Can be filtered with an optional expressions.
  1667. /// Part of DOM/Traversing
  1668. /// </summary>
  1669. /// <param name="expr" type="String" optional="true">
  1670. /// (optional) An expression to filter the sibling Elements with
  1671. /// </param>
  1672. /// <returns type="jQuery" />
  1673. var ret = jQuery.map(this, fn);
  1674. if (selector && typeof selector == "string")
  1675. ret = jQuery.multiFilter(selector, ret);
  1676. return this.pushStack(jQuery.unique(ret), name, selector);
  1677. };
  1678. });
  1679. jQuery.each({
  1680. children: function (elem) { return jQuery.sibling(elem.firstChild); }
  1681. }, function (name, fn) {
  1682. jQuery.fn[name] = function (selector) {
  1683. /// <summary>
  1684. /// Get a set of elements containing all of the unique children of each of the
  1685. /// matched set of elements.
  1686. /// Can be filtered with an optional expressions.
  1687. /// Part of DOM/Traversing
  1688. /// </summary>
  1689. /// <param name="expr" type="String" optional="true">
  1690. /// (optional) An expression to filter the child Elements with
  1691. /// </param>
  1692. /// <returns type="jQuery" />
  1693. var ret = jQuery.map(this, fn);
  1694. if (selector && typeof selector == "string")
  1695. ret = jQuery.multiFilter(selector, ret);
  1696. return this.pushStack(jQuery.unique(ret), name, selector);
  1697. };
  1698. });
  1699. jQuery.each({
  1700. contents: function (elem) { return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray(elem.childNodes); }
  1701. }, function (name, fn) {
  1702. jQuery.fn[name] = function (selector) {
  1703. /// <summary>Finds all the child nodes inside the matched elements including text nodes, or the content document if the element is an iframe.</summary>
  1704. /// <returns type="jQuery" />
  1705. var ret = jQuery.map(this, fn);
  1706. if (selector && typeof selector == "string")
  1707. ret = jQuery.multiFilter(selector, ret);
  1708. return this.pushStack(jQuery.unique(ret), name, selector);
  1709. };
  1710. });
  1711. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  1712. // jQuery.each({
  1713. // appendTo: "append",
  1714. // prependTo: "prepend",
  1715. // insertBefore: "before",
  1716. // insertAfter: "after",
  1717. // replaceAll: "replaceWith"
  1718. // }, function(name, original){
  1719. // jQuery.fn[ name ] = function() {
  1720. // var args = arguments;
  1721. //
  1722. // return this.each(function(){
  1723. // for ( var i = 0, length = args.length; i < length; i++ )
  1724. // jQuery( args[ i ] )[ original ]( this );
  1725. // });
  1726. // };
  1727. // });
  1728. jQuery.fn.appendTo = function (selector) {
  1729. /// <summary>
  1730. /// Append all of the matched elements to another, specified, set of elements.
  1731. /// As of jQuery 1.3.2, returns all of the inserted elements.
  1732. /// This operation is, essentially, the reverse of doing a regular
  1733. /// $(A).append(B), in that instead of appending B to A, you're appending
  1734. /// A to B.
  1735. /// </summary>
  1736. /// <param name="selector" type="Selector">
  1737. /// target to which the content will be appended.
  1738. /// </param>
  1739. /// <returns type="jQuery" />
  1740. var ret = [], insert = jQuery(selector);
  1741. for (var i = 0, l = insert.length; i < l; i++) {
  1742. var elems = (i > 0 ? this.clone(true) : this).get();
  1743. jQuery.fn["append"].apply(jQuery(insert[i]), elems);
  1744. ret = ret.concat(elems);
  1745. }
  1746. return this.pushStack(ret, "appendTo", selector);
  1747. };
  1748. jQuery.fn.prependTo = function (selector) {
  1749. /// <summary>
  1750. /// Prepend all of the matched elements to another, specified, set of elements.
  1751. /// As of jQuery 1.3.2, returns all of the inserted elements.
  1752. /// This operation is, essentially, the reverse of doing a regular
  1753. /// $(A).prepend(B), in that instead of prepending B to A, you're prepending
  1754. /// A to B.
  1755. /// </summary>
  1756. /// <param name="selector" type="Selector">
  1757. /// target to which the content will be appended.
  1758. /// </param>
  1759. /// <returns type="jQuery" />
  1760. var ret = [], insert = jQuery(selector);
  1761. for (var i = 0, l = insert.length; i < l; i++) {
  1762. var elems = (i > 0 ? this.clone(true) : this).get();
  1763. jQuery.fn["prepend"].apply(jQuery(insert[i]), elems);
  1764. ret = ret.concat(elems);
  1765. }
  1766. return this.pushStack(ret, "prependTo", selector);
  1767. };
  1768. jQuery.fn.insertBefore = function (selector) {
  1769. /// <summary>
  1770. /// Insert all of the matched elements before another, specified, set of elements.
  1771. /// As of jQuery 1.3.2, returns all of the inserted elements.
  1772. /// This operation is, essentially, the reverse of doing a regular
  1773. /// $(A).before(B), in that instead of inserting B before A, you're inserting
  1774. /// A before B.
  1775. /// </summary>
  1776. /// <param name="content" type="String">
  1777. /// Content after which the selected element(s) is inserted.
  1778. /// </param>
  1779. /// <returns type="jQuery" />
  1780. var ret = [], insert = jQuery(selector);
  1781. for (var i = 0, l = insert.length; i < l; i++) {
  1782. var elems = (i > 0 ? this.clone(true) : this).get();
  1783. jQuery.fn["before"].apply(jQuery(insert[i]), elems);
  1784. ret = ret.concat(elems);
  1785. }
  1786. return this.pushStack(ret, "insertBefore", selector);
  1787. };
  1788. jQuery.fn.insertAfter = function (selector) {
  1789. /// <summary>
  1790. /// Insert all of the matched elements after another, specified, set of elements.
  1791. /// As of jQuery 1.3.2, returns all of the inserted elements.
  1792. /// This operation is, essentially, the reverse of doing a regular
  1793. /// $(A).after(B), in that instead of inserting B after A, you're inserting
  1794. /// A after B.
  1795. /// </summary>
  1796. /// <param name="content" type="String">
  1797. /// Content after which the selected element(s) is inserted.
  1798. /// </param>
  1799. /// <returns type="jQuery" />
  1800. var ret = [], insert = jQuery(selector);
  1801. for (var i = 0, l = insert.length; i < l; i++) {
  1802. var elems = (i > 0 ? this.clone(true) : this).get();
  1803. jQuery.fn["after"].apply(jQuery(insert[i]), elems);
  1804. ret = ret.concat(elems);
  1805. }
  1806. return this.pushStack(ret, "insertAfter", selector);
  1807. };
  1808. jQuery.fn.replaceAll = function (selector) {
  1809. /// <summary>
  1810. /// Replaces the elements matched by the specified selector with the matched elements.
  1811. /// As of jQuery 1.3.2, returns all of the inserted elements.
  1812. /// </summary>
  1813. /// <param name="selector" type="Selector">The elements to find and replace the matched elements with.</param>
  1814. /// <returns type="jQuery" />
  1815. var ret = [], insert = jQuery(selector);
  1816. for (var i = 0, l = insert.length; i < l; i++) {
  1817. var elems = (i > 0 ? this.clone(true) : this).get();
  1818. jQuery.fn["replaceWith"].apply(jQuery(insert[i]), elems);
  1819. ret = ret.concat(elems);
  1820. }
  1821. return this.pushStack(ret, "replaceAll", selector);
  1822. };
  1823. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  1824. // jQuery.each({
  1825. // removeAttr: function( name ) {
  1826. // jQuery.attr( this, name, "" );
  1827. // if (this.nodeType == 1)
  1828. // this.removeAttribute( name );
  1829. // },
  1830. //
  1831. // addClass: function( classNames ) {
  1832. // jQuery.className.add( this, classNames );
  1833. // },
  1834. //
  1835. // removeClass: function( classNames ) {
  1836. // jQuery.className.remove( this, classNames );
  1837. // },
  1838. //
  1839. // toggleClass: function( classNames, state ) {
  1840. // if( typeof state !== "boolean" )
  1841. // state = !jQuery.className.has( this, classNames );
  1842. // jQuery.className[ state ? "add" : "remove" ]( this, classNames );
  1843. // },
  1844. //
  1845. // remove: function( selector ) {
  1846. // if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
  1847. // // Prevent memory leaks
  1848. // jQuery( "*", this ).add([this]).each(function(){
  1849. // jQuery.event.remove(this);
  1850. // jQuery.removeData(this);
  1851. // });
  1852. // if (this.parentNode)
  1853. // this.parentNode.removeChild( this );
  1854. // }
  1855. // },
  1856. //
  1857. // empty: function() {
  1858. // // Remove element nodes and prevent memory leaks
  1859. // jQuery( ">*", this ).remove();
  1860. //
  1861. // // Remove any remaining nodes
  1862. // while ( this.firstChild )
  1863. // this.removeChild( this.firstChild );
  1864. // }
  1865. // }, function(name, fn){
  1866. // jQuery.fn[ name ] = function(){
  1867. // return this.each( fn, arguments );
  1868. // };
  1869. // });
  1870. jQuery.fn.removeAttr = function () {
  1871. /// <summary>
  1872. /// Remove an attribute from each of the matched elements.
  1873. /// Part of DOM/Attributes
  1874. /// </summary>
  1875. /// <param name="key" type="String">
  1876. /// name The name of the attribute to remove.
  1877. /// </param>
  1878. /// <returns type="jQuery" />
  1879. return this.each(function (name) {
  1880. jQuery.attr(this, name, "");
  1881. if (this.nodeType == 1)
  1882. this.removeAttribute(name);
  1883. }, arguments);
  1884. };
  1885. jQuery.fn.addClass = function () {
  1886. /// <summary>
  1887. /// Adds the specified class(es) to each of the set of matched elements.
  1888. /// Part of DOM/Attributes
  1889. /// </summary>
  1890. /// <param name="classNames" type="String">
  1891. /// lass One or more CSS classes to add to the elements
  1892. /// </param>
  1893. /// <returns type="jQuery" />
  1894. return this.each(function (classNames) {
  1895. jQuery.className.add(this, classNames);
  1896. }, arguments);
  1897. };
  1898. jQuery.fn.removeClass = function () {
  1899. /// <summary>
  1900. /// Removes all or the specified class(es) from the set of matched elements.
  1901. /// Part of DOM/Attributes
  1902. /// </summary>
  1903. /// <param name="cssClasses" type="String" optional="true">
  1904. /// (Optional) One or more CSS classes to remove from the elements
  1905. /// </param>
  1906. /// <returns type="jQuery" />
  1907. return this.each(function (classNames) {
  1908. jQuery.className.remove(this, classNames);
  1909. }, arguments);
  1910. };
  1911. jQuery.fn.toggleClass = function () {
  1912. /// <summary>
  1913. /// Adds the specified class if it is not present, removes it if it is
  1914. /// present.
  1915. /// Part of DOM/Attributes
  1916. /// </summary>
  1917. /// <param name="cssClass" type="String">
  1918. /// A CSS class with which to toggle the elements
  1919. /// </param>
  1920. /// <returns type="jQuery" />
  1921. return this.each(function (classNames, state) {
  1922. if (typeof state !== "boolean")
  1923. state = !jQuery.className.has(this, classNames);
  1924. jQuery.className[state ? "add" : "remove"](this, classNames);
  1925. }, arguments);
  1926. };
  1927. jQuery.fn.remove = function () {
  1928. /// <summary>
  1929. /// Removes all matched elements from the DOM. This does NOT remove them from the
  1930. /// jQuery object, allowing you to use the matched elements further.
  1931. /// Can be filtered with an optional expressions.
  1932. /// Part of DOM/Manipulation
  1933. /// </summary>
  1934. /// <param name="expr" type="String" optional="true">
  1935. /// (optional) A jQuery expression to filter elements by.
  1936. /// </param>
  1937. /// <returns type="jQuery" />
  1938. return this.each(function (selector) {
  1939. if (!selector || jQuery.filter(selector, [this]).length) {
  1940. // Prevent memory leaks
  1941. jQuery("*", this).add([this]).each(function () {
  1942. jQuery.event.remove(this);
  1943. jQuery.removeData(this);
  1944. });
  1945. if (this.parentNode)
  1946. this.parentNode.removeChild(this);
  1947. }
  1948. }, arguments);
  1949. };
  1950. jQuery.fn.empty = function () {
  1951. /// <summary>
  1952. /// Removes all child nodes from the set of matched elements.
  1953. /// Part of DOM/Manipulation
  1954. /// </summary>
  1955. /// <returns type="jQuery" />
  1956. return this.each(function () {
  1957. // Remove element nodes and prevent memory leaks
  1958. jQuery(this).children().remove();
  1959. // Remove any remaining nodes
  1960. while (this.firstChild)
  1961. this.removeChild(this.firstChild);
  1962. }, arguments);
  1963. };
  1964. // Helper function used by the dimensions and offset modules
  1965. function num(elem, prop) {
  1966. return elem[0] && parseInt(jQuery.curCSS(elem[0], prop, true), 10) || 0;
  1967. }
  1968. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  1969. jQuery.extend({
  1970. cache: {},
  1971. data: function (elem, name, data) {
  1972. elem = elem == window ?
  1973. windowData :
  1974. elem;
  1975. var id = elem[expando];
  1976. // Compute a unique ID for the element
  1977. if (!id)
  1978. id = elem[expando] = ++uuid;
  1979. // Only generate the data cache if we're
  1980. // trying to access or manipulate it
  1981. if (name && !jQuery.cache[id])
  1982. jQuery.cache[id] = {};
  1983. // Prevent overriding the named cache with undefined values
  1984. if (data !== undefined)
  1985. jQuery.cache[id][name] = data;
  1986. // Return the named cache data, or the ID for the element
  1987. return name ?
  1988. jQuery.cache[id][name] :
  1989. id;
  1990. },
  1991. removeData: function (elem, name) {
  1992. elem = elem == window ?
  1993. windowData :
  1994. elem;
  1995. var id = elem[expando];
  1996. // If we want to remove a specific section of the element's data
  1997. if (name) {
  1998. if (jQuery.cache[id]) {
  1999. // Remove the section of cache data
  2000. delete jQuery.cache[id][name];
  2001. // If we've removed all the data, remove the element's cache
  2002. name = "";
  2003. for (name in jQuery.cache[id])
  2004. break;
  2005. if (!name)
  2006. jQuery.removeData(elem);
  2007. }
  2008. // Otherwise, we want to remove all of the element's data
  2009. } else {
  2010. // Clean up the element expando
  2011. try {
  2012. delete elem[expando];
  2013. } catch (e) {
  2014. // IE has trouble directly removing the expando
  2015. // but it's ok with using removeAttribute
  2016. if (elem.removeAttribute)
  2017. elem.removeAttribute(expando);
  2018. }
  2019. // Completely remove the data cache
  2020. delete jQuery.cache[id];
  2021. }
  2022. },
  2023. queue: function (elem, type, data) {
  2024. if (elem) {
  2025. type = (type || "fx") + "queue";
  2026. var q = jQuery.data(elem, type);
  2027. if (!q || jQuery.isArray(data))
  2028. q = jQuery.data(elem, type, jQuery.makeArray(data));
  2029. else if (data)
  2030. q.push(data);
  2031. }
  2032. return q;
  2033. },
  2034. dequeue: function (elem, type) {
  2035. var queue = jQuery.queue(elem, type),
  2036. fn = queue.shift();
  2037. if (!type || type === "fx")
  2038. fn = queue[0];
  2039. if (fn !== undefined)
  2040. fn.call(elem);
  2041. }
  2042. });
  2043. jQuery.fn.extend({
  2044. data: function (key, value) {
  2045. var parts = key.split(".");
  2046. parts[1] = parts[1] ? "." + parts[1] : "";
  2047. if (value === undefined) {
  2048. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  2049. if (data === undefined && this.length)
  2050. data = jQuery.data(this[0], key);
  2051. return data === undefined && parts[1] ?
  2052. this.data(parts[0]) :
  2053. data;
  2054. } else
  2055. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function () {
  2056. jQuery.data(this, key, value);
  2057. });
  2058. },
  2059. removeData: function (key) {
  2060. return this.each(function () {
  2061. jQuery.removeData(this, key);
  2062. });
  2063. },
  2064. queue: function (type, data) {
  2065. /// <summary>
  2066. /// 1: queue() - Returns a reference to the first element's queue (which is an array of functions).
  2067. /// 2: queue(callback) - Adds a new function, to be executed, onto the end of the queue of all matched elements.
  2068. /// 3: queue(queue) - Replaces the queue of all matched element with this new queue (the array of functions).
  2069. /// </summary>
  2070. /// <param name="type" type="Function">The function to add to the queue.</param>
  2071. /// <returns type="jQuery" />
  2072. if (typeof type !== "string") {
  2073. data = type;
  2074. type = "fx";
  2075. }
  2076. if (data === undefined)
  2077. return jQuery.queue(this[0], type);
  2078. return this.each(function () {
  2079. var queue = jQuery.queue(this, type, data);
  2080. if (type == "fx" && queue.length == 1)
  2081. queue[0].call(this);
  2082. });
  2083. },
  2084. dequeue: function (type) {
  2085. /// <summary>
  2086. /// Removes a queued function from the front of the queue and executes it.
  2087. /// </summary>
  2088. /// <param name="type" type="String" optional="true">The type of queue to access.</param>
  2089. /// <returns type="jQuery" />
  2090. return this.each(function () {
  2091. jQuery.dequeue(this, type);
  2092. });
  2093. }
  2094. });/*!
  2095. * Sizzle CSS Selector Engine - v0.9.3
  2096. * Copyright 2009, The Dojo Foundation
  2097. * Released under the MIT, BSD, and GPL Licenses.
  2098. * More information: http://sizzlejs.com/
  2099. */
  2100. (function () {
  2101. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
  2102. done = 0,
  2103. toString = Object.prototype.toString;
  2104. var Sizzle = function (selector, context, results, seed) {
  2105. results = results || [];
  2106. context = context || document;
  2107. if (context.nodeType !== 1 && context.nodeType !== 9)
  2108. return [];
  2109. if (!selector || typeof selector !== "string") {
  2110. return results;
  2111. }
  2112. var parts = [], m, set, checkSet, check, mode, extra, prune = true;
  2113. // Reset the position of the chunker regexp (start from head)
  2114. chunker.lastIndex = 0;
  2115. while ((m = chunker.exec(selector)) !== null) {
  2116. parts.push(m[1]);
  2117. if (m[2]) {
  2118. extra = RegExp.rightContext;
  2119. break;
  2120. }
  2121. }
  2122. if (parts.length > 1 && origPOS.exec(selector)) {
  2123. if (parts.length === 2 && Expr.relative[parts[0]]) {
  2124. set = posProcess(parts[0] + parts[1], context);
  2125. } else {
  2126. set = Expr.relative[parts[0]] ?
  2127. [context] :
  2128. Sizzle(parts.shift(), context);
  2129. while (parts.length) {
  2130. selector = parts.shift();
  2131. if (Expr.relative[selector])
  2132. selector += parts.shift();
  2133. set = posProcess(selector, set);
  2134. }
  2135. }
  2136. } else {
  2137. var ret = seed ?
  2138. { expr: parts.pop(), set: makeArray(seed) } :
  2139. Sizzle.find(parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context));
  2140. set = Sizzle.filter(ret.expr, ret.set);
  2141. if (parts.length > 0) {
  2142. checkSet = makeArray(set);
  2143. } else {
  2144. prune = false;
  2145. }
  2146. while (parts.length) {
  2147. var cur = parts.pop(), pop = cur;
  2148. if (!Expr.relative[cur]) {
  2149. cur = "";
  2150. } else {
  2151. pop = parts.pop();
  2152. }
  2153. if (pop == null) {
  2154. pop = context;
  2155. }
  2156. Expr.relative[cur](checkSet, pop, isXML(context));
  2157. }
  2158. }
  2159. if (!checkSet) {
  2160. checkSet = set;
  2161. }
  2162. if (!checkSet) {
  2163. throw "Syntax error, unrecognized expression: " + (cur || selector);
  2164. }
  2165. if (toString.call(checkSet) === "[object Array]") {
  2166. if (!prune) {
  2167. results.push.apply(results, checkSet);
  2168. } else if (context.nodeType === 1) {
  2169. for (var i = 0; checkSet[i] != null; i++) {
  2170. if (checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i]))) {
  2171. results.push(set[i]);
  2172. }
  2173. }
  2174. } else {
  2175. for (var i = 0; checkSet[i] != null; i++) {
  2176. if (checkSet[i] && checkSet[i].nodeType === 1) {
  2177. results.push(set[i]);
  2178. }
  2179. }
  2180. }
  2181. } else {
  2182. makeArray(checkSet, results);
  2183. }
  2184. if (extra) {
  2185. Sizzle(extra, context, results, seed);
  2186. if (sortOrder) {
  2187. hasDuplicate = false;
  2188. results.sort(sortOrder);
  2189. if (hasDuplicate) {
  2190. for (var i = 1; i < results.length; i++) {
  2191. if (results[i] === results[i - 1]) {
  2192. results.splice(i--, 1);
  2193. }
  2194. }
  2195. }
  2196. }
  2197. }
  2198. return results;
  2199. };
  2200. Sizzle.matches = function (expr, set) {
  2201. return Sizzle(expr, null, null, set);
  2202. };
  2203. Sizzle.find = function (expr, context, isXML) {
  2204. var set, match;
  2205. if (!expr) {
  2206. return [];
  2207. }
  2208. for (var i = 0, l = Expr.order.length; i < l; i++) {
  2209. var type = Expr.order[i], match;
  2210. if ((match = Expr.match[type].exec(expr))) {
  2211. var left = RegExp.leftContext;
  2212. if (left.substr(left.length - 1) !== "\\") {
  2213. match[1] = (match[1] || "").replace(/\\/g, "");
  2214. set = Expr.find[type](match, context, isXML);
  2215. if (set != null) {
  2216. expr = expr.replace(Expr.match[type], "");
  2217. break;
  2218. }
  2219. }
  2220. }
  2221. }
  2222. if (!set) {
  2223. set = context.getElementsByTagName("*");
  2224. }
  2225. return { set: set, expr: expr };
  2226. };
  2227. Sizzle.filter = function (expr, set, inplace, not) {
  2228. var old = expr, result = [], curLoop = set, match, anyFound,
  2229. isXMLFilter = set && set[0] && isXML(set[0]);
  2230. while (expr && set.length) {
  2231. for (var type in Expr.filter) {
  2232. if ((match = Expr.match[type].exec(expr)) != null) {
  2233. var filter = Expr.filter[type], found, item;
  2234. anyFound = false;
  2235. if (curLoop == result) {
  2236. result = [];
  2237. }
  2238. if (Expr.preFilter[type]) {
  2239. match = Expr.preFilter[type](match, curLoop, inplace, result, not, isXMLFilter);
  2240. if (!match) {
  2241. anyFound = found = true;
  2242. } else if (match === true) {
  2243. continue;
  2244. }
  2245. }
  2246. if (match) {
  2247. for (var i = 0; (item = curLoop[i]) != null; i++) {
  2248. if (item) {
  2249. found = filter(item, match, i, curLoop);
  2250. var pass = not ^ !!found;
  2251. if (inplace && found != null) {
  2252. if (pass) {
  2253. anyFound = true;
  2254. } else {
  2255. curLoop[i] = false;
  2256. }
  2257. } else if (pass) {
  2258. result.push(item);
  2259. anyFound = true;
  2260. }
  2261. }
  2262. }
  2263. }
  2264. if (found !== undefined) {
  2265. if (!inplace) {
  2266. curLoop = result;
  2267. }
  2268. expr = expr.replace(Expr.match[type], "");
  2269. if (!anyFound) {
  2270. return [];
  2271. }
  2272. break;
  2273. }
  2274. }
  2275. }
  2276. // Improper expression
  2277. if (expr == old) {
  2278. if (anyFound == null) {
  2279. throw "Syntax error, unrecognized expression: " + expr;
  2280. } else {
  2281. break;
  2282. }
  2283. }
  2284. old = expr;
  2285. }
  2286. return curLoop;
  2287. };
  2288. var Expr = Sizzle.selectors = {
  2289. order: ["ID", "NAME", "TAG"],
  2290. match: {
  2291. ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  2292. CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  2293. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
  2294. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  2295. TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
  2296. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
  2297. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
  2298. PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
  2299. },
  2300. attrMap: {
  2301. "class": "className",
  2302. "for": "htmlFor"
  2303. },
  2304. attrHandle: {
  2305. href: function (elem) {
  2306. return elem.getAttribute("href");
  2307. }
  2308. },
  2309. relative: {
  2310. "+": function (checkSet, part, isXML) {
  2311. var isPartStr = typeof part === "string",
  2312. isTag = isPartStr && !/\W/.test(part),
  2313. isPartStrNotTag = isPartStr && !isTag;
  2314. if (isTag && !isXML) {
  2315. part = part.toUpperCase();
  2316. }
  2317. for (var i = 0, l = checkSet.length, elem; i < l; i++) {
  2318. if ((elem = checkSet[i])) {
  2319. while ((elem = elem.previousSibling) && elem.nodeType !== 1) { }
  2320. checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
  2321. elem || false :
  2322. elem === part;
  2323. }
  2324. }
  2325. if (isPartStrNotTag) {
  2326. Sizzle.filter(part, checkSet, true);
  2327. }
  2328. },
  2329. ">": function (checkSet, part, isXML) {
  2330. var isPartStr = typeof part === "string";
  2331. if (isPartStr && !/\W/.test(part)) {
  2332. part = isXML ? part : part.toUpperCase();
  2333. for (var i = 0, l = checkSet.length; i < l; i++) {
  2334. var elem = checkSet[i];
  2335. if (elem) {
  2336. var parent = elem.parentNode;
  2337. checkSet[i] = parent.nodeName === part ? parent : false;
  2338. }
  2339. }
  2340. } else {
  2341. for (var i = 0, l = checkSet.length; i < l; i++) {
  2342. var elem = checkSet[i];
  2343. if (elem) {
  2344. checkSet[i] = isPartStr ?
  2345. elem.parentNode :
  2346. elem.parentNode === part;
  2347. }
  2348. }
  2349. if (isPartStr) {
  2350. Sizzle.filter(part, checkSet, true);
  2351. }
  2352. }
  2353. },
  2354. "": function (checkSet, part, isXML) {
  2355. var doneName = done++, checkFn = dirCheck;
  2356. if (!part.match(/\W/)) {
  2357. var nodeCheck = part = isXML ? part : part.toUpperCase();
  2358. checkFn = dirNodeCheck;
  2359. }
  2360. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  2361. },
  2362. "~": function (checkSet, part, isXML) {
  2363. var doneName = done++, checkFn = dirCheck;
  2364. if (typeof part === "string" && !part.match(/\W/)) {
  2365. var nodeCheck = part = isXML ? part : part.toUpperCase();
  2366. checkFn = dirNodeCheck;
  2367. }
  2368. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  2369. }
  2370. },
  2371. find: {
  2372. ID: function (match, context, isXML) {
  2373. if (typeof context.getElementById !== "undefined" && !isXML) {
  2374. var m = context.getElementById(match[1]);
  2375. return m ? [m] : [];
  2376. }
  2377. },
  2378. NAME: function (match, context, isXML) {
  2379. if (typeof context.getElementsByName !== "undefined") {
  2380. var ret = [], results = context.getElementsByName(match[1]);
  2381. for (var i = 0, l = results.length; i < l; i++) {
  2382. if (results[i].getAttribute("name") === match[1]) {
  2383. ret.push(results[i]);
  2384. }
  2385. }
  2386. return ret.length === 0 ? null : ret;
  2387. }
  2388. },
  2389. TAG: function (match, context) {
  2390. return context.getElementsByTagName(match[1]);
  2391. }
  2392. },
  2393. preFilter: {
  2394. CLASS: function (match, curLoop, inplace, result, not, isXML) {
  2395. match = " " + match[1].replace(/\\/g, "") + " ";
  2396. if (isXML) {
  2397. return match;
  2398. }
  2399. for (var i = 0, elem; (elem = curLoop[i]) != null; i++) {
  2400. if (elem) {
  2401. if (not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0)) {
  2402. if (!inplace)
  2403. result.push(elem);
  2404. } else if (inplace) {
  2405. curLoop[i] = false;
  2406. }
  2407. }
  2408. }
  2409. return false;
  2410. },
  2411. ID: function (match) {
  2412. return match[1].replace(/\\/g, "");
  2413. },
  2414. TAG: function (match, curLoop) {
  2415. for (var i = 0; curLoop[i] === false; i++) { }
  2416. return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
  2417. },
  2418. CHILD: function (match) {
  2419. if (match[1] == "nth") {
  2420. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  2421. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  2422. match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
  2423. !/\D/.test(match[2]) && "0n+" + match[2] || match[2]);
  2424. // calculate the numbers (first)n+(last) including if they are negative
  2425. match[2] = (test[1] + (test[2] || 1)) - 0;
  2426. match[3] = test[3] - 0;
  2427. }
  2428. // TODO: Move to normal caching system
  2429. match[0] = done++;
  2430. return match;
  2431. },
  2432. ATTR: function (match, curLoop, inplace, result, not, isXML) {
  2433. var name = match[1].replace(/\\/g, "");
  2434. if (!isXML && Expr.attrMap[name]) {
  2435. match[1] = Expr.attrMap[name];
  2436. }
  2437. if (match[2] === "~=") {
  2438. match[4] = " " + match[4] + " ";
  2439. }
  2440. return match;
  2441. },
  2442. PSEUDO: function (match, curLoop, inplace, result, not) {
  2443. if (match[1] === "not") {
  2444. // If we're dealing with a complex expression, or a simple one
  2445. if (match[3].match(chunker).length > 1 || /^\w/.test(match[3])) {
  2446. match[3] = Sizzle(match[3], null, null, curLoop);
  2447. } else {
  2448. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  2449. if (!inplace) {
  2450. result.push.apply(result, ret);
  2451. }
  2452. return false;
  2453. }
  2454. } else if (Expr.match.POS.test(match[0]) || Expr.match.CHILD.test(match[0])) {
  2455. return true;
  2456. }
  2457. return match;
  2458. },
  2459. POS: function (match) {
  2460. match.unshift(true);
  2461. return match;
  2462. }
  2463. },
  2464. filters: {
  2465. enabled: function (elem) {
  2466. return elem.disabled === false && elem.type !== "hidden";
  2467. },
  2468. disabled: function (elem) {
  2469. return elem.disabled === true;
  2470. },
  2471. checked: function (elem) {
  2472. return elem.checked === true;
  2473. },
  2474. selected: function (elem) {
  2475. // Accessing this property makes selected-by-default
  2476. // options in Safari work properly
  2477. elem.parentNode.selectedIndex;
  2478. return elem.selected === true;
  2479. },
  2480. parent: function (elem) {
  2481. return !!elem.firstChild;
  2482. },
  2483. empty: function (elem) {
  2484. return !elem.firstChild;
  2485. },
  2486. has: function (elem, i, match) {
  2487. return !!Sizzle(match[3], elem).length;
  2488. },
  2489. header: function (elem) {
  2490. return /h\d/i.test(elem.nodeName);
  2491. },
  2492. text: function (elem) {
  2493. return "text" === elem.type;
  2494. },
  2495. radio: function (elem) {
  2496. return "radio" === elem.type;
  2497. },
  2498. checkbox: function (elem) {
  2499. return "checkbox" === elem.type;
  2500. },
  2501. file: function (elem) {
  2502. return "file" === elem.type;
  2503. },
  2504. password: function (elem) {
  2505. return "password" === elem.type;
  2506. },
  2507. submit: function (elem) {
  2508. return "submit" === elem.type;
  2509. },
  2510. image: function (elem) {
  2511. return "image" === elem.type;
  2512. },
  2513. reset: function (elem) {
  2514. return "reset" === elem.type;
  2515. },
  2516. button: function (elem) {
  2517. return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
  2518. },
  2519. input: function (elem) {
  2520. return /input|select|textarea|button/i.test(elem.nodeName);
  2521. }
  2522. },
  2523. setFilters: {
  2524. first: function (elem, i) {
  2525. return i === 0;
  2526. },
  2527. last: function (elem, i, match, array) {
  2528. return i === array.length - 1;
  2529. },
  2530. even: function (elem, i) {
  2531. return i % 2 === 0;
  2532. },
  2533. odd: function (elem, i) {
  2534. return i % 2 === 1;
  2535. },
  2536. lt: function (elem, i, match) {
  2537. return i < match[3] - 0;
  2538. },
  2539. gt: function (elem, i, match) {
  2540. return i > match[3] - 0;
  2541. },
  2542. nth: function (elem, i, match) {
  2543. return match[3] - 0 == i;
  2544. },
  2545. eq: function (elem, i, match) {
  2546. return match[3] - 0 == i;
  2547. }
  2548. },
  2549. filter: {
  2550. PSEUDO: function (elem, match, i, array) {
  2551. var name = match[1], filter = Expr.filters[name];
  2552. if (filter) {
  2553. return filter(elem, i, match, array);
  2554. } else if (name === "contains") {
  2555. return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
  2556. } else if (name === "not") {
  2557. var not = match[3];
  2558. for (var i = 0, l = not.length; i < l; i++) {
  2559. if (not[i] === elem) {
  2560. return false;
  2561. }
  2562. }
  2563. return true;
  2564. }
  2565. },
  2566. CHILD: function (elem, match) {
  2567. var type = match[1], node = elem;
  2568. switch (type) {
  2569. case 'only':
  2570. case 'first':
  2571. while (node = node.previousSibling) {
  2572. if (node.nodeType === 1) return false;
  2573. }
  2574. if (type == 'first') return true;
  2575. node = elem;
  2576. case 'last':
  2577. while (node = node.nextSibling) {
  2578. if (node.nodeType === 1) return false;
  2579. }
  2580. return true;
  2581. case 'nth':
  2582. var first = match[2], last = match[3];
  2583. if (first == 1 && last == 0) {
  2584. return true;
  2585. }
  2586. var doneName = match[0],
  2587. parent = elem.parentNode;
  2588. if (parent && (parent.sizcache !== doneName || !elem.nodeIndex)) {
  2589. var count = 0;
  2590. for (node = parent.firstChild; node; node = node.nextSibling) {
  2591. if (node.nodeType === 1) {
  2592. node.nodeIndex = ++count;
  2593. }
  2594. }
  2595. parent.sizcache = doneName;
  2596. }
  2597. var diff = elem.nodeIndex - last;
  2598. if (first == 0) {
  2599. return diff == 0;
  2600. } else {
  2601. return (diff % first == 0 && diff / first >= 0);
  2602. }
  2603. }
  2604. },
  2605. ID: function (elem, match) {
  2606. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  2607. },
  2608. TAG: function (elem, match) {
  2609. return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
  2610. },
  2611. CLASS: function (elem, match) {
  2612. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  2613. .indexOf(match) > -1;
  2614. },
  2615. ATTR: function (elem, match) {
  2616. var name = match[1],
  2617. result = Expr.attrHandle[name] ?
  2618. Expr.attrHandle[name](elem) :
  2619. elem[name] != null ?
  2620. elem[name] :
  2621. elem.getAttribute(name),
  2622. value = result + "",
  2623. type = match[2],
  2624. check = match[4];
  2625. return result == null ?
  2626. type === "!=" :
  2627. type === "=" ?
  2628. value === check :
  2629. type === "*=" ?
  2630. value.indexOf(check) >= 0 :
  2631. type === "~=" ?
  2632. (" " + value + " ").indexOf(check) >= 0 :
  2633. !check ?
  2634. value && result !== false :
  2635. type === "!=" ?
  2636. value != check :
  2637. type === "^=" ?
  2638. value.indexOf(check) === 0 :
  2639. type === "$=" ?
  2640. value.substr(value.length - check.length) === check :
  2641. type === "|=" ?
  2642. value === check || value.substr(0, check.length + 1) === check + "-" :
  2643. false;
  2644. },
  2645. POS: function (elem, match, i, array) {
  2646. var name = match[2], filter = Expr.setFilters[name];
  2647. if (filter) {
  2648. return filter(elem, i, match, array);
  2649. }
  2650. }
  2651. }
  2652. };
  2653. var origPOS = Expr.match.POS;
  2654. for (var type in Expr.match) {
  2655. Expr.match[type] = RegExp(Expr.match[type].source + /(?![^\[]*\])(?![^\(]*\))/.source);
  2656. }
  2657. var makeArray = function (array, results) {
  2658. array = Array.prototype.slice.call(array);
  2659. if (results) {
  2660. results.push.apply(results, array);
  2661. return results;
  2662. }
  2663. return array;
  2664. };
  2665. // Perform a simple check to determine if the browser is capable of
  2666. // converting a NodeList to an array using builtin methods.
  2667. try {
  2668. Array.prototype.slice.call(document.documentElement.childNodes);
  2669. // Provide a fallback method if it does not work
  2670. } catch (e) {
  2671. makeArray = function (array, results) {
  2672. var ret = results || [];
  2673. if (toString.call(array) === "[object Array]") {
  2674. Array.prototype.push.apply(ret, array);
  2675. } else {
  2676. if (typeof array.length === "number") {
  2677. for (var i = 0, l = array.length; i < l; i++) {
  2678. ret.push(array[i]);
  2679. }
  2680. } else {
  2681. for (var i = 0; array[i]; i++) {
  2682. ret.push(array[i]);
  2683. }
  2684. }
  2685. }
  2686. return ret;
  2687. };
  2688. }
  2689. var sortOrder;
  2690. if (document.documentElement.compareDocumentPosition) {
  2691. sortOrder = function (a, b) {
  2692. var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  2693. if (ret === 0) {
  2694. hasDuplicate = true;
  2695. }
  2696. return ret;
  2697. };
  2698. } else if ("sourceIndex" in document.documentElement) {
  2699. sortOrder = function (a, b) {
  2700. var ret = a.sourceIndex - b.sourceIndex;
  2701. if (ret === 0) {
  2702. hasDuplicate = true;
  2703. }
  2704. return ret;
  2705. };
  2706. } else if (document.createRange) {
  2707. sortOrder = function (a, b) {
  2708. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  2709. aRange.selectNode(a);
  2710. aRange.collapse(true);
  2711. bRange.selectNode(b);
  2712. bRange.collapse(true);
  2713. var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  2714. if (ret === 0) {
  2715. hasDuplicate = true;
  2716. }
  2717. return ret;
  2718. };
  2719. }
  2720. // [vsdoc] The following function has been modified for IntelliSense.
  2721. // Check to see if the browser returns elements by name when
  2722. // querying by getElementById (and provide a workaround)
  2723. (function () {
  2724. // We're going to inject a fake input element with a specified name
  2725. ////var form = document.createElement("form"),
  2726. //// id = "script" + (new Date).getTime();
  2727. ////form.innerHTML = "<input name='" + id + "'/>";
  2728. // Inject it into the root element, check its status, and remove it quickly
  2729. ////var root = document.documentElement;
  2730. ////root.insertBefore( form, root.firstChild );
  2731. // The workaround has to do additional checks after a getElementById
  2732. // Which slows things down for other browsers (hence the branching)
  2733. ////if ( !!document.getElementById( id ) ) {
  2734. Expr.find.ID = function (match, context, isXML) {
  2735. if (typeof context.getElementById !== "undefined" && !isXML) {
  2736. var m = context.getElementById(match[1]);
  2737. return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
  2738. }
  2739. };
  2740. Expr.filter.ID = function (elem, match) {
  2741. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  2742. return elem.nodeType === 1 && node && node.nodeValue === match;
  2743. };
  2744. ////}
  2745. ////root.removeChild( form );
  2746. })();
  2747. // [vsdoc] The following function has been modified for IntelliSense.
  2748. (function () {
  2749. // Check to see if the browser returns only elements
  2750. // when doing getElementsByTagName("*")
  2751. // Create a fake element
  2752. ////var div = document.createElement("div");
  2753. ////div.appendChild( document.createComment("") );
  2754. // Make sure no comments are found
  2755. ////if ( div.getElementsByTagName("*").length > 0 ) {
  2756. Expr.find.TAG = function (match, context) {
  2757. var results = context.getElementsByTagName(match[1]);
  2758. // Filter out possible comments
  2759. if (match[1] === "*") {
  2760. var tmp = [];
  2761. for (var i = 0; results[i]; i++) {
  2762. if (results[i].nodeType === 1) {
  2763. tmp.push(results[i]);
  2764. }
  2765. }
  2766. results = tmp;
  2767. }
  2768. return results;
  2769. };
  2770. ////}
  2771. // Check to see if an attribute returns normalized href attributes
  2772. ////div.innerHTML = "<a href='#'></a>";
  2773. ////if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  2774. //// div.firstChild.getAttribute("href") !== "#" ) {
  2775. Expr.attrHandle.href = function (elem) {
  2776. return elem.getAttribute("href", 2);
  2777. };
  2778. ////}
  2779. })();
  2780. if (document.querySelectorAll) (function () {
  2781. var oldSizzle = Sizzle, div = document.createElement("div");
  2782. div.innerHTML = "<p class='TEST'></p>";
  2783. // Safari can't handle uppercase or unicode characters when
  2784. // in quirks mode.
  2785. if (div.querySelectorAll && div.querySelectorAll(".TEST").length === 0) {
  2786. return;
  2787. }
  2788. Sizzle = function (query, context, extra, seed) {
  2789. context = context || document;
  2790. // Only use querySelectorAll on non-XML documents
  2791. // (ID selectors don't work in non-HTML documents)
  2792. if (!seed && context.nodeType === 9 && !isXML(context)) {
  2793. try {
  2794. return makeArray(context.querySelectorAll(query), extra);
  2795. } catch (e) { }
  2796. }
  2797. return oldSizzle(query, context, extra, seed);
  2798. };
  2799. Sizzle.find = oldSizzle.find;
  2800. Sizzle.filter = oldSizzle.filter;
  2801. Sizzle.selectors = oldSizzle.selectors;
  2802. Sizzle.matches = oldSizzle.matches;
  2803. })();
  2804. if (document.getElementsByClassName && document.documentElement.getElementsByClassName) (function () {
  2805. var div = document.createElement("div");
  2806. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  2807. // Opera can't find a second classname (in 9.6)
  2808. if (div.getElementsByClassName("e").length === 0)
  2809. return;
  2810. // Safari caches class attributes, doesn't catch changes (in 3.2)
  2811. div.lastChild.className = "e";
  2812. if (div.getElementsByClassName("e").length === 1)
  2813. return;
  2814. Expr.order.splice(1, 0, "CLASS");
  2815. Expr.find.CLASS = function (match, context, isXML) {
  2816. if (typeof context.getElementsByClassName !== "undefined" && !isXML) {
  2817. return context.getElementsByClassName(match[1]);
  2818. }
  2819. };
  2820. })();
  2821. function dirNodeCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) {
  2822. var sibDir = dir == "previousSibling" && !isXML;
  2823. for (var i = 0, l = checkSet.length; i < l; i++) {
  2824. var elem = checkSet[i];
  2825. if (elem) {
  2826. if (sibDir && elem.nodeType === 1) {
  2827. elem.sizcache = doneName;
  2828. elem.sizset = i;
  2829. }
  2830. elem = elem[dir];
  2831. var match = false;
  2832. while (elem) {
  2833. if (elem.sizcache === doneName) {
  2834. match = checkSet[elem.sizset];
  2835. break;
  2836. }
  2837. if (elem.nodeType === 1 && !isXML) {
  2838. elem.sizcache = doneName;
  2839. elem.sizset = i;
  2840. }
  2841. if (elem.nodeName === cur) {
  2842. match = elem;
  2843. break;
  2844. }
  2845. elem = elem[dir];
  2846. }
  2847. checkSet[i] = match;
  2848. }
  2849. }
  2850. }
  2851. function dirCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) {
  2852. var sibDir = dir == "previousSibling" && !isXML;
  2853. for (var i = 0, l = checkSet.length; i < l; i++) {
  2854. var elem = checkSet[i];
  2855. if (elem) {
  2856. if (sibDir && elem.nodeType === 1) {
  2857. elem.sizcache = doneName;
  2858. elem.sizset = i;
  2859. }
  2860. elem = elem[dir];
  2861. var match = false;
  2862. while (elem) {
  2863. if (elem.sizcache === doneName) {
  2864. match = checkSet[elem.sizset];
  2865. break;
  2866. }
  2867. if (elem.nodeType === 1) {
  2868. if (!isXML) {
  2869. elem.sizcache = doneName;
  2870. elem.sizset = i;
  2871. }
  2872. if (typeof cur !== "string") {
  2873. if (elem === cur) {
  2874. match = true;
  2875. break;
  2876. }
  2877. } else if (Sizzle.filter(cur, [elem]).length > 0) {
  2878. match = elem;
  2879. break;
  2880. }
  2881. }
  2882. elem = elem[dir];
  2883. }
  2884. checkSet[i] = match;
  2885. }
  2886. }
  2887. }
  2888. var contains = document.compareDocumentPosition ? function (a, b) {
  2889. return a.compareDocumentPosition(b) & 16;
  2890. } : function (a, b) {
  2891. return a !== b && (a.contains ? a.contains(b) : true);
  2892. };
  2893. var isXML = function (elem) {
  2894. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  2895. !!elem.ownerDocument && isXML(elem.ownerDocument);
  2896. };
  2897. var posProcess = function (selector, context) {
  2898. var tmpSet = [], later = "", match,
  2899. root = context.nodeType ? [context] : context;
  2900. // Position selectors must be done after the filter
  2901. // And so must :not(positional) so we move all PSEUDOs to the end
  2902. while ((match = Expr.match.PSEUDO.exec(selector))) {
  2903. later += match[0];
  2904. selector = selector.replace(Expr.match.PSEUDO, "");
  2905. }
  2906. selector = Expr.relative[selector] ? selector + "*" : selector;
  2907. for (var i = 0, l = root.length; i < l; i++) {
  2908. Sizzle(selector, root[i], tmpSet);
  2909. }
  2910. return Sizzle.filter(later, tmpSet);
  2911. };
  2912. // EXPOSE
  2913. jQuery.find = Sizzle;
  2914. jQuery.filter = Sizzle.filter;
  2915. jQuery.expr = Sizzle.selectors;
  2916. jQuery.expr[":"] = jQuery.expr.filters;
  2917. Sizzle.selectors.filters.hidden = function (elem) {
  2918. return elem.offsetWidth === 0 || elem.offsetHeight === 0;
  2919. };
  2920. Sizzle.selectors.filters.visible = function (elem) {
  2921. return elem.offsetWidth > 0 || elem.offsetHeight > 0;
  2922. };
  2923. Sizzle.selectors.filters.animated = function (elem) {
  2924. return jQuery.grep(jQuery.timers, function (fn) {
  2925. return elem === fn.elem;
  2926. }).length;
  2927. };
  2928. jQuery.multiFilter = function (expr, elems, not) {
  2929. /// <summary>
  2930. /// This member is internal only.
  2931. /// </summary>
  2932. /// <private />
  2933. if (not) {
  2934. expr = ":not(" + expr + ")";
  2935. }
  2936. return Sizzle.matches(expr, elems);
  2937. };
  2938. jQuery.dir = function (elem, dir) {
  2939. /// <summary>
  2940. /// This member is internal only.
  2941. /// </summary>
  2942. /// <private />
  2943. // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=dir
  2944. var matched = [], cur = elem[dir];
  2945. while (cur && cur != document) {
  2946. if (cur.nodeType == 1)
  2947. matched.push(cur);
  2948. cur = cur[dir];
  2949. }
  2950. return matched;
  2951. };
  2952. jQuery.nth = function (cur, result, dir, elem) {
  2953. /// <summary>
  2954. /// This member is internal only.
  2955. /// </summary>
  2956. /// <private />
  2957. // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=nth
  2958. result = result || 1;
  2959. var num = 0;
  2960. for (; cur; cur = cur[dir])
  2961. if (cur.nodeType == 1 && ++num == result)
  2962. break;
  2963. return cur;
  2964. };
  2965. jQuery.sibling = function (n, elem) {
  2966. /// <summary>
  2967. /// This member is internal only.
  2968. /// </summary>
  2969. /// <private />
  2970. // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=nth
  2971. var r = [];
  2972. for (; n; n = n.nextSibling) {
  2973. if (n.nodeType == 1 && n != elem)
  2974. r.push(n);
  2975. }
  2976. return r;
  2977. };
  2978. return;
  2979. window.Sizzle = Sizzle;
  2980. })();
  2981. /*
  2982. * A number of helper functions used for managing events.
  2983. * Many of the ideas behind this code originated from
  2984. * Dean Edwards' addEvent library.
  2985. */
  2986. jQuery.event = {
  2987. // Bind an event to an element
  2988. // Original by Dean Edwards
  2989. add: function (elem, types, handler, data) {
  2990. /// <summary>
  2991. /// This method is internal.
  2992. /// </summary>
  2993. /// <private />
  2994. if (elem.nodeType == 3 || elem.nodeType == 8)
  2995. return;
  2996. // For whatever reason, IE has trouble passing the window object
  2997. // around, causing it to be cloned in the process
  2998. if (elem.setInterval && elem != window)
  2999. elem = window;
  3000. // Make sure that the function being executed has a unique ID
  3001. if (!handler.guid)
  3002. handler.guid = this.guid++;
  3003. // if data is passed, bind to handler
  3004. if (data !== undefined) {
  3005. // Create temporary function pointer to original handler
  3006. var fn = handler;
  3007. // Create unique handler function, wrapped around original handler
  3008. handler = this.proxy(fn);
  3009. // Store data in unique handler
  3010. handler.data = data;
  3011. }
  3012. // Init the element's event structure
  3013. var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
  3014. handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function () {
  3015. // Handle the second event of a trigger and when
  3016. // an event is called after a page has unloaded
  3017. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  3018. jQuery.event.handle.apply(arguments.callee.elem, arguments) :
  3019. undefined;
  3020. });
  3021. // Add elem as a property of the handle function
  3022. // This is to prevent a memory leak with non-native
  3023. // event in IE.
  3024. handle.elem = elem;
  3025. // Handle multiple events separated by a space
  3026. // jQuery(...).bind("mouseover mouseout", fn);
  3027. jQuery.each(types.split(/\s+/), function (index, type) {
  3028. // Namespaced event handlers
  3029. var namespaces = type.split(".");
  3030. type = namespaces.shift();
  3031. handler.type = namespaces.slice().sort().join(".");
  3032. // Get the current list of functions bound to this event
  3033. var handlers = events[type];
  3034. if (jQuery.event.specialAll[type])
  3035. jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
  3036. // Init the event handler queue
  3037. if (!handlers) {
  3038. handlers = events[type] = {};
  3039. // Check for a special event handler
  3040. // Only use addEventListener/attachEvent if the special
  3041. // events handler returns false
  3042. if (!jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false) {
  3043. // Bind the global event handler to the element
  3044. if (elem.addEventListener)
  3045. elem.addEventListener(type, handle, false);
  3046. else if (elem.attachEvent)
  3047. elem.attachEvent("on" + type, handle);
  3048. }
  3049. }
  3050. // Add the function to the element's handler list
  3051. handlers[handler.guid] = handler;
  3052. // Keep track of which events have been used, for global triggering
  3053. jQuery.event.global[type] = true;
  3054. });
  3055. // Nullify elem to prevent memory leaks in IE
  3056. elem = null;
  3057. },
  3058. guid: 1,
  3059. global: {},
  3060. // Detach an event or set of events from an element
  3061. remove: function (elem, types, handler) {
  3062. /// <summary>
  3063. /// This method is internal.
  3064. /// </summary>
  3065. /// <private />
  3066. // don't do events on text and comment nodes
  3067. if (elem.nodeType == 3 || elem.nodeType == 8)
  3068. return;
  3069. var events = jQuery.data(elem, "events"), ret, index;
  3070. if (events) {
  3071. // Unbind all events for the element
  3072. if (types === undefined || (typeof types === "string" && types.charAt(0) == "."))
  3073. for (var type in events)
  3074. this.remove(elem, type + (types || ""));
  3075. else {
  3076. // types is actually an event object here
  3077. if (types.type) {
  3078. handler = types.handler;
  3079. types = types.type;
  3080. }
  3081. // Handle multiple events seperated by a space
  3082. // jQuery(...).unbind("mouseover mouseout", fn);
  3083. jQuery.each(types.split(/\s+/), function (index, type) {
  3084. // Namespaced event handlers
  3085. var namespaces = type.split(".");
  3086. type = namespaces.shift();
  3087. var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
  3088. if (events[type]) {
  3089. // remove the given handler for the given type
  3090. if (handler)
  3091. delete events[type][handler.guid];
  3092. // remove all handlers for the given type
  3093. else
  3094. for (var handle in events[type])
  3095. // Handle the removal of namespaced events
  3096. if (namespace.test(events[type][handle].type))
  3097. delete events[type][handle];
  3098. if (jQuery.event.specialAll[type])
  3099. jQuery.event.specialAll[type].teardown.call(elem, namespaces);
  3100. // remove generic event handler if no more handlers exist
  3101. for (ret in events[type]) break;
  3102. if (!ret) {
  3103. if (!jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false) {
  3104. if (elem.removeEventListener)
  3105. elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
  3106. else if (elem.detachEvent)
  3107. elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
  3108. }
  3109. ret = null;
  3110. delete events[type];
  3111. }
  3112. }
  3113. });
  3114. }
  3115. // Remove the expando if it's no longer used
  3116. for (ret in events) break;
  3117. if (!ret) {
  3118. var handle = jQuery.data(elem, "handle");
  3119. if (handle) handle.elem = null;
  3120. jQuery.removeData(elem, "events");
  3121. jQuery.removeData(elem, "handle");
  3122. }
  3123. }
  3124. },
  3125. // bubbling is internal
  3126. trigger: function (event, data, elem, bubbling) {
  3127. /// <summary>
  3128. /// This method is internal.
  3129. /// </summary>
  3130. /// <private />
  3131. // Event object or event type
  3132. var type = event.type || event;
  3133. if (!bubbling) {
  3134. event = typeof event === "object" ?
  3135. // jQuery.Event object
  3136. event[expando] ? event :
  3137. // Object literal
  3138. jQuery.extend(jQuery.Event(type), event) :
  3139. // Just the event type (string)
  3140. jQuery.Event(type);
  3141. if (type.indexOf("!") >= 0) {
  3142. event.type = type = type.slice(0, -1);
  3143. event.exclusive = true;
  3144. }
  3145. // Handle a global trigger
  3146. if (!elem) {
  3147. // Don't bubble custom events when global (to avoid too much overhead)
  3148. event.stopPropagation();
  3149. // Only trigger if we've ever bound an event for it
  3150. if (this.global[type])
  3151. jQuery.each(jQuery.cache, function () {
  3152. if (this.events && this.events[type])
  3153. jQuery.event.trigger(event, data, this.handle.elem);
  3154. });
  3155. }
  3156. // Handle triggering a single element
  3157. // don't do events on text and comment nodes
  3158. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  3159. return undefined;
  3160. // Clean up in case it is reused
  3161. event.result = undefined;
  3162. event.target = elem;
  3163. // Clone the incoming data, if any
  3164. data = jQuery.makeArray(data);
  3165. data.unshift(event);
  3166. }
  3167. event.currentTarget = elem;
  3168. // Trigger the event, it is assumed that "handle" is a function
  3169. var handle = jQuery.data(elem, "handle");
  3170. if (handle)
  3171. handle.apply(elem, data);
  3172. // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
  3173. if ((!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on" + type] && elem["on" + type].apply(elem, data) === false)
  3174. event.result = false;
  3175. // Trigger the native events (except for clicks on links)
  3176. if (!bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click")) {
  3177. this.triggered = true;
  3178. try {
  3179. elem[type]();
  3180. // prevent IE from throwing an error for some hidden elements
  3181. } catch (e) { }
  3182. }
  3183. this.triggered = false;
  3184. if (!event.isPropagationStopped()) {
  3185. var parent = elem.parentNode || elem.ownerDocument;
  3186. if (parent)
  3187. jQuery.event.trigger(event, data, parent, true);
  3188. }
  3189. },
  3190. handle: function (event) {
  3191. /// <summary>
  3192. /// This method is internal.
  3193. /// </summary>
  3194. /// <private />
  3195. // returned undefined or false
  3196. var all, handlers;
  3197. event = arguments[0] = jQuery.event.fix(event || window.event);
  3198. event.currentTarget = this;
  3199. // Namespaced event handlers
  3200. var namespaces = event.type.split(".");
  3201. event.type = namespaces.shift();
  3202. // Cache this now, all = true means, any handler
  3203. all = !namespaces.length && !event.exclusive;
  3204. var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
  3205. handlers = (jQuery.data(this, "events") || {})[event.type];
  3206. for (var j in handlers) {
  3207. var handler = handlers[j];
  3208. // Filter the functions by class
  3209. if (all || namespace.test(handler.type)) {
  3210. // Pass in a reference to the handler function itself
  3211. // So that we can later remove it
  3212. event.handler = handler;
  3213. event.data = handler.data;
  3214. var ret = handler.apply(this, arguments);
  3215. if (ret !== undefined) {
  3216. event.result = ret;
  3217. if (ret === false) {
  3218. event.preventDefault();
  3219. event.stopPropagation();
  3220. }
  3221. }
  3222. if (event.isImmediatePropagationStopped())
  3223. break;
  3224. }
  3225. }
  3226. },
  3227. props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
  3228. fix: function (event) {
  3229. /// <summary>
  3230. /// This method is internal.
  3231. /// </summary>
  3232. /// <private />
  3233. if (event[expando])
  3234. return event;
  3235. // store a copy of the original event object
  3236. // and "clone" to set read-only properties
  3237. var originalEvent = event;
  3238. event = jQuery.Event(originalEvent);
  3239. for (var i = this.props.length, prop; i;) {
  3240. prop = this.props[--i];
  3241. event[prop] = originalEvent[prop];
  3242. }
  3243. // Fix target property, if necessary
  3244. if (!event.target)
  3245. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  3246. // check if target is a textnode (safari)
  3247. if (event.target.nodeType == 3)
  3248. event.target = event.target.parentNode;
  3249. // Add relatedTarget, if necessary
  3250. if (!event.relatedTarget && event.fromElement)
  3251. event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
  3252. // Calculate pageX/Y if missing and clientX/Y available
  3253. if (event.pageX == null && event.clientX != null) {
  3254. var doc = document.documentElement, body = document.body;
  3255. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  3256. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  3257. }
  3258. // Add which for key events
  3259. if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode))
  3260. event.which = event.charCode || event.keyCode;
  3261. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  3262. if (!event.metaKey && event.ctrlKey)
  3263. event.metaKey = event.ctrlKey;
  3264. // Add which for click: 1 == left; 2 == middle; 3 == right
  3265. // Note: button is not normalized, so don't use it
  3266. if (!event.which && event.button)
  3267. event.which = (event.button & 1 ? 1 : (event.button & 2 ? 3 : (event.button & 4 ? 2 : 0)));
  3268. return event;
  3269. },
  3270. proxy: function (fn, proxy) {
  3271. /// <summary>
  3272. /// This method is internal.
  3273. /// </summary>
  3274. /// <private />
  3275. proxy = proxy || function () { return fn.apply(this, arguments); };
  3276. // Set the guid of unique handler to the same of original handler, so it can be removed
  3277. proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
  3278. // So proxy can be declared as an argument
  3279. return proxy;
  3280. },
  3281. special: {
  3282. ready: {
  3283. /// <summary>
  3284. /// This method is internal.
  3285. /// </summary>
  3286. /// <private />
  3287. // Make sure the ready event is setup
  3288. setup: bindReady,
  3289. teardown: function () { }
  3290. }
  3291. },
  3292. specialAll: {
  3293. live: {
  3294. setup: function (selector, namespaces) {
  3295. jQuery.event.add(this, namespaces[0], liveHandler);
  3296. },
  3297. teardown: function (namespaces) {
  3298. if (namespaces.length) {
  3299. var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
  3300. jQuery.each((jQuery.data(this, "events").live || {}), function () {
  3301. if (name.test(this.type))
  3302. remove++;
  3303. });
  3304. if (remove < 1)
  3305. jQuery.event.remove(this, namespaces[0], liveHandler);
  3306. }
  3307. }
  3308. }
  3309. }
  3310. };
  3311. jQuery.Event = function (src) {
  3312. // Allow instantiation without the 'new' keyword
  3313. if (!this.preventDefault)
  3314. return new jQuery.Event(src);
  3315. // Event object
  3316. if (src && src.type) {
  3317. this.originalEvent = src;
  3318. this.type = src.type;
  3319. // Event type
  3320. } else
  3321. this.type = src;
  3322. // timeStamp is buggy for some events on Firefox(#3843)
  3323. // So we won't rely on the native value
  3324. this.timeStamp = now();
  3325. // Mark it as fixed
  3326. this[expando] = true;
  3327. };
  3328. function returnFalse() {
  3329. return false;
  3330. }
  3331. function returnTrue() {
  3332. return true;
  3333. }
  3334. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  3335. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  3336. jQuery.Event.prototype = {
  3337. preventDefault: function () {
  3338. this.isDefaultPrevented = returnTrue;
  3339. var e = this.originalEvent;
  3340. if (!e)
  3341. return;
  3342. // if preventDefault exists run it on the original event
  3343. if (e.preventDefault)
  3344. e.preventDefault();
  3345. // otherwise set the returnValue property of the original event to false (IE)
  3346. e.returnValue = false;
  3347. },
  3348. stopPropagation: function () {
  3349. this.isPropagationStopped = returnTrue;
  3350. var e = this.originalEvent;
  3351. if (!e)
  3352. return;
  3353. // if stopPropagation exists run it on the original event
  3354. if (e.stopPropagation)
  3355. e.stopPropagation();
  3356. // otherwise set the cancelBubble property of the original event to true (IE)
  3357. e.cancelBubble = true;
  3358. },
  3359. stopImmediatePropagation: function () {
  3360. this.isImmediatePropagationStopped = returnTrue;
  3361. this.stopPropagation();
  3362. },
  3363. isDefaultPrevented: returnFalse,
  3364. isPropagationStopped: returnFalse,
  3365. isImmediatePropagationStopped: returnFalse
  3366. };
  3367. // Checks if an event happened on an element within another element
  3368. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  3369. var withinElement = function (event) {
  3370. // Check if mouse(over|out) are still within the same parent element
  3371. var parent = event.relatedTarget;
  3372. // Traverse up the tree
  3373. while (parent && parent != this)
  3374. try { parent = parent.parentNode; }
  3375. catch (e) { parent = this; }
  3376. if (parent != this) {
  3377. // set the correct event type
  3378. event.type = event.data;
  3379. // handle event if we actually just moused on to a non sub-element
  3380. jQuery.event.handle.apply(this, arguments);
  3381. }
  3382. };
  3383. jQuery.each({
  3384. mouseover: 'mouseenter',
  3385. mouseout: 'mouseleave'
  3386. }, function (orig, fix) {
  3387. jQuery.event.special[fix] = {
  3388. setup: function () {
  3389. /// <summary>
  3390. /// This method is internal.
  3391. /// </summary>
  3392. /// <private />
  3393. jQuery.event.add(this, orig, withinElement, fix);
  3394. },
  3395. teardown: function () {
  3396. /// <summary>
  3397. /// This method is internal.
  3398. /// </summary>
  3399. /// <private />
  3400. jQuery.event.remove(this, orig, withinElement);
  3401. }
  3402. };
  3403. });
  3404. jQuery.fn.extend({
  3405. bind: function (type, data, fn) {
  3406. /// <summary>
  3407. /// Binds a handler to one or more events for each matched element. Can also bind custom events.
  3408. /// </summary>
  3409. /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
  3410. /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
  3411. /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
  3412. return type == "unload" ? this.one(type, data, fn) : this.each(function () {
  3413. jQuery.event.add(this, type, fn || data, fn && data);
  3414. });
  3415. },
  3416. one: function (type, data, fn) {
  3417. /// <summary>
  3418. /// Binds a handler to one or more events to be executed exactly once for each matched element.
  3419. /// </summary>
  3420. /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
  3421. /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
  3422. /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
  3423. var one = jQuery.event.proxy(fn || data, function (event) {
  3424. jQuery(this).unbind(event, one);
  3425. return (fn || data).apply(this, arguments);
  3426. });
  3427. return this.each(function () {
  3428. jQuery.event.add(this, type, one, fn && data);
  3429. });
  3430. },
  3431. unbind: function (type, fn) {
  3432. /// <summary>
  3433. /// Unbinds a handler from one or more events for each matched element.
  3434. /// </summary>
  3435. /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
  3436. /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
  3437. return this.each(function () {
  3438. jQuery.event.remove(this, type, fn);
  3439. });
  3440. },
  3441. trigger: function (type, data) {
  3442. /// <summary>
  3443. /// Triggers a type of event on every matched element.
  3444. /// </summary>
  3445. /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
  3446. /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
  3447. /// <param name="fn" type="Function">This parameter is undocumented.</param>
  3448. return this.each(function () {
  3449. jQuery.event.trigger(type, data, this);
  3450. });
  3451. },
  3452. triggerHandler: function (type, data) {
  3453. /// <summary>
  3454. /// Triggers all bound event handlers on an element for a specific event type without executing the browser's default actions.
  3455. /// </summary>
  3456. /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
  3457. /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
  3458. /// <param name="fn" type="Function">This parameter is undocumented.</param>
  3459. if (this[0]) {
  3460. var event = jQuery.Event(type);
  3461. event.preventDefault();
  3462. event.stopPropagation();
  3463. jQuery.event.trigger(event, data, this[0]);
  3464. return event.result;
  3465. }
  3466. },
  3467. toggle: function (fn) {
  3468. /// <summary>
  3469. /// Toggles among two or more function calls every other click.
  3470. /// </summary>
  3471. /// <param name="fn" type="Function">The functions among which to toggle execution</param>
  3472. // Save reference to arguments for access in closure
  3473. var args = arguments, i = 1;
  3474. // link all the functions, so any of them can unbind this click handler
  3475. while (i < args.length)
  3476. jQuery.event.proxy(fn, args[i++]);
  3477. return this.click(jQuery.event.proxy(fn, function (event) {
  3478. // Figure out which function to execute
  3479. this.lastToggle = (this.lastToggle || 0) % i;
  3480. // Make sure that clicks stop
  3481. event.preventDefault();
  3482. // and execute the function
  3483. return args[this.lastToggle++].apply(this, arguments) || false;
  3484. }));
  3485. },
  3486. hover: function (fnOver, fnOut) {
  3487. /// <summary>
  3488. /// Simulates hovering (moving the mouse on or off of an object).
  3489. /// </summary>
  3490. /// <param name="fnOver" type="Function">The function to fire when the mouse is moved over a matched element.</param>
  3491. /// <param name="fnOut" type="Function">The function to fire when the mouse is moved off of a matched element.</param>
  3492. return this.mouseenter(fnOver).mouseleave(fnOut);
  3493. },
  3494. ready: function (fn) {
  3495. /// <summary>
  3496. /// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.
  3497. /// </summary>
  3498. /// <param name="fn" type="Function">The function to be executed when the DOM is ready.</param>
  3499. // Attach the listeners
  3500. bindReady();
  3501. // If the DOM is already ready
  3502. if (jQuery.isReady)
  3503. // Execute the function immediately
  3504. fn.call(document, jQuery);
  3505. // Otherwise, remember the function for later
  3506. else
  3507. // Add the function to the wait list
  3508. jQuery.readyList.push(fn);
  3509. return this;
  3510. },
  3511. live: function (type, fn) {
  3512. /// <summary>
  3513. /// Binds a handler to an event (like click) for all current - and future - matched element. Can also bind custom events.
  3514. /// </summary>
  3515. /// <param name="type" type="String">An event type</param>
  3516. /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements</param>
  3517. var proxy = jQuery.event.proxy(fn);
  3518. proxy.guid += this.selector + type;
  3519. jQuery(document).bind(liveConvert(type, this.selector), this.selector, proxy);
  3520. return this;
  3521. },
  3522. die: function (type, fn) {
  3523. /// <summary>
  3524. /// This does the opposite of live, it removes a bound live event.
  3525. /// You can also unbind custom events registered with live.
  3526. /// If the type is provided, all bound live events of that type are removed.
  3527. /// If the function that was passed to live is provided as the second argument, only that specific event handler is removed.
  3528. /// </summary>
  3529. /// <param name="type" type="String">A live event type to unbind.</param>
  3530. /// <param name="fn" type="Function">A function to unbind from the event on each of the set of matched elements.</param>
  3531. jQuery(document).unbind(liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null);
  3532. return this;
  3533. }
  3534. });
  3535. function liveHandler(event) {
  3536. var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
  3537. stop = true,
  3538. elems = [];
  3539. jQuery.each(jQuery.data(this, "events").live || [], function (i, fn) {
  3540. if (check.test(fn.type)) {
  3541. var elem = jQuery(event.target).closest(fn.data)[0];
  3542. if (elem)
  3543. elems.push({ elem: elem, fn: fn });
  3544. }
  3545. });
  3546. elems.sort(function (a, b) {
  3547. return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
  3548. });
  3549. jQuery.each(elems, function () {
  3550. if (this.fn.call(this.elem, event, this.fn.data) === false)
  3551. return (stop = false);
  3552. });
  3553. return stop;
  3554. }
  3555. function liveConvert(type, selector) {
  3556. return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
  3557. }
  3558. jQuery.extend({
  3559. isReady: false,
  3560. readyList: [],
  3561. // Handle when the DOM is ready
  3562. ready: function () {
  3563. /// <summary>
  3564. /// This method is internal.
  3565. /// </summary>
  3566. /// <private />
  3567. // Make sure that the DOM is not already loaded
  3568. if (!jQuery.isReady) {
  3569. // Remember that the DOM is ready
  3570. jQuery.isReady = true;
  3571. // If there are functions bound, to execute
  3572. if (jQuery.readyList) {
  3573. // Execute all of them
  3574. jQuery.each(jQuery.readyList, function () {
  3575. this.call(document, jQuery);
  3576. });
  3577. // Reset the list of functions
  3578. jQuery.readyList = null;
  3579. }
  3580. // Trigger any bound ready events
  3581. jQuery(document).triggerHandler("ready");
  3582. }
  3583. }
  3584. });
  3585. var readyBound = false;
  3586. function bindReady() {
  3587. if (readyBound) return;
  3588. readyBound = true;
  3589. // Mozilla, Opera and webkit nightlies currently support this event
  3590. if (document.addEventListener) {
  3591. // Use the handy event callback
  3592. document.addEventListener("DOMContentLoaded", function () {
  3593. document.removeEventListener("DOMContentLoaded", arguments.callee, false);
  3594. jQuery.ready();
  3595. }, false);
  3596. // If IE event model is used
  3597. } else if (document.attachEvent) {
  3598. // ensure firing before onload,
  3599. // maybe late but safe also for iframes
  3600. document.attachEvent("onreadystatechange", function () {
  3601. if (document.readyState === "complete") {
  3602. document.detachEvent("onreadystatechange", arguments.callee);
  3603. jQuery.ready();
  3604. }
  3605. });
  3606. // If IE and not an iframe
  3607. // continually check to see if the document is ready
  3608. if (document.documentElement.doScroll && window == window.top) (function () {
  3609. if (jQuery.isReady) return;
  3610. try {
  3611. // If IE is used, use the trick by Diego Perini
  3612. // http://javascript.nwbox.com/IEContentLoaded/
  3613. document.documentElement.doScroll("left");
  3614. } catch (error) {
  3615. setTimeout(arguments.callee, 0);
  3616. return;
  3617. }
  3618. // and execute any waiting functions
  3619. jQuery.ready();
  3620. })();
  3621. }
  3622. // A fallback to window.onload, that will always work
  3623. jQuery.event.add(window, "load", jQuery.ready);
  3624. }
  3625. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  3626. jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick," +
  3627. "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
  3628. "change,select,submit,keydown,keypress,keyup,error").split(","), function (i, name) {
  3629. // Handle event binding
  3630. jQuery.fn[name] = function (fn) {
  3631. return fn ? this.bind(name, fn) : this.trigger(name);
  3632. };
  3633. });
  3634. jQuery.fn["blur"] = function (fn) {
  3635. /// <summary>
  3636. /// 1: blur() - Triggers the blur event of each matched element.
  3637. /// 2: blur(fn) - Binds a function to the blur event of each matched element.
  3638. /// </summary>
  3639. /// <param name="fn" type="Function">The function to execute.</param>
  3640. /// <returns type="jQuery" />
  3641. return fn ? this.bind("blur", fn) : this.trigger(name);
  3642. };
  3643. jQuery.fn["focus"] = function (fn) {
  3644. /// <summary>
  3645. /// 1: focus() - Triggers the focus event of each matched element.
  3646. /// 2: focus(fn) - Binds a function to the focus event of each matched element.
  3647. /// </summary>
  3648. /// <param name="fn" type="Function">The function to execute.</param>
  3649. /// <returns type="jQuery" />
  3650. return fn ? this.bind("focus", fn) : this.trigger(name);
  3651. };
  3652. jQuery.fn["load"] = function (fn) {
  3653. /// <summary>
  3654. /// 1: load() - Triggers the load event of each matched element.
  3655. /// 2: load(fn) - Binds a function to the load event of each matched element.
  3656. /// </summary>
  3657. /// <param name="fn" type="Function">The function to execute.</param>
  3658. /// <returns type="jQuery" />
  3659. return fn ? this.bind("load", fn) : this.trigger(name);
  3660. };
  3661. jQuery.fn["resize"] = function (fn) {
  3662. /// <summary>
  3663. /// 1: resize() - Triggers the resize event of each matched element.
  3664. /// 2: resize(fn) - Binds a function to the resize event of each matched element.
  3665. /// </summary>
  3666. /// <param name="fn" type="Function">The function to execute.</param>
  3667. /// <returns type="jQuery" />
  3668. return fn ? this.bind("resize", fn) : this.trigger(name);
  3669. };
  3670. jQuery.fn["scroll"] = function (fn) {
  3671. /// <summary>
  3672. /// 1: scroll() - Triggers the scroll event of each matched element.
  3673. /// 2: scroll(fn) - Binds a function to the scroll event of each matched element.
  3674. /// </summary>
  3675. /// <param name="fn" type="Function">The function to execute.</param>
  3676. /// <returns type="jQuery" />
  3677. return fn ? this.bind("scroll", fn) : this.trigger(name);
  3678. };
  3679. jQuery.fn["unload"] = function (fn) {
  3680. /// <summary>
  3681. /// 1: unload() - Triggers the unload event of each matched element.
  3682. /// 2: unload(fn) - Binds a function to the unload event of each matched element.
  3683. /// </summary>
  3684. /// <param name="fn" type="Function">The function to execute.</param>
  3685. /// <returns type="jQuery" />
  3686. return fn ? this.bind("unload", fn) : this.trigger(name);
  3687. };
  3688. jQuery.fn["click"] = function (fn) {
  3689. /// <summary>
  3690. /// 1: click() - Triggers the click event of each matched element.
  3691. /// 2: click(fn) - Binds a function to the click event of each matched element.
  3692. /// </summary>
  3693. /// <param name="fn" type="Function">The function to execute.</param>
  3694. /// <returns type="jQuery" />
  3695. return fn ? this.bind("click", fn) : this.trigger(name);
  3696. };
  3697. jQuery.fn["dblclick"] = function (fn) {
  3698. /// <summary>
  3699. /// 1: dblclick() - Triggers the dblclick event of each matched element.
  3700. /// 2: dblclick(fn) - Binds a function to the dblclick event of each matched element.
  3701. /// </summary>
  3702. /// <param name="fn" type="Function">The function to execute.</param>
  3703. /// <returns type="jQuery" />
  3704. return fn ? this.bind("dblclick", fn) : this.trigger(name);
  3705. };
  3706. jQuery.fn["mousedown"] = function (fn) {
  3707. /// <summary>
  3708. /// Binds a function to the mousedown event of each matched element.
  3709. /// </summary>
  3710. /// <param name="fn" type="Function">The function to execute.</param>
  3711. /// <returns type="jQuery" />
  3712. return fn ? this.bind("mousedown", fn) : this.trigger(name);
  3713. };
  3714. jQuery.fn["mouseup"] = function (fn) {
  3715. /// <summary>
  3716. /// Bind a function to the mouseup event of each matched element.
  3717. /// </summary>
  3718. /// <param name="fn" type="Function">The function to execute.</param>
  3719. /// <returns type="jQuery" />
  3720. return fn ? this.bind("mouseup", fn) : this.trigger(name);
  3721. };
  3722. jQuery.fn["mousemove"] = function (fn) {
  3723. /// <summary>
  3724. /// Bind a function to the mousemove event of each matched element.
  3725. /// </summary>
  3726. /// <param name="fn" type="Function">The function to execute.</param>
  3727. /// <returns type="jQuery" />
  3728. return fn ? this.bind("mousemove", fn) : this.trigger(name);
  3729. };
  3730. jQuery.fn["mouseover"] = function (fn) {
  3731. /// <summary>
  3732. /// Bind a function to the mouseover event of each matched element.
  3733. /// </summary>
  3734. /// <param name="fn" type="Function">The function to execute.</param>
  3735. /// <returns type="jQuery" />
  3736. return fn ? this.bind("mouseover", fn) : this.trigger(name);
  3737. };
  3738. jQuery.fn["mouseout"] = function (fn) {
  3739. /// <summary>
  3740. /// Bind a function to the mouseout event of each matched element.
  3741. /// </summary>
  3742. /// <param name="fn" type="Function">The function to execute.</param>
  3743. /// <returns type="jQuery" />
  3744. return fn ? this.bind("mouseout", fn) : this.trigger(name);
  3745. };
  3746. jQuery.fn["mouseenter"] = function (fn) {
  3747. /// <summary>
  3748. /// Bind a function to the mouseenter event of each matched element.
  3749. /// </summary>
  3750. /// <param name="fn" type="Function">The function to execute.</param>
  3751. /// <returns type="jQuery" />
  3752. return fn ? this.bind("mouseenter", fn) : this.trigger(name);
  3753. };
  3754. jQuery.fn["mouseleave"] = function (fn) {
  3755. /// <summary>
  3756. /// Bind a function to the mouseleave event of each matched element.
  3757. /// </summary>
  3758. /// <param name="fn" type="Function">The function to execute.</param>
  3759. /// <returns type="jQuery" />
  3760. return fn ? this.bind("mouseleave", fn) : this.trigger(name);
  3761. };
  3762. jQuery.fn["change"] = function (fn) {
  3763. /// <summary>
  3764. /// 1: change() - Triggers the change event of each matched element.
  3765. /// 2: change(fn) - Binds a function to the change event of each matched element.
  3766. /// </summary>
  3767. /// <param name="fn" type="Function">The function to execute.</param>
  3768. /// <returns type="jQuery" />
  3769. return fn ? this.bind("change", fn) : this.trigger(name);
  3770. };
  3771. jQuery.fn["select"] = function (fn) {
  3772. /// <summary>
  3773. /// 1: select() - Triggers the select event of each matched element.
  3774. /// 2: select(fn) - Binds a function to the select event of each matched element.
  3775. /// </summary>
  3776. /// <param name="fn" type="Function">The function to execute.</param>
  3777. /// <returns type="jQuery" />
  3778. return fn ? this.bind("select", fn) : this.trigger(name);
  3779. };
  3780. jQuery.fn["submit"] = function (fn) {
  3781. /// <summary>
  3782. /// 1: submit() - Triggers the submit event of each matched element.
  3783. /// 2: submit(fn) - Binds a function to the submit event of each matched element.
  3784. /// </summary>
  3785. /// <param name="fn" type="Function">The function to execute.</param>
  3786. /// <returns type="jQuery" />
  3787. return fn ? this.bind("submit", fn) : this.trigger(name);
  3788. };
  3789. jQuery.fn["keydown"] = function (fn) {
  3790. /// <summary>
  3791. /// 1: keydown() - Triggers the keydown event of each matched element.
  3792. /// 2: keydown(fn) - Binds a function to the keydown event of each matched element.
  3793. /// </summary>
  3794. /// <param name="fn" type="Function">The function to execute.</param>
  3795. /// <returns type="jQuery" />
  3796. return fn ? this.bind("keydown", fn) : this.trigger(name);
  3797. };
  3798. jQuery.fn["keypress"] = function (fn) {
  3799. /// <summary>
  3800. /// 1: keypress() - Triggers the keypress event of each matched element.
  3801. /// 2: keypress(fn) - Binds a function to the keypress event of each matched element.
  3802. /// </summary>
  3803. /// <param name="fn" type="Function">The function to execute.</param>
  3804. /// <returns type="jQuery" />
  3805. return fn ? this.bind("keypress", fn) : this.trigger(name);
  3806. };
  3807. jQuery.fn["keyup"] = function (fn) {
  3808. /// <summary>
  3809. /// 1: keyup() - Triggers the keyup event of each matched element.
  3810. /// 2: keyup(fn) - Binds a function to the keyup event of each matched element.
  3811. /// </summary>
  3812. /// <param name="fn" type="Function">The function to execute.</param>
  3813. /// <returns type="jQuery" />
  3814. return fn ? this.bind("keyup", fn) : this.trigger(name);
  3815. };
  3816. jQuery.fn["error"] = function (fn) {
  3817. /// <summary>
  3818. /// 1: error() - Triggers the error event of each matched element.
  3819. /// 2: error(fn) - Binds a function to the error event of each matched element.
  3820. /// </summary>
  3821. /// <param name="fn" type="Function">The function to execute.</param>
  3822. /// <returns type="jQuery" />
  3823. return fn ? this.bind("error", fn) : this.trigger(name);
  3824. };
  3825. // Prevent memory leaks in IE
  3826. // And prevent errors on refresh with events like mouseover in other browsers
  3827. // Window isn't included so as not to unbind existing unload events
  3828. jQuery(window).bind('unload', function () {
  3829. for (var id in jQuery.cache)
  3830. // Skip the window
  3831. if (id != 1 && jQuery.cache[id].handle)
  3832. jQuery.event.remove(jQuery.cache[id].handle.elem);
  3833. });
  3834. // [vsdoc] The following function has been modified for IntelliSense.
  3835. // [vsdoc] Stubbing support properties to "false" since we simulate IE.
  3836. (function () {
  3837. jQuery.support = {};
  3838. jQuery.support = {
  3839. // IE strips leading whitespace when .innerHTML is used
  3840. leadingWhitespace: false,
  3841. // Make sure that tbody elements aren't automatically inserted
  3842. // IE will insert them into empty tables
  3843. tbody: false,
  3844. // Make sure that you can get all elements in an <object> element
  3845. // IE 7 always returns no results
  3846. objectAll: false,
  3847. // Make sure that link elements get serialized correctly by innerHTML
  3848. // This requires a wrapper element in IE
  3849. htmlSerialize: false,
  3850. // Get the style information from getAttribute
  3851. // (IE uses .cssText insted)
  3852. style: false,
  3853. // Make sure that URLs aren't manipulated
  3854. // (IE normalizes it by default)
  3855. hrefNormalized: false,
  3856. // Make sure that element opacity exists
  3857. // (IE uses filter instead)
  3858. opacity: false,
  3859. // Verify style float existence
  3860. // (IE uses styleFloat instead of cssFloat)
  3861. cssFloat: false,
  3862. // Will be defined later
  3863. scriptEval: false,
  3864. noCloneEvent: false,
  3865. boxModel: false
  3866. };
  3867. })();
  3868. // [vsdoc] The following member has been modified for IntelliSense.
  3869. var styleFloat = "styleFloat";
  3870. jQuery.props = {
  3871. "for": "htmlFor",
  3872. "class": "className",
  3873. "float": styleFloat,
  3874. cssFloat: styleFloat,
  3875. styleFloat: styleFloat,
  3876. readonly: "readOnly",
  3877. maxlength: "maxLength",
  3878. cellspacing: "cellSpacing",
  3879. rowspan: "rowSpan",
  3880. tabindex: "tabIndex"
  3881. };
  3882. jQuery.fn.extend({
  3883. // Keep a copy of the old load
  3884. _load: jQuery.fn.load,
  3885. load: function (url, params, callback) {
  3886. /// <summary>
  3887. /// Loads HTML from a remote file and injects it into the DOM. By default performs a GET request, but if parameters are included
  3888. /// then a POST will be performed.
  3889. /// </summary>
  3890. /// <param name="url" type="String">The URL of the HTML page to load.</param>
  3891. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  3892. /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus, XMLHttpRequest) such that this maps the injected DOM element.</param>
  3893. /// <returns type="jQuery" />
  3894. if (typeof url !== "string")
  3895. return this._load(url);
  3896. var off = url.indexOf(" ");
  3897. if (off >= 0) {
  3898. var selector = url.slice(off, url.length);
  3899. url = url.slice(0, off);
  3900. }
  3901. // Default to a GET request
  3902. var type = "GET";
  3903. // If the second parameter was provided
  3904. if (params)
  3905. // If it's a function
  3906. if (jQuery.isFunction(params)) {
  3907. // We assume that it's the callback
  3908. callback = params;
  3909. params = null;
  3910. // Otherwise, build a param string
  3911. } else if (typeof params === "object") {
  3912. params = jQuery.param(params);
  3913. type = "POST";
  3914. }
  3915. var self = this;
  3916. // Request the remote document
  3917. jQuery.ajax({
  3918. url: url,
  3919. type: type,
  3920. dataType: "html",
  3921. data: params,
  3922. complete: function (res, status) {
  3923. // If successful, inject the HTML into all the matched elements
  3924. if (status == "success" || status == "notmodified")
  3925. // See if a selector was specified
  3926. self.html(selector ?
  3927. // Create a dummy div to hold the results
  3928. jQuery("<div/>")
  3929. // inject the contents of the document in, removing the scripts
  3930. // to avoid any 'Permission Denied' errors in IE
  3931. .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
  3932. // Locate the specified elements
  3933. .find(selector) :
  3934. // If not, just inject the full result
  3935. res.responseText);
  3936. if (callback)
  3937. self.each(callback, [res.responseText, status, res]);
  3938. }
  3939. });
  3940. return this;
  3941. },
  3942. serialize: function () {
  3943. /// <summary>
  3944. /// Serializes a set of input elements into a string of data.
  3945. /// </summary>
  3946. /// <returns type="String">The serialized result</returns>
  3947. return jQuery.param(this.serializeArray());
  3948. },
  3949. serializeArray: function () {
  3950. /// <summary>
  3951. /// Serializes all forms and form elements but returns a JSON data structure.
  3952. /// </summary>
  3953. /// <returns type="String">A JSON data structure representing the serialized items.</returns>
  3954. return this.map(function () {
  3955. return this.elements ? jQuery.makeArray(this.elements) : this;
  3956. })
  3957. .filter(function () {
  3958. return this.name && !this.disabled &&
  3959. (this.checked || /select|textarea/i.test(this.nodeName) ||
  3960. /text|hidden|password|search/i.test(this.type));
  3961. })
  3962. .map(function (i, elem) {
  3963. var val = jQuery(this).val();
  3964. return val == null ? null :
  3965. jQuery.isArray(val) ?
  3966. jQuery.map(val, function (val, i) {
  3967. return { name: elem.name, value: val };
  3968. }) :
  3969. { name: elem.name, value: val };
  3970. }).get();
  3971. }
  3972. });
  3973. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  3974. // Attach a bunch of functions for handling common AJAX events
  3975. // jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
  3976. // jQuery.fn[o] = function(f){
  3977. // return this.bind(o, f);
  3978. // };
  3979. // });
  3980. jQuery.fn["ajaxStart"] = function (callback) {
  3981. /// <summary>
  3982. /// Attach a function to be executed whenever an AJAX request begins and there is none already active. This is an Ajax Event.
  3983. /// </summary>
  3984. /// <param name="callback" type="Function">The function to execute.</param>
  3985. /// <returns type="jQuery" />
  3986. return this.bind("ajaxStart", f);
  3987. };
  3988. jQuery.fn["ajaxStop"] = function (callback) {
  3989. /// <summary>
  3990. /// Attach a function to be executed whenever all AJAX requests have ended. This is an Ajax Event.
  3991. /// </summary>
  3992. /// <param name="callback" type="Function">The function to execute.</param>
  3993. /// <returns type="jQuery" />
  3994. return this.bind("ajaxStop", f);
  3995. };
  3996. jQuery.fn["ajaxComplete"] = function (callback) {
  3997. /// <summary>
  3998. /// Attach a function to be executed whenever an AJAX request completes. This is an Ajax Event.
  3999. /// </summary>
  4000. /// <param name="callback" type="Function">The function to execute.</param>
  4001. /// <returns type="jQuery" />
  4002. return this.bind("ajaxComplete", f);
  4003. };
  4004. jQuery.fn["ajaxError"] = function (callback) {
  4005. /// <summary>
  4006. /// Attach a function to be executed whenever an AJAX request fails. This is an Ajax Event.
  4007. /// </summary>
  4008. /// <param name="callback" type="Function">The function to execute.</param>
  4009. /// <returns type="jQuery" />
  4010. return this.bind("ajaxError", f);
  4011. };
  4012. jQuery.fn["ajaxSuccess"] = function (callback) {
  4013. /// <summary>
  4014. /// Attach a function to be executed whenever an AJAX request completes successfully. This is an Ajax Event.
  4015. /// </summary>
  4016. /// <param name="callback" type="Function">The function to execute.</param>
  4017. /// <returns type="jQuery" />
  4018. return this.bind("ajaxSuccess", f);
  4019. };
  4020. jQuery.fn["ajaxSend"] = function (callback) {
  4021. /// <summary>
  4022. /// Attach a function to be executed before an AJAX request is sent. This is an Ajax Event.
  4023. /// </summary>
  4024. /// <param name="callback" type="Function">The function to execute.</param>
  4025. /// <returns type="jQuery" />
  4026. return this.bind("ajaxSend", f);
  4027. };
  4028. var jsc = now();
  4029. jQuery.extend({
  4030. get: function (url, data, callback, type) {
  4031. /// <summary>
  4032. /// Loads a remote page using an HTTP GET request.
  4033. /// </summary>
  4034. /// <param name="url" type="String">The URL of the HTML page to load.</param>
  4035. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  4036. /// <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>
  4037. /// <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>
  4038. /// <returns type="XMLHttpRequest" />
  4039. // shift arguments if data argument was ommited
  4040. if (jQuery.isFunction(data)) {
  4041. callback = data;
  4042. data = null;
  4043. }
  4044. return jQuery.ajax({
  4045. type: "GET",
  4046. url: url,
  4047. data: data,
  4048. success: callback,
  4049. dataType: type
  4050. });
  4051. },
  4052. getScript: function (url, callback) {
  4053. /// <summary>
  4054. /// Loads and executes a local JavaScript file using an HTTP GET request.
  4055. /// </summary>
  4056. /// <param name="url" type="String">The URL of the script to load.</param>
  4057. /// <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>
  4058. /// <returns type="XMLHttpRequest" />
  4059. return jQuery.get(url, null, callback, "script");
  4060. },
  4061. getJSON: function (url, data, callback) {
  4062. /// <summary>
  4063. /// Loads JSON data using an HTTP GET request.
  4064. /// </summary>
  4065. /// <param name="url" type="String">The URL of the JSON data to load.</param>
  4066. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  4067. /// <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>
  4068. /// <returns type="XMLHttpRequest" />
  4069. return jQuery.get(url, data, callback, "json");
  4070. },
  4071. post: function (url, data, callback, type) {
  4072. /// <summary>
  4073. /// Loads a remote page using an HTTP POST request.
  4074. /// </summary>
  4075. /// <param name="url" type="String">The URL of the HTML page to load.</param>
  4076. /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
  4077. /// <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>
  4078. /// <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>
  4079. /// <returns type="XMLHttpRequest" />
  4080. if (jQuery.isFunction(data)) {
  4081. callback = data;
  4082. data = {};
  4083. }
  4084. return jQuery.ajax({
  4085. type: "POST",
  4086. url: url,
  4087. data: data,
  4088. success: callback,
  4089. dataType: type
  4090. });
  4091. },
  4092. ajaxSetup: function (settings) {
  4093. /// <summary>
  4094. /// Sets up global settings for AJAX requests.
  4095. /// </summary>
  4096. /// <param name="settings" type="Options">A set of key/value pairs that configure the default Ajax request.</param>
  4097. jQuery.extend(jQuery.ajaxSettings, settings);
  4098. },
  4099. ajaxSettings: {
  4100. url: location.href,
  4101. global: true,
  4102. type: "GET",
  4103. contentType: "application/x-www-form-urlencoded",
  4104. processData: true,
  4105. async: true,
  4106. /*
  4107. timeout: 0,
  4108. data: null,
  4109. username: null,
  4110. password: null,
  4111. */
  4112. // Create the request object; Microsoft failed to properly
  4113. // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
  4114. // This function can be overriden by calling jQuery.ajaxSetup
  4115. xhr: function () {
  4116. return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  4117. },
  4118. accepts: {
  4119. xml: "application/xml, text/xml",
  4120. html: "text/html",
  4121. script: "text/javascript, application/javascript",
  4122. json: "application/json, text/javascript",
  4123. text: "text/plain",
  4124. _default: "*/*"
  4125. }
  4126. },
  4127. // Last-Modified header cache for next request
  4128. lastModified: {},
  4129. ajax: function (s) {
  4130. /// <summary>
  4131. /// Load a remote page using an HTTP request.
  4132. /// </summary>
  4133. /// <private />
  4134. // Extend the settings, but re-extend 's' so that it can be
  4135. // checked again later (in the test suite, specifically)
  4136. s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
  4137. var jsonp, jsre = /=\?(&|$)/g, status, data,
  4138. type = s.type.toUpperCase();
  4139. // convert data if not already a string
  4140. if (s.data && s.processData && typeof s.data !== "string")
  4141. s.data = jQuery.param(s.data);
  4142. // Handle JSONP Parameter Callbacks
  4143. if (s.dataType == "jsonp") {
  4144. if (type == "GET") {
  4145. if (!s.url.match(jsre))
  4146. s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  4147. } else if (!s.data || !s.data.match(jsre))
  4148. s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  4149. s.dataType = "json";
  4150. }
  4151. // Build temporary JSONP function
  4152. if (s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre))) {
  4153. jsonp = "jsonp" + jsc++;
  4154. // Replace the =? sequence both in the query string and the data
  4155. if (s.data)
  4156. s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  4157. s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  4158. // We need to make sure
  4159. // that a JSONP style response is executed properly
  4160. s.dataType = "script";
  4161. // Handle JSONP-style loading
  4162. window[jsonp] = function (tmp) {
  4163. data = tmp;
  4164. success();
  4165. complete();
  4166. // Garbage collect
  4167. window[jsonp] = undefined;
  4168. try { delete window[jsonp]; } catch (e) { }
  4169. if (head)
  4170. head.removeChild(script);
  4171. };
  4172. }
  4173. if (s.dataType == "script" && s.cache == null)
  4174. s.cache = false;
  4175. if (s.cache === false && type == "GET") {
  4176. var ts = now();
  4177. // try replacing _= if it is there
  4178. var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
  4179. // if nothing was replaced, add timestamp to the end
  4180. s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
  4181. }
  4182. // If data is available, append data to url for get requests
  4183. if (s.data && type == "GET") {
  4184. s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
  4185. // IE likes to send both get and post data, prevent this
  4186. s.data = null;
  4187. }
  4188. // Watch for a new set of requests
  4189. if (s.global && !jQuery.active++)
  4190. jQuery.event.trigger("ajaxStart");
  4191. // Matches an absolute URL, and saves the domain
  4192. var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);
  4193. // If we're requesting a remote document
  4194. // and trying to load JSON or Script with a GET
  4195. if (s.dataType == "script" && type == "GET" && parts
  4196. && (parts[1] && parts[1] != location.protocol || parts[2] != location.host)) {
  4197. var head = document.getElementsByTagName("head")[0];
  4198. var script = document.createElement("script");
  4199. script.src = s.url;
  4200. if (s.scriptCharset)
  4201. script.charset = s.scriptCharset;
  4202. // Handle Script loading
  4203. if (!jsonp) {
  4204. var done = false;
  4205. // Attach handlers for all browsers
  4206. script.onload = script.onreadystatechange = function () {
  4207. if (!done && (!this.readyState ||
  4208. this.readyState == "loaded" || this.readyState == "complete")) {
  4209. done = true;
  4210. success();
  4211. complete();
  4212. // Handle memory leak in IE
  4213. script.onload = script.onreadystatechange = null;
  4214. head.removeChild(script);
  4215. }
  4216. };
  4217. }
  4218. head.appendChild(script);
  4219. // We handle everything using the script element injection
  4220. return undefined;
  4221. }
  4222. var requestDone = false;
  4223. // Create the request object
  4224. var xhr = s.xhr();
  4225. // Open the socket
  4226. // Passing null username, generates a login popup on Opera (#2865)
  4227. if (s.username)
  4228. xhr.open(type, s.url, s.async, s.username, s.password);
  4229. else
  4230. xhr.open(type, s.url, s.async);
  4231. // Need an extra try/catch for cross domain requests in Firefox 3
  4232. try {
  4233. // Set the correct header, if data is being sent
  4234. if (s.data)
  4235. xhr.setRequestHeader("Content-Type", s.contentType);
  4236. // Set the If-Modified-Since header, if ifModified mode.
  4237. if (s.ifModified)
  4238. xhr.setRequestHeader("If-Modified-Since",
  4239. jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT");
  4240. // Set header so the called script knows that it's an XMLHttpRequest
  4241. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  4242. // Set the Accepts header for the server, depending on the dataType
  4243. xhr.setRequestHeader("Accept", s.dataType && s.accepts[s.dataType] ?
  4244. s.accepts[s.dataType] + ", */*" :
  4245. s.accepts._default);
  4246. } catch (e) { }
  4247. // Allow custom headers/mimetypes and early abort
  4248. if (s.beforeSend && s.beforeSend(xhr, s) === false) {
  4249. // Handle the global AJAX counter
  4250. if (s.global && ! --jQuery.active)
  4251. jQuery.event.trigger("ajaxStop");
  4252. // close opended socket
  4253. xhr.abort();
  4254. return false;
  4255. }
  4256. if (s.global)
  4257. jQuery.event.trigger("ajaxSend", [xhr, s]);
  4258. // Wait for a response to come back
  4259. var onreadystatechange = function (isTimeout) {
  4260. // The request was aborted, clear the interval and decrement jQuery.active
  4261. if (xhr.readyState == 0) {
  4262. if (ival) {
  4263. // clear poll interval
  4264. clearInterval(ival);
  4265. ival = null;
  4266. // Handle the global AJAX counter
  4267. if (s.global && ! --jQuery.active)
  4268. jQuery.event.trigger("ajaxStop");
  4269. }
  4270. // The transfer is complete and the data is available, or the request timed out
  4271. } else if (!requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout")) {
  4272. requestDone = true;
  4273. // clear poll interval
  4274. if (ival) {
  4275. clearInterval(ival);
  4276. ival = null;
  4277. }
  4278. status = isTimeout == "timeout" ? "timeout" :
  4279. !jQuery.httpSuccess(xhr) ? "error" :
  4280. s.ifModified && jQuery.httpNotModified(xhr, s.url) ? "notmodified" :
  4281. "success";
  4282. if (status == "success") {
  4283. // Watch for, and catch, XML document parse errors
  4284. try {
  4285. // process the data (runs the xml through httpData regardless of callback)
  4286. data = jQuery.httpData(xhr, s.dataType, s);
  4287. } catch (e) {
  4288. status = "parsererror";
  4289. }
  4290. }
  4291. // Make sure that the request was successful or notmodified
  4292. if (status == "success") {
  4293. // Cache Last-Modified header, if ifModified mode.
  4294. var modRes;
  4295. try {
  4296. modRes = xhr.getResponseHeader("Last-Modified");
  4297. } catch (e) { } // swallow exception thrown by FF if header is not available
  4298. if (s.ifModified && modRes)
  4299. jQuery.lastModified[s.url] = modRes;
  4300. // JSONP handles its own success callback
  4301. if (!jsonp)
  4302. success();
  4303. } else
  4304. jQuery.handleError(s, xhr, status);
  4305. // Fire the complete handlers
  4306. complete();
  4307. if (isTimeout)
  4308. xhr.abort();
  4309. // Stop memory leaks
  4310. if (s.async)
  4311. xhr = null;
  4312. }
  4313. };
  4314. if (s.async) {
  4315. // don't attach the handler to the request, just poll it instead
  4316. var ival = setInterval(onreadystatechange, 13);
  4317. // Timeout checker
  4318. if (s.timeout > 0)
  4319. setTimeout(function () {
  4320. // Check to see if the request is still happening
  4321. if (xhr && !requestDone)
  4322. onreadystatechange("timeout");
  4323. }, s.timeout);
  4324. }
  4325. // Send the data
  4326. try {
  4327. xhr.send(s.data);
  4328. } catch (e) {
  4329. jQuery.handleError(s, xhr, null, e);
  4330. }
  4331. // firefox 1.5 doesn't fire statechange for sync requests
  4332. if (!s.async)
  4333. onreadystatechange();
  4334. function success() {
  4335. // If a local callback was specified, fire it and pass it the data
  4336. if (s.success)
  4337. s.success(data, status);
  4338. // Fire the global callback
  4339. if (s.global)
  4340. jQuery.event.trigger("ajaxSuccess", [xhr, s]);
  4341. }
  4342. function complete() {
  4343. // Process result
  4344. if (s.complete)
  4345. s.complete(xhr, status);
  4346. // The request was completed
  4347. if (s.global)
  4348. jQuery.event.trigger("ajaxComplete", [xhr, s]);
  4349. // Handle the global AJAX counter
  4350. if (s.global && ! --jQuery.active)
  4351. jQuery.event.trigger("ajaxStop");
  4352. }
  4353. // return XMLHttpRequest to allow aborting the request etc.
  4354. return xhr;
  4355. },
  4356. handleError: function (s, xhr, status, e) {
  4357. /// <summary>
  4358. /// This method is internal.
  4359. /// </summary>
  4360. /// <private />
  4361. // If a local callback was specified, fire it
  4362. if (s.error) s.error(xhr, status, e);
  4363. // Fire the global callback
  4364. if (s.global)
  4365. jQuery.event.trigger("ajaxError", [xhr, s, e]);
  4366. },
  4367. // Counter for holding the number of active queries
  4368. active: 0,
  4369. // Determines if an XMLHttpRequest was successful or not
  4370. httpSuccess: function (xhr) {
  4371. /// <summary>
  4372. /// This method is internal.
  4373. /// </summary>
  4374. /// <private />
  4375. try {
  4376. // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  4377. return !xhr.status && location.protocol == "file:" ||
  4378. (xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || xhr.status == 1223;
  4379. } catch (e) { }
  4380. return false;
  4381. },
  4382. // Determines if an XMLHttpRequest returns NotModified
  4383. httpNotModified: function (xhr, url) {
  4384. /// <summary>
  4385. /// This method is internal.
  4386. /// </summary>
  4387. /// <private />
  4388. try {
  4389. var xhrRes = xhr.getResponseHeader("Last-Modified");
  4390. // Firefox always returns 200. check Last-Modified date
  4391. return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
  4392. } catch (e) { }
  4393. return false;
  4394. },
  4395. httpData: function (xhr, type, s) {
  4396. /// <summary>
  4397. /// This method is internal.
  4398. /// </summary>
  4399. /// <private />
  4400. var ct = xhr.getResponseHeader("content-type"),
  4401. xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
  4402. data = xml ? xhr.responseXML : xhr.responseText;
  4403. if (xml && data.documentElement.tagName == "parsererror")
  4404. throw "parsererror";
  4405. // Allow a pre-filtering function to sanitize the response
  4406. // s != null is checked to keep backwards compatibility
  4407. if (s && s.dataFilter)
  4408. data = s.dataFilter(data, type);
  4409. // The filter can actually parse the response
  4410. if (typeof data === "string") {
  4411. // If the type is "script", eval it in global context
  4412. if (type == "script")
  4413. jQuery.globalEval(data);
  4414. // Get the JavaScript object, if JSON is used.
  4415. if (type == "json")
  4416. data = window["eval"]("(" + data + ")");
  4417. }
  4418. return data;
  4419. },
  4420. // Serialize an array of form elements or a set of
  4421. // key/values into a query string
  4422. param: function (a) {
  4423. /// <summary>
  4424. /// This method is internal. Use serialize() instead.
  4425. /// </summary>
  4426. /// <param name="a" type="Map">A map of key/value pairs to serialize into a string.</param>'
  4427. /// <returns type="String" />
  4428. /// <private />
  4429. var s = [];
  4430. function add(key, value) {
  4431. s[s.length] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
  4432. };
  4433. // If an array was passed in, assume that it is an array
  4434. // of form elements
  4435. if (jQuery.isArray(a) || a.jquery)
  4436. // Serialize the form elements
  4437. jQuery.each(a, function () {
  4438. add(this.name, this.value);
  4439. });
  4440. // Otherwise, assume that it's an object of key/value pairs
  4441. else
  4442. // Serialize the key/values
  4443. for (var j in a)
  4444. // If the value is an array then the key names need to be repeated
  4445. if (jQuery.isArray(a[j]))
  4446. jQuery.each(a[j], function () {
  4447. add(j, this);
  4448. });
  4449. else
  4450. add(j, jQuery.isFunction(a[j]) ? a[j]() : a[j]);
  4451. // Return the resulting serialization
  4452. return s.join("&").replace(/%20/g, "+");
  4453. }
  4454. });
  4455. var elemdisplay = {},
  4456. timerId,
  4457. fxAttrs = [
  4458. // height animations
  4459. ["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"],
  4460. // width animations
  4461. ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"],
  4462. // opacity animations
  4463. ["opacity"]
  4464. ];
  4465. function genFx(type, num) {
  4466. var obj = {};
  4467. jQuery.each(fxAttrs.concat.apply([], fxAttrs.slice(0, num)), function () {
  4468. obj[this] = type;
  4469. });
  4470. return obj;
  4471. }
  4472. jQuery.fn.extend({
  4473. show: function (speed, callback) {
  4474. /// <summary>
  4475. /// Show all matched elements using a graceful animation and firing an optional callback after completion.
  4476. /// </summary>
  4477. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4478. /// the number of milliseconds to run the animation</param>
  4479. /// <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>
  4480. /// <returns type="jQuery" />
  4481. if (speed) {
  4482. return this.animate(genFx("show", 3), speed, callback);
  4483. } else {
  4484. for (var i = 0, l = this.length; i < l; i++) {
  4485. var old = jQuery.data(this[i], "olddisplay");
  4486. this[i].style.display = old || "";
  4487. if (jQuery.css(this[i], "display") === "none") {
  4488. var tagName = this[i].tagName, display;
  4489. if (elemdisplay[tagName]) {
  4490. display = elemdisplay[tagName];
  4491. } else {
  4492. var elem = jQuery("<" + tagName + " />").appendTo("body");
  4493. display = elem.css("display");
  4494. if (display === "none")
  4495. display = "block";
  4496. elem.remove();
  4497. elemdisplay[tagName] = display;
  4498. }
  4499. jQuery.data(this[i], "olddisplay", display);
  4500. }
  4501. }
  4502. // Set the display of the elements in a second loop
  4503. // to avoid the constant reflow
  4504. for (var i = 0, l = this.length; i < l; i++) {
  4505. this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
  4506. }
  4507. return this;
  4508. }
  4509. },
  4510. hide: function (speed, callback) {
  4511. /// <summary>
  4512. /// Hides all matched elements using a graceful animation and firing an optional callback after completion.
  4513. /// </summary>
  4514. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4515. /// the number of milliseconds to run the animation</param>
  4516. /// <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>
  4517. /// <returns type="jQuery" />
  4518. if (speed) {
  4519. return this.animate(genFx("hide", 3), speed, callback);
  4520. } else {
  4521. for (var i = 0, l = this.length; i < l; i++) {
  4522. var old = jQuery.data(this[i], "olddisplay");
  4523. if (!old && old !== "none")
  4524. jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
  4525. }
  4526. // Set the display of the elements in a second loop
  4527. // to avoid the constant reflow
  4528. for (var i = 0, l = this.length; i < l; i++) {
  4529. this[i].style.display = "none";
  4530. }
  4531. return this;
  4532. }
  4533. },
  4534. // Save the old toggle function
  4535. _toggle: jQuery.fn.toggle,
  4536. toggle: function (fn, fn2) {
  4537. /// <summary>
  4538. /// Toggles displaying each of the set of matched elements.
  4539. /// </summary>
  4540. /// <returns type="jQuery" />
  4541. var bool = typeof fn === "boolean";
  4542. return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
  4543. this._toggle.apply(this, arguments) :
  4544. fn == null || bool ?
  4545. this.each(function () {
  4546. var state = bool ? fn : jQuery(this).is(":hidden");
  4547. jQuery(this)[state ? "show" : "hide"]();
  4548. }) :
  4549. this.animate(genFx("toggle", 3), fn, fn2);
  4550. },
  4551. fadeTo: function (speed, to, callback) {
  4552. /// <summary>
  4553. /// Fades the opacity of all matched elements to a specified opacity.
  4554. /// </summary>
  4555. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4556. /// the number of milliseconds to run the animation</param>
  4557. /// <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>
  4558. /// <returns type="jQuery" />
  4559. return this.animate({ opacity: to }, speed, callback);
  4560. },
  4561. animate: function (prop, speed, easing, callback) {
  4562. /// <summary>
  4563. /// A function for making custom animations.
  4564. /// </summary>
  4565. /// <param name="prop" type="Options">A set of style attributes that you wish to animate and to what end.</param>
  4566. /// <param name="speed" optional="true" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4567. /// the number of milliseconds to run the animation</param>
  4568. /// <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>
  4569. /// <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>
  4570. /// <returns type="jQuery" />
  4571. var optall = jQuery.speed(speed, easing, callback);
  4572. return this[optall.queue === false ? "each" : "queue"](function () {
  4573. var opt = jQuery.extend({}, optall), p,
  4574. hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
  4575. self = this;
  4576. for (p in prop) {
  4577. if (prop[p] == "hide" && hidden || prop[p] == "show" && !hidden)
  4578. return opt.complete.call(this);
  4579. if ((p == "height" || p == "width") && this.style) {
  4580. // Store display property
  4581. opt.display = jQuery.css(this, "display");
  4582. // Make sure that nothing sneaks out
  4583. opt.overflow = this.style.overflow;
  4584. }
  4585. }
  4586. if (opt.overflow != null)
  4587. this.style.overflow = "hidden";
  4588. opt.curAnim = jQuery.extend({}, prop);
  4589. jQuery.each(prop, function (name, val) {
  4590. var e = new jQuery.fx(self, opt, name);
  4591. if (/toggle|show|hide/.test(val))
  4592. e[val == "toggle" ? hidden ? "show" : "hide" : val](prop);
  4593. else {
  4594. var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
  4595. start = e.cur(true) || 0;
  4596. if (parts) {
  4597. var end = parseFloat(parts[2]),
  4598. unit = parts[3] || "px";
  4599. // We need to compute starting value
  4600. if (unit != "px") {
  4601. self.style[name] = (end || 1) + unit;
  4602. start = ((end || 1) / e.cur(true)) * start;
  4603. self.style[name] = start + unit;
  4604. }
  4605. // If a +=/-= token was provided, we're doing a relative animation
  4606. if (parts[1])
  4607. end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
  4608. e.custom(start, end, unit);
  4609. } else
  4610. e.custom(start, val, "");
  4611. }
  4612. });
  4613. // For JS strict compliance
  4614. return true;
  4615. });
  4616. },
  4617. stop: function (clearQueue, gotoEnd) {
  4618. /// <summary>
  4619. /// Stops all currently animations on the specified elements.
  4620. /// </summary>
  4621. /// <param name="clearQueue" optional="true" type="Boolean">True to clear animations that are queued to run.</param>
  4622. /// <param name="gotoEnd" optional="true" type="Boolean">True to move the element value to the end of its animation target.</param>
  4623. /// <returns type="jQuery" />
  4624. var timers = jQuery.timers;
  4625. if (clearQueue)
  4626. this.queue([]);
  4627. this.each(function () {
  4628. // go in reverse order so anything added to the queue during the loop is ignored
  4629. for (var i = timers.length - 1; i >= 0; i--)
  4630. if (timers[i].elem == this) {
  4631. if (gotoEnd)
  4632. // force the next step to be the last
  4633. timers[i](true);
  4634. timers.splice(i, 1);
  4635. }
  4636. });
  4637. // start the next in the queue if the last step wasn't forced
  4638. if (!gotoEnd)
  4639. this.dequeue();
  4640. return this;
  4641. }
  4642. });
  4643. // Generate shortcuts for custom animations
  4644. // jQuery.each({
  4645. // slideDown: genFx("show", 1),
  4646. // slideUp: genFx("hide", 1),
  4647. // slideToggle: genFx("toggle", 1),
  4648. // fadeIn: { opacity: "show" },
  4649. // fadeOut: { opacity: "hide" }
  4650. // }, function( name, props ){
  4651. // jQuery.fn[ name ] = function( speed, callback ){
  4652. // return this.animate( props, speed, callback );
  4653. // };
  4654. // });
  4655. // [vsdoc] The following section has been denormalized from original sources for IntelliSense.
  4656. jQuery.fn.slideDown = function (speed, callback) {
  4657. /// <summary>
  4658. /// Reveal all matched elements by adjusting their height.
  4659. /// </summary>
  4660. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4661. /// the number of milliseconds to run the animation</param>
  4662. /// <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>
  4663. /// <returns type="jQuery" />
  4664. return this.animate(genFx("show", 1), speed, callback);
  4665. };
  4666. jQuery.fn.slideUp = function (speed, callback) {
  4667. /// <summary>
  4668. /// Hiding all matched elements by adjusting their height.
  4669. /// </summary>
  4670. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4671. /// the number of milliseconds to run the animation</param>
  4672. /// <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>
  4673. /// <returns type="jQuery" />
  4674. return this.animate(genFx("hide", 1), speed, callback);
  4675. };
  4676. jQuery.fn.slideToggle = function (speed, callback) {
  4677. /// <summary>
  4678. /// Toggles the visibility of all matched elements by adjusting their height.
  4679. /// </summary>
  4680. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4681. /// the number of milliseconds to run the animation</param>
  4682. /// <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>
  4683. /// <returns type="jQuery" />
  4684. return this.animate(genFx("toggle", 1), speed, callback);
  4685. };
  4686. jQuery.fn.fadeIn = function (speed, callback) {
  4687. /// <summary>
  4688. /// Fades in all matched elements by adjusting their opacity.
  4689. /// </summary>
  4690. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4691. /// the number of milliseconds to run the animation</param>
  4692. /// <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>
  4693. /// <returns type="jQuery" />
  4694. return this.animate({ opacity: "show" }, speed, callback);
  4695. };
  4696. jQuery.fn.fadeOut = function (speed, callback) {
  4697. /// <summary>
  4698. /// Fades the opacity of all matched elements to a specified opacity.
  4699. /// </summary>
  4700. /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
  4701. /// the number of milliseconds to run the animation</param>
  4702. /// <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>
  4703. /// <returns type="jQuery" />
  4704. return this.animate({ opacity: "hide" }, speed, callback);
  4705. };
  4706. jQuery.extend({
  4707. speed: function (speed, easing, fn) {
  4708. /// <summary>
  4709. /// This member is internal.
  4710. /// </summary>
  4711. /// <private />
  4712. var opt = typeof speed === "object" ? speed : {
  4713. complete: fn || !fn && easing ||
  4714. jQuery.isFunction(speed) && speed,
  4715. duration: speed,
  4716. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  4717. };
  4718. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  4719. jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
  4720. // Queueing
  4721. opt.old = opt.complete;
  4722. opt.complete = function () {
  4723. if (opt.queue !== false)
  4724. jQuery(this).dequeue();
  4725. if (jQuery.isFunction(opt.old))
  4726. opt.old.call(this);
  4727. };
  4728. return opt;
  4729. },
  4730. easing: {
  4731. linear: function (p, n, firstNum, diff) {
  4732. /// <summary>
  4733. /// This member is internal.
  4734. /// </summary>
  4735. /// <private />
  4736. return firstNum + diff * p;
  4737. },
  4738. swing: function (p, n, firstNum, diff) {
  4739. /// <summary>
  4740. /// This member is internal.
  4741. /// </summary>
  4742. /// <private />
  4743. return ((-Math.cos(p * Math.PI) / 2) + 0.5) * diff + firstNum;
  4744. }
  4745. },
  4746. timers: [],
  4747. fx: function (elem, options, prop) {
  4748. /// <summary>
  4749. /// This member is internal.
  4750. /// </summary>
  4751. /// <private />
  4752. this.options = options;
  4753. this.elem = elem;
  4754. this.prop = prop;
  4755. if (!options.orig)
  4756. options.orig = {};
  4757. }
  4758. });
  4759. jQuery.fx.prototype = {
  4760. // Simple function for setting a style value
  4761. update: function () {
  4762. /// <summary>
  4763. /// This member is internal.
  4764. /// </summary>
  4765. /// <private />
  4766. if (this.options.step)
  4767. this.options.step.call(this.elem, this.now, this);
  4768. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)(this);
  4769. // Set display property to block for height/width animations
  4770. if ((this.prop == "height" || this.prop == "width") && this.elem.style)
  4771. this.elem.style.display = "block";
  4772. },
  4773. // Get the current size
  4774. cur: function (force) {
  4775. /// <summary>
  4776. /// This member is internal.
  4777. /// </summary>
  4778. /// <private />
  4779. if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null))
  4780. return this.elem[this.prop];
  4781. var r = parseFloat(jQuery.css(this.elem, this.prop, force));
  4782. return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
  4783. },
  4784. // Start an animation from one number to another
  4785. custom: function (from, to, unit) {
  4786. this.startTime = now();
  4787. this.start = from;
  4788. this.end = to;
  4789. this.unit = unit || this.unit || "px";
  4790. this.now = this.start;
  4791. this.pos = this.state = 0;
  4792. var self = this;
  4793. function t(gotoEnd) {
  4794. return self.step(gotoEnd);
  4795. }
  4796. t.elem = this.elem;
  4797. if (t() && jQuery.timers.push(t) && !timerId) {
  4798. timerId = setInterval(function () {
  4799. var timers = jQuery.timers;
  4800. for (var i = 0; i < timers.length; i++)
  4801. if (!timers[i]())
  4802. timers.splice(i--, 1);
  4803. if (!timers.length) {
  4804. clearInterval(timerId);
  4805. timerId = undefined;
  4806. }
  4807. }, 13);
  4808. }
  4809. },
  4810. // Simple 'show' function
  4811. show: function () {
  4812. /// <summary>
  4813. /// Displays each of the set of matched elements if they are hidden.
  4814. /// </summary>
  4815. // Remember where we started, so that we can go back to it later
  4816. this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
  4817. this.options.show = true;
  4818. // Begin the animation
  4819. // Make sure that we start at a small width/height to avoid any
  4820. // flash of content
  4821. this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
  4822. // Start by showing the element
  4823. jQuery(this.elem).show();
  4824. },
  4825. // Simple 'hide' function
  4826. hide: function () {
  4827. /// <summary>
  4828. /// Hides each of the set of matched elements if they are shown.
  4829. /// </summary>
  4830. // Remember where we started, so that we can go back to it later
  4831. this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
  4832. this.options.hide = true;
  4833. // Begin the animation
  4834. this.custom(this.cur(), 0);
  4835. },
  4836. // Each step of an animation
  4837. step: function (gotoEnd) {
  4838. /// <summary>
  4839. /// This method is internal.
  4840. /// </summary>
  4841. /// <private />
  4842. var t = now();
  4843. if (gotoEnd || t >= this.options.duration + this.startTime) {
  4844. this.now = this.end;
  4845. this.pos = this.state = 1;
  4846. this.update();
  4847. this.options.curAnim[this.prop] = true;
  4848. var done = true;
  4849. for (var i in this.options.curAnim)
  4850. if (this.options.curAnim[i] !== true)
  4851. done = false;
  4852. if (done) {
  4853. if (this.options.display != null) {
  4854. // Reset the overflow
  4855. this.elem.style.overflow = this.options.overflow;
  4856. // Reset the display
  4857. this.elem.style.display = this.options.display;
  4858. if (jQuery.css(this.elem, "display") == "none")
  4859. this.elem.style.display = "block";
  4860. }
  4861. // Hide the element if the "hide" operation was done
  4862. if (this.options.hide)
  4863. jQuery(this.elem).hide();
  4864. // Reset the properties, if the item has been hidden or shown
  4865. if (this.options.hide || this.options.show)
  4866. for (var p in this.options.curAnim)
  4867. jQuery.attr(this.elem.style, p, this.options.orig[p]);
  4868. // Execute the complete function
  4869. this.options.complete.call(this.elem);
  4870. }
  4871. return false;
  4872. } else {
  4873. var n = t - this.startTime;
  4874. this.state = n / this.options.duration;
  4875. // Perform the easing function, defaults to swing
  4876. this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
  4877. this.now = this.start + ((this.end - this.start) * this.pos);
  4878. // Perform the next step of the animation
  4879. this.update();
  4880. }
  4881. return true;
  4882. }
  4883. };
  4884. jQuery.extend(jQuery.fx, {
  4885. speeds: {
  4886. slow: 600,
  4887. fast: 200,
  4888. // Default speed
  4889. _default: 400
  4890. },
  4891. step: {
  4892. opacity: function (fx) {
  4893. jQuery.attr(fx.elem.style, "opacity", fx.now);
  4894. },
  4895. _default: function (fx) {
  4896. if (fx.elem.style && fx.elem.style[fx.prop] != null)
  4897. fx.elem.style[fx.prop] = fx.now + fx.unit;
  4898. else
  4899. fx.elem[fx.prop] = fx.now;
  4900. }
  4901. }
  4902. });
  4903. if (document.documentElement["getBoundingClientRect"])
  4904. jQuery.fn.offset = function () {
  4905. /// <summary>
  4906. /// Gets the current offset of the first matched element relative to the viewport.
  4907. /// </summary>
  4908. /// <returns type="Object">An object with two Integer properties, 'top' and 'left'.</returns>
  4909. if (!this[0]) return { top: 0, left: 0 };
  4910. if (this[0] === this[0].ownerDocument.body) return jQuery.offset.bodyOffset(this[0]);
  4911. var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
  4912. clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
  4913. top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop) - clientTop,
  4914. left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
  4915. return { top: top, left: left };
  4916. };
  4917. else
  4918. jQuery.fn.offset = function () {
  4919. /// <summary>
  4920. /// Gets the current offset of the first matched element relative to the viewport.
  4921. /// </summary>
  4922. /// <returns type="Object">An object with two Integer properties, 'top' and 'left'.</returns>
  4923. if (!this[0]) return { top: 0, left: 0 };
  4924. if (this[0] === this[0].ownerDocument.body) return jQuery.offset.bodyOffset(this[0]);
  4925. jQuery.offset.initialized || jQuery.offset.initialize();
  4926. var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
  4927. doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
  4928. body = doc.body, defaultView = doc.defaultView,
  4929. prevComputedStyle = defaultView.getComputedStyle(elem, null),
  4930. top = elem.offsetTop, left = elem.offsetLeft;
  4931. while ((elem = elem.parentNode) && elem !== body && elem !== docElem) {
  4932. computedStyle = defaultView.getComputedStyle(elem, null);
  4933. top -= elem.scrollTop, left -= elem.scrollLeft;
  4934. if (elem === offsetParent) {
  4935. top += elem.offsetTop, left += elem.offsetLeft;
  4936. if (jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)))
  4937. top += parseInt(computedStyle.borderTopWidth, 10) || 0,
  4938. left += parseInt(computedStyle.borderLeftWidth, 10) || 0;
  4939. prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
  4940. }
  4941. if (jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible")
  4942. top += parseInt(computedStyle.borderTopWidth, 10) || 0,
  4943. left += parseInt(computedStyle.borderLeftWidth, 10) || 0;
  4944. prevComputedStyle = computedStyle;
  4945. }
  4946. if (prevComputedStyle.position === "relative" || prevComputedStyle.position === "static")
  4947. top += body.offsetTop,
  4948. left += body.offsetLeft;
  4949. if (prevComputedStyle.position === "fixed")
  4950. top += Math.max(docElem.scrollTop, body.scrollTop),
  4951. left += Math.max(docElem.scrollLeft, body.scrollLeft);
  4952. return { top: top, left: left };
  4953. };
  4954. jQuery.offset = {
  4955. initialize: function () {
  4956. if (this.initialized) return;
  4957. var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
  4958. 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>';
  4959. rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
  4960. for (prop in rules) container.style[prop] = rules[prop];
  4961. container.innerHTML = html;
  4962. body.insertBefore(container, body.firstChild);
  4963. innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
  4964. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  4965. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  4966. innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
  4967. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  4968. body.style.marginTop = '1px';
  4969. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
  4970. body.style.marginTop = bodyMarginTop;
  4971. body.removeChild(container);
  4972. this.initialized = true;
  4973. },
  4974. bodyOffset: function (body) {
  4975. jQuery.offset.initialized || jQuery.offset.initialize();
  4976. var top = body.offsetTop, left = body.offsetLeft;
  4977. if (jQuery.offset.doesNotIncludeMarginInBodyOffset)
  4978. top += parseInt(jQuery.curCSS(body, 'marginTop', true), 10) || 0,
  4979. left += parseInt(jQuery.curCSS(body, 'marginLeft', true), 10) || 0;
  4980. return { top: top, left: left };
  4981. }
  4982. };
  4983. jQuery.fn.extend({
  4984. position: function () {
  4985. /// <summary>
  4986. /// Gets the top and left positions of an element relative to its offset parent.
  4987. /// </summary>
  4988. /// <returns type="Object">An object with two integer properties, 'top' and 'left'.</returns>
  4989. var left = 0, top = 0, results;
  4990. if (this[0]) {
  4991. // Get *real* offsetParent
  4992. var offsetParent = this.offsetParent(),
  4993. // Get correct offsets
  4994. offset = this.offset(),
  4995. parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
  4996. // Subtract element margins
  4997. // note: when an element has margin: auto the offsetLeft and marginLeft
  4998. // are the same in Safari causing offset.left to incorrectly be 0
  4999. offset.top -= num(this, 'marginTop');
  5000. offset.left -= num(this, 'marginLeft');
  5001. // Add offsetParent borders
  5002. parentOffset.top += num(offsetParent, 'borderTopWidth');
  5003. parentOffset.left += num(offsetParent, 'borderLeftWidth');
  5004. // Subtract the two offsets
  5005. results = {
  5006. top: offset.top - parentOffset.top,
  5007. left: offset.left - parentOffset.left
  5008. };
  5009. }
  5010. return results;
  5011. },
  5012. offsetParent: function () {
  5013. /// <summary>
  5014. /// This method is internal.
  5015. /// </summary>
  5016. /// <private />
  5017. var offsetParent = this[0].offsetParent || document.body;
  5018. while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static'))
  5019. offsetParent = offsetParent.offsetParent;
  5020. return jQuery(offsetParent);
  5021. }
  5022. });
  5023. // Create scrollLeft and scrollTop methods
  5024. jQuery.each(['Left'], function (i, name) {
  5025. var method = 'scroll' + name;
  5026. jQuery.fn[method] = function (val) {
  5027. /// <summary>
  5028. /// Gets and optionally sets the scroll left offset of the first matched element.
  5029. /// </summary>
  5030. /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll left offset.</param>
  5031. /// <returns type="Number" integer="true">The scroll left offset of the first matched element.</returns>
  5032. if (!this[0]) return null;
  5033. return val !== undefined ?
  5034. // Set the scroll offset
  5035. this.each(function () {
  5036. this == window || this == document ?
  5037. window.scrollTo(
  5038. !i ? val : jQuery(window).scrollLeft(),
  5039. i ? val : jQuery(window).scrollTop()
  5040. ) :
  5041. this[method] = val;
  5042. }) :
  5043. // Return the scroll offset
  5044. this[0] == window || this[0] == document ?
  5045. self[i ? 'pageYOffset' : 'pageXOffset'] ||
  5046. jQuery.boxModel && document.documentElement[method] ||
  5047. document.body[method] :
  5048. this[0][method];
  5049. };
  5050. });
  5051. // Create scrollLeft and scrollTop methods
  5052. jQuery.each(['Top'], function (i, name) {
  5053. var method = 'scroll' + name;
  5054. jQuery.fn[method] = function (val) {
  5055. /// <summary>
  5056. /// Gets and optionally sets the scroll top offset of the first matched element.
  5057. /// </summary>
  5058. /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll top offset.</param>
  5059. /// <returns type="Number" integer="true">The scroll top offset of the first matched element.</returns>
  5060. if (!this[0]) return null;
  5061. return val !== undefined ?
  5062. // Set the scroll offset
  5063. this.each(function () {
  5064. this == window || this == document ?
  5065. window.scrollTo(
  5066. !i ? val : jQuery(window).scrollLeft(),
  5067. i ? val : jQuery(window).scrollTop()
  5068. ) :
  5069. this[method] = val;
  5070. }) :
  5071. // Return the scroll offset
  5072. this[0] == window || this[0] == document ?
  5073. self[i ? 'pageYOffset' : 'pageXOffset'] ||
  5074. jQuery.boxModel && document.documentElement[method] ||
  5075. document.body[method] :
  5076. this[0][method];
  5077. };
  5078. });
  5079. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  5080. jQuery.each(["Height"], function (i, name) {
  5081. var tl = i ? "Left" : "Top", // top or left
  5082. br = i ? "Right" : "Bottom", // bottom or right
  5083. lower = name.toLowerCase();
  5084. // innerHeight and innerWidth
  5085. jQuery.fn["inner" + name] = function () {
  5086. /// <summary>
  5087. /// Gets the inner height of the first matched element, excluding border but including padding.
  5088. /// </summary>
  5089. /// <returns type="Number" integer="true">The outer height of the first matched element.</returns>
  5090. return this[0] ?
  5091. jQuery.css(this[0], lower, false, "padding") :
  5092. null;
  5093. };
  5094. // outerHeight and outerWidth
  5095. jQuery.fn["outer" + name] = function (margin) {
  5096. /// <summary>
  5097. /// Gets the outer height of the first matched element, including border and padding by default.
  5098. /// </summary>
  5099. /// <param name="margins" type="Map">A set of key/value pairs that specify the options for the method.</param>
  5100. /// <returns type="Number" integer="true">The outer height of the first matched element.</returns>
  5101. return this[0] ?
  5102. jQuery.css(this[0], lower, false, margin ? "margin" : "border") :
  5103. null;
  5104. };
  5105. var type = name.toLowerCase();
  5106. jQuery.fn[type] = function (size) {
  5107. /// <summary>
  5108. /// Set the CSS height of every matched element. If no explicit unit
  5109. /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets
  5110. /// the current computed pixel height of the first matched element.
  5111. /// Part of CSS
  5112. /// </summary>
  5113. /// <returns type="jQuery" type="jQuery" />
  5114. /// <param name="cssProperty" type="String">
  5115. /// Set the CSS property to the specified value. Omit to get the value of the first matched element.
  5116. /// </param>
  5117. // Get window width or height
  5118. return this[0] == window ?
  5119. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  5120. document.compatMode == "CSS1Compat" && document.documentElement["client" + name] ||
  5121. document.body["client" + name] :
  5122. // Get document width or height
  5123. this[0] == document ?
  5124. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  5125. Math.max(
  5126. document.documentElement["client" + name],
  5127. document.body["scroll" + name], document.documentElement["scroll" + name],
  5128. document.body["offset" + name], document.documentElement["offset" + name]
  5129. ) :
  5130. // Get or set width or height on the element
  5131. size === undefined ?
  5132. // Get width or height on the element
  5133. (this.length ? jQuery.css(this[0], type) : null) :
  5134. // Set the width or height on the element (default to pixels if value is unitless)
  5135. this.css(type, typeof size === "string" ? size : size + "px");
  5136. };
  5137. });
  5138. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  5139. jQuery.each(["Width"], function (i, name) {
  5140. var tl = i ? "Left" : "Top", // top or left
  5141. br = i ? "Right" : "Bottom", // bottom or right
  5142. lower = name.toLowerCase();
  5143. // innerHeight and innerWidth
  5144. jQuery.fn["inner" + name] = function () {
  5145. /// <summary>
  5146. /// Gets the inner width of the first matched element, excluding border but including padding.
  5147. /// </summary>
  5148. /// <returns type="Number" integer="true">The outer width of the first matched element.</returns>
  5149. return this[0] ?
  5150. jQuery.css(this[0], lower, false, "padding") :
  5151. null;
  5152. };
  5153. // outerHeight and outerWidth
  5154. jQuery.fn["outer" + name] = function (margin) {
  5155. /// <summary>
  5156. /// Gets the outer width of the first matched element, including border and padding by default.
  5157. /// </summary>
  5158. /// <param name="margins" type="Map">A set of key/value pairs that specify the options for the method.</param>
  5159. /// <returns type="Number" integer="true">The outer width of the first matched element.</returns>
  5160. return this[0] ?
  5161. jQuery.css(this[0], lower, false, margin ? "margin" : "border") :
  5162. null;
  5163. };
  5164. var type = name.toLowerCase();
  5165. jQuery.fn[type] = function (size) {
  5166. /// <summary>
  5167. /// Set the CSS width of every matched element. If no explicit unit
  5168. /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets
  5169. /// the current computed pixel width of the first matched element.
  5170. /// Part of CSS
  5171. /// </summary>
  5172. /// <returns type="jQuery" type="jQuery" />
  5173. /// <param name="cssProperty" type="String">
  5174. /// Set the CSS property to the specified value. Omit to get the value of the first matched element.
  5175. /// </param>
  5176. // Get window width or height
  5177. return this[0] == window ?
  5178. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  5179. document.compatMode == "CSS1Compat" && document.documentElement["client" + name] ||
  5180. document.body["client" + name] :
  5181. // Get document width or height
  5182. this[0] == document ?
  5183. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  5184. Math.max(
  5185. document.documentElement["client" + name],
  5186. document.body["scroll" + name], document.documentElement["scroll" + name],
  5187. document.body["offset" + name], document.documentElement["offset" + name]
  5188. ) :
  5189. // Get or set width or height on the element
  5190. size === undefined ?
  5191. // Get width or height on the element
  5192. (this.length ? jQuery.css(this[0], type) : null) :
  5193. // Set the width or height on the element (default to pixels if value is unitless)
  5194. this.css(type, typeof size === "string" ? size : size + "px");
  5195. };
  5196. });
  5197. })();