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