프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / MarkusLogview / MARKUS_LOGVIEW / Scripts / jquery-1.10.2.js @ 401a87f8

이력 | 보기 | 이력해설 | 다운로드 (268 KB)

1 84578b97 djkim
/* NUGET: BEGIN LICENSE TEXT
2
 *
3
 * Microsoft grants you the right to use these script files for the sole
4
 * purpose of either: (i) interacting through your browser with the Microsoft
5
 * website or online service, subject to the applicable licensing or use
6
 * terms; or (ii) using the files as included with a Microsoft product subject
7
 * to that product's license terms. Microsoft reserves all other rights to the
8
 * files not expressly granted by Microsoft, whether by implication, estoppel
9
 * or otherwise. Insofar as a script file is dual licensed under GPL,
10
 * Microsoft neither took the code under GPL nor distributes it thereunder but
11
 * under the terms set out in this paragraph. All notices and licenses
12
 * below are for informational purposes only.
13
 *
14
 * NUGET: END LICENSE TEXT */
15
/*!
16
 * jQuery JavaScript Library v1.10.2
17
 * http://jquery.com/
18
 *
19
 * Includes Sizzle.js
20
 * http://sizzlejs.com/
21
 *
22
 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
23
 * Released under the MIT license
24
 * http://jquery.org/license
25
 *
26
 * Date: 2013-07-03T13:48Z
27
 */
28
(function( window, undefined ) {
29
30
// Can't do this because several apps including ASP.NET trace
31
// the stack via arguments.caller.callee and Firefox dies if
32
// you try to trace through "use strict" call chains. (#13335)
33
// Support: Firefox 18+
34
//"use strict";
35
var
36
        // The deferred used on DOM ready
37
        readyList,
38
39
        // A central reference to the root jQuery(document)
40
        rootjQuery,
41
42
        // Support: IE<10
43
        // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
44
        core_strundefined = typeof undefined,
45
46
        // Use the correct document accordingly with window argument (sandbox)
47
        location = window.location,
48
        document = window.document,
49
        docElem = document.documentElement,
50
51
        // Map over jQuery in case of overwrite
52
        _jQuery = window.jQuery,
53
54
        // Map over the $ in case of overwrite
55
        _$ = window.$,
56
57
        // [[Class]] -> type pairs
58
        class2type = {},
59
60
        // List of deleted data cache ids, so we can reuse them
61
        core_deletedIds = [],
62
63
        core_version = "1.10.2",
64
65
        // Save a reference to some core methods
66
        core_concat = core_deletedIds.concat,
67
        core_push = core_deletedIds.push,
68
        core_slice = core_deletedIds.slice,
69
        core_indexOf = core_deletedIds.indexOf,
70
        core_toString = class2type.toString,
71
        core_hasOwn = class2type.hasOwnProperty,
72
        core_trim = core_version.trim,
73
74
        // Define a local copy of jQuery
75
        jQuery = function( selector, context ) {
76
                // The jQuery object is actually just the init constructor 'enhanced'
77
                return new jQuery.fn.init( selector, context, rootjQuery );
78
        },
79
80
        // Used for matching numbers
81
        core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
82
83
        // Used for splitting on whitespace
84
        core_rnotwhite = /\S+/g,
85
86
        // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
87
        rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
88
89
        // A simple way to check for HTML strings
90
        // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
91
        // Strict HTML recognition (#11290: must start with <)
92
        rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
93
94
        // Match a standalone tag
95
        rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
96
97
        // JSON RegExp
98
        rvalidchars = /^[\],:{}\s]*$/,
99
        rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
100
        rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
101
        rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
102
103
        // Matches dashed string for camelizing
104
        rmsPrefix = /^-ms-/,
105
        rdashAlpha = /-([\da-z])/gi,
106
107
        // Used by jQuery.camelCase as callback to replace()
108
        fcamelCase = function( all, letter ) {
109
                return letter.toUpperCase();
110
        },
111
112
        // The ready event handler
113
        completed = function( event ) {
114
115
                // readyState === "complete" is good enough for us to call the dom ready in oldIE
116
                if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
117
                        detach();
118
                        jQuery.ready();
119
                }
120
        },
121
        // Clean-up method for dom ready events
122
        detach = function() {
123
                if ( document.addEventListener ) {
124
                        document.removeEventListener( "DOMContentLoaded", completed, false );
125
                        window.removeEventListener( "load", completed, false );
126
127
                } else {
128
                        document.detachEvent( "onreadystatechange", completed );
129
                        window.detachEvent( "onload", completed );
130
                }
131
        };
132
133
jQuery.fn = jQuery.prototype = {
134
        // The current version of jQuery being used
135
        jquery: core_version,
136
137
        constructor: jQuery,
138
        init: function( selector, context, rootjQuery ) {
139
                var match, elem;
140
141
                // HANDLE: $(""), $(null), $(undefined), $(false)
142
                if ( !selector ) {
143
                        return this;
144
                }
145
146
                // Handle HTML strings
147
                if ( typeof selector === "string" ) {
148
                        if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
149
                                // Assume that strings that start and end with <> are HTML and skip the regex check
150
                                match = [ null, selector, null ];
151
152
                        } else {
153
                                match = rquickExpr.exec( selector );
154
                        }
155
156
                        // Match html or make sure no context is specified for #id
157
                        if ( match && (match[1] || !context) ) {
158
159
                                // HANDLE: $(html) -> $(array)
160
                                if ( match[1] ) {
161
                                        context = context instanceof jQuery ? context[0] : context;
162
163
                                        // scripts is true for back-compat
164
                                        jQuery.merge( this, jQuery.parseHTML(
165
                                                match[1],
166
                                                context && context.nodeType ? context.ownerDocument || context : document,
167
                                                true
168
                                        ) );
169
170
                                        // HANDLE: $(html, props)
171
                                        if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
172
                                                for ( match in context ) {
173
                                                        // Properties of context are called as methods if possible
174
                                                        if ( jQuery.isFunction( this[ match ] ) ) {
175
                                                                this[ match ]( context[ match ] );
176
177
                                                        // ...and otherwise set as attributes
178
                                                        } else {
179
                                                                this.attr( match, context[ match ] );
180
                                                        }
181
                                                }
182
                                        }
183
184
                                        return this;
185
186
                                // HANDLE: $(#id)
187
                                } else {
188
                                        elem = document.getElementById( match[2] );
189
190
                                        // Check parentNode to catch when Blackberry 4.6 returns
191
                                        // nodes that are no longer in the document #6963
192
                                        if ( elem && elem.parentNode ) {
193
                                                // Handle the case where IE and Opera return items
194
                                                // by name instead of ID
195
                                                if ( elem.id !== match[2] ) {
196
                                                        return rootjQuery.find( selector );
197
                                                }
198
199
                                                // Otherwise, we inject the element directly into the jQuery object
200
                                                this.length = 1;
201
                                                this[0] = elem;
202
                                        }
203
204
                                        this.context = document;
205
                                        this.selector = selector;
206
                                        return this;
207
                                }
208
209
                        // HANDLE: $(expr, $(...))
210
                        } else if ( !context || context.jquery ) {
211
                                return ( context || rootjQuery ).find( selector );
212
213
                        // HANDLE: $(expr, context)
214
                        // (which is just equivalent to: $(context).find(expr)
215
                        } else {
216
                                return this.constructor( context ).find( selector );
217
                        }
218
219
                // HANDLE: $(DOMElement)
220
                } else if ( selector.nodeType ) {
221
                        this.context = this[0] = selector;
222
                        this.length = 1;
223
                        return this;
224
225
                // HANDLE: $(function)
226
                // Shortcut for document ready
227
                } else if ( jQuery.isFunction( selector ) ) {
228
                        return rootjQuery.ready( selector );
229
                }
230
231
                if ( selector.selector !== undefined ) {
232
                        this.selector = selector.selector;
233
                        this.context = selector.context;
234
                }
235
236
                return jQuery.makeArray( selector, this );
237
        },
238
239
        // Start with an empty selector
240
        selector: "",
241
242
        // The default length of a jQuery object is 0
243
        length: 0,
244
245
        toArray: function() {
246
                return core_slice.call( this );
247
        },
248
249
        // Get the Nth element in the matched element set OR
250
        // Get the whole matched element set as a clean array
251
        get: function( num ) {
252
                return num == null ?
253
254
                        // Return a 'clean' array
255
                        this.toArray() :
256
257
                        // Return just the object
258
                        ( num < 0 ? this[ this.length + num ] : this[ num ] );
259
        },
260
261
        // Take an array of elements and push it onto the stack
262
        // (returning the new matched element set)
263
        pushStack: function( elems ) {
264
265
                // Build a new jQuery matched element set
266
                var ret = jQuery.merge( this.constructor(), elems );
267
268
                // Add the old object onto the stack (as a reference)
269
                ret.prevObject = this;
270
                ret.context = this.context;
271
272
                // Return the newly-formed element set
273
                return ret;
274
        },
275
276
        // Execute a callback for every element in the matched set.
277
        // (You can seed the arguments with an array of args, but this is
278
        // only used internally.)
279
        each: function( callback, args ) {
280
                return jQuery.each( this, callback, args );
281
        },
282
283
        ready: function( fn ) {
284
                // Add the callback
285
                jQuery.ready.promise().done( fn );
286
287
                return this;
288
        },
289
290
        slice: function() {
291
                return this.pushStack( core_slice.apply( this, arguments ) );
292
        },
293
294
        first: function() {
295
                return this.eq( 0 );
296
        },
297
298
        last: function() {
299
                return this.eq( -1 );
300
        },
301
302
        eq: function( i ) {
303
                var len = this.length,
304
                        j = +i + ( i < 0 ? len : 0 );
305
                return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
306
        },
307
308
        map: function( callback ) {
309
                return this.pushStack( jQuery.map(this, function( elem, i ) {
310
                        return callback.call( elem, i, elem );
311
                }));
312
        },
313
314
        end: function() {
315
                return this.prevObject || this.constructor(null);
316
        },
317
318
        // For internal use only.
319
        // Behaves like an Array's method, not like a jQuery method.
320
        push: core_push,
321
        sort: [].sort,
322
        splice: [].splice
323
};
324
325
// Give the init function the jQuery prototype for later instantiation
326
jQuery.fn.init.prototype = jQuery.fn;
327
328
jQuery.extend = jQuery.fn.extend = function() {
329
        var src, copyIsArray, copy, name, options, clone,
330
                target = arguments[0] || {},
331
                i = 1,
332
                length = arguments.length,
333
                deep = false;
334
335
        // Handle a deep copy situation
336
        if ( typeof target === "boolean" ) {
337
                deep = target;
338
                target = arguments[1] || {};
339
                // skip the boolean and the target
340
                i = 2;
341
        }
342
343
        // Handle case when target is a string or something (possible in deep copy)
344
        if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
345
                target = {};
346
        }
347
348
        // extend jQuery itself if only one argument is passed
349
        if ( length === i ) {
350
                target = this;
351
                --i;
352
        }
353
354
        for ( ; i < length; i++ ) {
355
                // Only deal with non-null/undefined values
356
                if ( (options = arguments[ i ]) != null ) {
357
                        // Extend the base object
358
                        for ( name in options ) {
359
                                src = target[ name ];
360
                                copy = options[ name ];
361
362
                                // Prevent never-ending loop
363
                                if ( target === copy ) {
364
                                        continue;
365
                                }
366
367
                                // Recurse if we're merging plain objects or arrays
368
                                if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
369
                                        if ( copyIsArray ) {
370
                                                copyIsArray = false;
371
                                                clone = src && jQuery.isArray(src) ? src : [];
372
373
                                        } else {
374
                                                clone = src && jQuery.isPlainObject(src) ? src : {};
375
                                        }
376
377
                                        // Never move original objects, clone them
378
                                        target[ name ] = jQuery.extend( deep, clone, copy );
379
380
                                // Don't bring in undefined values
381
                                } else if ( copy !== undefined ) {
382
                                        target[ name ] = copy;
383
                                }
384
                        }
385
                }
386
        }
387
388
        // Return the modified object
389
        return target;
390
};
391
392
jQuery.extend({
393
        // Unique for each copy of jQuery on the page
394
        // Non-digits removed to match rinlinejQuery
395
        expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
396
397
        noConflict: function( deep ) {
398
                if ( window.$ === jQuery ) {
399
                        window.$ = _$;
400
                }
401
402
                if ( deep && window.jQuery === jQuery ) {
403
                        window.jQuery = _jQuery;
404
                }
405
406
                return jQuery;
407
        },
408
409
        // Is the DOM ready to be used? Set to true once it occurs.
410
        isReady: false,
411
412
        // A counter to track how many items to wait for before
413
        // the ready event fires. See #6781
414
        readyWait: 1,
415
416
        // Hold (or release) the ready event
417
        holdReady: function( hold ) {
418
                if ( hold ) {
419
                        jQuery.readyWait++;
420
                } else {
421
                        jQuery.ready( true );
422
                }
423
        },
424
425
        // Handle when the DOM is ready
426
        ready: function( wait ) {
427
428
                // Abort if there are pending holds or we're already ready
429
                if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
430
                        return;
431
                }
432
433
                // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
434
                if ( !document.body ) {
435
                        return setTimeout( jQuery.ready );
436
                }
437
438
                // Remember that the DOM is ready
439
                jQuery.isReady = true;
440
441
                // If a normal DOM Ready event fired, decrement, and wait if need be
442
                if ( wait !== true && --jQuery.readyWait > 0 ) {
443
                        return;
444
                }
445
446
                // If there are functions bound, to execute
447
                readyList.resolveWith( document, [ jQuery ] );
448
449
                // Trigger any bound ready events
450
                if ( jQuery.fn.trigger ) {
451
                        jQuery( document ).trigger("ready").off("ready");
452
                }
453
        },
454
455
        // See test/unit/core.js for details concerning isFunction.
456
        // Since version 1.3, DOM methods and functions like alert
457
        // aren't supported. They return false on IE (#2968).
458
        isFunction: function( obj ) {
459
                return jQuery.type(obj) === "function";
460
        },
461
462
        isArray: Array.isArray || function( obj ) {
463
                return jQuery.type(obj) === "array";
464
        },
465
466
        isWindow: function( obj ) {
467
                /* jshint eqeqeq: false */
468
                return obj != null && obj == obj.window;
469
        },
470
471
        isNumeric: function( obj ) {
472
                return !isNaN( parseFloat(obj) ) && isFinite( obj );
473
        },
474
475
        type: function( obj ) {
476
                if ( obj == null ) {
477
                        return String( obj );
478
                }
479
                return typeof obj === "object" || typeof obj === "function" ?
480
                        class2type[ core_toString.call(obj) ] || "object" :
481
                        typeof obj;
482
        },
483
484
        isPlainObject: function( obj ) {
485
                var key;
486
487
                // Must be an Object.
488
                // Because of IE, we also have to check the presence of the constructor property.
489
                // Make sure that DOM nodes and window objects don't pass through, as well
490
                if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
491
                        return false;
492
                }
493
494
                try {
495
                        // Not own constructor property must be Object
496
                        if ( obj.constructor &&
497
                                !core_hasOwn.call(obj, "constructor") &&
498
                                !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
499
                                return false;
500
                        }
501
                } catch ( e ) {
502
                        // IE8,9 Will throw exceptions on certain host objects #9897
503
                        return false;
504
                }
505
506
                // Support: IE<9
507
                // Handle iteration over inherited properties before own properties.
508
                if ( jQuery.support.ownLast ) {
509
                        for ( key in obj ) {
510
                                return core_hasOwn.call( obj, key );
511
                        }
512
                }
513
514
                // Own properties are enumerated firstly, so to speed up,
515
                // if last one is own, then all properties are own.
516
                for ( key in obj ) {}
517
518
                return key === undefined || core_hasOwn.call( obj, key );
519
        },
520
521
        isEmptyObject: function( obj ) {
522
                var name;
523
                for ( name in obj ) {
524
                        return false;
525
                }
526
                return true;
527
        },
528
529
        error: function( msg ) {
530
                throw new Error( msg );
531
        },
532
533
        // data: string of html
534
        // context (optional): If specified, the fragment will be created in this context, defaults to document
535
        // keepScripts (optional): If true, will include scripts passed in the html string
536
        parseHTML: function( data, context, keepScripts ) {
537
                if ( !data || typeof data !== "string" ) {
538
                        return null;
539
                }
540
                if ( typeof context === "boolean" ) {
541
                        keepScripts = context;
542
                        context = false;
543
                }
544
                context = context || document;
545
546
                var parsed = rsingleTag.exec( data ),
547
                        scripts = !keepScripts && [];
548
549
                // Single tag
550
                if ( parsed ) {
551
                        return [ context.createElement( parsed[1] ) ];
552
                }
553
554
                parsed = jQuery.buildFragment( [ data ], context, scripts );
555
                if ( scripts ) {
556
                        jQuery( scripts ).remove();
557
                }
558
                return jQuery.merge( [], parsed.childNodes );
559
        },
560
561
        parseJSON: function( data ) {
562
                // Attempt to parse using the native JSON parser first
563
                if ( window.JSON && window.JSON.parse ) {
564
                        return window.JSON.parse( data );
565
                }
566
567
                if ( data === null ) {
568
                        return data;
569
                }
570
571
                if ( typeof data === "string" ) {
572
573
                        // Make sure leading/trailing whitespace is removed (IE can't handle it)
574
                        data = jQuery.trim( data );
575
576
                        if ( data ) {
577
                                // Make sure the incoming data is actual JSON
578
                                // Logic borrowed from http://json.org/json2.js
579
                                if ( rvalidchars.test( data.replace( rvalidescape, "@" )
580
                                        .replace( rvalidtokens, "]" )
581
                                        .replace( rvalidbraces, "")) ) {
582
583
                                        return ( new Function( "return " + data ) )();
584
                                }
585
                        }
586
                }
587
588
                jQuery.error( "Invalid JSON: " + data );
589
        },
590
591
        // Cross-browser xml parsing
592
        parseXML: function( data ) {
593
                var xml, tmp;
594
                if ( !data || typeof data !== "string" ) {
595
                        return null;
596
                }
597
                try {
598
                        if ( window.DOMParser ) { // Standard
599
                                tmp = new DOMParser();
600
                                xml = tmp.parseFromString( data , "text/xml" );
601
                        } else { // IE
602
                                xml = new ActiveXObject( "Microsoft.XMLDOM" );
603
                                xml.async = "false";
604
                                xml.loadXML( data );
605
                        }
606
                } catch( e ) {
607
                        xml = undefined;
608
                }
609
                if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
610
                        jQuery.error( "Invalid XML: " + data );
611
                }
612
                return xml;
613
        },
614
615
        noop: function() {},
616
617
        // Evaluates a script in a global context
618
        // Workarounds based on findings by Jim Driscoll
619
        // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
620
        globalEval: function( data ) {
621
                if ( data && jQuery.trim( data ) ) {
622
                        // We use execScript on Internet Explorer
623
                        // We use an anonymous function so that context is window
624
                        // rather than jQuery in Firefox
625
                        ( window.execScript || function( data ) {
626
                                window[ "eval" ].call( window, data );
627
                        } )( data );
628
                }
629
        },
630
631
        // Convert dashed to camelCase; used by the css and data modules
632
        // Microsoft forgot to hump their vendor prefix (#9572)
633
        camelCase: function( string ) {
634
                return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
635
        },
636
637
        nodeName: function( elem, name ) {
638
                return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
639
        },
640
641
        // args is for internal usage only
642
        each: function( obj, callback, args ) {
643
                var value,
644
                        i = 0,
645
                        length = obj.length,
646
                        isArray = isArraylike( obj );
647
648
                if ( args ) {
649
                        if ( isArray ) {
650
                                for ( ; i < length; i++ ) {
651
                                        value = callback.apply( obj[ i ], args );
652
653
                                        if ( value === false ) {
654
                                                break;
655
                                        }
656
                                }
657
                        } else {
658
                                for ( i in obj ) {
659
                                        value = callback.apply( obj[ i ], args );
660
661
                                        if ( value === false ) {
662
                                                break;
663
                                        }
664
                                }
665
                        }
666
667
                // A special, fast, case for the most common use of each
668
                } else {
669
                        if ( isArray ) {
670
                                for ( ; i < length; i++ ) {
671
                                        value = callback.call( obj[ i ], i, obj[ i ] );
672
673
                                        if ( value === false ) {
674
                                                break;
675
                                        }
676
                                }
677
                        } else {
678
                                for ( i in obj ) {
679
                                        value = callback.call( obj[ i ], i, obj[ i ] );
680
681
                                        if ( value === false ) {
682
                                                break;
683
                                        }
684
                                }
685
                        }
686
                }
687
688
                return obj;
689
        },
690
691
        // Use native String.trim function wherever possible
692
        trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
693
                function( text ) {
694
                        return text == null ?
695
                                "" :
696
                                core_trim.call( text );
697
                } :
698
699
                // Otherwise use our own trimming functionality
700
                function( text ) {
701
                        return text == null ?
702
                                "" :
703
                                ( text + "" ).replace( rtrim, "" );
704
                },
705
706
        // results is for internal usage only
707
        makeArray: function( arr, results ) {
708
                var ret = results || [];
709
710
                if ( arr != null ) {
711
                        if ( isArraylike( Object(arr) ) ) {
712
                                jQuery.merge( ret,
713
                                        typeof arr === "string" ?
714
                                        [ arr ] : arr
715
                                );
716
                        } else {
717
                                core_push.call( ret, arr );
718
                        }
719
                }
720
721
                return ret;
722
        },
723
724
        inArray: function( elem, arr, i ) {
725
                var len;
726
727
                if ( arr ) {
728
                        if ( core_indexOf ) {
729
                                return core_indexOf.call( arr, elem, i );
730
                        }
731
732
                        len = arr.length;
733
                        i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
734
735
                        for ( ; i < len; i++ ) {
736
                                // Skip accessing in sparse arrays
737
                                if ( i in arr && arr[ i ] === elem ) {
738
                                        return i;
739
                                }
740
                        }
741
                }
742
743
                return -1;
744
        },
745
746
        merge: function( first, second ) {
747
                var l = second.length,
748
                        i = first.length,
749
                        j = 0;
750
751
                if ( typeof l === "number" ) {
752
                        for ( ; j < l; j++ ) {
753
                                first[ i++ ] = second[ j ];
754
                        }
755
                } else {
756
                        while ( second[j] !== undefined ) {
757
                                first[ i++ ] = second[ j++ ];
758
                        }
759
                }
760
761
                first.length = i;
762
763
                return first;
764
        },
765
766
        grep: function( elems, callback, inv ) {
767
                var retVal,
768
                        ret = [],
769
                        i = 0,
770
                        length = elems.length;
771
                inv = !!inv;
772
773
                // Go through the array, only saving the items
774
                // that pass the validator function
775
                for ( ; i < length; i++ ) {
776
                        retVal = !!callback( elems[ i ], i );
777
                        if ( inv !== retVal ) {
778
                                ret.push( elems[ i ] );
779
                        }
780
                }
781
782
                return ret;
783
        },
784
785
        // arg is for internal usage only
786
        map: function( elems, callback, arg ) {
787
                var value,
788
                        i = 0,
789
                        length = elems.length,
790
                        isArray = isArraylike( elems ),
791
                        ret = [];
792
793
                // Go through the array, translating each of the items to their
794
                if ( isArray ) {
795
                        for ( ; i < length; i++ ) {
796
                                value = callback( elems[ i ], i, arg );
797
798
                                if ( value != null ) {
799
                                        ret[ ret.length ] = value;
800
                                }
801
                        }
802
803
                // Go through every key on the object,
804
                } else {
805
                        for ( i in elems ) {
806
                                value = callback( elems[ i ], i, arg );
807
808
                                if ( value != null ) {
809
                                        ret[ ret.length ] = value;
810
                                }
811
                        }
812
                }
813
814
                // Flatten any nested arrays
815
                return core_concat.apply( [], ret );
816
        },
817
818
        // A global GUID counter for objects
819
        guid: 1,
820
821
        // Bind a function to a context, optionally partially applying any
822
        // arguments.
823
        proxy: function( fn, context ) {
824
                var args, proxy, tmp;
825
826
                if ( typeof context === "string" ) {
827
                        tmp = fn[ context ];
828
                        context = fn;
829
                        fn = tmp;
830
                }
831
832
                // Quick check to determine if target is callable, in the spec
833
                // this throws a TypeError, but we will just return undefined.
834
                if ( !jQuery.isFunction( fn ) ) {
835
                        return undefined;
836
                }
837
838
                // Simulated bind
839
                args = core_slice.call( arguments, 2 );
840
                proxy = function() {
841
                        return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
842
                };
843
844
                // Set the guid of unique handler to the same of original handler, so it can be removed
845
                proxy.guid = fn.guid = fn.guid || jQuery.guid++;
846
847
                return proxy;
848
        },
849
850
        // Multifunctional method to get and set values of a collection
851
        // The value/s can optionally be executed if it's a function
852
        access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
853
                var i = 0,
854
                        length = elems.length,
855
                        bulk = key == null;
856
857
                // Sets many values
858
                if ( jQuery.type( key ) === "object" ) {
859
                        chainable = true;
860
                        for ( i in key ) {
861
                                jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
862
                        }
863
864
                // Sets one value
865
                } else if ( value !== undefined ) {
866
                        chainable = true;
867
868
                        if ( !jQuery.isFunction( value ) ) {
869
                                raw = true;
870
                        }
871
872
                        if ( bulk ) {
873
                                // Bulk operations run against the entire set
874
                                if ( raw ) {
875
                                        fn.call( elems, value );
876
                                        fn = null;
877
878
                                // ...except when executing function values
879
                                } else {
880
                                        bulk = fn;
881
                                        fn = function( elem, key, value ) {
882
                                                return bulk.call( jQuery( elem ), value );
883
                                        };
884
                                }
885
                        }
886
887
                        if ( fn ) {
888
                                for ( ; i < length; i++ ) {
889
                                        fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
890
                                }
891
                        }
892
                }
893
894
                return chainable ?
895
                        elems :
896
897
                        // Gets
898
                        bulk ?
899
                                fn.call( elems ) :
900
                                length ? fn( elems[0], key ) : emptyGet;
901
        },
902
903
        now: function() {
904
                return ( new Date() ).getTime();
905
        },
906
907
        // A method for quickly swapping in/out CSS properties to get correct calculations.
908
        // Note: this method belongs to the css module but it's needed here for the support module.
909
        // If support gets modularized, this method should be moved back to the css module.
910
        swap: function( elem, options, callback, args ) {
911
                var ret, name,
912
                        old = {};
913
914
                // Remember the old values, and insert the new ones
915
                for ( name in options ) {
916
                        old[ name ] = elem.style[ name ];
917
                        elem.style[ name ] = options[ name ];
918
                }
919
920
                ret = callback.apply( elem, args || [] );
921
922
                // Revert the old values
923
                for ( name in options ) {
924
                        elem.style[ name ] = old[ name ];
925
                }
926
927
                return ret;
928
        }
929
});
930
931
jQuery.ready.promise = function( obj ) {
932
        if ( !readyList ) {
933
934
                readyList = jQuery.Deferred();
935
936
                // Catch cases where $(document).ready() is called after the browser event has already occurred.
937
                // we once tried to use readyState "interactive" here, but it caused issues like the one
938
                // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
939
                if ( document.readyState === "complete" ) {
940
                        // Handle it asynchronously to allow scripts the opportunity to delay ready
941
                        setTimeout( jQuery.ready );
942
943
                // Standards-based browsers support DOMContentLoaded
944
                } else if ( document.addEventListener ) {
945
                        // Use the handy event callback
946
                        document.addEventListener( "DOMContentLoaded", completed, false );
947
948
                        // A fallback to window.onload, that will always work
949
                        window.addEventListener( "load", completed, false );
950
951
                // If IE event model is used
952
                } else {
953
                        // Ensure firing before onload, maybe late but safe also for iframes
954
                        document.attachEvent( "onreadystatechange", completed );
955
956
                        // A fallback to window.onload, that will always work
957
                        window.attachEvent( "onload", completed );
958
959
                        // If IE and not a frame
960
                        // continually check to see if the document is ready
961
                        var top = false;
962
963
                        try {
964
                                top = window.frameElement == null && document.documentElement;
965
                        } catch(e) {}
966
967
                        if ( top && top.doScroll ) {
968
                                (function doScrollCheck() {
969
                                        if ( !jQuery.isReady ) {
970
971
                                                try {
972
                                                        // Use the trick by Diego Perini
973
                                                        // http://javascript.nwbox.com/IEContentLoaded/
974
                                                        top.doScroll("left");
975
                                                } catch(e) {
976
                                                        return setTimeout( doScrollCheck, 50 );
977
                                                }
978
979
                                                // detach all dom ready events
980
                                                detach();
981
982
                                                // and execute any waiting functions
983
                                                jQuery.ready();
984
                                        }
985
                                })();
986
                        }
987
                }
988
        }
989
        return readyList.promise( obj );
990
};
991
992
// Populate the class2type map
993
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
994
        class2type[ "[object " + name + "]" ] = name.toLowerCase();
995
});
996
997
function isArraylike( obj ) {
998
        var length = obj.length,
999
                type = jQuery.type( obj );
1000
1001
        if ( jQuery.isWindow( obj ) ) {
1002
                return false;
1003
        }
1004
1005
        if ( obj.nodeType === 1 && length ) {
1006
                return true;
1007
        }
1008
1009
        return type === "array" || type !== "function" &&
1010
                ( length === 0 ||
1011
                typeof length === "number" && length > 0 && ( length - 1 ) in obj );
1012
}
1013
1014
// All jQuery objects should point back to these
1015
rootjQuery = jQuery(document);
1016
/*!
1017
 * Sizzle CSS Selector Engine v1.10.2
1018
 * http://sizzlejs.com/
1019
 *
1020
 * Copyright 2013 jQuery Foundation, Inc. and other contributors
1021
 * Released under the MIT license
1022
 * http://jquery.org/license
1023
 *
1024
 * Date: 2013-07-03
1025
 */
1026
(function( window, undefined ) {
1027
1028
var i,
1029
        support,
1030
        cachedruns,
1031
        Expr,
1032
        getText,
1033
        isXML,
1034
        compile,
1035
        outermostContext,
1036
        sortInput,
1037
1038
        // Local document vars
1039
        setDocument,
1040
        document,
1041
        docElem,
1042
        documentIsHTML,
1043
        rbuggyQSA,
1044
        rbuggyMatches,
1045
        matches,
1046
        contains,
1047
1048
        // Instance-specific data
1049
        expando = "sizzle" + -(new Date()),
1050
        preferredDoc = window.document,
1051
        dirruns = 0,
1052
        done = 0,
1053
        classCache = createCache(),
1054
        tokenCache = createCache(),
1055
        compilerCache = createCache(),
1056
        hasDuplicate = false,
1057
        sortOrder = function( a, b ) {
1058
                if ( a === b ) {
1059
                        hasDuplicate = true;
1060
                        return 0;
1061
                }
1062
                return 0;
1063
        },
1064
1065
        // General-purpose constants
1066
        strundefined = typeof undefined,
1067
        MAX_NEGATIVE = 1 << 31,
1068
1069
        // Instance methods
1070
        hasOwn = ({}).hasOwnProperty,
1071
        arr = [],
1072
        pop = arr.pop,
1073
        push_native = arr.push,
1074
        push = arr.push,
1075
        slice = arr.slice,
1076
        // Use a stripped-down indexOf if we can't use a native one
1077
        indexOf = arr.indexOf || function( elem ) {
1078
                var i = 0,
1079
                        len = this.length;
1080
                for ( ; i < len; i++ ) {
1081
                        if ( this[i] === elem ) {
1082
                                return i;
1083
                        }
1084
                }
1085
                return -1;
1086
        },
1087
1088
        booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
1089
1090
        // Regular expressions
1091
1092
        // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
1093
        whitespace = "[\\x20\\t\\r\\n\\f]",
1094
        // http://www.w3.org/TR/css3-syntax/#characters
1095
        characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
1096
1097
        // Loosely modeled on CSS identifier characters
1098
        // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
1099
        // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
1100
        identifier = characterEncoding.replace( "w", "w#" ),
1101
1102
        // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
1103
        attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
1104
                "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
1105
1106
        // Prefer arguments quoted,
1107
        //   then not containing pseudos/brackets,
1108
        //   then attribute selectors/non-parenthetical expressions,
1109
        //   then anything else
1110
        // These preferences are here to reduce the number of selectors
1111
        //   needing tokenize in the PSEUDO preFilter
1112
        pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
1113
1114
        // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
1115
        rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
1116
1117
        rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
1118
        rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
1119
1120
        rsibling = new RegExp( whitespace + "*[+~]" ),
1121
        rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
1122
1123
        rpseudo = new RegExp( pseudos ),
1124
        ridentifier = new RegExp( "^" + identifier + "$" ),
1125
1126
        matchExpr = {
1127
                "ID": new RegExp( "^#(" + characterEncoding + ")" ),
1128
                "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
1129
                "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
1130
                "ATTR": new RegExp( "^" + attributes ),
1131
                "PSEUDO": new RegExp( "^" + pseudos ),
1132
                "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
1133
                        "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
1134
                        "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
1135
                "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
1136
                // For use in libraries implementing .is()
1137
                // We use this for POS matching in `select`
1138
                "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
1139
                        whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
1140
        },
1141
1142
        rnative = /^[^{]+\{\s*\[native \w/,
1143
1144
        // Easily-parseable/retrievable ID or TAG or CLASS selectors
1145
        rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
1146
1147
        rinputs = /^(?:input|select|textarea|button)$/i,
1148
        rheader = /^h\d$/i,
1149
1150
        rescape = /'|\\/g,
1151
1152
        // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
1153
        runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
1154
        funescape = function( _, escaped, escapedWhitespace ) {
1155
                var high = "0x" + escaped - 0x10000;
1156
                // NaN means non-codepoint
1157
                // Support: Firefox
1158
                // Workaround erroneous numeric interpretation of +"0x"
1159
                return high !== high || escapedWhitespace ?
1160
                        escaped :
1161
                        // BMP codepoint
1162
                        high < 0 ?
1163
                                String.fromCharCode( high + 0x10000 ) :
1164
                                // Supplemental Plane codepoint (surrogate pair)
1165
                                String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
1166
        };
1167
1168
// Optimize for push.apply( _, NodeList )
1169
try {
1170
        push.apply(
1171
                (arr = slice.call( preferredDoc.childNodes )),
1172
                preferredDoc.childNodes
1173
        );
1174
        // Support: Android<4.0
1175
        // Detect silently failing push.apply
1176
        arr[ preferredDoc.childNodes.length ].nodeType;
1177
} catch ( e ) {
1178
        push = { apply: arr.length ?
1179
1180
                // Leverage slice if possible
1181
                function( target, els ) {
1182
                        push_native.apply( target, slice.call(els) );
1183
                } :
1184
1185
                // Support: IE<9
1186
                // Otherwise append directly
1187
                function( target, els ) {
1188
                        var j = target.length,
1189
                                i = 0;
1190
                        // Can't trust NodeList.length
1191
                        while ( (target[j++] = els[i++]) ) {}
1192
                        target.length = j - 1;
1193
                }
1194
        };
1195
}
1196
1197
function Sizzle( selector, context, results, seed ) {
1198
        var match, elem, m, nodeType,
1199
                // QSA vars
1200
                i, groups, old, nid, newContext, newSelector;
1201
1202
        if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
1203
                setDocument( context );
1204
        }
1205
1206
        context = context || document;
1207
        results = results || [];
1208
1209
        if ( !selector || typeof selector !== "string" ) {
1210
                return results;
1211
        }
1212
1213
        if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
1214
                return [];
1215
        }
1216
1217
        if ( documentIsHTML && !seed ) {
1218
1219
                // Shortcuts
1220
                if ( (match = rquickExpr.exec( selector )) ) {
1221
                        // Speed-up: Sizzle("#ID")
1222
                        if ( (m = match[1]) ) {
1223
                                if ( nodeType === 9 ) {
1224
                                        elem = context.getElementById( m );
1225
                                        // Check parentNode to catch when Blackberry 4.6 returns
1226
                                        // nodes that are no longer in the document #6963
1227
                                        if ( elem && elem.parentNode ) {
1228
                                                // Handle the case where IE, Opera, and Webkit return items
1229
                                                // by name instead of ID
1230
                                                if ( elem.id === m ) {
1231
                                                        results.push( elem );
1232
                                                        return results;
1233
                                                }
1234
                                        } else {
1235
                                                return results;
1236
                                        }
1237
                                } else {
1238
                                        // Context is not a document
1239
                                        if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
1240
                                                contains( context, elem ) && elem.id === m ) {
1241
                                                results.push( elem );
1242
                                                return results;
1243
                                        }
1244
                                }
1245
1246
                        // Speed-up: Sizzle("TAG")
1247
                        } else if ( match[2] ) {
1248
                                push.apply( results, context.getElementsByTagName( selector ) );
1249
                                return results;
1250
1251
                        // Speed-up: Sizzle(".CLASS")
1252
                        } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
1253
                                push.apply( results, context.getElementsByClassName( m ) );
1254
                                return results;
1255
                        }
1256
                }
1257
1258
                // QSA path
1259
                if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
1260
                        nid = old = expando;
1261
                        newContext = context;
1262
                        newSelector = nodeType === 9 && selector;
1263
1264
                        // qSA works strangely on Element-rooted queries
1265
                        // We can work around this by specifying an extra ID on the root
1266
                        // and working up from there (Thanks to Andrew Dupont for the technique)
1267
                        // IE 8 doesn't work on object elements
1268
                        if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
1269
                                groups = tokenize( selector );
1270
1271
                                if ( (old = context.getAttribute("id")) ) {
1272
                                        nid = old.replace( rescape, "\\$&" );
1273
                                } else {
1274
                                        context.setAttribute( "id", nid );
1275
                                }
1276
                                nid = "[id='" + nid + "'] ";
1277
1278
                                i = groups.length;
1279
                                while ( i-- ) {
1280
                                        groups[i] = nid + toSelector( groups[i] );
1281
                                }
1282
                                newContext = rsibling.test( selector ) && context.parentNode || context;
1283
                                newSelector = groups.join(",");
1284
                        }
1285
1286
                        if ( newSelector ) {
1287
                                try {
1288
                                        push.apply( results,
1289
                                                newContext.querySelectorAll( newSelector )
1290
                                        );
1291
                                        return results;
1292
                                } catch(qsaError) {
1293
                                } finally {
1294
                                        if ( !old ) {
1295
                                                context.removeAttribute("id");
1296
                                        }
1297
                                }
1298
                        }
1299
                }
1300
        }
1301
1302
        // All others
1303
        return select( selector.replace( rtrim, "$1" ), context, results, seed );
1304
}
1305
1306
/**
1307
 * Create key-value caches of limited size
1308
 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
1309
 *        property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
1310
 *        deleting the oldest entry
1311
 */
1312
function createCache() {
1313
        var keys = [];
1314
1315
        function cache( key, value ) {
1316
                // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
1317
                if ( keys.push( key += " " ) > Expr.cacheLength ) {
1318
                        // Only keep the most recent entries
1319
                        delete cache[ keys.shift() ];
1320
                }
1321
                return (cache[ key ] = value);
1322
        }
1323
        return cache;
1324
}
1325
1326
/**
1327
 * Mark a function for special use by Sizzle
1328
 * @param {Function} fn The function to mark
1329
 */
