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.

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