/Plugins/Jquery rotate/js/jquery.js
JavaScript | 6866 lines | 4981 code | 1166 blank | 719 comment | 1383 complexity | 2d3c6ca006d09feef9f0f75a33f85753 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
1/*!
2 * jQuery JavaScript Library v1.4.3
3 * http://jquery.com/
4 *
5 * Copyright 2010, John Resig
6 * Dual licensed under the MIT or GPL Version 2 licenses.
7 * http://jquery.org/license
8 *
9 * Includes Sizzle.js
10 * http://sizzlejs.com/
11 * Copyright 2010, The Dojo Foundation
12 * Released under the MIT, BSD, and GPL Licenses.
13 *
14 * Date: Mon Oct 11 00:37:46 2010 -0400
15 */
16(function( window, undefined ) {
17
18// Use the correct document accordingly with window argument (sandbox)
19var document = window.document;
20var jQuery = (function() {
21
22// Define a local copy of jQuery
23var jQuery = function( selector, context ) {
24 // The jQuery object is actually just the init constructor 'enhanced'
25 return new jQuery.fn.init( selector, context );
26 },
27
28 // Map over jQuery in case of overwrite
29 _jQuery = window.jQuery,
30
31 // Map over the $ in case of overwrite
32 _$ = window.$,
33
34 // A central reference to the root jQuery(document)
35 rootjQuery,
36
37 // A simple way to check for HTML strings or ID strings
38 // (both of which we optimize for)
39 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
40
41 // Is it a simple selector
42 isSimple = /^.[^:#\[\.,]*$/,
43
44 // Check if a string has a non-whitespace character in it
45 rnotwhite = /\S/,
46 rwhite = /\s/,
47
48 // Used for trimming whitespace
49 trimLeft = /^\s+/,
50 trimRight = /\s+$/,
51
52 // Check for non-word characters
53 rnonword = /\W/,
54
55 // Check for digits
56 rdigit = /\d/,
57
58 // Match a standalone tag
59 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
60
61 // JSON RegExp
62 rvalidchars = /^[\],:{}\s]*$/,
63 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
64 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
65 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
66
67 // Useragent RegExp
68 rwebkit = /(webkit)[ \/]([\w.]+)/,
69 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
70 rmsie = /(msie) ([\w.]+)/,
71 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
72
73 // Keep a UserAgent string for use with jQuery.browser
74 userAgent = navigator.userAgent,
75
76 // For matching the engine and version of the browser
77 browserMatch,
78
79 // Has the ready events already been bound?
80 readyBound = false,
81
82 // The functions to execute on DOM ready
83 readyList = [],
84
85 // The ready event handler
86 DOMContentLoaded,
87
88 // Save a reference to some core methods
89 toString = Object.prototype.toString,
90 hasOwn = Object.prototype.hasOwnProperty,
91 push = Array.prototype.push,
92 slice = Array.prototype.slice,
93 trim = String.prototype.trim,
94 indexOf = Array.prototype.indexOf,
95
96 // [[Class]] -> type pairs
97 class2type = {};
98
99jQuery.fn = jQuery.prototype = {
100 init: function( selector, context ) {
101 var match, elem, ret, doc;
102
103 // Handle $(""), $(null), or $(undefined)
104 if ( !selector ) {
105 return this;
106 }
107
108 // Handle $(DOMElement)
109 if ( selector.nodeType ) {
110 this.context = this[0] = selector;
111 this.length = 1;
112 return this;
113 }
114
115 // The body element only exists once, optimize finding it
116 if ( selector === "body" && !context && document.body ) {
117 this.context = document;
118 this[0] = document.body;
119 this.selector = "body";
120 this.length = 1;
121 return this;
122 }
123
124 // Handle HTML strings
125 if ( typeof selector === "string" ) {
126 // Are we dealing with HTML string or an ID?
127 match = quickExpr.exec( selector );
128
129 // Verify a match, and that no context was specified for #id
130 if ( match && (match[1] || !context) ) {
131
132 // HANDLE: $(html) -> $(array)
133 if ( match[1] ) {
134 doc = (context ? context.ownerDocument || context : document);
135
136 // If a single string is passed in and it's a single tag
137 // just do a createElement and skip the rest
138 ret = rsingleTag.exec( selector );
139
140 if ( ret ) {
141 if ( jQuery.isPlainObject( context ) ) {
142 selector = [ document.createElement( ret[1] ) ];
143 jQuery.fn.attr.call( selector, context, true );
144
145 } else {
146 selector = [ doc.createElement( ret[1] ) ];
147 }
148
149 } else {
150 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
151 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
152 }
153
154 return jQuery.merge( this, selector );
155
156 // HANDLE: $("#id")
157 } else {
158 elem = document.getElementById( match[2] );
159
160 // Check parentNode to catch when Blackberry 4.6 returns
161 // nodes that are no longer in the document #6963
162 if ( elem && elem.parentNode ) {
163 // Handle the case where IE and Opera return items
164 // by name instead of ID
165 if ( elem.id !== match[2] ) {
166 return rootjQuery.find( selector );
167 }
168
169 // Otherwise, we inject the element directly into the jQuery object
170 this.length = 1;
171 this[0] = elem;
172 }
173
174 this.context = document;
175 this.selector = selector;
176 return this;
177 }
178
179 // HANDLE: $("TAG")
180 } else if ( !context && !rnonword.test( selector ) ) {
181 this.selector = selector;
182 this.context = document;
183 selector = document.getElementsByTagName( selector );
184 return jQuery.merge( this, selector );
185
186 // HANDLE: $(expr, $(...))
187 } else if ( !context || context.jquery ) {
188 return (context || rootjQuery).find( selector );
189
190 // HANDLE: $(expr, context)
191 // (which is just equivalent to: $(context).find(expr)
192 } else {
193 return jQuery( context ).find( selector );
194 }
195
196 // HANDLE: $(function)
197 // Shortcut for document ready
198 } else if ( jQuery.isFunction( selector ) ) {
199 return rootjQuery.ready( selector );
200 }
201
202 if (selector.selector !== undefined) {
203 this.selector = selector.selector;
204 this.context = selector.context;
205 }
206
207 return jQuery.makeArray( selector, this );
208 },
209
210 // Start with an empty selector
211 selector: "",
212
213 // The current version of jQuery being used
214 jquery: "1.4.3",
215
216 // The default length of a jQuery object is 0
217 length: 0,
218
219 // The number of elements contained in the matched element set
220 size: function() {
221 return this.length;
222 },
223
224 toArray: function() {
225 return slice.call( this, 0 );
226 },
227
228 // Get the Nth element in the matched element set OR
229 // Get the whole matched element set as a clean array
230 get: function( num ) {
231 return num == null ?
232
233 // Return a 'clean' array
234 this.toArray() :
235
236 // Return just the object
237 ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
238 },
239
240 // Take an array of elements and push it onto the stack
241 // (returning the new matched element set)
242 pushStack: function( elems, name, selector ) {
243 // Build a new jQuery matched element set
244 var ret = jQuery();
245
246 if ( jQuery.isArray( elems ) ) {
247 push.apply( ret, elems );
248
249 } else {
250 jQuery.merge( ret, elems );
251 }
252
253 // Add the old object onto the stack (as a reference)
254 ret.prevObject = this;
255
256 ret.context = this.context;
257
258 if ( name === "find" ) {
259 ret.selector = this.selector + (this.selector ? " " : "") + selector;
260 } else if ( name ) {
261 ret.selector = this.selector + "." + name + "(" + selector + ")";
262 }
263
264 // Return the newly-formed element set
265 return ret;
266 },
267
268 // Execute a callback for every element in the matched set.
269 // (You can seed the arguments with an array of args, but this is
270 // only used internally.)
271 each: function( callback, args ) {
272 return jQuery.each( this, callback, args );
273 },
274
275 ready: function( fn ) {
276 // Attach the listeners
277 jQuery.bindReady();
278
279 // If the DOM is already ready
280 if ( jQuery.isReady ) {
281 // Execute the function immediately
282 fn.call( document, jQuery );
283
284 // Otherwise, remember the function for later
285 } else if ( readyList ) {
286 // Add the function to the wait list
287 readyList.push( fn );
288 }
289
290 return this;
291 },
292
293 eq: function( i ) {
294 return i === -1 ?
295 this.slice( i ) :
296 this.slice( i, +i + 1 );
297 },
298
299 first: function() {
300 return this.eq( 0 );
301 },
302
303 last: function() {
304 return this.eq( -1 );
305 },
306
307 slice: function() {
308 return this.pushStack( slice.apply( this, arguments ),
309 "slice", slice.call(arguments).join(",") );
310 },
311
312 map: function( callback ) {
313 return this.pushStack( jQuery.map(this, function( elem, i ) {
314 return callback.call( elem, i, elem );
315 }));
316 },
317
318 end: function() {
319 return this.prevObject || jQuery(null);
320 },
321
322 // For internal use only.
323 // Behaves like an Array's method, not like a jQuery method.
324 push: push,
325 sort: [].sort,
326 splice: [].splice
327};
328
329// Give the init function the jQuery prototype for later instantiation
330jQuery.fn.init.prototype = jQuery.fn;
331
332jQuery.extend = jQuery.fn.extend = function() {
333 // copy reference to target object
334 var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray;
335
336 // Handle a deep copy situation
337 if ( typeof target === "boolean" ) {
338 deep = target;
339 target = arguments[1] || {};
340 // skip the boolean and the target
341 i = 2;
342 }
343
344 // Handle case when target is a string or something (possible in deep copy)
345 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
346 target = {};
347 }
348
349 // extend jQuery itself if only one argument is passed
350 if ( length === i ) {
351 target = this;
352 --i;
353 }
354
355 for ( ; i < length; i++ ) {
356 // Only deal with non-null/undefined values
357 if ( (options = arguments[ i ]) != null ) {
358 // Extend the base object
359 for ( name in options ) {
360 src = target[ name ];
361 copy = options[ name ];
362
363 // Prevent never-ending loop
364 if ( target === copy ) {
365 continue;
366 }
367
368 // Recurse if we're merging plain objects or arrays
369 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
370 if ( copyIsArray ) {
371 copyIsArray = false;
372 clone = src && jQuery.isArray(src) ? src : [];
373
374 } else {
375 clone = src && jQuery.isPlainObject(src) ? src : {};
376 }
377
378 // Never move original objects, clone them
379 target[ name ] = jQuery.extend( deep, clone, copy );
380
381 // Don't bring in undefined values
382 } else if ( copy !== undefined ) {
383 target[ name ] = copy;
384 }
385 }
386 }
387 }
388
389 // Return the modified object
390 return target;
391};
392
393jQuery.extend({
394 noConflict: function( deep ) {
395 window.$ = _$;
396
397 if ( deep ) {
398 window.jQuery = _jQuery;
399 }
400
401 return jQuery;
402 },
403
404 // Is the DOM ready to be used? Set to true once it occurs.
405 isReady: false,
406
407 // A counter to track how many items to wait for before
408 // the ready event fires. See #6781
409 readyWait: 1,
410
411 // Handle when the DOM is ready
412 ready: function( wait ) {
413 // A third-party is pushing the ready event forwards
414 if ( wait === true ) {
415 jQuery.readyWait--;
416 }
417
418 // Make sure that the DOM is not already loaded
419 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
420 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
421 if ( !document.body ) {
422 return setTimeout( jQuery.ready, 1 );
423 }
424
425 // Remember that the DOM is ready
426 jQuery.isReady = true;
427
428 // If a normal DOM Ready event fired, decrement, and wait if need be
429 if ( wait !== true && --jQuery.readyWait > 0 ) {
430 return;
431 }
432
433 // If there are functions bound, to execute
434 if ( readyList ) {
435 // Execute all of them
436 var fn, i = 0;
437 while ( (fn = readyList[ i++ ]) ) {
438 fn.call( document, jQuery );
439 }
440
441 // Reset the list of functions
442 readyList = null;
443 }
444
445 // Trigger any bound ready events
446 if ( jQuery.fn.triggerHandler ) {
447 jQuery( document ).triggerHandler( "ready" );
448 }
449 }
450 },
451
452 bindReady: function() {
453 if ( readyBound ) {
454 return;
455 }
456
457 readyBound = true;
458
459 // Catch cases where $(document).ready() is called after the
460 // browser event has already occurred.
461 if ( document.readyState === "complete" ) {
462 // Handle it asynchronously to allow scripts the opportunity to delay ready
463 return setTimeout( jQuery.ready, 1 );
464 }
465
466 // Mozilla, Opera and webkit nightlies currently support this event
467 if ( document.addEventListener ) {
468 // Use the handy event callback
469 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
470
471 // A fallback to window.onload, that will always work
472 window.addEventListener( "load", jQuery.ready, false );
473
474 // If IE event model is used
475 } else if ( document.attachEvent ) {
476 // ensure firing before onload,
477 // maybe late but safe also for iframes
478 document.attachEvent("onreadystatechange", DOMContentLoaded);
479
480 // A fallback to window.onload, that will always work
481 window.attachEvent( "onload", jQuery.ready );
482
483 // If IE and not a frame
484 // continually check to see if the document is ready
485 var toplevel = false;
486
487 try {
488 toplevel = window.frameElement == null;
489 } catch(e) {}
490
491 if ( document.documentElement.doScroll && toplevel ) {
492 doScrollCheck();
493 }
494 }
495 },
496
497 // See test/unit/core.js for details concerning isFunction.
498 // Since version 1.3, DOM methods and functions like alert
499 // aren't supported. They return false on IE (#2968).
500 isFunction: function( obj ) {
501 return jQuery.type(obj) === "function";
502 },
503
504 isArray: Array.isArray || function( obj ) {
505 return jQuery.type(obj) === "array";
506 },
507
508 // A crude way of determining if an object is a window
509 isWindow: function( obj ) {
510 return obj && typeof obj === "object" && "setInterval" in obj;
511 },
512
513 isNaN: function( obj ) {
514 return obj == null || !rdigit.test( obj ) || isNaN( obj );
515 },
516
517 type: function( obj ) {
518 return obj == null ?
519 String( obj ) :
520 class2type[ toString.call(obj) ] || "object";
521 },
522
523 isPlainObject: function( obj ) {
524 // Must be an Object.
525 // Because of IE, we also have to check the presence of the constructor property.
526 // Make sure that DOM nodes and window objects don't pass through, as well
527 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
528 return false;
529 }
530
531 // Not own constructor property must be Object
532 if ( obj.constructor &&
533 !hasOwn.call(obj, "constructor") &&
534 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
535 return false;
536 }
537
538 // Own properties are enumerated firstly, so to speed up,
539 // if last one is own, then all properties are own.
540
541 var key;
542 for ( key in obj ) {}
543
544 return key === undefined || hasOwn.call( obj, key );
545 },
546
547 isEmptyObject: function( obj ) {
548 for ( var name in obj ) {
549 return false;
550 }
551 return true;
552 },
553
554 error: function( msg ) {
555 throw msg;
556 },
557
558 parseJSON: function( data ) {
559 if ( typeof data !== "string" || !data ) {
560 return null;
561 }
562
563 // Make sure leading/trailing whitespace is removed (IE can't handle it)
564 data = jQuery.trim( data );
565
566 // Make sure the incoming data is actual JSON
567 // Logic borrowed from http://json.org/json2.js
568 if ( rvalidchars.test(data.replace(rvalidescape, "@")
569 .replace(rvalidtokens, "]")
570 .replace(rvalidbraces, "")) ) {
571
572 // Try to use the native JSON parser first
573 return window.JSON && window.JSON.parse ?
574 window.JSON.parse( data ) :
575 (new Function("return " + data))();
576
577 } else {
578 jQuery.error( "Invalid JSON: " + data );
579 }
580 },
581
582 noop: function() {},
583
584 // Evalulates a script in a global context
585 globalEval: function( data ) {
586 if ( data && rnotwhite.test(data) ) {
587 // Inspired by code by Andrea Giammarchi
588 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
589 var head = document.getElementsByTagName("head")[0] || document.documentElement,
590 script = document.createElement("script");
591
592 script.type = "text/javascript";
593
594 if ( jQuery.support.scriptEval ) {
595 script.appendChild( document.createTextNode( data ) );
596 } else {
597 script.text = data;
598 }
599
600 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
601 // This arises when a base node is used (#2709).
602 head.insertBefore( script, head.firstChild );
603 head.removeChild( script );
604 }
605 },
606
607 nodeName: function( elem, name ) {
608 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
609 },
610
611 // args is for internal usage only
612 each: function( object, callback, args ) {
613 var name, i = 0,
614 length = object.length,
615 isObj = length === undefined || jQuery.isFunction(object);
616
617 if ( args ) {
618 if ( isObj ) {
619 for ( name in object ) {
620 if ( callback.apply( object[ name ], args ) === false ) {
621 break;
622 }
623 }
624 } else {
625 for ( ; i < length; ) {
626 if ( callback.apply( object[ i++ ], args ) === false ) {
627 break;
628 }
629 }
630 }
631
632 // A special, fast, case for the most common use of each
633 } else {
634 if ( isObj ) {
635 for ( name in object ) {
636 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
637 break;
638 }
639 }
640 } else {
641 for ( var value = object[0];
642 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
643 }
644 }
645
646 return object;
647 },
648
649 // Use native String.trim function wherever possible
650 trim: trim ?
651 function( text ) {
652 return text == null ?
653 "" :
654 trim.call( text );
655 } :
656
657 // Otherwise use our own trimming functionality
658 function( text ) {
659 return text == null ?
660 "" :
661 text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
662 },
663
664 // results is for internal usage only
665 makeArray: function( array, results ) {
666 var ret = results || [];
667
668 if ( array != null ) {
669 // The window, strings (and functions) also have 'length'
670 // The extra typeof function check is to prevent crashes
671 // in Safari 2 (See: #3039)
672 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
673 var type = jQuery.type(array);
674
675 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
676 push.call( ret, array );
677 } else {
678 jQuery.merge( ret, array );
679 }
680 }
681
682 return ret;
683 },
684
685 inArray: function( elem, array ) {
686 if ( array.indexOf ) {
687 return array.indexOf( elem );
688 }
689
690 for ( var i = 0, length = array.length; i < length; i++ ) {
691 if ( array[ i ] === elem ) {
692 return i;
693 }
694 }
695
696 return -1;
697 },
698
699 merge: function( first, second ) {
700 var i = first.length, j = 0;
701
702 if ( typeof second.length === "number" ) {
703 for ( var l = second.length; j < l; j++ ) {
704 first[ i++ ] = second[ j ];
705 }
706
707 } else {
708 while ( second[j] !== undefined ) {
709 first[ i++ ] = second[ j++ ];
710 }
711 }
712
713 first.length = i;
714
715 return first;
716 },
717
718 grep: function( elems, callback, inv ) {
719 var ret = [], retVal;
720 inv = !!inv;
721
722 // Go through the array, only saving the items
723 // that pass the validator function
724 for ( var i = 0, length = elems.length; i < length; i++ ) {
725 retVal = !!callback( elems[ i ], i );
726 if ( inv !== retVal ) {
727 ret.push( elems[ i ] );
728 }
729 }
730
731 return ret;
732 },
733
734 // arg is for internal usage only
735 map: function( elems, callback, arg ) {
736 var ret = [], value;
737
738 // Go through the array, translating each of the items to their
739 // new value (or values).
740 for ( var i = 0, length = elems.length; i < length; i++ ) {
741 value = callback( elems[ i ], i, arg );
742
743 if ( value != null ) {
744 ret[ ret.length ] = value;
745 }
746 }
747
748 return ret.concat.apply( [], ret );
749 },
750
751 // A global GUID counter for objects
752 guid: 1,
753
754 proxy: function( fn, proxy, thisObject ) {
755 if ( arguments.length === 2 ) {
756 if ( typeof proxy === "string" ) {
757 thisObject = fn;
758 fn = thisObject[ proxy ];
759 proxy = undefined;
760
761 } else if ( proxy && !jQuery.isFunction( proxy ) ) {
762 thisObject = proxy;
763 proxy = undefined;
764 }
765 }
766
767 if ( !proxy && fn ) {
768 proxy = function() {
769 return fn.apply( thisObject || this, arguments );
770 };
771 }
772
773 // Set the guid of unique handler to the same of original handler, so it can be removed
774 if ( fn ) {
775 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
776 }
777
778 // So proxy can be declared as an argument
779 return proxy;
780 },
781
782 // Mutifunctional method to get and set values to a collection
783 // The value/s can be optionally by executed if its a function
784 access: function( elems, key, value, exec, fn, pass ) {
785 var length = elems.length;
786
787 // Setting many attributes
788 if ( typeof key === "object" ) {
789 for ( var k in key ) {
790 jQuery.access( elems, k, key[k], exec, fn, value );
791 }
792 return elems;
793 }
794
795 // Setting one attribute
796 if ( value !== undefined ) {
797 // Optionally, function values get executed if exec is true
798 exec = !pass && exec && jQuery.isFunction(value);
799
800 for ( var i = 0; i < length; i++ ) {
801 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
802 }
803
804 return elems;
805 }
806
807 // Getting an attribute
808 return length ? fn( elems[0], key ) : undefined;
809 },
810
811 now: function() {
812 return (new Date()).getTime();
813 },
814
815 // Use of jQuery.browser is frowned upon.
816 // More details: http://docs.jquery.com/Utilities/jQuery.browser
817 uaMatch: function( ua ) {
818 ua = ua.toLowerCase();
819
820 var match = rwebkit.exec( ua ) ||
821 ropera.exec( ua ) ||
822 rmsie.exec( ua ) ||
823 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
824 [];
825
826 return { browser: match[1] || "", version: match[2] || "0" };
827 },
828
829 browser: {}
830});
831
832// Populate the class2type map
833jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
834 class2type[ "[object " + name + "]" ] = name.toLowerCase();
835});
836
837browserMatch = jQuery.uaMatch( userAgent );
838if ( browserMatch.browser ) {
839 jQuery.browser[ browserMatch.browser ] = true;
840 jQuery.browser.version = browserMatch.version;
841}
842
843// Deprecated, use jQuery.browser.webkit instead
844if ( jQuery.browser.webkit ) {
845 jQuery.browser.safari = true;
846}
847
848if ( indexOf ) {
849 jQuery.inArray = function( elem, array ) {
850 return indexOf.call( array, elem );
851 };
852}
853
854// Verify that \s matches non-breaking spaces
855// (IE fails on this test)
856if ( !rwhite.test( "\xA0" ) ) {
857 trimLeft = /^[\s\xA0]+/;
858 trimRight = /[\s\xA0]+$/;
859}
860
861// All jQuery objects should point back to these
862rootjQuery = jQuery(document);
863
864// Cleanup functions for the document ready method
865if ( document.addEventListener ) {
866 DOMContentLoaded = function() {
867 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
868 jQuery.ready();
869 };
870
871} else if ( document.attachEvent ) {
872 DOMContentLoaded = function() {
873 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
874 if ( document.readyState === "complete" ) {
875 document.detachEvent( "onreadystatechange", DOMContentLoaded );
876 jQuery.ready();
877 }
878 };
879}
880
881// The DOM ready check for Internet Explorer
882function doScrollCheck() {
883 if ( jQuery.isReady ) {
884 return;
885 }
886
887 try {
888 // If IE is used, use the trick by Diego Perini
889 // http://javascript.nwbox.com/IEContentLoaded/
890 document.documentElement.doScroll("left");
891 } catch(e) {
892 setTimeout( doScrollCheck, 1 );
893 return;
894 }
895
896 // and execute any waiting functions
897 jQuery.ready();
898}
899
900// Expose jQuery to the global object
901return (window.jQuery = window.$ = jQuery);
902
903})();
904
905
906(function() {
907
908 jQuery.support = {};
909
910 var root = document.documentElement,
911 script = document.createElement("script"),
912 div = document.createElement("div"),
913 id = "script" + jQuery.now();
914
915 div.style.display = "none";
916 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
917
918 var all = div.getElementsByTagName("*"),
919 a = div.getElementsByTagName("a")[0],
920 select = document.createElement("select"),
921 opt = select.appendChild( document.createElement("option") );
922
923 // Can't get basic test support
924 if ( !all || !all.length || !a ) {
925 return;
926 }
927
928 jQuery.support = {
929 // IE strips leading whitespace when .innerHTML is used
930 leadingWhitespace: div.firstChild.nodeType === 3,
931
932 // Make sure that tbody elements aren't automatically inserted
933 // IE will insert them into empty tables
934 tbody: !div.getElementsByTagName("tbody").length,
935
936 // Make sure that link elements get serialized correctly by innerHTML
937 // This requires a wrapper element in IE
938 htmlSerialize: !!div.getElementsByTagName("link").length,
939
940 // Get the style information from getAttribute
941 // (IE uses .cssText insted)
942 style: /red/.test( a.getAttribute("style") ),
943
944 // Make sure that URLs aren't manipulated
945 // (IE normalizes it by default)
946 hrefNormalized: a.getAttribute("href") === "/a",
947
948 // Make sure that element opacity exists
949 // (IE uses filter instead)
950 // Use a regex to work around a WebKit issue. See #5145
951 opacity: /^0.55$/.test( a.style.opacity ),
952
953 // Verify style float existence
954 // (IE uses styleFloat instead of cssFloat)
955 cssFloat: !!a.style.cssFloat,
956
957 // Make sure that if no value is specified for a checkbox
958 // that it defaults to "on".
959 // (WebKit defaults to "" instead)
960 checkOn: div.getElementsByTagName("input")[0].value === "on",
961
962 // Make sure that a selected-by-default option has a working selected property.
963 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
964 optSelected: opt.selected,
965
966 // Will be defined later
967 optDisabled: false,
968 checkClone: false,
969 scriptEval: false,
970 noCloneEvent: true,
971 boxModel: null,
972 inlineBlockNeedsLayout: false,
973 shrinkWrapBlocks: false,
974 reliableHiddenOffsets: true
975 };
976
977 // Make sure that the options inside disabled selects aren't marked as disabled
978 // (WebKit marks them as diabled)
979 select.disabled = true;
980 jQuery.support.optDisabled = !opt.disabled;
981
982 script.type = "text/javascript";
983 try {
984 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
985 } catch(e) {}
986
987 root.insertBefore( script, root.firstChild );
988
989 // Make sure that the execution of code works by injecting a script
990 // tag with appendChild/createTextNode
991 // (IE doesn't support this, fails, and uses .text instead)
992 if ( window[ id ] ) {
993 jQuery.support.scriptEval = true;
994 delete window[ id ];
995 }
996
997 root.removeChild( script );
998
999 if ( div.attachEvent && div.fireEvent ) {
1000 div.attachEvent("onclick", function click() {
1001 // Cloning a node shouldn't copy over any
1002 // bound event handlers (IE does this)
1003 jQuery.support.noCloneEvent = false;
1004 div.detachEvent("onclick", click);
1005 });
1006 div.cloneNode(true).fireEvent("onclick");
1007 }
1008
1009 div = document.createElement("div");
1010 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
1011
1012 var fragment = document.createDocumentFragment();
1013 fragment.appendChild( div.firstChild );
1014
1015 // WebKit doesn't clone checked state correctly in fragments
1016 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
1017
1018 // Figure out if the W3C box model works as expected
1019 // document.body must exist before we can do this
1020 jQuery(function() {
1021 var div = document.createElement("div");
1022 div.style.width = div.style.paddingLeft = "1px";
1023
1024 document.body.appendChild( div );
1025 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
1026
1027 if ( "zoom" in div.style ) {
1028 // Check if natively block-level elements act like inline-block
1029 // elements when setting their display to 'inline' and giving
1030 // them layout
1031 // (IE < 8 does this)
1032 div.style.display = "inline";
1033 div.style.zoom = 1;
1034 jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
1035
1036 // Check if elements with layout shrink-wrap their children
1037 // (IE 6 does this)
1038 div.style.display = "";
1039 div.innerHTML = "<div style='width:4px;'></div>";
1040 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1041 }
1042
1043 div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
1044 var tds = div.getElementsByTagName("td");
1045
1046 // Check if table cells still have offsetWidth/Height when they are set
1047 // to display:none and there are still other visible table cells in a
1048 // table row; if so, offsetWidth/Height are not reliable for use when
1049 // determining if an element has been hidden directly using
1050 // display:none (it is still safe to use offsets if a parent element is
1051 // hidden; don safety goggles and see bug #4512 for more information).
1052 // (only IE 8 fails this test)
1053 jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
1054
1055 tds[0].style.display = "";
1056 tds[1].style.display = "none";
1057
1058 // Check if empty table cells still have offsetWidth/Height
1059 // (IE < 8 fail this test)
1060 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1061 div.innerHTML = "";
1062
1063 document.body.removeChild( div ).style.display = "none";
1064 div = tds = null;
1065 });
1066
1067 // Technique from Juriy Zaytsev
1068 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
1069 var eventSupported = function( eventName ) {
1070 var el = document.createElement("div");
1071 eventName = "on" + eventName;
1072
1073 var isSupported = (eventName in el);
1074 if ( !isSupported ) {
1075 el.setAttribute(eventName, "return;");
1076 isSupported = typeof el[eventName] === "function";
1077 }
1078 el = null;
1079
1080 return isSupported;
1081 };
1082
1083 jQuery.support.submitBubbles = eventSupported("submit");
1084 jQuery.support.changeBubbles = eventSupported("change");
1085
1086 // release memory in IE
1087 root = script = div = all = a = null;
1088})();
1089
1090jQuery.props = {
1091 "for": "htmlFor",
1092 "class": "className",
1093 readonly: "readOnly",
1094 maxlength: "maxLength",
1095 cellspacing: "cellSpacing",
1096 rowspan: "rowSpan",
1097 colspan: "colSpan",
1098 tabindex: "tabIndex",
1099 usemap: "useMap",
1100 frameborder: "frameBorder"
1101};
1102
1103
1104
1105
1106var windowData = {},
1107 rbrace = /^(?:\{.*\}|\[.*\])$/;
1108
1109jQuery.extend({
1110 cache: {},
1111
1112 // Please use with caution
1113 uuid: 0,
1114
1115 // Unique for each copy of jQuery on the page
1116 expando: "jQuery" + jQuery.now(),
1117
1118 // The following elements throw uncatchable exceptions if you
1119 // attempt to add expando properties to them.
1120 noData: {
1121 "embed": true,
1122 // Ban all objects except for Flash (which handle expandos)
1123 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1124 "applet": true
1125 },
1126
1127 data: function( elem, name, data ) {
1128 if ( !jQuery.acceptData( elem ) ) {
1129 return;
1130 }
1131
1132 elem = elem == window ?
1133 windowData :
1134 elem;
1135
1136 var isNode = elem.nodeType,
1137 id = isNode ? elem[ jQuery.expando ] : null,
1138 cache = jQuery.cache, thisCache;
1139
1140 if ( isNode && !id && typeof name === "string" && data === undefined ) {
1141 return;
1142 }
1143
1144 // Get the data from the object directly
1145 if ( !isNode ) {
1146 cache = elem;
1147
1148 // Compute a unique ID for the element
1149 } else if ( !id ) {
1150 elem[ jQuery.expando ] = id = ++jQuery.uuid;
1151 }
1152
1153 // Avoid generating a new cache unless none exists and we
1154 // want to manipulate it.
1155 if ( typeof name === "object" ) {
1156 if ( isNode ) {
1157 cache[ id ] = jQuery.extend(cache[ id ], name);
1158
1159 } else {
1160 jQuery.extend( cache, name );
1161 }
1162
1163 } else if ( isNode && !cache[ id ] ) {
1164 cache[ id ] = {};
1165 }
1166
1167 thisCache = isNode ? cache[ id ] : cache;
1168
1169 // Prevent overriding the named cache with undefined values
1170 if ( data !== undefined ) {
1171 thisCache[ name ] = data;
1172 }
1173
1174 return typeof name === "string" ? thisCache[ name ] : thisCache;
1175 },
1176
1177 removeData: function( elem, name ) {
1178 if ( !jQuery.acceptData( elem ) ) {
1179 return;
1180 }
1181
1182 elem = elem == window ?
1183 windowData :
1184 elem;
1185
1186 var isNode = elem.nodeType,
1187 id = isNode ? elem[ jQuery.expando ] : elem,
1188 cache = jQuery.cache,
1189 thisCache = isNode ? cache[ id ] : id;
1190
1191 // If we want to remove a specific section of the element's data
1192 if ( name ) {
1193 if ( thisCache ) {
1194 // Remove the section of cache data
1195 delete thisCache[ name ];
1196
1197 // If we've removed all the data, remove the element's cache
1198 if ( isNode && jQuery.isEmptyObject(thisCache) ) {
1199 jQuery.removeData( elem );
1200 }
1201 }
1202
1203 // Otherwise, we want to remove all of the element's data
1204 } else {
1205 if ( isNode && jQuery.support.deleteExpando ) {
1206 delete elem[ jQuery.expando ];
1207
1208 } else if ( elem.removeAttribute ) {
1209 elem.removeAttribute( jQuery.expando );
1210
1211 // Completely remove the data cache
1212 } else if ( isNode ) {
1213 delete cache[ id ];
1214
1215 // Remove all fields from the object
1216 } else {
1217 for ( var n in elem ) {
1218 delete elem[ n ];
1219 }
1220 }
1221 }
1222 },
1223
1224 // A method for determining if a DOM node can handle the data expando
1225 acceptData: function( elem ) {
1226 if ( elem.nodeName ) {
1227 var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
1228
1229 if ( match ) {
1230 return !(match === true || elem.getAttribute("classid") !== match);
1231 }
1232 }
1233
1234 return true;
1235 }
1236});
1237
1238jQuery.fn.extend({
1239 data: function( key, value ) {
1240 if ( typeof key === "undefined" ) {
1241 return this.length ? jQuery.data( this[0] ) : null;
1242
1243 } else if ( typeof key === "object" ) {
1244 return this.each(function() {
1245 jQuery.data( this, key );
1246 });
1247 }
1248
1249 var parts = key.split(".");
1250 parts[1] = parts[1] ? "." + parts[1] : "";
1251
1252 if ( value === undefined ) {
1253 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1254
1255 // Try to fetch any internally stored data first
1256 if ( data === undefined && this.length ) {
1257 data = jQuery.data( this[0], key );
1258
1259 // If nothing was found internally, try to fetch any
1260 // data from the HTML5 data-* attribute
1261 if ( data === undefined && this[0].nodeType === 1 ) {
1262 data = this[0].getAttribute( "data-" + key );
1263
1264 if ( typeof data === "string" ) {
1265 try {
1266 data = data === "true" ? true :
1267 data === "false" ? false :
1268 data === "null" ? null :
1269 !jQuery.isNaN( data ) ? parseFloat( data ) :
1270 rbrace.test( data ) ? jQuery.parseJSON( data ) :
1271 data;
1272 } catch( e ) {}
1273
1274 } else {
1275 data = undefined;
1276 }
1277 }
1278 }
1279
1280 return data === undefined && parts[1] ?
1281 this.data( parts[0] ) :
1282 data;
1283
1284 } else {
1285 return this.each(function() {
1286 var $this = jQuery( this ), args = [ parts[0], value ];
1287
1288 $this.triggerHandler( "setData" + parts[1] + "!", args );
1289 jQuery.data( this, key, value );
1290 $this.triggerHandler( "changeData" + parts[1] + "!", args );
1291 });
1292 }
1293 },
1294
1295 removeData: function( key ) {
1296 return this.each(function() {
1297 jQuery.removeData( this, key );
1298 });
1299 }
1300});
1301
1302
1303
1304
1305jQuery.extend({
1306 queue: function( elem, type, data ) {
1307 if ( !elem ) {
1308 return;
1309 }
1310
1311 type = (type || "fx") + "queue";
1312 var q = jQuery.data( elem, type );
1313
1314 // Speed up dequeue by getting out quickly if this is just a lookup
1315 if ( !data ) {
1316 return q || [];
1317 }
1318
1319 if ( !q || jQuery.isArray(data) ) {
1320 q = jQuery.data( elem, type, jQuery.makeArray(data) );
1321
1322 } else {
1323 q.push( data );
1324 }
1325
1326 return q;
1327 },
1328
1329 dequeue: function( elem, type ) {
1330 type = type || "fx";
1331
1332 var queue = jQuery.queue( elem, type ), fn = queue.shift();
1333
1334 // If the fx queue is dequeued, always remove the progress sentinel
1335 if ( fn === "inprogress" ) {
1336 fn = queue.shift();
1337 }
1338
1339 if ( fn ) {
1340 // Add a progress sentinel to prevent the fx queue from being
1341 // automatically dequeued
1342 if ( type === "fx" ) {
1343 queue.unshift("inprogress");
1344 }
1345
1346 fn.call(elem, function() {
1347 jQuery.dequeue(elem, type);
1348 });
1349 }
1350 }
1351});
1352
1353jQuery.fn.extend({
1354 queue: function( type, data ) {
1355 if ( typeof type !== "string" ) {
1356 data = type;
1357 type = "fx";
1358 }
1359
1360 if ( data === undefined ) {
1361 return jQuery.queue( this[0], type );
1362 }
1363 return this.each(function( i ) {
1364 var queue = jQuery.queue( this, type, data );
1365
1366 if ( type === "fx" && queue[0] !== "inprogress" ) {
1367 jQuery.dequeue( this, type );
1368 }
1369 });
1370 },
1371 dequeue: function( type ) {
1372 return this.each(function() {
1373 jQuery.dequeue( this, type );
1374 });
1375 },
1376
1377 // Based off of the plugin by Clint Helfers, with permission.
1378 // http://blindsignals.com/index.php/2009/07/jquery-delay/
1379 delay: function( time, type ) {
1380 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
1381 type = type || "fx";
1382
1383 return this.queue( type, function() {
1384 var elem = this;
1385 setTimeout(function() {
1386 jQuery.dequeue( elem, type );
1387 }, time );
1388 });
1389 },
1390
1391 clearQueue: function( type ) {
1392 return this.queue( type || "fx", [] );
1393 }
1394});
1395
1396
1397
1398
1399var rclass = /[\n\t]/g,
1400 rspaces = /\s+/,
1401 rreturn = /\r/g,
1402 rspecialurl = /^(?:href|src|style)$/,
1403 rtype = /^(?:button|input)$/i,
1404 rfocusable = /^(?:button|input|object|select|textarea)$/i,
1405 rclickable = /^a(?:rea)?$/i,
1406 rradiocheck = /^(?:radio|checkbox)$/i;
1407
1408jQuery.fn.extend({
1409 attr: function( name, value ) {
1410 return jQuery.access( this, name, value, true, jQuery.attr );
1411 },
1412
1413 removeAttr: function( name, fn ) {
1414 return this.each(function(){
1415 jQuery.attr( this, name, "" );
1416 if ( this.nodeType === 1 ) {
1417 this.removeAttribute( name );
1418 }
1419 });
1420 },
1421
1422 addClass: function( value ) {
1423 if ( jQuery.isFunction(value) ) {
1424 return this.each(function(i) {
1425 var self = jQuery(this);
1426 self.addClass( value.call(this, i, self.attr("class")) );
1427 });
1428 }
1429
1430 if ( value && typeof value === "string" ) {
1431 var classNames = (value || "").split( rspaces );
1432
1433 for ( var i = 0, l = this.length; i < l; i++ ) {
1434 var elem = this[i];
1435
1436 if ( elem.nodeType === 1 ) {
1437 if ( !elem.className ) {
1438 elem.className = value;
1439
1440 } else {
1441 var className = " " + elem.className + " ", setClass = elem.className;
1442 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1443 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1444 setClass += " " + classNames[c];
1445 }
1446 }
1447 elem.className = jQuery.trim( setClass );
1448 }
1449 }
1450 }
1451 }
1452
1453 return this;
1454 },
1455
1456 removeClass: function( value ) {
1457 if ( jQuery.isFunction(value) ) {
1458 return this.each(function(i) {
1459 var self = jQuery(this);
1460 self.removeClass( value.call(this, i, self.attr("class")) );
1461 });
1462 }
1463
1464 if ( (value && typeof value === "string") || value === undefined ) {
1465 var classNames = (value || "").split( rspaces );
1466
1467 for ( var i = 0, l = this.length; i < l; i++ ) {
1468 var elem = this[i];
1469
1470 if ( elem.nodeType === 1 && elem.className ) {
1471 if ( value ) {
1472 var className = (" " + elem.className + " ").replace(rclass, " ");
1473 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1474 className = className.replace(" " + classNames[c] + " ", " ");
1475 }
1476 elem.className = jQuery.trim( className );
1477
1478 } else {
1479 elem.className = "";
1480 }
1481 }
1482 }
1483 }
1484
1485 return this;
1486 },
1487
1488 toggleClass: function( value, stateVal ) {
1489 var type = typeof value, isBool = typeof stateVal === "boolean";
1490
1491 if ( jQuery.isFunction( value ) ) {
1492 return this.each(function(i) {
1493 var self = jQuery(this);
1494 self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
1495 });
1496 }
1497
1498 return this.each(function() {
1499 if ( type === "string" ) {
1500 // toggle individual class names
1501 var className, i = 0, self = jQuery(this),
1502 state = stateVal,
1503 classNames = value.split( rspaces );
1504
1505 while ( (className = classNames[ i++ ]) ) {
1506 // check each className given, space seperated list
1507 state = isBool ? state : !self.hasClass( className );
1508 self[ state ? "addClass" : "removeClass" ]( className );
1509 }
1510
1511 } else if ( type === "undefined" || type === "boolean" ) {
1512 if ( this.className ) {
1513 // store className if set
1514 jQuery.data( this, "__className__", this.className );
1515 }
1516
1517 // toggle whole className
1518 this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
1519 }
1520 });
1521 },
1522
1523 hasClass: function( selector ) {
1524 var className = " " + selector + " ";
1525 for ( var i = 0, l = this.length; i < l; i++ ) {
1526 if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
1527 return true;
1528 }
1529 }
1530
1531 return false;
1532 },
1533
1534 val: function( value ) {
1535 if ( !arguments.length ) {
1536 var elem = this[0];
1537
1538 if ( elem ) {
1539 if ( jQuery.nodeName( elem, "option" ) ) {
1540 // attributes.value is undefined in Blackberry 4.7 but
1541 // uses .value. See #6932
1542 var val = elem.attributes.value;
1543 return !val || val.specified ? elem.value : elem.text;
1544 }
1545
1546 // We need to handle select boxes special
1547 if ( jQuery.nodeName( elem, "select" ) ) {
1548 var index = elem.selectedIndex,
1549 values = [],
1550 options = elem.options,
1551 one = elem.type === "select-one";
1552
1553 // Nothing was selected
1554 if ( index < 0 ) {
1555 return null;
1556 }
1557
1558 // Loop through all the selected options
1559 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
1560 var option = options[ i ];
1561
1562 // Don't return options that are disabled or in a disabled optgroup
1563 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1564 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1565
1566 // Get the specific value for the option
1567 value = jQuery(option).val();
1568
1569 // We don't need an array for one selects
1570 if ( one ) {
1571 return value;
1572 }
1573
1574 // Multi-Selects return an array
1575 values.push( value );
1576 }
1577 }
1578
1579 return values;
1580 }
1581
1582 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
1583 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
1584 return elem.getAttribute("value") === null ? "on" : elem.value;
1585 }
1586
1587
1588 // Everything else, we just grab the value
1589 return (elem.value || "").replace(rreturn, "");
1590
1591 }
1592
1593 return undefined;
1594 }
1595
1596 var isFunction = jQuery.isFunction(value);
1597
1598 return this.each(function(i) {
1599 var self = jQuery(this), val = value;
1600
1601 if ( this.nodeType !== 1 ) {
1602 return;
1603 }
1604
1605 if ( isFunction ) {
1606 val = value.call(this, i, self.val());
1607 }
1608
1609 // Treat null/undefined as ""; convert numbers to string
1610 if ( val == null ) {
1611 val = "";
1612 } else if ( typeof val === "number" ) {
1613 val += "";
1614 } else if ( jQuery.isArray(val) ) {
1615 val = jQuery.map(val, function (value) {
1616 return value == null ? "" : value + "";
1617 });
1618 }
1619
1620 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
1621 this.checked = jQuery.inArray( self.val(), val ) >= 0;
1622
1623 } else if ( jQuery.nodeName( this, "select" ) ) {
1624 var values = jQuery.makeArray(val);
1625
1626 jQuery( "option", this ).each(function() {
1627 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
1628 });
1629
1630 if ( !values.length ) {
1631 this.selectedIndex = -1;
1632 }
1633
1634 } else {
1635 this.value = val;
1636 }
1637 });
1638 }
1639});
1640
1641jQuery.extend({
1642 attrFn: {
1643 val: true,
1644 css: true,
1645 html: true,
1646 text: true,
1647 data: true,
1648 width: true,
1649 height: true,
1650 offset: true
1651 },
1652
1653 attr: function( elem, name, value, pass ) {
1654 // don't set attributes on text and comment nodes
1655 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
1656 return undefined;
1657 }
1658
1659 if ( pass && name in jQuery.attrFn ) {
1660 return jQuery(elem)[name](value);
1661 }
1662
1663 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
1664 // Whether we are setting (or getting)
1665 set = value !== undefined;
1666
1667 // Try to normalize/fix the name
1668 name = notxml && jQuery.props[ name ] || name;
1669
1670 // Only do all the following if this is a node (faster for style)
1671 if ( elem.nodeType === 1 ) {
1672 // These attributes require special treatment
1673 var special = rspecialurl.test( name );
1674
1675 // Safari mis-reports the default selected property of an option
1676 // Accessing the parent's selectedIndex property fixes it
1677 if ( name === "selected" && !jQuery.support.optSelected ) {
1678 var parent = elem.parentNode;
1679 if ( parent ) {
1680 parent.selectedIndex;
1681
1682 // Make sure that it also works with optgroups, see #5701
1683 if ( parent.parentNode ) {
1684 parent.parentNode.selectedIndex;
1685 }
1686 }
1687 }
1688
1689 // If applicable, access the attribute via the DOM 0 way
1690 // 'in' checks fail in Blackberry 4.7 #6931
1691 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
1692 if ( set ) {
1693 // We can't allow the type property to be changed (since it causes problems in IE)
1694 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1695 jQuery.error( "type property can't be changed" );
1696 }
1697
1698 if ( value === null ) {
1699 if ( elem.nodeType === 1 ) {
1700 elem.removeAttribute( name );
1701 }
1702
1703 } else {
1704 elem[ name ] = value;
1705 }
1706 }
1707
1708 // browsers index elements by id/name on forms, give priority to attributes.
1709 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
1710 return elem.getAttributeNode( name ).nodeValue;
1711 }
1712
1713 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1714 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1715 if ( name === "tabIndex" ) {
1716 var attributeNode = elem.getAttributeNode( "tabIndex" );
1717
1718 return attributeNode && attributeNode.specified ?
1719 attributeNode.value :
1720 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
1721 0 :
1722 undefined;
1723 }
1724
1725 return elem[ name ];
1726 }
1727
1728 if ( !jQuery.support.style && notxml && name === "style" ) {
1729 if ( set ) {
1730 elem.style.cssText = "" + value;
1731 }
1732
1733 return elem.style.cssText;
1734 }
1735
1736 if ( set ) {
1737 // convert the value to a string (all browsers do this but IE) see #1070
1738 elem.setAttribute( name, "" + value );
1739 }
1740
1741 // Ensure that missing attributes return undefined
1742 // Blackberry 4.7 returns "" from getAttribute #6938
1743 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
1744 return undefined;
1745 }
1746
1747 var attr = !jQuery.support.hrefNormalized && notxml && special ?
1748 // Some attributes require a special call on IE
1749 elem.getAttribute( name, 2 ) :
1750 elem.getAttribute( name );
1751
1752 // Non-existent attributes return null, we normalize to undefined
1753 return attr === null ? undefined : attr;
1754 }
1755 }
1756});
1757
1758
1759
1760
1761var rnamespaces = /\.(.*)$/,
1762 rformElems = /^(?:textarea|input|select)$/i,
1763 rperiod = /\./g,
1764 rspace = / /g,
1765 rescape = /[^\w\s.|`]/g,
1766 fcleanup = function( nm ) {
1767 return nm.replace(rescape, "\\$&");
1768 };
1769
1770/*
1771 * A number of helper functions used for managing events.
1772 * Many of the ideas behind this code originated from
1773 * Dean Edwards' addEvent library.
1774 */
1775jQuery.event = {
1776
1777 // Bind an event to an element
1778 // Original by Dean Edwards
1779 add: function( elem, types, handler, data ) {
1780 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
1781 return;
1782 }
1783
1784 // For whatever reason, IE has trouble passing the window object
1785 // around, causing it to be cloned in the process
1786 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
1787 elem = window;
1788 }
1789
1790 if ( handler === false ) {
1791 handler = returnFalse;
1792 }
1793
1794 var handleObjIn, handleObj;
1795
1796 if ( handler.handler ) {
1797 handleObjIn = handler;
1798 handler = handleObjIn.handler;
1799 }
1800
1801 // Make sure that the function being executed has a unique ID
1802 if ( !handler.guid ) {
1803 handler.guid = jQuery.guid++;
1804 }
1805
1806 // Init the element's event structure
1807 var elemData = jQuery.data( elem );
1808
1809 // If no elemData is found then we must be trying to bind to one of the
1810 // banned noData elements
1811 if ( !elemData ) {
1812 return;
1813 }
1814
1815 var events = elemData.events,
1816 eventHandle = elemData.handle;
1817
1818 if ( typeof events === "function" ) {
1819 // On plain objects events is a fn that holds the the data
1820 // which prevents this data from being JSON serialized
1821 // the function does not need to be called, it just contains the data
1822 eventHandle = events.handle;
1823 events = events.events;
1824
1825 } else if ( !events ) {
1826 if ( !elem.nodeType ) {
1827 // On plain objects, create a fn that acts as the holder
1828 // of the values to avoid JSON serialization of event data
1829 elemData.events = elemData = function(){};
1830 }
1831
1832 elemData.events = events = {};
1833 }
1834
1835 if ( !eventHandle ) {
1836 elemData.handle = eventHandle = function() {
1837 // Handle the second event of a trigger and when
1838 // an event is called after a page has unloaded
1839 return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
1840 jQuery.event.handle.apply( eventHandle.elem, arguments ) :
1841 undefined;
1842 };
1843 }
1844
1845 // Add elem as a property of the handle function
1846 // This is to prevent a memory leak with non-native events in IE.
1847 eventHandle.elem = elem;
1848
1849 // Handle multiple events separated by a space
1850 // jQuery(...).bind("mouseover mouseout", fn);
1851 types = types.split(" ");
1852
1853 var type, i = 0, namespaces;
1854
1855 while ( (type = types[ i++ ]) ) {
1856 handleObj = handleObjIn ?
1857 jQuery.extend({}, handleObjIn) :
1858 { handler: handler, data: data };
1859
1860 // Namespaced event handlers
1861 if ( type.indexOf(".") > -1 ) {
1862 namespaces = type.split(".");
1863 type = namespaces.shift();
1864 handleObj.namespace = namespaces.slice(0).sort().join(".");
1865
1866 } else {
1867 namespaces = [];
1868 handleObj.namespace = "";
1869 }
1870
1871 handleObj.type = type;
1872 if ( !handleObj.guid ) {
1873 handleObj.guid = handler.guid;
1874 }
1875
1876 // Get the current list of functions bound to this event
1877 var handlers = events[ type ],
1878 special = jQuery.event.special[ type ] || {};
1879
1880 // Init the event handler queue
1881 if ( !handlers ) {
1882 handlers = events[ type ] = [];
1883
1884 // Check for a special event handler
1885 // Only use addEventListener/attachEvent if the special
1886 // events handler returns false
1887 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
1888 // Bind the global event handler to the element
1889 if ( elem.addEventListener ) {
1890 elem.addEventListener( type, eventHandle, false );
1891
1892 } else if ( elem.attachEvent ) {
1893 elem.attachEvent( "on" + type, eventHandle );
1894 }
1895 }
1896 }
1897
1898 if ( special.add ) {
1899 special.add.call( elem, handleObj );
1900
1901 if ( !handleObj.handler.guid ) {
1902 handleObj.handler.guid = handler.guid;
1903 }
1904 }
1905
1906 // Add the function to the element's handler list
1907 handlers.push( handleObj );
1908
1909 // Keep track of which events have been used, for global triggering
1910 jQuery.event.global[ type ] = true;
1911 }
1912
1913 // Nullify elem to prevent memory leaks in IE
1914 elem = null;
1915 },
1916
1917 global: {},
1918
1919 // Detach an event or set of events from an element
1920 remove: function( elem, types, handler, pos ) {
1921 // don't do events on text and comment nodes
1922 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
1923 return;
1924 }
1925
1926 if…
Large files files are truncated, but you can click here to view the full file