1330
function markFunction( fn ) {
1331
        fn[ expando ] = true;
1332
        return fn;
1333
}
1334
1335
/**
1336
 * Support testing using an element
1337
 * @param {Function} fn Passed the created div and expects a boolean result
1338
 */
1339
function assert( fn ) {
1340
        var div = document.createElement("div");
1341
1342
        try {
1343
                return !!fn( div );
1344
        } catch (e) {
1345
                return false;
1346
        } finally {
1347
                // Remove from its parent by default
1348
                if ( div.parentNode ) {
1349
                        div.parentNode.removeChild( div );
1350
                }
1351
                // release memory in IE
1352
                div = null;
1353
        }
1354
}
1355
1356
/**
1357
 * Adds the same handler for all of the specified attrs
1358
 * @param {String} attrs Pipe-separated list of attributes
1359
 * @param {Function} handler The method that will be applied
1360
 */
1361
function addHandle( attrs, handler ) {
1362
        var arr = attrs.split("|"),
1363
                i = attrs.length;
1364
1365
        while ( i-- ) {
1366
                Expr.attrHandle[ arr[i] ] = handler;
1367
        }
1368
}
1369
1370
/**
1371
 * Checks document order of two siblings
1372
 * @param {Element} a
1373
 * @param {Element} b
1374
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
1375
 */
1376
function siblingCheck( a, b ) {
1377
        var cur = b && a,
1378
                diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
1379
                        ( ~b.sourceIndex || MAX_NEGATIVE ) -
1380
                        ( ~a.sourceIndex || MAX_NEGATIVE );
1381
1382
        // Use IE sourceIndex if available on both nodes
1383
        if ( diff ) {
1384
                return diff;
1385
        }
1386
1387
        // Check if b follows a
1388
        if ( cur ) {
1389
                while ( (cur = cur.nextSibling) ) {
1390
                        if ( cur === b ) {
1391
                                return -1;
1392
                        }
1393
                }
1394
        }
1395
1396
        return a ? 1 : -1;
1397
}
1398
1399
/**
1400
 * Returns a function to use in pseudos for input types
1401
 * @param {String} type
1402
 */
1403
function createInputPseudo( type ) {
1404
        return function( elem ) {
1405
                var name = elem.nodeName.toLowerCase();
1406
                return name === "input" && elem.type === type;
1407
        };
1408
}
1409
1410
/**
1411
 * Returns a function to use in pseudos for buttons
1412
 * @param {String} type
1413
 */
1414
function createButtonPseudo( type ) {
1415
        return function( elem ) {
1416
                var name = elem.nodeName.toLowerCase();
1417
                return (name === "input" || name === "button") && elem.type === type;
1418
        };
1419
}
1420
1421
/**
1422
 * Returns a function to use in pseudos for positionals
1423
 * @param {Function} fn
1424
 */
1425
function createPositionalPseudo( fn ) {
1426
        return markFunction(function( argument ) {
1427
                argument = +argument;
1428
                return markFunction(function( seed, matches ) {
1429
                        var j,
1430
                                matchIndexes = fn( [], seed.length, argument ),
1431
                                i = matchIndexes.length;
1432
1433
                        // Match elements found at the specified indexes
1434
                        while ( i-- ) {
1435
                                if ( seed[ (j = matchIndexes[i]) ] ) {
1436
                                        seed[j] = !(matches[j] = seed[j]);
1437
                                }
1438
                        }
1439
                });
1440
        });
1441
}
1442
1443
/**
1444
 * Detect xml
1445
 * @param {Element|Object} elem An element or a document
1446
 */
1447
isXML = Sizzle.isXML = function( elem ) {
1448
        // documentElement is verified for cases where it doesn't yet exist
1449
        // (such as loading iframes in IE - #4833)
1450
        var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1451
        return documentElement ? documentElement.nodeName !== "HTML" : false;
1452
};
1453
1454
// Expose support vars for convenience
1455
support = Sizzle.support = {};
1456
1457
/**
1458
 * Sets document-related variables once based on the current document
1459
 * @param {Element|Object} [doc] An element or document object to use to set the document
1460
 * @returns {Object} Returns the current document
1461
 */
1462
setDocument = Sizzle.setDocument = function( node ) {
1463
        var doc = node ? node.ownerDocument || node : preferredDoc,
1464
                parent = doc.defaultView;
1465
1466
        // If no document and documentElement is available, return
1467
        if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1468
                return document;
1469
        }
1470
1471
        // Set our document
1472
        document = doc;
1473
        docElem = doc.documentElement;
1474
1475
        // Support tests
1476
        documentIsHTML = !isXML( doc );
1477
1478
        // Support: IE>8
1479
        // If iframe document is assigned to "document" variable and if iframe has been reloaded,
1480
        // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1481
        // IE6-8 do not support the defaultView property so parent will be undefined
1482
        if ( parent && parent.attachEvent && parent !== parent.top ) {
1483
                parent.attachEvent( "onbeforeunload", function() {
1484
                        setDocument();
1485
                });
1486
        }
1487
1488
        /* Attributes
1489
        ---------------------------------------------------------------------- */
1490
1491
        // Support: IE<8
1492
        // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
1493
        support.attributes = assert(function( div ) {
1494
                div.className = "i";
1495
                return !div.getAttribute("className");
1496
        });
1497
1498
        /* getElement(s)By*
1499
        ---------------------------------------------------------------------- */
1500
1501
        // Check if getElementsByTagName("*") returns only elements
1502
        support.getElementsByTagName = assert(function( div ) {
1503
                div.appendChild( doc.createComment("") );
1504
                return !div.getElementsByTagName("*").length;
1505
        });
1506
1507
        // Check if getElementsByClassName can be trusted
1508
        support.getElementsByClassName = assert(function( div ) {
1509
                div.innerHTML = "<div class='a'></div><div class='a i'></div>";
1510
1511
                // Support: Safari<4
1512
                // Catch class over-caching
1513
                div.firstChild.className = "i";
1514
                // Support: Opera<10
1515
                // Catch gEBCN failure to find non-leading classes
1516
                return div.getElementsByClassName("i").length === 2;
1517
        });
1518
1519
        // Support: IE<10
1520
        // Check if getElementById returns elements by name
1521
        // The broken getElementById methods don't pick up programatically-set names,
1522
        // so use a roundabout getElementsByName test
1523
        support.getById = assert(function( div ) {
1524
                docElem.appendChild( div ).id = expando;
1525
                return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1526
        });
1527
1528
        // ID find and filter
1529
        if ( support.getById ) {
1530
                Expr.find["ID"] = function( id, context ) {
1531
                        if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
1532
                                var m = context.getElementById( id );
1533
                                // Check parentNode to catch when Blackberry 4.6 returns
1534
                                // nodes that are no longer in the document #6963
1535
                                return m && m.parentNode ? [m] : [];
1536
                        }
1537
                };
1538
                Expr.filter["ID"] = function( id ) {
1539
                        var attrId = id.replace( runescape, funescape );
1540
                        return function( elem ) {
1541
                                return elem.getAttribute("id") === attrId;
1542
                        };
1543
                };
1544
        } else {
1545
                // Support: IE6/7
1546
                // getElementById is not reliable as a find shortcut
1547
                delete Expr.find["ID"];
1548
1549
                Expr.filter["ID"] =  function( id ) {
1550
                        var attrId = id.replace( runescape, funescape );
1551
                        return function( elem ) {
1552
                                var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
1553
                                return node && node.value === attrId;
1554
                        };
1555
                };
1556
        }
1557
1558
        // Tag
1559
        Expr.find["TAG"] = support.getElementsByTagName ?
1560
                function( tag, context ) {
1561
                        if ( typeof context.getElementsByTagName !== strundefined ) {
1562
                                return context.getElementsByTagName( tag );
1563
                        }
1564
                } :
1565
                function( tag, context ) {
1566
                        var elem,
1567
                                tmp = [],
1568
                                i = 0,
1569
                                results = context.getElementsByTagName( tag );
1570
1571
                        // Filter out possible comments
1572
                        if ( tag === "*" ) {
1573
                                while ( (elem = results[i++]) ) {
1574
                                        if ( elem.nodeType === 1 ) {
1575
                                                tmp.push( elem );
1576
                                        }
1577
                                }
1578
1579
                                return tmp;
1580
                        }
1581
                        return results;
1582
                };
1583
1584
        // Class
1585
        Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1586
                if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
1587
                        return context.getElementsByClassName( className );
1588
                }
1589
        };
1590
1591
        /* QSA/matchesSelector
1592
        ---------------------------------------------------------------------- */
1593
1594
        // QSA and matchesSelector support
1595
1596
        // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1597
        rbuggyMatches = [];
1598
1599
        // qSa(:focus) reports false when true (Chrome 21)
1600
        // We allow this because of a bug in IE8/9 that throws an error
1601
        // whenever `document.activeElement` is accessed on an iframe
1602
        // So, we allow :focus to pass through QSA all the time to avoid the IE error
1603
        // See http://bugs.jquery.com/ticket/13378
1604
        rbuggyQSA = [];
1605
1606
        if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1607
                // Build QSA regex
1608
                // Regex strategy adopted from Diego Perini
1609
                assert(function( div ) {
1610
                        // Select is set to empty string on purpose
1611
                        // This is to test IE's treatment of not explicitly
1612
                        // setting a boolean content attribute,
1613
                        // since its presence should be enough
1614
                        // http://bugs.jquery.com/ticket/12359
1615
                        div.innerHTML = "<select><option selected=''></option></select>";
1616
1617
                        // Support: IE8
1618
                        // Boolean attributes and "value" are not treated correctly
1619
                        if ( !div.querySelectorAll("[selected]").length ) {
1620
                                rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1621
                        }
1622
1623
                        // Webkit/Opera - :checked should return selected option elements
1624
                        // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1625
                        // IE8 throws error here and will not see later tests
1626
                        if ( !div.querySelectorAll(":checked").length ) {
1627
                                rbuggyQSA.push(":checked");
1628
                        }
1629
                });
1630
1631
                assert(function( div ) {
1632
1633
                        // Support: Opera 10-12/IE8
1634
                        // ^= $= *= and empty values
1635
                        // Should not select anything
1636
                        // Support: Windows 8 Native Apps
1637
                        // The type attribute is restricted during .innerHTML assignment
1638
                        var input = doc.createElement("input");
1639
                        input.setAttribute( "type", "hidden" );
1640
                        div.appendChild( input ).setAttribute( "t", "" );
1641
1642
                        if ( div.querySelectorAll("[t^='']").length ) {
1643
                                rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1644
                        }
1645
1646
                        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1647
                        // IE8 throws error here and will not see later tests
1648
                        if ( !div.querySelectorAll(":enabled").length ) {
1649
                                rbuggyQSA.push( ":enabled", ":disabled" );
1650
                        }
1651
1652
                        // Opera 10-11 does not throw on post-comma invalid pseudos
1653
                        div.querySelectorAll("*,:x");
1654
                        rbuggyQSA.push(",.*:");
1655
                });
1656
        }
1657
1658
        if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
1659
                docElem.mozMatchesSelector ||
1660
                docElem.oMatchesSelector ||
1661
                docElem.msMatchesSelector) )) ) {
1662
1663
                assert(function( div ) {
1664
                        // Check to see if it's possible to do matchesSelector
1665
                        // on a disconnected node (IE 9)
1666
                        support.disconnectedMatch = matches.call( div, "div" );
1667
1668
                        // This should fail with an exception
1669
                        // Gecko does not error, returns false instead
1670
                        matches.call( div, "[s!='']:x" );
1671
                        rbuggyMatches.push( "!=", pseudos );
1672
                });
1673
        }
1674
1675
        rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1676
        rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1677
1678
        /* Contains
1679
        ---------------------------------------------------------------------- */
1680
1681
        // Element contains another
1682
        // Purposefully does not implement inclusive descendent
1683
        // As in, an element does not contain itself
1684
        contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
1685
                function( a, b ) {
1686
                        var adown = a.nodeType === 9 ? a.documentElement : a,
1687
                                bup = b && b.parentNode;
1688
                        return a === bup || !!( bup && bup.nodeType === 1 && (
1689
                                adown.contains ?
1690
                                        adown.contains( bup ) :
1691
                                        a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1692
                        ));
1693
                } :
1694
                function( a, b ) {
1695
                        if ( b ) {
1696
                                while ( (b = b.parentNode) ) {
1697
                                        if ( b === a ) {
1698
                                                return true;
1699
                                        }
1700
                                }
1701
                        }
1702
                        return false;
1703
                };
1704
1705
        /* Sorting
1706
        ---------------------------------------------------------------------- */
1707
1708
        // Document order sorting
1709
        sortOrder = docElem.compareDocumentPosition ?
1710
        function( a, b ) {
1711
1712
                // Flag for duplicate removal
1713
                if ( a === b ) {
1714
                        hasDuplicate = true;
1715
                        return 0;
1716
                }
1717
1718
                var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
1719
1720
                if ( compare ) {
1721
                        // Disconnected nodes
1722
                        if ( compare & 1 ||
1723
                                (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1724
1725
                                // Choose the first element that is related to our preferred document
1726
                                if ( a === doc || contains(preferredDoc, a) ) {
1727
                                        return -1;
1728
                                }
1729
                                if ( b === doc || contains(preferredDoc, b) ) {
1730
                                        return 1;
1731
                                }
1732
1733
                                // Maintain original order
1734
                                return sortInput ?
1735
                                        ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1736
                                        0;
1737
                        }
1738
1739
                        return compare & 4 ? -1 : 1;
1740
                }
1741
1742
                // Not directly comparable, sort on existence of method
1743
                return a.compareDocumentPosition ? -1 : 1;
1744
        } :
1745
        function( a, b ) {
1746
                var cur,
1747
                        i = 0,
1748
                        aup = a.parentNode,
1749
                        bup = b.parentNode,
1750
                        ap = [ a ],
1751
                        bp = [ b ];
1752
1753
                // Exit early if the nodes are identical
1754
                if ( a === b ) {
1755
                        hasDuplicate = true;
1756
                        return 0;
1757
1758
                // Parentless nodes are either documents or disconnected
1759
                } else if ( !aup || !bup ) {
1760
                        return a === doc ? -1 :
1761
                                b === doc ? 1 :
1762
                                aup ? -1 :
1763
                                bup ? 1 :
1764
                                sortInput ?
1765
                                ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1766
                                0;
1767
1768
                // If the nodes are siblings, we can do a quick check
1769
                } else if ( aup === bup ) {
1770
                        return siblingCheck( a, b );
1771
                }
1772
1773
                // Otherwise we need full lists of their ancestors for comparison
1774
                cur = a;
1775
                while ( (cur = cur.parentNode) ) {
1776
                        ap.unshift( cur );
1777
                }
1778
                cur = b;
1779
                while ( (cur = cur.parentNode) ) {
1780
                        bp.unshift( cur );
1781
                }
1782
1783
                // Walk down the tree looking for a discrepancy
1784
                while ( ap[i] === bp[i] ) {
1785
                        i++;
1786
                }
1787
1788
                return i ?
1789
                        // Do a sibling check if the nodes have a common ancestor
1790
                        siblingCheck( ap[i], bp[i] ) :
1791
1792
                        // Otherwise nodes in our document sort first
1793
                        ap[i] === preferredDoc ? -1 :
1794
                        bp[i] === preferredDoc ? 1 :
1795
                        0;
1796
        };
1797
1798
        return doc;
1799
};
1800
1801
Sizzle.matches = function( expr, elements ) {
1802
        return Sizzle( expr, null, null, elements );
1803
};
1804
1805
Sizzle.matchesSelector = function( elem, expr ) {
1806
        // Set document vars if needed
1807
        if ( ( elem.ownerDocument || elem ) !== document ) {
1808
                setDocument( elem );
1809
        }
1810
1811
        // Make sure that attribute selectors are quoted
1812
        expr = expr.replace( rattributeQuotes, "='$1']" );
1813
1814
        if ( support.matchesSelector && documentIsHTML &&
1815
                ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1816
                ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1817
1818
                try {
1819
                        var ret = matches.call( elem, expr );
1820
1821
                        // IE 9's matchesSelector returns false on disconnected nodes
1822
                        if ( ret || support.disconnectedMatch ||
1823
                                        // As well, disconnected nodes are said to be in a document
1824
                                        // fragment in IE 9
1825
                                        elem.document && elem.document.nodeType !== 11 ) {
1826
                                return ret;
1827
                        }
1828
                } catch(e) {}
1829
        }
1830
1831
        return Sizzle( expr, document, null, [elem] ).length > 0;
1832
};
1833
1834
Sizzle.contains = function( context, elem ) {
1835
        // Set document vars if needed
1836
        if ( ( context.ownerDocument || context ) !== document ) {
1837
                setDocument( context );
1838
        }
1839
        return contains( context, elem );
1840
};
1841
1842
Sizzle.attr = function( elem, name ) {
1843
        // Set document vars if needed
1844
        if ( ( elem.ownerDocument || elem ) !== document ) {
1845
                setDocument( elem );
1846
        }
1847
1848
        var fn = Expr.attrHandle[ name.toLowerCase() ],
1849
                // Don't get fooled by Object.prototype properties (jQuery #13807)
1850
                val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1851
                        fn( elem, name, !documentIsHTML ) :
1852
                        undefined;
1853
1854
        return val === undefined ?
1855
                support.attributes || !documentIsHTML ?
1856
                        elem.getAttribute( name ) :
1857
                        (val = elem.getAttributeNode(name)) && val.specified ?
1858
                                val.value :
1859
                                null :
1860
                val;
1861
};
1862
1863
Sizzle.error = function( msg ) {
1864
        throw new Error( "Syntax error, unrecognized expression: " + msg );
1865
};
1866
1867
/**
1868
 * Document sorting and removing duplicates
1869
 * @param {ArrayLike} results
1870
 */
1871
Sizzle.uniqueSort = function( results ) {
1872
        var elem,
1873
                duplicates = [],
1874
                j = 0,
1875
                i = 0;
1876
1877
        // Unless we *know* we can detect duplicates, assume their presence
1878
        hasDuplicate = !support.detectDuplicates;
1879
        sortInput = !support.sortStable && results.slice( 0 );
1880
        results.sort( sortOrder );
1881
1882
        if ( hasDuplicate ) {
1883
                while ( (elem = results[i++]) ) {
1884
                        if ( elem === results[ i ] ) {
1885
                                j = duplicates.push( i );
1886
                        }
1887
                }
1888
                while ( j-- ) {
1889
                        results.splice( duplicates[ j ], 1 );
1890
                }
1891
        }
1892
1893
        return results;
1894
};
1895
1896
/**
1897
 * Utility function for retrieving the text value of an array of DOM nodes
1898
 * @param {Array|Element} elem
1899
 */
1900
getText = Sizzle.getText = function( elem ) {
1901
        var node,
1902
                ret = "",
1903
                i = 0,
1904
                nodeType = elem.nodeType;
1905
1906
        if ( !nodeType ) {
1907
                // If no nodeType, this is expected to be an array
1908
                for ( ; (node = elem[i]); i++ ) {
1909
                        // Do not traverse comment nodes
1910
                        ret += getText( node );
1911
                }
1912
        } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1913
                // Use textContent for elements
1914
                // innerText usage removed for consistency of new lines (see #11153)
1915
                if ( typeof elem.textContent === "string" ) {
1916
                        return elem.textContent;
1917
                } else {
1918
                        // Traverse its children
1919
                        for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1920
                                ret += getText( elem );
1921
                        }
1922
                }
1923
        } else if ( nodeType === 3 || nodeType === 4 ) {
1924
                return elem.nodeValue;
1925
        }
1926
        // Do not include comment or processing instruction nodes
1927
1928
        return ret;
1929
};
1930
1931
Expr = Sizzle.selectors = {
1932
1933
        // Can be adjusted by the user
1934
        cacheLength: 50,
1935
1936
        createPseudo: markFunction,
1937
1938
        match: matchExpr,
1939
1940
        attrHandle: {},
1941
1942
        find: {},
1943
1944
        relative: {
1945
                ">": { dir: "parentNode", first: true },
1946
                " ": { dir: "parentNode" },
1947
                "+": { dir: "previousSibling", first: true },
1948
                "~": { dir: "previousSibling" }
1949
        },
1950
1951
        preFilter: {
1952
                "ATTR": function( match ) {
1953
                        match[1] = match[1].replace( runescape, funescape );
1954
1955
                        // Move the given value to match[3] whether quoted or unquoted
1956
                        match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
1957
1958
                        if ( match[2] === "~=" ) {
1959
                                match[3] = " " + match[3] + " ";
1960
                        }
1961
1962
                        return match.slice( 0, 4 );
1963
                },
1964
1965
                "CHILD": function( match ) {
1966
                        /* matches from matchExpr["CHILD"]
1967
                                1 type (only|nth|...)
1968
                                2 what (child|of-type)
1969
                                3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1970
                                4 xn-component of xn+y argument ([+-]?\d*n|)
1971
                                5 sign of xn-component
1972
                                6 x of xn-component
1973
                                7 sign of y-component
1974
                                8 y of y-component
1975
                        */
1976
                        match[1] = match[1].toLowerCase();
1977
1978
                        if ( match[1].slice( 0, 3 ) === "nth" ) {
1979
                                // nth-* requires argument
1980
                                if ( !match[3] ) {
1981
                                        Sizzle.error( match[0] );
1982
                                }
1983
1984
                                // numeric x and y parameters for Expr.filter.CHILD
1985
                                // remember that false/true cast respectively to 0/1
1986
                                match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1987
                                match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1988
1989
                        // other types prohibit arguments
1990
                        } else if ( match[3] ) {
1991
                                Sizzle.error( match[0] );
1992
                        }
1993
1994
                        return match;
1995
                },
1996
1997
                "PSEUDO": function( match ) {
1998
                        var excess,
1999
                                unquoted = !match[5] && match[2];
2000
2001
                        if ( matchExpr["CHILD"].test( match[0] ) ) {
2002
                                return null;
2003
                        }
2004
2005
                        // Accept quoted arguments as-is
2006
                        if ( match[3] && match[4] !== undefined ) {
2007
                                match[2] = match[4];
2008
2009
                        // Strip excess characters from unquoted arguments
2010
                        } else if ( unquoted && rpseudo.test( unquoted ) &&
2011
                                // Get excess from tokenize (recursively)
2012
                                (excess = tokenize( unquoted, true )) &&
2013
                                // advance to the next closing parenthesis
2014
                                (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
2015
2016
                                // excess is a negative index
2017
                                match[0] = match[0].slice( 0, excess );
2018
                                match[2] = unquoted.slice( 0, excess );
2019
                        }
2020
2021
                        // Return only captures needed by the pseudo filter method (type and argument)
2022
                        return match.slice( 0, 3 );
2023
                }
2024
        },
2025
2026
        filter: {
2027
2028
                "TAG": function( nodeNameSelector ) {
2029
                        var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
2030
                        return nodeNameSelector === "*" ?
2031
                                function() { return true; } :
2032
                                function( elem ) {
2033
                                        return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
2034
                                };
2035
                },
2036
2037
                "CLASS": function( className ) {
2038
                        var pattern = classCache[ className + " " ];
2039
2040
                        return pattern ||
2041
                                (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
2042
                                classCache( className, function( elem ) {
2043
                                        return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
2044
                                });
2045
                },
2046
2047
                "ATTR": function( name, operator, check ) {
2048
                        return function( elem ) {
2049
                                var result = Sizzle.attr( elem, name );
2050
2051
                                if ( result == null ) {
2052
                                        return operator === "!=";
2053
                                }
2054
                                if ( !operator ) {
2055
                                        return true;
2056
                                }
2057
2058
                                result += "";
2059
2060
                                return operator === "=" ? result === check :
2061
                                        operator === "!=" ? result !== check :
2062
                                        operator === "^=" ? check && result.indexOf( check ) === 0 :
2063
                                        operator === "*=" ? check && result.indexOf( check ) > -1 :
2064
                                        operator === "$=" ? check && result.slice( -check.length ) === check :
2065
                                        operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
2066
                                        operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
2067
                                        false;
2068
                        };
2069
                },
2070
2071
                "CHILD": function( type, what, argument, first, last ) {
2072
                        var simple = type.slice( 0, 3 ) !== "nth",
2073
                                forward = type.slice( -4 ) !== "last",
2074
                                ofType = what === "of-type";
2075
2076
                        return first === 1 && last === 0 ?
2077
2078
                                // Shortcut for :nth-*(n)
2079
                                function( elem ) {
2080
                                        return !!elem.parentNode;
2081
                                } :
2082
2083
                                function( elem, context, xml ) {
2084
                                        var cache, outerCache, node, diff, nodeIndex, start,
2085
                                                dir = simple !== forward ? "nextSibling" : "previousSibling",
2086
                                                parent = elem.parentNode,
2087
                                                name = ofType && elem.nodeName.toLowerCase(),
2088
                                                useCache = !xml && !ofType;
2089
2090
                                        if ( parent ) {
2091
2092
                                                // :(first|last|only)-(child|of-type)
2093
                                                if ( simple ) {
2094
                                                        while ( dir ) {
2095
                                                                node = elem;
2096
                                                                while ( (node = node[ dir ]) ) {
2097
                                                                        if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
2098
                                                                                return false;
2099
                                                                        }
2100
                                                                }
2101
                                                                // Reverse direction for :only-* (if we haven't yet done so)
2102
                                                                start = dir = type === "only" && !start && "nextSibling";
2103
                                                        }
2104
                                                        return true;
2105
                                                }
2106
2107
                                                start = [ forward ? parent.firstChild : parent.lastChild ];
2108
2109
                                                // non-xml :nth-child(...) stores cache data on `parent`
2110
                                                if ( forward && useCache ) {
2111
                                                        // Seek `elem` from a previously-cached index
2112
                                                        outerCache = parent[ expando ] || (parent[ expando ] = {});
2113
                                                        cache = outerCache[ type ] || [];
2114
                                                        nodeIndex = cache[0] === dirruns && cache[1];
2115
                                                        diff = cache[0] === dirruns && cache[2];
2116
                                                        node = nodeIndex && parent.childNodes[ nodeIndex ];
2117
2118
                                                        while ( (node = ++nodeIndex && node && node[ dir ] ||
2119
2120
                                                                // Fallback to seeking `elem` from the start
2121
                                                                (diff = nodeIndex = 0) || start.pop()) ) {
2122
2123
                                                                // When found, cache indexes on `parent` and break
2124
                                                                if ( node.nodeType === 1 && ++diff && node === elem ) {
2125
                                                                        outerCache[ type ] = [ dirruns, nodeIndex, diff ];
2126
                                                                        break;
2127
                                                                }
2128
                                                        }
2129
2130
                                                // Use previously-cached element index if available
2131
                                                } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
2132
                                                        diff = cache[1];
2133
2134
                                                // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
2135
                                                } else {
2136
                                                        // Use the same loop as above to seek `elem` from the start
2137
                                                        while ( (node = ++nodeIndex && node && node[ dir ] ||
2138
                                                                (diff = nodeIndex = 0) || start.pop()) ) {
2139
2140
                                                                if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
2141
                                                                        // Cache the index of each encountered element
2142
                                                                        if ( useCache ) {
2143
                                                                                (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
2144
                                                                        }
2145
2146
                                                                        if ( node === elem ) {
2147
                                                                                break;
2148
                                                                        }
2149
                                                                }
2150
                                                        }
2151
                                                }
2152
2153
                                                // Incorporate the offset, then check against cycle size
2154
                                                diff -= last;
2155
                                                return diff === first || ( diff % first === 0 && diff / first >= 0 );
2156
                                        }
2157
                                };
2158
                },
2159
2160
                "PSEUDO": function( pseudo, argument ) {
2161
                        // pseudo-class names are case-insensitive
2162
                        // http://www.w3.org/TR/selectors/#pseudo-classes
2163
                        // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2164
                        // Remember that setFilters inherits from pseudos
2165
                        var args,
2166
                                fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2167
                                        Sizzle.error( "unsupported pseudo: " + pseudo );
2168
2169
                        // The user may use createPseudo to indicate that
2170
                        // arguments are needed to create the filter function
2171
                        // just as Sizzle does
2172
                        if ( fn[ expando ] ) {
2173
                                return fn( argument );
2174
                        }
2175
2176
                        // But maintain support for old signatures
2177
                        if ( fn.length > 1 ) {
2178
                                args = [ pseudo, pseudo, "", argument ];
2179
                                return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
2180
                                        markFunction(function( seed, matches ) {
2181
                                                var idx,
2182
                                                        matched = fn( seed, argument ),
2183
                                                        i = matched.length;
2184
                                                while ( i-- ) {
2185
                                                        idx = indexOf.call( seed, matched[i] );
2186
                                                        seed[ idx ] = !( matches[ idx ] = matched[i] );
2187
                                                }
2188
                                        }) :
2189
                                        function( elem ) {
2190
                                                return fn( elem, 0, args );
2191
                                        };
2192
                        }
2193
2194
                        return fn;
2195
                }
2196
        },
2197
2198
        pseudos: {
2199
                // Potentially complex pseudos
2200
                "not": markFunction(function( selector ) {
2201
                        // Trim the selector passed to compile
2202
                        // to avoid treating leading and trailing
2203
                        // spaces as combinators
2204
                        var input = [],
2205
                                results = [],
2206
                                matcher = compile( selector.replace( rtrim, "$1" ) );
2207
2208
                        return matcher[ expando ] ?
2209
                                markFunction(function( seed, matches, context, xml ) {
2210
                                        var elem,
2211
                                                unmatched = matcher( seed, null, xml, [] ),
2212
                                                i = seed.length;
2213
2214
                                        // Match elements unmatched by `matcher`
2215
                                        while ( i-- ) {
2216
                                                if ( (elem = unmatched[i]) ) {
2217
                                                        seed[i] = !(matches[i] = elem);
2218
                                                }
2219
                                        }
2220
                                }) :
2221
                                function( elem, context, xml ) {
2222
                                        input[0] = elem;
2223
                                        matcher( input, null, xml, results );
2224
                                        return !results.pop();
2225
                                };
2226
                }),
2227
2228
                "has": markFunction(function( selector ) {
2229
                        return function( elem ) {
2230
                                return Sizzle( selector, elem ).length > 0;
2231
                        };
2232
                }),
2233
2234
                "contains": markFunction(function( text ) {
2235
                        return function( elem ) {
2236
                                return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2237
                        };
2238
                }),
2239
2240
                // "Whether an element is represented by a :lang() selector
2241
                // is based solely on the element's language value
2242
                // being equal to the identifier C,
2243
                // or beginning with the identifier C immediately followed by "-".
2244
                // The matching of C against the element's language value is performed case-insensitively.
2245
                // The identifier C does not have to be a valid language name."
2246
                // http://www.w3.org/TR/selectors/#lang-pseudo
2247
                "lang": markFunction( function( lang ) {
2248
                        // lang value must be a valid identifier
2249
                        if ( !ridentifier.test(lang || "") ) {
2250
                                Sizzle.error( "unsupported lang: " + lang );
2251
                        }
2252
                        lang = lang.replace( runescape, funescape ).toLowerCase();
2253
                        return function( elem ) {
2254
                                var elemLang;
2255
                                do {
2256
                                        if ( (elemLang = documentIsHTML ?
2257
                                                elem.lang :
2258
                                                elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2259
2260
                                                elemLang = elemLang.toLowerCase();
2261
                                                return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2262
                                        }
2263
                                } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2264
                                return false;
2265
                        };
2266
                }),
2267
2268
                // Miscellaneous
2269
                "target": function( elem ) {
2270
                        var hash = window.location && window.location.hash;
2271
                        return hash && hash.slice( 1 ) === elem.id;
2272
                },
2273
2274
                "root": function( elem ) {
2275
                        return elem === docElem;
2276
                },
2277
2278
                "focus": function( elem ) {
2279
                        return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2280
                },
2281
2282
                // Boolean properties
2283
                "enabled": function( elem ) {
2284
                        return elem.disabled === false;
2285
                },
2286
2287
                "disabled": function( elem ) {
2288
                        return elem.disabled === true;
2289
                },
2290
2291
                "checked": function( elem ) {
2292
                        // In CSS3, :checked should return both checked and selected elements
2293
                        // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2294
                        var nodeName = elem.nodeName.toLowerCase();
2295
                        return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2296
                },
2297
2298
                "selected": function( elem ) {
2299
                        // Accessing this property makes selected-by-default
2300
                        // options in Safari work properly
2301
                        if ( elem.parentNode ) {
2302
                                elem.parentNode.selectedIndex;
2303
                        }
2304
2305
                        return elem.selected === true;
2306
                },
2307
2308
                // Contents
2309
                "empty": function( elem ) {
2310
                        // http://www.w3.org/TR/selectors/#empty-pseudo
2311
                        // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
2312
                        //   not comment, processing instructions, or others
2313
                        // Thanks to Diego Perini for the nodeName shortcut
2314
                        //   Greater than "@" means alpha characters (specifically not starting with "#" or "?")
2315
                        for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2316
                                if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
2317
                                        return false;
2318
                                }
2319
                        }
2320
                        return true;
2321
                },
2322
2323
                "parent": function( elem ) {
2324
                        return !Expr.pseudos["empty"]( elem );
2325
                },
2326
2327
                // Element/input types
2328
                "header": function( elem ) {
2329
                        return rheader.test( elem.nodeName );
2330
                },
2331
2332
                "input": function( elem ) {
2333
                        return rinputs.test( elem.nodeName );
2334
                },
2335
2336
                "button": function( elem ) {
2337
                        var name = elem.nodeName.toLowerCase();
2338
                        return name === "input" && elem.type === "button" || name === "button";
2339
                },
2340
2341
                "text": function( elem ) {
2342
                        var attr;
2343
                        // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
2344
                        // use getAttribute instead to test this case
2345
                        return elem.nodeName.toLowerCase() === "input" &&
2346
                                elem.type === "text" &&
2347
                                ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
2348
                },
2349
2350
                // Position-in-collection
2351
                "first": createPositionalPseudo(function() {
2352
                        return [ 0 ];
2353
                }),
2354
2355
                "last": createPositionalPseudo(function( matchIndexes, length ) {
2356
                        return [ length - 1 ];
2357
                }),
2358
2359
                "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2360
                        return [ argument < 0 ? argument + length : argument ];
2361
                }),
2362
2363
                "even": createPositionalPseudo(function( matchIndexes, length ) {
2364
                        var i = 0;
2365
                        for ( ; i < length; i += 2 ) {
2366
                                matchIndexes.push( i );
2367
                        }
2368
                        return matchIndexes;
2369
                }),
2370
2371
                "odd": createPositionalPseudo(function( matchIndexes, length ) {
2372
                        var i = 1;
2373
                        for ( ; i < length; i += 2 ) {
2374
                                matchIndexes.push( i );
2375
                        }
2376
                        return matchIndexes;
2377
                }),
2378
2379
                "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2380
                        var i = argument < 0 ? argument + length : argument;
2381
                        for ( ; --i >= 0; ) {
2382
                                matchIndexes.push( i );
2383
                        }
2384
                        return matchIndexes;
2385
                }),
2386
2387
                "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2388
                        var i = argument < 0 ? argument + length : argument;
2389
                        for ( ; ++i < length; ) {
2390
                                matchIndexes.push( i );
2391
                        }
2392
                        return matchIndexes;
2393
                })
2394
        }
2395
};
2396
2397
Expr.pseudos["nth"] = Expr.pseudos["eq"];
2398
2399
// Add button/input type pseudos
2400
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2401
        Expr.pseudos[ i ] = createInputPseudo( i );
2402
}
2403
for ( i in { submit: true, reset: true } ) {
2404
        Expr.pseudos[ i ] = createButtonPseudo( i );
2405
}
2406
2407
// Easy API for creating new setFilters
2408
function setFilters() {}
2409
setFilters.prototype = Expr.filters = Expr.pseudos;
2410
Expr.setFilters = new setFilters();
2411
2412
function tokenize( selector, parseOnly ) {
2413
        var matched, match, tokens, type,
2414
                soFar, groups, preFilters,
2415
                cached = tokenCache[ selector + " " ];
2416
2417
        if ( cached ) {
2418
                return parseOnly ? 0 : cached.slice( 0 );
2419
        }
2420
2421
        soFar = selector;
2422
        groups = [];
2423
        preFilters = Expr.preFilter;
2424
2425
        while ( soFar ) {
2426
2427
                // Comma and first run
2428
                if ( !matched || (match = rcomma.exec( soFar )) ) {
2429
                        if ( match ) {
2430
                                // Don't consume trailing commas as valid
2431
                                soFar = soFar.slice( match[0].length ) || soFar;
2432
                        }
2433
                        groups.push( tokens = [] );
2434
                }
2435
2436
                matched = false;
2437
2438
                // Combinators
2439
                if ( (match = rcombinators.exec( soFar )) ) {
2440
                        matched = match.shift();
2441
                        tokens.push({
2442
                                value: matched,
2443
                                // Cast descendant combinators to space
2444
                                type: match[0].replace( rtrim, " " )
2445
                        });
2446
                        soFar = soFar.slice( matched.length );
2447
                }
2448
2449
                // Filters
2450
                for ( type in Expr.filter ) {
2451
                        if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2452
                                (match = preFilters[ type ]( match ))) ) {
2453
                                matched = match.shift();
2454
                                tokens.push({
2455
                                        value: matched,
2456
                                        type: type,
2457
                                        matches: match
2458
                                });
2459
                                soFar = soFar.slice( matched.length );
2460
                        }
2461
                }
2462
2463
                if ( !matched ) {
2464
                        break;
2465
                }
2466
        }
2467
2468
        // Return the length of the invalid excess
2469
        // if we're just parsing
2470
        // Otherwise, throw an error or return tokens
2471
        return parseOnly ?
2472
                soFar.length :
2473
                soFar ?
2474
                        Sizzle.error( selector ) :
2475
                        // Cache the tokens
2476
                        tokenCache( selector, groups ).slice( 0 );
2477
}
2478
2479
function toSelector( tokens ) {
2480
        var i = 0,
2481
                len = tokens.length,
2482
                selector = "";
2483
        for ( ; i < len; i++ ) {
2484
                selector += tokens[i].value;
2485
        }
2486
        return selector;
2487
}
2488
2489
function addCombinator( matcher, combinator, base ) {
2490
        var dir = combinator.dir,
2491
                checkNonElements = base && dir === "parentNode",
2492
                doneName = done++;
2493
2494
        return combinator.first ?
2495
                // Check against closest ancestor/preceding element
2496
                function( elem, context, xml ) {
2497
                        while ( (elem = elem[ dir ]) ) {
2498
                                if ( elem.nodeType === 1 || checkNonElements ) {
2499
                                        return matcher( elem, context, xml );
2500
                                }
2501
                        }
2502
                } :
2503
2504
                // Check against all ancestor/preceding elements
2505
                function( elem, context, xml ) {
2506
                        var data, cache, outerCache,
2507
                                dirkey = dirruns + " " + doneName;
2508
2509
                        // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2510
                        if ( xml ) {
2511
                                while ( (elem = elem[ dir ]) ) {
2512
                                        if ( elem.nodeType === 1 || checkNonElements ) {
2513
                                                if ( matcher( elem, context, xml ) ) {
2514
                                                        return true;
2515
                                                }
2516
                                        }
2517
                                }
2518
                        } else {
2519
                                while ( (elem = elem[ dir ]) ) {
2520
                                        if ( elem.nodeType === 1 || checkNonElements ) {
2521
                                                outerCache = elem[ expando ] || (elem[ expando ] = {});
2522
                                                if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
2523
                                                        if ( (data = cache[1]) === true || data === cachedruns ) {
2524
                                                                return data === true;
2525
                                                        }
2526
                                                } else {
2527
                                                        cache = outerCache[ dir ] = [ dirkey ];
2528
                                                        cache[1] = matcher( elem, context, xml ) || cachedruns;
2529
                                                        if ( cache[1] === true ) {
2530
                                                                return true;
2531
                                                        }
2532
                                                }
2533
                                        }
2534
                                }
2535
                        }
2536
                };
2537
}
2538
2539
function elementMatcher( matchers ) {
2540
        return matchers.length > 1 ?
2541
                function( elem, context, xml ) {
2542
                        var i = matchers.length;
2543
                        while ( i-- ) {
2544
                                if ( !matchers[i]( elem, context, xml ) ) {
2545
                                        return false;
2546
                                }
2547
                        }
2548
                        return true;
2549
                } :
2550
                matchers[0];
2551
}
2552
2553
function condense( unmatched, map, filter, context, xml ) {
2554
        var elem,
2555
                newUnmatched = [],
2556
                i = 0,
2557
                len = unmatched.length,
2558
                mapped = map != null;
2559
2560
        for ( ; i < len; i++ ) {
2561
                if ( (elem = unmatched[i]) ) {
2562
                        if ( !filter || filter( elem, context, xml ) ) {
2563
                                newUnmatched.push( elem );
2564
                                if ( mapped ) {
2565
                                        map.push( i );
2566
                                }
2567
                        }
2568
                }
2569
        }
2570
2571
        return newUnmatched;
2572
}
2573
2574
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2575
        if ( postFilter && !postFilter[ expando ] ) {
2576
                postFilter = setMatcher( postFilter );
2577
        }
2578
        if ( postFinder && !postFinder[ expando ] ) {
2579
                postFinder = setMatcher( postFinder, postSelector );
2580
        }
2581
        return markFunction(function( seed, results, context, xml ) {
2582
                var temp, i, elem,
2583
                        preMap = [],
2584
                        postMap = [],
2585
                        preexisting = results.length,
2586
2587
                        // Get initial elements from seed or context
2588
                        elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2589
2590
                        // Prefilter to get matcher input, preserving a map for seed-results synchronization
2591
                        matcherIn = preFilter && ( seed || !selector ) ?
2592
                                condense( elems, preMap, preFilter, context, xml ) :
2593
                                elems,
2594
2595
                        matcherOut = matcher ?
2596
                                // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2597
                                postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2598
2599
                                        // ...intermediate processing is necessary
2600
                                        [] :
2601
2602
                                        // ...otherwise use results directly
2603
                                        results :
2604
                                matcherIn;
2605
2606
                // Find primary matches
2607
                if ( matcher ) {
2608
                        matcher( matcherIn, matcherOut, context, xml );
2609
                }
2610
2611
                // Apply postFilter
2612
                if ( postFilter ) {
2613
                        temp = condense( matcherOut, postMap );
2614
                        postFilter( temp, [], context, xml );
2615
2616
                        // Un-match failing elements by moving them back to matcherIn
2617
                        i = temp.length;
2618
                        while ( i-- ) {
2619
                                if ( (elem = temp[i]) ) {
2620
                                        matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2621
                                }
2622
                        }
2623
                }
2624
2625
                if ( seed ) {
2626
                        if ( postFinder || preFilter ) {
2627
                                if ( postFinder ) {
2628
                                        // Get the final matcherOut by condensing this intermediate into postFinder contexts
2629
                                        temp = [];
2630
                                        i = matcherOut.length;
2631
                                        while ( i-- ) {
2632
                                                if ( (elem = matcherOut[i]) ) {
2633
                                                        // Restore matcherIn since elem is not yet a final match
2634
                                                        temp.push( (matcherIn[i] = elem) );
2635
                                                }
2636
                                        }
2637
                                        postFinder( null, (matcherOut = []), temp, xml );
2638
                                }
2639
2640
                                // Move matched elements from seed to results to keep them synchronized
2641
                                i = matcherOut.length;
2642
                                while ( i-- ) {
2643
                                        if ( (elem = matcherOut[i]) &&
2644
                                                (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
2645
2646
                                                seed[temp] = !(results[temp] = elem);
2647
                                        }
2648
                                }
2649
                        }
2650
2651
                // Add elements to results, through postFinder if defined
2652
                } else {
2653
                        matcherOut = condense(
2654
                                matcherOut === results ?
2655
                                        matcherOut.splice( preexisting, matcherOut.length ) :
2656
                                        matcherOut
2657
                        );
2658
                        if ( postFinder ) {
2659
                                postFinder( null, results, matcherOut, xml );
2660
                        } else {
2661
                                push.apply( results, matcherOut );
2662
                        }
2663
                }
2664
        });
2665
}
2666
2667
function matcherFromTokens( tokens ) {
2668
        var checkContext, matcher, j,
2669
                len = tokens.length,
2670
                leadingRelative = Expr.relative[ tokens[0].type ],
2671
                implicitRelative = leadingRelative || Expr.relative[" "],
2672
                i = leadingRelative ? 1 : 0,
2673
2674
                // The foundational matcher ensures that elements are reachable from top-level context(s)
2675
                matchContext = addCombinator( function( elem ) {
2676
                        return elem === checkContext;
2677
                }, implicitRelative, true ),
2678
                matchAnyContext = addCombinator( function( elem ) {
2679
                        return indexOf.call( checkContext, elem ) > -1;
2680
                }, implicitRelative, true ),
2681
                matchers = [ function( elem, context, xml ) {
2682
                        return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2683
                                (checkContext = context).nodeType ?
2684
                                        matchContext( elem, context, xml ) :
2685
                                        matchAnyContext( elem, context, xml ) );
2686
                } ];
2687
2688
        for ( ; i < len; i++ ) {
2689
                if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2690
                        matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2691
                } else {
2692
                        matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2693
2694
                        // Return special upon seeing a positional matcher
2695
                        if ( matcher[ expando ] ) {
2696
                                // Find the next relative operator (if any) for proper handling
2697
                                j = ++i;
2698
                                for ( ; j < len; j++ ) {
2699
                                        if ( Expr.relative[ tokens[j].type ] ) {
2700
                                                break;
2701
                                        }
2702
                                }
2703
                                return setMatcher(
2704
                                        i > 1 && elementMatcher( matchers ),
2705
                                        i > 1 && toSelector(
2706
                                                // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2707
                                                tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2708
                                        ).replace( rtrim, "$1" ),
2709
                                        matcher,
2710
                                        i < j && matcherFromTokens( tokens.slice( i, j ) ),
2711
                                        j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2712
                                        j < len && toSelector( tokens )
2713
                                );
2714
                        }
2715
                        matchers.push( matcher );
2716
                }
2717
        }
2718
2719
        return elementMatcher( matchers );
2720
}
2721
2722
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2723
        // A counter to specify which element is currently being matched
2724
        var matcherCachedRuns = 0,
2725
                bySet = setMatchers.length > 0,
2726
                byElement = elementMatchers.length > 0,
2727
                superMatcher = function( seed, context, xml, results, expandContext ) {
2728
                        var elem, j, matcher,
2729
                                setMatched = [],
2730
                                matchedCount = 0,
2731
                                i = "0",
2732
                                unmatched = seed && [],
2733
                                outermost = expandContext != null,
2734
                                contextBackup = outermostContext,
2735
                                // We must always have either seed elements or context
2736
                                elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
2737
                                // Use integer dirruns iff this is the outermost matcher
2738
                                dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
2739
2740
                        if ( outermost ) {
2741
                                outermostContext = context !== document && context;
2742
                                cachedruns = matcherCachedRuns;
2743
                        }
2744
2745
                        // Add elements passing elementMatchers directly to results
2746
                        // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2747
                        for ( ; (elem = elems[i]) != null; i++ ) {
2748
                                if ( byElement && elem ) {
2749
                                        j = 0;
2750
                                        while ( (matcher = elementMatchers[j++]) ) {
2751
                                                if ( matcher( elem, context, xml ) ) {
2752
                                                        results.push( elem );
2753
                                                        break;
2754
                                                }
2755
                                        }
2756
                                        if ( outermost ) {
2757
                                                dirruns = dirrunsUnique;
2758
                                                cachedruns = ++matcherCachedRuns;
2759
                                        }
2760
                                }
2761
2762
                                // Track unmatched elements for set filters
2763
                                if ( bySet ) {
2764
                                        // They will have gone through all possible matchers
2765
                                        if ( (elem = !matcher && elem) ) {
2766
                                                matchedCount--;
2767
                                        }
2768
2769
                                        // Lengthen the array for every element, matched or not
2770
                                        if ( seed ) {
2771
                                                unmatched.push( elem );
2772
                                        }
2773
                                }
2774
                        }
2775
2776
                        // Apply set filters to unmatched elements
2777
                        matchedCount += i;
2778
                        if ( bySet && i !== matchedCount ) {
2779
                                j = 0;
2780
                                while ( (matcher = setMatchers[j++]) ) {
2781
                                        matcher( unmatched, setMatched, context, xml );
2782
                                }
2783
2784
                                if ( seed ) {
2785
                                        // Reintegrate element matches to eliminate the need for sorting
2786
                                        if ( matchedCount > 0 ) {
2787
                                                while ( i-- ) {
2788
                                                        if ( !(unmatched[i] || setMatched[i]) ) {
2789
                                                                setMatched[i] = pop.call( results );
2790
                                                        }
2791
                                                }
2792
                                        }
2793
2794
                                        // Discard index placeholder values to get only actual matches
2795
                                        setMatched = condense( setMatched );
2796
                                }
2797
2798
                                // Add matches to results
2799
                                push.apply( results, setMatched );
2800
2801
                                // Seedless set matches succeeding multiple successful matchers stipulate sorting
2802
                                if ( outermost && !seed && setMatched.length > 0 &&
2803
                                        ( matchedCount + setMatchers.length ) > 1 ) {
2804
2805
                                        Sizzle.uniqueSort( results );
2806
                                }
2807
                        }
2808
2809
                        // Override manipulation of globals by nested matchers
2810
                        if ( outermost ) {
2811
                                dirruns = dirrunsUnique;
2812
                                outermostContext = contextBackup;
2813
                        }
2814
2815
                        return unmatched;
2816
                };
2817
2818
        return bySet ?
2819
                markFunction( superMatcher ) :
2820
                superMatcher;
2821
}
2822
2823
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
2824
        var i,
2825
                setMatchers = [],
2826
                elementMatchers = [],
2827
                cached = compilerCache[ selector + " " ];
2828
2829
        if ( !cached ) {
2830
                // Generate a function of recursive functions that can be used to check each element
2831
                if ( !group ) {
2832
                        group = tokenize( selector );
2833
                }
2834
                i = group.length;
2835
                while ( i-- ) {
2836
                        cached = matcherFromTokens( group[i] );
2837
                        if ( cached[ expando ] ) {
2838
                                setMatchers.push( cached );
2839
                        } else {
2840
                                elementMatchers.push( cached );
2841
                        }
2842
                }
2843
2844
                // Cache the compiled function
2845
                cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2846
        }
2847
        return cached;
2848
};
2849
2850
function multipleContexts( selector, contexts, results ) {
2851
        var i = 0,
2852
                len = contexts.length;
2853
        for ( ; i < len; i++ ) {
2854
                Sizzle( selector, contexts[i], results );
2855
        }
2856
        return results;
2857
}
2858
2859
function select( selector, context, results, seed ) {
2860
        var i, tokens, token, type, find,
2861
                match = tokenize( selector );
2862
2863
        if ( !seed ) {
2864
                // Try to minimize operations if there is only one group
2865
                if ( match.length === 1 ) {
2866
2867
                        // Take a shortcut and set the context if the root selector is an ID
2868
                        tokens = match[0] = match[0].slice( 0 );
2869
                        if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2870
                                        support.getById && context.nodeType === 9 && documentIsHTML &&
2871
                                        Expr.relative[ tokens[1].type ] ) {
2872
2873
                                context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2874
                                if ( !context ) {
2875
                                        return results;
2876
                                }
2877
                                selector = selector.slice( tokens.shift().value.length );
2878
                        }
2879
2880
                        // Fetch a seed set for right-to-left matching
2881
                        i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2882
                        while ( i-- ) {
2883
                                token = tokens[i];
2884
2885
                                // Abort if we hit a combinator
2886
                                if ( Expr.relative[ (type = token.type) ] ) {
2887
                                        break;
2888
                                }
2889
                                if ( (find = Expr.find[ type ]) ) {
2890
                                        // Search, expanding context for leading sibling combinators
2891
                                        if ( (seed = find(
2892
                                                token.matches[0].replace( runescape, funescape ),
2893
                                                rsibling.test( tokens[0].type ) && context.parentNode || context
2894
                                        )) ) {
2895
2896
                                                // If seed is empty or no tokens remain, we can return early
2897
                                                tokens.splice( i, 1 );
2898
                                                selector = seed.length && toSelector( tokens );
2899
                                                if ( !selector ) {
2900
                                                        push.apply( results, seed );
2901
                                                        return results;
2902
                                                }
2903
2904
                                                break;
2905
                                        }
2906
                                }
2907
                        }
2908
                }
2909
        }
2910
2911
        // Compile and execute a filtering function
2912
        // Provide `match` to avoid retokenization if we modified the selector above
2913
        compile( selector, match )(
2914
                seed,
2915
                context,
2916
                !documentIsHTML,
2917
                results,
2918
                rsibling.test( selector )
2919
        );
2920
        return results;
2921
}
2922
2923
// One-time assignments
2924
2925
// Sort stability
2926
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2927
2928
// Support: Chrome<14
2929
// Always assume duplicates if they aren't passed to the comparison function
2930
support.detectDuplicates = hasDuplicate;
2931
2932
// Initialize against the default document
2933
setDocument();
2934
2935
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2936
// Detached nodes confoundingly follow *each other*
2937
support.sortDetached = assert(function( div1 ) {
2938
        // Should return 1, but returns 4 (following)
2939
        return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2940
});
2941
2942
// Support: IE<8
2943
// Prevent attribute/property "interpolation"
2944
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2945
if ( !assert(function( div ) {
2946
        div.innerHTML = "<a href='#'></a>";
2947
        return div.firstChild.getAttribute("href") === "#" ;
2948
}) ) {
2949
        addHandle( "type|href|height|width", function( elem, name, isXML ) {
2950
                if ( !isXML ) {
2951
                        return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2952
                }
2953
        });
2954
}
2955
2956
// Support: IE<9
2957
// Use defaultValue in place of getAttribute("value")
2958
if ( !support.attributes || !assert(function( div ) {
2959
        div.innerHTML = "<input/>";
2960
        div.firstChild.setAttribute( "value", "" );
2961
        return div.firstChild.getAttribute( "value" ) === "";
2962
}) ) {
2963
        addHandle( "value", function( elem, name, isXML ) {
2964
                if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2965
                        return elem.defaultValue;
2966
                }
2967
        });
2968
}
2969
2970
// Support: IE<9
2971
// Use getAttributeNode to fetch booleans when getAttribute lies
2972
if ( !assert(function( div ) {
2973
        return div.getAttribute("disabled") == null;
2974
}) ) {
2975
        addHandle( booleans, function( elem, name, isXML ) {
2976
                var val;
2977
                if ( !isXML ) {
2978
                        return (val = elem.getAttributeNode( name )) && val.specified ?
2979
                                val.value :
2980
                                elem[ name ] === true ? name.toLowerCase() : null;
2981
                }
2982
        });
2983
}
2984
2985
jQuery.find = Sizzle;
2986
jQuery.expr = Sizzle.selectors;
2987
jQuery.expr[":"] = jQuery.expr.pseudos;
2988
jQuery.unique = Sizzle.uniqueSort;
2989
jQuery.text = Sizzle.getText;
2990
jQuery.isXMLDoc = Sizzle.isXML;
2991
jQuery.contains = Sizzle.contains;
2992
2993
2994
})( window );
2995
// String to Object options format cache
2996
var optionsCache = {};
2997
2998
// Convert String-formatted options into Object-formatted ones and store in cache
2999
function createOptions( options ) {
3000
        var object = optionsCache[ options ] = {};
3001
        jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
3002
                object[ flag ] = true;
3003
        });
3004
        return object;
3005
}
3006
3007
/*
3008
 * Create a callback list using the following parameters:
3009
 *
3010
 *        options: an optional list of space-separated options that will change how
3011
 *                        the callback list behaves or a more traditional option object
3012
 *
3013
 * By default a callback list will act like an event callback list and can be
3014
 * "fired" multiple times.
3015
 *
3016
 * Possible options:
3017
 *
3018
 *        once:                        will ensure the callback list can only be fired once (like a Deferred)
3019
 *
3020
 *        memory:                        will keep track of previous values and will call any callback added
3021
 *                                        after the list has been fired right away with the latest "memorized"
3022
 *                                        values (like a Deferred)
3023
 *
3024
 *        unique:                        will ensure a callback can only be added once (no duplicate in the list)
3025
 *
3026
 *        stopOnFalse:        interrupt callings when a callback returns false
3027
 *
3028
 */
3029
jQuery.Callbacks = function( options ) {
3030
3031
        // Convert options from String-formatted to Object-formatted if needed
3032
        // (we check in cache first)
3033
        options = typeof options === "string" ?
3034
                ( optionsCache[ options ] || createOptions( options ) ) :
3035
                jQuery.extend( {}, options );
3036
3037
        var // Flag to know if list is currently firing
3038
                firing,
3039
                // Last fire value (for non-forgettable lists)
3040
                memory,
3041
                // Flag to know if list was already fired
3042
                fired,
3043
                // End of the loop when firing
3044
                firingLength,
3045
                // Index of currently firing callback (modified by remove if needed)
3046
                firingIndex,
3047
                // First callback to fire (used internally by add and fireWith)
3048
                firingStart,
3049
                // Actual callback list
3050
                list = [],
3051
                // Stack of fire calls for repeatable lists
3052
                stack = !options.once && [],
3053
                // Fire callbacks
3054
                fire = function( data ) {
3055
                        memory = options.memory && data;
3056
                        fired = true;
3057
                        firingIndex = firingStart || 0;
3058
                        firingStart = 0;
3059
                        firingLength = list.length;
3060
                        firing = true;
3061
                        for ( ; list && firingIndex < firingLength; firingIndex++ ) {
3062
                                if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
3063
                                        memory = false; // To prevent further calls using add
3064
                                        break;
3065
                                }
3066
                        }
3067
                        firing = false;
3068
                        if ( list ) {
3069
                                if ( stack ) {
3070
                                        if ( stack.length ) {
3071
                                                fire( stack.shift() );
3072
                                        }
3073
                                } else if ( memory ) {
3074
                                        list = [];
3075
                                } else {
3076
                                        self.disable();
3077
                                }
3078
                        }
3079
                },
3080
                // Actual Callbacks object
3081
                self = {
3082
                        // Add a callback or a collection of callbacks to the list
3083
                        add: function() {
3084
                                if ( list ) {
3085
                                        // First, we save the current length
3086
                                        var start = list.length;
3087
                                        (function add( args ) {
3088
                                                jQuery.each( args, function( _, arg ) {
3089
                                                        var type = jQuery.type( arg );
3090
                                                        if ( type === "function" ) {
3091
                                                                if ( !options.unique || !self.has( arg ) ) {
3092
                                                                        list.push( arg );
3093
                                                                }
3094
                                                        } else if ( arg && arg.length && type !== "string" ) {
3095
                                                                // Inspect recursively
3096
                                                                add( arg );
3097
                                                        }
3098
                                                });
3099
                                        })( arguments );
3100
                                        // Do we need to add the callbacks to the
3101
                                        // current firing batch?
3102
                                        if ( firing ) {
3103
                                                firingLength = list.length;
3104
                                        // With memory, if we're not firing then
3105
                                        // we should call right away
3106
                                        } else if ( memory ) {
3107
                                                firingStart = start;
3108
                                                fire( memory );
3109
                                        }
3110
                                }
3111
                                return this;
3112
                        },
3113
                        // Remove a callback from the list
3114
                        remove: function() {
3115
                                if ( list ) {
3116
                                        jQuery.each( arguments, function( _, arg ) {
3117
                                                var index;
3118
                                                while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3119
                                                        list.splice( index, 1 );
3120
                                                        // Handle firing indexes
3121
                                                        if ( firing ) {
3122
                                                                if ( index <= firingLength ) {
3123
                                                                        firingLength--;
3124
                                                                }
3125
                                                                if ( index <= firingIndex ) {
3126
                                                                        firingIndex--;
3127
                                                                }
3128
                                                        }
3129
                                                }
3130
                                        });
3131
                                }
3132
                                return this;
3133
                        },
3134
                        // Check if a given callback is in the list.
3135
                        // If no argument is given, return whether or not list has callbacks attached.
3136
                        has: function( fn ) {
3137
                                return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
3138
                        },
3139
                        // Remove all callbacks from the list
3140
                        empty: function() {
3141
                                list = [];
3142
                                firingLength = 0;
3143
                                return this;
3144
                        },
3145
                        // Have the list do nothing anymore
3146
                        disable: function() {
3147
                                list = stack = memory = undefined;
3148
                                return this;
3149
                        },
3150
                        // Is it disabled?
3151
                        disabled: function() {
3152
                                return !list;
3153
                        },
3154
                        // Lock the list in its current state
3155
                        lock: function() {
3156
                                stack = undefined;
3157
                                if ( !memory ) {
3158
                                        self.disable();
3159
                                }
3160
                                return this;
3161
                        },
3162
                        // Is it locked?
3163
                        locked: function() {
3164
                                return !stack;
3165
                        },
3166
                        // Call all callbacks with the given context and arguments
3167
                        fireWith: function( context, args ) {
3168
                                if ( list && ( !fired || stack ) ) {
3169
                                        args = args || [];
3170
                                        args = [ context, args.slice ? args.slice() : args ];
3171
                                        if ( firing ) {
3172
                                                stack.push( args );
3173
                                        } else {
3174
                                                fire( args );
3175
                                        }
3176
                                }
3177
                                return this;
3178
                        },
3179
                        // Call all the callbacks with the given arguments
3180
                        fire: function() {
3181
                                self.fireWith( this, arguments );
3182
                                return this;
3183
                        },
3184
                        // To know if the callbacks have already been called at least once
3185
                        fired: function() {
3186
                                return !!fired;
3187
                        }
3188
                };
3189
3190
        return self;
3191
};
3192
jQuery.extend({
3193
3194
        Deferred: function( func ) {
3195
                var tuples = [
3196
                                // action, add listener, listener list, final state
3197
                                [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
3198
                                [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
3199
                                [ "notify", "progress", jQuery.Callbacks("memory") ]
3200
                        ],
3201
                        state = "pending",
3202
                        promise = {
3203
                                state: function() {
3204
                                        return state;
3205
                                },
3206
                                always: function() {
3207
                                        deferred.done( arguments ).fail( arguments );
3208
                                        return this;
3209
                                },
3210
                                then: function( /* fnDone, fnFail, fnProgress */ ) {
3211
                                        var fns = arguments;
3212
                                        return jQuery.Deferred(function( newDefer ) {
3213
                                                jQuery.each( tuples, function( i, tuple ) {
3214
                                                        var action = tuple[ 0 ],
3215
                                                                fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
3216
                                                        // deferred[ done | fail | progress ] for forwarding actions to newDefer
3217
                                                        deferred[ tuple[1] ](function() {
3218
                                                                var returned = fn && fn.apply( this, arguments );
3219
                                                                if ( returned && jQuery.isFunction( returned.promise ) ) {
3220
                                                                        returned.promise()
3221
                                                                                .done( newDefer.resolve )
3222
                                                                                .fail( newDefer.reject )
3223
                                                                                .progress( newDefer.notify );
3224
                                                                } else {
3225
                                                                        newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
3226
                                                                }
3227
                                                        });
3228
                                                });
3229
                                                fns = null;
3230
                                        }).promise();
3231
                                },
3232
                                // Get a promise for this deferred
3233
                                // If obj is provided, the promise aspect is added to the object
3234
                                promise: function( obj ) {
3235
                                        return obj != null ? jQuery.extend( obj, promise ) : promise;
3236
                                }
3237
                        },
3238
                        deferred = {};
3239
3240
                // Keep pipe for back-compat
3241
                promise.pipe = promise.then;
3242
3243
                // Add list-specific methods
3244
                jQuery.each( tuples, function( i, tuple ) {
3245
                        var list = tuple[ 2 ],
3246
                                stateString = tuple[ 3 ];
3247
3248
                        // promise[ done | fail | progress ] = list.add
3249
                        promise[ tuple[1] ] = list.add;
3250
3251
                        // Handle state
3252
                        if ( stateString ) {
3253
                                list.add(function() {
3254
                                        // state = [ resolved | rejected ]
3255
                                        state = stateString;
3256
3257
                                // [ reject_list | resolve_list ].disable; progress_list.lock
3258
                                }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
3259
                        }
3260
3261
                        // deferred[ resolve | reject | notify ]
3262
                        deferred[ tuple[0] ] = function() {
3263
                                deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
3264
                                return this;
3265
                        };
3266
                        deferred[ tuple[0] + "With" ] = list.fireWith;
3267
                });
3268
3269
                // Make the deferred a promise
3270
                promise.promise( deferred );
3271
3272
                // Call given func if any
3273
                if ( func ) {
3274
                        func.call( deferred, deferred );
3275
                }
3276
3277
                // All done!
3278
                return deferred;
3279
        },
3280
3281
        // Deferred helper
3282
        when: function( subordinate /* , ..., subordinateN */ ) {
3283
                var i = 0,
3284
                        resolveValues = core_slice.call( arguments ),
3285
                        length = resolveValues.length,
3286
3287
                        // the count of uncompleted subordinates
3288
                        remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
3289
3290
                        // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
3291
                        deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
3292
3293
                        // Update function for both resolve and progress values
3294
                        updateFunc = function( i, contexts, values ) {
3295
                                return function( value ) {
3296
                                        contexts[ i ] = this;
3297
                                        values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
3298
                                        if( values === progressValues ) {
3299
                                                deferred.notifyWith( contexts, values );
3300
                                        } else if ( !( --remaining ) ) {
3301
                                                deferred.resolveWith( contexts, values );
3302
                                        }
3303
                                };
3304
                        },
3305
3306
                        progressValues, progressContexts, resolveContexts;
3307
3308
                // add listeners to Deferred subordinates; treat others as resolved
3309
                if ( length > 1 ) {
3310
                        progressValues = new Array( length );
3311
                        progressContexts = new Array( length );
3312
                        resolveContexts = new Array( length );
3313
                        for ( ; i < length; i++ ) {
3314
                                if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
3315
                                        resolveValues[ i ].promise()
3316
                                                .done( updateFunc( i, resolveContexts, resolveValues ) )
3317
                                                .fail( deferred.reject )
3318
                                                .progress( updateFunc( i, progressContexts, progressValues ) );
3319
                                } else {
3320
                                        --remaining;
3321
                                }
3322
                        }
3323
                }
3324
3325
                // if we're not waiting on anything, resolve the master
3326
                if ( !remaining ) {
3327
                        deferred.resolveWith( resolveContexts, resolveValues );
3328
                }
3329
3330
                return deferred.promise();
3331
        }
3332
});
3333
jQuery.support = (function( support ) {
3334
3335
        var all, a, input, select, fragment, opt, eventName, isSupported, i,
3336
                div = document.createElement("div");
3337
3338
        // Setup
3339
        div.setAttribute( "className", "t" );
3340
        div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
3341
3342
        // Finish early in limited (non-browser) environments
3343
        all = div.getElementsByTagName("*") || [];
3344
        a = div.getElementsByTagName("a")[ 0 ];
3345
        if ( !a || !a.style || !all.length ) {
3346
                return support;
3347
        }
3348
3349
        // First batch of tests
3350
        select = document.createElement("select");
3351
        opt = select.appendChild( document.createElement("option") );
3352
        input = div.getElementsByTagName("input")[ 0 ];
3353
3354
        a.style.cssText = "top:1px;float:left;opacity:.5";
3355
3356
        // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
3357
        support.getSetAttribute = div.className !== "t";
3358
3359
        // IE strips leading whitespace when .innerHTML is used
3360
        support.leadingWhitespace = div.firstChild.nodeType === 3;
3361
3362
        // Make sure that tbody elements aren't automatically inserted
3363
        // IE will insert them into empty tables
3364
        support.tbody = !div.getElementsByTagName("tbody").length;
3365
3366
        // Make sure that link elements get serialized correctly by innerHTML
3367
        // This requires a wrapper element in IE
3368
        support.htmlSerialize = !!div.getElementsByTagName("link").length;
3369
3370
        // Get the style information from getAttribute
3371
        // (IE uses .cssText instead)
3372
        support.style = /top/.test( a.getAttribute("style") );
3373
3374
        // Make sure that URLs aren't manipulated
3375
        // (IE normalizes it by default)
3376
        support.hrefNormalized = a.getAttribute("href") === "/a";
3377
3378
        // Make sure that element opacity exists
3379
        // (IE uses filter instead)
3380
        // Use a regex to work around a WebKit issue. See #5145
3381
        support.opacity = /^0.5/.test( a.style.opacity );
3382
3383
        // Verify style float existence
3384
        // (IE uses styleFloat instead of cssFloat)
3385
        support.cssFloat = !!a.style.cssFloat;
3386
3387
        // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
3388
        support.checkOn = !!input.value;
3389
3390
        // Make sure that a selected-by-default option has a working selected property.
3391
        // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
3392
        support.optSelected = opt.selected;
3393
3394
        // Tests for enctype support on a form (#6743)
3395
        support.enctype = !!document.createElement("form").enctype;
3396
3397
        // Makes sure cloning an html5 element does not cause problems
3398
        // Where outerHTML is undefined, this still works
3399
        support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
3400
3401
        // Will be defined later
3402
        support.inlineBlockNeedsLayout = false;
3403
        support.shrinkWrapBlocks = false;
3404
        support.pixelPosition = false;
3405
        support.deleteExpando = true;
3406
        support.noCloneEvent = true;
3407
        support.reliableMarginRight = true;
3408
        support.boxSizingReliable = true;
3409
3410
        // Make sure checked status is properly cloned
3411
        input.checked = true;
3412
        support.noCloneChecked = input.cloneNode( true ).checked;
3413
3414
        // Make sure that the options inside disabled selects aren't marked as disabled
3415
        // (WebKit marks them as disabled)
3416
        select.disabled = true;
3417
        support.optDisabled = !opt.disabled;
3418
3419
        // Support: IE<9
3420
        try {
3421
                delete div.test;
3422
        } catch( e ) {
3423
                support.deleteExpando = false;
3424
        }
3425
3426
        // Check if we can trust getAttribute("value")
3427
        input = document.createElement("input");
3428
        input.setAttribute( "value", "" );
3429
        support.input = input.getAttribute( "value" ) === "";
3430
3431
        // Check if an input maintains its value after becoming a radio
3432
        input.value = "t";
3433
        input.setAttribute( "type", "radio" );
3434
        support.radioValue = input.value === "t";
3435
3436
        // #11217 - WebKit loses check when the name is after the checked attribute
3437
        input.setAttribute( "checked", "t" );
3438
        input.setAttribute( "name", "t" );
3439
3440
        fragment = document.createDocumentFragment();
3441
        fragment.appendChild( input );
3442
3443
        // Check if a disconnected checkbox will retain its checked
3444
        // value of true after appended to the DOM (IE6/7)
3445
        support.appendChecked = input.checked;
3446
3447
        // WebKit doesn't clone checked state correctly in fragments
3448
        support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
3449
3450
        // Support: IE<9
3451
        // Opera does not clone events (and typeof div.attachEvent === undefined).
3452
        // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
3453
        if ( div.attachEvent ) {
3454
                div.attachEvent( "onclick", function() {
3455
                        support.noCloneEvent = false;
3456
                });
3457
3458
                div.cloneNode( true ).click();
3459
        }
3460
3461
        // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
3462
        // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
3463
        for ( i in { submit: true, change: true, focusin: true }) {
3464
                div.setAttribute( eventName = "on" + i, "t" );
3465
3466
                support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
3467
        }
3468
3469
        div.style.backgroundClip = "content-box";
3470
        div.cloneNode( true ).style.backgroundClip = "";
3471
        support.clearCloneStyle = div.style.backgroundClip === "content-box";
3472
3473
        // Support: IE<9
3474
        // Iteration over object's inherited properties before its own.
3475
        for ( i in jQuery( support ) ) {
3476
                break;
3477
        }
3478
        support.ownLast = i !== "0";
3479
3480
        // Run tests that need a body at doc ready
3481
        jQuery(function() {
3482
                var container, marginDiv, tds,
3483
                        divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
3484
                        body = document.getElementsByTagName("body")[0];
3485
3486
                if ( !body ) {
3487
                        // Return for frameset docs that don't have a body
3488
                        return;
3489
                }
3490
3491
                container = document.createElement("div");
3492
                container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
3493
3494
                body.appendChild( container ).appendChild( div );
3495
3496
                // Support: IE8
3497
                // Check if table cells still have offsetWidth/Height when they are set
3498
                // to display:none and there are still other visible table cells in a
3499
                // table row; if so, offsetWidth/Height are not reliable for use when
3500
                // determining if an element has been hidden directly using
3501
                // display:none (it is still safe to use offsets if a parent element is
3502
                // hidden; don safety goggles and see bug #4512 for more information).
3503
                div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
3504
                tds = div.getElementsByTagName("td");
3505
                tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
3506
                isSupported = ( tds[ 0 ].offsetHeight === 0 );
3507
3508
                tds[ 0 ].style.display = "";
3509
                tds[ 1 ].style.display = "none";
3510
3511
                // Support: IE8
3512
                // Check if empty table cells still have offsetWidth/Height
3513
                support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
3514
3515
                // Check box-sizing and margin behavior.
3516
                div.innerHTML = "";
3517
                div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
3518
3519
                // Workaround failing boxSizing test due to offsetWidth returning wrong value
3520
                // with some non-1 values of body zoom, ticket #13543
3521
                jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
3522
                        support.boxSizing = div.offsetWidth === 4;
3523
                });
3524
3525
                // Use window.getComputedStyle because jsdom on node.js will break without it.
3526
                if ( window.getComputedStyle ) {
3527
                        support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
3528
                        support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
3529
3530
                        // Check if div with explicit width and no margin-right incorrectly
3531
                        // gets computed margin-right based on width of container. (#3333)
3532
                        // Fails in WebKit before Feb 2011 nightlies
3533
                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
3534
                        marginDiv = div.appendChild( document.createElement("div") );
3535
                        marginDiv.style.cssText = div.style.cssText = divReset;
3536
                        marginDiv.style.marginRight = marginDiv.style.width = "0";
3537
                        div.style.width = "1px";
3538
3539
                        support.reliableMarginRight =
3540
                                !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
3541
                }
3542
3543
                if ( typeof div.style.zoom !== core_strundefined ) {
3544
                        // Support: IE<8
3545
                        // Check if natively block-level elements act like inline-block
3546
                        // elements when setting their display to 'inline' and giving
3547
                        // them layout
3548
                        div.innerHTML = "";
3549
                        div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
3550
                        support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
3551
3552
                        // Support: IE6
3553
                        // Check if elements with layout shrink-wrap their children
3554
                        div.style.display = "block";
3555
                        div.innerHTML = "<div></div>";
3556
                        div.firstChild.style.width = "5px";
3557
                        support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
3558
3559
                        if ( support.inlineBlockNeedsLayout ) {
3560
                                // Prevent IE 6 from affecting layout for positioned elements #11048
3561
                                // Prevent IE from shrinking the body in IE 7 mode #12869
3562
                                // Support: IE<8
3563
                                body.style.zoom = 1;
3564
                        }
3565
                }
3566
3567
                body.removeChild( container );
3568
3569
                // Null elements to avoid leaks in IE
3570
                container = div = tds = marginDiv = null;
3571
        });
3572
3573
        // Null elements to avoid leaks in IE
3574
        all = select = fragment = opt = a = input = null;
3575
3576
        return support;
3577
})({});
3578
3579
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
3580
        rmultiDash = /([A-Z])/g;
3581
3582
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
3583
        if ( !jQuery.acceptData( elem ) ) {
3584
                return;
3585
        }
3586
3587
        var ret, thisCache,
3588
                internalKey = jQuery.expando,
3589
3590
                // We have to handle DOM nodes and JS objects differently because IE6-7
3591
                // can't GC object references properly across the DOM-JS boundary
3592
                isNode = elem.nodeType,
3593
3594
                // Only DOM nodes need the global jQuery cache; JS object data is
3595
                // attached directly to the object so GC can occur automatically
3596
                cache = isNode ? jQuery.cache : elem,
3597
3598
                // Only defining an ID for JS objects if its cache already exists allows
3599
                // the code to shortcut on the same path as a DOM node with no cache
3600
                id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
3601
3602
        // Avoid doing any more work than we need to when trying to get data on an
3603
        // object that has no data at all
3604
        if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
3605
                return;
3606
        }
3607
3608
        if ( !id ) {
3609
                // Only DOM nodes need a new unique ID for each element since their data
3610
                // ends up in the global cache
3611
                if ( isNode ) {
3612
                        id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
3613
                } else {
3614
                        id = internalKey;
3615
                }
3616
        }
3617
3618
        if ( !cache[ id ] ) {
3619
                // Avoid exposing jQuery metadata on plain JS objects when the object
3620
                // is serialized using JSON.stringify
3621
                cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
3622
        }
3623
3624
        // An object can be passed to jQuery.data instead of a key/value pair; this gets
3625
        // shallow copied over onto the existing cache
3626
        if ( typeof name === "object" || typeof name === "function" ) {
3627
                if ( pvt ) {
3628
                        cache[ id ] = jQuery.extend( cache[ id ], name );
3629
                } else {
3630
                        cache[ id ].data = jQuery.extend( cache[ id ].data, name );
3631
                }
3632
        }
3633
3634
        thisCache = cache[ id ];
3635
3636
        // jQuery data() is stored in a separate object inside the object's internal data
3637
        // cache in order to avoid key collisions between internal data and user-defined
3638
        // data.
3639
        if ( !pvt ) {
3640
                if ( !thisCache.data ) {
3641
                        thisCache.data = {};
3642
                }
3643
3644
                thisCache = thisCache.data;
3645
        }
3646
3647
        if ( data !== undefined ) {
3648
                thisCache[ jQuery.camelCase( name ) ] = data;
3649
        }
3650
3651
        // Check for both converted-to-camel and non-converted data property names
3652
        // If a data property was specified
3653
        if ( typeof name === "string" ) {
3654
3655
                // First Try to find as-is property data
3656
                ret = thisCache[ name ];
3657
3658
                // Test for null|undefined property data
3659
                if ( ret == null ) {
3660
3661
                        // Try to find the camelCased property
3662
                        ret = thisCache[ jQuery.camelCase( name ) ];
3663
                }
3664
        } else {
3665
                ret = thisCache;
3666
        }
3667
3668
        return ret;
3669
}
3670
3671
function internalRemoveData( elem, name, pvt ) {
3672
        if ( !jQuery.acceptData( elem ) ) {
3673
                return;
3674
        }
3675
3676
        var thisCache, i,
3677
                isNode = elem.nodeType,
3678
3679
                // See jQuery.data for more information
3680
                cache = isNode ? jQuery.cache : elem,
3681
                id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
3682
3683
        // If there is already no cache entry for this object, there is no
3684
        // purpose in continuing
3685
        if ( !cache[ id ] ) {
3686
                return;
3687
        }
3688
3689
        if ( name ) {
3690
3691
                thisCache = pvt ? cache[ id ] : cache[ id ].data;
3692
3693
                if ( thisCache ) {
3694
3695
                        // Support array or space separated string names for data keys
3696
                        if ( !jQuery.isArray( name ) ) {
3697
3698
                                // try the string as a key before any manipulation
3699
                                if ( name in thisCache ) {
3700
                                        name = [ name ];
3701
                                } else {
3702
3703
                                        // split the camel cased version by spaces unless a key with the spaces exists
3704
                                        name = jQuery.camelCase( name );
3705
                                        if ( name in thisCache ) {
3706
                                                name = [ name ];
3707
                                        } else {
3708
                                                name = name.split(" ");
3709
                                        }
3710
                                }
3711
                        } else {
3712
                                // If "name" is an array of keys...
3713
                                // When data is initially created, via ("key", "val") signature,
3714
                                // keys will be converted to camelCase.
3715
                                // Since there is no way to tell _how_ a key was added, remove
3716
                                // both plain key and camelCase key. #12786
3717
                                // This will only penalize the array argument path.
3718
                                name = name.concat( jQuery.map( name, jQuery.camelCase ) );
3719
                        }
3720
3721
                        i = name.length;
3722
                        while ( i-- ) {
3723
                                delete thisCache[ name[i] ];
3724
                        }
3725
3726
                        // If there is no data left in the cache, we want to continue
3727
                        // and let the cache object itself get destroyed
3728
                        if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
3729
                                return;
3730
                        }
3731
                }
3732
        }
3733
3734
        // See jQuery.data for more information
3735
        if ( !pvt ) {
3736
                delete cache[ id ].data;
3737
3738
                // Don't destroy the parent cache unless the internal data object
3739
                // had been the only thing left in it
3740
                if ( !isEmptyDataObject( cache[ id ] ) ) {
3741
                        return;
3742
                }
3743
        }
3744
3745
        // Destroy the cache
3746
        if ( isNode ) {
3747
                jQuery.cleanData( [ elem ], true );
3748
3749
        // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
3750
        /* jshint eqeqeq: false */
3751
        } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
3752
                /* jshint eqeqeq: true */
3753
                delete cache[ id ];
3754
3755
        // When all else fails, null
3756
        } else {
3757
                cache[ id ] = null;
3758
        }
3759
}
3760
3761
jQuery.extend({
3762
        cache: {},
3763
3764
        // The following elements throw uncatchable exceptions if you
3765
        // attempt to add expando properties to them.
3766
        noData: {
3767
                "applet": true,
3768
                "embed": true,
3769
                // Ban all objects except for Flash (which handle expandos)
3770
                "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
3771
        },
3772
3773
        hasData: function( elem ) {
3774
                elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
3775
                return !!elem && !isEmptyDataObject( elem );
3776
        },
3777
3778
        data: function( elem, name, data ) {
3779
                return internalData( elem, name, data );
3780
        },
3781
3782
        removeData: function( elem, name ) {
3783
                return internalRemoveData( elem, name );
3784
        },
3785
3786
        // For internal use only.
3787
        _data: function( elem, name, data ) {
3788
                return internalData( elem, name, data, true );
3789
        },
3790
3791
        _removeData: function( elem, name ) {
3792
                return internalRemoveData( elem, name, true );
3793
        },
3794
3795
        // A method for determining if a DOM node can handle the data expando
3796
        acceptData: function( elem ) {
3797
                // Do not set data on non-element because it will not be cleared (#8335).
3798
                if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
3799
                        return false;
3800
                }
3801
3802
                var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
3803
3804
                // nodes accept data unless otherwise specified; rejection can be conditional
3805
                return !noData || noData !== true && elem.getAttribute("classid") === noData;
3806
        }
3807
});
3808
3809
jQuery.fn.extend({
3810
        data: function( key, value ) {
3811
                var attrs, name,
3812
                        data = null,
3813
                        i = 0,
3814
                        elem = this[0];
3815
3816
                // Special expections of .data basically thwart jQuery.access,
3817
                // so implement the relevant behavior ourselves
3818
3819
                // Gets all values
3820
                if ( key === undefined ) {
3821
                        if ( this.length ) {
3822
                                data = jQuery.data( elem );
3823
3824
                                if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
3825
                                        attrs = elem.attributes;
3826
                                        for ( ; i < attrs.length; i++ ) {
3827
                                                name = attrs[i].name;
3828
3829
                                                if ( name.indexOf("data-") === 0 ) {
3830
                                                        name = jQuery.camelCase( name.slice(5) );
3831
3832
                                                        dataAttr( elem, name, data[ name ] );
3833
                                                }
3834
                                        }
3835
                                        jQuery._data( elem, "parsedAttrs", true );
3836
                                }
3837
                        }
3838
3839
                        return data;
3840
                }
3841
3842
                // Sets multiple values
3843
                if ( typeof key === "object" ) {
3844
                        return this.each(function() {
3845
                                jQuery.data( this, key );
3846
                        });
3847
                }
3848
3849
                return arguments.length > 1 ?
3850
3851
                        // Sets one value
3852
                        this.each(function() {
3853
                                jQuery.data( this, key, value );
3854
                        }) :
3855
3856
                        // Gets one value
3857
                        // Try to fetch any internally stored data first
3858
                        elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
3859
        },
3860
3861
        removeData: function( key ) {
3862
                return this.each(function() {
3863
                        jQuery.removeData( this, key );
3864
                });
3865
        }
3866
});
3867
3868
function dataAttr( elem, key, data ) {
3869
        // If nothing was found internally, try to fetch any
3870
        // data from the HTML5 data-* attribute
3871
        if ( data === undefined && elem.nodeType === 1 ) {
3872
3873
                var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
3874
3875
                data = elem.getAttribute( name );
3876
3877
                if ( typeof data === "string" ) {
3878
                        try {
3879
                                data = data === "true" ? true :
3880
                                        data === "false" ? false :
3881
                                        data === "null" ? null :
3882
                                        // Only convert to a number if it doesn't change the string
3883
                                        +data + "" === data ? +data :
3884
                                        rbrace.test( data ) ? jQuery.parseJSON( data ) :
3885
                                                data;
3886
                        } catch( e ) {}
3887
3888
                        // Make sure we set the data so it isn't changed later
3889
                        jQuery.data( elem, key, data );
3890
3891
                } else {
3892
                        data = undefined;
3893
                }
3894
        }
3895
3896
        return data;
3897
}
3898
3899
// checks a cache object for emptiness
3900
function isEmptyDataObject( obj ) {
3901
        var name;
3902
        for ( name in obj ) {
3903
3904
                // if the public data object is empty, the private is still empty
3905
                if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
3906
                        continue;
3907
                }
3908
                if ( name !== "toJSON" ) {
3909
                        return false;
3910
                }
3911
        }
3912
3913
        return true;
3914
}
3915
jQuery.extend({
3916
        queue: function( elem, type, data ) {
3917
                var queue;
3918
3919
                if ( elem ) {
3920
                        type = ( type || "fx" ) + "queue";
3921
                        queue = jQuery._data( elem, type );
3922
3923
                        // Speed up dequeue by getting out quickly if this is just a lookup
3924
                        if ( data ) {
3925
                                if ( !queue || jQuery.isArray(data) ) {
3926
                                        queue = jQuery._data( elem, type, jQuery.makeArray(data) );
3927
                                } else {
3928
                                        queue.push( data );
3929
                                }
3930
                        }
3931
                        return queue || [];
3932
                }
3933
        },
3934
3935
        dequeue: function( elem, type ) {
3936
                type = type || "fx";
3937
3938
                var queue = jQuery.queue( elem, type ),
3939
                        startLength = queue.length,
3940
                        fn = queue.shift(),
3941
                        hooks = jQuery._queueHooks( elem, type ),
3942
                        next = function() {
3943
                                jQuery.dequeue( elem, type );
3944
                        };
3945
3946
                // If the fx queue is dequeued, always remove the progress sentinel
3947
                if ( fn === "inprogress" ) {
3948
                        fn = queue.shift();
3949
                        startLength--;
3950
                }
3951
3952
                if ( fn ) {
3953
3954
                        // Add a progress sentinel to prevent the fx queue from being
3955
                        // automatically dequeued
3956
                        if ( type === "fx" ) {
3957
                                queue.unshift( "inprogress" );
3958
                        }
3959
3960
                        // clear up the last queue stop function
3961
                        delete hooks.stop;
3962
                        fn.call( elem, next, hooks );
3963
                }
3964
3965
                if ( !startLength && hooks ) {
3966
                        hooks.empty.fire();
3967
                }
3968
        },
3969
3970
        // not intended for public consumption - generates a queueHooks object, or returns the current one
3971
        _queueHooks: function( elem, type ) {
3972
                var key = type + "queueHooks";
3973
                return jQuery._data( elem, key ) || jQuery._data( elem, key, {
3974
                        empty: jQuery.Callbacks("once memory").add(function() {
3975
                                jQuery._removeData( elem, type + "queue" );
3976
                                jQuery._removeData( elem, key );
3977
                        })
3978
                });
3979
        }
3980
});
3981
3982
jQuery.fn.extend({
3983
        queue: function( type, data ) {
3984
                var setter = 2;
3985
3986
                if ( typeof type !== "string" ) {
3987
                        data = type;
3988
                        type = "fx";
3989
                        setter--;
3990
                }
3991
3992
                if ( arguments.length < setter ) {
3993
                        return jQuery.queue( this[0], type );
3994
                }
3995
3996
                return data === undefined ?
3997
                        this :
3998
                        this.each(function() {
3999
                                var queue = jQuery.queue( this, type, data );
4000
4001
                                // ensure a hooks for this queue
4002
                                jQuery._queueHooks( this, type );
4003
4004
                                if ( type === "fx" && queue[0] !== "inprogress" ) {
4005
                                        jQuery.dequeue( this, type );
4006
                                }
4007
                        });
4008
        },
4009
        dequeue: function( type ) {
4010
                return this.each(function() {
4011
                        jQuery.dequeue( this, type );
4012
                });
4013
        },
4014
        // Based off of the plugin by Clint Helfers, with permission.
4015
        // http://blindsignals.com/index.php/2009/07/jquery-delay/
4016
        delay: function( time, type ) {
4017
                time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
4018
                type = type || "fx";
4019
4020
                return this.queue( type, function( next, hooks ) {
4021
                        var timeout = setTimeout( next, time );
4022
                        hooks.stop = function() {
4023
                                clearTimeout( timeout );
4024
                        };
4025
                });
4026
        },
4027
        clearQueue: function( type ) {
4028
                return this.queue( type || "fx", [] );
4029
        },
4030
        // Get a promise resolved when queues of a certain type
4031
        // are emptied (fx is the type by default)
4032
        promise: function( type, obj ) {
4033
                var tmp,
4034
                        count = 1,
4035
                        defer = jQuery.Deferred(),
4036
                        elements = this,
4037
                        i = this.length,
4038
                        resolve = function() {
4039
                                if ( !( --count ) ) {
4040
                                        defer.resolveWith( elements, [ elements ] );
4041
                                }
4042
                        };
4043
4044
                if ( typeof type !== "string" ) {
4045
                        obj = type;
4046
                        type = undefined;
4047
                }
4048
                type = type || "fx";
4049
4050
                while( i-- ) {
4051
                        tmp = jQuery._data( elements[ i ], type + "queueHooks" );
4052
                        if ( tmp && tmp.empty ) {
4053
                                count++;
4054
                                tmp.empty.add( resolve );
4055
                        }
4056
                }
4057
                resolve();
4058
                return defer.promise( obj );
4059
        }
4060
});
4061
var nodeHook, boolHook,
4062
        rclass = /[\t\r\n\f]/g,
4063
        rreturn = /\r/g,
4064
        rfocusable = /^(?:input|select|textarea|button|object)$/i,
4065
        rclickable = /^(?:a|area)$/i,
4066
        ruseDefault = /^(?:checked|selected)$/i,
4067
        getSetAttribute = jQuery.support.getSetAttribute,
4068
        getSetInput = jQuery.support.input;
4069
4070
jQuery.fn.extend({
4071
        attr: function( name, value ) {
4072
                return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
4073
        },
4074
4075
        removeAttr: function( name ) {
4076
                return this.each(function() {
4077
                        jQuery.removeAttr( this, name );
4078
                });
4079
        },
4080
4081
        prop: function( name, value ) {
4082
                return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
4083
        },
4084
4085
        removeProp: function( name ) {
4086
                name = jQuery.propFix[ name ] || name;
4087
                return this.each(function() {
4088
                        // try/catch handles cases where IE balks (such as removing a property on window)
4089
                        try {
4090
                                this[ name ] = undefined;
4091
                                delete this[ name ];
4092
                        } catch( e ) {}
4093
                });
4094
        },
4095
4096
        addClass: function( value ) {
4097
                var classes, elem, cur, clazz, j,
4098
                        i = 0,
4099
                        len = this.length,
4100
                        proceed = typeof value === "string" && value;
4101
4102
                if ( jQuery.isFunction( value ) ) {
4103
                        return this.each(function( j ) {
4104
                                jQuery( this ).addClass( value.call( this, j, this.className ) );
4105
                        });
4106
                }
4107
4108
                if ( proceed ) {
4109
                        // The disjunction here is for better compressibility (see removeClass)
4110
                        classes = ( value || "" ).match( core_rnotwhite ) || [];
4111
4112
                        for ( ; i < len; i++ ) {
4113
                                elem = this[ i ];
4114
                                cur = elem.nodeType === 1 && ( elem.className ?
4115
                                        ( " " + elem.className + " " ).replace( rclass, " " ) :
4116
                                        " "
4117
                                );
4118
4119
                                if ( cur ) {
4120
                                        j = 0;
4121
                                        while ( (clazz = classes[j++]) ) {
4122
                                                if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
4123
                                                        cur += clazz + " ";
4124
                                                }
4125
                                        }
4126
                                        elem.className = jQuery.trim( cur );
4127
4128
                                }
4129
                        }
4130
                }
4131
4132
                return this;
4133
        },
4134
4135
        removeClass: function( value ) {
4136
                var classes, elem, cur, clazz, j,
4137
                        i = 0,
4138
                        len = this.length,
4139
                        proceed = arguments.length === 0 || typeof value === "string" && value;
4140
4141
                if ( jQuery.isFunction( value ) ) {
4142
                        return this.each(function( j ) {
4143
                                jQuery( this ).removeClass( value.call( this, j, this.className ) );
4144
                        });
4145
                }
4146
                if ( proceed ) {
4147
                        classes = ( value || "" ).match( core_rnotwhite ) || [];
4148
4149
                        for ( ; i < len; i++ ) {
4150
                                elem = this[ i ];
4151
                                // This expression is here for better compressibility (see addClass)
4152
                                cur = elem.nodeType === 1 && ( elem.className ?
4153
                                        ( " " + elem.className + " " ).replace( rclass, " " ) :
4154
                                        ""
4155
                                );
4156
4157
                                if ( cur ) {
4158
                                        j = 0;
4159
                                        while ( (clazz = classes[j++]) ) {
4160
                                                // Remove *all* instances
4161
                                                while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
4162
                                                        cur = cur.replace( " " + clazz + " ", " " );
4163
                                                }
4164
                                        }
4165
                                        elem.className = value ? jQuery.trim( cur ) : "";
4166
                                }
4167
                        }
4168
                }
4169
4170
                return this;
4171
        },
4172
4173
        toggleClass: function( value, stateVal ) {
4174
                var type = typeof value;
4175
4176
                if ( typeof stateVal === "boolean" && type === "string" ) {
4177
                        return stateVal ? this.addClass( value ) : this.removeClass( value );
4178
                }
4179
4180
                if ( jQuery.isFunction( value ) ) {
4181
                        return this.each(function( i ) {
4182
                                jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
4183
                        });
4184
                }
4185
4186
                return this.each(function() {
4187
                        if ( type === "string" ) {
4188
                                // toggle individual class names
4189
                                var className,
4190
                                        i = 0,
4191
                                        self = jQuery( this ),
4192
                                        classNames = value.match( core_rnotwhite ) || [];
4193
4194
                                while ( (className = classNames[ i++ ]) ) {
4195
                                        // check each className given, space separated list
4196
                                        if ( self.hasClass( className ) ) {
4197
                                                self.removeClass( className );
4198
                                        } else {
4199
                                                self.addClass( className );
4200
                                        }
4201
                                }
4202
4203
                        // Toggle whole class name
4204
                        } else if ( type === core_strundefined || type === "boolean" ) {
4205
                                if ( this.className ) {
4206
                                        // store className if set
4207
                                        jQuery._data( this, "__className__", this.className );
4208
                                }
4209
4210
                                // If the element has a class name or if we're passed "false",
4211
                                // then remove the whole classname (if there was one, the above saved it).
4212
                                // Otherwise bring back whatever was previously saved (if anything),
4213
                                // falling back to the empty string if nothing was stored.
4214
                                this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
4215
                        }
4216
                });
4217
        },
4218
4219
        hasClass: function( selector ) {
4220
                var className = " " + selector + " ",
4221
                        i = 0,
4222
                        l = this.length;
4223
                for ( ; i < l; i++ ) {
4224
                        if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
4225
                                return true;
4226
                        }
4227
                }
4228
4229
                return false;
4230
        },
4231
4232
        val: function( value ) {
4233
                var ret, hooks, isFunction,
4234
                        elem = this[0];
4235
4236
                if ( !arguments.length ) {
4237
                        if ( elem ) {
4238
                                hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
4239
4240
                                if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
4241
                                        return ret;
4242
                                }
4243
4244
                                ret = elem.value;
4245
4246
                                return typeof ret === "string" ?
4247
                                        // handle most common string cases
4248
                                        ret.replace(rreturn, "") :
4249
                                        // handle cases where value is null/undef or number
4250
                                        ret == null ? "" : ret;
4251
                        }
4252
4253
                        return;
4254
                }
4255
4256
                isFunction = jQuery.isFunction( value );
4257
4258
                return this.each(function( i ) {
4259
                        var val;
4260
4261
                        if ( this.nodeType !== 1 ) {
4262
                                return;
4263
                        }
4264
4265
                        if ( isFunction ) {
4266
                                val = value.call( this, i, jQuery( this ).val() );
4267
                        } else {
4268
                                val = value;
4269
                        }
4270
4271
                        // Treat null/undefined as ""; convert numbers to string
4272
                        if ( val == null ) {
4273
                                val = "";
4274
                        } else if ( typeof val === "number" ) {
4275
                                val += "";
4276
                        } else if ( jQuery.isArray( val ) ) {
4277
                                val = jQuery.map(val, function ( value ) {
4278
                                        return value == null ? "" : value + "";
4279
                                });
4280
                        }
4281
4282
                        hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
4283
4284
                        // If set returns undefined, fall back to normal setting
4285
                        if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
4286
                                this.value = val;
4287
                        }
4288
                });
4289
        }
4290
});
4291
4292
jQuery.extend({
4293
        valHooks: {
4294
                option: {
4295
                        get: function( elem ) {
4296
                                // Use proper attribute retrieval(#6932, #12072)
4297
                                var val = jQuery.find.attr( elem, "value" );
4298
                                return val != null ?
4299
                                        val :
4300
                                        elem.text;
4301
                        }
4302
                },
4303
                select: {
4304
                        get: function( elem ) {
4305
                                var value, option,
4306
                                        options = elem.options,
4307
                                        index = elem.selectedIndex,
4308
                                        one = elem.type === "select-one" || index < 0,
4309
                                        values = one ? null : [],
4310
                                        max = one ? index + 1 : options.length,
4311
                                        i = index < 0 ?
4312
                                                max :
4313
                                                one ? index : 0;
4314
4315
                                // Loop through all the selected options
4316
                                for ( ; i < max; i++ ) {
4317
                                        option = options[ i ];
4318
4319
                                        // oldIE doesn't update selected after form reset (#2551)
4320
                                        if ( ( option.selected || i === index ) &&
4321
                                                        // Don't return options that are disabled or in a disabled optgroup
4322
                                                        ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
4323
                                                        ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
4324
4325
                                                // Get the specific value for the option
4326
                                                value = jQuery( option ).val();
4327
4328
                                                // We don't need an array for one selects
4329
                                                if ( one ) {
4330
                                                        return value;
4331
                                                }
4332
4333
                                                // Multi-Selects return an array
4334
                                                values.push( value );
4335
                                        }
4336
                                }
4337
4338
                                return values;
4339
                        },
4340
4341
                        set: function( elem, value ) {
4342
                                var optionSet, option,
4343
                                        options = elem.options,
4344
                                        values = jQuery.makeArray( value ),
4345
                                        i = options.length;
4346
4347
                                while ( i-- ) {
4348
                                        option = options[ i ];
4349
                                        if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
4350
                                                optionSet = true;
4351
                                        }
4352
                                }
4353
4354
                                // force browsers to behave consistently when non-matching value is set
4355
                                if ( !optionSet ) {
4356
                                        elem.selectedIndex = -1;
4357
                                }
4358
                                return values;
4359
                        }
4360
                }
4361
        },
4362
4363
        attr: function( elem, name, value ) {
4364
                var hooks, ret,
4365
                        nType = elem.nodeType;
4366
4367
                // don't get/set attributes on text, comment and attribute nodes
4368
                if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
4369
                        return;
4370
                }
4371
4372
                // Fallback to prop when attributes are not supported
4373
                if ( typeof elem.getAttribute === core_strundefined ) {
4374
                        return jQuery.prop( elem, name, value );
4375
                }
4376
4377
                // All attributes are lowercase
4378
                // Grab necessary hook if one is defined
4379
                if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
4380
                        name = name.toLowerCase();
4381
                        hooks = jQuery.attrHooks[ name ] ||
4382
                                ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
4383
                }
4384
4385
                if ( value !== undefined ) {
4386
4387
                        if ( value === null ) {
4388
                                jQuery.removeAttr( elem, name );
4389
4390
                        } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
4391
                                return ret;
4392
4393
                        } else {
4394
                                elem.setAttribute( name, value + "" );
4395
                                return value;
4396
                        }
4397
4398
                } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
4399
                        return ret;
4400
4401
                } else {
4402
                        ret = jQuery.find.attr( elem, name );
4403
4404
                        // Non-existent attributes return null, we normalize to undefined
4405
                        return ret == null ?
4406
                                undefined :
4407
                                ret;
4408
                }
4409
        },
4410
4411
        removeAttr: function( elem, value ) {
4412
                var name, propName,
4413
                        i = 0,
4414
                        attrNames = value && value.match( core_rnotwhite );
4415
4416
                if ( attrNames && elem.nodeType === 1 ) {
4417
                        while ( (name = attrNames[i++]) ) {
4418
                                propName = jQuery.propFix[ name ] || name;
4419
4420
                                // Boolean attributes get special treatment (#10870)
4421
                                if ( jQuery.expr.match.bool.test( name ) ) {
4422
                                        // Set corresponding property to false
4423
                                        if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
4424
                                                elem[ propName ] = false;
4425
                                        // Support: IE<9
4426
                                        // Also clear defaultChecked/defaultSelected (if appropriate)
4427
                                        } else {
4428
                                                elem[ jQuery.camelCase( "default-" + name ) ] =
4429
                                                        elem[ propName ] = false;
4430
                                        }
4431
4432
                                // See #9699 for explanation of this approach (setting first, then removal)
4433
                                } else {
4434
                                        jQuery.attr( elem, name, "" );
4435
                                }
4436
4437
                                elem.removeAttribute( getSetAttribute ? name : propName );
4438
                        }
4439
                }
4440
        },
4441
4442
        attrHooks: {
4443
                type: {
4444
                        set: function( elem, value ) {
4445
                                if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
4446
                                        // Setting the type on a radio button after the value resets the value in IE6-9
4447
                                        // Reset value to default in case type is set after value during creation
4448
                                        var val = elem.value;
4449
                                        elem.setAttribute( "type", value );
4450
                                        if ( val ) {
4451
                                                elem.value = val;
4452
                                        }
4453
                                        return value;
4454
                                }
4455
                        }
4456
                }
4457
        },
4458
4459
        propFix: {
4460
                "for": "htmlFor",
4461
                "class": "className"
4462
        },
4463
4464
        prop: function( elem, name, value ) {
4465
                var ret, hooks, notxml,
4466
                        nType = elem.nodeType;
4467
4468
                // don't get/set properties on text, comment and attribute nodes
4469
                if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
4470
                        return;
4471
                }
4472
4473
                notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
4474
4475
                if ( notxml ) {
4476
                        // Fix name and attach hooks
4477
                        name = jQuery.propFix[ name ] || name;
4478
                        hooks = jQuery.propHooks[ name ];
4479
                }
4480
4481
                if ( value !== undefined ) {
4482
                        return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
4483
                                ret :
4484
                                ( elem[ name ] = value );
4485
4486
                } else {
4487
                        return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
4488
                                ret :
4489
                                elem[ name ];
4490
                }
4491
        },
4492
4493
        propHooks: {
4494
                tabIndex: {
4495
                        get: function( elem ) {
4496
                                // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
4497
                                // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
4498
                                // Use proper attribute retrieval(#12072)
4499
                                var tabindex = jQuery.find.attr( elem, "tabindex" );
4500
4501
                                return tabindex ?
4502
                                        parseInt( tabindex, 10 ) :
4503
                                        rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
4504
                                                0 :
4505
                                                -1;
4506
                        }
4507
                }
4508
        }
4509
});
4510
4511
// Hooks for boolean attributes
4512
boolHook = {
4513
        set: function( elem, value, name ) {
4514
                if ( value === false ) {
4515
                        // Remove boolean attributes when set to false
4516
                        jQuery.removeAttr( elem, name );
4517
                } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
4518
                        // IE<8 needs the *property* name
4519
                        elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
4520
4521
                // Use defaultChecked and defaultSelected for oldIE
4522
                } else {
4523
                        elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
4524
                }
4525
4526
                return name;
4527
        }
4528
};
4529
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
4530
        var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
4531
4532
        jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
4533
                function( elem, name, isXML ) {
4534
                        var fn = jQuery.expr.attrHandle[ name ],
4535
                                ret = isXML ?
4536
                                        undefined :
4537
                                        /* jshint eqeqeq: false */
4538
                                        (jQuery.expr.attrHandle[ name ] = undefined) !=
4539
                                                getter( elem, name, isXML ) ?
4540
4541
                                                name.toLowerCase() :
4542
                                                null;
4543
                        jQuery.expr.attrHandle[ name ] = fn;
4544
                        return ret;
4545
                } :
4546
                function( elem, name, isXML ) {
4547
                        return isXML ?
4548
                                undefined :
4549
                                elem[ jQuery.camelCase( "default-" + name ) ] ?
4550
                                        name.toLowerCase() :
4551
                                        null;
4552
                };
4553
});
4554
4555
// fix oldIE attroperties
4556
if ( !getSetInput || !getSetAttribute ) {
4557
        jQuery.attrHooks.value = {
4558
                set: function( elem, value, name ) {
4559
                        if ( jQuery.nodeName( elem, "input" ) ) {
4560
                                // Does not return so that setAttribute is also used
4561
                                elem.defaultValue = value;
4562
                        } else {
4563
                                // Use nodeHook if defined (#1954); otherwise setAttribute is fine
4564
                                return nodeHook && nodeHook.set( elem, value, name );
4565
                        }
4566
                }
4567
        };
4568
}
4569
4570
// IE6/7 do not support getting/setting some attributes with get/setAttribute
4571
if ( !getSetAttribute ) {
4572
4573
        // Use this for any attribute in IE6/7
4574
        // This fixes almost every IE6/7 issue
4575
        nodeHook = {
4576
                set: function( elem, value, name ) {
4577
                        // Set the existing or create a new attribute node
4578
                        var ret = elem.getAttributeNode( name );
4579
                        if ( !ret ) {
4580
                                elem.setAttributeNode(
4581
                                        (ret = elem.ownerDocument.createAttribute( name ))
4582
                                );
4583
                        }
4584
4585
                        ret.value = value += "";
4586
4587
                        // Break association with cloned elements by also using setAttribute (#9646)
4588
                        return name === "value" || value === elem.getAttribute( name ) ?
4589
                                value :
4590
                                undefined;
4591
                }
4592
        };
4593
        jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
4594
                // Some attributes are constructed with empty-string values when not defined
4595
                function( elem, name, isXML ) {
4596
                        var ret;
4597
                        return isXML ?
4598
                                undefined :
4599
                                (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
4600
                                        ret.value :
4601
                                        null;
4602
                };
4603
        jQuery.valHooks.button = {
4604
                get: function( elem, name ) {
4605
                        var ret = elem.getAttributeNode( name );
4606
                        return ret && ret.specified ?
4607
                                ret.value :
4608
                                undefined;
4609
                },
4610
                set: nodeHook.set
4611
        };
4612
4613
        // Set contenteditable to false on removals(#10429)
4614
        // Setting to empty string throws an error as an invalid value
4615
        jQuery.attrHooks.contenteditable = {
4616
                set: function( elem, value, name ) {
4617
                        nodeHook.set( elem, value === "" ? false : value, name );
4618
                }
4619
        };
4620
4621
        // Set width and height to auto instead of 0 on empty string( Bug #8150 )
4622
        // This is for removals
4623
        jQuery.each([ "width", "height" ], function( i, name ) {
4624
                jQuery.attrHooks[ name ] = {
4625
                        set: function( elem, value ) {
4626
                                if ( value === "" ) {
4627
                                        elem.setAttribute( name, "auto" );
4628
                                        return value;
4629
                                }
4630
                        }
4631
                };
4632
        });
4633
}
4634
4635
4636
// Some attributes require a special call on IE
4637
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
4638
if ( !jQuery.support.hrefNormalized ) {
4639
        // href/src property should get the full normalized URL (#10299/#12915)
4640
        jQuery.each([ "href", "src" ], function( i, name ) {
4641
                jQuery.propHooks[ name ] = {
4642
                        get: function( elem ) {
4643
                                return elem.getAttribute( name, 4 );
4644
                        }
4645
                };
4646
        });
4647
}
4648
4649
if ( !jQuery.support.style ) {
4650
        jQuery.attrHooks.style = {
4651
                get: function( elem ) {
4652
                        // Return undefined in the case of empty string
4653
                        // Note: IE uppercases css property names, but if we were to .toLowerCase()
4654
                        // .cssText, that would destroy case senstitivity in URL's, like in "background"
4655
                        return elem.style.cssText || undefined;
4656
                },
4657
                set: function( elem, value ) {
4658
                        return ( elem.style.cssText = value + "" );
4659
                }
4660
        };
4661
}
4662
4663
// Safari mis-reports the default selected property of an option
4664
// Accessing the parent's selectedIndex property fixes it
4665
if ( !jQuery.support.optSelected ) {
4666
        jQuery.propHooks.selected = {
4667
                get: function( elem ) {
4668
                        var parent = elem.parentNode;
4669
4670
                        if ( parent ) {
4671
                                parent.selectedIndex;
4672
4673
                                // Make sure that it also works with optgroups, see #5701
4674
                                if ( parent.parentNode ) {
4675
                                        parent.parentNode.selectedIndex;
4676
                                }
4677
                        }
4678
                        return null;
4679
                }
4680
        };
4681
}
4682
4683
jQuery.each([
4684
        "tabIndex",
4685
        "readOnly",
4686
        "maxLength",
4687
        "cellSpacing",
4688
        "cellPadding",
4689
        "rowSpan",
4690
        "colSpan",
4691
        "useMap",
4692
        "frameBorder",
4693
        "contentEditable"
4694
], function() {
4695
        jQuery.propFix[ this.toLowerCase() ] = this;
4696
});
4697
4698
// IE6/7 call enctype encoding
4699
if ( !jQuery.support.enctype ) {
4700
        jQuery.propFix.enctype = "encoding";
4701
}
4702
4703
// Radios and checkboxes getter/setter
4704
jQuery.each([ "radio", "checkbox" ], function() {
4705
        jQuery.valHooks[ this ] = {
4706
                set: function( elem, value ) {
4707
                        if ( jQuery.isArray( value ) ) {
4708
                                return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
4709
                        }
4710
                }
4711
        };
4712
        if ( !jQuery.support.checkOn ) {
4713
                jQuery.valHooks[ this ].get = function( elem ) {
4714
                        // Support: Webkit
4715
                        // "" is returned instead of "on" if a value isn't specified
4716
                        return elem.getAttribute("value") === null ? "on" : elem.value;
4717
                };
4718
        }
4719
});
4720
var rformElems = /^(?:input|select|textarea)$/i,
4721
        rkeyEvent = /^key/,
4722
        rmouseEvent = /^(?:mouse|contextmenu)|click/,
4723
        rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
4724
        rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
4725
4726
function returnTrue() {
4727
        return true;
4728
}
4729
4730
function returnFalse() {
4731
        return false;
4732
}
4733
4734
function safeActiveElement() {
4735
        try {
4736
                return document.activeElement;
4737
        } catch ( err ) { }
4738
}
4739
4740
/*
4741
 * Helper functions for managing events -- not part of the public interface.
4742
 * Props to Dean Edwards' addEvent library for many of the ideas.
4743
 */
4744
jQuery.event = {
4745
4746
        global: {},
4747
4748
        add: function( elem, types, handler, data, selector ) {
4749
                var tmp, events, t, handleObjIn,
4750
                        special, eventHandle, handleObj,
4751
                        handlers, type, namespaces, origType,
4752
                        elemData = jQuery._data( elem );
4753
4754
                // Don't attach events to noData or text/comment nodes (but allow plain objects)
4755
                if ( !elemData ) {
4756
                        return;
4757
                }
4758
4759
                // Caller can pass in an object of custom data in lieu of the handler
4760
                if ( handler.handler ) {
4761
                        handleObjIn = handler;
4762
                        handler = handleObjIn.handler;
4763
                        selector = handleObjIn.selector;
4764
                }
4765
4766
                // Make sure that the handler has a unique ID, used to find/remove it later
4767
                if ( !handler.guid ) {
4768
                        handler.guid = jQuery.guid++;
4769
                }
4770
4771
                // Init the element's event structure and main handler, if this is the first
4772
                if ( !(events = elemData.events) ) {
4773
                        events = elemData.events = {};
4774
                }
4775
                if ( !(eventHandle = elemData.handle) ) {
4776
                        eventHandle = elemData.handle = function( e ) {
4777
                                // Discard the second event of a jQuery.event.trigger() and
4778
                                // when an event is called after a page has unloaded
4779
                                return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
4780
                                        jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
4781
                                        undefined;
4782
                        };
4783
                        // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
4784
                        eventHandle.elem = elem;
4785
                }
4786
4787
                // Handle multiple events separated by a space
4788
                types = ( types || "" ).match( core_rnotwhite ) || [""];
4789
                t = types.length;
4790
                while ( t-- ) {
4791
                        tmp = rtypenamespace.exec( types[t] ) || [];
4792
                        type = origType = tmp[1];
4793
                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
4794
4795
                        // There *must* be a type, no attaching namespace-only handlers
4796
                        if ( !type ) {
4797
                                continue;
4798
                        }
4799
4800
                        // If event changes its type, use the special event handlers for the changed type
4801
                        special = jQuery.event.special[ type ] || {};
4802
4803
                        // If selector defined, determine special event api type, otherwise given type
4804
                        type = ( selector ? special.delegateType : special.bindType ) || type;
4805
4806
                        // Update special based on newly reset type
4807
                        special = jQuery.event.special[ type ] || {};
4808
4809
                        // handleObj is passed to all event handlers
4810
                        handleObj = jQuery.extend({
4811
                                type: type,
4812
                                origType: origType,
4813
                                data: data,
4814
                                handler: handler,
4815
                                guid: handler.guid,
4816
                                selector: selector,
4817
                                needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4818
                                namespace: namespaces.join(".")
4819
                        }, handleObjIn );
4820
4821
                        // Init the event handler queue if we're the first
4822
                        if ( !(handlers = events[ type ]) ) {
4823
                                handlers = events[ type ] = [];
4824
                                handlers.delegateCount = 0;
4825
4826
                                // Only use addEventListener/attachEvent if the special events handler returns false
4827
                                if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4828
                                        // Bind the global event handler to the element
4829
                                        if ( elem.addEventListener ) {
4830
                                                elem.addEventListener( type, eventHandle, false );
4831
4832
                                        } else if ( elem.attachEvent ) {
4833
                                                elem.attachEvent( "on" + type, eventHandle );
4834
                                        }
4835
                                }
4836
                        }
4837
4838
                        if ( special.add ) {
4839
                                special.add.call( elem, handleObj );
4840
4841
                                if ( !handleObj.handler.guid ) {
4842
                                        handleObj.handler.guid = handler.guid;
4843
                                }
4844
                        }
4845
4846
                        // Add to the element's handler list, delegates in front
4847
                        if ( selector ) {
4848
                                handlers.splice( handlers.delegateCount++, 0, handleObj );
4849
                        } else {
4850
                                handlers.push( handleObj );
4851
                        }
4852
4853
                        // Keep track of which events have ever been used, for event optimization
4854
                        jQuery.event.global[ type ] = true;
4855
                }
4856
4857
                // Nullify elem to prevent memory leaks in IE
4858
                elem = null;
4859
        },
4860
4861
        // Detach an event or set of events from an element
4862
        remove: function( elem, types, handler, selector, mappedTypes ) {
4863
                var j, handleObj, tmp,
4864
                        origCount, t, events,
4865
                        special, handlers, type,
4866
                        namespaces, origType,
4867
                        elemData = jQuery.hasData( elem ) && jQuery._data( elem );
4868
4869
                if ( !elemData || !(events = elemData.events) ) {
4870
                        return;
4871
                }
4872
4873
                // Once for each type.namespace in types; type may be omitted
4874
                types = ( types || "" ).match( core_rnotwhite ) || [""];
4875
                t = types.length;
4876
                while ( t-- ) {
4877
                        tmp = rtypenamespace.exec( types[t] ) || [];
4878
                        type = origType = tmp[1];
4879
                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
4880
4881
                        // Unbind all events (on this namespace, if provided) for the element
4882
                        if ( !type ) {
4883
                                for ( type in events ) {
4884
                                        jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4885
                                }
4886
                                continue;
4887
                        }
4888
4889
                        special = jQuery.event.special[ type ] || {};
4890
                        type = ( selector ? special.delegateType : special.bindType ) || type;
4891
                        handlers = events[ type ] || [];
4892
                        tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
4893
4894
                        // Remove matching events
4895
                        origCount = j = handlers.length;
4896
                        while ( j-- ) {
4897
                                handleObj = handlers[ j ];
4898
4899
                                if ( ( mappedTypes || origType === handleObj.origType ) &&
4900
                                        ( !handler || handler.guid === handleObj.guid ) &&
4901
                                        ( !tmp || tmp.test( handleObj.namespace ) ) &&
4902
                                        ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
4903
                                        handlers.splice( j, 1 );
4904
4905
                                        if ( handleObj.selector ) {
4906
                                                handlers.delegateCount--;
4907
                                        }
4908
                                        if ( special.remove ) {
4909
                                                special.remove.call( elem, handleObj );
4910
                                        }
4911
                                }
4912
                        }
4913
4914
                        // Remove generic event handler if we removed something and no more handlers exist
4915
                        // (avoids potential for endless recursion during removal of special event handlers)
4916
                        if ( origCount && !handlers.length ) {
4917
                                if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4918
                                        jQuery.removeEvent( elem, type, elemData.handle );
4919
                                }
4920
4921
                                delete events[ type ];
4922
                        }
4923
                }
4924
4925
                // Remove the expando if it's no longer used
4926
                if ( jQuery.isEmptyObject( events ) ) {
4927
                        delete elemData.handle;
4928
4929
                        // removeData also checks for emptiness and clears the expando if empty
4930
                        // so use it instead of delete
4931
                        jQuery._removeData( elem, "events" );
4932
                }
4933
        },
4934
4935
        trigger: function( event, data, elem, onlyHandlers ) {
4936
                var handle, ontype, cur,
4937
                        bubbleType, special, tmp, i,
4938
                        eventPath = [ elem || document ],
4939
                        type = core_hasOwn.call( event, "type" ) ? event.type : event,
4940
                        namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
4941
4942
                cur = tmp = elem = elem || document;
4943
4944
                // Don't do events on text and comment nodes
4945
                if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
4946
                        return;
4947
                }
4948
4949
                // focus/blur morphs to focusin/out; ensure we're not firing them right now
4950
                if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
4951
                        return;
4952
                }
4953
4954
                if ( type.indexOf(".") >= 0 ) {
4955
                        // Namespaced trigger; create a regexp to match event type in handle()
4956
                        namespaces = type.split(".");
4957
                        type = namespaces.shift();
4958
                        namespaces.sort();
4959
                }
4960
                ontype = type.indexOf(":") < 0 && "on" + type;
4961
4962
                // Caller can pass in a jQuery.Event object, Object, or just an event type string
4963
                event = event[ jQuery.expando ] ?
4964
                        event :
4965
                        new jQuery.Event( type, typeof event === "object" && event );
4966
4967
                // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
4968
                event.isTrigger = onlyHandlers ? 2 : 3;
4969
                event.namespace = namespaces.join(".");
4970
                event.namespace_re = event.namespace ?
4971
                        new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
4972
                        null;
4973
4974
                // Clean up the event in case it is being reused
4975
                event.result = undefined;
4976
                if ( !event.target ) {
4977
                        event.target = elem;
4978
                }
4979
4980
                // Clone any incoming data and prepend the event, creating the handler arg list
4981
                data = data == null ?
4982
                        [ event ] :
4983
                        jQuery.makeArray( data, [ event ] );
4984
4985
                // Allow special events to draw outside the lines
4986
                special = jQuery.event.special[ type ] || {};
4987
                if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
4988
                        return;
4989
                }
4990
4991
                // Determine event propagation path in advance, per W3C events spec (#9951)
4992
                // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
4993
                if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
4994
4995
                        bubbleType = special.delegateType || type;
4996
                        if ( !rfocusMorph.test( bubbleType + type ) ) {
4997
                                cur = cur.parentNode;
4998
                        }
4999
                        for ( ; cur; cur = cur.parentNode ) {
5000
                                eventPath.push( cur );
5001
                                tmp = cur;
5002
                        }
5003
5004
                        // Only add window if we got to document (e.g., not plain obj or detached DOM)
5005
                        if ( tmp === (elem.ownerDocument || document) ) {
5006
                                eventPath.push( tmp.defaultView || tmp.parentWindow || window );
5007
                        }
5008
                }
5009
5010
                // Fire handlers on the event path
5011
                i = 0;
5012
                while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
5013
5014
                        event.type = i > 1 ?
5015
                                bubbleType :
5016
                                special.bindType || type;
5017
5018
                        // jQuery handler
5019
                        handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
5020
                        if ( handle ) {
5021
                                handle.apply( cur, data );
5022
                        }
5023
5024
                        // Native handler
5025
                        handle = ontype && cur[ ontype ];
5026
                        if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
5027
                                event.preventDefault();
5028
                        }
5029
                }
5030
                event.type = type;
5031
5032
                // If nobody prevented the default action, do it now
5033
                if ( !onlyHandlers && !event.isDefaultPrevented() ) {
5034
5035
                        if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
5036
                                jQuery.acceptData( elem ) ) {
5037
5038
                                // Call a native DOM method on the target with the same name name as the event.
5039
                                // Can't use an .isFunction() check here because IE6/7 fails that test.
5040
                                // Don't do default actions on window, that's where global variables be (#6170)
5041
                                if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
5042
5043
                                        // Don't re-trigger an onFOO event when we call its FOO() method
5044
                                        tmp = elem[ ontype ];
5045
5046
                                        if ( tmp ) {
5047
                                                elem[ ontype ] = null;
5048
                                        }
5049
5050
                                        // Prevent re-triggering of the same event, since we already bubbled it above
5051
                                        jQuery.event.triggered = type;
5052
                                        try {
5053
                                                elem[ type ]();
5054
                                        } catch ( e ) {
5055
                                                // IE<9 dies on focus/blur to hidden element (#1486,#12518)
5056
                                                // only reproducible on winXP IE8 native, not IE9 in IE8 mode
5057
                                        }
5058
                                        jQuery.event.triggered = undefined;
5059
5060
                                        if ( tmp ) {
5061
                                                elem[ ontype ] = tmp;
5062
                                        }
5063
                                }
5064
                        }
5065
                }
5066
5067
                return event.result;
5068
        },
5069
5070
        dispatch: function( event ) {
5071
5072
                // Make a writable jQuery.Event from the native event object
5073
                event = jQuery.event.fix( event );
5074
5075
                var i, ret, handleObj, matched, j,
5076
                        handlerQueue = [],
5077
                        args = core_slice.call( arguments ),
5078
                        handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
5079
                        special = jQuery.event.special[ event.type ] || {};
5080
5081
                // Use the fix-ed jQuery.Event rather than the (read-only) native event
5082
                args[0] = event;
5083
                event.delegateTarget = this;
5084
5085
                // Call the preDispatch hook for the mapped type, and let it bail if desired
5086
                if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5087
                        return;
5088
                }
5089
5090
                // Determine handlers
5091
                handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5092
5093
                // Run delegates first; they may want to stop propagation beneath us
5094
                i = 0;
5095
                while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
5096
                        event.currentTarget = matched.elem;
5097
5098
                        j = 0;
5099
                        while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
5100
5101
                                // Triggered event must either 1) have no namespace, or
5102
                                // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
5103
                                if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
5104
5105
                                        event.handleObj = handleObj;
5106
                                        event.data = handleObj.data;
5107
5108
                                        ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
5109
                                                        .apply( matched.elem, args );
5110
5111
                                        if ( ret !== undefined ) {
5112
                                                if ( (event.result = ret) === false ) {
5113
                                                        event.preventDefault();
5114
                                                        event.stopPropagation();
5115
                                                }
5116
                                        }
5117
                                }
5118
                        }
5119
                }
5120
5121
                // Call the postDispatch hook for the mapped type
5122
                if ( special.postDispatch ) {
5123
                        special.postDispatch.call( this, event );
5124
                }
5125
5126
                return event.result;
5127
        },
5128
5129
        handlers: function( event, handlers ) {
5130
                var sel, handleObj, matches, i,
5131
                        handlerQueue = [],
5132
                        delegateCount = handlers.delegateCount,
5133
                        cur = event.target;
5134
5135
                // Find delegate handlers
5136
                // Black-hole SVG <use> instance trees (#13180)
5137
                // Avoid non-left-click bubbling in Firefox (#3861)
5138
                if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
5139
5140
                        /* jshint eqeqeq: false */
5141
                        for ( ; cur != this; cur = cur.parentNode || this ) {
5142
                                /* jshint eqeqeq: true */
5143
5144
                                // Don't check non-elements (#13208)
5145
                                // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5146
                                if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
5147
                                        matches = [];
5148
                                        for ( i = 0; i < delegateCount; i++ ) {
5149
                                                handleObj = handlers[ i ];
5150
5151
                                                // Don't conflict with Object.prototype properties (#13203)
5152
                                                sel = handleObj.selector + " ";
5153
5154
                                                if ( matches[ sel ] === undefined ) {
5155
                                                        matches[ sel ] = handleObj.needsContext ?
5156
                                                                jQuery( sel, this ).index( cur ) >= 0 :
5157
                                                                jQuery.find( sel, this, null, [ cur ] ).length;
5158
                                                }
5159
                                                if ( matches[ sel ] ) {
5160
                                                        matches.push( handleObj );
5161
                                                }
5162
                                        }
5163
                                        if ( matches.length ) {
5164
                                                handlerQueue.push({ elem: cur, handlers: matches });
5165
                                        }
5166
                                }
5167
                        }
5168
                }
5169
5170
                // Add the remaining (directly-bound) handlers
5171
                if ( delegateCount < handlers.length ) {
5172
                        handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
5173
                }
5174
5175
                return handlerQueue;
5176
        },
5177
5178
        fix: function( event ) {
5179
                if ( event[ jQuery.expando ] ) {
5180
                        return event;
5181
                }
5182
5183
                // Create a writable copy of the event object and normalize some properties
5184
                var i, prop, copy,
5185
                        type = event.type,
5186
                        originalEvent = event,
5187
                        fixHook = this.fixHooks[ type ];
5188
5189
                if ( !fixHook ) {
5190
                        this.fixHooks[ type ] = fixHook =
5191
                                rmouseEvent.test( type ) ? this.mouseHooks :
5192
                                rkeyEvent.test( type ) ? this.keyHooks :
5193
                                {};
5194
                }
5195
                copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
5196
5197
                event = new jQuery.Event( originalEvent );
5198
5199
                i = copy.length;
5200
                while ( i-- ) {
5201
                        prop = copy[ i ];
5202
                        event[ prop ] = originalEvent[ prop ];
5203
                }
5204
5205
                // Support: IE<9
5206
                // Fix target property (#1925)
5207
                if ( !event.target ) {
5208
                        event.target = originalEvent.srcElement || document;
5209
                }
5210
5211
                // Support: Chrome 23+, Safari?
5212
                // Target should not be a text node (#504, #13143)
5213
                if ( event.target.nodeType === 3 ) {
5214
                        event.target = event.target.parentNode;
5215
                }
5216
5217
                // Support: IE<9
5218
                // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
5219
                event.metaKey = !!event.metaKey;
5220
5221
                return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
5222
        },
5223
5224
        // Includes some event props shared by KeyEvent and MouseEvent
5225
        props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
5226
5227
        fixHooks: {},
5228
5229
        keyHooks: {
5230
                props: "char charCode key keyCode".split(" "),
5231
                filter: function( event, original ) {
5232
5233
                        // Add which for key events
5234
                        if ( event.which == null ) {
5235
                                event.which = original.charCode != null ? original.charCode : original.keyCode;
5236
                        }
5237
5238
                        return event;
5239
                }
5240
        },
5241
5242
        mouseHooks: {
5243
                props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
5244
                filter: function( event, original ) {
5245
                        var body, eventDoc, doc,
5246
                                button = original.button,
5247
                                fromElement = original.fromElement;
5248
5249
                        // Calculate pageX/Y if missing and clientX/Y available
5250
                        if ( event.pageX == null && original.clientX != null ) {
5251
                                eventDoc = event.target.ownerDocument || document;
5252
                                doc = eventDoc.documentElement;
5253
                                body = eventDoc.body;
5254
5255
                                event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
5256
                                event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
5257
                        }
5258
5259
                        // Add relatedTarget, if necessary
5260
                        if ( !event.relatedTarget && fromElement ) {
5261
                                event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
5262
                        }
5263
5264
                        // Add which for click: 1 === left; 2 === middle; 3 === right
5265
                        // Note: button is not normalized, so don't use it
5266
                        if ( !event.which && button !== undefined ) {
5267
                                event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
5268
                        }
5269
5270
                        return event;
5271
                }
5272
        },
5273
5274
        special: {
5275
                load: {
5276
                        // Prevent triggered image.load events from bubbling to window.load
5277
                        noBubble: true
5278
                },
5279
                focus: {
5280
                        // Fire native event if possible so blur/focus sequence is correct
5281
                        trigger: function() {
5282
                                if ( this !== safeActiveElement() && this.focus ) {
5283
                                        try {
5284
                                                this.focus();
5285
                                                return false;
5286
                                        } catch ( e ) {
5287
                                                // Support: IE<9
5288
                                                // If we error on focus to hidden element (#1486, #12518),
5289
                                                // let .trigger() run the handlers
5290
                                        }
5291
                                }
5292
                        },
5293
                        delegateType: "focusin"
5294
                },
5295
                blur: {
5296
                        trigger: function() {
5297
                                if ( this === safeActiveElement() && this.blur ) {
5298
                                        this.blur();
5299
                                        return false;
5300
                                }
5301
                        },
5302
                        delegateType: "focusout"
5303
                },
5304
                click: {
5305
                        // For checkbox, fire native event so checked state will be right
5306
                        trigger: function() {
5307
                                if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
5308
                                        this.click();
5309
                                        return false;
5310
                                }
5311
                        },
5312
5313
                        // For cross-browser consistency, don't fire native .click() on links
5314
                        _default: function( event ) {
5315
                                return jQuery.nodeName( event.target, "a" );
5316
                        }
5317
                },
5318
5319
                beforeunload: {
5320
                        postDispatch: function( event ) {
5321
5322
                                // Even when returnValue equals to undefined Firefox will still show alert
5323
                                if ( event.result !== undefined ) {
5324
                                        event.originalEvent.returnValue = event.result;
5325
                                }
5326
                        }
5327
                }
5328
        },
5329
5330
        simulate: function( type, elem, event, bubble ) {
5331
                // Piggyback on a donor event to simulate a different one.
5332
                // Fake originalEvent to avoid donor's stopPropagation, but if the
5333
                // simulated event prevents default then we do the same on the donor.
5334
                var e = jQuery.extend(
5335
                        new jQuery.Event(),
5336
                        event,
5337
                        {
5338
                                type: type,
5339
                                isSimulated: true,
5340
                                originalEvent: {}
5341
                        }
5342
                );
5343
                if ( bubble ) {
5344
                        jQuery.event.trigger( e, null, elem );
5345
                } else {
5346
                        jQuery.event.dispatch.call( elem, e );
5347
                }
5348
                if ( e.isDefaultPrevented() ) {
5349
                        event.preventDefault();
5350
                }
5351
        }
5352
};
5353
5354
jQuery.removeEvent = document.removeEventListener ?
5355
        function( elem, type, handle ) {
5356
                if ( elem.removeEventListener ) {
5357
                        elem.removeEventListener( type, handle, false );
5358
                }
5359
        } :
5360
        function( elem, type, handle ) {
5361
                var name = "on" + type;
5362
5363
                if ( elem.detachEvent ) {
5364
5365
                        // #8545, #7054, preventing memory leaks for custom events in IE6-8
5366
                        // detachEvent needed property on element, by name of that event, to properly expose it to GC
5367
                        if ( typeof elem[ name ] === core_strundefined ) {
5368
                                elem[ name ] = null;
5369
                        }
5370
5371
                        elem.detachEvent( name, handle );
5372
                }
5373
        };
5374
5375
jQuery.Event = function( src, props ) {
5376
        // Allow instantiation without the 'new' keyword
5377
        if ( !(this instanceof jQuery.Event) ) {
5378
                return new jQuery.Event( src, props );
5379
        }
5380
5381
        // Event object
5382
        if ( src && src.type ) {
5383
                this.originalEvent = src;
5384
                this.type = src.type;
5385
5386
                // Events bubbling up the document may have been marked as prevented
5387
                // by a handler lower down the tree; reflect the correct value.
5388
                this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
5389
                        src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
5390
5391
        // Event type
5392
        } else {
5393
                this.type = src;
5394
        }
5395
5396
        // Put explicitly provided properties onto the event object
5397
        if ( props ) {
5398
                jQuery.extend( this, props );
5399
        }
5400
5401
        // Create a timestamp if incoming event doesn't have one
5402
        this.timeStamp = src && src.timeStamp || jQuery.now();
5403
5404
        // Mark it as fixed
5405
        this[ jQuery.expando ] = true;
5406
};
5407
5408
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5409
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5410
jQuery.Event.prototype = {
5411
        isDefaultPrevented: returnFalse,
5412
        isPropagationStopped: returnFalse,
5413
        isImmediatePropagationStopped: returnFalse,
5414
5415
        preventDefault: function() {
5416
                var e = this.originalEvent;
5417
5418
                this.isDefaultPrevented = returnTrue;
5419
                if ( !e ) {
5420
                        return;
5421
                }
5422
5423
                // If preventDefault exists, run it on the original event
5424
                if ( e.preventDefault ) {
5425
                        e.preventDefault();
5426
5427
                // Support: IE
5428
                // Otherwise set the returnValue property of the original event to false
5429
                } else {
5430
                        e.returnValue = false;
5431
                }
5432
        },
5433
        stopPropagation: function() {
5434
                var e = this.originalEvent;
5435
5436
                this.isPropagationStopped = returnTrue;
5437
                if ( !e ) {
5438
                        return;
5439
                }
5440
                // If stopPropagation exists, run it on the original event
5441
                if ( e.stopPropagation ) {
5442
                        e.stopPropagation();
5443
                }
5444
5445
                // Support: IE
5446
                // Set the cancelBubble property of the original event to true
5447
                e.cancelBubble = true;
5448
        },
5449
        stopImmediatePropagation: function() {
5450
                this.isImmediatePropagationStopped = returnTrue;
5451
                this.stopPropagation();
5452
        }
5453
};
5454
5455
// Create mouseenter/leave events using mouseover/out and event-time checks
5456
jQuery.each({
5457
        mouseenter: "mouseover",
5458
        mouseleave: "mouseout"
5459
}, function( orig, fix ) {
5460
        jQuery.event.special[ orig ] = {
5461
                delegateType: fix,
5462
                bindType: fix,
5463
5464
                handle: function( event ) {
5465
                        var ret,
5466
                                target = this,
5467
                                related = event.relatedTarget,
5468
                                handleObj = event.handleObj;
5469
5470
                        // For mousenter/leave call the handler if related is outside the target.
5471
                        // NB: No relatedTarget if the mouse left/entered the browser window
5472
                        if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
5473
                                event.type = handleObj.origType;
5474
                                ret = handleObj.handler.apply( this, arguments );
5475
                                event.type = fix;
5476
                        }
5477
                        return ret;
5478
                }
5479
        };
5480
});
5481
5482
// IE submit delegation
5483
if ( !jQuery.support.submitBubbles ) {
5484
5485
        jQuery.event.special.submit = {
5486
                setup: function() {
5487
                        // Only need this for delegated form submit events
5488
                        if ( jQuery.nodeName( this, "form" ) ) {
5489
                                return false;
5490
                        }
5491
5492
                        // Lazy-add a submit handler when a descendant form may potentially be submitted
5493
                        jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
5494
                                // Node name check avoids a VML-related crash in IE (#9807)
5495
                                var elem = e.target,
5496
                                        form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
5497
                                if ( form && !jQuery._data( form, "submitBubbles" ) ) {
5498
                                        jQuery.event.add( form, "submit._submit", function( event ) {
5499
                                                event._submit_bubble = true;
5500
                                        });
5501
                                        jQuery._data( form, "submitBubbles", true );
5502
                                }
5503
                        });
5504
                        // return undefined since we don't need an event listener
5505
                },
5506
5507
                postDispatch: function( event ) {
5508
                        // If form was submitted by the user, bubble the event up the tree
5509
                        if ( event._submit_bubble ) {
5510
                                delete event._submit_bubble;
5511
                                if ( this.parentNode && !event.isTrigger ) {
5512
                                        jQuery.event.simulate( "submit", this.parentNode, event, true );
5513
                                }
5514
                        }
5515
                },
5516
5517
                teardown: function() {
5518
                        // Only need this for delegated form submit events
5519
                        if ( jQuery.nodeName( this, "form" ) ) {
5520
                                return false;
5521
                        }
5522
5523
                        // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
5524
                        jQuery.event.remove( this, "._submit" );
5525
                }
5526
        };
5527
}
5528
5529
// IE change delegation and checkbox/radio fix
5530
if ( !jQuery.support.changeBubbles ) {
5531
5532
        jQuery.event.special.change = {
5533
5534
                setup: function() {
5535
5536
                        if ( rformElems.test( this.nodeName ) ) {
5537
                                // IE doesn't fire change on a check/radio until blur; trigger it on click
5538
                                // after a propertychange. Eat the blur-change in special.change.handle.
5539
                                // This still fires onchange a second time for check/radio after blur.
5540
                                if ( this.type === "checkbox" || this.type === "radio" ) {
5541
                                        jQuery.event.add( this, "propertychange._change", function( event ) {
5542
                                                if ( event.originalEvent.propertyName === "checked" ) {
5543
                                                        this._just_changed = true;
5544
                                                }
5545
                                        });
5546
                                        jQuery.event.add( this, "click._change", function( event ) {
5547
                                                if ( this._just_changed && !event.isTrigger ) {
5548
                                                        this._just_changed = false;
5549
                                                }
5550
                                                // Allow triggered, simulated change events (#11500)
5551
                                                jQuery.event.simulate( "change", this, event, true );
5552
                                        });
5553
                                }
5554
                                return false;
5555
                        }
5556
                        // Delegated event; lazy-add a change handler on descendant inputs
5557
                        jQuery.event.add( this, "beforeactivate._change", function( e ) {
5558
                                var elem = e.target;
5559
5560
                                if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
5561
                                        jQuery.event.add( elem, "change._change", function( event ) {
5562
                                                if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
5563
                                                        jQuery.event.simulate( "change", this.parentNode, event, true );
5564
                                                }
5565
                                        });
5566
                                        jQuery._data( elem, "changeBubbles", true );
5567
                                }
5568
                        });
5569
                },
5570
5571
                handle: function( event ) {
5572
                        var elem = event.target;
5573
5574
                        // Swallow native change events from checkbox/radio, we already triggered them above
5575
                        if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
5576
                                return event.handleObj.handler.apply( this, arguments );
5577
                        }
5578
                },
5579
5580
                teardown: function() {
5581
                        jQuery.event.remove( this, "._change" );
5582
5583
                        return !rformElems.test( this.nodeName );
5584
                }
5585
        };
5586
}
5587
5588
// Create "bubbling" focus and blur events
5589
if ( !jQuery.support.focusinBubbles ) {
5590
        jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
5591
5592
                // Attach a single capturing handler while someone wants focusin/focusout
5593
                var attaches = 0,
5594
                        handler = function( event ) {
5595
                                jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
5596
                        };
5597
5598
                jQuery.event.special[ fix ] = {
5599
                        setup: function() {
5600
                                if ( attaches++ === 0 ) {
5601
                                        document.addEventListener( orig, handler, true );
5602
                                }
5603
                        },
5604
                        teardown: function() {
5605
                                if ( --attaches === 0 ) {
5606
                                        document.removeEventListener( orig, handler, true );
5607
                                }
5608
                        }
5609
                };
5610
        });
5611
}
5612
5613
jQuery.fn.extend({
5614
5615
        on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
5616
                var type, origFn;
5617
5618
                // Types can be a map of types/handlers
5619
                if ( typeof types === "object" ) {
5620
                        // ( types-Object, selector, data )
5621
                        if ( typeof selector !== "string" ) {
5622
                                // ( types-Object, data )
5623
                                data = data || selector;
5624
                                selector = undefined;
5625
                        }
5626
                        for ( type in types ) {
5627
                                this.on( type, selector, data, types[ type ], one );
5628
                        }
5629
                        return this;
5630
                }
5631
5632
                if ( data == null && fn == null ) {
5633
                        // ( types, fn )
5634
                        fn = selector;
5635
                        data = selector = undefined;
5636
                } else if ( fn == null ) {
5637
                        if ( typeof selector === "string" ) {
5638
                                // ( types, selector, fn )
5639
                                fn = data;
5640
                                data = undefined;
5641
                        } else {
5642
                                // ( types, data, fn )
5643
                                fn = data;
5644
                                data = selector;
5645
                                selector = undefined;
5646
                        }
5647
                }
5648
                if ( fn === false ) {
5649
                        fn = returnFalse;
5650
                } else if ( !fn ) {
5651
                        return this;
5652
                }
5653
5654
                if ( one === 1 ) {
5655
                        origFn = fn;
5656
                        fn = function( event ) {
5657
                                // Can use an empty set, since event contains the info
5658
                                jQuery().off( event );
5659
                                return origFn.apply( this, arguments );
5660
                        };
5661
                        // Use same guid so caller can remove using origFn
5662
                        fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5663
                }
5664
                return this.each( function() {
5665
                        jQuery.event.add( this, types, fn, data, selector );
5666
                });
5667
        },
5668
        one: function( types, selector, data, fn ) {
5669
                return this.on( types, selector, data, fn, 1 );
5670
        },
5671
        off: function( types, selector, fn ) {
5672
                var handleObj, type;
5673
                if ( types && types.preventDefault && types.handleObj ) {
5674
                        // ( event )  dispatched jQuery.Event
5675
                        handleObj = types.handleObj;
5676
                        jQuery( types.delegateTarget ).off(
5677
                                handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
5678
                                handleObj.selector,
5679
                                handleObj.handler
5680
                        );
5681
                        return this;
5682
                }
5683
                if ( typeof types === "object" ) {
5684
                        // ( types-object [, selector] )
5685
                        for ( type in types ) {
5686
                                this.off( type, selector, types[ type ] );
5687
                        }
5688
                        return this;
5689
                }
5690
                if ( selector === false || typeof selector === "function" ) {
5691
                        // ( types [, fn] )
5692
                        fn = selector;
5693
                        selector = undefined;
5694
                }
5695
                if ( fn === false ) {
5696
                        fn = returnFalse;
5697
                }
5698
                return this.each(function() {
5699
                        jQuery.event.remove( this, types, fn, selector );
5700
                });
5701
        },
5702
5703
        trigger: function( type, data ) {
5704
                return this.each(function() {
5705
                        jQuery.event.trigger( type, data, this );
5706
                });
5707
        },
5708
        triggerHandler: function( type, data ) {
5709
                var elem = this[0];
5710
                if ( elem ) {
5711
                        return jQuery.event.trigger( type, data, elem, true );
5712
                }
5713
        }
5714
});
5715
var isSimple = /^.[^:#\[\.,]*$/,
5716
        rparentsprev = /^(?:parents|prev(?:Until|All))/,
5717
        rneedsContext = jQuery.expr.match.needsContext,
5718
        // methods guaranteed to produce a unique set when starting from a unique set
5719
        guaranteedUnique = {
5720
                children: true,
5721
                contents: true,
5722
                next: true,
5723
                prev: true
5724
        };
5725
5726
jQuery.fn.extend({
5727
        find: function( selector ) {
5728
                var i,
5729
                        ret = [],
5730
                        self = this,
5731
                        len = self.length;
5732
5733
                if ( typeof selector !== "string" ) {
5734
                        return this.pushStack( jQuery( selector ).filter(function() {
5735
                                for ( i = 0; i < len; i++ ) {
5736
                                        if ( jQuery.contains( self[ i ], this ) ) {
5737
                                                return true;
5738
                                        }
5739
                                }
5740
                        }) );
5741
                }
5742
5743
                for ( i = 0; i < len; i++ ) {
5744
                        jQuery.find( selector, self[ i ], ret );
5745
                }
5746
5747
                // Needed because $( selector, context ) becomes $( context ).find( selector )
5748
                ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
5749
                ret.selector = this.selector ? this.selector + " " + selector : selector;
5750
                return ret;
5751
        },
5752
5753
        has: function( target ) {
5754
                var i,
5755
                        targets = jQuery( target, this ),
5756
                        len = targets.length;
5757
5758
                return this.filter(function() {
5759
                        for ( i = 0; i < len; i++ ) {
5760
                                if ( jQuery.contains( this, targets[i] ) ) {
5761
                                        return true;
5762
                                }
5763
                        }
5764
                });
5765
        },
5766
5767
        not: function( selector ) {
5768
                return this.pushStack( winnow(this, selector || [], true) );
5769
        },
5770
5771
        filter: function( selector ) {
5772
                return this.pushStack( winnow(this, selector || [], false) );
5773
        },
5774
5775
        is: function( selector ) {
5776
                return !!winnow(
5777
                        this,
5778
5779
                        // If this is a positional/relative selector, check membership in the returned set
5780
                        // so $("p:first").is("p:last") won't return true for a doc with two "p".
5781
                        typeof selector === "string" && rneedsContext.test( selector ) ?
5782
                                jQuery( selector ) :
5783
                                selector || [],
5784
                        false
5785
                ).length;
5786
        },
5787
5788
        closest: function( selectors, context ) {
5789
                var cur,
5790
                        i = 0,
5791
                        l = this.length,
5792
                        ret = [],
5793
                        pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
5794
                                jQuery( selectors, context || this.context ) :
5795
                                0;
5796
5797
                for ( ; i < l; i++ ) {
5798
                        for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
5799
                                // Always skip document fragments
5800
                                if ( cur.nodeType < 11 && (pos ?
5801
                                        pos.index(cur) > -1 :
5802
5803
                                        // Don't pass non-elements to Sizzle
5804
                                        cur.nodeType === 1 &&
5805
                                                jQuery.find.matchesSelector(cur, selectors)) ) {
5806
5807
                                        cur = ret.push( cur );
5808
                                        break;
5809
                                }
5810
                        }
5811
                }
5812
5813
                return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
5814
        },
5815
5816
        // Determine the position of an element within
5817
        // the matched set of elements
5818
        index: function( elem ) {
5819
5820
                // No argument, return index in parent
5821
                if ( !elem ) {
5822
                        return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
5823
                }
5824
5825
                // index in selector
5826
                if ( typeof elem === "string" ) {
5827
                        return jQuery.inArray( this[0], jQuery( elem ) );
5828
                }
5829
5830
                // Locate the position of the desired element
5831
                return jQuery.inArray(
5832
                        // If it receives a jQuery object, the first element is used
5833
                        elem.jquery ? elem[0] : elem, this );
5834
        },
5835
5836
        add: function( selector, context ) {
5837
                var set = typeof selector === "string" ?
5838
                                jQuery( selector, context ) :
5839
                                jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
5840
                        all = jQuery.merge( this.get(), set );
5841
5842
                return this.pushStack( jQuery.unique(all) );
5843
        },
5844
5845
        addBack: function( selector ) {
5846
                return this.add( selector == null ?
5847
                        this.prevObject : this.prevObject.filter(selector)
5848
                );
5849
        }
5850
});
5851
5852
function sibling( cur, dir ) {
5853
        do {
5854
                cur = cur[ dir ];
5855
        } while ( cur && cur.nodeType !== 1 );
5856
5857
        return cur;
5858
}
5859
5860
jQuery.each({
5861
        parent: function( elem ) {
5862
                var parent = elem.parentNode;
5863
                return parent && parent.nodeType !== 11 ? parent : null;
5864
        },
5865
        parents: function( elem ) {
5866
                return jQuery.dir( elem, "parentNode" );
5867
        },
5868
        parentsUntil: function( elem, i, until ) {
5869
                return jQuery.dir( elem, "parentNode", until );
5870
        },
5871
        next: function( elem ) {
5872
                return sibling( elem, "nextSibling" );
5873
        },
5874
        prev: function( elem ) {
5875
                return sibling( elem, "previousSibling" );
5876
        },
5877
        nextAll: function( elem ) {
5878
                return jQuery.dir( elem, "nextSibling" );
5879
        },
5880
        prevAll: function( elem ) {
5881
                return jQuery.dir( elem, "previousSibling" );
5882
        },
5883
        nextUntil: function( elem, i, until ) {
5884
                return jQuery.dir( elem, "nextSibling", until );
5885
        },
5886
        prevUntil: function( elem, i, until ) {
5887
                return jQuery.dir( elem, "previousSibling", until );
5888
        },
5889
        siblings: function( elem ) {
5890
                return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
5891
        },
5892
        children: function( elem ) {
5893
                return jQuery.sibling( elem.firstChild );
5894
        },
5895
        contents: function( elem ) {
5896
                return jQuery.nodeName( elem, "iframe" ) ?
5897
                        elem.contentDocument || elem.contentWindow.document :
5898
                        jQuery.merge( [], elem.childNodes );
5899
        }
5900
}, function( name, fn ) {
5901
        jQuery.fn[ name ] = function( until, selector ) {
5902
                var ret = jQuery.map( this, fn, until );
5903
5904
                if ( name.slice( -5 ) !== "Until" ) {
5905
                        selector = until;
5906
                }
5907
5908
                if ( selector && typeof selector === "string" ) {
5909
                        ret = jQuery.filter( selector, ret );
5910
                }
5911
5912
                if ( this.length > 1 ) {
5913
                        // Remove duplicates
5914
                        if ( !guaranteedUnique[ name ] ) {
5915
                                ret = jQuery.unique( ret );
5916
                        }
5917
5918
                        // Reverse order for parents* and prev-derivatives
5919
                        if ( rparentsprev.test( name ) ) {
5920
                                ret = ret.reverse();
5921
                        }
5922
                }
5923
5924
                return this.pushStack( ret );
5925
        };
5926
});
5927
5928
jQuery.extend({
5929
        filter: function( expr, elems, not ) {
5930
                var elem = elems[ 0 ];
5931
5932
                if ( not ) {
5933
                        expr = ":not(" + expr + ")";
5934
                }
5935
5936
                return elems.length === 1 && elem.nodeType === 1 ?
5937
                        jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
5938
                        jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
5939
                                return elem.nodeType === 1;
5940
                        }));
5941
        },
5942
5943
        dir: function( elem, dir, until ) {
5944
                var matched = [],
5945
                        cur = elem[ dir ];
5946
5947
                while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
5948
                        if ( cur.nodeType === 1 ) {
5949
                                matched.push( cur );
5950
                        }
5951
                        cur = cur[dir];
5952
                }
5953
                return matched;
5954
        },
5955
5956
        sibling: function( n, elem ) {
5957
                var r = [];
5958
5959
                for ( ; n; n = n.nextSibling ) {
5960
                        if ( n.nodeType === 1 && n !== elem ) {
5961
                                r.push( n );
5962
                        }
5963
                }
5964
5965
                return r;
5966
        }
5967
});
5968
5969
// Implement the identical functionality for filter and not
5970
function winnow( elements, qualifier, not ) {
5971
        if ( jQuery.isFunction( qualifier ) ) {
5972
                return jQuery.grep( elements, function( elem, i ) {
5973
                        /* jshint -W018 */
5974
                        return !!qualifier.call( elem, i, elem ) !== not;
5975
                });
5976
5977
        }
5978
5979
        if ( qualifier.nodeType ) {
5980
                return jQuery.grep( elements, function( elem ) {
5981
                        return ( elem === qualifier ) !== not;
5982
                });
5983
5984
        }
5985
5986
        if ( typeof qualifier === "string" ) {
5987
                if ( isSimple.test( qualifier ) ) {
5988
                        return jQuery.filter( qualifier, elements, not );
5989
                }
5990
5991
                qualifier = jQuery.filter( qualifier, elements );
5992
        }
5993
5994
        return jQuery.grep( elements, function( elem ) {
5995
                return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
5996
        });
5997
}
5998
function createSafeFragment( document ) {
5999
        var list = nodeNames.split( "|" ),
6000
                safeFrag = document.createDocumentFragment();
6001
6002
        if ( safeFrag.createElement ) {
6003
                while ( list.length ) {
6004
                        safeFrag.createElement(
6005
                                list.pop()
6006
                        );
6007
                }
6008
        }
6009
        return safeFrag;
6010
}
6011
6012
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
6013
                "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
6014
        rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
6015
        rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
6016
        rleadingWhitespace = /^\s+/,
6017
        rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
6018
        rtagName = /<([\w:]+)/,
6019
        rtbody = /<tbody/i,
6020
        rhtml = /<|&#?\w+;/,
6021
        rnoInnerhtml = /<(?:script|style|link)/i,
6022
        manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
6023
        // checked="checked" or checked
6024
        rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
6025
        rscriptType = /^$|\/(?:java|ecma)script/i,
6026
        rscriptTypeMasked = /^true\/(.*)/,
6027
        rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
6028
6029
        // We have to close these tags to support XHTML (#13200)
6030
        wrapMap = {
6031
                option: [ 1, "<select multiple='multiple'>", "</select>" ],
6032
                legend: [ 1, "<fieldset>", "</fieldset>" ],
6033
                area: [ 1, "<map>", "</map>" ],
6034
                param: [ 1, "<object>", "</object>" ],
6035
                thead: [ 1, "<table>", "</table>" ],
6036
                tr: [ 2, "<table><tbody>", "</tbody></table>" ],
6037
                col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
6038
                td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
6039
6040
                // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
6041
                // unless wrapped in a div with non-breaking characters in front of it.
6042
                _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
6043
        },
6044
        safeFragment = createSafeFragment( document ),
6045
        fragmentDiv = safeFragment.appendChild( document.createElement("div") );
6046
6047
wrapMap.optgroup = wrapMap.option;
6048
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
6049
wrapMap.th = wrapMap.td;
6050
6051
jQuery.fn.extend({
6052
        text: function( value ) {
6053
                return jQuery.access( this, function( value ) {
6054
                        return value === undefined ?
6055
                                jQuery.text( this ) :
6056
                                this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
6057
                }, null, value, arguments.length );
6058
        },
6059
6060
        append: function() {
6061
                return this.domManip( arguments, function( elem ) {
6062
                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6063
                                var target = manipulationTarget( this, elem );
6064
                                target.appendChild( elem );
6065
                        }
6066
                });
6067
        },
6068
6069
        prepend: function() {
6070
                return this.domManip( arguments, function( elem ) {
6071
                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6072
                                var target = manipulationTarget( this, elem );
6073
                                target.insertBefore( elem, target.firstChild );
6074
                        }
6075
                });
6076
        },
6077
6078
        before: function() {
6079
                return this.domManip( arguments, function( elem ) {
6080
                        if ( this.parentNode ) {
6081
                                this.parentNode.insertBefore( elem, this );
6082
                        }
6083
                });
6084
        },
6085
6086
        after: function() {
6087
                return this.domManip( arguments, function( elem ) {
6088
                        if ( this.parentNode ) {
6089
                                this.parentNode.insertBefore( elem, this.nextSibling );
6090
                        }
6091
                });
6092
        },
6093
6094
        // keepData is for internal use only--do not document
6095
        remove: function( selector, keepData ) {
6096
                var elem,
6097
                        elems = selector ? jQuery.filter( selector, this ) : this,
6098
                        i = 0;
6099
6100
                for ( ; (elem = elems[i]) != null; i++ ) {
6101
6102
                        if ( !keepData && elem.nodeType === 1 ) {
6103
                                jQuery.cleanData( getAll( elem ) );
6104
                        }
6105
6106
                        if ( elem.parentNode ) {
6107
                                if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
6108
                                        setGlobalEval( getAll( elem, "script" ) );
6109
                                }
6110
                                elem.parentNode.removeChild( elem );
6111
                        }
6112
                }
6113
6114
                return this;
6115
        },
6116
6117
        empty: function() {
6118
                var elem,
6119
                        i = 0;
6120
6121
                for ( ; (elem = this[i]) != null; i++ ) {
6122
                        // Remove element nodes and prevent memory leaks
6123
                        if ( elem.nodeType === 1 ) {
6124
                                jQuery.cleanData( getAll( elem, false ) );
6125
                        }
6126
6127
                        // Remove any remaining nodes
6128
                        while ( elem.firstChild ) {
6129
                                elem.removeChild( elem.firstChild );
6130
                        }
6131
6132
                        // If this is a select, ensure that it displays empty (#12336)
6133
                        // Support: IE<9
6134
                        if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
6135
                                elem.options.length = 0;
6136
                        }
6137
                }
6138
6139
                return this;
6140
        },
6141
6142
        clone: function( dataAndEvents, deepDataAndEvents ) {
6143
                dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6144
                deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6145
6146
                return this.map( function () {
6147
                        return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6148
                });
6149
        },
6150
6151
        html: function( value ) {
6152
                return jQuery.access( this, function( value ) {
6153
                        var elem = this[0] || {},
6154
                                i = 0,
6155
                                l = this.length;
6156
6157
                        if ( value === undefined ) {
6158
                                return elem.nodeType === 1 ?
6159
                                        elem.innerHTML.replace( rinlinejQuery, "" ) :
6160
                                        undefined;
6161
                        }
6162
6163
                        // See if we can take a shortcut and just use innerHTML
6164
                        if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6165
                                ( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
6166
                                ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
6167
                                !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
6168
6169
                                value = value.replace( rxhtmlTag, "<$1></$2>" );
6170
6171
                                try {
6172
                                        for (; i < l; i++ ) {
6173
                                                // Remove element nodes and prevent memory leaks
6174
                                                elem = this[i] || {};
6175
                                                if ( elem.nodeType === 1 ) {
6176
                                                        jQuery.cleanData( getAll( elem, false ) );
6177
                                                        elem.innerHTML = value;
6178
                                                }
6179
                                        }
6180
6181
                                        elem = 0;
6182
6183
                                // If using innerHTML throws an exception, use the fallback method
6184
                                } catch(e) {}
6185
                        }
6186
6187
                        if ( elem ) {
6188
                                this.empty().append( value );
6189
                        }
6190
                }, null, value, arguments.length );
6191
        },
6192
6193
        replaceWith: function() {
6194
                var
6195
                        // Snapshot the DOM in case .domManip sweeps something relevant into its fragment
6196
                        args = jQuery.map( this, function( elem ) {
6197
                                return [ elem.nextSibling, elem.parentNode ];
6198
                        }),
6199
                        i = 0;
6200
6201
                // Make the changes, replacing each context element with the new content
6202
                this.domManip( arguments, function( elem ) {
6203
                        var next = args[ i++ ],
6204
                                parent = args[ i++ ];
6205
6206
                        if ( parent ) {
6207
                                // Don't use the snapshot next if it has moved (#13810)
6208
                                if ( next && next.parentNode !== parent ) {
6209
                                        next = this.nextSibling;
6210
                                }
6211
                                jQuery( this ).remove();
6212
                                parent.insertBefore( elem, next );
6213
                        }
6214
                // Allow new content to include elements from the context set
6215
                }, true );
6216
6217
                // Force removal if there was no new content (e.g., from empty arguments)
6218
                return i ? this : this.remove();
6219
        },
6220
6221
        detach: function( selector ) {
6222
                return this.remove( selector, true );
6223
        },
6224
6225
        domManip: function( args, callback, allowIntersection ) {
6226
6227
                // Flatten any nested arrays
6228
                args = core_concat.apply( [], args );
6229
6230
                var first, node, hasScripts,
6231
                        scripts, doc, fragment,
6232
                        i = 0,
6233
                        l = this.length,
6234
                        set = this,
6235
                        iNoClone = l - 1,
6236
                        value = args[0],
6237
                        isFunction = jQuery.isFunction( value );
6238
6239
                // We can't cloneNode fragments that contain checked, in WebKit
6240
                if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
6241
                        return this.each(function( index ) {
6242
                                var self = set.eq( index );
6243
                                if ( isFunction ) {
6244
                                        args[0] = value.call( this, index, self.html() );
6245
                                }
6246
                                self.domManip( args, callback, allowIntersection );
6247
                        });
6248
                }
6249
6250
                if ( l ) {
6251
                        fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
6252
                        first = fragment.firstChild;
6253
6254
                        if ( fragment.childNodes.length === 1 ) {
6255
                                fragment = first;
6256
                        }
6257
6258
                        if ( first ) {
6259
                                scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
6260
                                hasScripts = scripts.length;
6261
6262
                                // Use the original fragment for the last item instead of the first because it can end up
6263
                                // being emptied incorrectly in certain situations (#8070).
6264
                                for ( ; i < l; i++ ) {
6265
                                        node = fragment;
6266
6267
                                        if ( i !== iNoClone ) {
6268
                                                node = jQuery.clone( node, true, true );
6269
6270
                                                // Keep references to cloned scripts for later restoration
6271
                                                if ( hasScripts ) {
6272
                                                        jQuery.merge( scripts, getAll( node, "script" ) );
6273
                                                }
6274
                                        }
6275
6276
                                        callback.call( this[i], node, i );
6277
                                }
6278
6279
                                if ( hasScripts ) {
6280
                                        doc = scripts[ scripts.length - 1 ].ownerDocument;
6281
6282
                                        // Reenable scripts
6283
                                        jQuery.map( scripts, restoreScript );
6284
6285
                                        // Evaluate executable scripts on first document insertion
6286
                                        for ( i = 0; i < hasScripts; i++ ) {
6287
                                                node = scripts[ i ];
6288
                                                if ( rscriptType.test( node.type || "" ) &&
6289
                                                        !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
6290
6291
                                                        if ( node.src ) {
6292
                                                                // Hope ajax is available...
6293
                                                                jQuery._evalUrl( node.src );
6294
                                                        } else {
6295
                                                                jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
6296
                                                        }
6297
                                                }
6298
                                        }
6299
                                }
6300
6301
                                // Fix #11809: Avoid leaking memory
6302
                                fragment = first = null;
6303
                        }
6304
                }
6305
6306
                return this;
6307
        }
6308
});
6309
6310
// Support: IE<8
6311
// Manipulating tables requires a tbody
6312
function manipulationTarget( elem, content ) {
6313
        return jQuery.nodeName( elem, "table" ) &&
6314
                jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
6315
6316
                elem.getElementsByTagName("tbody")[0] ||
6317
                        elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
6318
                elem;
6319
}
6320
6321
// Replace/restore the type attribute of script elements for safe DOM manipulation
6322
function disableScript( elem ) {
6323
        elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
6324
        return elem;
6325
}
6326
function restoreScript( elem ) {
6327
        var match = rscriptTypeMasked.exec( elem.type );
6328
        if ( match ) {
6329
                elem.type = match[1];
6330
        } else {
6331
                elem.removeAttribute("type");
6332
        }
6333
        return elem;
6334
}
6335
6336
// Mark scripts as having already been evaluated
6337
function setGlobalEval( elems, refElements ) {
6338
        var elem,
6339
                i = 0;
6340
        for ( ; (elem = elems[i]) != null; i++ ) {
6341
                jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
6342
        }
6343
}
6344
6345
function cloneCopyEvent( src, dest ) {
6346
6347
        if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
6348
                return;
6349
        }
6350
6351
        var type, i, l,
6352
                oldData = jQuery._data( src ),
6353
                curData = jQuery._data( dest, oldData ),
6354
                events = oldData.events;
6355
6356
        if ( events ) {
6357
                delete curData.handle;
6358
                curData.events = {};
6359
6360
                for ( type in events ) {
6361
                        for ( i = 0, l = events[ type ].length; i < l; i++ ) {
6362
                                jQuery.event.add( dest, type, events[ type ][ i ] );
6363
                        }
6364
                }
6365
        }
6366
6367
        // make the cloned public data object a copy from the original
6368
        if ( curData.data ) {
6369
                curData.data = jQuery.extend( {}, curData.data );
6370
        }
6371
}
6372
6373
function fixCloneNodeIssues( src, dest ) {
6374
        var nodeName, e, data;
6375
6376
        // We do not need to do anything for non-Elements
6377
        if ( dest.nodeType !== 1 ) {
6378
                return;
6379
        }
6380
6381
        nodeName = dest.nodeName.toLowerCase();
6382
6383
        // IE6-8 copies events bound via attachEvent when using cloneNode.
6384
        if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
6385
                data = jQuery._data( dest );
6386
6387
                for ( e in data.events ) {
6388
                        jQuery.removeEvent( dest, e, data.handle );
6389
                }
6390
6391
                // Event data gets referenced instead of copied if the expando gets copied too
6392
                dest.removeAttribute( jQuery.expando );
6393
        }
6394
6395
        // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
6396
        if ( nodeName === "script" && dest.text !== src.text ) {
6397
                disableScript( dest ).text = src.text;
6398
                restoreScript( dest );
6399
6400
        // IE6-10 improperly clones children of object elements using classid.
6401
        // IE10 throws NoModificationAllowedError if parent is null, #12132.
6402
        } else if ( nodeName === "object" ) {
6403
                if ( dest.parentNode ) {
6404
                        dest.outerHTML = src.outerHTML;
6405
                }
6406
6407
                // This path appears unavoidable for IE9. When cloning an object
6408
                // element in IE9, the outerHTML strategy above is not sufficient.
6409
                // If the src has innerHTML and the destination does not,
6410
                // copy the src.innerHTML into the dest.innerHTML. #10324
6411
                if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
6412
                        dest.innerHTML = src.innerHTML;
6413
                }
6414
6415
        } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
6416
                // IE6-8 fails to persist the checked state of a cloned checkbox
6417
                // or radio button. Worse, IE6-7 fail to give the cloned element
6418
                // a checked appearance if the defaultChecked value isn't also set
6419
6420
                dest.defaultChecked = dest.checked = src.checked;
6421
6422
                // IE6-7 get confused and end up setting the value of a cloned
6423
                // checkbox/radio button to an empty string instead of "on"
6424
                if ( dest.value !== src.value ) {
6425
                        dest.value = src.value;
6426
                }
6427
6428
        // IE6-8 fails to return the selected option to the default selected
6429
        // state when cloning options
6430
        } else if ( nodeName === "option" ) {
6431
                dest.defaultSelected = dest.selected = src.defaultSelected;
6432
6433
        // IE6-8 fails to set the defaultValue to the correct value when
6434
        // cloning other types of input fields
6435
        } else if ( nodeName === "input" || nodeName === "textarea" ) {
6436
                dest.defaultValue = src.defaultValue;
6437
        }
6438
}
6439
6440
jQuery.each({
6441
        appendTo: "append",
6442
        prependTo: "prepend",
6443
        insertBefore: "before",
6444
        insertAfter: "after",
6445
        replaceAll: "replaceWith"
6446
}, function( name, original ) {
6447
        jQuery.fn[ name ] = function( selector ) {
6448
                var elems,
6449
                        i = 0,
6450
                        ret = [],
6451
                        insert = jQuery( selector ),
6452
                        last = insert.length - 1;
6453
6454
                for ( ; i <= last; i++ ) {
6455
                        elems = i === last ? this : this.clone(true);
6456
                        jQuery( insert[i] )[ original ]( elems );
6457
6458
                        // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
6459
                        core_push.apply( ret, elems.get() );
6460
                }
6461
6462
                return this.pushStack( ret );
6463
        };
6464
});
6465
6466
function getAll( context, tag ) {
6467
        var elems, elem,
6468
                i = 0,
6469
                found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
6470
                        typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
6471
                        undefined;
6472
6473
        if ( !found ) {
6474
                for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
6475
                        if ( !tag || jQuery.nodeName( elem, tag ) ) {
6476
                                found.push( elem );
6477
                        } else {
6478
                                jQuery.merge( found, getAll( elem, tag ) );
6479
                        }
6480
                }
6481
        }
6482
6483
        return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
6484
                jQuery.merge( [ context ], found ) :
6485
                found;
6486
}
6487
6488
// Used in buildFragment, fixes the defaultChecked property
6489
function fixDefaultChecked( elem ) {
6490
        if ( manipulation_rcheckableType.test( elem.type ) ) {
6491
                elem.defaultChecked = elem.checked;
6492
        }
6493
}
6494
6495
jQuery.extend({
6496
        clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6497
                var destElements, node, clone, i, srcElements,
6498
                        inPage = jQuery.contains( elem.ownerDocument, elem );
6499
6500
                if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
6501
                        clone = elem.cloneNode( true );
6502
6503
                // IE<=8 does not properly clone detached, unknown element nodes
6504
                } else {
6505
                        fragmentDiv.innerHTML = elem.outerHTML;
6506
                        fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
6507
                }
6508
6509
                if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
6510
                                (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
6511
6512
                        // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
6513
                        destElements = getAll( clone );
6514
                        srcElements = getAll( elem );
6515
6516
                        // Fix all IE cloning issues
6517
                        for ( i = 0; (node = srcElements[i]) != null; ++i ) {
6518
                                // Ensure that the destination node is not null; Fixes #9587
6519
                                if ( destElements[i] ) {
6520
                                        fixCloneNodeIssues( node, destElements[i] );
6521
                                }
6522
                        }
6523
                }
6524
6525
                // Copy the events from the original to the clone
6526
                if ( dataAndEvents ) {
6527
                        if ( deepDataAndEvents ) {
6528
                                srcElements = srcElements || getAll( elem );
6529
                                destElements = destElements || getAll( clone );
6530
6531
                                for ( i = 0; (node = srcElements[i]) != null; i++ ) {
6532
                                        cloneCopyEvent( node, destElements[i] );
6533
                                }
6534
                        } else {
6535
                                cloneCopyEvent( elem, clone );
6536
                        }
6537
                }
6538
6539
                // Preserve script evaluation history
6540
                destElements = getAll( clone, "script" );
6541
                if ( destElements.length > 0 ) {
6542
                        setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6543
                }
6544
6545
                destElements = srcElements = node = null;
6546
6547
                // Return the cloned set
6548
                return clone;
6549
        },
6550
6551
        buildFragment: function( elems, context, scripts, selection ) {
6552
                var j, elem, contains,
6553
                        tmp, tag, tbody, wrap,
6554
                        l = elems.length,
6555
6556
                        // Ensure a safe fragment
6557
                        safe = createSafeFragment( context ),
6558
6559
                        nodes = [],
6560
                        i = 0;
6561
6562
                for ( ; i < l; i++ ) {
6563
                        elem = elems[ i ];
6564
6565
                        if ( elem || elem === 0 ) {
6566
6567
                                // Add nodes directly
6568
                                if ( jQuery.type( elem ) === "object" ) {
6569
                                        jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
6570
6571
                                // Convert non-html into a text node
6572
                                } else if ( !rhtml.test( elem ) ) {
6573
                                        nodes.push( context.createTextNode( elem ) );
6574
6575
                                // Convert html into DOM nodes
6576
                                } else {
6577
                                        tmp = tmp || safe.appendChild( context.createElement("div") );
6578
6579
                                        // Deserialize a standard representation
6580
                                        tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
6581
                                        wrap = wrapMap[ tag ] || wrapMap._default;
6582
6583
                                        tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
6584
6585
                                        // Descend through wrappers to the right content
6586
                                        j = wrap[0];
6587
                                        while ( j-- ) {
6588
                                                tmp = tmp.lastChild;
6589
                                        }
6590
6591
                                        // Manually add leading whitespace removed by IE
6592
                                        if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
6593
                                                nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
6594
                                        }
6595
6596
                                        // Remove IE's autoinserted <tbody> from table fragments
6597
                                        if ( !jQuery.support.tbody ) {
6598
6599
                                                // String was a <table>, *may* have spurious <tbody>
6600
                                                elem = tag === "table" && !rtbody.test( elem ) ?
6601
                                                        tmp.firstChild :
6602
6603
                                                        // String was a bare <thead> or <tfoot>
6604
                                                        wrap[1] === "<table>" && !rtbody.test( elem ) ?
6605
                                                                tmp :
6606
                                                                0;
6607
6608
                                                j = elem && elem.childNodes.length;
6609
                                                while ( j-- ) {
6610
                                                        if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
6611
                                                                elem.removeChild( tbody );
6612
                                                        }
6613
                                                }
6614
                                        }
6615
6616
                                        jQuery.merge( nodes, tmp.childNodes );
6617
6618
                                        // Fix #12392 for WebKit and IE > 9
6619
                                        tmp.textContent = "";
6620
6621
                                        // Fix #12392 for oldIE
6622
                                        while ( tmp.firstChild ) {
6623
                                                tmp.removeChild( tmp.firstChild );
6624
                                        }
6625
6626
                                        // Remember the top-level container for proper cleanup
6627
                                        tmp = safe.lastChild;
6628
                                }
6629
                        }
6630
                }
6631
6632
                // Fix #11356: Clear elements from fragment
6633
                if ( tmp ) {
6634
                        safe.removeChild( tmp );
6635
                }
6636
6637
                // Reset defaultChecked for any radios and checkboxes
6638
                // about to be appended to the DOM in IE 6/7 (#8060)
6639
                if ( !jQuery.support.appendChecked ) {
6640
                        jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
6641
                }
6642
6643
                i = 0;
6644
                while ( (elem = nodes[ i++ ]) ) {
6645
6646
                        // #4087 - If origin and destination elements are the same, and this is
6647
                        // that element, do not do anything
6648
                        if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
6649
                                continue;
6650
                        }
6651
6652
                        contains = jQuery.contains( elem.ownerDocument, elem );
6653
6654
                        // Append to fragment
6655
                        tmp = getAll( safe.appendChild( elem ), "script" );
6656
6657
                        // Preserve script evaluation history
6658
                        if ( contains ) {
6659
                                setGlobalEval( tmp );
6660
                        }
6661
6662
                        // Capture executables
6663
                        if ( scripts ) {
6664
                                j = 0;
6665
                                while ( (elem = tmp[ j++ ]) ) {
6666
                                        if ( rscriptType.test( elem.type || "" ) ) {
6667
                                                scripts.push( elem );
6668
                                        }
6669
                                }
6670
                        }
6671
                }
6672
6673
                tmp = null;
6674
6675
                return safe;
6676
        },
6677
6678
        cleanData: function( elems, /* internal */ acceptData ) {
6679
                var elem, type, id, data,
6680
                        i = 0,
6681
                        internalKey = jQuery.expando,
6682
                        cache = jQuery.cache,
6683
                        deleteExpando = jQuery.support.deleteExpando,
6684
                        special = jQuery.event.special;
6685
6686
                for ( ; (elem = elems[i]) != null; i++ ) {
6687
6688
                        if ( acceptData || jQuery.acceptData( elem ) ) {
6689
6690
                                id = elem[ internalKey ];
6691
                                data = id && cache[ id ];
6692
6693
                                if ( data ) {
6694
                                        if ( data.events ) {
6695
                                                for ( type in data.events ) {
6696
                                                        if ( special[ type ] ) {
6697
                                                                jQuery.event.remove( elem, type );
6698
6699
                                                        // This is a shortcut to avoid jQuery.event.remove's overhead
6700
                                                        } else {
6701
                                                                jQuery.removeEvent( elem, type, data.handle );
6702
                                                        }
6703
                                                }
6704
                                        }
6705
6706
                                        // Remove cache only if it was not already removed by jQuery.event.remove
6707
                                        if ( cache[ id ] ) {
6708
6709
                                                delete cache[ id ];
6710
6711
                                                // IE does not allow us to delete expando properties from nodes,
6712
                                                // nor does it have a removeAttribute function on Document nodes;
6713
                                                // we must handle all of these cases
6714
                                                if ( deleteExpando ) {
6715
                                                        delete elem[ internalKey ];
6716
6717
                                                } else if ( typeof elem.removeAttribute !== core_strundefined ) {
6718
                                                        elem.removeAttribute( internalKey );
6719
6720
                                                } else {
6721
                                                        elem[ internalKey ] = null;
6722
                                                }
6723
6724
                                                core_deletedIds.push( id );
6725
                                        }
6726
                                }
6727
                        }
6728
                }
6729
        },
6730
6731
        _evalUrl: function( url ) {
6732
                return jQuery.ajax({
6733
                        url: url,
6734
                        type: "GET",
6735
                        dataType: "script",
6736
                        async: false,
6737
                        global: false,
6738
                        "throws": true
6739
                });
6740
        }
6741
});
6742
jQuery.fn.extend({
6743
        wrapAll: function( html ) {
6744
                if ( jQuery.isFunction( html ) ) {
6745
                        return this.each(function(i) {
6746
                                jQuery(this).wrapAll( html.call(this, i) );
6747
                        });
6748
                }
6749
6750
                if ( this[0] ) {
6751
                        // The elements to wrap the target around
6752
                        var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
6753
6754
                        if ( this[0].parentNode ) {
6755
                                wrap.insertBefore( this[0] );
6756
                        }
6757
6758
                        wrap.map(function() {
6759
                                var elem = this;
6760
6761
                                while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
6762
                                        elem = elem.firstChild;
6763
                                }
6764
6765
                                return elem;
6766
                        }).append( this );
6767
                }
6768
6769
                return this;
6770
        },
6771
6772
        wrapInner: function( html ) {
6773
                if ( jQuery.isFunction( html ) ) {
6774
                        return this.each(function(i) {
6775
                                jQuery(this).wrapInner( html.call(this, i) );
6776
                        });
6777
                }
6778
6779
                return this.each(function() {
6780
                        var self = jQuery( this ),
6781
                                contents = self.contents();
6782
6783
                        if ( contents.length ) {
6784
                                contents.wrapAll( html );
6785
6786
                        } else {
6787
                                self.append( html );
6788
                        }
6789
                });
6790
        },
6791
6792
        wrap: function( html ) {
6793
                var isFunction = jQuery.isFunction( html );
6794
6795
                return this.each(function(i) {
6796
                        jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
6797
                });
6798
        },
6799
6800
        unwrap: function() {
6801
                return this.parent().each(function() {
6802
                        if ( !jQuery.nodeName( this, "body" ) ) {
6803
                                jQuery( this ).replaceWith( this.childNodes );
6804
                        }
6805
                }).end();
6806
        }
6807
});
6808
var iframe, getStyles, curCSS,
6809
        ralpha = /alpha\([^)]*\)/i,
6810
        ropacity = /opacity\s*=\s*([^)]*)/,
6811
        rposition = /^(top|right|bottom|left)$/,
6812
        // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
6813
        // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6814
        rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6815
        rmargin = /^margin/,
6816
        rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
6817
        rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
6818
        rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
6819
        elemdisplay = { BODY: "block" },
6820
6821
        cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6822
        cssNormalTransform = {
6823
                letterSpacing: 0,
6824
                fontWeight: 400
6825
        },
6826
6827
        cssExpand = [ "Top", "Right", "Bottom", "Left" ],
6828
        cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
6829
6830
// return a css property mapped to a potentially vendor prefixed property
6831
function vendorPropName( style, name ) {
6832
6833
        // shortcut for names that are not vendor prefixed
6834
        if ( name in style ) {
6835
                return name;
6836
        }
6837
6838
        // check for vendor prefixed names
6839
        var capName = name.charAt(0).toUpperCase() + name.slice(1),
6840
                origName = name,
6841
                i = cssPrefixes.length;
6842
6843
        while ( i-- ) {
6844
                name = cssPrefixes[ i ] + capName;
6845
                if ( name in style ) {
6846
                        return name;
6847
                }
6848
        }
6849
6850
        return origName;
6851
}
6852
6853
function isHidden( elem, el ) {
6854
        // isHidden might be called from jQuery#filter function;
6855
        // in that case, element will be second argument
6856
        elem = el || elem;
6857
        return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
6858
}
6859
6860
function showHide( elements, show ) {
6861
        var display, elem, hidden,
6862
                values = [],
6863
                index = 0,
6864
                length = elements.length;
6865
6866
        for ( ; index < length; index++ ) {
6867
                elem = elements[ index ];
6868
                if ( !elem.style ) {
6869
                        continue;
6870
                }
6871
6872
                values[ index ] = jQuery._data( elem, "olddisplay" );
6873
                display = elem.style.display;
6874
                if ( show ) {
6875
                        // Reset the inline display of this element to learn if it is
6876
                        // being hidden by cascaded rules or not
6877
                        if ( !values[ index ] && display === "none" ) {
6878
                                elem.style.display = "";
6879
                        }
6880
6881
                        // Set elements which have been overridden with display: none
6882
                        // in a stylesheet to whatever the default browser style is
6883
                        // for such an element
6884
                        if ( elem.style.display === "" && isHidden( elem ) ) {
6885
                                values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6886
                        }
6887
                } else {
6888
6889
                        if ( !values[ index ] ) {
6890
                                hidden = isHidden( elem );
6891
6892
                                if ( display && display !== "none" || !hidden ) {
6893
                                        jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
6894
                                }
6895
                        }
6896
                }
6897
        }
6898
6899
        // Set the display of most of the elements in a second loop
6900
        // to avoid the constant reflow
6901
        for ( index = 0; index < length; index++ ) {
6902
                elem = elements[ index ];
6903
                if ( !elem.style ) {
6904
                        continue;
6905
                }
6906
                if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6907
                        elem.style.display = show ? values[ index ] || "" : "none";
6908
                }
6909
        }
6910
6911
        return elements;
6912
}
6913
6914
jQuery.fn.extend({
6915
        css: function( name, value ) {
6916
                return jQuery.access( this, function( elem, name, value ) {
6917
                        var len, styles,
6918
                                map = {},
6919
                                i = 0;
6920
6921
                        if ( jQuery.isArray( name ) ) {
6922
                                styles = getStyles( elem );
6923
                                len = name.length;
6924
6925
                                for ( ; i < len; i++ ) {
6926
                                        map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6927
                                }
6928
6929
                                return map;
6930
                        }
6931
6932
                        return value !== undefined ?
6933
                                jQuery.style( elem, name, value ) :
6934
                                jQuery.css( elem, name );
6935
                }, name, value, arguments.length > 1 );
6936
        },
6937
        show: function() {
6938
                return showHide( this, true );
6939
        },
6940
        hide: function() {
6941
                return showHide( this );
6942
        },
6943
        toggle: function( state ) {
6944
                if ( typeof state === "boolean" ) {
6945
                        return state ? this.show() : this.hide();
6946
                }
6947
6948
                return this.each(function() {
6949
                        if ( isHidden( this ) ) {
6950
                                jQuery( this ).show();
6951
                        } else {
6952
                                jQuery( this ).hide();
6953
                        }
6954
                });
6955
        }
6956
});
6957
6958
jQuery.extend({
6959
        // Add in style property hooks for overriding the default
6960
        // behavior of getting and setting a style property
6961
        cssHooks: {
6962
                opacity: {
6963
                        get: function( elem, computed ) {
6964
                                if ( computed ) {
6965
                                        // We should always get a number back from opacity
6966
                                        var ret = curCSS( elem, "opacity" );
6967
                                        return ret === "" ? "1" : ret;
6968
                                }
6969
                        }
6970
                }
6971
        },
6972
6973
        // Don't automatically add "px" to these possibly-unitless properties
6974
        cssNumber: {
6975
                "columnCount": true,
6976
                "fillOpacity": true,
6977
                "fontWeight": true,
6978
                "lineHeight": true,
6979
                "opacity": true,
6980
                "order": true,
6981
                "orphans": true,
6982
                "widows": true,
6983
                "zIndex": true,
6984
                "zoom": true
6985
        },
6986
6987
        // Add in properties whose names you wish to fix before
6988
        // setting or getting the value
6989
        cssProps: {
6990
                // normalize float css property
6991
                "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
6992
        },
6993
6994
        // Get and set the style property on a DOM Node
6995
        style: function( elem, name, value, extra ) {
6996
                // Don't set styles on text and comment nodes
6997
                if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6998
                        return;
6999
                }
7000
7001
                // Make sure that we're working with the right name
7002
                var ret, type, hooks,
7003
                        origName = jQuery.camelCase( name ),
7004
                        style = elem.style;
7005
7006
                name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
7007
7008
                // gets hook for the prefixed version
7009
                // followed by the unprefixed version
7010
                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
7011
7012
                // Check if we're setting a value
7013
                if ( value !== undefined ) {
7014
                        type = typeof value;
7015
7016
                        // convert relative number strings (+= or -=) to relative numbers. #7345
7017
                        if ( type === "string" && (ret = rrelNum.exec( value )) ) {
7018
                                value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
7019
                                // Fixes bug #9237
7020
                                type = "number";
7021
                        }
7022
7023
                        // Make sure that NaN and null values aren't set. See: #7116
7024
                        if ( value == null || type === "number" && isNaN( value ) ) {
7025
                                return;
7026
                        }
7027
7028
                        // If a number was passed in, add 'px' to the (except for certain CSS properties)
7029
                        if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
7030
                                value += "px";
7031
                        }
7032
7033
                        // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
7034
                        // but it would mean to define eight (for every problematic property) identical functions
7035
                        if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
7036
                                style[ name ] = "inherit";
7037
                        }
7038
7039
                        // If a hook was provided, use that value, otherwise just set the specified value
7040
                        if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
7041
7042
                                // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
7043
                                // Fixes bug #5509
7044
                                try {
7045
                                        style[ name ] = value;
7046
                                } catch(e) {}
7047
                        }
7048
7049
                } else {
7050
                        // If a hook was provided get the non-computed value from there
7051
                        if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
7052
                                return ret;
7053
                        }
7054
7055
                        // Otherwise just get the value from the style object
7056
                        return style[ name ];
7057
                }
7058
        },
7059
7060
        css: function( elem, name, extra, styles ) {
7061
                var num, val, hooks,
7062
                        origName = jQuery.camelCase( name );
7063
7064
                // Make sure that we're working with the right name
7065
                name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
7066
7067
                // gets hook for the prefixed version
7068
                // followed by the unprefixed version
7069
                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
7070
7071
                // If a hook was provided get the computed value from there
7072
                if ( hooks && "get" in hooks ) {
7073
                        val = hooks.get( elem, true, extra );
7074
                }
7075
7076
                // Otherwise, if a way to get the computed value exists, use that
7077
                if ( val === undefined ) {
7078
                        val = curCSS( elem, name, styles );
7079
                }
7080
7081
                //convert "normal" to computed value
7082
                if ( val === "normal" && name in cssNormalTransform ) {
7083
                        val = cssNormalTransform[ name ];
7084
                }
7085
7086
                // Return, converting to number if forced or a qualifier was provided and val looks numeric
7087
                if ( extra === "" || extra ) {
7088
                        num = parseFloat( val );
7089
                        return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
7090
                }
7091
                return val;
7092
        }
7093
});
7094
7095
// NOTE: we've included the "window" in window.getComputedStyle
7096
// because jsdom on node.js will break without it.
7097
if ( window.getComputedStyle ) {
7098
        getStyles = function( elem ) {
7099
                return window.getComputedStyle( elem, null );
7100
        };
7101
7102
        curCSS = function( elem, name, _computed ) {
7103
                var width, minWidth, maxWidth,
7104
                        computed = _computed || getStyles( elem ),
7105
7106
                        // getPropertyValue is only needed for .css('filter') in IE9, see #12537
7107
                        ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
7108
                        style = elem.style;
7109
7110
                if ( computed ) {
7111
7112
                        if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
7113
                                ret = jQuery.style( elem, name );
7114
                        }
7115
7116
                        // A tribute to the "awesome hack by Dean Edwards"
7117
                        // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
7118
                        // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
7119
                        // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
7120
                        if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
7121
7122
                                // Remember the original values
7123
                                width = style.width;
7124
                                minWidth = style.minWidth;
7125
                                maxWidth = style.maxWidth;
7126
7127
                                // Put in the new values to get a computed value out
7128
                                style.minWidth = style.maxWidth = style.width = ret;
7129
                                ret = computed.width;
7130
7131
                                // Revert the changed values
7132
                                style.width = width;
7133
                                style.minWidth = minWidth;
7134
                                style.maxWidth = maxWidth;
7135
                        }
7136
                }
7137
7138
                return ret;
7139
        };
7140
} else if ( document.documentElement.currentStyle ) {
7141
        getStyles = function( elem ) {
7142
                return elem.currentStyle;
7143
        };
7144
7145
        curCSS = function( elem, name, _computed ) {
7146
                var left, rs, rsLeft,
7147
                        computed = _computed || getStyles( elem ),
7148
                        ret = computed ? computed[ name ] : undefined,
7149
                        style = elem.style;
7150
7151
                // Avoid setting ret to empty string here
7152
                // so we don't default to auto
7153
                if ( ret == null && style && style[ name ] ) {
7154
                        ret = style[ name ];
7155
                }
7156
7157
                // From the awesome hack by Dean Edwards
7158
                // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
7159
7160
                // If we're not dealing with a regular pixel number
7161
                // but a number that has a weird ending, we need to convert it to pixels
7162
                // but not position css attributes, as those are proportional to the parent element instead
7163
                // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
7164
                if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
7165
7166
                        // Remember the original values
7167
                        left = style.left;
7168
                        rs = elem.runtimeStyle;
7169
                        rsLeft = rs && rs.left;
7170
7171
                        // Put in the new values to get a computed value out
7172
                        if ( rsLeft ) {
7173
                                rs.left = elem.currentStyle.left;
7174
                        }
7175
                        style.left = name === "fontSize" ? "1em" : ret;
7176
                        ret = style.pixelLeft + "px";
7177
7178
                        // Revert the changed values
7179
                        style.left = left;
7180
                        if ( rsLeft ) {
7181
                                rs.left = rsLeft;
7182
                        }
7183
                }
7184
7185
                return ret === "" ? "auto" : ret;
7186
        };
7187
}
7188
7189
function setPositiveNumber( elem, value, subtract ) {
7190
        var matches = rnumsplit.exec( value );
7191
        return matches ?
7192
                // Guard against undefined "subtract", e.g., when used as in cssHooks
7193
                Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
7194
                value;
7195
}
7196
7197
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
7198
        var i = extra === ( isBorderBox ? "border" : "content" ) ?
7199
                // If we already have the right measurement, avoid augmentation
7200
                4 :
7201
                // Otherwise initialize for horizontal or vertical properties
7202
                name === "width" ? 1 : 0,
7203
7204
                val = 0;
7205
7206
        for ( ; i < 4; i += 2 ) {
7207
                // both box models exclude margin, so add it if we want it
7208
                if ( extra === "margin" ) {
7209
                        val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
7210
                }
7211
7212
                if ( isBorderBox ) {
7213
                        // border-box includes padding, so remove it if we want content
7214
                        if ( extra === "content" ) {
7215
                                val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7216
                        }
7217
7218
                        // at this point, extra isn't border nor margin, so remove border
7219
                        if ( extra !== "margin" ) {
7220
                                val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7221
                        }
7222
                } else {
7223
                        // at this point, extra isn't content, so add padding
7224
                        val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7225
7226
                        // at this point, extra isn't content nor padding, so add border
7227
                        if ( extra !== "padding" ) {
7228
                                val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7229
                        }
7230
                }
7231
        }
7232
7233
        return val;
7234
}
7235
7236
function getWidthOrHeight( elem, name, extra ) {
7237
7238
        // Start with offset property, which is equivalent to the border-box value
7239
        var valueIsBorderBox = true,
7240
                val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
7241
                styles = getStyles( elem ),
7242
                isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
7243
7244
        // some non-html elements return undefined for offsetWidth, so check for null/undefined
7245
        // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
7246
        // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
7247
        if ( val <= 0 || val == null ) {
7248
                // Fall back to computed then uncomputed css if necessary
7249
                val = curCSS( elem, name, styles );
7250
                if ( val < 0 || val == null ) {
7251
                        val = elem.style[ name ];
7252
                }
7253
7254
                // Computed unit is not pixels. Stop here and return.
7255
                if ( rnumnonpx.test(val) ) {
7256
                        return val;
7257
                }
7258
7259
                // we need the check for style in case a browser which returns unreliable values
7260
                // for getComputedStyle silently falls back to the reliable elem.style
7261
                valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
7262
7263
                // Normalize "", auto, and prepare for extra
7264
                val = parseFloat( val ) || 0;
7265
        }
7266
7267
        // use the active box-sizing model to add/subtract irrelevant styles
7268
        return ( val +
7269
                augmentWidthOrHeight(
7270
                        elem,
7271
                        name,
7272
                        extra || ( isBorderBox ? "border" : "content" ),
7273
                        valueIsBorderBox,
7274
                        styles
7275
                )
7276
        ) + "px";
7277
}
7278
7279
// Try to determine the default display value of an element
7280
function css_defaultDisplay( nodeName ) {
7281
        var doc = document,
7282
                display = elemdisplay[ nodeName ];
7283
7284
        if ( !display ) {
7285
                display = actualDisplay( nodeName, doc );
7286
7287
                // If the simple way fails, read from inside an iframe
7288
                if ( display === "none" || !display ) {
7289
                        // Use the already-created iframe if possible
7290
                        iframe = ( iframe ||
7291
                                jQuery("<iframe frameborder='0' width='0' height='0'/>")
7292
                                .css( "cssText", "display:block !important" )
7293
                        ).appendTo( doc.documentElement );
7294
7295
                        // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
7296
                        doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
7297
                        doc.write("<!doctype html><html><body>");
7298
                        doc.close();
7299
7300
                        display = actualDisplay( nodeName, doc );
7301
                        iframe.detach();
7302
                }
7303
7304
                // Store the correct default display
7305
                elemdisplay[ nodeName ] = display;
7306
        }
7307
7308
        return display;
7309
}
7310
7311
// Called ONLY from within css_defaultDisplay
7312
function actualDisplay( name, doc ) {
7313
        var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
7314
                display = jQuery.css( elem[0], "display" );
7315
        elem.remove();
7316
        return display;
7317
}
7318
7319
jQuery.each([ "height", "width" ], function( i, name ) {
7320
        jQuery.cssHooks[ name ] = {
7321
                get: function( elem, computed, extra ) {
7322
                        if ( computed ) {
7323
                                // certain elements can have dimension info if we invisibly show them
7324
                                // however, it must have a current display style that would benefit from this
7325
                                return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
7326
                                        jQuery.swap( elem, cssShow, function() {
7327
                                                return getWidthOrHeight( elem, name, extra );
7328
                                        }) :
7329
                                        getWidthOrHeight( elem, name, extra );
7330
                        }
7331
                },
7332
7333
                set: function( elem, value, extra ) {
7334
                        var styles = extra && getStyles( elem );
7335
                        return setPositiveNumber( elem, value, extra ?
7336
                                augmentWidthOrHeight(
7337
                                        elem,
7338
                                        name,
7339
                                        extra,
7340
                                        jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
7341
                                        styles
7342
                                ) : 0
7343
                        );
7344
                }
7345
        };
7346
});
7347
7348
if ( !jQuery.support.opacity ) {
7349
        jQuery.cssHooks.opacity = {
7350
                get: function( elem, computed ) {
7351
                        // IE uses filters for opacity
7352
                        return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
7353
                                ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
7354
                                computed ? "1" : "";
7355
                },
7356
7357
                set: function( elem, value ) {
7358
                        var style = elem.style,
7359
                                currentStyle = elem.currentStyle,
7360
                                opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
7361
                                filter = currentStyle && currentStyle.filter || style.filter || "";
7362
7363
                        // IE has trouble with opacity if it does not have layout
7364
                        // Force it by setting the zoom level
7365
                        style.zoom = 1;
7366
7367
                        // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
7368
                        // if value === "", then remove inline opacity #12685
7369
                        if ( ( value >= 1 || value === "" ) &&
7370
                                        jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
7371
                                        style.removeAttribute ) {
7372
7373
                                // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
7374
                                // if "filter:" is present at all, clearType is disabled, we want to avoid this
7375
                                // style.removeAttribute is IE Only, but so apparently is this code path...
7376
                                style.removeAttribute( "filter" );
7377
7378
                                // if there is no filter style applied in a css rule or unset inline opacity, we are done
7379
                                if ( value === "" || currentStyle && !currentStyle.filter ) {
7380
                                        return;
7381
                                }
7382
                        }
7383
7384
                        // otherwise, set new filter values
7385
                        style.filter = ralpha.test( filter ) ?
7386
                                filter.replace( ralpha, opacity ) :
7387
                                filter + " " + opacity;
7388
                }
7389
        };
7390
}
7391
7392
// These hooks cannot be added until DOM ready because the support test
7393
// for it is not run until after DOM ready
7394
jQuery(function() {
7395
        if ( !jQuery.support.reliableMarginRight ) {
7396
                jQuery.cssHooks.marginRight = {
7397
                        get: function( elem, computed ) {
7398
                                if ( computed ) {
7399
                                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
7400
                                        // Work around by temporarily setting element display to inline-block
7401
                                        return jQuery.swap( elem, { "display": "inline-block" },
7402
                                                curCSS, [ elem, "marginRight" ] );
7403
                                }
7404
                        }
7405
                };
7406
        }
7407
7408
        // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
7409
        // getComputedStyle returns percent when specified for top/left/bottom/right
7410
        // rather than make the css module depend on the offset module, we just check for it here
7411
        if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
7412
                jQuery.each( [ "top", "left" ], function( i, prop ) {
7413
                        jQuery.cssHooks[ prop ] = {
7414
                                get: function( elem, computed ) {
7415
                                        if ( computed ) {
7416
                                                computed = curCSS( elem, prop );
7417
                                                // if curCSS returns percentage, fallback to offset
7418
                                                return rnumnonpx.test( computed ) ?
7419
                                                        jQuery( elem ).position()[ prop ] + "px" :
7420
                                                        computed;
7421
                                        }
7422
                                }
7423
                        };
7424
                });
7425
        }
7426
7427
});
7428
7429
if ( jQuery.expr && jQuery.expr.filters ) {
7430
        jQuery.expr.filters.hidden = function( elem ) {
7431
                // Support: Opera <= 12.12
7432
                // Opera reports offsetWidths and offsetHeights less than zero on some elements
7433
                return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
7434
                        (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
7435
        };
7436
7437
        jQuery.expr.filters.visible = function( elem ) {
7438
                return !jQuery.expr.filters.hidden( elem );
7439
        };
7440
}
7441
7442
// These hooks are used by animate to expand properties
7443
jQuery.each({
7444
        margin: "",
7445
        padding: "",
7446
        border: "Width"
7447
}, function( prefix, suffix ) {
7448
        jQuery.cssHooks[ prefix + suffix ] = {
7449
                expand: function( value ) {
7450
                        var i = 0,
7451
                                expanded = {},
7452
7453
                                // assumes a single number if not a string
7454
                                parts = typeof value === "string" ? value.split(" ") : [ value ];
7455
7456
                        for ( ; i < 4; i++ ) {
7457
                                expanded[ prefix + cssExpand[ i ] + suffix ] =
7458
                                        parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
7459
                        }
7460
7461
                        return expanded;
7462
                }
7463
        };
7464
7465
        if ( !rmargin.test( prefix ) ) {
7466
                jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
7467
        }
7468
});
7469
var r20 = /%20/g,
7470
        rbracket = /\[\]$/,
7471
        rCRLF = /\r?\n/g,
7472
        rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
7473
        rsubmittable = /^(?:input|select|textarea|keygen)/i;
7474
7475
jQuery.fn.extend({
7476
        serialize: function() {
7477
                return jQuery.param( this.serializeArray() );
7478
        },
7479
        serializeArray: function() {
7480
                return this.map(function(){
7481
                        // Can add propHook for "elements" to filter or add form elements
7482
                        var elements = jQuery.prop( this, "elements" );
7483
                        return elements ? jQuery.makeArray( elements ) : this;
7484
                })
7485
                .filter(function(){
7486
                        var type = this.type;
7487
                        // Use .is(":disabled") so that fieldset[disabled] works
7488
                        return this.name && !jQuery( this ).is( ":disabled" ) &&
7489
                                rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
7490
                                ( this.checked || !manipulation_rcheckableType.test( type ) );
7491
                })
7492
                .map(function( i, elem ){
7493
                        var val = jQuery( this ).val();
7494
7495
                        return val == null ?
7496
                                null :
7497
                                jQuery.isArray( val ) ?
7498
                                        jQuery.map( val, function( val ){
7499
                                                return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7500
                                        }) :
7501
                                        { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7502
                }).get();
7503
        }
7504
});
7505
7506
//Serialize an array of form elements or a set of
7507
//key/values into a query string
7508
jQuery.param = function( a, traditional ) {
7509
        var prefix,
7510
                s = [],
7511
                add = function( key, value ) {
7512
                        // If value is a function, invoke it and return its value
7513
                        value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
7514
                        s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
7515
                };
7516
7517
        // Set traditional to true for jQuery <= 1.3.2 behavior.
7518
        if ( traditional === undefined ) {
7519
                traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
7520
        }
7521
7522
        // If an array was passed in, assume that it is an array of form elements.
7523
        if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7524
                // Serialize the form elements
7525
                jQuery.each( a, function() {
7526
                        add( this.name, this.value );
7527
                });
7528
7529
        } else {
7530
                // If traditional, encode the "old" way (the way 1.3.2 or older
7531
                // did it), otherwise encode params recursively.
7532
                for ( prefix in a ) {
7533
                        buildParams( prefix, a[ prefix ], traditional, add );
7534
                }
7535
        }
7536
7537
        // Return the resulting serialization
7538
        return s.join( "&" ).replace( r20, "+" );
7539
};
7540
7541
function buildParams( prefix, obj, traditional, add ) {
7542
        var name;
7543
7544
        if ( jQuery.isArray( obj ) ) {
7545
                // Serialize array item.
7546
                jQuery.each( obj, function( i, v ) {
7547
                        if ( traditional || rbracket.test( prefix ) ) {
7548
                                // Treat each array item as a scalar.
7549
                                add( prefix, v );
7550
7551
                        } else {
7552
                                // Item is non-scalar (array or object), encode its numeric index.
7553
                                buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7554
                        }
7555
                });
7556
7557
        } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7558
                // Serialize object item.
7559
                for ( name in obj ) {
7560
                        buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7561
                }
7562
7563
        } else {
7564
                // Serialize scalar item.
7565
                add( prefix, obj );
7566
        }
7567
}
7568
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
7569
        "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
7570
        "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
7571
7572
        // Handle event binding
7573
        jQuery.fn[ name ] = function( data, fn ) {
7574
                return arguments.length > 0 ?
7575
                        this.on( name, null, data, fn ) :
7576
                        this.trigger( name );
7577
        };
7578
});
7579
7580
jQuery.fn.extend({
7581
        hover: function( fnOver, fnOut ) {
7582
                return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
7583
        },
7584
7585
        bind: function( types, data, fn ) {
7586
                return this.on( types, null, data, fn );
7587
        },
7588
        unbind: function( types, fn ) {
7589
                return this.off( types, null, fn );
7590
        },
7591
7592
        delegate: function( selector, types, data, fn ) {
7593
                return this.on( types, selector, data, fn );
7594
        },
7595
        undelegate: function( selector, types, fn ) {
7596
                // ( namespace ) or ( selector, types [, fn] )
7597
                return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
7598
        }
7599
});
7600
var
7601
        // Document location
7602
        ajaxLocParts,
7603
        ajaxLocation,
7604
        ajax_nonce = jQuery.now(),
7605
7606
        ajax_rquery = /\?/,
7607
        rhash = /#.*$/,
7608
        rts = /([?&])_=[^&]*/,
7609
        rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
7610
        // #7653, #8125, #8152: local protocol detection
7611
        rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
7612
        rnoContent = /^(?:GET|HEAD)$/,
7613
        rprotocol = /^\/\//,
7614
        rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
7615
7616
        // Keep a copy of the old load method
7617
        _load = jQuery.fn.load,
7618
7619
        /* Prefilters
7620
         * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7621
         * 2) These are called:
7622
         *    - BEFORE asking for a transport
7623
         *    - AFTER param serialization (s.data is a string if s.processData is true)
7624
         * 3) key is the dataType
7625
         * 4) the catchall symbol "*" can be used
7626
         * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7627
         */
7628
        prefilters = {},
7629
7630
        /* Transports bindings
7631
         * 1) key is the dataType
7632
         * 2) the catchall symbol "*" can be used
7633
         * 3) selection will start with transport dataType and THEN go to "*" if needed
7634
         */
7635
        transports = {},
7636
7637
        // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7638
        allTypes = "*/".concat("*");
7639
7640
// #8138, IE may throw an exception when accessing
7641
// a field from window.location if document.domain has been set
7642
try {
7643
        ajaxLocation = location.href;
7644
} catch( e ) {
7645
        // Use the href attribute of an A element
7646
        // since IE will modify it given document.location
7647
        ajaxLocation = document.createElement( "a" );
7648
        ajaxLocation.href = "";
7649
        ajaxLocation = ajaxLocation.href;
7650
}
7651
7652
// Segment location into parts
7653
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
7654
7655
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7656
function addToPrefiltersOrTransports( structure ) {
7657
7658
        // dataTypeExpression is optional and defaults to "*"
7659
        return function( dataTypeExpression, func ) {
7660
7661
                if ( typeof dataTypeExpression !== "string" ) {
7662
                        func = dataTypeExpression;
7663
                        dataTypeExpression = "*";
7664
                }
7665
7666
                var dataType,
7667
                        i = 0,
7668
                        dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
7669
7670
                if ( jQuery.isFunction( func ) ) {
7671
                        // For each dataType in the dataTypeExpression
7672
                        while ( (dataType = dataTypes[i++]) ) {
7673
                                // Prepend if requested
7674
                                if ( dataType[0] === "+" ) {
7675
                                        dataType = dataType.slice( 1 ) || "*";
7676
                                        (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
7677
7678
                                // Otherwise append
7679
                                } else {
7680
                                        (structure[ dataType ] = structure[ dataType ] || []).push( func );
7681
                                }
7682
                        }
7683
                }
7684
        };
7685
}
7686
7687
// Base inspection function for prefilters and transports
7688
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
7689
7690
        var inspected = {},
7691
                seekingTransport = ( structure === transports );
7692
7693
        function inspect( dataType ) {
7694
                var selected;
7695
                inspected[ dataType ] = true;
7696
                jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
7697
                        var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
7698
                        if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
7699
                                options.dataTypes.unshift( dataTypeOrTransport );
7700
                                inspect( dataTypeOrTransport );
7701
                                return false;
7702
                        } else if ( seekingTransport ) {
7703
                                return !( selected = dataTypeOrTransport );
7704
                        }
7705
                });
7706
                return selected;
7707
        }
7708
7709
        return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
7710
}
7711
7712
// A special extend for ajax options
7713
// that takes "flat" options (not to be deep extended)
7714
// Fixes #9887
7715
function ajaxExtend( target, src ) {
7716
        var deep, key,
7717
                flatOptions = jQuery.ajaxSettings.flatOptions || {};
7718
7719
        for ( key in src ) {
7720
                if ( src[ key ] !== undefined ) {
7721
                        ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
7722
                }
7723
        }
7724
        if ( deep ) {
7725
                jQuery.extend( true, target, deep );
7726
        }
7727
7728
        return target;
7729
}
7730
7731
jQuery.fn.load = function( url, params, callback ) {
7732
        if ( typeof url !== "string" && _load ) {
7733
                return _load.apply( this, arguments );
7734
        }
7735
7736
        var selector, response, type,
7737
                self = this,
7738
                off = url.indexOf(" ");
7739
7740
        if ( off >= 0 ) {
7741
                selector = url.slice( off, url.length );
7742
                url = url.slice( 0, off );
7743
        }
7744
7745
        // If it's a function
7746
        if ( jQuery.isFunction( params ) ) {
7747
7748
                // We assume that it's the callback
7749
                callback = params;
7750
                params = undefined;
7751
7752
        // Otherwise, build a param string
7753
        } else if ( params && typeof params === "object" ) {
7754
                type = "POST";
7755
        }
7756
7757
        // If we have elements to modify, make the request
7758
        if ( self.length > 0 ) {
7759
                jQuery.ajax({
7760
                        url: url,
7761
7762
                        // if "type" variable is undefined, then "GET" method will be used
7763
                        type: type,
7764
                        dataType: "html",
7765
                        data: params
7766
                }).done(function( responseText ) {
7767
7768
                        // Save response for use in complete callback
7769
                        response = arguments;
7770
7771
                        self.html( selector ?
7772
7773
                                // If a selector was specified, locate the right elements in a dummy div
7774
                                // Exclude scripts to avoid IE 'Permission Denied' errors
7775
                                jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
7776
7777
                                // Otherwise use the full result
7778
                                responseText );
7779
7780
                }).complete( callback && function( jqXHR, status ) {
7781
                        self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
7782
                });
7783
        }
7784
7785
        return this;
7786
};
7787
7788
// Attach a bunch of functions for handling common AJAX events
7789
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
7790
        jQuery.fn[ type ] = function( fn ){
7791
                return this.on( type, fn );
7792
        };
7793
});
7794
7795
jQuery.extend({
7796
7797
        // Counter for holding the number of active queries
7798
        active: 0,
7799
7800
        // Last-Modified header cache for next request
7801
        lastModified: {},
7802
        etag: {},
7803
7804
        ajaxSettings: {
7805
                url: ajaxLocation,
7806
                type: "GET",
7807
                isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7808
                global: true,
7809
                processData: true,
7810
                async: true,
7811
                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7812
                /*
7813
                timeout: 0,
7814
                data: null,
7815
                dataType: null,
7816
                username: null,
7817
                password: null,
7818
                cache: null,
7819
                throws: false,
7820
                traditional: false,
7821
                headers: {},
7822
                */
7823
7824
                accepts: {
7825
                        "*": allTypes,
7826
                        text: "text/plain",
7827
                        html: "text/html",
7828
                        xml: "application/xml, text/xml",
7829
                        json: "application/json, text/javascript"
7830
                },
7831
7832
                contents: {
7833
                        xml: /xml/,
7834
                        html: /html/,
7835
                        json: /json/
7836
                },
7837
7838
                responseFields: {
7839
                        xml: "responseXML",
7840
                        text: "responseText",
7841
                        json: "responseJSON"
7842
                },
7843
7844
                // Data converters
7845
                // Keys separate source (or catchall "*") and destination types with a single space
7846
                converters: {
7847
7848
                        // Convert anything to text
7849
                        "* text": String,
7850
7851
                        // Text to html (true = no transformation)
7852
                        "text html": true,
7853
7854
                        // Evaluate text as a json expression
7855
                        "text json": jQuery.parseJSON,
7856
7857
                        // Parse text as xml
7858
                        "text xml": jQuery.parseXML
7859
                },
7860
7861
                // For options that shouldn't be deep extended:
7862
                // you can add your own custom options here if
7863
                // and when you create one that shouldn't be
7864
                // deep extended (see ajaxExtend)
7865
                flatOptions: {
7866
                        url: true,
7867
                        context: true
7868
                }
7869
        },
7870
7871
        // Creates a full fledged settings object into target
7872
        // with both ajaxSettings and settings fields.
7873
        // If target is omitted, writes into ajaxSettings.
7874
        ajaxSetup: function( target, settings ) {
7875
                return settings ?
7876
7877
                        // Building a settings object
7878
                        ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
7879
7880
                        // Extending ajaxSettings
7881
                        ajaxExtend( jQuery.ajaxSettings, target );
7882
        },
7883
7884
        ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
7885
        ajaxTransport: addToPrefiltersOrTransports( transports ),
7886
7887
        // Main method
7888
        ajax: function( url, options ) {
7889
7890
                // If url is an object, simulate pre-1.5 signature
7891
                if ( typeof url === "object" ) {
7892
                        options = url;
7893
                        url = undefined;
7894
                }
7895
7896
                // Force options to be an object
7897
                options = options || {};
7898
7899
                var // Cross-domain detection vars
7900
                        parts,
7901
                        // Loop variable
7902
                        i,
7903
                        // URL without anti-cache param
7904
                        cacheURL,
7905
                        // Response headers as string
7906
                        responseHeadersString,
7907
                        // timeout handle
7908
                        timeoutTimer,
7909
7910
                        // To know if global events are to be dispatched
7911
                        fireGlobals,
7912
7913
                        transport,
7914
                        // Response headers
7915
                        responseHeaders,
7916
                        // Create the final options object
7917
                        s = jQuery.ajaxSetup( {}, options ),
7918
                        // Callbacks context
7919
                        callbackContext = s.context || s,
7920
                        // Context for global events is callbackContext if it is a DOM node or jQuery collection
7921
                        globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
7922
                                jQuery( callbackContext ) :
7923
                                jQuery.event,
7924
                        // Deferreds
7925
                        deferred = jQuery.Deferred(),
7926
                        completeDeferred = jQuery.Callbacks("once memory"),
7927
                        // Status-dependent callbacks
7928
                        statusCode = s.statusCode || {},
7929
                        // Headers (they are sent all at once)
7930
                        requestHeaders = {},
7931
                        requestHeadersNames = {},
7932
                        // The jqXHR state
7933
                        state = 0,
7934
                        // Default abort message
7935
                        strAbort = "canceled",
7936
                        // Fake xhr
7937
                        jqXHR = {
7938
                                readyState: 0,
7939
7940
                                // Builds headers hashtable if needed
7941
                                getResponseHeader: function( key ) {
7942
                                        var match;
7943
                                        if ( state === 2 ) {
7944
                                                if ( !responseHeaders ) {
7945
                                                        responseHeaders = {};
7946
                                                        while ( (match = rheaders.exec( responseHeadersString )) ) {
7947
                                                                responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
7948
                                                        }
7949
                                                }
7950
                                                match = responseHeaders[ key.toLowerCase() ];
7951
                                        }
7952
                                        return match == null ? null : match;
7953
                                },
7954
7955
                                // Raw string
7956
                                getAllResponseHeaders: function() {
7957
                                        return state === 2 ? responseHeadersString : null;
7958
                                },
7959
7960
                                // Caches the header
7961
                                setRequestHeader: function( name, value ) {
7962
                                        var lname = name.toLowerCase();
7963
                                        if ( !state ) {
7964
                                                name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
7965
                                                requestHeaders[ name ] = value;
7966
                                        }
7967
                                        return this;
7968
                                },
7969
7970
                                // Overrides response content-type header
7971
                                overrideMimeType: function( type ) {
7972
                                        if ( !state ) {
7973
                                                s.mimeType = type;
7974
                                        }
7975
                                        return this;
7976
                                },
7977
7978
                                // Status-dependent callbacks
7979
                                statusCode: function( map ) {
7980
                                        var code;
7981
                                        if ( map ) {
7982
                                                if ( state < 2 ) {
7983
                                                        for ( code in map ) {
7984
                                                                // Lazy-add the new callback in a way that preserves old ones
7985
                                                                statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
7986
                                                        }
7987
                                                } else {
7988
                                                        // Execute the appropriate callbacks
7989
                                                        jqXHR.always( map[ jqXHR.status ] );
7990
                                                }
7991
                                        }
7992
                                        return this;
7993
                                },
7994
7995
                                // Cancel the request
7996
                                abort: function( statusText ) {
7997
                                        var finalText = statusText || strAbort;
7998
                                        if ( transport ) {
7999
                                                transport.abort( finalText );
8000
                                        }
8001
                                        done( 0, finalText );
8002
                                        return this;
8003
                                }
8004
                        };
8005
8006
                // Attach deferreds
8007
                deferred.promise( jqXHR ).complete = completeDeferred.add;
8008
                jqXHR.success = jqXHR.done;
8009
                jqXHR.error = jqXHR.fail;
8010
8011
                // Remove hash character (#7531: and string promotion)
8012
                // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
8013
                // Handle falsy url in the settings object (#10093: consistency with old signature)
8014
                // We also use the url parameter if available
8015
                s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
8016
8017
                // Alias method option to type as per ticket #12004
8018
                s.type = options.method || options.type || s.method || s.type;
8019
8020
                // Extract dataTypes list
8021
                s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
8022
8023
                // A cross-domain request is in order when we have a protocol:host:port mismatch
8024
                if ( s.crossDomain == null ) {
8025
                        parts = rurl.exec( s.url.toLowerCase() );
8026
                        s.crossDomain = !!( parts &&
8027
                                ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
8028
                                        ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
8029
                                                ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
8030
                        );
8031
                }
8032
8033
                // Convert data if not already a string
8034
                if ( s.data && s.processData && typeof s.data !== "string" ) {
8035
                        s.data = jQuery.param( s.data, s.traditional );
8036
                }
8037
8038
                // Apply prefilters
8039
                inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
8040
8041
                // If request was aborted inside a prefilter, stop there
8042
                if ( state === 2 ) {
8043
                        return jqXHR;
8044
                }
8045
8046
                // We can fire global events as of now if asked to
8047
                fireGlobals = s.global;
8048
8049
                // Watch for a new set of requests
8050
                if ( fireGlobals && jQuery.active++ === 0 ) {
8051
                        jQuery.event.trigger("ajaxStart");
8052
                }
8053
8054
                // Uppercase the type
8055
                s.type = s.type.toUpperCase();
8056
8057
                // Determine if request has content
8058
                s.hasContent = !rnoContent.test( s.type );
8059
8060
                // Save the URL in case we're toying with the If-Modified-Since
8061
                // and/or If-None-Match header later on
8062
                cacheURL = s.url;
8063
8064
                // More options handling for requests with no content
8065
                if ( !s.hasContent ) {
8066
8067
                        // If data is available, append data to url
8068
                        if ( s.data ) {
8069
                                cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
8070
                                // #9682: remove data so that it's not used in an eventual retry
8071
                                delete s.data;
8072
                        }
8073
8074
                        // Add anti-cache in url if needed
8075
                        if ( s.cache === false ) {
8076
                                s.url = rts.test( cacheURL ) ?
8077
8078
                                        // If there is already a '_' parameter, set its value
8079
                                        cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
8080
8081
                                        // Otherwise add one to the end
8082
                                        cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
8083
                        }
8084
                }
8085
8086
                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8087
                if ( s.ifModified ) {
8088
                        if ( jQuery.lastModified[ cacheURL ] ) {
8089
                                jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
8090
                        }
8091
                        if ( jQuery.etag[ cacheURL ] ) {
8092
                                jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
8093
                        }
8094
                }
8095
8096
                // Set the correct header, if data is being sent
8097
                if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
8098
                        jqXHR.setRequestHeader( "Content-Type", s.contentType );
8099
                }
8100
8101
                // Set the Accepts header for the server, depending on the dataType
8102
                jqXHR.setRequestHeader(
8103
                        "Accept",
8104
                        s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
8105
                                s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
8106
                                s.accepts[ "*" ]
8107
                );
8108
8109
                // Check for headers option
8110
                for ( i in s.headers ) {
8111
                        jqXHR.setRequestHeader( i, s.headers[ i ] );
8112
                }
8113
8114
                // Allow custom headers/mimetypes and early abort
8115
                if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
8116
                        // Abort if not done already and return
8117
                        return jqXHR.abort();
8118
                }
8119
8120
                // aborting is no longer a cancellation
8121
                strAbort = "abort";
8122
8123
                // Install callbacks on deferreds
8124
                for ( i in { success: 1, error: 1, complete: 1 } ) {
8125
                        jqXHR[ i ]( s[ i ] );
8126
                }
8127
8128
                // Get transport
8129
                transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
8130
8131
                // If no transport, we auto-abort
8132
                if ( !transport ) {
8133
                        done( -1, "No Transport" );
8134
                } else {
8135
                        jqXHR.readyState = 1;
8136
8137
                        // Send global event
8138
                        if ( fireGlobals ) {
8139
                                globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
8140
                        }
8141
                        // Timeout
8142
                        if ( s.async && s.timeout > 0 ) {
8143
                                timeoutTimer = setTimeout(function() {
8144
                                        jqXHR.abort("timeout");
8145
                                }, s.timeout );
8146
                        }
8147
8148
                        try {
8149
                                state = 1;
8150
                                transport.send( requestHeaders, done );
8151
                        } catch ( e ) {
8152
                                // Propagate exception as error if not done
8153
                                if ( state < 2 ) {
8154
                                        done( -1, e );
8155
                                // Simply rethrow otherwise
8156
                                } else {
8157
                                        throw e;
8158
                                }
8159
                        }
8160
                }
8161
8162
                // Callback for when everything is done
8163
                function done( status, nativeStatusText, responses, headers ) {
8164
                        var isSuccess, success, error, response, modified,
8165
                                statusText = nativeStatusText;
8166
8167
                        // Called once
8168
                        if ( state === 2 ) {
8169
                                return;
8170
                        }
8171
8172
                        // State is "done" now
8173
                        state = 2;
8174
8175
                        // Clear timeout if it exists
8176
                        if ( timeoutTimer ) {
8177
                                clearTimeout( timeoutTimer );
8178
                        }
8179
8180
                        // Dereference transport for early garbage collection
8181
                        // (no matter how long the jqXHR object will be used)
8182
                        transport = undefined;
8183
8184
                        // Cache response headers
8185
                        responseHeadersString = headers || "";
8186
8187
                        // Set readyState
8188
                        jqXHR.readyState = status > 0 ? 4 : 0;
8189
8190
                        // Determine if successful
8191
                        isSuccess = status >= 200 && status < 300 || status === 304;
8192
8193
                        // Get response data
8194
                        if ( responses ) {
8195
                                response = ajaxHandleResponses( s, jqXHR, responses );
8196
                        }
8197
8198
                        // Convert no matter what (that way responseXXX fields are always set)
8199
                        response = ajaxConvert( s, response, jqXHR, isSuccess );
8200
8201
                        // If successful, handle type chaining
8202
                        if ( isSuccess ) {
8203
8204
                                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8205
                                if ( s.ifModified ) {
8206
                                        modified = jqXHR.getResponseHeader("Last-Modified");
8207
                                        if ( modified ) {
8208
                                                jQuery.lastModified[ cacheURL ] = modified;
8209
                                        }
8210
                                        modified = jqXHR.getResponseHeader("etag");
8211
                                        if ( modified ) {
8212
                                                jQuery.etag[ cacheURL ] = modified;
8213
                                        }
8214
                                }
8215
8216
                                // if no content
8217
                                if ( status === 204 || s.type === "HEAD" ) {
8218
                                        statusText = "nocontent";
8219
8220
                                // if not modified
8221
                                } else if ( status === 304 ) {
8222
                                        statusText = "notmodified";
8223
8224
                                // If we have data, let's convert it
8225
                                } else {
8226
                                        statusText = response.state;
8227
                                        success = response.data;
8228
                                        error = response.error;
8229
                                        isSuccess = !error;
8230
                                }
8231
                        } else {
8232
                                // We extract error from statusText
8233
                                // then normalize statusText and status for non-aborts
8234
                                error = statusText;
8235
                                if ( status || !statusText ) {
8236
                                        statusText = "error";
8237
                                        if ( status < 0 ) {
8238
                                                status = 0;
8239
                                        }
8240
                                }
8241
                        }
8242
8243
                        // Set data for the fake xhr object
8244
                        jqXHR.status = status;
8245
                        jqXHR.statusText = ( nativeStatusText || statusText ) + "";
8246
8247
                        // Success/Error
8248
                        if ( isSuccess ) {
8249
                                deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
8250
                        } else {
8251
                                deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
8252
                        }
8253
8254
                        // Status-dependent callbacks
8255
                        jqXHR.statusCode( statusCode );
8256
                        statusCode = undefined;
8257
8258
                        if ( fireGlobals ) {
8259
                                globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
8260
                                        [ jqXHR, s, isSuccess ? success : error ] );
8261
                        }
8262
8263
                        // Complete
8264
                        completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
8265
8266
                        if ( fireGlobals ) {
8267
                                globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
8268
                                // Handle the global AJAX counter
8269
                                if ( !( --jQuery.active ) ) {
8270
                                        jQuery.event.trigger("ajaxStop");
8271
                                }
8272
                        }
8273
                }
8274
8275
                return jqXHR;
8276
        },
8277
8278
        getJSON: function( url, data, callback ) {
8279
                return jQuery.get( url, data, callback, "json" );
8280
        },
8281
8282
        getScript: function( url, callback ) {
8283
                return jQuery.get( url, undefined, callback, "script" );
8284
        }
8285
});
8286
8287
jQuery.each( [ "get", "post" ], function( i, method ) {
8288
        jQuery[ method ] = function( url, data, callback, type ) {
8289
                // shift arguments if data argument was omitted
8290
                if ( jQuery.isFunction( data ) ) {
8291
                        type = type || callback;
8292
                        callback = data;
8293
                        data = undefined;
8294
                }
8295
8296
                return jQuery.ajax({
8297
                        url: url,
8298
                        type: method,
8299
                        dataType: type,
8300
                        data: data,
8301
                        success: callback
8302
                });
8303
        };
8304
});
8305
8306
/* Handles responses to an ajax request:
8307
 * - finds the right dataType (mediates between content-type and expected dataType)
8308
 * - returns the corresponding response
8309
 */
8310
function ajaxHandleResponses( s, jqXHR, responses ) {
8311
        var firstDataType, ct, finalDataType, type,
8312
                contents = s.contents,
8313
                dataTypes = s.dataTypes;
8314
8315
        // Remove auto dataType and get content-type in the process
8316
        while( dataTypes[ 0 ] === "*" ) {
8317
                dataTypes.shift();
8318
                if ( ct === undefined ) {
8319
                        ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
8320
                }
8321
        }
8322
8323
        // Check if we're dealing with a known content-type
8324
        if ( ct ) {
8325
                for ( type in contents ) {
8326
                        if ( contents[ type ] && contents[ type ].test( ct ) ) {
8327
                                dataTypes.unshift( type );
8328
                                break;
8329
                        }
8330
                }
8331
        }
8332
8333
        // Check to see if we have a response for the expected dataType
8334
        if ( dataTypes[ 0 ] in responses ) {
8335
                finalDataType = dataTypes[ 0 ];
8336
        } else {
8337
                // Try convertible dataTypes
8338
                for ( type in responses ) {
8339
                        if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
8340
                                finalDataType = type;
8341
                                break;
8342
                        }
8343
                        if ( !firstDataType ) {
8344
                                firstDataType = type;
8345
                        }
8346
                }
8347
                // Or just use first one
8348
                finalDataType = finalDataType || firstDataType;
8349
        }
8350
8351
        // If we found a dataType
8352
        // We add the dataType to the list if needed
8353
        // and return the corresponding response
8354
        if ( finalDataType ) {
8355
                if ( finalDataType !== dataTypes[ 0 ] ) {
8356
                        dataTypes.unshift( finalDataType );
8357
                }
8358
                return responses[ finalDataType ];
8359
        }
8360
}
8361
8362
/* Chain conversions given the request and the original response
8363
 * Also sets the responseXXX fields on the jqXHR instance
8364
 */
8365
function ajaxConvert( s, response, jqXHR, isSuccess ) {
8366
        var conv2, current, conv, tmp, prev,
8367
                converters = {},
8368
                // Work with a copy of dataTypes in case we need to modify it for conversion
8369
                dataTypes = s.dataTypes.slice();
8370
8371
        // Create converters map with lowercased keys
8372
        if ( dataTypes[ 1 ] ) {
8373
                for ( conv in s.converters ) {
8374
                        converters[ conv.toLowerCase() ] = s.converters[ conv ];
8375
                }
8376
        }
8377
8378
        current = dataTypes.shift();
8379
8380
        // Convert to each sequential dataType
8381
        while ( current ) {
8382
8383
                if ( s.responseFields[ current ] ) {
8384
                        jqXHR[ s.responseFields[ current ] ] = response;
8385
                }
8386
8387
                // Apply the dataFilter if provided
8388
                if ( !prev && isSuccess && s.dataFilter ) {
8389
                        response = s.dataFilter( response, s.dataType );
8390
                }
8391
8392
                prev = current;
8393
                current = dataTypes.shift();
8394
8395
                if ( current ) {
8396
8397
                        // There's only work to do if current dataType is non-auto
8398
                        if ( current === "*" ) {
8399
8400
                                current = prev;
8401
8402
                        // Convert response if prev dataType is non-auto and differs from current
8403
                        } else if ( prev !== "*" && prev !== current ) {
8404
8405
                                // Seek a direct converter
8406
                                conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8407
8408
                                // If none found, seek a pair
8409
                                if ( !conv ) {
8410
                                        for ( conv2 in converters ) {
8411
8412
                                                // If conv2 outputs current
8413
                                                tmp = conv2.split( " " );
8414
                                                if ( tmp[ 1 ] === current ) {
8415
8416
                                                        // If prev can be converted to accepted input
8417
                                                        conv = converters[ prev + " " + tmp[ 0 ] ] ||
8418
                                                                converters[ "* " + tmp[ 0 ] ];
8419
                                                        if ( conv ) {
8420
                                                                // Condense equivalence converters
8421
                                                                if ( conv === true ) {
8422
                                                                        conv = converters[ conv2 ];
8423
8424
                                                                // Otherwise, insert the intermediate dataType
8425
                                                                } else if ( converters[ conv2 ] !== true ) {
8426
                                                                        current = tmp[ 0 ];
8427
                                                                        dataTypes.unshift( tmp[ 1 ] );
8428
                                                                }
8429
                                                                break;
8430
                                                        }
8431
                                                }
8432
                                        }
8433
                                }
8434
8435
                                // Apply converter (if not an equivalence)
8436
                                if ( conv !== true ) {
8437
8438
                                        // Unless errors are allowed to bubble, catch and return them
8439
                                        if ( conv && s[ "throws" ] ) {
8440
                                                response = conv( response );
8441
                                        } else {
8442
                                                try {
8443
                                                        response = conv( response );
8444
                                                } catch ( e ) {
8445
                                                        return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
8446
                                                }
8447
                                        }
8448
                                }
8449
                        }
8450
                }
8451
        }
8452
8453
        return { state: "success", data: response };
8454
}
8455
// Install script dataType
8456
jQuery.ajaxSetup({
8457
        accepts: {
8458
                script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
8459
        },
8460
        contents: {
8461
                script: /(?:java|ecma)script/
8462
        },
8463
        converters: {
8464
                "text script": function( text ) {
8465
                        jQuery.globalEval( text );
8466
                        return text;
8467
                }
8468
        }
8469
});
8470
8471
// Handle cache's special case and global
8472
jQuery.ajaxPrefilter( "script", function( s ) {
8473
        if ( s.cache === undefined ) {
8474
                s.cache = false;
8475
        }
8476
        if ( s.crossDomain ) {
8477
                s.type = "GET";
8478
                s.global = false;
8479
        }
8480
});
8481
8482
// Bind script tag hack transport
8483
jQuery.ajaxTransport( "script", function(s) {
8484
8485
        // This transport only deals with cross domain requests
8486
        if ( s.crossDomain ) {
8487
8488
                var script,
8489
                        head = document.head || jQuery("head")[0] || document.documentElement;
8490
8491
                return {
8492
8493
                        send: function( _, callback ) {
8494
8495
                                script = document.createElement("script");
8496
8497
                                script.async = true;
8498
8499
                                if ( s.scriptCharset ) {
8500
                                        script.charset = s.scriptCharset;
8501
                                }
8502
8503
                                script.src = s.url;
8504
8505
                                // Attach handlers for all browsers
8506
                                script.onload = script.onreadystatechange = function( _, isAbort ) {
8507
8508
                                        if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
8509
8510
                                                // Handle memory leak in IE
8511
                                                script.onload = script.onreadystatechange = null;
8512
8513
                                                // Remove the script
8514
                                                if ( script.parentNode ) {
8515
                                                        script.parentNode.removeChild( script );
8516
                                                }
8517
8518
                                                // Dereference the script
8519
                                                script = null;
8520
8521
                                                // Callback if not abort
8522
                                                if ( !isAbort ) {
8523
                                                        callback( 200, "success" );
8524
                                                }
8525
                                        }
8526
                                };
8527
8528
                                // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
8529
                                // Use native DOM manipulation to avoid our domManip AJAX trickery
8530
                                head.insertBefore( script, head.firstChild );
8531
                        },
8532
8533
                        abort: function() {
8534
                                if ( script ) {
8535
                                        script.onload( undefined, true );
8536
                                }
8537
                        }
8538
                };
8539
        }
8540
});
8541
var oldCallbacks = [],
8542
        rjsonp = /(=)\?(?=&|$)|\?\?/;
8543
8544
// Default jsonp settings
8545
jQuery.ajaxSetup({
8546
        jsonp: "callback",
8547
        jsonpCallback: function() {
8548
                var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
8549
                this[ callback ] = true;
8550
                return callback;
8551
        }
8552
});
8553
8554
// Detect, normalize options and install callbacks for jsonp requests
8555
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
8556
8557
        var callbackName, overwritten, responseContainer,
8558
                jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
8559
                        "url" :
8560
                        typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
8561
                );
8562
8563
        // Handle iff the expected data type is "jsonp" or we have a parameter to set
8564
        if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
8565
8566
                // Get callback name, remembering preexisting value associated with it
8567
                callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
8568
                        s.jsonpCallback() :
8569
                        s.jsonpCallback;
8570
8571
                // Insert callback into url or form data
8572
                if ( jsonProp ) {
8573
                        s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
8574
                } else if ( s.jsonp !== false ) {
8575
                        s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
8576
                }
8577
8578
                // Use data converter to retrieve json after script execution
8579
                s.converters["script json"] = function() {
8580
                        if ( !responseContainer ) {
8581
                                jQuery.error( callbackName + " was not called" );
8582
                        }
8583
                        return responseContainer[ 0 ];
8584
                };
8585
8586
                // force json dataType
8587
                s.dataTypes[ 0 ] = "json";
8588
8589
                // Install callback
8590
                overwritten = window[ callbackName ];
8591
                window[ callbackName ] = function() {
8592
                        responseContainer = arguments;
8593
                };
8594
8595
                // Clean-up function (fires after converters)
8596
                jqXHR.always(function() {
8597
                        // Restore preexisting value
8598
                        window[ callbackName ] = overwritten;
8599
8600
                        // Save back as free
8601
                        if ( s[ callbackName ] ) {
8602
                                // make sure that re-using the options doesn't screw things around
8603
                                s.jsonpCallback = originalSettings.jsonpCallback;
8604
8605
                                // save the callback name for future use
8606
                                oldCallbacks.push( callbackName );
8607
                        }
8608
8609
                        // Call if it was a function and we have a response
8610
                        if ( responseContainer && jQuery.isFunction( overwritten ) ) {
8611
                                overwritten( responseContainer[ 0 ] );
8612
                        }
8613
8614
                        responseContainer = overwritten = undefined;
8615
                });
8616
8617
                // Delegate to script
8618
                return "script";
8619
        }
8620
});
8621
var xhrCallbacks, xhrSupported,
8622
        xhrId = 0,
8623
        // #5280: Internet Explorer will keep connections alive if we don't abort on unload
8624
        xhrOnUnloadAbort = window.ActiveXObject && function() {
8625
                // Abort all pending requests
8626
                var key;
8627
                for ( key in xhrCallbacks ) {
8628
                        xhrCallbacks[ key ]( undefined, true );
8629
                }
8630
        };
8631
8632
// Functions to create xhrs
8633
function createStandardXHR() {
8634
        try {
8635
                return new window.XMLHttpRequest();
8636
        } catch( e ) {}
8637
}
8638
8639
function createActiveXHR() {
8640
        try {
8641
                return new window.ActiveXObject("Microsoft.XMLHTTP");
8642
        } catch( e ) {}
8643
}
8644
8645
// Create the request object
8646
// (This is still attached to ajaxSettings for backward compatibility)
8647
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
8648
        /* Microsoft failed to properly
8649
         * implement the XMLHttpRequest in IE7 (can't request local files),
8650
         * so we use the ActiveXObject when it is available
8651
         * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
8652
         * we need a fallback.
8653
         */
8654
        function() {
8655
                return !this.isLocal && createStandardXHR() || createActiveXHR();
8656
        } :
8657
        // For all other browsers, use the standard XMLHttpRequest object
8658
        createStandardXHR;
8659
8660
// Determine support properties
8661
xhrSupported = jQuery.ajaxSettings.xhr();
8662
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
8663
xhrSupported = jQuery.support.ajax = !!xhrSupported;
8664
8665
// Create transport if the browser can provide an xhr
8666
if ( xhrSupported ) {
8667
8668
        jQuery.ajaxTransport(function( s ) {
8669
                // Cross domain only allowed if supported through XMLHttpRequest
8670
                if ( !s.crossDomain || jQuery.support.cors ) {
8671
8672
                        var callback;
8673
8674
                        return {
8675
                                send: function( headers, complete ) {
8676
8677
                                        // Get a new xhr
8678
                                        var handle, i,
8679
                                                xhr = s.xhr();
8680
8681
                                        // Open the socket
8682
                                        // Passing null username, generates a login popup on Opera (#2865)
8683
                                        if ( s.username ) {
8684
                                                xhr.open( s.type, s.url, s.async, s.username, s.password );
8685
                                        } else {
8686
                                                xhr.open( s.type, s.url, s.async );
8687
                                        }
8688
8689
                                        // Apply custom fields if provided
8690
                                        if ( s.xhrFields ) {
8691
                                                for ( i in s.xhrFields ) {
8692
                                                        xhr[ i ] = s.xhrFields[ i ];
8693
                                                }
8694
                                        }
8695
8696
                                        // Override mime type if needed
8697
                                        if ( s.mimeType && xhr.overrideMimeType ) {
8698
                                                xhr.overrideMimeType( s.mimeType );
8699
                                        }
8700
8701
                                        // X-Requested-With header
8702
                                        // For cross-domain requests, seeing as conditions for a preflight are
8703
                                        // akin to a jigsaw puzzle, we simply never set it to be sure.
8704
                                        // (it can always be set on a per-request basis or even using ajaxSetup)
8705
                                        // For same-domain requests, won't change header if already provided.
8706
                                        if ( !s.crossDomain && !headers["X-Requested-With"] ) {
8707
                                                headers["X-Requested-With"] = "XMLHttpRequest";
8708
                                        }
8709
8710
                                        // Need an extra try/catch for cross domain requests in Firefox 3
8711
                                        try {
8712
                                                for ( i in headers ) {
8713
                                                        xhr.setRequestHeader( i, headers[ i ] );
8714
                                                }
8715
                                        } catch( err ) {}
8716
8717
                                        // Do send the request
8718
                                        // This may raise an exception which is actually
8719
                                        // handled in jQuery.ajax (so no try/catch here)
8720
                                        xhr.send( ( s.hasContent && s.data ) || null );
8721
8722
                                        // Listener
8723
                                        callback = function( _, isAbort ) {
8724
                                                var status, responseHeaders, statusText, responses;
8725
8726
                                                // Firefox throws exceptions when accessing properties
8727
                                                // of an xhr when a network error occurred
8728
                                                // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
8729
                                                try {
8730
8731
                                                        // Was never called and is aborted or complete
8732
                                                        if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
8733
8734
                                                                // Only called once
8735
                                                                callback = undefined;
8736
8737
                                                                // Do not keep as active anymore
8738
                                                                if ( handle ) {
8739
                                                                        xhr.onreadystatechange = jQuery.noop;
8740
                                                                        if ( xhrOnUnloadAbort ) {
8741
                                                                                delete xhrCallbacks[ handle ];
8742
                                                                        }
8743
                                                                }
8744
8745
                                                                // If it's an abort
8746
                                                                if ( isAbort ) {
8747
                                                                        // Abort it manually if needed
8748
                                                                        if ( xhr.readyState !== 4 ) {
8749
                                                                                xhr.abort();
8750
                                                                        }
8751
                                                                } else {
8752
                                                                        responses = {};
8753
                                                                        status = xhr.status;
8754
                                                                        responseHeaders = xhr.getAllResponseHeaders();
8755
8756
                                                                        // When requesting binary data, IE6-9 will throw an exception
8757
                                                                        // on any attempt to access responseText (#11426)
8758
                                                                        if ( typeof xhr.responseText === "string" ) {
8759
                                                                                responses.text = xhr.responseText;
8760
                                                                        }
8761
8762
                                                                        // Firefox throws an exception when accessing
8763
                                                                        // statusText for faulty cross-domain requests
8764
                                                                        try {
8765
                                                                                statusText = xhr.statusText;
8766
                                                                        } catch( e ) {
8767
                                                                                // We normalize with Webkit giving an empty statusText
8768
                                                                                statusText = "";
8769
                                                                        }
8770
8771
                                                                        // Filter status for non standard behaviors
8772
8773
                                                                        // If the request is local and we have data: assume a success
8774
                                                                        // (success with no data won't get notified, that's the best we
8775
                                                                        // can do given current implementations)
8776
                                                                        if ( !status && s.isLocal && !s.crossDomain ) {
8777
                                                                                status = responses.text ? 200 : 404;
8778
                                                                        // IE - #1450: sometimes returns 1223 when it should be 204
8779
                                                                        } else if ( status === 1223 ) {
8780
                                                                                status = 204;
8781
                                                                        }
8782
                                                                }
8783
                                                        }
8784
                                                } catch( firefoxAccessException ) {
8785
                                                        if ( !isAbort ) {
8786
                                                                complete( -1, firefoxAccessException );
8787
                                                        }
8788
                                                }
8789
8790
                                                // Call complete if needed
8791
                                                if ( responses ) {
8792
                                                        complete( status, statusText, responses, responseHeaders );
8793
                                                }
8794
                                        };
8795
8796
                                        if ( !s.async ) {
8797
                                                // if we're in sync mode we fire the callback
8798
                                                callback();
8799
                                        } else if ( xhr.readyState === 4 ) {
8800
                                                // (IE6 & IE7) if it's in cache and has been
8801
                                                // retrieved directly we need to fire the callback
8802
                                                setTimeout( callback );
8803
                                        } else {
8804
                                                handle = ++xhrId;
8805
                                                if ( xhrOnUnloadAbort ) {
8806
                                                        // Create the active xhrs callbacks list if needed
8807
                                                        // and attach the unload handler
8808
                                                        if ( !xhrCallbacks ) {
8809
                                                                xhrCallbacks = {};
8810
                                                                jQuery( window ).unload( xhrOnUnloadAbort );
8811
                                                        }
8812
                                                        // Add to list of active xhrs callbacks
8813
                                                        xhrCallbacks[ handle ] = callback;
8814
                                                }
8815
                                                xhr.onreadystatechange = callback;
8816
                                        }
8817
                                },
8818
8819
                                abort: function() {
8820
                                        if ( callback ) {
8821
                                                callback( undefined, true );
8822
                                        }
8823
                                }
8824
                        };
8825
                }
8826
        });
8827
}
8828
var fxNow, timerId,
8829
        rfxtypes = /^(?:toggle|show|hide)$/,
8830
        rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
8831
        rrun = /queueHooks$/,
8832
        animationPrefilters = [ defaultPrefilter ],
8833
        tweeners = {
8834
                "*": [function( prop, value ) {
8835
                        var tween = this.createTween( prop, value ),
8836
                                target = tween.cur(),
8837
                                parts = rfxnum.exec( value ),
8838
                                unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
8839
8840
                                // Starting value computation is required for potential unit mismatches
8841
                                start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
8842
                                        rfxnum.exec( jQuery.css( tween.elem, prop ) ),
8843
                                scale = 1,
8844
                                maxIterations = 20;
8845
8846
                        if ( start && start[ 3 ] !== unit ) {
8847
                                // Trust units reported by jQuery.css
8848
                                unit = unit || start[ 3 ];
8849
8850
                                // Make sure we update the tween properties later on
8851
                                parts = parts || [];
8852
8853
                                // Iteratively approximate from a nonzero starting point
8854
                                start = +target || 1;
8855
8856
                                do {
8857
                                        // If previous iteration zeroed out, double until we get *something*
8858
                                        // Use a string for doubling factor so we don't accidentally see scale as unchanged below
8859
                                        scale = scale || ".5";
8860
8861
                                        // Adjust and apply
8862
                                        start = start / scale;
8863
                                        jQuery.style( tween.elem, prop, start + unit );
8864
8865
                                // Update scale, tolerating zero or NaN from tween.cur()
8866
                                // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
8867
                                } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
8868
                        }
8869
8870
                        // Update tween properties
8871
                        if ( parts ) {
8872
                                start = tween.start = +start || +target || 0;
8873
                                tween.unit = unit;
8874
                                // If a +=/-= token was provided, we're doing a relative animation
8875
                                tween.end = parts[ 1 ] ?
8876
                                        start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
8877
                                        +parts[ 2 ];
8878
                        }
8879
8880
                        return tween;
8881
                }]
8882
        };
8883
8884
// Animations created synchronously will run synchronously
8885
function createFxNow() {
8886
        setTimeout(function() {
8887
                fxNow = undefined;
8888
        });
8889
        return ( fxNow = jQuery.now() );
8890
}
8891
8892
function createTween( value, prop, animation ) {
8893
        var tween,
8894
                collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
8895
                index = 0,
8896
                length = collection.length;
8897
        for ( ; index < length; index++ ) {
8898
                if ( (tween = collection[ index ].call( animation, prop, value )) ) {
8899
8900
                        // we're done with this property
8901
                        return tween;
8902
                }
8903
        }
8904
}
8905
8906
function Animation( elem, properties, options ) {
8907
        var result,
8908
                stopped,
8909
                index = 0,
8910
                length = animationPrefilters.length,
8911
                deferred = jQuery.Deferred().always( function() {
8912
                        // don't match elem in the :animated selector
8913
                        delete tick.elem;
8914
                }),
8915
                tick = function() {
8916
                        if ( stopped ) {
8917
                                return false;
8918
                        }
8919
                        var currentTime = fxNow || createFxNow(),
8920
                                remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8921
                                // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
8922
                                temp = remaining / animation.duration || 0,
8923
                                percent = 1 - temp,
8924
                                index = 0,
8925
                                length = animation.tweens.length;
8926
8927
                        for ( ; index < length ; index++ ) {
8928
                                animation.tweens[ index ].run( percent );
8929
                        }
8930
8931
                        deferred.notifyWith( elem, [ animation, percent, remaining ]);
8932
8933
                        if ( percent < 1 && length ) {
8934
                                return remaining;
8935
                        } else {
8936
                                deferred.resolveWith( elem, [ animation ] );
8937
                                return false;
8938
                        }
8939
                },
8940
                animation = deferred.promise({
8941
                        elem: elem,
8942
                        props: jQuery.extend( {}, properties ),
8943
                        opts: jQuery.extend( true, { specialEasing: {} }, options ),
8944
                        originalProperties: properties,
8945
                        originalOptions: options,
8946
                        startTime: fxNow || createFxNow(),
8947
                        duration: options.duration,
8948
                        tweens: [],
8949
                        createTween: function( prop, end ) {
8950
                                var tween = jQuery.Tween( elem, animation.opts, prop, end,
8951
                                                animation.opts.specialEasing[ prop ] || animation.opts.easing );
8952
                                animation.tweens.push( tween );
8953
                                return tween;
8954
                        },
8955
                        stop: function( gotoEnd ) {
8956
                                var index = 0,
8957
                                        // if we are going to the end, we want to run all the tweens
8958
                                        // otherwise we skip this part
8959
                                        length = gotoEnd ? animation.tweens.length : 0;
8960
                                if ( stopped ) {
8961
                                        return this;
8962
                                }
8963
                                stopped = true;
8964
                                for ( ; index < length ; index++ ) {
8965
                                        animation.tweens[ index ].run( 1 );
8966
                                }
8967
8968
                                // resolve when we played the last frame
8969
                                // otherwise, reject
8970
                                if ( gotoEnd ) {
8971
                                        deferred.resolveWith( elem, [ animation, gotoEnd ] );
8972
                                } else {
8973
                                        deferred.rejectWith( elem, [ animation, gotoEnd ] );
8974
                                }
8975
                                return this;
8976
                        }
8977
                }),
8978
                props = animation.props;
8979
8980
        propFilter( props, animation.opts.specialEasing );
8981
8982
        for ( ; index < length ; index++ ) {
8983
                result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
8984
                if ( result ) {
8985
                        return result;
8986
                }
8987
        }
8988
8989
        jQuery.map( props, createTween, animation );
8990
8991
        if ( jQuery.isFunction( animation.opts.start ) ) {
8992
                animation.opts.start.call( elem, animation );
8993
        }
8994
8995
        jQuery.fx.timer(
8996
                jQuery.extend( tick, {
8997
                        elem: elem,
8998
                        anim: animation,
8999
                        queue: animation.opts.queue
9000
                })
9001
        );
9002
9003
        // attach callbacks from options
9004
        return animation.progress( animation.opts.progress )
9005
                .done( animation.opts.done, animation.opts.complete )
9006
                .fail( animation.opts.fail )
9007
                .always( animation.opts.always );
9008
}
9009
9010
function propFilter( props, specialEasing ) {
9011
        var index, name, easing, value, hooks;
9012
9013
        // camelCase, specialEasing and expand cssHook pass
9014
        for ( index in props ) {
9015
                name = jQuery.camelCase( index );
9016
                easing = specialEasing[ name ];
9017
                value = props[ index ];
9018
                if ( jQuery.isArray( value ) ) {
9019
                        easing = value[ 1 ];
9020
                        value = props[ index ] = value[ 0 ];
9021
                }
9022
9023
                if ( index !== name ) {
9024
                        props[ name ] = value;
9025
                        delete props[ index ];
9026
                }
9027
9028
                hooks = jQuery.cssHooks[ name ];
9029
                if ( hooks && "expand" in hooks ) {
9030
                        value = hooks.expand( value );
9031
                        delete props[ name ];
9032
9033
                        // not quite $.extend, this wont overwrite keys already present.
9034
                        // also - reusing 'index' from above because we have the correct "name"
9035
                        for ( index in value ) {
9036
                                if ( !( index in props ) ) {
9037
                                        props[ index ] = value[ index ];
9038
                                        specialEasing[ index ] = easing;
9039
                                }
9040
                        }
9041
                } else {
9042
                        specialEasing[ name ] = easing;
9043
                }
9044
        }
9045
}
9046
9047
jQuery.Animation = jQuery.extend( Animation, {
9048
9049
        tweener: function( props, callback ) {
9050
                if ( jQuery.isFunction( props ) ) {
9051
                        callback = props;
9052
                        props = [ "*" ];
9053
                } else {
9054
                        props = props.split(" ");
9055
                }
9056
9057
                var prop,
9058
                        index = 0,
9059
                        length = props.length;
9060
9061
                for ( ; index < length ; index++ ) {
9062
                        prop = props[ index ];
9063
                        tweeners[ prop ] = tweeners[ prop ] || [];
9064
                        tweeners[ prop ].unshift( callback );
9065
                }
9066
        },
9067
9068
        prefilter: function( callback, prepend ) {
9069
                if ( prepend ) {
9070
                        animationPrefilters.unshift( callback );
9071
                } else {
9072
                        animationPrefilters.push( callback );
9073
                }
9074
        }
9075
});
9076
9077
function defaultPrefilter( elem, props, opts ) {
9078
        /* jshint validthis: true */
9079
        var prop, value, toggle, tween, hooks, oldfire,
9080
                anim = this,
9081
                orig = {},
9082
                style = elem.style,
9083
                hidden = elem.nodeType && isHidden( elem ),
9084
                dataShow = jQuery._data( elem, "fxshow" );
9085
9086
        // handle queue: false promises
9087
        if ( !opts.queue ) {
9088
                hooks = jQuery._queueHooks( elem, "fx" );
9089
                if ( hooks.unqueued == null ) {
9090
                        hooks.unqueued = 0;
9091
                        oldfire = hooks.empty.fire;
9092
                        hooks.empty.fire = function() {
9093
                                if ( !hooks.unqueued ) {
9094
                                        oldfire();
9095
                                }
9096
                        };
9097
                }
9098
                hooks.unqueued++;
9099
9100
                anim.always(function() {
9101
                        // doing this makes sure that the complete handler will be called
9102
                        // before this completes
9103
                        anim.always(function() {
9104
                                hooks.unqueued--;
9105
                                if ( !jQuery.queue( elem, "fx" ).length ) {
9106
                                        hooks.empty.fire();
9107
                                }
9108
                        });
9109
                });
9110
        }
9111
9112
        // height/width overflow pass
9113
        if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
9114
                // Make sure that nothing sneaks out
9115
                // Record all 3 overflow attributes because IE does not
9116
                // change the overflow attribute when overflowX and
9117
                // overflowY are set to the same value
9118
                opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
9119
9120
                // Set display property to inline-block for height/width
9121
                // animations on inline elements that are having width/height animated
9122
                if ( jQuery.css( elem, "display" ) === "inline" &&
9123
                                jQuery.css( elem, "float" ) === "none" ) {
9124
9125
                        // inline-level elements accept inline-block;
9126
                        // block-level elements need to be inline with layout
9127
                        if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
9128
                                style.display = "inline-block";
9129
9130
                        } else {
9131
                                style.zoom = 1;
9132
                        }
9133
                }
9134
        }
9135
9136
        if ( opts.overflow ) {
9137
                style.overflow = "hidden";
9138
                if ( !jQuery.support.shrinkWrapBlocks ) {
9139
                        anim.always(function() {
9140
                                style.overflow = opts.overflow[ 0 ];
9141
                                style.overflowX = opts.overflow[ 1 ];
9142
                                style.overflowY = opts.overflow[ 2 ];
9143
                        });
9144
                }
9145
        }
9146
9147
9148
        // show/hide pass
9149
        for ( prop in props ) {
9150
                value = props[ prop ];
9151
                if ( rfxtypes.exec( value ) ) {
9152
                        delete props[ prop ];
9153
                        toggle = toggle || value === "toggle";
9154
                        if ( value === ( hidden ? "hide" : "show" ) ) {
9155
                                continue;
9156
                        }
9157
                        orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
9158
                }
9159
        }
9160
9161
        if ( !jQuery.isEmptyObject( orig ) ) {
9162
                if ( dataShow ) {
9163
                        if ( "hidden" in dataShow ) {
9164
                                hidden = dataShow.hidden;
9165
                        }
9166
                } else {
9167
                        dataShow = jQuery._data( elem, "fxshow", {} );
9168
                }
9169
9170
                // store state if its toggle - enables .stop().toggle() to "reverse"
9171
                if ( toggle ) {
9172
                        dataShow.hidden = !hidden;
9173
                }
9174
                if ( hidden ) {
9175
                        jQuery( elem ).show();
9176
                } else {
9177
                        anim.done(function() {
9178
                                jQuery( elem ).hide();
9179
                        });
9180
                }
9181
                anim.done(function() {
9182
                        var prop;
9183
                        jQuery._removeData( elem, "fxshow" );
9184
                        for ( prop in orig ) {
9185
                                jQuery.style( elem, prop, orig[ prop ] );
9186
                        }
9187
                });
9188
                for ( prop in orig ) {
9189
                        tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
9190
9191
                        if ( !( prop in dataShow ) ) {
9192
                                dataShow[ prop ] = tween.start;
9193
                                if ( hidden ) {
9194
                                        tween.end = tween.start;
9195
                                        tween.start = prop === "width" || prop === "height" ? 1 : 0;
9196
                                }
9197
                        }
9198
                }
9199
        }
9200
}
9201
9202
function Tween( elem, options, prop, end, easing ) {
9203
        return new Tween.prototype.init( elem, options, prop, end, easing );
9204
}
9205
jQuery.Tween = Tween;
9206
9207
Tween.prototype = {
9208
        constructor: Tween,
9209
        init: function( elem, options, prop, end, easing, unit ) {
9210
                this.elem = elem;
9211
                this.prop = prop;
9212
                this.easing = easing || "swing";
9213
                this.options = options;
9214
                this.start = this.now = this.cur();
9215
                this.end = end;
9216
                this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
9217
        },
9218
        cur: function() {
9219
                var hooks = Tween.propHooks[ this.prop ];
9220
9221
                return hooks && hooks.get ?
9222
                        hooks.get( this ) :
9223
                        Tween.propHooks._default.get( this );
9224
        },
9225
        run: function( percent ) {
9226
                var eased,
9227
                        hooks = Tween.propHooks[ this.prop ];
9228
9229
                if ( this.options.duration ) {
9230
                        this.pos = eased = jQuery.easing[ this.easing ](
9231
                                percent, this.options.duration * percent, 0, 1, this.options.duration
9232
                        );
9233
                } else {
9234
                        this.pos = eased = percent;
9235
                }
9236
                this.now = ( this.end - this.start ) * eased + this.start;
9237
9238
                if ( this.options.step ) {
9239
                        this.options.step.call( this.elem, this.now, this );
9240
                }
9241
9242
                if ( hooks && hooks.set ) {
9243
                        hooks.set( this );
9244
                } else {
9245
                        Tween.propHooks._default.set( this );
9246
                }
9247
                return this;
9248
        }
9249
};
9250
9251
Tween.prototype.init.prototype = Tween.prototype;
9252
9253
Tween.propHooks = {
9254
        _default: {
9255
                get: function( tween ) {
9256
                        var result;
9257
9258
                        if ( tween.elem[ tween.prop ] != null &&
9259
                                (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
9260
                                return tween.elem[ tween.prop ];
9261
                        }
9262
9263
                        // passing an empty string as a 3rd parameter to .css will automatically
9264
                        // attempt a parseFloat and fallback to a string if the parse fails
9265
                        // so, simple values such as "10px" are parsed to Float.
9266
                        // complex values such as "rotate(1rad)" are returned as is.
9267
                        result = jQuery.css( tween.elem, tween.prop, "" );
9268
                        // Empty strings, null, undefined and "auto" are converted to 0.
9269
                        return !result || result === "auto" ? 0 : result;
9270
                },
9271
                set: function( tween ) {
9272
                        // use step hook for back compat - use cssHook if its there - use .style if its
9273
                        // available and use plain properties where available
9274
                        if ( jQuery.fx.step[ tween.prop ] ) {
9275
                                jQuery.fx.step[ tween.prop ]( tween );
9276
                        } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
9277
                                jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
9278
                        } else {
9279
                                tween.elem[ tween.prop ] = tween.now;
9280
                        }
9281
                }
9282
        }
9283
};
9284
9285
// Support: IE <=9
9286
// Panic based approach to setting things on disconnected nodes
9287
9288
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
9289
        set: function( tween ) {
9290
                if ( tween.elem.nodeType && tween.elem.parentNode ) {
9291
                        tween.elem[ tween.prop ] = tween.now;
9292
                }
9293
        }
9294
};
9295
9296
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
9297
        var cssFn = jQuery.fn[ name ];
9298
        jQuery.fn[ name ] = function( speed, easing, callback ) {
9299
                return speed == null || typeof speed === "boolean" ?
9300
                        cssFn.apply( this, arguments ) :
9301
                        this.animate( genFx( name, true ), speed, easing, callback );
9302
        };
9303
});
9304
9305
jQuery.fn.extend({
9306
        fadeTo: function( speed, to, easing, callback ) {
9307
9308
                // show any hidden elements after setting opacity to 0
9309
                return this.filter( isHidden ).css( "opacity", 0 ).show()
9310
9311
                        // animate to the value specified
9312
                        .end().animate({ opacity: to }, speed, easing, callback );
9313
        },
9314
        animate: function( prop, speed, easing, callback ) {
9315
                var empty = jQuery.isEmptyObject( prop ),
9316
                        optall = jQuery.speed( speed, easing, callback ),
9317
                        doAnimation = function() {
9318
                                // Operate on a copy of prop so per-property easing won't be lost
9319
                                var anim = Animation( this, jQuery.extend( {}, prop ), optall );
9320
9321
                                // Empty animations, or finishing resolves immediately
9322
                                if ( empty || jQuery._data( this, "finish" ) ) {
9323
                                        anim.stop( true );
9324
                                }
9325
                        };
9326
                        doAnimation.finish = doAnimation;
9327
9328
                return empty || optall.queue === false ?
9329
                        this.each( doAnimation ) :
9330
                        this.queue( optall.queue, doAnimation );
9331
        },
9332
        stop: function( type, clearQueue, gotoEnd ) {
9333
                var stopQueue = function( hooks ) {
9334
                        var stop = hooks.stop;
9335
                        delete hooks.stop;
9336
                        stop( gotoEnd );
9337
                };
9338
9339
                if ( typeof type !== "string" ) {
9340
                        gotoEnd = clearQueue;
9341
                        clearQueue = type;
9342
                        type = undefined;
9343
                }
9344
                if ( clearQueue && type !== false ) {
9345
                        this.queue( type || "fx", [] );
9346
                }
9347
9348
                return this.each(function() {
9349
                        var dequeue = true,
9350
                                index = type != null && type + "queueHooks",
9351
                                timers = jQuery.timers,
9352
                                data = jQuery._data( this );
9353
9354
                        if ( index ) {
9355
                                if ( data[ index ] && data[ index ].stop ) {
9356
                                        stopQueue( data[ index ] );
9357
                                }
9358
                        } else {
9359
                                for ( index in data ) {
9360
                                        if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
9361
                                                stopQueue( data[ index ] );
9362
                                        }
9363
                                }
9364
                        }
9365
9366
                        for ( index = timers.length; index--; ) {
9367
                                if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
9368
                                        timers[ index ].anim.stop( gotoEnd );
9369
                                        dequeue = false;
9370
                                        timers.splice( index, 1 );
9371
                                }
9372
                        }
9373
9374
                        // start the next in the queue if the last step wasn't forced
9375
                        // timers currently will call their complete callbacks, which will dequeue
9376
                        // but only if they were gotoEnd
9377
                        if ( dequeue || !gotoEnd ) {
9378
                                jQuery.dequeue( this, type );
9379
                        }
9380
                });
9381
        },
9382
        finish: function( type ) {
9383
                if ( type !== false ) {
9384
                        type = type || "fx";
9385
                }
9386
                return this.each(function() {
9387
                        var index,
9388
                                data = jQuery._data( this ),
9389
                                queue = data[ type + "queue" ],
9390
                                hooks = data[ type + "queueHooks" ],
9391
                                timers = jQuery.timers,
9392
                                length = queue ? queue.length : 0;
9393
9394
                        // enable finishing flag on private data
9395
                        data.finish = true;
9396
9397
                        // empty the queue first
9398
                        jQuery.queue( this, type, [] );
9399
9400
                        if ( hooks && hooks.stop ) {
9401
                                hooks.stop.call( this, true );
9402
                        }
9403
9404
                        // look for any active animations, and finish them
9405
                        for ( index = timers.length; index--; ) {
9406
                                if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9407
                                        timers[ index ].anim.stop( true );
9408
                                        timers.splice( index, 1 );
9409
                                }
9410
                        }
9411
9412
                        // look for any animations in the old queue and finish them
9413
                        for ( index = 0; index < length; index++ ) {
9414
                                if ( queue[ index ] && queue[ index ].finish ) {
9415
                                        queue[ index ].finish.call( this );
9416
                                }
9417
                        }
9418
9419
                        // turn off finishing flag
9420
                        delete data.finish;
9421
                });
9422
        }
9423
});
9424
9425
// Generate parameters to create a standard animation
9426
function genFx( type, includeWidth ) {
9427
        var which,
9428
                attrs = { height: type },
9429
                i = 0;
9430
9431
        // if we include width, step value is 1 to do all cssExpand values,
9432
        // if we don't include width, step value is 2 to skip over Left and Right
9433
        includeWidth = includeWidth? 1 : 0;
9434
        for( ; i < 4 ; i += 2 - includeWidth ) {
9435
                which = cssExpand[ i ];
9436
                attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
9437
        }
9438
9439
        if ( includeWidth ) {
9440
                attrs.opacity = attrs.width = type;
9441
        }
9442
9443
        return attrs;
9444
}
9445
9446
// Generate shortcuts for custom animations
9447
jQuery.each({
9448
        slideDown: genFx("show"),
9449
        slideUp: genFx("hide"),
9450
        slideToggle: genFx("toggle"),
9451
        fadeIn: { opacity: "show" },
9452
        fadeOut: { opacity: "hide" },
9453
        fadeToggle: { opacity: "toggle" }
9454
}, function( name, props ) {
9455
        jQuery.fn[ name ] = function( speed, easing, callback ) {
9456
                return this.animate( props, speed, easing, callback );
9457
        };
9458
});
9459
9460
jQuery.speed = function( speed, easing, fn ) {
9461
        var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
9462
                complete: fn || !fn && easing ||
9463
                        jQuery.isFunction( speed ) && speed,
9464
                duration: speed,
9465
                easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
9466
        };
9467
9468
        opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
9469
                opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
9470
9471
        // normalize opt.queue - true/undefined/null -> "fx"
9472
        if ( opt.queue == null || opt.queue === true ) {
9473
                opt.queue = "fx";
9474
        }
9475
9476
        // Queueing
9477
        opt.old = opt.complete;
9478
9479
        opt.complete = function() {
9480
                if ( jQuery.isFunction( opt.old ) ) {
9481
                        opt.old.call( this );
9482
                }
9483
9484
                if ( opt.queue ) {
9485
                        jQuery.dequeue( this, opt.queue );
9486
                }
9487
        };
9488
9489
        return opt;
9490
};
9491
9492
jQuery.easing = {
9493
        linear: function( p ) {
9494
                return p;
9495
        },
9496
        swing: function( p ) {
9497
                return 0.5 - Math.cos( p*Math.PI ) / 2;
9498
        }
9499
};
9500
9501
jQuery.timers = [];
9502
jQuery.fx = Tween.prototype.init;
9503
jQuery.fx.tick = function() {
9504
        var timer,
9505
                timers = jQuery.timers,
9506
                i = 0;
9507
9508
        fxNow = jQuery.now();
9509
9510
        for ( ; i < timers.length; i++ ) {
9511
                timer = timers[ i ];
9512
                // Checks the timer has not already been removed
9513
                if ( !timer() && timers[ i ] === timer ) {
9514
                        timers.splice( i--, 1 );
9515
                }
9516
        }
9517
9518
        if ( !timers.length ) {
9519
                jQuery.fx.stop();
9520
        }
9521
        fxNow = undefined;
9522
};
9523
9524
jQuery.fx.timer = function( timer ) {
9525
        if ( timer() && jQuery.timers.push( timer ) ) {
9526
                jQuery.fx.start();
9527
        }
9528
};
9529
9530
jQuery.fx.interval = 13;
9531
9532
jQuery.fx.start = function() {
9533
        if ( !timerId ) {
9534
                timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
9535
        }
9536
};
9537
9538
jQuery.fx.stop = function() {
9539
        clearInterval( timerId );
9540
        timerId = null;
9541
};
9542
9543
jQuery.fx.speeds = {
9544
        slow: 600,
9545
        fast: 200,
9546
        // Default speed
9547
        _default: 400
9548
};
9549
9550
// Back Compat <1.8 extension point
9551
jQuery.fx.step = {};
9552
9553
if ( jQuery.expr && jQuery.expr.filters ) {
9554
        jQuery.expr.filters.animated = function( elem ) {
9555
                return jQuery.grep(jQuery.timers, function( fn ) {
9556
                        return elem === fn.elem;
9557
                }).length;
9558
        };
9559
}
9560
jQuery.fn.offset = function( options ) {
9561
        if ( arguments.length ) {
9562
                return options === undefined ?
9563
                        this :
9564
                        this.each(function( i ) {
9565
                                jQuery.offset.setOffset( this, options, i );
9566
                        });
9567
        }
9568
9569
        var docElem, win,
9570
                box = { top: 0, left: 0 },
9571
                elem = this[ 0 ],
9572
                doc = elem && elem.ownerDocument;
9573
9574
        if ( !doc ) {
9575
                return;
9576
        }
9577
9578
        docElem = doc.documentElement;
9579
9580
        // Make sure it's not a disconnected DOM node
9581
        if ( !jQuery.contains( docElem, elem ) ) {
9582
                return box;
9583
        }
9584
9585
        // If we don't have gBCR, just use 0,0 rather than error
9586
        // BlackBerry 5, iOS 3 (original iPhone)
9587
        if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
9588
                box = elem.getBoundingClientRect();
9589
        }
9590
        win = getWindow( doc );
9591
        return {
9592
                top: box.top  + ( win.pageYOffset || docElem.scrollTop )  - ( docElem.clientTop  || 0 ),
9593
                left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
9594
        };
9595
};
9596
9597
jQuery.offset = {
9598
9599
        setOffset: function( elem, options, i ) {
9600
                var position = jQuery.css( elem, "position" );
9601
9602
                // set position first, in-case top/left are set even on static elem
9603
                if ( position === "static" ) {
9604
                        elem.style.position = "relative";
9605
                }
9606
9607
                var curElem = jQuery( elem ),
9608
                        curOffset = curElem.offset(),
9609
                        curCSSTop = jQuery.css( elem, "top" ),
9610
                        curCSSLeft = jQuery.css( elem, "left" ),
9611
                        calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
9612
                        props = {}, curPosition = {}, curTop, curLeft;
9613
9614
                // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
9615
                if ( calculatePosition ) {
9616
                        curPosition = curElem.position();
9617
                        curTop = curPosition.top;
9618
                        curLeft = curPosition.left;
9619
                } else {
9620
                        curTop = parseFloat( curCSSTop ) || 0;
9621
                        curLeft = parseFloat( curCSSLeft ) || 0;
9622
                }
9623
9624
                if ( jQuery.isFunction( options ) ) {
9625
                        options = options.call( elem, i, curOffset );
9626
                }
9627
9628
                if ( options.top != null ) {
9629
                        props.top = ( options.top - curOffset.top ) + curTop;
9630
                }
9631
                if ( options.left != null ) {
9632
                        props.left = ( options.left - curOffset.left ) + curLeft;
9633
                }
9634
9635
                if ( "using" in options ) {
9636
                        options.using.call( elem, props );
9637
                } else {
9638
                        curElem.css( props );
9639
                }
9640
        }
9641
};
9642
9643
9644
jQuery.fn.extend({
9645
9646
        position: function() {
9647
                if ( !this[ 0 ] ) {
9648
                        return;
9649
                }
9650
9651
                var offsetParent, offset,
9652
                        parentOffset = { top: 0, left: 0 },
9653
                        elem = this[ 0 ];
9654
9655
                // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
9656
                if ( jQuery.css( elem, "position" ) === "fixed" ) {
9657
                        // we assume that getBoundingClientRect is available when computed position is fixed
9658
                        offset = elem.getBoundingClientRect();
9659
                } else {
9660
                        // Get *real* offsetParent
9661
                        offsetParent = this.offsetParent();
9662
9663
                        // Get correct offsets
9664
                        offset = this.offset();
9665
                        if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
9666
                                parentOffset = offsetParent.offset();
9667
                        }
9668
9669
                        // Add offsetParent borders
9670
                        parentOffset.top  += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
9671
                        parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
9672
                }
9673
9674
                // Subtract parent offsets and element margins
9675
                // note: when an element has margin: auto the offsetLeft and marginLeft
9676
                // are the same in Safari causing offset.left to incorrectly be 0
9677
                return {
9678
                        top:  offset.top  - parentOffset.top - jQuery.css( elem, "marginTop", true ),
9679
                        left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
9680
                };
9681
        },
9682
9683
        offsetParent: function() {
9684
                return this.map(function() {
9685
                        var offsetParent = this.offsetParent || docElem;
9686
                        while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
9687
                                offsetParent = offsetParent.offsetParent;
9688
                        }
9689
                        return offsetParent || docElem;
9690
                });
9691
        }
9692
});
9693
9694
9695
// Create scrollLeft and scrollTop methods
9696
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
9697
        var top = /Y/.test( prop );
9698
9699
        jQuery.fn[ method ] = function( val ) {
9700
                return jQuery.access( this, function( elem, method, val ) {
9701
                        var win = getWindow( elem );
9702
9703
                        if ( val === undefined ) {
9704
                                return win ? (prop in win) ? win[ prop ] :
9705
                                        win.document.documentElement[ method ] :
9706
                                        elem[ method ];
9707
                        }
9708
9709
                        if ( win ) {
9710
                                win.scrollTo(
9711
                                        !top ? val : jQuery( win ).scrollLeft(),
9712
                                        top ? val : jQuery( win ).scrollTop()
9713
                                );
9714
9715
                        } else {
9716
                                elem[ method ] = val;
9717
                        }
9718
                }, method, val, arguments.length, null );
9719
        };
9720
});
9721
9722
function getWindow( elem ) {
9723
        return jQuery.isWindow( elem ) ?
9724
                elem :
9725
                elem.nodeType === 9 ?
9726
                        elem.defaultView || elem.parentWindow :
9727
                        false;
9728
}
9729
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9730
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9731
        jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
9732
                // margin is only for outerHeight, outerWidth
9733
                jQuery.fn[ funcName ] = function( margin, value ) {
9734
                        var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9735
                                extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9736
9737
                        return jQuery.access( this, function( elem, type, value ) {
9738
                                var doc;
9739
9740
                                if ( jQuery.isWindow( elem ) ) {
9741
                                        // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9742
                                        // isn't a whole lot we can do. See pull request at this URL for discussion:
9743
                                        // https://github.com/jquery/jquery/pull/764
9744
                                        return elem.document.documentElement[ "client" + name ];
9745
                                }
9746
9747
                                // Get document width or height
9748
                                if ( elem.nodeType === 9 ) {
9749
                                        doc = elem.documentElement;
9750
9751
                                        // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
9752
                                        // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
9753
                                        return Math.max(
9754
                                                elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9755
                                                elem.body[ "offset" + name ], doc[ "offset" + name ],
9756
                                                doc[ "client" + name ]
9757
                                        );
9758
                                }
9759
9760
                                return value === undefined ?
9761
                                        // Get width or height on the element, requesting but not forcing parseFloat
9762
                                        jQuery.css( elem, type, extra ) :
9763
9764
                                        // Set width or height on the element
9765
                                        jQuery.style( elem, type, value, extra );
9766
                        }, type, chainable ? margin : undefined, chainable, null );
9767
                };
9768
        });
9769
});
9770
// Limit scope pollution from any deprecated API
9771
// (function() {
9772
9773
// The number of elements contained in the matched element set
9774
jQuery.fn.size = function() {
9775
        return this.length;
9776
};
9777
9778
jQuery.fn.andSelf = jQuery.fn.addBack;
9779
9780
// })();
9781
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
9782
        // Expose jQuery as module.exports in loaders that implement the Node
9783
        // module pattern (including browserify). Do not create the global, since
9784
        // the user will be storing it themselves locally, and globals are frowned
9785
        // upon in the Node module world.
9786
        module.exports = jQuery;
9787
} else {
9788
        // Otherwise expose jQuery to the global object as usual
9789
        window.jQuery = window.$ = jQuery;
9790
9791
        // Register as a named AMD module, since jQuery can be concatenated with other
9792
        // files that may use define, but not via a proper concatenation script that
9793
        // understands anonymous AMD modules. A named AMD is safest and most robust
9794
        // way to register. Lowercase jquery is used because AMD module names are
9795
        // derived from file names, and jQuery is normally delivered in a lowercase
9796
        // file name. Do this after creating the global so that if an AMD module wants
9797
        // to call noConflict to hide this version of jQuery, it will work.
9798
        if ( typeof define === "function" && define.amd ) {
9799
                define( "jquery", [], function () { return jQuery; } );
9800
        }
9801
}
9802
9803
})( window );
클립보드 이미지 추가 (최대 크기: 500 MB)