How to use K method in mountebank

Best JavaScript code snippet using mountebank

jquery-1.10.2.js

Source:jquery-1.10.2.js Github

copy

Full Screen

1/*!2 * jQuery JavaScript Library v1.10.23 * http://jquery.com/4 *5 * Includes Sizzle.js6 * http://sizzlejs.com/7 *8 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors9 * Released under the MIT license10 * http://jquery.org/license11 *12 * Date: 2013-07-03T13:48Z13 */14(function( window, undefined ) {15// Can't do this because several apps including ASP.NET trace16// the stack via arguments.caller.callee and Firefox dies if17// you try to trace through "use strict" call chains. (#13335)18// Support: Firefox 18+19//"use strict";20var21 // The deferred used on DOM ready22 readyList,23 // A central reference to the root jQuery(document)24 rootjQuery,25 // Support: IE<1026 // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`27 core_strundefined = typeof undefined,28 // Use the correct document accordingly with window argument (sandbox)29 location = window.location,30 document = window.document,31 docElem = document.documentElement,32 // Map over jQuery in case of overwrite33 _jQuery = window.jQuery,34 // Map over the $ in case of overwrite35 _$ = window.$,36 // [[Class]] -> type pairs37 class2type = {},38 // List of deleted data cache ids, so we can reuse them39 core_deletedIds = [],40 core_version = "1.10.2",41 // Save a reference to some core methods42 core_concat = core_deletedIds.concat,43 core_push = core_deletedIds.push,44 core_slice = core_deletedIds.slice,45 core_indexOf = core_deletedIds.indexOf,46 core_toString = class2type.toString,47 core_hasOwn = class2type.hasOwnProperty,48 core_trim = core_version.trim,49 // Define a local copy of jQuery50 jQuery = function( selector, context ) {51 // The jQuery object is actually just the init constructor 'enhanced'52 return new jQuery.fn.init( selector, context, rootjQuery );53 },54 // Used for matching numbers55 core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,56 // Used for splitting on whitespace57 core_rnotwhite = /\S+/g,58 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)59 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,60 // A simple way to check for HTML strings61 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)62 // Strict HTML recognition (#11290: must start with <)63 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,64 // Match a standalone tag65 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,66 // JSON RegExp67 rvalidchars = /^[\],:{}\s]*$/,68 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,69 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,70 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,71 // Matches dashed string for camelizing72 rmsPrefix = /^-ms-/,73 rdashAlpha = /-([\da-z])/gi,74 // Used by jQuery.camelCase as callback to replace()75 fcamelCase = function( all, letter ) {76 return letter.toUpperCase();77 },78 // The ready event handler79 completed = function( event ) {80 // readyState === "complete" is good enough for us to call the dom ready in oldIE81 if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {82 detach();83 jQuery.ready();84 }85 },86 // Clean-up method for dom ready events87 detach = function() {88 if ( document.addEventListener ) {89 document.removeEventListener( "DOMContentLoaded", completed, false );90 window.removeEventListener( "load", completed, false );91 } else {92 document.detachEvent( "onreadystatechange", completed );93 window.detachEvent( "onload", completed );94 }95 };96jQuery.fn = jQuery.prototype = {97 // The current version of jQuery being used98 jquery: core_version,99 constructor: jQuery,100 init: function( selector, context, rootjQuery ) {101 var match, elem;102 // HANDLE: $(""), $(null), $(undefined), $(false)103 if ( !selector ) {104 return this;105 }106 // Handle HTML strings107 if ( typeof selector === "string" ) {108 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {109 // Assume that strings that start and end with <> are HTML and skip the regex check110 match = [ null, selector, null ];111 } else {112 match = rquickExpr.exec( selector );113 }114 // Match html or make sure no context is specified for #id115 if ( match && (match[1] || !context) ) {116 // HANDLE: $(html) -> $(array)117 if ( match[1] ) {118 context = context instanceof jQuery ? context[0] : context;119 // scripts is true for back-compat120 jQuery.merge( this, jQuery.parseHTML(121 match[1],122 context && context.nodeType ? context.ownerDocument || context : document,123 true124 ) );125 // HANDLE: $(html, props)126 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {127 for ( match in context ) {128 // Properties of context are called as methods if possible129 if ( jQuery.isFunction( this[ match ] ) ) {130 this[ match ]( context[ match ] );131 // ...and otherwise set as attributes132 } else {133 this.attr( match, context[ match ] );134 }135 }136 }137 return this;138 // HANDLE: $(#id)139 } else {140 elem = document.getElementById( match[2] );141 // Check parentNode to catch when Blackberry 4.6 returns142 // nodes that are no longer in the document #6963143 if ( elem && elem.parentNode ) {144 // Handle the case where IE and Opera return items145 // by name instead of ID146 if ( elem.id !== match[2] ) {147 return rootjQuery.find( selector );148 }149 // Otherwise, we inject the element directly into the jQuery object150 this.length = 1;151 this[0] = elem;152 }153 this.context = document;154 this.selector = selector;155 return this;156 }157 // HANDLE: $(expr, $(...))158 } else if ( !context || context.jquery ) {159 return ( context || rootjQuery ).find( selector );160 // HANDLE: $(expr, context)161 // (which is just equivalent to: $(context).find(expr)162 } else {163 return this.constructor( context ).find( selector );164 }165 // HANDLE: $(DOMElement)166 } else if ( selector.nodeType ) {167 this.context = this[0] = selector;168 this.length = 1;169 return this;170 // HANDLE: $(function)171 // Shortcut for document ready172 } else if ( jQuery.isFunction( selector ) ) {173 return rootjQuery.ready( selector );174 }175 if ( selector.selector !== undefined ) {176 this.selector = selector.selector;177 this.context = selector.context;178 }179 return jQuery.makeArray( selector, this );180 },181 // Start with an empty selector182 selector: "",183 // The default length of a jQuery object is 0184 length: 0,185 toArray: function() {186 return core_slice.call( this );187 },188 // Get the Nth element in the matched element set OR189 // Get the whole matched element set as a clean array190 get: function( num ) {191 return num == null ?192 // Return a 'clean' array193 this.toArray() :194 // Return just the object195 ( num < 0 ? this[ this.length + num ] : this[ num ] );196 },197 // Take an array of elements and push it onto the stack198 // (returning the new matched element set)199 pushStack: function( elems ) {200 // Build a new jQuery matched element set201 var ret = jQuery.merge( this.constructor(), elems );202 // Add the old object onto the stack (as a reference)203 ret.prevObject = this;204 ret.context = this.context;205 // Return the newly-formed element set206 return ret;207 },208 // Execute a callback for every element in the matched set.209 // (You can seed the arguments with an array of args, but this is210 // only used internally.)211 each: function( callback, args ) {212 return jQuery.each( this, callback, args );213 },214 ready: function( fn ) {215 // Add the callback216 jQuery.ready.promise().done( fn );217 return this;218 },219 slice: function() {220 return this.pushStack( core_slice.apply( this, arguments ) );221 },222 first: function() {223 return this.eq( 0 );224 },225 last: function() {226 return this.eq( -1 );227 },228 eq: function( i ) {229 var len = this.length,230 j = +i + ( i < 0 ? len : 0 );231 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );232 },233 map: function( callback ) {234 return this.pushStack( jQuery.map(this, function( elem, i ) {235 return callback.call( elem, i, elem );236 }));237 },238 end: function() {239 return this.prevObject || this.constructor(null);240 },241 // For internal use only.242 // Behaves like an Array's method, not like a jQuery method.243 push: core_push,244 sort: [].sort,245 splice: [].splice246};247// Give the init function the jQuery prototype for later instantiation248jQuery.fn.init.prototype = jQuery.fn;249jQuery.extend = jQuery.fn.extend = function() {250 var src, copyIsArray, copy, name, options, clone,251 target = arguments[0] || {},252 i = 1,253 length = arguments.length,254 deep = false;255 // Handle a deep copy situation256 if ( typeof target === "boolean" ) {257 deep = target;258 target = arguments[1] || {};259 // skip the boolean and the target260 i = 2;261 }262 // Handle case when target is a string or something (possible in deep copy)263 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {264 target = {};265 }266 // extend jQuery itself if only one argument is passed267 if ( length === i ) {268 target = this;269 --i;270 }271 for ( ; i < length; i++ ) {272 // Only deal with non-null/undefined values273 if ( (options = arguments[ i ]) != null ) {274 // Extend the base object275 for ( name in options ) {276 src = target[ name ];277 copy = options[ name ];278 // Prevent never-ending loop279 if ( target === copy ) {280 continue;281 }282 // Recurse if we're merging plain objects or arrays283 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {284 if ( copyIsArray ) {285 copyIsArray = false;286 clone = src && jQuery.isArray(src) ? src : [];287 } else {288 clone = src && jQuery.isPlainObject(src) ? src : {};289 }290 // Never move original objects, clone them291 target[ name ] = jQuery.extend( deep, clone, copy );292 // Don't bring in undefined values293 } else if ( copy !== undefined ) {294 target[ name ] = copy;295 }296 }297 }298 }299 // Return the modified object300 return target;301};302jQuery.extend({303 // Unique for each copy of jQuery on the page304 // Non-digits removed to match rinlinejQuery305 expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),306 noConflict: function( deep ) {307 if ( window.$ === jQuery ) {308 window.$ = _$;309 }310 if ( deep && window.jQuery === jQuery ) {311 window.jQuery = _jQuery;312 }313 return jQuery;314 },315 // Is the DOM ready to be used? Set to true once it occurs.316 isReady: false,317 // A counter to track how many items to wait for before318 // the ready event fires. See #6781319 readyWait: 1,320 // Hold (or release) the ready event321 holdReady: function( hold ) {322 if ( hold ) {323 jQuery.readyWait++;324 } else {325 jQuery.ready( true );326 }327 },328 // Handle when the DOM is ready329 ready: function( wait ) {330 // Abort if there are pending holds or we're already ready331 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {332 return;333 }334 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).335 if ( !document.body ) {336 return setTimeout( jQuery.ready );337 }338 // Remember that the DOM is ready339 jQuery.isReady = true;340 // If a normal DOM Ready event fired, decrement, and wait if need be341 if ( wait !== true && --jQuery.readyWait > 0 ) {342 return;343 }344 // If there are functions bound, to execute345 readyList.resolveWith( document, [ jQuery ] );346 // Trigger any bound ready events347 if ( jQuery.fn.trigger ) {348 jQuery( document ).trigger("ready").off("ready");349 }350 },351 // See test/unit/core.js for details concerning isFunction.352 // Since version 1.3, DOM methods and functions like alert353 // aren't supported. They return false on IE (#2968).354 isFunction: function( obj ) {355 return jQuery.type(obj) === "function";356 },357 isArray: Array.isArray || function( obj ) {358 return jQuery.type(obj) === "array";359 },360 isWindow: function( obj ) {361 /* jshint eqeqeq: false */362 return obj != null && obj == obj.window;363 },364 isNumeric: function( obj ) {365 return !isNaN( parseFloat(obj) ) && isFinite( obj );366 },367 type: function( obj ) {368 if ( obj == null ) {369 return String( obj );370 }371 return typeof obj === "object" || typeof obj === "function" ?372 class2type[ core_toString.call(obj) ] || "object" :373 typeof obj;374 },375 isPlainObject: function( obj ) {376 var key;377 // Must be an Object.378 // Because of IE, we also have to check the presence of the constructor property.379 // Make sure that DOM nodes and window objects don't pass through, as well380 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {381 return false;382 }383 try {384 // Not own constructor property must be Object385 if ( obj.constructor &&386 !core_hasOwn.call(obj, "constructor") &&387 !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {388 return false;389 }390 } catch ( e ) {391 // IE8,9 Will throw exceptions on certain host objects #9897392 return false;393 }394 // Support: IE<9395 // Handle iteration over inherited properties before own properties.396 if ( jQuery.support.ownLast ) {397 for ( key in obj ) {398 return core_hasOwn.call( obj, key );399 }400 }401 // Own properties are enumerated firstly, so to speed up,402 // if last one is own, then all properties are own.403 for ( key in obj ) {}404 return key === undefined || core_hasOwn.call( obj, key );405 },406 isEmptyObject: function( obj ) {407 var name;408 for ( name in obj ) {409 return false;410 }411 return true;412 },413 error: function( msg ) {414 throw new Error( msg );415 },416 // data: string of html417 // context (optional): If specified, the fragment will be created in this context, defaults to document418 // keepScripts (optional): If true, will include scripts passed in the html string419 parseHTML: function( data, context, keepScripts ) {420 if ( !data || typeof data !== "string" ) {421 return null;422 }423 if ( typeof context === "boolean" ) {424 keepScripts = context;425 context = false;426 }427 context = context || document;428 var parsed = rsingleTag.exec( data ),429 scripts = !keepScripts && [];430 // Single tag431 if ( parsed ) {432 return [ context.createElement( parsed[1] ) ];433 }434 parsed = jQuery.buildFragment( [ data ], context, scripts );435 if ( scripts ) {436 jQuery( scripts ).remove();437 }438 return jQuery.merge( [], parsed.childNodes );439 },440 parseJSON: function( data ) {441 // Attempt to parse using the native JSON parser first442 if ( window.JSON && window.JSON.parse ) {443 return window.JSON.parse( data );444 }445 if ( data === null ) {446 return data;447 }448 if ( typeof data === "string" ) {449 // Make sure leading/trailing whitespace is removed (IE can't handle it)450 data = jQuery.trim( data );451 if ( data ) {452 // Make sure the incoming data is actual JSON453 // Logic borrowed from http://json.org/json2.js454 if ( rvalidchars.test( data.replace( rvalidescape, "@" )455 .replace( rvalidtokens, "]" )456 .replace( rvalidbraces, "")) ) {457 return ( new Function( "return " + data ) )();458 }459 }460 }461 jQuery.error( "Invalid JSON: " + data );462 },463 // Cross-browser xml parsing464 parseXML: function( data ) {465 var xml, tmp;466 if ( !data || typeof data !== "string" ) {467 return null;468 }469 try {470 if ( window.DOMParser ) { // Standard471 tmp = new DOMParser();472 xml = tmp.parseFromString( data , "text/xml" );473 } else { // IE474 xml = new ActiveXObject( "Microsoft.XMLDOM" );475 xml.async = "false";476 xml.loadXML( data );477 }478 } catch( e ) {479 xml = undefined;480 }481 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {482 jQuery.error( "Invalid XML: " + data );483 }484 return xml;485 },486 noop: function() {},487 // Evaluates a script in a global context488 // Workarounds based on findings by Jim Driscoll489 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context490 globalEval: function( data ) {491 if ( data && jQuery.trim( data ) ) {492 // We use execScript on Internet Explorer493 // We use an anonymous function so that context is window494 // rather than jQuery in Firefox495 ( window.execScript || function( data ) {496 window[ "eval" ].call( window, data );497 } )( data );498 }499 },500 // Convert dashed to camelCase; used by the css and data modules501 // Microsoft forgot to hump their vendor prefix (#9572)502 camelCase: function( string ) {503 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );504 },505 nodeName: function( elem, name ) {506 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();507 },508 // args is for internal usage only509 each: function( obj, callback, args ) {510 var value,511 i = 0,512 length = obj.length,513 isArray = isArraylike( obj );514 if ( args ) {515 if ( isArray ) {516 for ( ; i < length; i++ ) {517 value = callback.apply( obj[ i ], args );518 if ( value === false ) {519 break;520 }521 }522 } else {523 for ( i in obj ) {524 value = callback.apply( obj[ i ], args );525 if ( value === false ) {526 break;527 }528 }529 }530 // A special, fast, case for the most common use of each531 } else {532 if ( isArray ) {533 for ( ; i < length; i++ ) {534 value = callback.call( obj[ i ], i, obj[ i ] );535 if ( value === false ) {536 break;537 }538 }539 } else {540 for ( i in obj ) {541 value = callback.call( obj[ i ], i, obj[ i ] );542 if ( value === false ) {543 break;544 }545 }546 }547 }548 return obj;549 },550 // Use native String.trim function wherever possible551 trim: core_trim && !core_trim.call("\uFEFF\xA0") ?552 function( text ) {553 return text == null ?554 "" :555 core_trim.call( text );556 } :557 // Otherwise use our own trimming functionality558 function( text ) {559 return text == null ?560 "" :561 ( text + "" ).replace( rtrim, "" );562 },563 // results is for internal usage only564 makeArray: function( arr, results ) {565 var ret = results || [];566 if ( arr != null ) {567 if ( isArraylike( Object(arr) ) ) {568 jQuery.merge( ret,569 typeof arr === "string" ?570 [ arr ] : arr571 );572 } else {573 core_push.call( ret, arr );574 }575 }576 return ret;577 },578 inArray: function( elem, arr, i ) {579 var len;580 if ( arr ) {581 if ( core_indexOf ) {582 return core_indexOf.call( arr, elem, i );583 }584 len = arr.length;585 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;586 for ( ; i < len; i++ ) {587 // Skip accessing in sparse arrays588 if ( i in arr && arr[ i ] === elem ) {589 return i;590 }591 }592 }593 return -1;594 },595 merge: function( first, second ) {596 var l = second.length,597 i = first.length,598 j = 0;599 if ( typeof l === "number" ) {600 for ( ; j < l; j++ ) {601 first[ i++ ] = second[ j ];602 }603 } else {604 while ( second[j] !== undefined ) {605 first[ i++ ] = second[ j++ ];606 }607 }608 first.length = i;609 return first;610 },611 grep: function( elems, callback, inv ) {612 var retVal,613 ret = [],614 i = 0,615 length = elems.length;616 inv = !!inv;617 // Go through the array, only saving the items618 // that pass the validator function619 for ( ; i < length; i++ ) {620 retVal = !!callback( elems[ i ], i );621 if ( inv !== retVal ) {622 ret.push( elems[ i ] );623 }624 }625 return ret;626 },627 // arg is for internal usage only628 map: function( elems, callback, arg ) {629 var value,630 i = 0,631 length = elems.length,632 isArray = isArraylike( elems ),633 ret = [];634 // Go through the array, translating each of the items to their635 if ( isArray ) {636 for ( ; i < length; i++ ) {637 value = callback( elems[ i ], i, arg );638 if ( value != null ) {639 ret[ ret.length ] = value;640 }641 }642 // Go through every key on the object,643 } else {644 for ( i in elems ) {645 value = callback( elems[ i ], i, arg );646 if ( value != null ) {647 ret[ ret.length ] = value;648 }649 }650 }651 // Flatten any nested arrays652 return core_concat.apply( [], ret );653 },654 // A global GUID counter for objects655 guid: 1,656 // Bind a function to a context, optionally partially applying any657 // arguments.658 proxy: function( fn, context ) {659 var args, proxy, tmp;660 if ( typeof context === "string" ) {661 tmp = fn[ context ];662 context = fn;663 fn = tmp;664 }665 // Quick check to determine if target is callable, in the spec666 // this throws a TypeError, but we will just return undefined.667 if ( !jQuery.isFunction( fn ) ) {668 return undefined;669 }670 // Simulated bind671 args = core_slice.call( arguments, 2 );672 proxy = function() {673 return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );674 };675 // Set the guid of unique handler to the same of original handler, so it can be removed676 proxy.guid = fn.guid = fn.guid || jQuery.guid++;677 return proxy;678 },679 // Multifunctional method to get and set values of a collection680 // The value/s can optionally be executed if it's a function681 access: function( elems, fn, key, value, chainable, emptyGet, raw ) {682 var i = 0,683 length = elems.length,684 bulk = key == null;685 // Sets many values686 if ( jQuery.type( key ) === "object" ) {687 chainable = true;688 for ( i in key ) {689 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );690 }691 // Sets one value692 } else if ( value !== undefined ) {693 chainable = true;694 if ( !jQuery.isFunction( value ) ) {695 raw = true;696 }697 if ( bulk ) {698 // Bulk operations run against the entire set699 if ( raw ) {700 fn.call( elems, value );701 fn = null;702 // ...except when executing function values703 } else {704 bulk = fn;705 fn = function( elem, key, value ) {706 return bulk.call( jQuery( elem ), value );707 };708 }709 }710 if ( fn ) {711 for ( ; i < length; i++ ) {712 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );713 }714 }715 }716 return chainable ?717 elems :718 // Gets719 bulk ?720 fn.call( elems ) :721 length ? fn( elems[0], key ) : emptyGet;722 },723 now: function() {724 return ( new Date() ).getTime();725 },726 // A method for quickly swapping in/out CSS properties to get correct calculations.727 // Note: this method belongs to the css module but it's needed here for the support module.728 // If support gets modularized, this method should be moved back to the css module.729 swap: function( elem, options, callback, args ) {730 var ret, name,731 old = {};732 // Remember the old values, and insert the new ones733 for ( name in options ) {734 old[ name ] = elem.style[ name ];735 elem.style[ name ] = options[ name ];736 }737 ret = callback.apply( elem, args || [] );738 // Revert the old values739 for ( name in options ) {740 elem.style[ name ] = old[ name ];741 }742 return ret;743 }744});745jQuery.ready.promise = function( obj ) {746 if ( !readyList ) {747 readyList = jQuery.Deferred();748 // Catch cases where $(document).ready() is called after the browser event has already occurred.749 // we once tried to use readyState "interactive" here, but it caused issues like the one750 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15751 if ( document.readyState === "complete" ) {752 // Handle it asynchronously to allow scripts the opportunity to delay ready753 setTimeout( jQuery.ready );754 // Standards-based browsers support DOMContentLoaded755 } else if ( document.addEventListener ) {756 // Use the handy event callback757 document.addEventListener( "DOMContentLoaded", completed, false );758 // A fallback to window.onload, that will always work759 window.addEventListener( "load", completed, false );760 // If IE event model is used761 } else {762 // Ensure firing before onload, maybe late but safe also for iframes763 document.attachEvent( "onreadystatechange", completed );764 // A fallback to window.onload, that will always work765 window.attachEvent( "onload", completed );766 // If IE and not a frame767 // continually check to see if the document is ready768 var top = false;769 try {770 top = window.frameElement == null && document.documentElement;771 } catch(e) {}772 if ( top && top.doScroll ) {773 (function doScrollCheck() {774 if ( !jQuery.isReady ) {775 try {776 // Use the trick by Diego Perini777 // http://javascript.nwbox.com/IEContentLoaded/778 top.doScroll("left");779 } catch(e) {780 return setTimeout( doScrollCheck, 50 );781 }782 // detach all dom ready events783 detach();784 // and execute any waiting functions785 jQuery.ready();786 }787 })();788 }789 }790 }791 return readyList.promise( obj );792};793// Populate the class2type map794jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {795 class2type[ "[object " + name + "]" ] = name.toLowerCase();796});797function isArraylike( obj ) {798 var length = obj.length,799 type = jQuery.type( obj );800 if ( jQuery.isWindow( obj ) ) {801 return false;802 }803 if ( obj.nodeType === 1 && length ) {804 return true;805 }806 return type === "array" || type !== "function" &&807 ( length === 0 ||808 typeof length === "number" && length > 0 && ( length - 1 ) in obj );809}810// All jQuery objects should point back to these811rootjQuery = jQuery(document);812/*!813 * Sizzle CSS Selector Engine v1.10.2814 * http://sizzlejs.com/815 *816 * Copyright 2013 jQuery Foundation, Inc. and other contributors817 * Released under the MIT license818 * http://jquery.org/license819 *820 * Date: 2013-07-03821 */822(function( window, undefined ) {823var i,824 support,825 cachedruns,826 Expr,827 getText,828 isXML,829 compile,830 outermostContext,831 sortInput,832 // Local document vars833 setDocument,834 document,835 docElem,836 documentIsHTML,837 rbuggyQSA,838 rbuggyMatches,839 matches,840 contains,841 // Instance-specific data842 expando = "sizzle" + -(new Date()),843 preferredDoc = window.document,844 dirruns = 0,845 done = 0,846 classCache = createCache(),847 tokenCache = createCache(),848 compilerCache = createCache(),849 hasDuplicate = false,850 sortOrder = function( a, b ) {851 if ( a === b ) {852 hasDuplicate = true;853 return 0;854 }855 return 0;856 },857 // General-purpose constants858 strundefined = typeof undefined,859 MAX_NEGATIVE = 1 << 31,860 // Instance methods861 hasOwn = ({}).hasOwnProperty,862 arr = [],863 pop = arr.pop,864 push_native = arr.push,865 push = arr.push,866 slice = arr.slice,867 // Use a stripped-down indexOf if we can't use a native one868 indexOf = arr.indexOf || function( elem ) {869 var i = 0,870 len = this.length;871 for ( ; i < len; i++ ) {872 if ( this[i] === elem ) {873 return i;874 }875 }876 return -1;877 },878 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",879 // Regular expressions880 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace881 whitespace = "[\\x20\\t\\r\\n\\f]",882 // http://www.w3.org/TR/css3-syntax/#characters883 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",884 // Loosely modeled on CSS identifier characters885 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors886 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier887 identifier = characterEncoding.replace( "w", "w#" ),888 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors889 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +890 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",891 // Prefer arguments quoted,892 // then not containing pseudos/brackets,893 // then attribute selectors/non-parenthetical expressions,894 // then anything else895 // These preferences are here to reduce the number of selectors896 // needing tokenize in the PSEUDO preFilter897 pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",898 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter899 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),900 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),901 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),902 rsibling = new RegExp( whitespace + "*[+~]" ),903 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),904 rpseudo = new RegExp( pseudos ),905 ridentifier = new RegExp( "^" + identifier + "$" ),906 matchExpr = {907 "ID": new RegExp( "^#(" + characterEncoding + ")" ),908 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),909 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),910 "ATTR": new RegExp( "^" + attributes ),911 "PSEUDO": new RegExp( "^" + pseudos ),912 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +913 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +914 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),915 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),916 // For use in libraries implementing .is()917 // We use this for POS matching in `select`918 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +919 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )920 },921 rnative = /^[^{]+\{\s*\[native \w/,922 // Easily-parseable/retrievable ID or TAG or CLASS selectors923 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,924 rinputs = /^(?:input|select|textarea|button)$/i,925 rheader = /^h\d$/i,926 rescape = /'|\\/g,927 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters928 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),929 funescape = function( _, escaped, escapedWhitespace ) {930 var high = "0x" + escaped - 0x10000;931 // NaN means non-codepoint932 // Support: Firefox933 // Workaround erroneous numeric interpretation of +"0x"934 return high !== high || escapedWhitespace ?935 escaped :936 // BMP codepoint937 high < 0 ?938 String.fromCharCode( high + 0x10000 ) :939 // Supplemental Plane codepoint (surrogate pair)940 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );941 };942// Optimize for push.apply( _, NodeList )943try {944 push.apply(945 (arr = slice.call( preferredDoc.childNodes )),946 preferredDoc.childNodes947 );948 // Support: Android<4.0949 // Detect silently failing push.apply950 arr[ preferredDoc.childNodes.length ].nodeType;951} catch ( e ) {952 push = { apply: arr.length ?953 // Leverage slice if possible954 function( target, els ) {955 push_native.apply( target, slice.call(els) );956 } :957 // Support: IE<9958 // Otherwise append directly959 function( target, els ) {960 var j = target.length,961 i = 0;962 // Can't trust NodeList.length963 while ( (target[j++] = els[i++]) ) {}964 target.length = j - 1;965 }966 };967}968function Sizzle( selector, context, results, seed ) {969 var match, elem, m, nodeType,970 // QSA vars971 i, groups, old, nid, newContext, newSelector;972 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {973 setDocument( context );974 }975 context = context || document;976 results = results || [];977 if ( !selector || typeof selector !== "string" ) {978 return results;979 }980 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {981 return [];982 }983 if ( documentIsHTML && !seed ) {984 // Shortcuts985 if ( (match = rquickExpr.exec( selector )) ) {986 // Speed-up: Sizzle("#ID")987 if ( (m = match[1]) ) {988 if ( nodeType === 9 ) {989 elem = context.getElementById( m );990 // Check parentNode to catch when Blackberry 4.6 returns991 // nodes that are no longer in the document #6963992 if ( elem && elem.parentNode ) {993 // Handle the case where IE, Opera, and Webkit return items994 // by name instead of ID995 if ( elem.id === m ) {996 results.push( elem );997 return results;998 }999 } else {1000 return results;1001 }1002 } else {1003 // Context is not a document1004 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&1005 contains( context, elem ) && elem.id === m ) {1006 results.push( elem );1007 return results;1008 }1009 }1010 // Speed-up: Sizzle("TAG")1011 } else if ( match[2] ) {1012 push.apply( results, context.getElementsByTagName( selector ) );1013 return results;1014 // Speed-up: Sizzle(".CLASS")1015 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {1016 push.apply( results, context.getElementsByClassName( m ) );1017 return results;1018 }1019 }1020 // QSA path1021 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {1022 nid = old = expando;1023 newContext = context;1024 newSelector = nodeType === 9 && selector;1025 // qSA works strangely on Element-rooted queries1026 // We can work around this by specifying an extra ID on the root1027 // and working up from there (Thanks to Andrew Dupont for the technique)1028 // IE 8 doesn't work on object elements1029 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {1030 groups = tokenize( selector );1031 if ( (old = context.getAttribute("id")) ) {1032 nid = old.replace( rescape, "\\$&" );1033 } else {1034 context.setAttribute( "id", nid );1035 }1036 nid = "[id='" + nid + "'] ";1037 i = groups.length;1038 while ( i-- ) {1039 groups[i] = nid + toSelector( groups[i] );1040 }1041 newContext = rsibling.test( selector ) && context.parentNode || context;1042 newSelector = groups.join(",");1043 }1044 if ( newSelector ) {1045 try {1046 push.apply( results,1047 newContext.querySelectorAll( newSelector )1048 );1049 return results;1050 } catch(qsaError) {1051 } finally {1052 if ( !old ) {1053 context.removeAttribute("id");1054 }1055 }1056 }1057 }1058 }1059 // All others1060 return select( selector.replace( rtrim, "$1" ), context, results, seed );1061}1062/**1063 * Create key-value caches of limited size1064 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with1065 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)1066 * deleting the oldest entry1067 */1068function createCache() {1069 var keys = [];1070 function cache( key, value ) {1071 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)1072 if ( keys.push( key += " " ) > Expr.cacheLength ) {1073 // Only keep the most recent entries1074 delete cache[ keys.shift() ];1075 }1076 return (cache[ key ] = value);1077 }1078 return cache;1079}1080/**1081 * Mark a function for special use by Sizzle1082 * @param {Function} fn The function to mark1083 */1084function markFunction( fn ) {1085 fn[ expando ] = true;1086 return fn;1087}1088/**1089 * Support testing using an element1090 * @param {Function} fn Passed the created div and expects a boolean result1091 */1092function assert( fn ) {1093 var div = document.createElement("div");1094 try {1095 return !!fn( div );1096 } catch (e) {1097 return false;1098 } finally {1099 // Remove from its parent by default1100 if ( div.parentNode ) {1101 div.parentNode.removeChild( div );1102 }1103 // release memory in IE1104 div = null;1105 }1106}1107/**1108 * Adds the same handler for all of the specified attrs1109 * @param {String} attrs Pipe-separated list of attributes1110 * @param {Function} handler The method that will be applied1111 */1112function addHandle( attrs, handler ) {1113 var arr = attrs.split("|"),1114 i = attrs.length;1115 while ( i-- ) {1116 Expr.attrHandle[ arr[i] ] = handler;1117 }1118}1119/**1120 * Checks document order of two siblings1121 * @param {Element} a1122 * @param {Element} b1123 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b1124 */1125function siblingCheck( a, b ) {1126 var cur = b && a,1127 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&1128 ( ~b.sourceIndex || MAX_NEGATIVE ) -1129 ( ~a.sourceIndex || MAX_NEGATIVE );1130 // Use IE sourceIndex if available on both nodes1131 if ( diff ) {1132 return diff;1133 }1134 // Check if b follows a1135 if ( cur ) {1136 while ( (cur = cur.nextSibling) ) {1137 if ( cur === b ) {1138 return -1;1139 }1140 }1141 }1142 return a ? 1 : -1;1143}1144/**1145 * Returns a function to use in pseudos for input types1146 * @param {String} type1147 */1148function createInputPseudo( type ) {1149 return function( elem ) {1150 var name = elem.nodeName.toLowerCase();1151 return name === "input" && elem.type === type;1152 };1153}1154/**1155 * Returns a function to use in pseudos for buttons1156 * @param {String} type1157 */1158function createButtonPseudo( type ) {1159 return function( elem ) {1160 var name = elem.nodeName.toLowerCase();1161 return (name === "input" || name === "button") && elem.type === type;1162 };1163}1164/**1165 * Returns a function to use in pseudos for positionals1166 * @param {Function} fn1167 */1168function createPositionalPseudo( fn ) {1169 return markFunction(function( argument ) {1170 argument = +argument;1171 return markFunction(function( seed, matches ) {1172 var j,1173 matchIndexes = fn( [], seed.length, argument ),1174 i = matchIndexes.length;1175 // Match elements found at the specified indexes1176 while ( i-- ) {1177 if ( seed[ (j = matchIndexes[i]) ] ) {1178 seed[j] = !(matches[j] = seed[j]);1179 }1180 }1181 });1182 });1183}1184/**1185 * Detect xml1186 * @param {Element|Object} elem An element or a document1187 */1188isXML = Sizzle.isXML = function( elem ) {1189 // documentElement is verified for cases where it doesn't yet exist1190 // (such as loading iframes in IE - #4833)1191 var documentElement = elem && (elem.ownerDocument || elem).documentElement;1192 return documentElement ? documentElement.nodeName !== "HTML" : false;1193};1194// Expose support vars for convenience1195support = Sizzle.support = {};1196/**1197 * Sets document-related variables once based on the current document1198 * @param {Element|Object} [doc] An element or document object to use to set the document1199 * @returns {Object} Returns the current document1200 */1201setDocument = Sizzle.setDocument = function( node ) {1202 var doc = node ? node.ownerDocument || node : preferredDoc,1203 parent = doc.defaultView;1204 // If no document and documentElement is available, return1205 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {1206 return document;1207 }1208 // Set our document1209 document = doc;1210 docElem = doc.documentElement;1211 // Support tests1212 documentIsHTML = !isXML( doc );1213 // Support: IE>81214 // If iframe document is assigned to "document" variable and if iframe has been reloaded,1215 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #139361216 // IE6-8 do not support the defaultView property so parent will be undefined1217 if ( parent && parent.attachEvent && parent !== parent.top ) {1218 parent.attachEvent( "onbeforeunload", function() {1219 setDocument();1220 });1221 }1222 /* Attributes1223 ---------------------------------------------------------------------- */1224 // Support: IE<81225 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)1226 support.attributes = assert(function( div ) {1227 div.className = "i";1228 return !div.getAttribute("className");1229 });1230 /* getElement(s)By*1231 ---------------------------------------------------------------------- */1232 // Check if getElementsByTagName("*") returns only elements1233 support.getElementsByTagName = assert(function( div ) {1234 div.appendChild( doc.createComment("") );1235 return !div.getElementsByTagName("*").length;1236 });1237 // Check if getElementsByClassName can be trusted1238 support.getElementsByClassName = assert(function( div ) {1239 div.innerHTML = "<div class='a'></div><div class='a i'></div>";1240 // Support: Safari<41241 // Catch class over-caching1242 div.firstChild.className = "i";1243 // Support: Opera<101244 // Catch gEBCN failure to find non-leading classes1245 return div.getElementsByClassName("i").length === 2;1246 });1247 // Support: IE<101248 // Check if getElementById returns elements by name1249 // The broken getElementById methods don't pick up programatically-set names,1250 // so use a roundabout getElementsByName test1251 support.getById = assert(function( div ) {1252 docElem.appendChild( div ).id = expando;1253 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;1254 });1255 // ID find and filter1256 if ( support.getById ) {1257 Expr.find["ID"] = function( id, context ) {1258 if ( typeof context.getElementById !== strundefined && documentIsHTML ) {1259 var m = context.getElementById( id );1260 // Check parentNode to catch when Blackberry 4.6 returns1261 // nodes that are no longer in the document #69631262 return m && m.parentNode ? [m] : [];1263 }1264 };1265 Expr.filter["ID"] = function( id ) {1266 var attrId = id.replace( runescape, funescape );1267 return function( elem ) {1268 return elem.getAttribute("id") === attrId;1269 };1270 };1271 } else {1272 // Support: IE6/71273 // getElementById is not reliable as a find shortcut1274 delete Expr.find["ID"];1275 Expr.filter["ID"] = function( id ) {1276 var attrId = id.replace( runescape, funescape );1277 return function( elem ) {1278 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");1279 return node && node.value === attrId;1280 };1281 };1282 }1283 // Tag1284 Expr.find["TAG"] = support.getElementsByTagName ?1285 function( tag, context ) {1286 if ( typeof context.getElementsByTagName !== strundefined ) {1287 return context.getElementsByTagName( tag );1288 }1289 } :1290 function( tag, context ) {1291 var elem,1292 tmp = [],1293 i = 0,1294 results = context.getElementsByTagName( tag );1295 // Filter out possible comments1296 if ( tag === "*" ) {1297 while ( (elem = results[i++]) ) {1298 if ( elem.nodeType === 1 ) {1299 tmp.push( elem );1300 }1301 }1302 return tmp;1303 }1304 return results;1305 };1306 // Class1307 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {1308 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {1309 return context.getElementsByClassName( className );1310 }1311 };1312 /* QSA/matchesSelector1313 ---------------------------------------------------------------------- */1314 // QSA and matchesSelector support1315 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)1316 rbuggyMatches = [];1317 // qSa(:focus) reports false when true (Chrome 21)1318 // We allow this because of a bug in IE8/9 that throws an error1319 // whenever `document.activeElement` is accessed on an iframe1320 // So, we allow :focus to pass through QSA all the time to avoid the IE error1321 // See http://bugs.jquery.com/ticket/133781322 rbuggyQSA = [];1323 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {1324 // Build QSA regex1325 // Regex strategy adopted from Diego Perini1326 assert(function( div ) {1327 // Select is set to empty string on purpose1328 // This is to test IE's treatment of not explicitly1329 // setting a boolean content attribute,1330 // since its presence should be enough1331 // http://bugs.jquery.com/ticket/123591332 div.innerHTML = "<select><option selected=''></option></select>";1333 // Support: IE81334 // Boolean attributes and "value" are not treated correctly1335 if ( !div.querySelectorAll("[selected]").length ) {1336 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );1337 }1338 // Webkit/Opera - :checked should return selected option elements1339 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1340 // IE8 throws error here and will not see later tests1341 if ( !div.querySelectorAll(":checked").length ) {1342 rbuggyQSA.push(":checked");1343 }1344 });1345 assert(function( div ) {1346 // Support: Opera 10-12/IE81347 // ^= $= *= and empty values1348 // Should not select anything1349 // Support: Windows 8 Native Apps1350 // The type attribute is restricted during .innerHTML assignment1351 var input = doc.createElement("input");1352 input.setAttribute( "type", "hidden" );1353 div.appendChild( input ).setAttribute( "t", "" );1354 if ( div.querySelectorAll("[t^='']").length ) {1355 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );1356 }1357 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)1358 // IE8 throws error here and will not see later tests1359 if ( !div.querySelectorAll(":enabled").length ) {1360 rbuggyQSA.push( ":enabled", ":disabled" );1361 }1362 // Opera 10-11 does not throw on post-comma invalid pseudos1363 div.querySelectorAll("*,:x");1364 rbuggyQSA.push(",.*:");1365 });1366 }1367 if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||1368 docElem.mozMatchesSelector ||1369 docElem.oMatchesSelector ||1370 docElem.msMatchesSelector) )) ) {1371 assert(function( div ) {1372 // Check to see if it's possible to do matchesSelector1373 // on a disconnected node (IE 9)1374 support.disconnectedMatch = matches.call( div, "div" );1375 // This should fail with an exception1376 // Gecko does not error, returns false instead1377 matches.call( div, "[s!='']:x" );1378 rbuggyMatches.push( "!=", pseudos );1379 });1380 }1381 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );1382 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );1383 /* Contains1384 ---------------------------------------------------------------------- */1385 // Element contains another1386 // Purposefully does not implement inclusive descendent1387 // As in, an element does not contain itself1388 contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?1389 function( a, b ) {1390 var adown = a.nodeType === 9 ? a.documentElement : a,1391 bup = b && b.parentNode;1392 return a === bup || !!( bup && bup.nodeType === 1 && (1393 adown.contains ?1394 adown.contains( bup ) :1395 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 161396 ));1397 } :1398 function( a, b ) {1399 if ( b ) {1400 while ( (b = b.parentNode) ) {1401 if ( b === a ) {1402 return true;1403 }1404 }1405 }1406 return false;1407 };1408 /* Sorting1409 ---------------------------------------------------------------------- */1410 // Document order sorting1411 sortOrder = docElem.compareDocumentPosition ?1412 function( a, b ) {1413 // Flag for duplicate removal1414 if ( a === b ) {1415 hasDuplicate = true;1416 return 0;1417 }1418 var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );1419 if ( compare ) {1420 // Disconnected nodes1421 if ( compare & 1 ||1422 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {1423 // Choose the first element that is related to our preferred document1424 if ( a === doc || contains(preferredDoc, a) ) {1425 return -1;1426 }1427 if ( b === doc || contains(preferredDoc, b) ) {1428 return 1;1429 }1430 // Maintain original order1431 return sortInput ?1432 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1433 0;1434 }1435 return compare & 4 ? -1 : 1;1436 }1437 // Not directly comparable, sort on existence of method1438 return a.compareDocumentPosition ? -1 : 1;1439 } :1440 function( a, b ) {1441 var cur,1442 i = 0,1443 aup = a.parentNode,1444 bup = b.parentNode,1445 ap = [ a ],1446 bp = [ b ];1447 // Exit early if the nodes are identical1448 if ( a === b ) {1449 hasDuplicate = true;1450 return 0;1451 // Parentless nodes are either documents or disconnected1452 } else if ( !aup || !bup ) {1453 return a === doc ? -1 :1454 b === doc ? 1 :1455 aup ? -1 :1456 bup ? 1 :1457 sortInput ?1458 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1459 0;1460 // If the nodes are siblings, we can do a quick check1461 } else if ( aup === bup ) {1462 return siblingCheck( a, b );1463 }1464 // Otherwise we need full lists of their ancestors for comparison1465 cur = a;1466 while ( (cur = cur.parentNode) ) {1467 ap.unshift( cur );1468 }1469 cur = b;1470 while ( (cur = cur.parentNode) ) {1471 bp.unshift( cur );1472 }1473 // Walk down the tree looking for a discrepancy1474 while ( ap[i] === bp[i] ) {1475 i++;1476 }1477 return i ?1478 // Do a sibling check if the nodes have a common ancestor1479 siblingCheck( ap[i], bp[i] ) :1480 // Otherwise nodes in our document sort first1481 ap[i] === preferredDoc ? -1 :1482 bp[i] === preferredDoc ? 1 :1483 0;1484 };1485 return doc;1486};1487Sizzle.matches = function( expr, elements ) {1488 return Sizzle( expr, null, null, elements );1489};1490Sizzle.matchesSelector = function( elem, expr ) {1491 // Set document vars if needed1492 if ( ( elem.ownerDocument || elem ) !== document ) {1493 setDocument( elem );1494 }1495 // Make sure that attribute selectors are quoted1496 expr = expr.replace( rattributeQuotes, "='$1']" );1497 if ( support.matchesSelector && documentIsHTML &&1498 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&1499 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {1500 try {1501 var ret = matches.call( elem, expr );1502 // IE 9's matchesSelector returns false on disconnected nodes1503 if ( ret || support.disconnectedMatch ||1504 // As well, disconnected nodes are said to be in a document1505 // fragment in IE 91506 elem.document && elem.document.nodeType !== 11 ) {1507 return ret;1508 }1509 } catch(e) {}1510 }1511 return Sizzle( expr, document, null, [elem] ).length > 0;1512};1513Sizzle.contains = function( context, elem ) {1514 // Set document vars if needed1515 if ( ( context.ownerDocument || context ) !== document ) {1516 setDocument( context );1517 }1518 return contains( context, elem );1519};1520Sizzle.attr = function( elem, name ) {1521 // Set document vars if needed1522 if ( ( elem.ownerDocument || elem ) !== document ) {1523 setDocument( elem );1524 }1525 var fn = Expr.attrHandle[ name.toLowerCase() ],1526 // Don't get fooled by Object.prototype properties (jQuery #13807)1527 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?1528 fn( elem, name, !documentIsHTML ) :1529 undefined;1530 return val === undefined ?1531 support.attributes || !documentIsHTML ?1532 elem.getAttribute( name ) :1533 (val = elem.getAttributeNode(name)) && val.specified ?1534 val.value :1535 null :1536 val;1537};1538Sizzle.error = function( msg ) {1539 throw new Error( "Syntax error, unrecognized expression: " + msg );1540};1541/**1542 * Document sorting and removing duplicates1543 * @param {ArrayLike} results1544 */1545Sizzle.uniqueSort = function( results ) {1546 var elem,1547 duplicates = [],1548 j = 0,1549 i = 0;1550 // Unless we *know* we can detect duplicates, assume their presence1551 hasDuplicate = !support.detectDuplicates;1552 sortInput = !support.sortStable && results.slice( 0 );1553 results.sort( sortOrder );1554 if ( hasDuplicate ) {1555 while ( (elem = results[i++]) ) {1556 if ( elem === results[ i ] ) {1557 j = duplicates.push( i );1558 }1559 }1560 while ( j-- ) {1561 results.splice( duplicates[ j ], 1 );1562 }1563 }1564 return results;1565};1566/**1567 * Utility function for retrieving the text value of an array of DOM nodes1568 * @param {Array|Element} elem1569 */1570getText = Sizzle.getText = function( elem ) {1571 var node,1572 ret = "",1573 i = 0,1574 nodeType = elem.nodeType;1575 if ( !nodeType ) {1576 // If no nodeType, this is expected to be an array1577 for ( ; (node = elem[i]); i++ ) {1578 // Do not traverse comment nodes1579 ret += getText( node );1580 }1581 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {1582 // Use textContent for elements1583 // innerText usage removed for consistency of new lines (see #11153)1584 if ( typeof elem.textContent === "string" ) {1585 return elem.textContent;1586 } else {1587 // Traverse its children1588 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1589 ret += getText( elem );1590 }1591 }1592 } else if ( nodeType === 3 || nodeType === 4 ) {1593 return elem.nodeValue;1594 }1595 // Do not include comment or processing instruction nodes1596 return ret;1597};1598Expr = Sizzle.selectors = {1599 // Can be adjusted by the user1600 cacheLength: 50,1601 createPseudo: markFunction,1602 match: matchExpr,1603 attrHandle: {},1604 find: {},1605 relative: {1606 ">": { dir: "parentNode", first: true },1607 " ": { dir: "parentNode" },1608 "+": { dir: "previousSibling", first: true },1609 "~": { dir: "previousSibling" }1610 },1611 preFilter: {1612 "ATTR": function( match ) {1613 match[1] = match[1].replace( runescape, funescape );1614 // Move the given value to match[3] whether quoted or unquoted1615 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );1616 if ( match[2] === "~=" ) {1617 match[3] = " " + match[3] + " ";1618 }1619 return match.slice( 0, 4 );1620 },1621 "CHILD": function( match ) {1622 /* matches from matchExpr["CHILD"]1623 1 type (only|nth|...)1624 2 what (child|of-type)1625 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)1626 4 xn-component of xn+y argument ([+-]?\d*n|)1627 5 sign of xn-component1628 6 x of xn-component1629 7 sign of y-component1630 8 y of y-component1631 */1632 match[1] = match[1].toLowerCase();1633 if ( match[1].slice( 0, 3 ) === "nth" ) {1634 // nth-* requires argument1635 if ( !match[3] ) {1636 Sizzle.error( match[0] );1637 }1638 // numeric x and y parameters for Expr.filter.CHILD1639 // remember that false/true cast respectively to 0/11640 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );1641 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );1642 // other types prohibit arguments1643 } else if ( match[3] ) {1644 Sizzle.error( match[0] );1645 }1646 return match;1647 },1648 "PSEUDO": function( match ) {1649 var excess,1650 unquoted = !match[5] && match[2];1651 if ( matchExpr["CHILD"].test( match[0] ) ) {1652 return null;1653 }1654 // Accept quoted arguments as-is1655 if ( match[3] && match[4] !== undefined ) {1656 match[2] = match[4];1657 // Strip excess characters from unquoted arguments1658 } else if ( unquoted && rpseudo.test( unquoted ) &&1659 // Get excess from tokenize (recursively)1660 (excess = tokenize( unquoted, true )) &&1661 // advance to the next closing parenthesis1662 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {1663 // excess is a negative index1664 match[0] = match[0].slice( 0, excess );1665 match[2] = unquoted.slice( 0, excess );1666 }1667 // Return only captures needed by the pseudo filter method (type and argument)1668 return match.slice( 0, 3 );1669 }1670 },1671 filter: {1672 "TAG": function( nodeNameSelector ) {1673 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();1674 return nodeNameSelector === "*" ?1675 function() { return true; } :1676 function( elem ) {1677 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;1678 };1679 },1680 "CLASS": function( className ) {1681 var pattern = classCache[ className + " " ];1682 return pattern ||1683 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&1684 classCache( className, function( elem ) {1685 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );1686 });1687 },1688 "ATTR": function( name, operator, check ) {1689 return function( elem ) {1690 var result = Sizzle.attr( elem, name );1691 if ( result == null ) {1692 return operator === "!=";1693 }1694 if ( !operator ) {1695 return true;1696 }1697 result += "";1698 return operator === "=" ? result === check :1699 operator === "!=" ? result !== check :1700 operator === "^=" ? check && result.indexOf( check ) === 0 :1701 operator === "*=" ? check && result.indexOf( check ) > -1 :1702 operator === "$=" ? check && result.slice( -check.length ) === check :1703 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :1704 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :1705 false;1706 };1707 },1708 "CHILD": function( type, what, argument, first, last ) {1709 var simple = type.slice( 0, 3 ) !== "nth",1710 forward = type.slice( -4 ) !== "last",1711 ofType = what === "of-type";1712 return first === 1 && last === 0 ?1713 // Shortcut for :nth-*(n)1714 function( elem ) {1715 return !!elem.parentNode;1716 } :1717 function( elem, context, xml ) {1718 var cache, outerCache, node, diff, nodeIndex, start,1719 dir = simple !== forward ? "nextSibling" : "previousSibling",1720 parent = elem.parentNode,1721 name = ofType && elem.nodeName.toLowerCase(),1722 useCache = !xml && !ofType;1723 if ( parent ) {1724 // :(first|last|only)-(child|of-type)1725 if ( simple ) {1726 while ( dir ) {1727 node = elem;1728 while ( (node = node[ dir ]) ) {1729 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {1730 return false;1731 }1732 }1733 // Reverse direction for :only-* (if we haven't yet done so)1734 start = dir = type === "only" && !start && "nextSibling";1735 }1736 return true;1737 }1738 start = [ forward ? parent.firstChild : parent.lastChild ];1739 // non-xml :nth-child(...) stores cache data on `parent`1740 if ( forward && useCache ) {1741 // Seek `elem` from a previously-cached index1742 outerCache = parent[ expando ] || (parent[ expando ] = {});1743 cache = outerCache[ type ] || [];1744 nodeIndex = cache[0] === dirruns && cache[1];1745 diff = cache[0] === dirruns && cache[2];1746 node = nodeIndex && parent.childNodes[ nodeIndex ];1747 while ( (node = ++nodeIndex && node && node[ dir ] ||1748 // Fallback to seeking `elem` from the start1749 (diff = nodeIndex = 0) || start.pop()) ) {1750 // When found, cache indexes on `parent` and break1751 if ( node.nodeType === 1 && ++diff && node === elem ) {1752 outerCache[ type ] = [ dirruns, nodeIndex, diff ];1753 break;1754 }1755 }1756 // Use previously-cached element index if available1757 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {1758 diff = cache[1];1759 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)1760 } else {1761 // Use the same loop as above to seek `elem` from the start1762 while ( (node = ++nodeIndex && node && node[ dir ] ||1763 (diff = nodeIndex = 0) || start.pop()) ) {1764 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {1765 // Cache the index of each encountered element1766 if ( useCache ) {1767 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];1768 }1769 if ( node === elem ) {1770 break;1771 }1772 }1773 }1774 }1775 // Incorporate the offset, then check against cycle size1776 diff -= last;1777 return diff === first || ( diff % first === 0 && diff / first >= 0 );1778 }1779 };1780 },1781 "PSEUDO": function( pseudo, argument ) {1782 // pseudo-class names are case-insensitive1783 // http://www.w3.org/TR/selectors/#pseudo-classes1784 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters1785 // Remember that setFilters inherits from pseudos1786 var args,1787 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||1788 Sizzle.error( "unsupported pseudo: " + pseudo );1789 // The user may use createPseudo to indicate that1790 // arguments are needed to create the filter function1791 // just as Sizzle does1792 if ( fn[ expando ] ) {1793 return fn( argument );1794 }1795 // But maintain support for old signatures1796 if ( fn.length > 1 ) {1797 args = [ pseudo, pseudo, "", argument ];1798 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?1799 markFunction(function( seed, matches ) {1800 var idx,1801 matched = fn( seed, argument ),1802 i = matched.length;1803 while ( i-- ) {1804 idx = indexOf.call( seed, matched[i] );1805 seed[ idx ] = !( matches[ idx ] = matched[i] );1806 }1807 }) :1808 function( elem ) {1809 return fn( elem, 0, args );1810 };1811 }1812 return fn;1813 }1814 },1815 pseudos: {1816 // Potentially complex pseudos1817 "not": markFunction(function( selector ) {1818 // Trim the selector passed to compile1819 // to avoid treating leading and trailing1820 // spaces as combinators1821 var input = [],1822 results = [],1823 matcher = compile( selector.replace( rtrim, "$1" ) );1824 return matcher[ expando ] ?1825 markFunction(function( seed, matches, context, xml ) {1826 var elem,1827 unmatched = matcher( seed, null, xml, [] ),1828 i = seed.length;1829 // Match elements unmatched by `matcher`1830 while ( i-- ) {1831 if ( (elem = unmatched[i]) ) {1832 seed[i] = !(matches[i] = elem);1833 }1834 }1835 }) :1836 function( elem, context, xml ) {1837 input[0] = elem;1838 matcher( input, null, xml, results );1839 return !results.pop();1840 };1841 }),1842 "has": markFunction(function( selector ) {1843 return function( elem ) {1844 return Sizzle( selector, elem ).length > 0;1845 };1846 }),1847 "contains": markFunction(function( text ) {1848 return function( elem ) {1849 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;1850 };1851 }),1852 // "Whether an element is represented by a :lang() selector1853 // is based solely on the element's language value1854 // being equal to the identifier C,1855 // or beginning with the identifier C immediately followed by "-".1856 // The matching of C against the element's language value is performed case-insensitively.1857 // The identifier C does not have to be a valid language name."1858 // http://www.w3.org/TR/selectors/#lang-pseudo1859 "lang": markFunction( function( lang ) {1860 // lang value must be a valid identifier1861 if ( !ridentifier.test(lang || "") ) {1862 Sizzle.error( "unsupported lang: " + lang );1863 }1864 lang = lang.replace( runescape, funescape ).toLowerCase();1865 return function( elem ) {1866 var elemLang;1867 do {1868 if ( (elemLang = documentIsHTML ?1869 elem.lang :1870 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {1871 elemLang = elemLang.toLowerCase();1872 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;1873 }1874 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );1875 return false;1876 };1877 }),1878 // Miscellaneous1879 "target": function( elem ) {1880 var hash = window.location && window.location.hash;1881 return hash && hash.slice( 1 ) === elem.id;1882 },1883 "root": function( elem ) {1884 return elem === docElem;1885 },1886 "focus": function( elem ) {1887 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);1888 },1889 // Boolean properties1890 "enabled": function( elem ) {1891 return elem.disabled === false;1892 },1893 "disabled": function( elem ) {1894 return elem.disabled === true;1895 },1896 "checked": function( elem ) {1897 // In CSS3, :checked should return both checked and selected elements1898 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1899 var nodeName = elem.nodeName.toLowerCase();1900 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);1901 },1902 "selected": function( elem ) {1903 // Accessing this property makes selected-by-default1904 // options in Safari work properly1905 if ( elem.parentNode ) {1906 elem.parentNode.selectedIndex;1907 }1908 return elem.selected === true;1909 },1910 // Contents1911 "empty": function( elem ) {1912 // http://www.w3.org/TR/selectors/#empty-pseudo1913 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),1914 // not comment, processing instructions, or others1915 // Thanks to Diego Perini for the nodeName shortcut1916 // Greater than "@" means alpha characters (specifically not starting with "#" or "?")1917 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1918 if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {1919 return false;1920 }1921 }1922 return true;1923 },1924 "parent": function( elem ) {1925 return !Expr.pseudos["empty"]( elem );1926 },1927 // Element/input types1928 "header": function( elem ) {1929 return rheader.test( elem.nodeName );1930 },1931 "input": function( elem ) {1932 return rinputs.test( elem.nodeName );1933 },1934 "button": function( elem ) {1935 var name = elem.nodeName.toLowerCase();1936 return name === "input" && elem.type === "button" || name === "button";1937 },1938 "text": function( elem ) {1939 var attr;1940 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)1941 // use getAttribute instead to test this case1942 return elem.nodeName.toLowerCase() === "input" &&1943 elem.type === "text" &&1944 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );1945 },1946 // Position-in-collection1947 "first": createPositionalPseudo(function() {1948 return [ 0 ];1949 }),1950 "last": createPositionalPseudo(function( matchIndexes, length ) {1951 return [ length - 1 ];1952 }),1953 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {1954 return [ argument < 0 ? argument + length : argument ];1955 }),1956 "even": createPositionalPseudo(function( matchIndexes, length ) {1957 var i = 0;1958 for ( ; i < length; i += 2 ) {1959 matchIndexes.push( i );1960 }1961 return matchIndexes;1962 }),1963 "odd": createPositionalPseudo(function( matchIndexes, length ) {1964 var i = 1;1965 for ( ; i < length; i += 2 ) {1966 matchIndexes.push( i );1967 }1968 return matchIndexes;1969 }),1970 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {1971 var i = argument < 0 ? argument + length : argument;1972 for ( ; --i >= 0; ) {1973 matchIndexes.push( i );1974 }1975 return matchIndexes;1976 }),1977 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {1978 var i = argument < 0 ? argument + length : argument;1979 for ( ; ++i < length; ) {1980 matchIndexes.push( i );1981 }1982 return matchIndexes;1983 })1984 }1985};1986Expr.pseudos["nth"] = Expr.pseudos["eq"];1987// Add button/input type pseudos1988for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {1989 Expr.pseudos[ i ] = createInputPseudo( i );1990}1991for ( i in { submit: true, reset: true } ) {1992 Expr.pseudos[ i ] = createButtonPseudo( i );1993}1994// Easy API for creating new setFilters1995function setFilters() {}1996setFilters.prototype = Expr.filters = Expr.pseudos;1997Expr.setFilters = new setFilters();1998function tokenize( selector, parseOnly ) {1999 var matched, match, tokens, type,2000 soFar, groups, preFilters,2001 cached = tokenCache[ selector + " " ];2002 if ( cached ) {2003 return parseOnly ? 0 : cached.slice( 0 );2004 }2005 soFar = selector;2006 groups = [];2007 preFilters = Expr.preFilter;2008 while ( soFar ) {2009 // Comma and first run2010 if ( !matched || (match = rcomma.exec( soFar )) ) {2011 if ( match ) {2012 // Don't consume trailing commas as valid2013 soFar = soFar.slice( match[0].length ) || soFar;2014 }2015 groups.push( tokens = [] );2016 }2017 matched = false;2018 // Combinators2019 if ( (match = rcombinators.exec( soFar )) ) {2020 matched = match.shift();2021 tokens.push({2022 value: matched,2023 // Cast descendant combinators to space2024 type: match[0].replace( rtrim, " " )2025 });2026 soFar = soFar.slice( matched.length );2027 }2028 // Filters2029 for ( type in Expr.filter ) {2030 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||2031 (match = preFilters[ type ]( match ))) ) {2032 matched = match.shift();2033 tokens.push({2034 value: matched,2035 type: type,2036 matches: match2037 });2038 soFar = soFar.slice( matched.length );2039 }2040 }2041 if ( !matched ) {2042 break;2043 }2044 }2045 // Return the length of the invalid excess2046 // if we're just parsing2047 // Otherwise, throw an error or return tokens2048 return parseOnly ?2049 soFar.length :2050 soFar ?2051 Sizzle.error( selector ) :2052 // Cache the tokens2053 tokenCache( selector, groups ).slice( 0 );2054}2055function toSelector( tokens ) {2056 var i = 0,2057 len = tokens.length,2058 selector = "";2059 for ( ; i < len; i++ ) {2060 selector += tokens[i].value;2061 }2062 return selector;2063}2064function addCombinator( matcher, combinator, base ) {2065 var dir = combinator.dir,2066 checkNonElements = base && dir === "parentNode",2067 doneName = done++;2068 return combinator.first ?2069 // Check against closest ancestor/preceding element2070 function( elem, context, xml ) {2071 while ( (elem = elem[ dir ]) ) {2072 if ( elem.nodeType === 1 || checkNonElements ) {2073 return matcher( elem, context, xml );2074 }2075 }2076 } :2077 // Check against all ancestor/preceding elements2078 function( elem, context, xml ) {2079 var data, cache, outerCache,2080 dirkey = dirruns + " " + doneName;2081 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching2082 if ( xml ) {2083 while ( (elem = elem[ dir ]) ) {2084 if ( elem.nodeType === 1 || checkNonElements ) {2085 if ( matcher( elem, context, xml ) ) {2086 return true;2087 }2088 }2089 }2090 } else {2091 while ( (elem = elem[ dir ]) ) {2092 if ( elem.nodeType === 1 || checkNonElements ) {2093 outerCache = elem[ expando ] || (elem[ expando ] = {});2094 if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {2095 if ( (data = cache[1]) === true || data === cachedruns ) {2096 return data === true;2097 }2098 } else {2099 cache = outerCache[ dir ] = [ dirkey ];2100 cache[1] = matcher( elem, context, xml ) || cachedruns;2101 if ( cache[1] === true ) {2102 return true;2103 }2104 }2105 }2106 }2107 }2108 };2109}2110function elementMatcher( matchers ) {2111 return matchers.length > 1 ?2112 function( elem, context, xml ) {2113 var i = matchers.length;2114 while ( i-- ) {2115 if ( !matchers[i]( elem, context, xml ) ) {2116 return false;2117 }2118 }2119 return true;2120 } :2121 matchers[0];2122}2123function condense( unmatched, map, filter, context, xml ) {2124 var elem,2125 newUnmatched = [],2126 i = 0,2127 len = unmatched.length,2128 mapped = map != null;2129 for ( ; i < len; i++ ) {2130 if ( (elem = unmatched[i]) ) {2131 if ( !filter || filter( elem, context, xml ) ) {2132 newUnmatched.push( elem );2133 if ( mapped ) {2134 map.push( i );2135 }2136 }2137 }2138 }2139 return newUnmatched;2140}2141function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {2142 if ( postFilter && !postFilter[ expando ] ) {2143 postFilter = setMatcher( postFilter );2144 }2145 if ( postFinder && !postFinder[ expando ] ) {2146 postFinder = setMatcher( postFinder, postSelector );2147 }2148 return markFunction(function( seed, results, context, xml ) {2149 var temp, i, elem,2150 preMap = [],2151 postMap = [],2152 preexisting = results.length,2153 // Get initial elements from seed or context2154 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),2155 // Prefilter to get matcher input, preserving a map for seed-results synchronization2156 matcherIn = preFilter && ( seed || !selector ) ?2157 condense( elems, preMap, preFilter, context, xml ) :2158 elems,2159 matcherOut = matcher ?2160 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,2161 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?2162 // ...intermediate processing is necessary2163 [] :2164 // ...otherwise use results directly2165 results :2166 matcherIn;2167 // Find primary matches2168 if ( matcher ) {2169 matcher( matcherIn, matcherOut, context, xml );2170 }2171 // Apply postFilter2172 if ( postFilter ) {2173 temp = condense( matcherOut, postMap );2174 postFilter( temp, [], context, xml );2175 // Un-match failing elements by moving them back to matcherIn2176 i = temp.length;2177 while ( i-- ) {2178 if ( (elem = temp[i]) ) {2179 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);2180 }2181 }2182 }2183 if ( seed ) {2184 if ( postFinder || preFilter ) {2185 if ( postFinder ) {2186 // Get the final matcherOut by condensing this intermediate into postFinder contexts2187 temp = [];2188 i = matcherOut.length;2189 while ( i-- ) {2190 if ( (elem = matcherOut[i]) ) {2191 // Restore matcherIn since elem is not yet a final match2192 temp.push( (matcherIn[i] = elem) );2193 }2194 }2195 postFinder( null, (matcherOut = []), temp, xml );2196 }2197 // Move matched elements from seed to results to keep them synchronized2198 i = matcherOut.length;2199 while ( i-- ) {2200 if ( (elem = matcherOut[i]) &&2201 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {2202 seed[temp] = !(results[temp] = elem);2203 }2204 }2205 }2206 // Add elements to results, through postFinder if defined2207 } else {2208 matcherOut = condense(2209 matcherOut === results ?2210 matcherOut.splice( preexisting, matcherOut.length ) :2211 matcherOut2212 );2213 if ( postFinder ) {2214 postFinder( null, results, matcherOut, xml );2215 } else {2216 push.apply( results, matcherOut );2217 }2218 }2219 });2220}2221function matcherFromTokens( tokens ) {2222 var checkContext, matcher, j,2223 len = tokens.length,2224 leadingRelative = Expr.relative[ tokens[0].type ],2225 implicitRelative = leadingRelative || Expr.relative[" "],2226 i = leadingRelative ? 1 : 0,2227 // The foundational matcher ensures that elements are reachable from top-level context(s)2228 matchContext = addCombinator( function( elem ) {2229 return elem === checkContext;2230 }, implicitRelative, true ),2231 matchAnyContext = addCombinator( function( elem ) {2232 return indexOf.call( checkContext, elem ) > -1;2233 }, implicitRelative, true ),2234 matchers = [ function( elem, context, xml ) {2235 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (2236 (checkContext = context).nodeType ?2237 matchContext( elem, context, xml ) :2238 matchAnyContext( elem, context, xml ) );2239 } ];2240 for ( ; i < len; i++ ) {2241 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {2242 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];2243 } else {2244 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );2245 // Return special upon seeing a positional matcher2246 if ( matcher[ expando ] ) {2247 // Find the next relative operator (if any) for proper handling2248 j = ++i;2249 for ( ; j < len; j++ ) {2250 if ( Expr.relative[ tokens[j].type ] ) {2251 break;2252 }2253 }2254 return setMatcher(2255 i > 1 && elementMatcher( matchers ),2256 i > 1 && toSelector(2257 // If the preceding token was a descendant combinator, insert an implicit any-element `*`2258 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })2259 ).replace( rtrim, "$1" ),2260 matcher,2261 i < j && matcherFromTokens( tokens.slice( i, j ) ),2262 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),2263 j < len && toSelector( tokens )2264 );2265 }2266 matchers.push( matcher );2267 }2268 }2269 return elementMatcher( matchers );2270}2271function matcherFromGroupMatchers( elementMatchers, setMatchers ) {2272 // A counter to specify which element is currently being matched2273 var matcherCachedRuns = 0,2274 bySet = setMatchers.length > 0,2275 byElement = elementMatchers.length > 0,2276 superMatcher = function( seed, context, xml, results, expandContext ) {2277 var elem, j, matcher,2278 setMatched = [],2279 matchedCount = 0,2280 i = "0",2281 unmatched = seed && [],2282 outermost = expandContext != null,2283 contextBackup = outermostContext,2284 // We must always have either seed elements or context2285 elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),2286 // Use integer dirruns iff this is the outermost matcher2287 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);2288 if ( outermost ) {2289 outermostContext = context !== document && context;2290 cachedruns = matcherCachedRuns;2291 }2292 // Add elements passing elementMatchers directly to results2293 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below2294 for ( ; (elem = elems[i]) != null; i++ ) {2295 if ( byElement && elem ) {2296 j = 0;2297 while ( (matcher = elementMatchers[j++]) ) {2298 if ( matcher( elem, context, xml ) ) {2299 results.push( elem );2300 break;2301 }2302 }2303 if ( outermost ) {2304 dirruns = dirrunsUnique;2305 cachedruns = ++matcherCachedRuns;2306 }2307 }2308 // Track unmatched elements for set filters2309 if ( bySet ) {2310 // They will have gone through all possible matchers2311 if ( (elem = !matcher && elem) ) {2312 matchedCount--;2313 }2314 // Lengthen the array for every element, matched or not2315 if ( seed ) {2316 unmatched.push( elem );2317 }2318 }2319 }2320 // Apply set filters to unmatched elements2321 matchedCount += i;2322 if ( bySet && i !== matchedCount ) {2323 j = 0;2324 while ( (matcher = setMatchers[j++]) ) {2325 matcher( unmatched, setMatched, context, xml );2326 }2327 if ( seed ) {2328 // Reintegrate element matches to eliminate the need for sorting2329 if ( matchedCount > 0 ) {2330 while ( i-- ) {2331 if ( !(unmatched[i] || setMatched[i]) ) {2332 setMatched[i] = pop.call( results );2333 }2334 }2335 }2336 // Discard index placeholder values to get only actual matches2337 setMatched = condense( setMatched );2338 }2339 // Add matches to results2340 push.apply( results, setMatched );2341 // Seedless set matches succeeding multiple successful matchers stipulate sorting2342 if ( outermost && !seed && setMatched.length > 0 &&2343 ( matchedCount + setMatchers.length ) > 1 ) {2344 Sizzle.uniqueSort( results );2345 }2346 }2347 // Override manipulation of globals by nested matchers2348 if ( outermost ) {2349 dirruns = dirrunsUnique;2350 outermostContext = contextBackup;2351 }2352 return unmatched;2353 };2354 return bySet ?2355 markFunction( superMatcher ) :2356 superMatcher;2357}2358compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {2359 var i,2360 setMatchers = [],2361 elementMatchers = [],2362 cached = compilerCache[ selector + " " ];2363 if ( !cached ) {2364 // Generate a function of recursive functions that can be used to check each element2365 if ( !group ) {2366 group = tokenize( selector );2367 }2368 i = group.length;2369 while ( i-- ) {2370 cached = matcherFromTokens( group[i] );2371 if ( cached[ expando ] ) {2372 setMatchers.push( cached );2373 } else {2374 elementMatchers.push( cached );2375 }2376 }2377 // Cache the compiled function2378 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );2379 }2380 return cached;2381};2382function multipleContexts( selector, contexts, results ) {2383 var i = 0,2384 len = contexts.length;2385 for ( ; i < len; i++ ) {2386 Sizzle( selector, contexts[i], results );2387 }2388 return results;2389}2390function select( selector, context, results, seed ) {2391 var i, tokens, token, type, find,2392 match = tokenize( selector );2393 if ( !seed ) {2394 // Try to minimize operations if there is only one group2395 if ( match.length === 1 ) {2396 // Take a shortcut and set the context if the root selector is an ID2397 tokens = match[0] = match[0].slice( 0 );2398 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&2399 support.getById && context.nodeType === 9 && documentIsHTML &&2400 Expr.relative[ tokens[1].type ] ) {2401 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];2402 if ( !context ) {2403 return results;2404 }2405 selector = selector.slice( tokens.shift().value.length );2406 }2407 // Fetch a seed set for right-to-left matching2408 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;2409 while ( i-- ) {2410 token = tokens[i];2411 // Abort if we hit a combinator2412 if ( Expr.relative[ (type = token.type) ] ) {2413 break;2414 }2415 if ( (find = Expr.find[ type ]) ) {2416 // Search, expanding context for leading sibling combinators2417 if ( (seed = find(2418 token.matches[0].replace( runescape, funescape ),2419 rsibling.test( tokens[0].type ) && context.parentNode || context2420 )) ) {2421 // If seed is empty or no tokens remain, we can return early2422 tokens.splice( i, 1 );2423 selector = seed.length && toSelector( tokens );2424 if ( !selector ) {2425 push.apply( results, seed );2426 return results;2427 }2428 break;2429 }2430 }2431 }2432 }2433 }2434 // Compile and execute a filtering function2435 // Provide `match` to avoid retokenization if we modified the selector above2436 compile( selector, match )(2437 seed,2438 context,2439 !documentIsHTML,2440 results,2441 rsibling.test( selector )2442 );2443 return results;2444}2445// One-time assignments2446// Sort stability2447support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;2448// Support: Chrome<142449// Always assume duplicates if they aren't passed to the comparison function2450support.detectDuplicates = hasDuplicate;2451// Initialize against the default document2452setDocument();2453// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)2454// Detached nodes confoundingly follow *each other*2455support.sortDetached = assert(function( div1 ) {2456 // Should return 1, but returns 4 (following)2457 return div1.compareDocumentPosition( document.createElement("div") ) & 1;2458});2459// Support: IE<82460// Prevent attribute/property "interpolation"2461// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx2462if ( !assert(function( div ) {2463 div.innerHTML = "<a href='#'></a>";2464 return div.firstChild.getAttribute("href") === "#" ;2465}) ) {2466 addHandle( "type|href|height|width", function( elem, name, isXML ) {2467 if ( !isXML ) {2468 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );2469 }2470 });2471}2472// Support: IE<92473// Use defaultValue in place of getAttribute("value")2474if ( !support.attributes || !assert(function( div ) {2475 div.innerHTML = "<input/>";2476 div.firstChild.setAttribute( "value", "" );2477 return div.firstChild.getAttribute( "value" ) === "";2478}) ) {2479 addHandle( "value", function( elem, name, isXML ) {2480 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {2481 return elem.defaultValue;2482 }2483 });2484}2485// Support: IE<92486// Use getAttributeNode to fetch booleans when getAttribute lies2487if ( !assert(function( div ) {2488 return div.getAttribute("disabled") == null;2489}) ) {2490 addHandle( booleans, function( elem, name, isXML ) {2491 var val;2492 if ( !isXML ) {2493 return (val = elem.getAttributeNode( name )) && val.specified ?2494 val.value :2495 elem[ name ] === true ? name.toLowerCase() : null;2496 }2497 });2498}2499jQuery.find = Sizzle;2500jQuery.expr = Sizzle.selectors;2501jQuery.expr[":"] = jQuery.expr.pseudos;2502jQuery.unique = Sizzle.uniqueSort;2503jQuery.text = Sizzle.getText;2504jQuery.isXMLDoc = Sizzle.isXML;2505jQuery.contains = Sizzle.contains;2506})( window );2507// String to Object options format cache2508var optionsCache = {};2509// Convert String-formatted options into Object-formatted ones and store in cache2510function createOptions( options ) {2511 var object = optionsCache[ options ] = {};2512 jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {2513 object[ flag ] = true;2514 });2515 return object;2516}2517/*2518 * Create a callback list using the following parameters:2519 *2520 * options: an optional list of space-separated options that will change how2521 * the callback list behaves or a more traditional option object2522 *2523 * By default a callback list will act like an event callback list and can be2524 * "fired" multiple times.2525 *2526 * Possible options:2527 *2528 * once: will ensure the callback list can only be fired once (like a Deferred)2529 *2530 * memory: will keep track of previous values and will call any callback added2531 * after the list has been fired right away with the latest "memorized"2532 * values (like a Deferred)2533 *2534 * unique: will ensure a callback can only be added once (no duplicate in the list)2535 *2536 * stopOnFalse: interrupt callings when a callback returns false2537 *2538 */2539jQuery.Callbacks = function( options ) {2540 // Convert options from String-formatted to Object-formatted if needed2541 // (we check in cache first)2542 options = typeof options === "string" ?2543 ( optionsCache[ options ] || createOptions( options ) ) :2544 jQuery.extend( {}, options );2545 var // Flag to know if list is currently firing2546 firing,2547 // Last fire value (for non-forgettable lists)2548 memory,2549 // Flag to know if list was already fired2550 fired,2551 // End of the loop when firing2552 firingLength,2553 // Index of currently firing callback (modified by remove if needed)2554 firingIndex,2555 // First callback to fire (used internally by add and fireWith)2556 firingStart,2557 // Actual callback list2558 list = [],2559 // Stack of fire calls for repeatable lists2560 stack = !options.once && [],2561 // Fire callbacks2562 fire = function( data ) {2563 memory = options.memory && data;2564 fired = true;2565 firingIndex = firingStart || 0;2566 firingStart = 0;2567 firingLength = list.length;2568 firing = true;2569 for ( ; list && firingIndex < firingLength; firingIndex++ ) {2570 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {2571 memory = false; // To prevent further calls using add2572 break;2573 }2574 }2575 firing = false;2576 if ( list ) {2577 if ( stack ) {2578 if ( stack.length ) {2579 fire( stack.shift() );2580 }2581 } else if ( memory ) {2582 list = [];2583 } else {2584 self.disable();2585 }2586 }2587 },2588 // Actual Callbacks object2589 self = {2590 // Add a callback or a collection of callbacks to the list2591 add: function() {2592 if ( list ) {2593 // First, we save the current length2594 var start = list.length;2595 (function add( args ) {2596 jQuery.each( args, function( _, arg ) {2597 var type = jQuery.type( arg );2598 if ( type === "function" ) {2599 if ( !options.unique || !self.has( arg ) ) {2600 list.push( arg );2601 }2602 } else if ( arg && arg.length && type !== "string" ) {2603 // Inspect recursively2604 add( arg );2605 }2606 });2607 })( arguments );2608 // Do we need to add the callbacks to the2609 // current firing batch?2610 if ( firing ) {2611 firingLength = list.length;2612 // With memory, if we're not firing then2613 // we should call right away2614 } else if ( memory ) {2615 firingStart = start;2616 fire( memory );2617 }2618 }2619 return this;2620 },2621 // Remove a callback from the list2622 remove: function() {2623 if ( list ) {2624 jQuery.each( arguments, function( _, arg ) {2625 var index;2626 while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {2627 list.splice( index, 1 );2628 // Handle firing indexes2629 if ( firing ) {2630 if ( index <= firingLength ) {2631 firingLength--;2632 }2633 if ( index <= firingIndex ) {2634 firingIndex--;2635 }2636 }2637 }2638 });2639 }2640 return this;2641 },2642 // Check if a given callback is in the list.2643 // If no argument is given, return whether or not list has callbacks attached.2644 has: function( fn ) {2645 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );2646 },2647 // Remove all callbacks from the list2648 empty: function() {2649 list = [];2650 firingLength = 0;2651 return this;2652 },2653 // Have the list do nothing anymore2654 disable: function() {2655 list = stack = memory = undefined;2656 return this;2657 },2658 // Is it disabled?2659 disabled: function() {2660 return !list;2661 },2662 // Lock the list in its current state2663 lock: function() {2664 stack = undefined;2665 if ( !memory ) {2666 self.disable();2667 }2668 return this;2669 },2670 // Is it locked?2671 locked: function() {2672 return !stack;2673 },2674 // Call all callbacks with the given context and arguments2675 fireWith: function( context, args ) {2676 if ( list && ( !fired || stack ) ) {2677 args = args || [];2678 args = [ context, args.slice ? args.slice() : args ];2679 if ( firing ) {2680 stack.push( args );2681 } else {2682 fire( args );2683 }2684 }2685 return this;2686 },2687 // Call all the callbacks with the given arguments2688 fire: function() {2689 self.fireWith( this, arguments );2690 return this;2691 },2692 // To know if the callbacks have already been called at least once2693 fired: function() {2694 return !!fired;2695 }2696 };2697 return self;2698};2699jQuery.extend({2700 Deferred: function( func ) {2701 var tuples = [2702 // action, add listener, listener list, final state2703 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],2704 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],2705 [ "notify", "progress", jQuery.Callbacks("memory") ]2706 ],2707 state = "pending",2708 promise = {2709 state: function() {2710 return state;2711 },2712 always: function() {2713 deferred.done( arguments ).fail( arguments );2714 return this;2715 },2716 then: function( /* fnDone, fnFail, fnProgress */ ) {2717 var fns = arguments;2718 return jQuery.Deferred(function( newDefer ) {2719 jQuery.each( tuples, function( i, tuple ) {2720 var action = tuple[ 0 ],2721 fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];2722 // deferred[ done | fail | progress ] for forwarding actions to newDefer2723 deferred[ tuple[1] ](function() {2724 var returned = fn && fn.apply( this, arguments );2725 if ( returned && jQuery.isFunction( returned.promise ) ) {2726 returned.promise()2727 .done( newDefer.resolve )2728 .fail( newDefer.reject )2729 .progress( newDefer.notify );2730 } else {2731 newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );2732 }2733 });2734 });2735 fns = null;2736 }).promise();2737 },2738 // Get a promise for this deferred2739 // If obj is provided, the promise aspect is added to the object2740 promise: function( obj ) {2741 return obj != null ? jQuery.extend( obj, promise ) : promise;2742 }2743 },2744 deferred = {};2745 // Keep pipe for back-compat2746 promise.pipe = promise.then;2747 // Add list-specific methods2748 jQuery.each( tuples, function( i, tuple ) {2749 var list = tuple[ 2 ],2750 stateString = tuple[ 3 ];2751 // promise[ done | fail | progress ] = list.add2752 promise[ tuple[1] ] = list.add;2753 // Handle state2754 if ( stateString ) {2755 list.add(function() {2756 // state = [ resolved | rejected ]2757 state = stateString;2758 // [ reject_list | resolve_list ].disable; progress_list.lock2759 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );2760 }2761 // deferred[ resolve | reject | notify ]2762 deferred[ tuple[0] ] = function() {2763 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );2764 return this;2765 };2766 deferred[ tuple[0] + "With" ] = list.fireWith;2767 });2768 // Make the deferred a promise2769 promise.promise( deferred );2770 // Call given func if any2771 if ( func ) {2772 func.call( deferred, deferred );2773 }2774 // All done!2775 return deferred;2776 },2777 // Deferred helper2778 when: function( subordinate /* , ..., subordinateN */ ) {2779 var i = 0,2780 resolveValues = core_slice.call( arguments ),2781 length = resolveValues.length,2782 // the count of uncompleted subordinates2783 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,2784 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.2785 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),2786 // Update function for both resolve and progress values2787 updateFunc = function( i, contexts, values ) {2788 return function( value ) {2789 contexts[ i ] = this;2790 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;2791 if( values === progressValues ) {2792 deferred.notifyWith( contexts, values );2793 } else if ( !( --remaining ) ) {2794 deferred.resolveWith( contexts, values );2795 }2796 };2797 },2798 progressValues, progressContexts, resolveContexts;2799 // add listeners to Deferred subordinates; treat others as resolved2800 if ( length > 1 ) {2801 progressValues = new Array( length );2802 progressContexts = new Array( length );2803 resolveContexts = new Array( length );2804 for ( ; i < length; i++ ) {2805 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {2806 resolveValues[ i ].promise()2807 .done( updateFunc( i, resolveContexts, resolveValues ) )2808 .fail( deferred.reject )2809 .progress( updateFunc( i, progressContexts, progressValues ) );2810 } else {2811 --remaining;2812 }2813 }2814 }2815 // if we're not waiting on anything, resolve the master2816 if ( !remaining ) {2817 deferred.resolveWith( resolveContexts, resolveValues );2818 }2819 return deferred.promise();2820 }2821});2822jQuery.support = (function( support ) {2823 var all, a, input, select, fragment, opt, eventName, isSupported, i,2824 div = document.createElement("div");2825 // Setup2826 div.setAttribute( "className", "t" );2827 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";2828 // Finish early in limited (non-browser) environments2829 all = div.getElementsByTagName("*") || [];2830 a = div.getElementsByTagName("a")[ 0 ];2831 if ( !a || !a.style || !all.length ) {2832 return support;2833 }2834 // First batch of tests2835 select = document.createElement("select");2836 opt = select.appendChild( document.createElement("option") );2837 input = div.getElementsByTagName("input")[ 0 ];2838 a.style.cssText = "top:1px;float:left;opacity:.5";2839 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)2840 support.getSetAttribute = div.className !== "t";2841 // IE strips leading whitespace when .innerHTML is used2842 support.leadingWhitespace = div.firstChild.nodeType === 3;2843 // Make sure that tbody elements aren't automatically inserted2844 // IE will insert them into empty tables2845 support.tbody = !div.getElementsByTagName("tbody").length;2846 // Make sure that link elements get serialized correctly by innerHTML2847 // This requires a wrapper element in IE2848 support.htmlSerialize = !!div.getElementsByTagName("link").length;2849 // Get the style information from getAttribute2850 // (IE uses .cssText instead)2851 support.style = /top/.test( a.getAttribute("style") );2852 // Make sure that URLs aren't manipulated2853 // (IE normalizes it by default)2854 support.hrefNormalized = a.getAttribute("href") === "/a";2855 // Make sure that element opacity exists2856 // (IE uses filter instead)2857 // Use a regex to work around a WebKit issue. See #51452858 support.opacity = /^0.5/.test( a.style.opacity );2859 // Verify style float existence2860 // (IE uses styleFloat instead of cssFloat)2861 support.cssFloat = !!a.style.cssFloat;2862 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)2863 support.checkOn = !!input.value;2864 // Make sure that a selected-by-default option has a working selected property.2865 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)2866 support.optSelected = opt.selected;2867 // Tests for enctype support on a form (#6743)2868 support.enctype = !!document.createElement("form").enctype;2869 // Makes sure cloning an html5 element does not cause problems2870 // Where outerHTML is undefined, this still works2871 support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";2872 // Will be defined later2873 support.inlineBlockNeedsLayout = false;2874 support.shrinkWrapBlocks = false;2875 support.pixelPosition = false;2876 support.deleteExpando = true;2877 support.noCloneEvent = true;2878 support.reliableMarginRight = true;2879 support.boxSizingReliable = true;2880 // Make sure checked status is properly cloned2881 input.checked = true;2882 support.noCloneChecked = input.cloneNode( true ).checked;2883 // Make sure that the options inside disabled selects aren't marked as disabled2884 // (WebKit marks them as disabled)2885 select.disabled = true;2886 support.optDisabled = !opt.disabled;2887 // Support: IE<92888 try {2889 delete div.test;2890 } catch( e ) {2891 support.deleteExpando = false;2892 }2893 // Check if we can trust getAttribute("value")2894 input = document.createElement("input");2895 input.setAttribute( "value", "" );2896 support.input = input.getAttribute( "value" ) === "";2897 // Check if an input maintains its value after becoming a radio2898 input.value = "t";2899 input.setAttribute( "type", "radio" );2900 support.radioValue = input.value === "t";2901 // #11217 - WebKit loses check when the name is after the checked attribute2902 input.setAttribute( "checked", "t" );2903 input.setAttribute( "name", "t" );2904 fragment = document.createDocumentFragment();2905 fragment.appendChild( input );2906 // Check if a disconnected checkbox will retain its checked2907 // value of true after appended to the DOM (IE6/7)2908 support.appendChecked = input.checked;2909 // WebKit doesn't clone checked state correctly in fragments2910 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;2911 // Support: IE<92912 // Opera does not clone events (and typeof div.attachEvent === undefined).2913 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()2914 if ( div.attachEvent ) {2915 div.attachEvent( "onclick", function() {2916 support.noCloneEvent = false;2917 });2918 div.cloneNode( true ).click();2919 }2920 // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)2921 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)2922 for ( i in { submit: true, change: true, focusin: true }) {2923 div.setAttribute( eventName = "on" + i, "t" );2924 support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;2925 }2926 div.style.backgroundClip = "content-box";2927 div.cloneNode( true ).style.backgroundClip = "";2928 support.clearCloneStyle = div.style.backgroundClip === "content-box";2929 // Support: IE<92930 // Iteration over object's inherited properties before its own.2931 for ( i in jQuery( support ) ) {2932 break;2933 }2934 support.ownLast = i !== "0";2935 // Run tests that need a body at doc ready2936 jQuery(function() {2937 var container, marginDiv, tds,2938 divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",2939 body = document.getElementsByTagName("body")[0];2940 if ( !body ) {2941 // Return for frameset docs that don't have a body2942 return;2943 }2944 container = document.createElement("div");2945 container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";2946 body.appendChild( container ).appendChild( div );2947 // Support: IE82948 // Check if table cells still have offsetWidth/Height when they are set2949 // to display:none and there are still other visible table cells in a2950 // table row; if so, offsetWidth/Height are not reliable for use when2951 // determining if an element has been hidden directly using2952 // display:none (it is still safe to use offsets if a parent element is2953 // hidden; don safety goggles and see bug #4512 for more information).2954 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";2955 tds = div.getElementsByTagName("td");2956 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";2957 isSupported = ( tds[ 0 ].offsetHeight === 0 );2958 tds[ 0 ].style.display = "";2959 tds[ 1 ].style.display = "none";2960 // Support: IE82961 // Check if empty table cells still have offsetWidth/Height2962 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );2963 // Check box-sizing and margin behavior.2964 div.innerHTML = "";2965 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%;";2966 // Workaround failing boxSizing test due to offsetWidth returning wrong value2967 // with some non-1 values of body zoom, ticket #135432968 jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {2969 support.boxSizing = div.offsetWidth === 4;2970 });2971 // Use window.getComputedStyle because jsdom on node.js will break without it.2972 if ( window.getComputedStyle ) {2973 support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";2974 support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";2975 // Check if div with explicit width and no margin-right incorrectly2976 // gets computed margin-right based on width of container. (#3333)2977 // Fails in WebKit before Feb 2011 nightlies2978 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right2979 marginDiv = div.appendChild( document.createElement("div") );2980 marginDiv.style.cssText = div.style.cssText = divReset;2981 marginDiv.style.marginRight = marginDiv.style.width = "0";2982 div.style.width = "1px";2983 support.reliableMarginRight =2984 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );2985 }2986 if ( typeof div.style.zoom !== core_strundefined ) {2987 // Support: IE<82988 // Check if natively block-level elements act like inline-block2989 // elements when setting their display to 'inline' and giving2990 // them layout2991 div.innerHTML = "";2992 div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";2993 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );2994 // Support: IE62995 // Check if elements with layout shrink-wrap their children2996 div.style.display = "block";2997 div.innerHTML = "<div></div>";2998 div.firstChild.style.width = "5px";2999 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );3000 if ( support.inlineBlockNeedsLayout ) {3001 // Prevent IE 6 from affecting layout for positioned elements #110483002 // Prevent IE from shrinking the body in IE 7 mode #128693003 // Support: IE<83004 body.style.zoom = 1;3005 }3006 }3007 body.removeChild( container );3008 // Null elements to avoid leaks in IE3009 container = div = tds = marginDiv = null;3010 });3011 // Null elements to avoid leaks in IE3012 all = select = fragment = opt = a = input = null;3013 return support;3014})({});3015var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,3016 rmultiDash = /([A-Z])/g;3017function internalData( elem, name, data, pvt /* Internal Use Only */ ){3018 if ( !jQuery.acceptData( elem ) ) {3019 return;3020 }3021 var ret, thisCache,3022 internalKey = jQuery.expando,3023 // We have to handle DOM nodes and JS objects differently because IE6-73024 // can't GC object references properly across the DOM-JS boundary3025 isNode = elem.nodeType,3026 // Only DOM nodes need the global jQuery cache; JS object data is3027 // attached directly to the object so GC can occur automatically3028 cache = isNode ? jQuery.cache : elem,3029 // Only defining an ID for JS objects if its cache already exists allows3030 // the code to shortcut on the same path as a DOM node with no cache3031 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;3032 // Avoid doing any more work than we need to when trying to get data on an3033 // object that has no data at all3034 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {3035 return;3036 }3037 if ( !id ) {3038 // Only DOM nodes need a new unique ID for each element since their data3039 // ends up in the global cache3040 if ( isNode ) {3041 id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;3042 } else {3043 id = internalKey;3044 }3045 }3046 if ( !cache[ id ] ) {3047 // Avoid exposing jQuery metadata on plain JS objects when the object3048 // is serialized using JSON.stringify3049 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };3050 }3051 // An object can be passed to jQuery.data instead of a key/value pair; this gets3052 // shallow copied over onto the existing cache3053 if ( typeof name === "object" || typeof name === "function" ) {3054 if ( pvt ) {3055 cache[ id ] = jQuery.extend( cache[ id ], name );3056 } else {3057 cache[ id ].data = jQuery.extend( cache[ id ].data, name );3058 }3059 }3060 thisCache = cache[ id ];3061 // jQuery data() is stored in a separate object inside the object's internal data3062 // cache in order to avoid key collisions between internal data and user-defined3063 // data.3064 if ( !pvt ) {3065 if ( !thisCache.data ) {3066 thisCache.data = {};3067 }3068 thisCache = thisCache.data;3069 }3070 if ( data !== undefined ) {3071 thisCache[ jQuery.camelCase( name ) ] = data;3072 }3073 // Check for both converted-to-camel and non-converted data property names3074 // If a data property was specified3075 if ( typeof name === "string" ) {3076 // First Try to find as-is property data3077 ret = thisCache[ name ];3078 // Test for null|undefined property data3079 if ( ret == null ) {3080 // Try to find the camelCased property3081 ret = thisCache[ jQuery.camelCase( name ) ];3082 }3083 } else {3084 ret = thisCache;3085 }3086 return ret;3087}3088function internalRemoveData( elem, name, pvt ) {3089 if ( !jQuery.acceptData( elem ) ) {3090 return;3091 }3092 var thisCache, i,3093 isNode = elem.nodeType,3094 // See jQuery.data for more information3095 cache = isNode ? jQuery.cache : elem,3096 id = isNode ? elem[ jQuery.expando ] : jQuery.expando;3097 // If there is already no cache entry for this object, there is no3098 // purpose in continuing3099 if ( !cache[ id ] ) {3100 return;3101 }3102 if ( name ) {3103 thisCache = pvt ? cache[ id ] : cache[ id ].data;3104 if ( thisCache ) {3105 // Support array or space separated string names for data keys3106 if ( !jQuery.isArray( name ) ) {3107 // try the string as a key before any manipulation3108 if ( name in thisCache ) {3109 name = [ name ];3110 } else {3111 // split the camel cased version by spaces unless a key with the spaces exists3112 name = jQuery.camelCase( name );3113 if ( name in thisCache ) {3114 name = [ name ];3115 } else {3116 name = name.split(" ");3117 }3118 }3119 } else {3120 // If "name" is an array of keys...3121 // When data is initially created, via ("key", "val") signature,3122 // keys will be converted to camelCase.3123 // Since there is no way to tell _how_ a key was added, remove3124 // both plain key and camelCase key. #127863125 // This will only penalize the array argument path.3126 name = name.concat( jQuery.map( name, jQuery.camelCase ) );3127 }3128 i = name.length;3129 while ( i-- ) {3130 delete thisCache[ name[i] ];3131 }3132 // If there is no data left in the cache, we want to continue3133 // and let the cache object itself get destroyed3134 if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {3135 return;3136 }3137 }3138 }3139 // See jQuery.data for more information3140 if ( !pvt ) {3141 delete cache[ id ].data;3142 // Don't destroy the parent cache unless the internal data object3143 // had been the only thing left in it3144 if ( !isEmptyDataObject( cache[ id ] ) ) {3145 return;3146 }3147 }3148 // Destroy the cache3149 if ( isNode ) {3150 jQuery.cleanData( [ elem ], true );3151 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)3152 /* jshint eqeqeq: false */3153 } else if ( jQuery.support.deleteExpando || cache != cache.window ) {3154 /* jshint eqeqeq: true */3155 delete cache[ id ];3156 // When all else fails, null3157 } else {3158 cache[ id ] = null;3159 }3160}3161jQuery.extend({3162 cache: {},3163 // The following elements throw uncatchable exceptions if you3164 // attempt to add expando properties to them.3165 noData: {3166 "applet": true,3167 "embed": true,3168 // Ban all objects except for Flash (which handle expandos)3169 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"3170 },3171 hasData: function( elem ) {3172 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];3173 return !!elem && !isEmptyDataObject( elem );3174 },3175 data: function( elem, name, data ) {3176 return internalData( elem, name, data );3177 },3178 removeData: function( elem, name ) {3179 return internalRemoveData( elem, name );3180 },3181 // For internal use only.3182 _data: function( elem, name, data ) {3183 return internalData( elem, name, data, true );3184 },3185 _removeData: function( elem, name ) {3186 return internalRemoveData( elem, name, true );3187 },3188 // A method for determining if a DOM node can handle the data expando3189 acceptData: function( elem ) {3190 // Do not set data on non-element because it will not be cleared (#8335).3191 if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {3192 return false;3193 }3194 var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];3195 // nodes accept data unless otherwise specified; rejection can be conditional3196 return !noData || noData !== true && elem.getAttribute("classid") === noData;3197 }3198});3199jQuery.fn.extend({3200 data: function( key, value ) {3201 var attrs, name,3202 data = null,3203 i = 0,3204 elem = this[0];3205 // Special expections of .data basically thwart jQuery.access,3206 // so implement the relevant behavior ourselves3207 // Gets all values3208 if ( key === undefined ) {3209 if ( this.length ) {3210 data = jQuery.data( elem );3211 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {3212 attrs = elem.attributes;3213 for ( ; i < attrs.length; i++ ) {3214 name = attrs[i].name;3215 if ( name.indexOf("data-") === 0 ) {3216 name = jQuery.camelCase( name.slice(5) );3217 dataAttr( elem, name, data[ name ] );3218 }3219 }3220 jQuery._data( elem, "parsedAttrs", true );3221 }3222 }3223 return data;3224 }3225 // Sets multiple values3226 if ( typeof key === "object" ) {3227 return this.each(function() {3228 jQuery.data( this, key );3229 });3230 }3231 return arguments.length > 1 ?3232 // Sets one value3233 this.each(function() {3234 jQuery.data( this, key, value );3235 }) :3236 // Gets one value3237 // Try to fetch any internally stored data first3238 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;3239 },3240 removeData: function( key ) {3241 return this.each(function() {3242 jQuery.removeData( this, key );3243 });3244 }3245});3246function dataAttr( elem, key, data ) {3247 // If nothing was found internally, try to fetch any3248 // data from the HTML5 data-* attribute3249 if ( data === undefined && elem.nodeType === 1 ) {3250 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();3251 data = elem.getAttribute( name );3252 if ( typeof data === "string" ) {3253 try {3254 data = data === "true" ? true :3255 data === "false" ? false :3256 data === "null" ? null :3257 // Only convert to a number if it doesn't change the string3258 +data + "" === data ? +data :3259 rbrace.test( data ) ? jQuery.parseJSON( data ) :3260 data;3261 } catch( e ) {}3262 // Make sure we set the data so it isn't changed later3263 jQuery.data( elem, key, data );3264 } else {3265 data = undefined;3266 }3267 }3268 return data;3269}3270// checks a cache object for emptiness3271function isEmptyDataObject( obj ) {3272 var name;3273 for ( name in obj ) {3274 // if the public data object is empty, the private is still empty3275 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {3276 continue;3277 }3278 if ( name !== "toJSON" ) {3279 return false;3280 }3281 }3282 return true;3283}3284jQuery.extend({3285 queue: function( elem, type, data ) {3286 var queue;3287 if ( elem ) {3288 type = ( type || "fx" ) + "queue";3289 queue = jQuery._data( elem, type );3290 // Speed up dequeue by getting out quickly if this is just a lookup3291 if ( data ) {3292 if ( !queue || jQuery.isArray(data) ) {3293 queue = jQuery._data( elem, type, jQuery.makeArray(data) );3294 } else {3295 queue.push( data );3296 }3297 }3298 return queue || [];3299 }3300 },3301 dequeue: function( elem, type ) {3302 type = type || "fx";3303 var queue = jQuery.queue( elem, type ),3304 startLength = queue.length,3305 fn = queue.shift(),3306 hooks = jQuery._queueHooks( elem, type ),3307 next = function() {3308 jQuery.dequeue( elem, type );3309 };3310 // If the fx queue is dequeued, always remove the progress sentinel3311 if ( fn === "inprogress" ) {3312 fn = queue.shift();3313 startLength--;3314 }3315 if ( fn ) {3316 // Add a progress sentinel to prevent the fx queue from being3317 // automatically dequeued3318 if ( type === "fx" ) {3319 queue.unshift( "inprogress" );3320 }3321 // clear up the last queue stop function3322 delete hooks.stop;3323 fn.call( elem, next, hooks );3324 }3325 if ( !startLength && hooks ) {3326 hooks.empty.fire();3327 }3328 },3329 // not intended for public consumption - generates a queueHooks object, or returns the current one3330 _queueHooks: function( elem, type ) {3331 var key = type + "queueHooks";3332 return jQuery._data( elem, key ) || jQuery._data( elem, key, {3333 empty: jQuery.Callbacks("once memory").add(function() {3334 jQuery._removeData( elem, type + "queue" );3335 jQuery._removeData( elem, key );3336 })3337 });3338 }3339});3340jQuery.fn.extend({3341 queue: function( type, data ) {3342 var setter = 2;3343 if ( typeof type !== "string" ) {3344 data = type;3345 type = "fx";3346 setter--;3347 }3348 if ( arguments.length < setter ) {3349 return jQuery.queue( this[0], type );3350 }3351 return data === undefined ?3352 this :3353 this.each(function() {3354 var queue = jQuery.queue( this, type, data );3355 // ensure a hooks for this queue3356 jQuery._queueHooks( this, type );3357 if ( type === "fx" && queue[0] !== "inprogress" ) {3358 jQuery.dequeue( this, type );3359 }3360 });3361 },3362 dequeue: function( type ) {3363 return this.each(function() {3364 jQuery.dequeue( this, type );3365 });3366 },3367 // Based off of the plugin by Clint Helfers, with permission.3368 // http://blindsignals.com/index.php/2009/07/jquery-delay/3369 delay: function( time, type ) {3370 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;3371 type = type || "fx";3372 return this.queue( type, function( next, hooks ) {3373 var timeout = setTimeout( next, time );3374 hooks.stop = function() {3375 clearTimeout( timeout );3376 };3377 });3378 },3379 clearQueue: function( type ) {3380 return this.queue( type || "fx", [] );3381 },3382 // Get a promise resolved when queues of a certain type3383 // are emptied (fx is the type by default)3384 promise: function( type, obj ) {3385 var tmp,3386 count = 1,3387 defer = jQuery.Deferred(),3388 elements = this,3389 i = this.length,3390 resolve = function() {3391 if ( !( --count ) ) {3392 defer.resolveWith( elements, [ elements ] );3393 }3394 };3395 if ( typeof type !== "string" ) {3396 obj = type;3397 type = undefined;3398 }3399 type = type || "fx";3400 while( i-- ) {3401 tmp = jQuery._data( elements[ i ], type + "queueHooks" );3402 if ( tmp && tmp.empty ) {3403 count++;3404 tmp.empty.add( resolve );3405 }3406 }3407 resolve();3408 return defer.promise( obj );3409 }3410});3411var nodeHook, boolHook,3412 rclass = /[\t\r\n\f]/g,3413 rreturn = /\r/g,3414 rfocusable = /^(?:input|select|textarea|button|object)$/i,3415 rclickable = /^(?:a|area)$/i,3416 ruseDefault = /^(?:checked|selected)$/i,3417 getSetAttribute = jQuery.support.getSetAttribute,3418 getSetInput = jQuery.support.input;3419jQuery.fn.extend({3420 attr: function( name, value ) {3421 return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );3422 },3423 removeAttr: function( name ) {3424 return this.each(function() {3425 jQuery.removeAttr( this, name );3426 });3427 },3428 prop: function( name, value ) {3429 return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );3430 },3431 removeProp: function( name ) {3432 name = jQuery.propFix[ name ] || name;3433 return this.each(function() {3434 // try/catch handles cases where IE balks (such as removing a property on window)3435 try {3436 this[ name ] = undefined;3437 delete this[ name ];3438 } catch( e ) {}3439 });3440 },3441 addClass: function( value ) {3442 var classes, elem, cur, clazz, j,3443 i = 0,3444 len = this.length,3445 proceed = typeof value === "string" && value;3446 if ( jQuery.isFunction( value ) ) {3447 return this.each(function( j ) {3448 jQuery( this ).addClass( value.call( this, j, this.className ) );3449 });3450 }3451 if ( proceed ) {3452 // The disjunction here is for better compressibility (see removeClass)3453 classes = ( value || "" ).match( core_rnotwhite ) || [];3454 for ( ; i < len; i++ ) {3455 elem = this[ i ];3456 cur = elem.nodeType === 1 && ( elem.className ?3457 ( " " + elem.className + " " ).replace( rclass, " " ) :3458 " "3459 );3460 if ( cur ) {3461 j = 0;3462 while ( (clazz = classes[j++]) ) {3463 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {3464 cur += clazz + " ";3465 }3466 }3467 elem.className = jQuery.trim( cur );3468 }3469 }3470 }3471 return this;3472 },3473 removeClass: function( value ) {3474 var classes, elem, cur, clazz, j,3475 i = 0,3476 len = this.length,3477 proceed = arguments.length === 0 || typeof value === "string" && value;3478 if ( jQuery.isFunction( value ) ) {3479 return this.each(function( j ) {3480 jQuery( this ).removeClass( value.call( this, j, this.className ) );3481 });3482 }3483 if ( proceed ) {3484 classes = ( value || "" ).match( core_rnotwhite ) || [];3485 for ( ; i < len; i++ ) {3486 elem = this[ i ];3487 // This expression is here for better compressibility (see addClass)3488 cur = elem.nodeType === 1 && ( elem.className ?3489 ( " " + elem.className + " " ).replace( rclass, " " ) :3490 ""3491 );3492 if ( cur ) {3493 j = 0;3494 while ( (clazz = classes[j++]) ) {3495 // Remove *all* instances3496 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {3497 cur = cur.replace( " " + clazz + " ", " " );3498 }3499 }3500 elem.className = value ? jQuery.trim( cur ) : "";3501 }3502 }3503 }3504 return this;3505 },3506 toggleClass: function( value, stateVal ) {3507 var type = typeof value;3508 if ( typeof stateVal === "boolean" && type === "string" ) {3509 return stateVal ? this.addClass( value ) : this.removeClass( value );3510 }3511 if ( jQuery.isFunction( value ) ) {3512 return this.each(function( i ) {3513 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );3514 });3515 }3516 return this.each(function() {3517 if ( type === "string" ) {3518 // toggle individual class names3519 var className,3520 i = 0,3521 self = jQuery( this ),3522 classNames = value.match( core_rnotwhite ) || [];3523 while ( (className = classNames[ i++ ]) ) {3524 // check each className given, space separated list3525 if ( self.hasClass( className ) ) {3526 self.removeClass( className );3527 } else {3528 self.addClass( className );3529 }3530 }3531 // Toggle whole class name3532 } else if ( type === core_strundefined || type === "boolean" ) {3533 if ( this.className ) {3534 // store className if set3535 jQuery._data( this, "__className__", this.className );3536 }3537 // If the element has a class name or if we're passed "false",3538 // then remove the whole classname (if there was one, the above saved it).3539 // Otherwise bring back whatever was previously saved (if anything),3540 // falling back to the empty string if nothing was stored.3541 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";3542 }3543 });3544 },3545 hasClass: function( selector ) {3546 var className = " " + selector + " ",3547 i = 0,3548 l = this.length;3549 for ( ; i < l; i++ ) {3550 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {3551 return true;3552 }3553 }3554 return false;3555 },3556 val: function( value ) {3557 var ret, hooks, isFunction,3558 elem = this[0];3559 if ( !arguments.length ) {3560 if ( elem ) {3561 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];3562 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {3563 return ret;3564 }3565 ret = elem.value;3566 return typeof ret === "string" ?3567 // handle most common string cases3568 ret.replace(rreturn, "") :3569 // handle cases where value is null/undef or number3570 ret == null ? "" : ret;3571 }3572 return;3573 }3574 isFunction = jQuery.isFunction( value );3575 return this.each(function( i ) {3576 var val;3577 if ( this.nodeType !== 1 ) {3578 return;3579 }3580 if ( isFunction ) {3581 val = value.call( this, i, jQuery( this ).val() );3582 } else {3583 val = value;3584 }3585 // Treat null/undefined as ""; convert numbers to string3586 if ( val == null ) {3587 val = "";3588 } else if ( typeof val === "number" ) {3589 val += "";3590 } else if ( jQuery.isArray( val ) ) {3591 val = jQuery.map(val, function ( value ) {3592 return value == null ? "" : value + "";3593 });3594 }3595 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];3596 // If set returns undefined, fall back to normal setting3597 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {3598 this.value = val;3599 }3600 });3601 }3602});3603jQuery.extend({3604 valHooks: {3605 option: {3606 get: function( elem ) {3607 // Use proper attribute retrieval(#6932, #12072)3608 var val = jQuery.find.attr( elem, "value" );3609 return val != null ?3610 val :3611 elem.text;3612 }3613 },3614 select: {3615 get: function( elem ) {3616 var value, option,3617 options = elem.options,3618 index = elem.selectedIndex,3619 one = elem.type === "select-one" || index < 0,3620 values = one ? null : [],3621 max = one ? index + 1 : options.length,3622 i = index < 0 ?3623 max :3624 one ? index : 0;3625 // Loop through all the selected options3626 for ( ; i < max; i++ ) {3627 option = options[ i ];3628 // oldIE doesn't update selected after form reset (#2551)3629 if ( ( option.selected || i === index ) &&3630 // Don't return options that are disabled or in a disabled optgroup3631 ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&3632 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {3633 // Get the specific value for the option3634 value = jQuery( option ).val();3635 // We don't need an array for one selects3636 if ( one ) {3637 return value;3638 }3639 // Multi-Selects return an array3640 values.push( value );3641 }3642 }3643 return values;3644 },3645 set: function( elem, value ) {3646 var optionSet, option,3647 options = elem.options,3648 values = jQuery.makeArray( value ),3649 i = options.length;3650 while ( i-- ) {3651 option = options[ i ];3652 if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {3653 optionSet = true;3654 }3655 }3656 // force browsers to behave consistently when non-matching value is set3657 if ( !optionSet ) {3658 elem.selectedIndex = -1;3659 }3660 return values;3661 }3662 }3663 },3664 attr: function( elem, name, value ) {3665 var hooks, ret,3666 nType = elem.nodeType;3667 // don't get/set attributes on text, comment and attribute nodes3668 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {3669 return;3670 }3671 // Fallback to prop when attributes are not supported3672 if ( typeof elem.getAttribute === core_strundefined ) {3673 return jQuery.prop( elem, name, value );3674 }3675 // All attributes are lowercase3676 // Grab necessary hook if one is defined3677 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {3678 name = name.toLowerCase();3679 hooks = jQuery.attrHooks[ name ] ||3680 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );3681 }3682 if ( value !== undefined ) {3683 if ( value === null ) {3684 jQuery.removeAttr( elem, name );3685 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {3686 return ret;3687 } else {3688 elem.setAttribute( name, value + "" );3689 return value;3690 }3691 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {3692 return ret;3693 } else {3694 ret = jQuery.find.attr( elem, name );3695 // Non-existent attributes return null, we normalize to undefined3696 return ret == null ?3697 undefined :3698 ret;3699 }3700 },3701 removeAttr: function( elem, value ) {3702 var name, propName,3703 i = 0,3704 attrNames = value && value.match( core_rnotwhite );3705 if ( attrNames && elem.nodeType === 1 ) {3706 while ( (name = attrNames[i++]) ) {3707 propName = jQuery.propFix[ name ] || name;3708 // Boolean attributes get special treatment (#10870)3709 if ( jQuery.expr.match.bool.test( name ) ) {3710 // Set corresponding property to false3711 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {3712 elem[ propName ] = false;3713 // Support: IE<93714 // Also clear defaultChecked/defaultSelected (if appropriate)3715 } else {3716 elem[ jQuery.camelCase( "default-" + name ) ] =3717 elem[ propName ] = false;3718 }3719 // See #9699 for explanation of this approach (setting first, then removal)3720 } else {3721 jQuery.attr( elem, name, "" );3722 }3723 elem.removeAttribute( getSetAttribute ? name : propName );3724 }3725 }3726 },3727 attrHooks: {3728 type: {3729 set: function( elem, value ) {3730 if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {3731 // Setting the type on a radio button after the value resets the value in IE6-93732 // Reset value to default in case type is set after value during creation3733 var val = elem.value;3734 elem.setAttribute( "type", value );3735 if ( val ) {3736 elem.value = val;3737 }3738 return value;3739 }3740 }3741 }3742 },3743 propFix: {3744 "for": "htmlFor",3745 "class": "className"3746 },3747 prop: function( elem, name, value ) {3748 var ret, hooks, notxml,3749 nType = elem.nodeType;3750 // don't get/set properties on text, comment and attribute nodes3751 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {3752 return;3753 }3754 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );3755 if ( notxml ) {3756 // Fix name and attach hooks3757 name = jQuery.propFix[ name ] || name;3758 hooks = jQuery.propHooks[ name ];3759 }3760 if ( value !== undefined ) {3761 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?3762 ret :3763 ( elem[ name ] = value );3764 } else {3765 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?3766 ret :3767 elem[ name ];3768 }3769 },3770 propHooks: {3771 tabIndex: {3772 get: function( elem ) {3773 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set3774 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/3775 // Use proper attribute retrieval(#12072)3776 var tabindex = jQuery.find.attr( elem, "tabindex" );3777 return tabindex ?3778 parseInt( tabindex, 10 ) :3779 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?3780 0 :3781 -1;3782 }3783 }3784 }3785});3786// Hooks for boolean attributes3787boolHook = {3788 set: function( elem, value, name ) {3789 if ( value === false ) {3790 // Remove boolean attributes when set to false3791 jQuery.removeAttr( elem, name );3792 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {3793 // IE<8 needs the *property* name3794 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );3795 // Use defaultChecked and defaultSelected for oldIE3796 } else {3797 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;3798 }3799 return name;3800 }3801};3802jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {3803 var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;3804 jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?3805 function( elem, name, isXML ) {3806 var fn = jQuery.expr.attrHandle[ name ],3807 ret = isXML ?3808 undefined :3809 /* jshint eqeqeq: false */3810 (jQuery.expr.attrHandle[ name ] = undefined) !=3811 getter( elem, name, isXML ) ?3812 name.toLowerCase() :3813 null;3814 jQuery.expr.attrHandle[ name ] = fn;3815 return ret;3816 } :3817 function( elem, name, isXML ) {3818 return isXML ?3819 undefined :3820 elem[ jQuery.camelCase( "default-" + name ) ] ?3821 name.toLowerCase() :3822 null;3823 };3824});3825// fix oldIE attroperties3826if ( !getSetInput || !getSetAttribute ) {3827 jQuery.attrHooks.value = {3828 set: function( elem, value, name ) {3829 if ( jQuery.nodeName( elem, "input" ) ) {3830 // Does not return so that setAttribute is also used3831 elem.defaultValue = value;3832 } else {3833 // Use nodeHook if defined (#1954); otherwise setAttribute is fine3834 return nodeHook && nodeHook.set( elem, value, name );3835 }3836 }3837 };3838}3839// IE6/7 do not support getting/setting some attributes with get/setAttribute3840if ( !getSetAttribute ) {3841 // Use this for any attribute in IE6/73842 // This fixes almost every IE6/7 issue3843 nodeHook = {3844 set: function( elem, value, name ) {3845 // Set the existing or create a new attribute node3846 var ret = elem.getAttributeNode( name );3847 if ( !ret ) {3848 elem.setAttributeNode(3849 (ret = elem.ownerDocument.createAttribute( name ))3850 );3851 }3852 ret.value = value += "";3853 // Break association with cloned elements by also using setAttribute (#9646)3854 return name === "value" || value === elem.getAttribute( name ) ?3855 value :3856 undefined;3857 }3858 };3859 jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =3860 // Some attributes are constructed with empty-string values when not defined3861 function( elem, name, isXML ) {3862 var ret;3863 return isXML ?3864 undefined :3865 (ret = elem.getAttributeNode( name )) && ret.value !== "" ?3866 ret.value :3867 null;3868 };3869 jQuery.valHooks.button = {3870 get: function( elem, name ) {3871 var ret = elem.getAttributeNode( name );3872 return ret && ret.specified ?3873 ret.value :3874 undefined;3875 },3876 set: nodeHook.set3877 };3878 // Set contenteditable to false on removals(#10429)3879 // Setting to empty string throws an error as an invalid value3880 jQuery.attrHooks.contenteditable = {3881 set: function( elem, value, name ) {3882 nodeHook.set( elem, value === "" ? false : value, name );3883 }3884 };3885 // Set width and height to auto instead of 0 on empty string( Bug #8150 )3886 // This is for removals3887 jQuery.each([ "width", "height" ], function( i, name ) {3888 jQuery.attrHooks[ name ] = {3889 set: function( elem, value ) {3890 if ( value === "" ) {3891 elem.setAttribute( name, "auto" );3892 return value;3893 }3894 }3895 };3896 });3897}3898// Some attributes require a special call on IE3899// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx3900if ( !jQuery.support.hrefNormalized ) {3901 // href/src property should get the full normalized URL (#10299/#12915)3902 jQuery.each([ "href", "src" ], function( i, name ) {3903 jQuery.propHooks[ name ] = {3904 get: function( elem ) {3905 return elem.getAttribute( name, 4 );3906 }3907 };3908 });3909}3910if ( !jQuery.support.style ) {3911 jQuery.attrHooks.style = {3912 get: function( elem ) {3913 // Return undefined in the case of empty string3914 // Note: IE uppercases css property names, but if we were to .toLowerCase()3915 // .cssText, that would destroy case senstitivity in URL's, like in "background"3916 return elem.style.cssText || undefined;3917 },3918 set: function( elem, value ) {3919 return ( elem.style.cssText = value + "" );3920 }3921 };3922}3923// Safari mis-reports the default selected property of an option3924// Accessing the parent's selectedIndex property fixes it3925if ( !jQuery.support.optSelected ) {3926 jQuery.propHooks.selected = {3927 get: function( elem ) {3928 var parent = elem.parentNode;3929 if ( parent ) {3930 parent.selectedIndex;3931 // Make sure that it also works with optgroups, see #57013932 if ( parent.parentNode ) {3933 parent.parentNode.selectedIndex;3934 }3935 }3936 return null;3937 }3938 };3939}3940jQuery.each([3941 "tabIndex",3942 "readOnly",3943 "maxLength",3944 "cellSpacing",3945 "cellPadding",3946 "rowSpan",3947 "colSpan",3948 "useMap",3949 "frameBorder",3950 "contentEditable"3951], function() {3952 jQuery.propFix[ this.toLowerCase() ] = this;3953});3954// IE6/7 call enctype encoding3955if ( !jQuery.support.enctype ) {3956 jQuery.propFix.enctype = "encoding";3957}3958// Radios and checkboxes getter/setter3959jQuery.each([ "radio", "checkbox" ], function() {3960 jQuery.valHooks[ this ] = {3961 set: function( elem, value ) {3962 if ( jQuery.isArray( value ) ) {3963 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );3964 }3965 }3966 };3967 if ( !jQuery.support.checkOn ) {3968 jQuery.valHooks[ this ].get = function( elem ) {3969 // Support: Webkit3970 // "" is returned instead of "on" if a value isn't specified3971 return elem.getAttribute("value") === null ? "on" : elem.value;3972 };3973 }3974});3975var rformElems = /^(?:input|select|textarea)$/i,3976 rkeyEvent = /^key/,3977 rmouseEvent = /^(?:mouse|contextmenu)|click/,3978 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,3979 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;3980function returnTrue() {3981 return true;3982}3983function returnFalse() {3984 return false;3985}3986function safeActiveElement() {3987 try {3988 return document.activeElement;3989 } catch ( err ) { }3990}3991/*3992 * Helper functions for managing events -- not part of the public interface.3993 * Props to Dean Edwards' addEvent library for many of the ideas.3994 */3995jQuery.event = {3996 global: {},3997 add: function( elem, types, handler, data, selector ) {3998 var tmp, events, t, handleObjIn,3999 special, eventHandle, handleObj,4000 handlers, type, namespaces, origType,4001 elemData = jQuery._data( elem );4002 // Don't attach events to noData or text/comment nodes (but allow plain objects)4003 if ( !elemData ) {4004 return;4005 }4006 // Caller can pass in an object of custom data in lieu of the handler4007 if ( handler.handler ) {4008 handleObjIn = handler;4009 handler = handleObjIn.handler;4010 selector = handleObjIn.selector;4011 }4012 // Make sure that the handler has a unique ID, used to find/remove it later4013 if ( !handler.guid ) {4014 handler.guid = jQuery.guid++;4015 }4016 // Init the element's event structure and main handler, if this is the first4017 if ( !(events = elemData.events) ) {4018 events = elemData.events = {};4019 }4020 if ( !(eventHandle = elemData.handle) ) {4021 eventHandle = elemData.handle = function( e ) {4022 // Discard the second event of a jQuery.event.trigger() and4023 // when an event is called after a page has unloaded4024 return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?4025 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :4026 undefined;4027 };4028 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events4029 eventHandle.elem = elem;4030 }4031 // Handle multiple events separated by a space4032 types = ( types || "" ).match( core_rnotwhite ) || [""];4033 t = types.length;4034 while ( t-- ) {4035 tmp = rtypenamespace.exec( types[t] ) || [];4036 type = origType = tmp[1];4037 namespaces = ( tmp[2] || "" ).split( "." ).sort();4038 // There *must* be a type, no attaching namespace-only handlers4039 if ( !type ) {4040 continue;4041 }4042 // If event changes its type, use the special event handlers for the changed type4043 special = jQuery.event.special[ type ] || {};4044 // If selector defined, determine special event api type, otherwise given type4045 type = ( selector ? special.delegateType : special.bindType ) || type;4046 // Update special based on newly reset type4047 special = jQuery.event.special[ type ] || {};4048 // handleObj is passed to all event handlers4049 handleObj = jQuery.extend({4050 type: type,4051 origType: origType,4052 data: data,4053 handler: handler,4054 guid: handler.guid,4055 selector: selector,4056 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),4057 namespace: namespaces.join(".")4058 }, handleObjIn );4059 // Init the event handler queue if we're the first4060 if ( !(handlers = events[ type ]) ) {4061 handlers = events[ type ] = [];4062 handlers.delegateCount = 0;4063 // Only use addEventListener/attachEvent if the special events handler returns false4064 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {4065 // Bind the global event handler to the element4066 if ( elem.addEventListener ) {4067 elem.addEventListener( type, eventHandle, false );4068 } else if ( elem.attachEvent ) {4069 elem.attachEvent( "on" + type, eventHandle );4070 }4071 }4072 }4073 if ( special.add ) {4074 special.add.call( elem, handleObj );4075 if ( !handleObj.handler.guid ) {4076 handleObj.handler.guid = handler.guid;4077 }4078 }4079 // Add to the element's handler list, delegates in front4080 if ( selector ) {4081 handlers.splice( handlers.delegateCount++, 0, handleObj );4082 } else {4083 handlers.push( handleObj );4084 }4085 // Keep track of which events have ever been used, for event optimization4086 jQuery.event.global[ type ] = true;4087 }4088 // Nullify elem to prevent memory leaks in IE4089 elem = null;4090 },4091 // Detach an event or set of events from an element4092 remove: function( elem, types, handler, selector, mappedTypes ) {4093 var j, handleObj, tmp,4094 origCount, t, events,4095 special, handlers, type,4096 namespaces, origType,4097 elemData = jQuery.hasData( elem ) && jQuery._data( elem );4098 if ( !elemData || !(events = elemData.events) ) {4099 return;4100 }4101 // Once for each type.namespace in types; type may be omitted4102 types = ( types || "" ).match( core_rnotwhite ) || [""];4103 t = types.length;4104 while ( t-- ) {4105 tmp = rtypenamespace.exec( types[t] ) || [];4106 type = origType = tmp[1];4107 namespaces = ( tmp[2] || "" ).split( "." ).sort();4108 // Unbind all events (on this namespace, if provided) for the element4109 if ( !type ) {4110 for ( type in events ) {4111 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );4112 }4113 continue;4114 }4115 special = jQuery.event.special[ type ] || {};4116 type = ( selector ? special.delegateType : special.bindType ) || type;4117 handlers = events[ type ] || [];4118 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );4119 // Remove matching events4120 origCount = j = handlers.length;4121 while ( j-- ) {4122 handleObj = handlers[ j ];4123 if ( ( mappedTypes || origType === handleObj.origType ) &&4124 ( !handler || handler.guid === handleObj.guid ) &&4125 ( !tmp || tmp.test( handleObj.namespace ) ) &&4126 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {4127 handlers.splice( j, 1 );4128 if ( handleObj.selector ) {4129 handlers.delegateCount--;4130 }4131 if ( special.remove ) {4132 special.remove.call( elem, handleObj );4133 }4134 }4135 }4136 // Remove generic event handler if we removed something and no more handlers exist4137 // (avoids potential for endless recursion during removal of special event handlers)4138 if ( origCount && !handlers.length ) {4139 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {4140 jQuery.removeEvent( elem, type, elemData.handle );4141 }4142 delete events[ type ];4143 }4144 }4145 // Remove the expando if it's no longer used4146 if ( jQuery.isEmptyObject( events ) ) {4147 delete elemData.handle;4148 // removeData also checks for emptiness and clears the expando if empty4149 // so use it instead of delete4150 jQuery._removeData( elem, "events" );4151 }4152 },4153 trigger: function( event, data, elem, onlyHandlers ) {4154 var handle, ontype, cur,4155 bubbleType, special, tmp, i,4156 eventPath = [ elem || document ],4157 type = core_hasOwn.call( event, "type" ) ? event.type : event,4158 namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];4159 cur = tmp = elem = elem || document;4160 // Don't do events on text and comment nodes4161 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {4162 return;4163 }4164 // focus/blur morphs to focusin/out; ensure we're not firing them right now4165 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {4166 return;4167 }4168 if ( type.indexOf(".") >= 0 ) {4169 // Namespaced trigger; create a regexp to match event type in handle()4170 namespaces = type.split(".");4171 type = namespaces.shift();4172 namespaces.sort();4173 }4174 ontype = type.indexOf(":") < 0 && "on" + type;4175 // Caller can pass in a jQuery.Event object, Object, or just an event type string4176 event = event[ jQuery.expando ] ?4177 event :4178 new jQuery.Event( type, typeof event === "object" && event );4179 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)4180 event.isTrigger = onlyHandlers ? 2 : 3;4181 event.namespace = namespaces.join(".");4182 event.namespace_re = event.namespace ?4183 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :4184 null;4185 // Clean up the event in case it is being reused4186 event.result = undefined;4187 if ( !event.target ) {4188 event.target = elem;4189 }4190 // Clone any incoming data and prepend the event, creating the handler arg list4191 data = data == null ?4192 [ event ] :4193 jQuery.makeArray( data, [ event ] );4194 // Allow special events to draw outside the lines4195 special = jQuery.event.special[ type ] || {};4196 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {4197 return;4198 }4199 // Determine event propagation path in advance, per W3C events spec (#9951)4200 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)4201 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {4202 bubbleType = special.delegateType || type;4203 if ( !rfocusMorph.test( bubbleType + type ) ) {4204 cur = cur.parentNode;4205 }4206 for ( ; cur; cur = cur.parentNode ) {4207 eventPath.push( cur );4208 tmp = cur;4209 }4210 // Only add window if we got to document (e.g., not plain obj or detached DOM)4211 if ( tmp === (elem.ownerDocument || document) ) {4212 eventPath.push( tmp.defaultView || tmp.parentWindow || window );4213 }4214 }4215 // Fire handlers on the event path4216 i = 0;4217 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {4218 event.type = i > 1 ?4219 bubbleType :4220 special.bindType || type;4221 // jQuery handler4222 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );4223 if ( handle ) {4224 handle.apply( cur, data );4225 }4226 // Native handler4227 handle = ontype && cur[ ontype ];4228 if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {4229 event.preventDefault();4230 }4231 }4232 event.type = type;4233 // If nobody prevented the default action, do it now4234 if ( !onlyHandlers && !event.isDefaultPrevented() ) {4235 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&4236 jQuery.acceptData( elem ) ) {4237 // Call a native DOM method on the target with the same name name as the event.4238 // Can't use an .isFunction() check here because IE6/7 fails that test.4239 // Don't do default actions on window, that's where global variables be (#6170)4240 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {4241 // Don't re-trigger an onFOO event when we call its FOO() method4242 tmp = elem[ ontype ];4243 if ( tmp ) {4244 elem[ ontype ] = null;4245 }4246 // Prevent re-triggering of the same event, since we already bubbled it above4247 jQuery.event.triggered = type;4248 try {4249 elem[ type ]();4250 } catch ( e ) {4251 // IE<9 dies on focus/blur to hidden element (#1486,#12518)4252 // only reproducible on winXP IE8 native, not IE9 in IE8 mode4253 }4254 jQuery.event.triggered = undefined;4255 if ( tmp ) {4256 elem[ ontype ] = tmp;4257 }4258 }4259 }4260 }4261 return event.result;4262 },4263 dispatch: function( event ) {4264 // Make a writable jQuery.Event from the native event object4265 event = jQuery.event.fix( event );4266 var i, ret, handleObj, matched, j,4267 handlerQueue = [],4268 args = core_slice.call( arguments ),4269 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],4270 special = jQuery.event.special[ event.type ] || {};4271 // Use the fix-ed jQuery.Event rather than the (read-only) native event4272 args[0] = event;4273 event.delegateTarget = this;4274 // Call the preDispatch hook for the mapped type, and let it bail if desired4275 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {4276 return;4277 }4278 // Determine handlers4279 handlerQueue = jQuery.event.handlers.call( this, event, handlers );4280 // Run delegates first; they may want to stop propagation beneath us4281 i = 0;4282 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {4283 event.currentTarget = matched.elem;4284 j = 0;4285 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {4286 // Triggered event must either 1) have no namespace, or4287 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).4288 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {4289 event.handleObj = handleObj;4290 event.data = handleObj.data;4291 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )4292 .apply( matched.elem, args );4293 if ( ret !== undefined ) {4294 if ( (event.result = ret) === false ) {4295 event.preventDefault();4296 event.stopPropagation();4297 }4298 }4299 }4300 }4301 }4302 // Call the postDispatch hook for the mapped type4303 if ( special.postDispatch ) {4304 special.postDispatch.call( this, event );4305 }4306 return event.result;4307 },4308 handlers: function( event, handlers ) {4309 var sel, handleObj, matches, i,4310 handlerQueue = [],4311 delegateCount = handlers.delegateCount,4312 cur = event.target;4313 // Find delegate handlers4314 // Black-hole SVG <use> instance trees (#13180)4315 // Avoid non-left-click bubbling in Firefox (#3861)4316 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {4317 /* jshint eqeqeq: false */4318 for ( ; cur != this; cur = cur.parentNode || this ) {4319 /* jshint eqeqeq: true */4320 // Don't check non-elements (#13208)4321 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)4322 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {4323 matches = [];4324 for ( i = 0; i < delegateCount; i++ ) {4325 handleObj = handlers[ i ];4326 // Don't conflict with Object.prototype properties (#13203)4327 sel = handleObj.selector + " ";4328 if ( matches[ sel ] === undefined ) {4329 matches[ sel ] = handleObj.needsContext ?4330 jQuery( sel, this ).index( cur ) >= 0 :4331 jQuery.find( sel, this, null, [ cur ] ).length;4332 }4333 if ( matches[ sel ] ) {4334 matches.push( handleObj );4335 }4336 }4337 if ( matches.length ) {4338 handlerQueue.push({ elem: cur, handlers: matches });4339 }4340 }4341 }4342 }4343 // Add the remaining (directly-bound) handlers4344 if ( delegateCount < handlers.length ) {4345 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });4346 }4347 return handlerQueue;4348 },4349 fix: function( event ) {4350 if ( event[ jQuery.expando ] ) {4351 return event;4352 }4353 // Create a writable copy of the event object and normalize some properties4354 var i, prop, copy,4355 type = event.type,4356 originalEvent = event,4357 fixHook = this.fixHooks[ type ];4358 if ( !fixHook ) {4359 this.fixHooks[ type ] = fixHook =4360 rmouseEvent.test( type ) ? this.mouseHooks :4361 rkeyEvent.test( type ) ? this.keyHooks :4362 {};4363 }4364 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;4365 event = new jQuery.Event( originalEvent );4366 i = copy.length;4367 while ( i-- ) {4368 prop = copy[ i ];4369 event[ prop ] = originalEvent[ prop ];4370 }4371 // Support: IE<94372 // Fix target property (#1925)4373 if ( !event.target ) {4374 event.target = originalEvent.srcElement || document;4375 }4376 // Support: Chrome 23+, Safari?4377 // Target should not be a text node (#504, #13143)4378 if ( event.target.nodeType === 3 ) {4379 event.target = event.target.parentNode;4380 }4381 // Support: IE<94382 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)4383 event.metaKey = !!event.metaKey;4384 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;4385 },4386 // Includes some event props shared by KeyEvent and MouseEvent4387 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),4388 fixHooks: {},4389 keyHooks: {4390 props: "char charCode key keyCode".split(" "),4391 filter: function( event, original ) {4392 // Add which for key events4393 if ( event.which == null ) {4394 event.which = original.charCode != null ? original.charCode : original.keyCode;4395 }4396 return event;4397 }4398 },4399 mouseHooks: {4400 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),4401 filter: function( event, original ) {4402 var body, eventDoc, doc,4403 button = original.button,4404 fromElement = original.fromElement;4405 // Calculate pageX/Y if missing and clientX/Y available4406 if ( event.pageX == null && original.clientX != null ) {4407 eventDoc = event.target.ownerDocument || document;4408 doc = eventDoc.documentElement;4409 body = eventDoc.body;4410 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );4411 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );4412 }4413 // Add relatedTarget, if necessary4414 if ( !event.relatedTarget && fromElement ) {4415 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;4416 }4417 // Add which for click: 1 === left; 2 === middle; 3 === right4418 // Note: button is not normalized, so don't use it4419 if ( !event.which && button !== undefined ) {4420 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );4421 }4422 return event;4423 }4424 },4425 special: {4426 load: {4427 // Prevent triggered image.load events from bubbling to window.load4428 noBubble: true4429 },4430 focus: {4431 // Fire native event if possible so blur/focus sequence is correct4432 trigger: function() {4433 if ( this !== safeActiveElement() && this.focus ) {4434 try {4435 this.focus();4436 return false;4437 } catch ( e ) {4438 // Support: IE<94439 // If we error on focus to hidden element (#1486, #12518),4440 // let .trigger() run the handlers4441 }4442 }4443 },4444 delegateType: "focusin"4445 },4446 blur: {4447 trigger: function() {4448 if ( this === safeActiveElement() && this.blur ) {4449 this.blur();4450 return false;4451 }4452 },4453 delegateType: "focusout"4454 },4455 click: {4456 // For checkbox, fire native event so checked state will be right4457 trigger: function() {4458 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {4459 this.click();4460 return false;4461 }4462 },4463 // For cross-browser consistency, don't fire native .click() on links4464 _default: function( event ) {4465 return jQuery.nodeName( event.target, "a" );4466 }4467 },4468 beforeunload: {4469 postDispatch: function( event ) {4470 // Even when returnValue equals to undefined Firefox will still show alert4471 if ( event.result !== undefined ) {4472 event.originalEvent.returnValue = event.result;4473 }4474 }4475 }4476 },4477 simulate: function( type, elem, event, bubble ) {4478 // Piggyback on a donor event to simulate a different one.4479 // Fake originalEvent to avoid donor's stopPropagation, but if the4480 // simulated event prevents default then we do the same on the donor.4481 var e = jQuery.extend(4482 new jQuery.Event(),4483 event,4484 {4485 type: type,4486 isSimulated: true,4487 originalEvent: {}4488 }4489 );4490 if ( bubble ) {4491 jQuery.event.trigger( e, null, elem );4492 } else {4493 jQuery.event.dispatch.call( elem, e );4494 }4495 if ( e.isDefaultPrevented() ) {4496 event.preventDefault();4497 }4498 }4499};4500jQuery.removeEvent = document.removeEventListener ?4501 function( elem, type, handle ) {4502 if ( elem.removeEventListener ) {4503 elem.removeEventListener( type, handle, false );4504 }4505 } :4506 function( elem, type, handle ) {4507 var name = "on" + type;4508 if ( elem.detachEvent ) {4509 // #8545, #7054, preventing memory leaks for custom events in IE6-84510 // detachEvent needed property on element, by name of that event, to properly expose it to GC4511 if ( typeof elem[ name ] === core_strundefined ) {4512 elem[ name ] = null;4513 }4514 elem.detachEvent( name, handle );4515 }4516 };4517jQuery.Event = function( src, props ) {4518 // Allow instantiation without the 'new' keyword4519 if ( !(this instanceof jQuery.Event) ) {4520 return new jQuery.Event( src, props );4521 }4522 // Event object4523 if ( src && src.type ) {4524 this.originalEvent = src;4525 this.type = src.type;4526 // Events bubbling up the document may have been marked as prevented4527 // by a handler lower down the tree; reflect the correct value.4528 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||4529 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;4530 // Event type4531 } else {4532 this.type = src;4533 }4534 // Put explicitly provided properties onto the event object4535 if ( props ) {4536 jQuery.extend( this, props );4537 }4538 // Create a timestamp if incoming event doesn't have one4539 this.timeStamp = src && src.timeStamp || jQuery.now();4540 // Mark it as fixed4541 this[ jQuery.expando ] = true;4542};4543// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding4544// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html4545jQuery.Event.prototype = {4546 isDefaultPrevented: returnFalse,4547 isPropagationStopped: returnFalse,4548 isImmediatePropagationStopped: returnFalse,4549 preventDefault: function() {4550 var e = this.originalEvent;4551 this.isDefaultPrevented = returnTrue;4552 if ( !e ) {4553 return;4554 }4555 // If preventDefault exists, run it on the original event4556 if ( e.preventDefault ) {4557 e.preventDefault();4558 // Support: IE4559 // Otherwise set the returnValue property of the original event to false4560 } else {4561 e.returnValue = false;4562 }4563 },4564 stopPropagation: function() {4565 var e = this.originalEvent;4566 this.isPropagationStopped = returnTrue;4567 if ( !e ) {4568 return;4569 }4570 // If stopPropagation exists, run it on the original event4571 if ( e.stopPropagation ) {4572 e.stopPropagation();4573 }4574 // Support: IE4575 // Set the cancelBubble property of the original event to true4576 e.cancelBubble = true;4577 },4578 stopImmediatePropagation: function() {4579 this.isImmediatePropagationStopped = returnTrue;4580 this.stopPropagation();4581 }4582};4583// Create mouseenter/leave events using mouseover/out and event-time checks4584jQuery.each({4585 mouseenter: "mouseover",4586 mouseleave: "mouseout"4587}, function( orig, fix ) {4588 jQuery.event.special[ orig ] = {4589 delegateType: fix,4590 bindType: fix,4591 handle: function( event ) {4592 var ret,4593 target = this,4594 related = event.relatedTarget,4595 handleObj = event.handleObj;4596 // For mousenter/leave call the handler if related is outside the target.4597 // NB: No relatedTarget if the mouse left/entered the browser window4598 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {4599 event.type = handleObj.origType;4600 ret = handleObj.handler.apply( this, arguments );4601 event.type = fix;4602 }4603 return ret;4604 }4605 };4606});4607// IE submit delegation4608if ( !jQuery.support.submitBubbles ) {4609 jQuery.event.special.submit = {4610 setup: function() {4611 // Only need this for delegated form submit events4612 if ( jQuery.nodeName( this, "form" ) ) {4613 return false;4614 }4615 // Lazy-add a submit handler when a descendant form may potentially be submitted4616 jQuery.event.add( this, "click._submit keypress._submit", function( e ) {4617 // Node name check avoids a VML-related crash in IE (#9807)4618 var elem = e.target,4619 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;4620 if ( form && !jQuery._data( form, "submitBubbles" ) ) {4621 jQuery.event.add( form, "submit._submit", function( event ) {4622 event._submit_bubble = true;4623 });4624 jQuery._data( form, "submitBubbles", true );4625 }4626 });4627 // return undefined since we don't need an event listener4628 },4629 postDispatch: function( event ) {4630 // If form was submitted by the user, bubble the event up the tree4631 if ( event._submit_bubble ) {4632 delete event._submit_bubble;4633 if ( this.parentNode && !event.isTrigger ) {4634 jQuery.event.simulate( "submit", this.parentNode, event, true );4635 }4636 }4637 },4638 teardown: function() {4639 // Only need this for delegated form submit events4640 if ( jQuery.nodeName( this, "form" ) ) {4641 return false;4642 }4643 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above4644 jQuery.event.remove( this, "._submit" );4645 }4646 };4647}4648// IE change delegation and checkbox/radio fix4649if ( !jQuery.support.changeBubbles ) {4650 jQuery.event.special.change = {4651 setup: function() {4652 if ( rformElems.test( this.nodeName ) ) {4653 // IE doesn't fire change on a check/radio until blur; trigger it on click4654 // after a propertychange. Eat the blur-change in special.change.handle.4655 // This still fires onchange a second time for check/radio after blur.4656 if ( this.type === "checkbox" || this.type === "radio" ) {4657 jQuery.event.add( this, "propertychange._change", function( event ) {4658 if ( event.originalEvent.propertyName === "checked" ) {4659 this._just_changed = true;4660 }4661 });4662 jQuery.event.add( this, "click._change", function( event ) {4663 if ( this._just_changed && !event.isTrigger ) {4664 this._just_changed = false;4665 }4666 // Allow triggered, simulated change events (#11500)4667 jQuery.event.simulate( "change", this, event, true );4668 });4669 }4670 return false;4671 }4672 // Delegated event; lazy-add a change handler on descendant inputs4673 jQuery.event.add( this, "beforeactivate._change", function( e ) {4674 var elem = e.target;4675 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {4676 jQuery.event.add( elem, "change._change", function( event ) {4677 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {4678 jQuery.event.simulate( "change", this.parentNode, event, true );4679 }4680 });4681 jQuery._data( elem, "changeBubbles", true );4682 }4683 });4684 },4685 handle: function( event ) {4686 var elem = event.target;4687 // Swallow native change events from checkbox/radio, we already triggered them above4688 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {4689 return event.handleObj.handler.apply( this, arguments );4690 }4691 },4692 teardown: function() {4693 jQuery.event.remove( this, "._change" );4694 return !rformElems.test( this.nodeName );4695 }4696 };4697}4698// Create "bubbling" focus and blur events4699if ( !jQuery.support.focusinBubbles ) {4700 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {4701 // Attach a single capturing handler while someone wants focusin/focusout4702 var attaches = 0,4703 handler = function( event ) {4704 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );4705 };4706 jQuery.event.special[ fix ] = {4707 setup: function() {4708 if ( attaches++ === 0 ) {4709 document.addEventListener( orig, handler, true );4710 }4711 },4712 teardown: function() {4713 if ( --attaches === 0 ) {4714 document.removeEventListener( orig, handler, true );4715 }4716 }4717 };4718 });4719}4720jQuery.fn.extend({4721 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {4722 var type, origFn;4723 // Types can be a map of types/handlers4724 if ( typeof types === "object" ) {4725 // ( types-Object, selector, data )4726 if ( typeof selector !== "string" ) {4727 // ( types-Object, data )4728 data = data || selector;4729 selector = undefined;4730 }4731 for ( type in types ) {4732 this.on( type, selector, data, types[ type ], one );4733 }4734 return this;4735 }4736 if ( data == null && fn == null ) {4737 // ( types, fn )4738 fn = selector;4739 data = selector = undefined;4740 } else if ( fn == null ) {4741 if ( typeof selector === "string" ) {4742 // ( types, selector, fn )4743 fn = data;4744 data = undefined;4745 } else {4746 // ( types, data, fn )4747 fn = data;4748 data = selector;4749 selector = undefined;4750 }4751 }4752 if ( fn === false ) {4753 fn = returnFalse;4754 } else if ( !fn ) {4755 return this;4756 }4757 if ( one === 1 ) {4758 origFn = fn;4759 fn = function( event ) {4760 // Can use an empty set, since event contains the info4761 jQuery().off( event );4762 return origFn.apply( this, arguments );4763 };4764 // Use same guid so caller can remove using origFn4765 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );4766 }4767 return this.each( function() {4768 jQuery.event.add( this, types, fn, data, selector );4769 });4770 },4771 one: function( types, selector, data, fn ) {4772 return this.on( types, selector, data, fn, 1 );4773 },4774 off: function( types, selector, fn ) {4775 var handleObj, type;4776 if ( types && types.preventDefault && types.handleObj ) {4777 // ( event ) dispatched jQuery.Event4778 handleObj = types.handleObj;4779 jQuery( types.delegateTarget ).off(4780 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,4781 handleObj.selector,4782 handleObj.handler4783 );4784 return this;4785 }4786 if ( typeof types === "object" ) {4787 // ( types-object [, selector] )4788 for ( type in types ) {4789 this.off( type, selector, types[ type ] );4790 }4791 return this;4792 }4793 if ( selector === false || typeof selector === "function" ) {4794 // ( types [, fn] )4795 fn = selector;4796 selector = undefined;4797 }4798 if ( fn === false ) {4799 fn = returnFalse;4800 }4801 return this.each(function() {4802 jQuery.event.remove( this, types, fn, selector );4803 });4804 },4805 trigger: function( type, data ) {4806 return this.each(function() {4807 jQuery.event.trigger( type, data, this );4808 });4809 },4810 triggerHandler: function( type, data ) {4811 var elem = this[0];4812 if ( elem ) {4813 return jQuery.event.trigger( type, data, elem, true );4814 }4815 }4816});4817var isSimple = /^.[^:#\[\.,]*$/,4818 rparentsprev = /^(?:parents|prev(?:Until|All))/,4819 rneedsContext = jQuery.expr.match.needsContext,4820 // methods guaranteed to produce a unique set when starting from a unique set4821 guaranteedUnique = {4822 children: true,4823 contents: true,4824 next: true,4825 prev: true4826 };4827jQuery.fn.extend({4828 find: function( selector ) {4829 var i,4830 ret = [],4831 self = this,4832 len = self.length;4833 if ( typeof selector !== "string" ) {4834 return this.pushStack( jQuery( selector ).filter(function() {4835 for ( i = 0; i < len; i++ ) {4836 if ( jQuery.contains( self[ i ], this ) ) {4837 return true;4838 }4839 }4840 }) );4841 }4842 for ( i = 0; i < len; i++ ) {4843 jQuery.find( selector, self[ i ], ret );4844 }4845 // Needed because $( selector, context ) becomes $( context ).find( selector )4846 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );4847 ret.selector = this.selector ? this.selector + " " + selector : selector;4848 return ret;4849 },4850 has: function( target ) {4851 var i,4852 targets = jQuery( target, this ),4853 len = targets.length;4854 return this.filter(function() {4855 for ( i = 0; i < len; i++ ) {4856 if ( jQuery.contains( this, targets[i] ) ) {4857 return true;4858 }4859 }4860 });4861 },4862 not: function( selector ) {4863 return this.pushStack( winnow(this, selector || [], true) );4864 },4865 filter: function( selector ) {4866 return this.pushStack( winnow(this, selector || [], false) );4867 },4868 is: function( selector ) {4869 return !!winnow(4870 this,4871 // If this is a positional/relative selector, check membership in the returned set4872 // so $("p:first").is("p:last") won't return true for a doc with two "p".4873 typeof selector === "string" && rneedsContext.test( selector ) ?4874 jQuery( selector ) :4875 selector || [],4876 false4877 ).length;4878 },4879 closest: function( selectors, context ) {4880 var cur,4881 i = 0,4882 l = this.length,4883 ret = [],4884 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?4885 jQuery( selectors, context || this.context ) :4886 0;4887 for ( ; i < l; i++ ) {4888 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {4889 // Always skip document fragments4890 if ( cur.nodeType < 11 && (pos ?4891 pos.index(cur) > -1 :4892 // Don't pass non-elements to Sizzle4893 cur.nodeType === 1 &&4894 jQuery.find.matchesSelector(cur, selectors)) ) {4895 cur = ret.push( cur );4896 break;4897 }4898 }4899 }4900 return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );4901 },4902 // Determine the position of an element within4903 // the matched set of elements4904 index: function( elem ) {4905 // No argument, return index in parent4906 if ( !elem ) {4907 return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;4908 }4909 // index in selector4910 if ( typeof elem === "string" ) {4911 return jQuery.inArray( this[0], jQuery( elem ) );4912 }4913 // Locate the position of the desired element4914 return jQuery.inArray(4915 // If it receives a jQuery object, the first element is used4916 elem.jquery ? elem[0] : elem, this );4917 },4918 add: function( selector, context ) {4919 var set = typeof selector === "string" ?4920 jQuery( selector, context ) :4921 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),4922 all = jQuery.merge( this.get(), set );4923 return this.pushStack( jQuery.unique(all) );4924 },4925 addBack: function( selector ) {4926 return this.add( selector == null ?4927 this.prevObject : this.prevObject.filter(selector)4928 );4929 }4930});4931function sibling( cur, dir ) {4932 do {4933 cur = cur[ dir ];4934 } while ( cur && cur.nodeType !== 1 );4935 return cur;4936}4937jQuery.each({4938 parent: function( elem ) {4939 var parent = elem.parentNode;4940 return parent && parent.nodeType !== 11 ? parent : null;4941 },4942 parents: function( elem ) {4943 return jQuery.dir( elem, "parentNode" );4944 },4945 parentsUntil: function( elem, i, until ) {4946 return jQuery.dir( elem, "parentNode", until );4947 },4948 next: function( elem ) {4949 return sibling( elem, "nextSibling" );4950 },4951 prev: function( elem ) {4952 return sibling( elem, "previousSibling" );4953 },4954 nextAll: function( elem ) {4955 return jQuery.dir( elem, "nextSibling" );4956 },4957 prevAll: function( elem ) {4958 return jQuery.dir( elem, "previousSibling" );4959 },4960 nextUntil: function( elem, i, until ) {4961 return jQuery.dir( elem, "nextSibling", until );4962 },4963 prevUntil: function( elem, i, until ) {4964 return jQuery.dir( elem, "previousSibling", until );4965 },4966 siblings: function( elem ) {4967 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );4968 },4969 children: function( elem ) {4970 return jQuery.sibling( elem.firstChild );4971 },4972 contents: function( elem ) {4973 return jQuery.nodeName( elem, "iframe" ) ?4974 elem.contentDocument || elem.contentWindow.document :4975 jQuery.merge( [], elem.childNodes );4976 }4977}, function( name, fn ) {4978 jQuery.fn[ name ] = function( until, selector ) {4979 var ret = jQuery.map( this, fn, until );4980 if ( name.slice( -5 ) !== "Until" ) {4981 selector = until;4982 }4983 if ( selector && typeof selector === "string" ) {4984 ret = jQuery.filter( selector, ret );4985 }4986 if ( this.length > 1 ) {4987 // Remove duplicates4988 if ( !guaranteedUnique[ name ] ) {4989 ret = jQuery.unique( ret );4990 }4991 // Reverse order for parents* and prev-derivatives4992 if ( rparentsprev.test( name ) ) {4993 ret = ret.reverse();4994 }4995 }4996 return this.pushStack( ret );4997 };4998});4999jQuery.extend({5000 filter: function( expr, elems, not ) {5001 var elem = elems[ 0 ];5002 if ( not ) {5003 expr = ":not(" + expr + ")";5004 }5005 return elems.length === 1 && elem.nodeType === 1 ?5006 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :5007 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {5008 return elem.nodeType === 1;5009 }));5010 },5011 dir: function( elem, dir, until ) {5012 var matched = [],5013 cur = elem[ dir ];5014 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {5015 if ( cur.nodeType === 1 ) {5016 matched.push( cur );5017 }5018 cur = cur[dir];5019 }5020 return matched;5021 },5022 sibling: function( n, elem ) {5023 var r = [];5024 for ( ; n; n = n.nextSibling ) {5025 if ( n.nodeType === 1 && n !== elem ) {5026 r.push( n );5027 }5028 }5029 return r;5030 }5031});5032// Implement the identical functionality for filter and not5033function winnow( elements, qualifier, not ) {5034 if ( jQuery.isFunction( qualifier ) ) {5035 return jQuery.grep( elements, function( elem, i ) {5036 /* jshint -W018 */5037 return !!qualifier.call( elem, i, elem ) !== not;5038 });5039 }5040 if ( qualifier.nodeType ) {5041 return jQuery.grep( elements, function( elem ) {5042 return ( elem === qualifier ) !== not;5043 });5044 }5045 if ( typeof qualifier === "string" ) {5046 if ( isSimple.test( qualifier ) ) {5047 return jQuery.filter( qualifier, elements, not );5048 }5049 qualifier = jQuery.filter( qualifier, elements );5050 }5051 return jQuery.grep( elements, function( elem ) {5052 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;5053 });5054}5055function createSafeFragment( document ) {5056 var list = nodeNames.split( "|" ),5057 safeFrag = document.createDocumentFragment();5058 if ( safeFrag.createElement ) {5059 while ( list.length ) {5060 safeFrag.createElement(5061 list.pop()5062 );5063 }5064 }5065 return safeFrag;5066}5067var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +5068 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",5069 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,5070 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),5071 rleadingWhitespace = /^\s+/,5072 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,5073 rtagName = /<([\w:]+)/,5074 rtbody = /<tbody/i,5075 rhtml = /<|&#?\w+;/,5076 rnoInnerhtml = /<(?:script|style|link)/i,5077 manipulation_rcheckableType = /^(?:checkbox|radio)$/i,5078 // checked="checked" or checked5079 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,5080 rscriptType = /^$|\/(?:java|ecma)script/i,5081 rscriptTypeMasked = /^true\/(.*)/,5082 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,5083 // We have to close these tags to support XHTML (#13200)5084 wrapMap = {5085 option: [ 1, "<select multiple='multiple'>", "</select>" ],5086 legend: [ 1, "<fieldset>", "</fieldset>" ],5087 area: [ 1, "<map>", "</map>" ],5088 param: [ 1, "<object>", "</object>" ],5089 thead: [ 1, "<table>", "</table>" ],5090 tr: [ 2, "<table><tbody>", "</tbody></table>" ],5091 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],5092 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],5093 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,5094 // unless wrapped in a div with non-breaking characters in front of it.5095 _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]5096 },5097 safeFragment = createSafeFragment( document ),5098 fragmentDiv = safeFragment.appendChild( document.createElement("div") );5099wrapMap.optgroup = wrapMap.option;5100wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;5101wrapMap.th = wrapMap.td;5102jQuery.fn.extend({5103 text: function( value ) {5104 return jQuery.access( this, function( value ) {5105 return value === undefined ?5106 jQuery.text( this ) :5107 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );5108 }, null, value, arguments.length );5109 },5110 append: function() {5111 return this.domManip( arguments, function( elem ) {5112 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {5113 var target = manipulationTarget( this, elem );5114 target.appendChild( elem );5115 }5116 });5117 },5118 prepend: function() {5119 return this.domManip( arguments, function( elem ) {5120 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {5121 var target = manipulationTarget( this, elem );5122 target.insertBefore( elem, target.firstChild );5123 }5124 });5125 },5126 before: function() {5127 return this.domManip( arguments, function( elem ) {5128 if ( this.parentNode ) {5129 this.parentNode.insertBefore( elem, this );5130 }5131 });5132 },5133 after: function() {5134 return this.domManip( arguments, function( elem ) {5135 if ( this.parentNode ) {5136 this.parentNode.insertBefore( elem, this.nextSibling );5137 }5138 });5139 },5140 // keepData is for internal use only--do not document5141 remove: function( selector, keepData ) {5142 var elem,5143 elems = selector ? jQuery.filter( selector, this ) : this,5144 i = 0;5145 for ( ; (elem = elems[i]) != null; i++ ) {5146 if ( !keepData && elem.nodeType === 1 ) {5147 jQuery.cleanData( getAll( elem ) );5148 }5149 if ( elem.parentNode ) {5150 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {5151 setGlobalEval( getAll( elem, "script" ) );5152 }5153 elem.parentNode.removeChild( elem );5154 }5155 }5156 return this;5157 },5158 empty: function() {5159 var elem,5160 i = 0;5161 for ( ; (elem = this[i]) != null; i++ ) {5162 // Remove element nodes and prevent memory leaks5163 if ( elem.nodeType === 1 ) {5164 jQuery.cleanData( getAll( elem, false ) );5165 }5166 // Remove any remaining nodes5167 while ( elem.firstChild ) {5168 elem.removeChild( elem.firstChild );5169 }5170 // If this is a select, ensure that it displays empty (#12336)5171 // Support: IE<95172 if ( elem.options && jQuery.nodeName( elem, "select" ) ) {5173 elem.options.length = 0;5174 }5175 }5176 return this;5177 },5178 clone: function( dataAndEvents, deepDataAndEvents ) {5179 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;5180 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;5181 return this.map( function () {5182 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );5183 });5184 },5185 html: function( value ) {5186 return jQuery.access( this, function( value ) {5187 var elem = this[0] || {},5188 i = 0,5189 l = this.length;5190 if ( value === undefined ) {5191 return elem.nodeType === 1 ?5192 elem.innerHTML.replace( rinlinejQuery, "" ) :5193 undefined;5194 }5195 // See if we can take a shortcut and just use innerHTML5196 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&5197 ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&5198 ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&5199 !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {5200 value = value.replace( rxhtmlTag, "<$1></$2>" );5201 try {5202 for (; i < l; i++ ) {5203 // Remove element nodes and prevent memory leaks5204 elem = this[i] || {};5205 if ( elem.nodeType === 1 ) {5206 jQuery.cleanData( getAll( elem, false ) );5207 elem.innerHTML = value;5208 }5209 }5210 elem = 0;5211 // If using innerHTML throws an exception, use the fallback method5212 } catch(e) {}5213 }5214 if ( elem ) {5215 this.empty().append( value );5216 }5217 }, null, value, arguments.length );5218 },5219 replaceWith: function() {5220 var5221 // Snapshot the DOM in case .domManip sweeps something relevant into its fragment5222 args = jQuery.map( this, function( elem ) {5223 return [ elem.nextSibling, elem.parentNode ];5224 }),5225 i = 0;5226 // Make the changes, replacing each context element with the new content5227 this.domManip( arguments, function( elem ) {5228 var next = args[ i++ ],5229 parent = args[ i++ ];5230 if ( parent ) {5231 // Don't use the snapshot next if it has moved (#13810)5232 if ( next && next.parentNode !== parent ) {5233 next = this.nextSibling;5234 }5235 jQuery( this ).remove();5236 parent.insertBefore( elem, next );5237 }5238 // Allow new content to include elements from the context set5239 }, true );5240 // Force removal if there was no new content (e.g., from empty arguments)5241 return i ? this : this.remove();5242 },5243 detach: function( selector ) {5244 return this.remove( selector, true );5245 },5246 domManip: function( args, callback, allowIntersection ) {5247 // Flatten any nested arrays5248 args = core_concat.apply( [], args );5249 var first, node, hasScripts,5250 scripts, doc, fragment,5251 i = 0,5252 l = this.length,5253 set = this,5254 iNoClone = l - 1,5255 value = args[0],5256 isFunction = jQuery.isFunction( value );5257 // We can't cloneNode fragments that contain checked, in WebKit5258 if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {5259 return this.each(function( index ) {5260 var self = set.eq( index );5261 if ( isFunction ) {5262 args[0] = value.call( this, index, self.html() );5263 }5264 self.domManip( args, callback, allowIntersection );5265 });5266 }5267 if ( l ) {5268 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );5269 first = fragment.firstChild;5270 if ( fragment.childNodes.length === 1 ) {5271 fragment = first;5272 }5273 if ( first ) {5274 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );5275 hasScripts = scripts.length;5276 // Use the original fragment for the last item instead of the first because it can end up5277 // being emptied incorrectly in certain situations (#8070).5278 for ( ; i < l; i++ ) {5279 node = fragment;5280 if ( i !== iNoClone ) {5281 node = jQuery.clone( node, true, true );5282 // Keep references to cloned scripts for later restoration5283 if ( hasScripts ) {5284 jQuery.merge( scripts, getAll( node, "script" ) );5285 }5286 }5287 callback.call( this[i], node, i );5288 }5289 if ( hasScripts ) {5290 doc = scripts[ scripts.length - 1 ].ownerDocument;5291 // Reenable scripts5292 jQuery.map( scripts, restoreScript );5293 // Evaluate executable scripts on first document insertion5294 for ( i = 0; i < hasScripts; i++ ) {5295 node = scripts[ i ];5296 if ( rscriptType.test( node.type || "" ) &&5297 !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {5298 if ( node.src ) {5299 // Hope ajax is available...5300 jQuery._evalUrl( node.src );5301 } else {5302 jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );5303 }5304 }5305 }5306 }5307 // Fix #11809: Avoid leaking memory5308 fragment = first = null;5309 }5310 }5311 return this;5312 }5313});5314// Support: IE<85315// Manipulating tables requires a tbody5316function manipulationTarget( elem, content ) {5317 return jQuery.nodeName( elem, "table" ) &&5318 jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?5319 elem.getElementsByTagName("tbody")[0] ||5320 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :5321 elem;5322}5323// Replace/restore the type attribute of script elements for safe DOM manipulation5324function disableScript( elem ) {5325 elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;5326 return elem;5327}5328function restoreScript( elem ) {5329 var match = rscriptTypeMasked.exec( elem.type );5330 if ( match ) {5331 elem.type = match[1];5332 } else {5333 elem.removeAttribute("type");5334 }5335 return elem;5336}5337// Mark scripts as having already been evaluated5338function setGlobalEval( elems, refElements ) {5339 var elem,5340 i = 0;5341 for ( ; (elem = elems[i]) != null; i++ ) {5342 jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );5343 }5344}5345function cloneCopyEvent( src, dest ) {5346 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {5347 return;5348 }5349 var type, i, l,5350 oldData = jQuery._data( src ),5351 curData = jQuery._data( dest, oldData ),5352 events = oldData.events;5353 if ( events ) {5354 delete curData.handle;5355 curData.events = {};5356 for ( type in events ) {5357 for ( i = 0, l = events[ type ].length; i < l; i++ ) {5358 jQuery.event.add( dest, type, events[ type ][ i ] );5359 }5360 }5361 }5362 // make the cloned public data object a copy from the original5363 if ( curData.data ) {5364 curData.data = jQuery.extend( {}, curData.data );5365 }5366}5367function fixCloneNodeIssues( src, dest ) {5368 var nodeName, e, data;5369 // We do not need to do anything for non-Elements5370 if ( dest.nodeType !== 1 ) {5371 return;5372 }5373 nodeName = dest.nodeName.toLowerCase();5374 // IE6-8 copies events bound via attachEvent when using cloneNode.5375 if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {5376 data = jQuery._data( dest );5377 for ( e in data.events ) {5378 jQuery.removeEvent( dest, e, data.handle );5379 }5380 // Event data gets referenced instead of copied if the expando gets copied too5381 dest.removeAttribute( jQuery.expando );5382 }5383 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text5384 if ( nodeName === "script" && dest.text !== src.text ) {5385 disableScript( dest ).text = src.text;5386 restoreScript( dest );5387 // IE6-10 improperly clones children of object elements using classid.5388 // IE10 throws NoModificationAllowedError if parent is null, #12132.5389 } else if ( nodeName === "object" ) {5390 if ( dest.parentNode ) {5391 dest.outerHTML = src.outerHTML;5392 }5393 // This path appears unavoidable for IE9. When cloning an object5394 // element in IE9, the outerHTML strategy above is not sufficient.5395 // If the src has innerHTML and the destination does not,5396 // copy the src.innerHTML into the dest.innerHTML. #103245397 if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {5398 dest.innerHTML = src.innerHTML;5399 }5400 } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {5401 // IE6-8 fails to persist the checked state of a cloned checkbox5402 // or radio button. Worse, IE6-7 fail to give the cloned element5403 // a checked appearance if the defaultChecked value isn't also set5404 dest.defaultChecked = dest.checked = src.checked;5405 // IE6-7 get confused and end up setting the value of a cloned5406 // checkbox/radio button to an empty string instead of "on"5407 if ( dest.value !== src.value ) {5408 dest.value = src.value;5409 }5410 // IE6-8 fails to return the selected option to the default selected5411 // state when cloning options5412 } else if ( nodeName === "option" ) {5413 dest.defaultSelected = dest.selected = src.defaultSelected;5414 // IE6-8 fails to set the defaultValue to the correct value when5415 // cloning other types of input fields5416 } else if ( nodeName === "input" || nodeName === "textarea" ) {5417 dest.defaultValue = src.defaultValue;5418 }5419}5420jQuery.each({5421 appendTo: "append",5422 prependTo: "prepend",5423 insertBefore: "before",5424 insertAfter: "after",5425 replaceAll: "replaceWith"5426}, function( name, original ) {5427 jQuery.fn[ name ] = function( selector ) {5428 var elems,5429 i = 0,5430 ret = [],5431 insert = jQuery( selector ),5432 last = insert.length - 1;5433 for ( ; i <= last; i++ ) {5434 elems = i === last ? this : this.clone(true);5435 jQuery( insert[i] )[ original ]( elems );5436 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()5437 core_push.apply( ret, elems.get() );5438 }5439 return this.pushStack( ret );5440 };5441});5442function getAll( context, tag ) {5443 var elems, elem,5444 i = 0,5445 found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :5446 typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :5447 undefined;5448 if ( !found ) {5449 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {5450 if ( !tag || jQuery.nodeName( elem, tag ) ) {5451 found.push( elem );5452 } else {5453 jQuery.merge( found, getAll( elem, tag ) );5454 }5455 }5456 }5457 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?5458 jQuery.merge( [ context ], found ) :5459 found;5460}5461// Used in buildFragment, fixes the defaultChecked property5462function fixDefaultChecked( elem ) {5463 if ( manipulation_rcheckableType.test( elem.type ) ) {5464 elem.defaultChecked = elem.checked;5465 }5466}5467jQuery.extend({5468 clone: function( elem, dataAndEvents, deepDataAndEvents ) {5469 var destElements, node, clone, i, srcElements,5470 inPage = jQuery.contains( elem.ownerDocument, elem );5471 if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {5472 clone = elem.cloneNode( true );5473 // IE<=8 does not properly clone detached, unknown element nodes5474 } else {5475 fragmentDiv.innerHTML = elem.outerHTML;5476 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );5477 }5478 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&5479 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {5480 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/25481 destElements = getAll( clone );5482 srcElements = getAll( elem );5483 // Fix all IE cloning issues5484 for ( i = 0; (node = srcElements[i]) != null; ++i ) {5485 // Ensure that the destination node is not null; Fixes #95875486 if ( destElements[i] ) {5487 fixCloneNodeIssues( node, destElements[i] );5488 }5489 }5490 }5491 // Copy the events from the original to the clone5492 if ( dataAndEvents ) {5493 if ( deepDataAndEvents ) {5494 srcElements = srcElements || getAll( elem );5495 destElements = destElements || getAll( clone );5496 for ( i = 0; (node = srcElements[i]) != null; i++ ) {5497 cloneCopyEvent( node, destElements[i] );5498 }5499 } else {5500 cloneCopyEvent( elem, clone );5501 }5502 }5503 // Preserve script evaluation history5504 destElements = getAll( clone, "script" );5505 if ( destElements.length > 0 ) {5506 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );5507 }5508 destElements = srcElements = node = null;5509 // Return the cloned set5510 return clone;5511 },5512 buildFragment: function( elems, context, scripts, selection ) {5513 var j, elem, contains,5514 tmp, tag, tbody, wrap,5515 l = elems.length,5516 // Ensure a safe fragment5517 safe = createSafeFragment( context ),5518 nodes = [],5519 i = 0;5520 for ( ; i < l; i++ ) {5521 elem = elems[ i ];5522 if ( elem || elem === 0 ) {5523 // Add nodes directly5524 if ( jQuery.type( elem ) === "object" ) {5525 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );5526 // Convert non-html into a text node5527 } else if ( !rhtml.test( elem ) ) {5528 nodes.push( context.createTextNode( elem ) );5529 // Convert html into DOM nodes5530 } else {5531 tmp = tmp || safe.appendChild( context.createElement("div") );5532 // Deserialize a standard representation5533 tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();5534 wrap = wrapMap[ tag ] || wrapMap._default;5535 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];5536 // Descend through wrappers to the right content5537 j = wrap[0];5538 while ( j-- ) {5539 tmp = tmp.lastChild;5540 }5541 // Manually add leading whitespace removed by IE5542 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {5543 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );5544 }5545 // Remove IE's autoinserted <tbody> from table fragments5546 if ( !jQuery.support.tbody ) {5547 // String was a <table>, *may* have spurious <tbody>5548 elem = tag === "table" && !rtbody.test( elem ) ?5549 tmp.firstChild :5550 // String was a bare <thead> or <tfoot>5551 wrap[1] === "<table>" && !rtbody.test( elem ) ?5552 tmp :5553 0;5554 j = elem && elem.childNodes.length;5555 while ( j-- ) {5556 if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {5557 elem.removeChild( tbody );5558 }5559 }5560 }5561 jQuery.merge( nodes, tmp.childNodes );5562 // Fix #12392 for WebKit and IE > 95563 tmp.textContent = "";5564 // Fix #12392 for oldIE5565 while ( tmp.firstChild ) {5566 tmp.removeChild( tmp.firstChild );5567 }5568 // Remember the top-level container for proper cleanup5569 tmp = safe.lastChild;5570 }5571 }5572 }5573 // Fix #11356: Clear elements from fragment5574 if ( tmp ) {5575 safe.removeChild( tmp );5576 }5577 // Reset defaultChecked for any radios and checkboxes5578 // about to be appended to the DOM in IE 6/7 (#8060)5579 if ( !jQuery.support.appendChecked ) {5580 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );5581 }5582 i = 0;5583 while ( (elem = nodes[ i++ ]) ) {5584 // #4087 - If origin and destination elements are the same, and this is5585 // that element, do not do anything5586 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {5587 continue;5588 }5589 contains = jQuery.contains( elem.ownerDocument, elem );5590 // Append to fragment5591 tmp = getAll( safe.appendChild( elem ), "script" );5592 // Preserve script evaluation history5593 if ( contains ) {5594 setGlobalEval( tmp );5595 }5596 // Capture executables5597 if ( scripts ) {5598 j = 0;5599 while ( (elem = tmp[ j++ ]) ) {5600 if ( rscriptType.test( elem.type || "" ) ) {5601 scripts.push( elem );5602 }5603 }5604 }5605 }5606 tmp = null;5607 return safe;5608 },5609 cleanData: function( elems, /* internal */ acceptData ) {5610 var elem, type, id, data,5611 i = 0,5612 internalKey = jQuery.expando,5613 cache = jQuery.cache,5614 deleteExpando = jQuery.support.deleteExpando,5615 special = jQuery.event.special;5616 for ( ; (elem = elems[i]) != null; i++ ) {5617 if ( acceptData || jQuery.acceptData( elem ) ) {5618 id = elem[ internalKey ];5619 data = id && cache[ id ];5620 if ( data ) {5621 if ( data.events ) {5622 for ( type in data.events ) {5623 if ( special[ type ] ) {5624 jQuery.event.remove( elem, type );5625 // This is a shortcut to avoid jQuery.event.remove's overhead5626 } else {5627 jQuery.removeEvent( elem, type, data.handle );5628 }5629 }5630 }5631 // Remove cache only if it was not already removed by jQuery.event.remove5632 if ( cache[ id ] ) {5633 delete cache[ id ];5634 // IE does not allow us to delete expando properties from nodes,5635 // nor does it have a removeAttribute function on Document nodes;5636 // we must handle all of these cases5637 if ( deleteExpando ) {5638 delete elem[ internalKey ];5639 } else if ( typeof elem.removeAttribute !== core_strundefined ) {5640 elem.removeAttribute( internalKey );5641 } else {5642 elem[ internalKey ] = null;5643 }5644 core_deletedIds.push( id );5645 }5646 }5647 }5648 }5649 },5650 _evalUrl: function( url ) {5651 return jQuery.ajax({5652 url: url,5653 type: "GET",5654 dataType: "script",5655 async: false,5656 global: false,5657 "throws": true5658 });5659 }5660});5661jQuery.fn.extend({5662 wrapAll: function( html ) {5663 if ( jQuery.isFunction( html ) ) {5664 return this.each(function(i) {5665 jQuery(this).wrapAll( html.call(this, i) );5666 });5667 }5668 if ( this[0] ) {5669 // The elements to wrap the target around5670 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);5671 if ( this[0].parentNode ) {5672 wrap.insertBefore( this[0] );5673 }5674 wrap.map(function() {5675 var elem = this;5676 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {5677 elem = elem.firstChild;5678 }5679 return elem;5680 }).append( this );5681 }5682 return this;5683 },5684 wrapInner: function( html ) {5685 if ( jQuery.isFunction( html ) ) {5686 return this.each(function(i) {5687 jQuery(this).wrapInner( html.call(this, i) );5688 });5689 }5690 return this.each(function() {5691 var self = jQuery( this ),5692 contents = self.contents();5693 if ( contents.length ) {5694 contents.wrapAll( html );5695 } else {5696 self.append( html );5697 }5698 });5699 },5700 wrap: function( html ) {5701 var isFunction = jQuery.isFunction( html );5702 return this.each(function(i) {5703 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );5704 });5705 },5706 unwrap: function() {5707 return this.parent().each(function() {5708 if ( !jQuery.nodeName( this, "body" ) ) {5709 jQuery( this ).replaceWith( this.childNodes );5710 }5711 }).end();5712 }5713});5714var iframe, getStyles, curCSS,5715 ralpha = /alpha\([^)]*\)/i,5716 ropacity = /opacity\s*=\s*([^)]*)/,5717 rposition = /^(top|right|bottom|left)$/,5718 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"5719 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display5720 rdisplayswap = /^(none|table(?!-c[ea]).+)/,5721 rmargin = /^margin/,5722 rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),5723 rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),5724 rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),5725 elemdisplay = { BODY: "block" },5726 cssShow = { position: "absolute", visibility: "hidden", display: "block" },5727 cssNormalTransform = {5728 letterSpacing: 0,5729 fontWeight: 4005730 },5731 cssExpand = [ "Top", "Right", "Bottom", "Left" ],5732 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];5733// return a css property mapped to a potentially vendor prefixed property5734function vendorPropName( style, name ) {5735 // shortcut for names that are not vendor prefixed5736 if ( name in style ) {5737 return name;5738 }5739 // check for vendor prefixed names5740 var capName = name.charAt(0).toUpperCase() + name.slice(1),5741 origName = name,5742 i = cssPrefixes.length;5743 while ( i-- ) {5744 name = cssPrefixes[ i ] + capName;5745 if ( name in style ) {5746 return name;5747 }5748 }5749 return origName;5750}5751function isHidden( elem, el ) {5752 // isHidden might be called from jQuery#filter function;5753 // in that case, element will be second argument5754 elem = el || elem;5755 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );5756}5757function showHide( elements, show ) {5758 var display, elem, hidden,5759 values = [],5760 index = 0,5761 length = elements.length;5762 for ( ; index < length; index++ ) {5763 elem = elements[ index ];5764 if ( !elem.style ) {5765 continue;5766 }5767 values[ index ] = jQuery._data( elem, "olddisplay" );5768 display = elem.style.display;5769 if ( show ) {5770 // Reset the inline display of this element to learn if it is5771 // being hidden by cascaded rules or not5772 if ( !values[ index ] && display === "none" ) {5773 elem.style.display = "";5774 }5775 // Set elements which have been overridden with display: none5776 // in a stylesheet to whatever the default browser style is5777 // for such an element5778 if ( elem.style.display === "" && isHidden( elem ) ) {5779 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );5780 }5781 } else {5782 if ( !values[ index ] ) {5783 hidden = isHidden( elem );5784 if ( display && display !== "none" || !hidden ) {5785 jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );5786 }5787 }5788 }5789 }5790 // Set the display of most of the elements in a second loop5791 // to avoid the constant reflow5792 for ( index = 0; index < length; index++ ) {5793 elem = elements[ index ];5794 if ( !elem.style ) {5795 continue;5796 }5797 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {5798 elem.style.display = show ? values[ index ] || "" : "none";5799 }5800 }5801 return elements;5802}5803jQuery.fn.extend({5804 css: function( name, value ) {5805 return jQuery.access( this, function( elem, name, value ) {5806 var len, styles,5807 map = {},5808 i = 0;5809 if ( jQuery.isArray( name ) ) {5810 styles = getStyles( elem );5811 len = name.length;5812 for ( ; i < len; i++ ) {5813 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );5814 }5815 return map;5816 }5817 return value !== undefined ?5818 jQuery.style( elem, name, value ) :5819 jQuery.css( elem, name );5820 }, name, value, arguments.length > 1 );5821 },5822 show: function() {5823 return showHide( this, true );5824 },5825 hide: function() {5826 return showHide( this );5827 },5828 toggle: function( state ) {5829 if ( typeof state === "boolean" ) {5830 return state ? this.show() : this.hide();5831 }5832 return this.each(function() {5833 if ( isHidden( this ) ) {5834 jQuery( this ).show();5835 } else {5836 jQuery( this ).hide();5837 }5838 });5839 }5840});5841jQuery.extend({5842 // Add in style property hooks for overriding the default5843 // behavior of getting and setting a style property5844 cssHooks: {5845 opacity: {5846 get: function( elem, computed ) {5847 if ( computed ) {5848 // We should always get a number back from opacity5849 var ret = curCSS( elem, "opacity" );5850 return ret === "" ? "1" : ret;5851 }5852 }5853 }5854 },5855 // Don't automatically add "px" to these possibly-unitless properties5856 cssNumber: {5857 "columnCount": true,5858 "fillOpacity": true,5859 "fontWeight": true,5860 "lineHeight": true,5861 "opacity": true,5862 "order": true,5863 "orphans": true,5864 "widows": true,5865 "zIndex": true,5866 "zoom": true5867 },5868 // Add in properties whose names you wish to fix before5869 // setting or getting the value5870 cssProps: {5871 // normalize float css property5872 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"5873 },5874 // Get and set the style property on a DOM Node5875 style: function( elem, name, value, extra ) {5876 // Don't set styles on text and comment nodes5877 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {5878 return;5879 }5880 // Make sure that we're working with the right name5881 var ret, type, hooks,5882 origName = jQuery.camelCase( name ),5883 style = elem.style;5884 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );5885 // gets hook for the prefixed version5886 // followed by the unprefixed version5887 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];5888 // Check if we're setting a value5889 if ( value !== undefined ) {5890 type = typeof value;5891 // convert relative number strings (+= or -=) to relative numbers. #73455892 if ( type === "string" && (ret = rrelNum.exec( value )) ) {5893 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );5894 // Fixes bug #92375895 type = "number";5896 }5897 // Make sure that NaN and null values aren't set. See: #71165898 if ( value == null || type === "number" && isNaN( value ) ) {5899 return;5900 }5901 // If a number was passed in, add 'px' to the (except for certain CSS properties)5902 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {5903 value += "px";5904 }5905 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,5906 // but it would mean to define eight (for every problematic property) identical functions5907 if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {5908 style[ name ] = "inherit";5909 }5910 // If a hook was provided, use that value, otherwise just set the specified value5911 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {5912 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided5913 // Fixes bug #55095914 try {5915 style[ name ] = value;5916 } catch(e) {}5917 }5918 } else {5919 // If a hook was provided get the non-computed value from there5920 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {5921 return ret;5922 }5923 // Otherwise just get the value from the style object5924 return style[ name ];5925 }5926 },5927 css: function( elem, name, extra, styles ) {5928 var num, val, hooks,5929 origName = jQuery.camelCase( name );5930 // Make sure that we're working with the right name5931 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );5932 // gets hook for the prefixed version5933 // followed by the unprefixed version5934 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];5935 // If a hook was provided get the computed value from there5936 if ( hooks && "get" in hooks ) {5937 val = hooks.get( elem, true, extra );5938 }5939 // Otherwise, if a way to get the computed value exists, use that5940 if ( val === undefined ) {5941 val = curCSS( elem, name, styles );5942 }5943 //convert "normal" to computed value5944 if ( val === "normal" && name in cssNormalTransform ) {5945 val = cssNormalTransform[ name ];5946 }5947 // Return, converting to number if forced or a qualifier was provided and val looks numeric5948 if ( extra === "" || extra ) {5949 num = parseFloat( val );5950 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;5951 }5952 return val;5953 }5954});5955// NOTE: we've included the "window" in window.getComputedStyle5956// because jsdom on node.js will break without it.5957if ( window.getComputedStyle ) {5958 getStyles = function( elem ) {5959 return window.getComputedStyle( elem, null );5960 };5961 curCSS = function( elem, name, _computed ) {5962 var width, minWidth, maxWidth,5963 computed = _computed || getStyles( elem ),5964 // getPropertyValue is only needed for .css('filter') in IE9, see #125375965 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,5966 style = elem.style;5967 if ( computed ) {5968 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {5969 ret = jQuery.style( elem, name );5970 }5971 // A tribute to the "awesome hack by Dean Edwards"5972 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right5973 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels5974 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values5975 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {5976 // Remember the original values5977 width = style.width;5978 minWidth = style.minWidth;5979 maxWidth = style.maxWidth;5980 // Put in the new values to get a computed value out5981 style.minWidth = style.maxWidth = style.width = ret;5982 ret = computed.width;5983 // Revert the changed values5984 style.width = width;5985 style.minWidth = minWidth;5986 style.maxWidth = maxWidth;5987 }5988 }5989 return ret;5990 };5991} else if ( document.documentElement.currentStyle ) {5992 getStyles = function( elem ) {5993 return elem.currentStyle;5994 };5995 curCSS = function( elem, name, _computed ) {5996 var left, rs, rsLeft,5997 computed = _computed || getStyles( elem ),5998 ret = computed ? computed[ name ] : undefined,5999 style = elem.style;6000 // Avoid setting ret to empty string here6001 // so we don't default to auto6002 if ( ret == null && style && style[ name ] ) {6003 ret = style[ name ];6004 }6005 // From the awesome hack by Dean Edwards6006 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022916007 // If we're not dealing with a regular pixel number6008 // but a number that has a weird ending, we need to convert it to pixels6009 // but not position css attributes, as those are proportional to the parent element instead6010 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem6011 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {6012 // Remember the original values6013 left = style.left;6014 rs = elem.runtimeStyle;6015 rsLeft = rs && rs.left;6016 // Put in the new values to get a computed value out6017 if ( rsLeft ) {6018 rs.left = elem.currentStyle.left;6019 }6020 style.left = name === "fontSize" ? "1em" : ret;6021 ret = style.pixelLeft + "px";6022 // Revert the changed values6023 style.left = left;6024 if ( rsLeft ) {6025 rs.left = rsLeft;6026 }6027 }6028 return ret === "" ? "auto" : ret;6029 };6030}6031function setPositiveNumber( elem, value, subtract ) {6032 var matches = rnumsplit.exec( value );6033 return matches ?6034 // Guard against undefined "subtract", e.g., when used as in cssHooks6035 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :6036 value;6037}6038function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {6039 var i = extra === ( isBorderBox ? "border" : "content" ) ?6040 // If we already have the right measurement, avoid augmentation6041 4 :6042 // Otherwise initialize for horizontal or vertical properties6043 name === "width" ? 1 : 0,6044 val = 0;6045 for ( ; i < 4; i += 2 ) {6046 // both box models exclude margin, so add it if we want it6047 if ( extra === "margin" ) {6048 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );6049 }6050 if ( isBorderBox ) {6051 // border-box includes padding, so remove it if we want content6052 if ( extra === "content" ) {6053 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );6054 }6055 // at this point, extra isn't border nor margin, so remove border6056 if ( extra !== "margin" ) {6057 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );6058 }6059 } else {6060 // at this point, extra isn't content, so add padding6061 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );6062 // at this point, extra isn't content nor padding, so add border6063 if ( extra !== "padding" ) {6064 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );6065 }6066 }6067 }6068 return val;6069}6070function getWidthOrHeight( elem, name, extra ) {6071 // Start with offset property, which is equivalent to the border-box value6072 var valueIsBorderBox = true,6073 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,6074 styles = getStyles( elem ),6075 isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";6076 // some non-html elements return undefined for offsetWidth, so check for null/undefined6077 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=6492856078 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=4916686079 if ( val <= 0 || val == null ) {6080 // Fall back to computed then uncomputed css if necessary6081 val = curCSS( elem, name, styles );6082 if ( val < 0 || val == null ) {6083 val = elem.style[ name ];6084 }6085 // Computed unit is not pixels. Stop here and return.6086 if ( rnumnonpx.test(val) ) {6087 return val;6088 }6089 // we need the check for style in case a browser which returns unreliable values6090 // for getComputedStyle silently falls back to the reliable elem.style6091 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );6092 // Normalize "", auto, and prepare for extra6093 val = parseFloat( val ) || 0;6094 }6095 // use the active box-sizing model to add/subtract irrelevant styles6096 return ( val +6097 augmentWidthOrHeight(6098 elem,6099 name,6100 extra || ( isBorderBox ? "border" : "content" ),6101 valueIsBorderBox,6102 styles6103 )6104 ) + "px";6105}6106// Try to determine the default display value of an element6107function css_defaultDisplay( nodeName ) {6108 var doc = document,6109 display = elemdisplay[ nodeName ];6110 if ( !display ) {6111 display = actualDisplay( nodeName, doc );6112 // If the simple way fails, read from inside an iframe6113 if ( display === "none" || !display ) {6114 // Use the already-created iframe if possible6115 iframe = ( iframe ||6116 jQuery("<iframe frameborder='0' width='0' height='0'/>")6117 .css( "cssText", "display:block !important" )6118 ).appendTo( doc.documentElement );6119 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse6120 doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;6121 doc.write("<!doctype html><html><body>");6122 doc.close();6123 display = actualDisplay( nodeName, doc );6124 iframe.detach();6125 }6126 // Store the correct default display6127 elemdisplay[ nodeName ] = display;6128 }6129 return display;6130}6131// Called ONLY from within css_defaultDisplay6132function actualDisplay( name, doc ) {6133 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),6134 display = jQuery.css( elem[0], "display" );6135 elem.remove();6136 return display;6137}6138jQuery.each([ "height", "width" ], function( i, name ) {6139 jQuery.cssHooks[ name ] = {6140 get: function( elem, computed, extra ) {6141 if ( computed ) {6142 // certain elements can have dimension info if we invisibly show them6143 // however, it must have a current display style that would benefit from this6144 return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?6145 jQuery.swap( elem, cssShow, function() {6146 return getWidthOrHeight( elem, name, extra );6147 }) :6148 getWidthOrHeight( elem, name, extra );6149 }6150 },6151 set: function( elem, value, extra ) {6152 var styles = extra && getStyles( elem );6153 return setPositiveNumber( elem, value, extra ?6154 augmentWidthOrHeight(6155 elem,6156 name,6157 extra,6158 jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",6159 styles6160 ) : 06161 );6162 }6163 };6164});6165if ( !jQuery.support.opacity ) {6166 jQuery.cssHooks.opacity = {6167 get: function( elem, computed ) {6168 // IE uses filters for opacity6169 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?6170 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :6171 computed ? "1" : "";6172 },6173 set: function( elem, value ) {6174 var style = elem.style,6175 currentStyle = elem.currentStyle,6176 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",6177 filter = currentStyle && currentStyle.filter || style.filter || "";6178 // IE has trouble with opacity if it does not have layout6179 // Force it by setting the zoom level6180 style.zoom = 1;6181 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #66526182 // if value === "", then remove inline opacity #126856183 if ( ( value >= 1 || value === "" ) &&6184 jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&6185 style.removeAttribute ) {6186 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText6187 // if "filter:" is present at all, clearType is disabled, we want to avoid this6188 // style.removeAttribute is IE Only, but so apparently is this code path...6189 style.removeAttribute( "filter" );6190 // if there is no filter style applied in a css rule or unset inline opacity, we are done6191 if ( value === "" || currentStyle && !currentStyle.filter ) {6192 return;6193 }6194 }6195 // otherwise, set new filter values6196 style.filter = ralpha.test( filter ) ?6197 filter.replace( ralpha, opacity ) :6198 filter + " " + opacity;6199 }6200 };6201}6202// These hooks cannot be added until DOM ready because the support test6203// for it is not run until after DOM ready6204jQuery(function() {6205 if ( !jQuery.support.reliableMarginRight ) {6206 jQuery.cssHooks.marginRight = {6207 get: function( elem, computed ) {6208 if ( computed ) {6209 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right6210 // Work around by temporarily setting element display to inline-block6211 return jQuery.swap( elem, { "display": "inline-block" },6212 curCSS, [ elem, "marginRight" ] );6213 }6214 }6215 };6216 }6217 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=290846218 // getComputedStyle returns percent when specified for top/left/bottom/right6219 // rather than make the css module depend on the offset module, we just check for it here6220 if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {6221 jQuery.each( [ "top", "left" ], function( i, prop ) {6222 jQuery.cssHooks[ prop ] = {6223 get: function( elem, computed ) {6224 if ( computed ) {6225 computed = curCSS( elem, prop );6226 // if curCSS returns percentage, fallback to offset6227 return rnumnonpx.test( computed ) ?6228 jQuery( elem ).position()[ prop ] + "px" :6229 computed;6230 }6231 }6232 };6233 });6234 }6235});6236if ( jQuery.expr && jQuery.expr.filters ) {6237 jQuery.expr.filters.hidden = function( elem ) {6238 // Support: Opera <= 12.126239 // Opera reports offsetWidths and offsetHeights less than zero on some elements6240 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||6241 (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");6242 };6243 jQuery.expr.filters.visible = function( elem ) {6244 return !jQuery.expr.filters.hidden( elem );6245 };6246}6247// These hooks are used by animate to expand properties6248jQuery.each({6249 margin: "",6250 padding: "",6251 border: "Width"6252}, function( prefix, suffix ) {6253 jQuery.cssHooks[ prefix + suffix ] = {6254 expand: function( value ) {6255 var i = 0,6256 expanded = {},6257 // assumes a single number if not a string6258 parts = typeof value === "string" ? value.split(" ") : [ value ];6259 for ( ; i < 4; i++ ) {6260 expanded[ prefix + cssExpand[ i ] + suffix ] =6261 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];6262 }6263 return expanded;6264 }6265 };6266 if ( !rmargin.test( prefix ) ) {6267 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;6268 }6269});6270var r20 = /%20/g,6271 rbracket = /\[\]$/,6272 rCRLF = /\r?\n/g,6273 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,6274 rsubmittable = /^(?:input|select|textarea|keygen)/i;6275jQuery.fn.extend({6276 serialize: function() {6277 return jQuery.param( this.serializeArray() );6278 },6279 serializeArray: function() {6280 return this.map(function(){6281 // Can add propHook for "elements" to filter or add form elements6282 var elements = jQuery.prop( this, "elements" );6283 return elements ? jQuery.makeArray( elements ) : this;6284 })6285 .filter(function(){6286 var type = this.type;6287 // Use .is(":disabled") so that fieldset[disabled] works6288 return this.name && !jQuery( this ).is( ":disabled" ) &&6289 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&6290 ( this.checked || !manipulation_rcheckableType.test( type ) );6291 })6292 .map(function( i, elem ){6293 var val = jQuery( this ).val();6294 return val == null ?6295 null :6296 jQuery.isArray( val ) ?6297 jQuery.map( val, function( val ){6298 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };6299 }) :6300 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };6301 }).get();6302 }6303});6304//Serialize an array of form elements or a set of6305//key/values into a query string6306jQuery.param = function( a, traditional ) {6307 var prefix,6308 s = [],6309 add = function( key, value ) {6310 // If value is a function, invoke it and return its value6311 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );6312 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );6313 };6314 // Set traditional to true for jQuery <= 1.3.2 behavior.6315 if ( traditional === undefined ) {6316 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;6317 }6318 // If an array was passed in, assume that it is an array of form elements.6319 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {6320 // Serialize the form elements6321 jQuery.each( a, function() {6322 add( this.name, this.value );6323 });6324 } else {6325 // If traditional, encode the "old" way (the way 1.3.2 or older6326 // did it), otherwise encode params recursively.6327 for ( prefix in a ) {6328 buildParams( prefix, a[ prefix ], traditional, add );6329 }6330 }6331 // Return the resulting serialization6332 return s.join( "&" ).replace( r20, "+" );6333};6334function buildParams( prefix, obj, traditional, add ) {6335 var name;6336 if ( jQuery.isArray( obj ) ) {6337 // Serialize array item.6338 jQuery.each( obj, function( i, v ) {6339 if ( traditional || rbracket.test( prefix ) ) {6340 // Treat each array item as a scalar.6341 add( prefix, v );6342 } else {6343 // Item is non-scalar (array or object), encode its numeric index.6344 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );6345 }6346 });6347 } else if ( !traditional && jQuery.type( obj ) === "object" ) {6348 // Serialize object item.6349 for ( name in obj ) {6350 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );6351 }6352 } else {6353 // Serialize scalar item.6354 add( prefix, obj );6355 }6356}6357jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +6358 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +6359 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {6360 // Handle event binding6361 jQuery.fn[ name ] = function( data, fn ) {6362 return arguments.length > 0 ?6363 this.on( name, null, data, fn ) :6364 this.trigger( name );6365 };6366});6367jQuery.fn.extend({6368 hover: function( fnOver, fnOut ) {6369 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );6370 },6371 bind: function( types, data, fn ) {6372 return this.on( types, null, data, fn );6373 },6374 unbind: function( types, fn ) {6375 return this.off( types, null, fn );6376 },6377 delegate: function( selector, types, data, fn ) {6378 return this.on( types, selector, data, fn );6379 },6380 undelegate: function( selector, types, fn ) {6381 // ( namespace ) or ( selector, types [, fn] )6382 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );6383 }6384});6385var6386 // Document location6387 ajaxLocParts,6388 ajaxLocation,6389 ajax_nonce = jQuery.now(),6390 ajax_rquery = /\?/,6391 rhash = /#.*$/,6392 rts = /([?&])_=[^&]*/,6393 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL6394 // #7653, #8125, #8152: local protocol detection6395 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,6396 rnoContent = /^(?:GET|HEAD)$/,6397 rprotocol = /^\/\//,6398 rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,6399 // Keep a copy of the old load method6400 _load = jQuery.fn.load,6401 /* Prefilters6402 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)6403 * 2) These are called:6404 * - BEFORE asking for a transport6405 * - AFTER param serialization (s.data is a string if s.processData is true)6406 * 3) key is the dataType6407 * 4) the catchall symbol "*" can be used6408 * 5) execution will start with transport dataType and THEN continue down to "*" if needed6409 */6410 prefilters = {},6411 /* Transports bindings6412 * 1) key is the dataType6413 * 2) the catchall symbol "*" can be used6414 * 3) selection will start with transport dataType and THEN go to "*" if needed6415 */6416 transports = {},6417 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression6418 allTypes = "*/".concat("*");6419// #8138, IE may throw an exception when accessing6420// a field from window.location if document.domain has been set6421try {6422 ajaxLocation = location.href;6423} catch( e ) {6424 // Use the href attribute of an A element6425 // since IE will modify it given document.location6426 ajaxLocation = document.createElement( "a" );6427 ajaxLocation.href = "";6428 ajaxLocation = ajaxLocation.href;6429}6430// Segment location into parts6431ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];6432// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport6433function addToPrefiltersOrTransports( structure ) {6434 // dataTypeExpression is optional and defaults to "*"6435 return function( dataTypeExpression, func ) {6436 if ( typeof dataTypeExpression !== "string" ) {6437 func = dataTypeExpression;6438 dataTypeExpression = "*";6439 }6440 var dataType,6441 i = 0,6442 dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];6443 if ( jQuery.isFunction( func ) ) {6444 // For each dataType in the dataTypeExpression6445 while ( (dataType = dataTypes[i++]) ) {6446 // Prepend if requested6447 if ( dataType[0] === "+" ) {6448 dataType = dataType.slice( 1 ) || "*";6449 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );6450 // Otherwise append6451 } else {6452 (structure[ dataType ] = structure[ dataType ] || []).push( func );6453 }6454 }6455 }6456 };6457}6458// Base inspection function for prefilters and transports6459function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {6460 var inspected = {},6461 seekingTransport = ( structure === transports );6462 function inspect( dataType ) {6463 var selected;6464 inspected[ dataType ] = true;6465 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {6466 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );6467 if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {6468 options.dataTypes.unshift( dataTypeOrTransport );6469 inspect( dataTypeOrTransport );6470 return false;6471 } else if ( seekingTransport ) {6472 return !( selected = dataTypeOrTransport );6473 }6474 });6475 return selected;6476 }6477 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );6478}6479// A special extend for ajax options6480// that takes "flat" options (not to be deep extended)6481// Fixes #98876482function ajaxExtend( target, src ) {6483 var deep, key,6484 flatOptions = jQuery.ajaxSettings.flatOptions || {};6485 for ( key in src ) {6486 if ( src[ key ] !== undefined ) {6487 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];6488 }6489 }6490 if ( deep ) {6491 jQuery.extend( true, target, deep );6492 }6493 return target;6494}6495jQuery.fn.load = function( url, params, callback ) {6496 if ( typeof url !== "string" && _load ) {6497 return _load.apply( this, arguments );6498 }6499 var selector, response, type,6500 self = this,6501 off = url.indexOf(" ");6502 if ( off >= 0 ) {6503 selector = url.slice( off, url.length );6504 url = url.slice( 0, off );6505 }6506 // If it's a function6507 if ( jQuery.isFunction( params ) ) {6508 // We assume that it's the callback6509 callback = params;6510 params = undefined;6511 // Otherwise, build a param string6512 } else if ( params && typeof params === "object" ) {6513 type = "POST";6514 }6515 // If we have elements to modify, make the request6516 if ( self.length > 0 ) {6517 jQuery.ajax({6518 url: url,6519 // if "type" variable is undefined, then "GET" method will be used6520 type: type,6521 dataType: "html",6522 data: params6523 }).done(function( responseText ) {6524 // Save response for use in complete callback6525 response = arguments;6526 self.html( selector ?6527 // If a selector was specified, locate the right elements in a dummy div6528 // Exclude scripts to avoid IE 'Permission Denied' errors6529 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :6530 // Otherwise use the full result6531 responseText );6532 }).complete( callback && function( jqXHR, status ) {6533 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );6534 });6535 }6536 return this;6537};6538// Attach a bunch of functions for handling common AJAX events6539jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){6540 jQuery.fn[ type ] = function( fn ){6541 return this.on( type, fn );6542 };6543});6544jQuery.extend({6545 // Counter for holding the number of active queries6546 active: 0,6547 // Last-Modified header cache for next request6548 lastModified: {},6549 etag: {},6550 ajaxSettings: {6551 url: ajaxLocation,6552 type: "GET",6553 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),6554 global: true,6555 processData: true,6556 async: true,6557 contentType: "application/x-www-form-urlencoded; charset=UTF-8",6558 /*6559 timeout: 0,6560 data: null,6561 dataType: null,6562 username: null,6563 password: null,6564 cache: null,6565 throws: false,6566 traditional: false,6567 headers: {},6568 */6569 accepts: {6570 "*": allTypes,6571 text: "text/plain",6572 html: "text/html",6573 xml: "application/xml, text/xml",6574 json: "application/json, text/javascript"6575 },6576 contents: {6577 xml: /xml/,6578 html: /html/,6579 json: /json/6580 },6581 responseFields: {6582 xml: "responseXML",6583 text: "responseText",6584 json: "responseJSON"6585 },6586 // Data converters6587 // Keys separate source (or catchall "*") and destination types with a single space6588 converters: {6589 // Convert anything to text6590 "* text": String,6591 // Text to html (true = no transformation)6592 "text html": true,6593 // Evaluate text as a json expression6594 "text json": jQuery.parseJSON,6595 // Parse text as xml6596 "text xml": jQuery.parseXML6597 },6598 // For options that shouldn't be deep extended:6599 // you can add your own custom options here if6600 // and when you create one that shouldn't be6601 // deep extended (see ajaxExtend)6602 flatOptions: {6603 url: true,6604 context: true6605 }6606 },6607 // Creates a full fledged settings object into target6608 // with both ajaxSettings and settings fields.6609 // If target is omitted, writes into ajaxSettings.6610 ajaxSetup: function( target, settings ) {6611 return settings ?6612 // Building a settings object6613 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :6614 // Extending ajaxSettings6615 ajaxExtend( jQuery.ajaxSettings, target );6616 },6617 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),6618 ajaxTransport: addToPrefiltersOrTransports( transports ),6619 // Main method6620 ajax: function( url, options ) {6621 // If url is an object, simulate pre-1.5 signature6622 if ( typeof url === "object" ) {6623 options = url;6624 url = undefined;6625 }6626 // Force options to be an object6627 options = options || {};6628 var // Cross-domain detection vars6629 parts,6630 // Loop variable6631 i,6632 // URL without anti-cache param6633 cacheURL,6634 // Response headers as string6635 responseHeadersString,6636 // timeout handle6637 timeoutTimer,6638 // To know if global events are to be dispatched6639 fireGlobals,6640 transport,6641 // Response headers6642 responseHeaders,6643 // Create the final options object6644 s = jQuery.ajaxSetup( {}, options ),6645 // Callbacks context6646 callbackContext = s.context || s,6647 // Context for global events is callbackContext if it is a DOM node or jQuery collection6648 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?6649 jQuery( callbackContext ) :6650 jQuery.event,6651 // Deferreds6652 deferred = jQuery.Deferred(),6653 completeDeferred = jQuery.Callbacks("once memory"),6654 // Status-dependent callbacks6655 statusCode = s.statusCode || {},6656 // Headers (they are sent all at once)6657 requestHeaders = {},6658 requestHeadersNames = {},6659 // The jqXHR state6660 state = 0,6661 // Default abort message6662 strAbort = "canceled",6663 // Fake xhr6664 jqXHR = {6665 readyState: 0,6666 // Builds headers hashtable if needed6667 getResponseHeader: function( key ) {6668 var match;6669 if ( state === 2 ) {6670 if ( !responseHeaders ) {6671 responseHeaders = {};6672 while ( (match = rheaders.exec( responseHeadersString )) ) {6673 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];6674 }6675 }6676 match = responseHeaders[ key.toLowerCase() ];6677 }6678 return match == null ? null : match;6679 },6680 // Raw string6681 getAllResponseHeaders: function() {6682 return state === 2 ? responseHeadersString : null;6683 },6684 // Caches the header6685 setRequestHeader: function( name, value ) {6686 var lname = name.toLowerCase();6687 if ( !state ) {6688 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;6689 requestHeaders[ name ] = value;6690 }6691 return this;6692 },6693 // Overrides response content-type header6694 overrideMimeType: function( type ) {6695 if ( !state ) {6696 s.mimeType = type;6697 }6698 return this;6699 },6700 // Status-dependent callbacks6701 statusCode: function( map ) {6702 var code;6703 if ( map ) {6704 if ( state < 2 ) {6705 for ( code in map ) {6706 // Lazy-add the new callback in a way that preserves old ones6707 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];6708 }6709 } else {6710 // Execute the appropriate callbacks6711 jqXHR.always( map[ jqXHR.status ] );6712 }6713 }6714 return this;6715 },6716 // Cancel the request6717 abort: function( statusText ) {6718 var finalText = statusText || strAbort;6719 if ( transport ) {6720 transport.abort( finalText );6721 }6722 done( 0, finalText );6723 return this;6724 }6725 };6726 // Attach deferreds6727 deferred.promise( jqXHR ).complete = completeDeferred.add;6728 jqXHR.success = jqXHR.done;6729 jqXHR.error = jqXHR.fail;6730 // Remove hash character (#7531: and string promotion)6731 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)6732 // Handle falsy url in the settings object (#10093: consistency with old signature)6733 // We also use the url parameter if available6734 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );6735 // Alias method option to type as per ticket #120046736 s.type = options.method || options.type || s.method || s.type;6737 // Extract dataTypes list6738 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];6739 // A cross-domain request is in order when we have a protocol:host:port mismatch6740 if ( s.crossDomain == null ) {6741 parts = rurl.exec( s.url.toLowerCase() );6742 s.crossDomain = !!( parts &&6743 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||6744 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==6745 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )6746 );6747 }6748 // Convert data if not already a string6749 if ( s.data && s.processData && typeof s.data !== "string" ) {6750 s.data = jQuery.param( s.data, s.traditional );6751 }6752 // Apply prefilters6753 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );6754 // If request was aborted inside a prefilter, stop there6755 if ( state === 2 ) {6756 return jqXHR;6757 }6758 // We can fire global events as of now if asked to6759 fireGlobals = s.global;6760 // Watch for a new set of requests6761 if ( fireGlobals && jQuery.active++ === 0 ) {6762 jQuery.event.trigger("ajaxStart");6763 }6764 // Uppercase the type6765 s.type = s.type.toUpperCase();6766 // Determine if request has content6767 s.hasContent = !rnoContent.test( s.type );6768 // Save the URL in case we're toying with the If-Modified-Since6769 // and/or If-None-Match header later on6770 cacheURL = s.url;6771 // More options handling for requests with no content6772 if ( !s.hasContent ) {6773 // If data is available, append data to url6774 if ( s.data ) {6775 cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );6776 // #9682: remove data so that it's not used in an eventual retry6777 delete s.data;6778 }6779 // Add anti-cache in url if needed6780 if ( s.cache === false ) {6781 s.url = rts.test( cacheURL ) ?6782 // If there is already a '_' parameter, set its value6783 cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :6784 // Otherwise add one to the end6785 cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;6786 }6787 }6788 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.6789 if ( s.ifModified ) {6790 if ( jQuery.lastModified[ cacheURL ] ) {6791 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );6792 }6793 if ( jQuery.etag[ cacheURL ] ) {6794 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );6795 }6796 }6797 // Set the correct header, if data is being sent6798 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {6799 jqXHR.setRequestHeader( "Content-Type", s.contentType );6800 }6801 // Set the Accepts header for the server, depending on the dataType6802 jqXHR.setRequestHeader(6803 "Accept",6804 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?6805 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :6806 s.accepts[ "*" ]6807 );6808 // Check for headers option6809 for ( i in s.headers ) {6810 jqXHR.setRequestHeader( i, s.headers[ i ] );6811 }6812 // Allow custom headers/mimetypes and early abort6813 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {6814 // Abort if not done already and return6815 return jqXHR.abort();6816 }6817 // aborting is no longer a cancellation6818 strAbort = "abort";6819 // Install callbacks on deferreds6820 for ( i in { success: 1, error: 1, complete: 1 } ) {6821 jqXHR[ i ]( s[ i ] );6822 }6823 // Get transport6824 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );6825 // If no transport, we auto-abort6826 if ( !transport ) {6827 done( -1, "No Transport" );6828 } else {6829 jqXHR.readyState = 1;6830 // Send global event6831 if ( fireGlobals ) {6832 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );6833 }6834 // Timeout6835 if ( s.async && s.timeout > 0 ) {6836 timeoutTimer = setTimeout(function() {6837 jqXHR.abort("timeout");6838 }, s.timeout );6839 }6840 try {6841 state = 1;6842 transport.send( requestHeaders, done );6843 } catch ( e ) {6844 // Propagate exception as error if not done6845 if ( state < 2 ) {6846 done( -1, e );6847 // Simply rethrow otherwise6848 } else {6849 throw e;6850 }6851 }6852 }6853 // Callback for when everything is done6854 function done( status, nativeStatusText, responses, headers ) {6855 var isSuccess, success, error, response, modified,6856 statusText = nativeStatusText;6857 // Called once6858 if ( state === 2 ) {6859 return;6860 }6861 // State is "done" now6862 state = 2;6863 // Clear timeout if it exists6864 if ( timeoutTimer ) {6865 clearTimeout( timeoutTimer );6866 }6867 // Dereference transport for early garbage collection6868 // (no matter how long the jqXHR object will be used)6869 transport = undefined;6870 // Cache response headers6871 responseHeadersString = headers || "";6872 // Set readyState6873 jqXHR.readyState = status > 0 ? 4 : 0;6874 // Determine if successful6875 isSuccess = status >= 200 && status < 300 || status === 304;6876 // Get response data6877 if ( responses ) {6878 response = ajaxHandleResponses( s, jqXHR, responses );6879 }6880 // Convert no matter what (that way responseXXX fields are always set)6881 response = ajaxConvert( s, response, jqXHR, isSuccess );6882 // If successful, handle type chaining6883 if ( isSuccess ) {6884 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.6885 if ( s.ifModified ) {6886 modified = jqXHR.getResponseHeader("Last-Modified");6887 if ( modified ) {6888 jQuery.lastModified[ cacheURL ] = modified;6889 }6890 modified = jqXHR.getResponseHeader("etag");6891 if ( modified ) {6892 jQuery.etag[ cacheURL ] = modified;6893 }6894 }6895 // if no content6896 if ( status === 204 || s.type === "HEAD" ) {6897 statusText = "nocontent";6898 // if not modified6899 } else if ( status === 304 ) {6900 statusText = "notmodified";6901 // If we have data, let's convert it6902 } else {6903 statusText = response.state;6904 success = response.data;6905 error = response.error;6906 isSuccess = !error;6907 }6908 } else {6909 // We extract error from statusText6910 // then normalize statusText and status for non-aborts6911 error = statusText;6912 if ( status || !statusText ) {6913 statusText = "error";6914 if ( status < 0 ) {6915 status = 0;6916 }6917 }6918 }6919 // Set data for the fake xhr object6920 jqXHR.status = status;6921 jqXHR.statusText = ( nativeStatusText || statusText ) + "";6922 // Success/Error6923 if ( isSuccess ) {6924 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );6925 } else {6926 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );6927 }6928 // Status-dependent callbacks6929 jqXHR.statusCode( statusCode );6930 statusCode = undefined;6931 if ( fireGlobals ) {6932 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",6933 [ jqXHR, s, isSuccess ? success : error ] );6934 }6935 // Complete6936 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );6937 if ( fireGlobals ) {6938 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );6939 // Handle the global AJAX counter6940 if ( !( --jQuery.active ) ) {6941 jQuery.event.trigger("ajaxStop");6942 }6943 }6944 }6945 return jqXHR;6946 },6947 getJSON: function( url, data, callback ) {6948 return jQuery.get( url, data, callback, "json" );6949 },6950 getScript: function( url, callback ) {6951 return jQuery.get( url, undefined, callback, "script" );6952 }6953});6954jQuery.each( [ "get", "post" ], function( i, method ) {6955 jQuery[ method ] = function( url, data, callback, type ) {6956 // shift arguments if data argument was omitted6957 if ( jQuery.isFunction( data ) ) {6958 type = type || callback;6959 callback = data;6960 data = undefined;6961 }6962 return jQuery.ajax({6963 url: url,6964 type: method,6965 dataType: type,6966 data: data,6967 success: callback6968 });6969 };6970});6971/* Handles responses to an ajax request:6972 * - finds the right dataType (mediates between content-type and expected dataType)6973 * - returns the corresponding response6974 */6975function ajaxHandleResponses( s, jqXHR, responses ) {6976 var firstDataType, ct, finalDataType, type,6977 contents = s.contents,6978 dataTypes = s.dataTypes;6979 // Remove auto dataType and get content-type in the process6980 while( dataTypes[ 0 ] === "*" ) {6981 dataTypes.shift();6982 if ( ct === undefined ) {6983 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");6984 }6985 }6986 // Check if we're dealing with a known content-type6987 if ( ct ) {6988 for ( type in contents ) {6989 if ( contents[ type ] && contents[ type ].test( ct ) ) {6990 dataTypes.unshift( type );6991 break;6992 }6993 }6994 }6995 // Check to see if we have a response for the expected dataType6996 if ( dataTypes[ 0 ] in responses ) {6997 finalDataType = dataTypes[ 0 ];6998 } else {6999 // Try convertible dataTypes7000 for ( type in responses ) {7001 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {7002 finalDataType = type;7003 break;7004 }7005 if ( !firstDataType ) {7006 firstDataType = type;7007 }7008 }7009 // Or just use first one7010 finalDataType = finalDataType || firstDataType;7011 }7012 // If we found a dataType7013 // We add the dataType to the list if needed7014 // and return the corresponding response7015 if ( finalDataType ) {7016 if ( finalDataType !== dataTypes[ 0 ] ) {7017 dataTypes.unshift( finalDataType );7018 }7019 return responses[ finalDataType ];7020 }7021}7022/* Chain conversions given the request and the original response7023 * Also sets the responseXXX fields on the jqXHR instance7024 */7025function ajaxConvert( s, response, jqXHR, isSuccess ) {7026 var conv2, current, conv, tmp, prev,7027 converters = {},7028 // Work with a copy of dataTypes in case we need to modify it for conversion7029 dataTypes = s.dataTypes.slice();7030 // Create converters map with lowercased keys7031 if ( dataTypes[ 1 ] ) {7032 for ( conv in s.converters ) {7033 converters[ conv.toLowerCase() ] = s.converters[ conv ];7034 }7035 }7036 current = dataTypes.shift();7037 // Convert to each sequential dataType7038 while ( current ) {7039 if ( s.responseFields[ current ] ) {7040 jqXHR[ s.responseFields[ current ] ] = response;7041 }7042 // Apply the dataFilter if provided7043 if ( !prev && isSuccess && s.dataFilter ) {7044 response = s.dataFilter( response, s.dataType );7045 }7046 prev = current;7047 current = dataTypes.shift();7048 if ( current ) {7049 // There's only work to do if current dataType is non-auto7050 if ( current === "*" ) {7051 current = prev;7052 // Convert response if prev dataType is non-auto and differs from current7053 } else if ( prev !== "*" && prev !== current ) {7054 // Seek a direct converter7055 conv = converters[ prev + " " + current ] || converters[ "* " + current ];7056 // If none found, seek a pair7057 if ( !conv ) {7058 for ( conv2 in converters ) {7059 // If conv2 outputs current7060 tmp = conv2.split( " " );7061 if ( tmp[ 1 ] === current ) {7062 // If prev can be converted to accepted input7063 conv = converters[ prev + " " + tmp[ 0 ] ] ||7064 converters[ "* " + tmp[ 0 ] ];7065 if ( conv ) {7066 // Condense equivalence converters7067 if ( conv === true ) {7068 conv = converters[ conv2 ];7069 // Otherwise, insert the intermediate dataType7070 } else if ( converters[ conv2 ] !== true ) {7071 current = tmp[ 0 ];7072 dataTypes.unshift( tmp[ 1 ] );7073 }7074 break;7075 }7076 }7077 }7078 }7079 // Apply converter (if not an equivalence)7080 if ( conv !== true ) {7081 // Unless errors are allowed to bubble, catch and return them7082 if ( conv && s[ "throws" ] ) {7083 response = conv( response );7084 } else {7085 try {7086 response = conv( response );7087 } catch ( e ) {7088 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };7089 }7090 }7091 }7092 }7093 }7094 }7095 return { state: "success", data: response };7096}7097// Install script dataType7098jQuery.ajaxSetup({7099 accepts: {7100 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"7101 },7102 contents: {7103 script: /(?:java|ecma)script/7104 },7105 converters: {7106 "text script": function( text ) {7107 jQuery.globalEval( text );7108 return text;7109 }7110 }7111});7112// Handle cache's special case and global7113jQuery.ajaxPrefilter( "script", function( s ) {7114 if ( s.cache === undefined ) {7115 s.cache = false;7116 }7117 if ( s.crossDomain ) {7118 s.type = "GET";7119 s.global = false;7120 }7121});7122// Bind script tag hack transport7123jQuery.ajaxTransport( "script", function(s) {7124 // This transport only deals with cross domain requests7125 if ( s.crossDomain ) {7126 var script,7127 head = document.head || jQuery("head")[0] || document.documentElement;7128 return {7129 send: function( _, callback ) {7130 script = document.createElement("script");7131 script.async = true;7132 if ( s.scriptCharset ) {7133 script.charset = s.scriptCharset;7134 }7135 script.src = s.url;7136 // Attach handlers for all browsers7137 script.onload = script.onreadystatechange = function( _, isAbort ) {7138 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {7139 // Handle memory leak in IE7140 script.onload = script.onreadystatechange = null;7141 // Remove the script7142 if ( script.parentNode ) {7143 script.parentNode.removeChild( script );7144 }7145 // Dereference the script7146 script = null;7147 // Callback if not abort7148 if ( !isAbort ) {7149 callback( 200, "success" );7150 }7151 }7152 };7153 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending7154 // Use native DOM manipulation to avoid our domManip AJAX trickery7155 head.insertBefore( script, head.firstChild );7156 },7157 abort: function() {7158 if ( script ) {7159 script.onload( undefined, true );7160 }7161 }7162 };7163 }7164});7165var oldCallbacks = [],7166 rjsonp = /(=)\?(?=&|$)|\?\?/;7167// Default jsonp settings7168jQuery.ajaxSetup({7169 jsonp: "callback",7170 jsonpCallback: function() {7171 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );7172 this[ callback ] = true;7173 return callback;7174 }7175});7176// Detect, normalize options and install callbacks for jsonp requests7177jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {7178 var callbackName, overwritten, responseContainer,7179 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?7180 "url" :7181 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"7182 );7183 // Handle iff the expected data type is "jsonp" or we have a parameter to set7184 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {7185 // Get callback name, remembering preexisting value associated with it7186 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?7187 s.jsonpCallback() :7188 s.jsonpCallback;7189 // Insert callback into url or form data7190 if ( jsonProp ) {7191 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );7192 } else if ( s.jsonp !== false ) {7193 s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;7194 }7195 // Use data converter to retrieve json after script execution7196 s.converters["script json"] = function() {7197 if ( !responseContainer ) {7198 jQuery.error( callbackName + " was not called" );7199 }7200 return responseContainer[ 0 ];7201 };7202 // force json dataType7203 s.dataTypes[ 0 ] = "json";7204 // Install callback7205 overwritten = window[ callbackName ];7206 window[ callbackName ] = function() {7207 responseContainer = arguments;7208 };7209 // Clean-up function (fires after converters)7210 jqXHR.always(function() {7211 // Restore preexisting value7212 window[ callbackName ] = overwritten;7213 // Save back as free7214 if ( s[ callbackName ] ) {7215 // make sure that re-using the options doesn't screw things around7216 s.jsonpCallback = originalSettings.jsonpCallback;7217 // save the callback name for future use7218 oldCallbacks.push( callbackName );7219 }7220 // Call if it was a function and we have a response7221 if ( responseContainer && jQuery.isFunction( overwritten ) ) {7222 overwritten( responseContainer[ 0 ] );7223 }7224 responseContainer = overwritten = undefined;7225 });7226 // Delegate to script7227 return "script";7228 }7229});7230var xhrCallbacks, xhrSupported,7231 xhrId = 0,7232 // #5280: Internet Explorer will keep connections alive if we don't abort on unload7233 xhrOnUnloadAbort = window.ActiveXObject && function() {7234 // Abort all pending requests7235 var key;7236 for ( key in xhrCallbacks ) {7237 xhrCallbacks[ key ]( undefined, true );7238 }7239 };7240// Functions to create xhrs7241function createStandardXHR() {7242 try {7243 return new window.XMLHttpRequest();7244 } catch( e ) {}7245}7246function createActiveXHR() {7247 try {7248 return new window.ActiveXObject("Microsoft.XMLHTTP");7249 } catch( e ) {}7250}7251// Create the request object7252// (This is still attached to ajaxSettings for backward compatibility)7253jQuery.ajaxSettings.xhr = window.ActiveXObject ?7254 /* Microsoft failed to properly7255 * implement the XMLHttpRequest in IE7 (can't request local files),7256 * so we use the ActiveXObject when it is available7257 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so7258 * we need a fallback.7259 */7260 function() {7261 return !this.isLocal && createStandardXHR() || createActiveXHR();7262 } :7263 // For all other browsers, use the standard XMLHttpRequest object7264 createStandardXHR;7265// Determine support properties7266xhrSupported = jQuery.ajaxSettings.xhr();7267jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );7268xhrSupported = jQuery.support.ajax = !!xhrSupported;7269// Create transport if the browser can provide an xhr7270if ( xhrSupported ) {7271 jQuery.ajaxTransport(function( s ) {7272 // Cross domain only allowed if supported through XMLHttpRequest7273 if ( !s.crossDomain || jQuery.support.cors ) {7274 var callback;7275 return {7276 send: function( headers, complete ) {7277 // Get a new xhr7278 var handle, i,7279 xhr = s.xhr();7280 // Open the socket7281 // Passing null username, generates a login popup on Opera (#2865)7282 if ( s.username ) {7283 xhr.open( s.type, s.url, s.async, s.username, s.password );7284 } else {7285 xhr.open( s.type, s.url, s.async );7286 }7287 // Apply custom fields if provided7288 if ( s.xhrFields ) {7289 for ( i in s.xhrFields ) {7290 xhr[ i ] = s.xhrFields[ i ];7291 }7292 }7293 // Override mime type if needed7294 if ( s.mimeType && xhr.overrideMimeType ) {7295 xhr.overrideMimeType( s.mimeType );7296 }7297 // X-Requested-With header7298 // For cross-domain requests, seeing as conditions for a preflight are7299 // akin to a jigsaw puzzle, we simply never set it to be sure.7300 // (it can always be set on a per-request basis or even using ajaxSetup)7301 // For same-domain requests, won't change header if already provided.7302 if ( !s.crossDomain && !headers["X-Requested-With"] ) {7303 headers["X-Requested-With"] = "XMLHttpRequest";7304 }7305 // Need an extra try/catch for cross domain requests in Firefox 37306 try {7307 for ( i in headers ) {7308 xhr.setRequestHeader( i, headers[ i ] );7309 }7310 } catch( err ) {}7311 // Do send the request7312 // This may raise an exception which is actually7313 // handled in jQuery.ajax (so no try/catch here)7314 xhr.send( ( s.hasContent && s.data ) || null );7315 // Listener7316 callback = function( _, isAbort ) {7317 var status, responseHeaders, statusText, responses;7318 // Firefox throws exceptions when accessing properties7319 // of an xhr when a network error occurred7320 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)7321 try {7322 // Was never called and is aborted or complete7323 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {7324 // Only called once7325 callback = undefined;7326 // Do not keep as active anymore7327 if ( handle ) {7328 xhr.onreadystatechange = jQuery.noop;7329 if ( xhrOnUnloadAbort ) {7330 delete xhrCallbacks[ handle ];7331 }7332 }7333 // If it's an abort7334 if ( isAbort ) {7335 // Abort it manually if needed7336 if ( xhr.readyState !== 4 ) {7337 xhr.abort();7338 }7339 } else {7340 responses = {};7341 status = xhr.status;7342 responseHeaders = xhr.getAllResponseHeaders();7343 // When requesting binary data, IE6-9 will throw an exception7344 // on any attempt to access responseText (#11426)7345 if ( typeof xhr.responseText === "string" ) {7346 responses.text = xhr.responseText;7347 }7348 // Firefox throws an exception when accessing7349 // statusText for faulty cross-domain requests7350 try {7351 statusText = xhr.statusText;7352 } catch( e ) {7353 // We normalize with Webkit giving an empty statusText7354 statusText = "";7355 }7356 // Filter status for non standard behaviors7357 // If the request is local and we have data: assume a success7358 // (success with no data won't get notified, that's the best we7359 // can do given current implementations)7360 if ( !status && s.isLocal && !s.crossDomain ) {7361 status = responses.text ? 200 : 404;7362 // IE - #1450: sometimes returns 1223 when it should be 2047363 } else if ( status === 1223 ) {7364 status = 204;7365 }7366 }7367 }7368 } catch( firefoxAccessException ) {7369 if ( !isAbort ) {7370 complete( -1, firefoxAccessException );7371 }7372 }7373 // Call complete if needed7374 if ( responses ) {7375 complete( status, statusText, responses, responseHeaders );7376 }7377 };7378 if ( !s.async ) {7379 // if we're in sync mode we fire the callback7380 callback();7381 } else if ( xhr.readyState === 4 ) {7382 // (IE6 & IE7) if it's in cache and has been7383 // retrieved directly we need to fire the callback7384 setTimeout( callback );7385 } else {7386 handle = ++xhrId;7387 if ( xhrOnUnloadAbort ) {7388 // Create the active xhrs callbacks list if needed7389 // and attach the unload handler7390 if ( !xhrCallbacks ) {7391 xhrCallbacks = {};7392 jQuery( window ).unload( xhrOnUnloadAbort );7393 }7394 // Add to list of active xhrs callbacks7395 xhrCallbacks[ handle ] = callback;7396 }7397 xhr.onreadystatechange = callback;7398 }7399 },7400 abort: function() {7401 if ( callback ) {7402 callback( undefined, true );7403 }7404 }7405 };7406 }7407 });7408}7409var fxNow, timerId,7410 rfxtypes = /^(?:toggle|show|hide)$/,7411 rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),7412 rrun = /queueHooks$/,7413 animationPrefilters = [ defaultPrefilter ],7414 tweeners = {7415 "*": [function( prop, value ) {7416 var tween = this.createTween( prop, value ),7417 target = tween.cur(),7418 parts = rfxnum.exec( value ),7419 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),7420 // Starting value computation is required for potential unit mismatches7421 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&7422 rfxnum.exec( jQuery.css( tween.elem, prop ) ),7423 scale = 1,7424 maxIterations = 20;7425 if ( start && start[ 3 ] !== unit ) {7426 // Trust units reported by jQuery.css7427 unit = unit || start[ 3 ];7428 // Make sure we update the tween properties later on7429 parts = parts || [];7430 // Iteratively approximate from a nonzero starting point7431 start = +target || 1;7432 do {7433 // If previous iteration zeroed out, double until we get *something*7434 // Use a string for doubling factor so we don't accidentally see scale as unchanged below7435 scale = scale || ".5";7436 // Adjust and apply7437 start = start / scale;7438 jQuery.style( tween.elem, prop, start + unit );7439 // Update scale, tolerating zero or NaN from tween.cur()7440 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough7441 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );7442 }7443 // Update tween properties7444 if ( parts ) {7445 start = tween.start = +start || +target || 0;7446 tween.unit = unit;7447 // If a +=/-= token was provided, we're doing a relative animation7448 tween.end = parts[ 1 ] ?7449 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :7450 +parts[ 2 ];7451 }7452 return tween;7453 }]7454 };7455// Animations created synchronously will run synchronously7456function createFxNow() {7457 setTimeout(function() {7458 fxNow = undefined;7459 });7460 return ( fxNow = jQuery.now() );7461}7462function createTween( value, prop, animation ) {7463 var tween,7464 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),7465 index = 0,7466 length = collection.length;7467 for ( ; index < length; index++ ) {7468 if ( (tween = collection[ index ].call( animation, prop, value )) ) {7469 // we're done with this property7470 return tween;7471 }7472 }7473}7474function Animation( elem, properties, options ) {7475 var result,7476 stopped,7477 index = 0,7478 length = animationPrefilters.length,7479 deferred = jQuery.Deferred().always( function() {7480 // don't match elem in the :animated selector7481 delete tick.elem;7482 }),7483 tick = function() {7484 if ( stopped ) {7485 return false;7486 }7487 var currentTime = fxNow || createFxNow(),7488 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),7489 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)7490 temp = remaining / animation.duration || 0,7491 percent = 1 - temp,7492 index = 0,7493 length = animation.tweens.length;7494 for ( ; index < length ; index++ ) {7495 animation.tweens[ index ].run( percent );7496 }7497 deferred.notifyWith( elem, [ animation, percent, remaining ]);7498 if ( percent < 1 && length ) {7499 return remaining;7500 } else {7501 deferred.resolveWith( elem, [ animation ] );7502 return false;7503 }7504 },7505 animation = deferred.promise({7506 elem: elem,7507 props: jQuery.extend( {}, properties ),7508 opts: jQuery.extend( true, { specialEasing: {} }, options ),7509 originalProperties: properties,7510 originalOptions: options,7511 startTime: fxNow || createFxNow(),7512 duration: options.duration,7513 tweens: [],7514 createTween: function( prop, end ) {7515 var tween = jQuery.Tween( elem, animation.opts, prop, end,7516 animation.opts.specialEasing[ prop ] || animation.opts.easing );7517 animation.tweens.push( tween );7518 return tween;7519 },7520 stop: function( gotoEnd ) {7521 var index = 0,7522 // if we are going to the end, we want to run all the tweens7523 // otherwise we skip this part7524 length = gotoEnd ? animation.tweens.length : 0;7525 if ( stopped ) {7526 return this;7527 }7528 stopped = true;7529 for ( ; index < length ; index++ ) {7530 animation.tweens[ index ].run( 1 );7531 }7532 // resolve when we played the last frame7533 // otherwise, reject7534 if ( gotoEnd ) {7535 deferred.resolveWith( elem, [ animation, gotoEnd ] );7536 } else {7537 deferred.rejectWith( elem, [ animation, gotoEnd ] );7538 }7539 return this;7540 }7541 }),7542 props = animation.props;7543 propFilter( props, animation.opts.specialEasing );7544 for ( ; index < length ; index++ ) {7545 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );7546 if ( result ) {7547 return result;7548 }7549 }7550 jQuery.map( props, createTween, animation );7551 if ( jQuery.isFunction( animation.opts.start ) ) {7552 animation.opts.start.call( elem, animation );7553 }7554 jQuery.fx.timer(7555 jQuery.extend( tick, {7556 elem: elem,7557 anim: animation,7558 queue: animation.opts.queue7559 })7560 );7561 // attach callbacks from options7562 return animation.progress( animation.opts.progress )7563 .done( animation.opts.done, animation.opts.complete )7564 .fail( animation.opts.fail )7565 .always( animation.opts.always );7566}7567function propFilter( props, specialEasing ) {7568 var index, name, easing, value, hooks;7569 // camelCase, specialEasing and expand cssHook pass7570 for ( index in props ) {7571 name = jQuery.camelCase( index );7572 easing = specialEasing[ name ];7573 value = props[ index ];7574 if ( jQuery.isArray( value ) ) {7575 easing = value[ 1 ];7576 value = props[ index ] = value[ 0 ];7577 }7578 if ( index !== name ) {7579 props[ name ] = value;7580 delete props[ index ];7581 }7582 hooks = jQuery.cssHooks[ name ];7583 if ( hooks && "expand" in hooks ) {7584 value = hooks.expand( value );7585 delete props[ name ];7586 // not quite $.extend, this wont overwrite keys already present.7587 // also - reusing 'index' from above because we have the correct "name"7588 for ( index in value ) {7589 if ( !( index in props ) ) {7590 props[ index ] = value[ index ];7591 specialEasing[ index ] = easing;7592 }7593 }7594 } else {7595 specialEasing[ name ] = easing;7596 }7597 }7598}7599jQuery.Animation = jQuery.extend( Animation, {7600 tweener: function( props, callback ) {7601 if ( jQuery.isFunction( props ) ) {7602 callback = props;7603 props = [ "*" ];7604 } else {7605 props = props.split(" ");7606 }7607 var prop,7608 index = 0,7609 length = props.length;7610 for ( ; index < length ; index++ ) {7611 prop = props[ index ];7612 tweeners[ prop ] = tweeners[ prop ] || [];7613 tweeners[ prop ].unshift( callback );7614 }7615 },7616 prefilter: function( callback, prepend ) {7617 if ( prepend ) {7618 animationPrefilters.unshift( callback );7619 } else {7620 animationPrefilters.push( callback );7621 }7622 }7623});7624function defaultPrefilter( elem, props, opts ) {7625 /* jshint validthis: true */7626 var prop, value, toggle, tween, hooks, oldfire,7627 anim = this,7628 orig = {},7629 style = elem.style,7630 hidden = elem.nodeType && isHidden( elem ),7631 dataShow = jQuery._data( elem, "fxshow" );7632 // handle queue: false promises7633 if ( !opts.queue ) {7634 hooks = jQuery._queueHooks( elem, "fx" );7635 if ( hooks.unqueued == null ) {7636 hooks.unqueued = 0;7637 oldfire = hooks.empty.fire;7638 hooks.empty.fire = function() {7639 if ( !hooks.unqueued ) {7640 oldfire();7641 }7642 };7643 }7644 hooks.unqueued++;7645 anim.always(function() {7646 // doing this makes sure that the complete handler will be called7647 // before this completes7648 anim.always(function() {7649 hooks.unqueued--;7650 if ( !jQuery.queue( elem, "fx" ).length ) {7651 hooks.empty.fire();7652 }7653 });7654 });7655 }7656 // height/width overflow pass7657 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {7658 // Make sure that nothing sneaks out7659 // Record all 3 overflow attributes because IE does not7660 // change the overflow attribute when overflowX and7661 // overflowY are set to the same value7662 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];7663 // Set display property to inline-block for height/width7664 // animations on inline elements that are having width/height animated7665 if ( jQuery.css( elem, "display" ) === "inline" &&7666 jQuery.css( elem, "float" ) === "none" ) {7667 // inline-level elements accept inline-block;7668 // block-level elements need to be inline with layout7669 if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {7670 style.display = "inline-block";7671 } else {7672 style.zoom = 1;7673 }7674 }7675 }7676 if ( opts.overflow ) {7677 style.overflow = "hidden";7678 if ( !jQuery.support.shrinkWrapBlocks ) {7679 anim.always(function() {7680 style.overflow = opts.overflow[ 0 ];7681 style.overflowX = opts.overflow[ 1 ];7682 style.overflowY = opts.overflow[ 2 ];7683 });7684 }7685 }7686 // show/hide pass7687 for ( prop in props ) {7688 value = props[ prop ];7689 if ( rfxtypes.exec( value ) ) {7690 delete props[ prop ];7691 toggle = toggle || value === "toggle";7692 if ( value === ( hidden ? "hide" : "show" ) ) {7693 continue;7694 }7695 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );7696 }7697 }7698 if ( !jQuery.isEmptyObject( orig ) ) {7699 if ( dataShow ) {7700 if ( "hidden" in dataShow ) {7701 hidden = dataShow.hidden;7702 }7703 } else {7704 dataShow = jQuery._data( elem, "fxshow", {} );7705 }7706 // store state if its toggle - enables .stop().toggle() to "reverse"7707 if ( toggle ) {7708 dataShow.hidden = !hidden;7709 }7710 if ( hidden ) {7711 jQuery( elem ).show();7712 } else {7713 anim.done(function() {7714 jQuery( elem ).hide();7715 });7716 }7717 anim.done(function() {7718 var prop;7719 jQuery._removeData( elem, "fxshow" );7720 for ( prop in orig ) {7721 jQuery.style( elem, prop, orig[ prop ] );7722 }7723 });7724 for ( prop in orig ) {7725 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );7726 if ( !( prop in dataShow ) ) {7727 dataShow[ prop ] = tween.start;7728 if ( hidden ) {7729 tween.end = tween.start;7730 tween.start = prop === "width" || prop === "height" ? 1 : 0;7731 }7732 }7733 }7734 }7735}7736function Tween( elem, options, prop, end, easing ) {7737 return new Tween.prototype.init( elem, options, prop, end, easing );7738}7739jQuery.Tween = Tween;7740Tween.prototype = {7741 constructor: Tween,7742 init: function( elem, options, prop, end, easing, unit ) {7743 this.elem = elem;7744 this.prop = prop;7745 this.easing = easing || "swing";7746 this.options = options;7747 this.start = this.now = this.cur();7748 this.end = end;7749 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );7750 },7751 cur: function() {7752 var hooks = Tween.propHooks[ this.prop ];7753 return hooks && hooks.get ?7754 hooks.get( this ) :7755 Tween.propHooks._default.get( this );7756 },7757 run: function( percent ) {7758 var eased,7759 hooks = Tween.propHooks[ this.prop ];7760 if ( this.options.duration ) {7761 this.pos = eased = jQuery.easing[ this.easing ](7762 percent, this.options.duration * percent, 0, 1, this.options.duration7763 );7764 } else {7765 this.pos = eased = percent;7766 }7767 this.now = ( this.end - this.start ) * eased + this.start;7768 if ( this.options.step ) {7769 this.options.step.call( this.elem, this.now, this );7770 }7771 if ( hooks && hooks.set ) {7772 hooks.set( this );7773 } else {7774 Tween.propHooks._default.set( this );7775 }7776 return this;7777 }7778};7779Tween.prototype.init.prototype = Tween.prototype;7780Tween.propHooks = {7781 _default: {7782 get: function( tween ) {7783 var result;7784 if ( tween.elem[ tween.prop ] != null &&7785 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {7786 return tween.elem[ tween.prop ];7787 }7788 // passing an empty string as a 3rd parameter to .css will automatically7789 // attempt a parseFloat and fallback to a string if the parse fails7790 // so, simple values such as "10px" are parsed to Float.7791 // complex values such as "rotate(1rad)" are returned as is.7792 result = jQuery.css( tween.elem, tween.prop, "" );7793 // Empty strings, null, undefined and "auto" are converted to 0.7794 return !result || result === "auto" ? 0 : result;7795 },7796 set: function( tween ) {7797 // use step hook for back compat - use cssHook if its there - use .style if its7798 // available and use plain properties where available7799 if ( jQuery.fx.step[ tween.prop ] ) {7800 jQuery.fx.step[ tween.prop ]( tween );7801 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {7802 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );7803 } else {7804 tween.elem[ tween.prop ] = tween.now;7805 }7806 }7807 }7808};7809// Support: IE <=97810// Panic based approach to setting things on disconnected nodes7811Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {7812 set: function( tween ) {7813 if ( tween.elem.nodeType && tween.elem.parentNode ) {7814 tween.elem[ tween.prop ] = tween.now;7815 }7816 }7817};7818jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {7819 var cssFn = jQuery.fn[ name ];7820 jQuery.fn[ name ] = function( speed, easing, callback ) {7821 return speed == null || typeof speed === "boolean" ?7822 cssFn.apply( this, arguments ) :7823 this.animate( genFx( name, true ), speed, easing, callback );7824 };7825});7826jQuery.fn.extend({7827 fadeTo: function( speed, to, easing, callback ) {7828 // show any hidden elements after setting opacity to 07829 return this.filter( isHidden ).css( "opacity", 0 ).show()7830 // animate to the value specified7831 .end().animate({ opacity: to }, speed, easing, callback );7832 },7833 animate: function( prop, speed, easing, callback ) {7834 var empty = jQuery.isEmptyObject( prop ),7835 optall = jQuery.speed( speed, easing, callback ),7836 doAnimation = function() {7837 // Operate on a copy of prop so per-property easing won't be lost7838 var anim = Animation( this, jQuery.extend( {}, prop ), optall );7839 // Empty animations, or finishing resolves immediately7840 if ( empty || jQuery._data( this, "finish" ) ) {7841 anim.stop( true );7842 }7843 };7844 doAnimation.finish = doAnimation;7845 return empty || optall.queue === false ?7846 this.each( doAnimation ) :7847 this.queue( optall.queue, doAnimation );7848 },7849 stop: function( type, clearQueue, gotoEnd ) {7850 var stopQueue = function( hooks ) {7851 var stop = hooks.stop;7852 delete hooks.stop;7853 stop( gotoEnd );7854 };7855 if ( typeof type !== "string" ) {7856 gotoEnd = clearQueue;7857 clearQueue = type;7858 type = undefined;7859 }7860 if ( clearQueue && type !== false ) {7861 this.queue( type || "fx", [] );7862 }7863 return this.each(function() {7864 var dequeue = true,7865 index = type != null && type + "queueHooks",7866 timers = jQuery.timers,7867 data = jQuery._data( this );7868 if ( index ) {7869 if ( data[ index ] && data[ index ].stop ) {7870 stopQueue( data[ index ] );7871 }7872 } else {7873 for ( index in data ) {7874 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {7875 stopQueue( data[ index ] );7876 }7877 }7878 }7879 for ( index = timers.length; index--; ) {7880 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {7881 timers[ index ].anim.stop( gotoEnd );7882 dequeue = false;7883 timers.splice( index, 1 );7884 }7885 }7886 // start the next in the queue if the last step wasn't forced7887 // timers currently will call their complete callbacks, which will dequeue7888 // but only if they were gotoEnd7889 if ( dequeue || !gotoEnd ) {7890 jQuery.dequeue( this, type );7891 }7892 });7893 },7894 finish: function( type ) {7895 if ( type !== false ) {7896 type = type || "fx";7897 }7898 return this.each(function() {7899 var index,7900 data = jQuery._data( this ),7901 queue = data[ type + "queue" ],7902 hooks = data[ type + "queueHooks" ],7903 timers = jQuery.timers,7904 length = queue ? queue.length : 0;7905 // enable finishing flag on private data7906 data.finish = true;7907 // empty the queue first7908 jQuery.queue( this, type, [] );7909 if ( hooks && hooks.stop ) {7910 hooks.stop.call( this, true );7911 }7912 // look for any active animations, and finish them7913 for ( index = timers.length; index--; ) {7914 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {7915 timers[ index ].anim.stop( true );7916 timers.splice( index, 1 );7917 }7918 }7919 // look for any animations in the old queue and finish them7920 for ( index = 0; index < length; index++ ) {7921 if ( queue[ index ] && queue[ index ].finish ) {7922 queue[ index ].finish.call( this );7923 }7924 }7925 // turn off finishing flag7926 delete data.finish;7927 });7928 }7929});7930// Generate parameters to create a standard animation7931function genFx( type, includeWidth ) {7932 var which,7933 attrs = { height: type },7934 i = 0;7935 // if we include width, step value is 1 to do all cssExpand values,7936 // if we don't include width, step value is 2 to skip over Left and Right7937 includeWidth = includeWidth? 1 : 0;7938 for( ; i < 4 ; i += 2 - includeWidth ) {7939 which = cssExpand[ i ];7940 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;7941 }7942 if ( includeWidth ) {7943 attrs.opacity = attrs.width = type;7944 }7945 return attrs;7946}7947// Generate shortcuts for custom animations7948jQuery.each({7949 slideDown: genFx("show"),7950 slideUp: genFx("hide"),7951 slideToggle: genFx("toggle"),7952 fadeIn: { opacity: "show" },7953 fadeOut: { opacity: "hide" },7954 fadeToggle: { opacity: "toggle" }7955}, function( name, props ) {7956 jQuery.fn[ name ] = function( speed, easing, callback ) {7957 return this.animate( props, speed, easing, callback );7958 };7959});7960jQuery.speed = function( speed, easing, fn ) {7961 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {7962 complete: fn || !fn && easing ||7963 jQuery.isFunction( speed ) && speed,7964 duration: speed,7965 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing7966 };7967 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :7968 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;7969 // normalize opt.queue - true/undefined/null -> "fx"7970 if ( opt.queue == null || opt.queue === true ) {7971 opt.queue = "fx";7972 }7973 // Queueing7974 opt.old = opt.complete;7975 opt.complete = function() {7976 if ( jQuery.isFunction( opt.old ) ) {7977 opt.old.call( this );7978 }7979 if ( opt.queue ) {7980 jQuery.dequeue( this, opt.queue );7981 }7982 };7983 return opt;7984};7985jQuery.easing = {7986 linear: function( p ) {7987 return p;7988 },7989 swing: function( p ) {7990 return 0.5 - Math.cos( p*Math.PI ) / 2;7991 }7992};7993jQuery.timers = [];7994jQuery.fx = Tween.prototype.init;7995jQuery.fx.tick = function() {7996 var timer,7997 timers = jQuery.timers,7998 i = 0;7999 fxNow = jQuery.now();8000 for ( ; i < timers.length; i++ ) {8001 timer = timers[ i ];8002 // Checks the timer has not already been removed8003 if ( !timer() && timers[ i ] === timer ) {8004 timers.splice( i--, 1 );8005 }8006 }8007 if ( !timers.length ) {8008 jQuery.fx.stop();8009 }8010 fxNow = undefined;8011};8012jQuery.fx.timer = function( timer ) {8013 if ( timer() && jQuery.timers.push( timer ) ) {8014 jQuery.fx.start();8015 }8016};8017jQuery.fx.interval = 13;8018jQuery.fx.start = function() {8019 if ( !timerId ) {8020 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );8021 }8022};8023jQuery.fx.stop = function() {8024 clearInterval( timerId );8025 timerId = null;8026};8027jQuery.fx.speeds = {8028 slow: 600,8029 fast: 200,8030 // Default speed8031 _default: 4008032};8033// Back Compat <1.8 extension point8034jQuery.fx.step = {};8035if ( jQuery.expr && jQuery.expr.filters ) {8036 jQuery.expr.filters.animated = function( elem ) {8037 return jQuery.grep(jQuery.timers, function( fn ) {8038 return elem === fn.elem;8039 }).length;8040 };8041}8042jQuery.fn.offset = function( options ) {8043 if ( arguments.length ) {8044 return options === undefined ?8045 this :8046 this.each(function( i ) {8047 jQuery.offset.setOffset( this, options, i );8048 });8049 }8050 var docElem, win,8051 box = { top: 0, left: 0 },8052 elem = this[ 0 ],8053 doc = elem && elem.ownerDocument;8054 if ( !doc ) {8055 return;8056 }8057 docElem = doc.documentElement;8058 // Make sure it's not a disconnected DOM node8059 if ( !jQuery.contains( docElem, elem ) ) {8060 return box;8061 }8062 // If we don't have gBCR, just use 0,0 rather than error8063 // BlackBerry 5, iOS 3 (original iPhone)8064 if ( typeof elem.getBoundingClientRect !== core_strundefined ) {8065 box = elem.getBoundingClientRect();8066 }8067 win = getWindow( doc );8068 return {8069 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),8070 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )8071 };8072};8073jQuery.offset = {8074 setOffset: function( elem, options, i ) {8075 var position = jQuery.css( elem, "position" );8076 // set position first, in-case top/left are set even on static elem8077 if ( position === "static" ) {8078 elem.style.position = "relative";8079 }8080 var curElem = jQuery( elem ),8081 curOffset = curElem.offset(),8082 curCSSTop = jQuery.css( elem, "top" ),8083 curCSSLeft = jQuery.css( elem, "left" ),8084 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,8085 props = {}, curPosition = {}, curTop, curLeft;8086 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed8087 if ( calculatePosition ) {8088 curPosition = curElem.position();8089 curTop = curPosition.top;8090 curLeft = curPosition.left;8091 } else {8092 curTop = parseFloat( curCSSTop ) || 0;8093 curLeft = parseFloat( curCSSLeft ) || 0;8094 }8095 if ( jQuery.isFunction( options ) ) {8096 options = options.call( elem, i, curOffset );8097 }8098 if ( options.top != null ) {8099 props.top = ( options.top - curOffset.top ) + curTop;8100 }8101 if ( options.left != null ) {8102 props.left = ( options.left - curOffset.left ) + curLeft;8103 }8104 if ( "using" in options ) {8105 options.using.call( elem, props );8106 } else {8107 curElem.css( props );8108 }8109 }8110};8111jQuery.fn.extend({8112 position: function() {8113 if ( !this[ 0 ] ) {8114 return;8115 }8116 var offsetParent, offset,8117 parentOffset = { top: 0, left: 0 },8118 elem = this[ 0 ];8119 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent8120 if ( jQuery.css( elem, "position" ) === "fixed" ) {8121 // we assume that getBoundingClientRect is available when computed position is fixed8122 offset = elem.getBoundingClientRect();8123 } else {8124 // Get *real* offsetParent8125 offsetParent = this.offsetParent();8126 // Get correct offsets8127 offset = this.offset();8128 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {8129 parentOffset = offsetParent.offset();8130 }8131 // Add offsetParent borders8132 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );8133 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );8134 }8135 // Subtract parent offsets and element margins8136 // note: when an element has margin: auto the offsetLeft and marginLeft8137 // are the same in Safari causing offset.left to incorrectly be 08138 return {8139 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),8140 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)8141 };8142 },8143 offsetParent: function() {8144 return this.map(function() {8145 var offsetParent = this.offsetParent || docElem;8146 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {8147 offsetParent = offsetParent.offsetParent;8148 }8149 return offsetParent || docElem;8150 });8151 }8152});8153// Create scrollLeft and scrollTop methods8154jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {8155 var top = /Y/.test( prop );8156 jQuery.fn[ method ] = function( val ) {8157 return jQuery.access( this, function( elem, method, val ) {8158 var win = getWindow( elem );8159 if ( val === undefined ) {8160 return win ? (prop in win) ? win[ prop ] :8161 win.document.documentElement[ method ] :8162 elem[ method ];8163 }8164 if ( win ) {8165 win.scrollTo(8166 !top ? val : jQuery( win ).scrollLeft(),8167 top ? val : jQuery( win ).scrollTop()8168 );8169 } else {8170 elem[ method ] = val;8171 }8172 }, method, val, arguments.length, null );8173 };8174});8175function getWindow( elem ) {8176 return jQuery.isWindow( elem ) ?8177 elem :8178 elem.nodeType === 9 ?8179 elem.defaultView || elem.parentWindow :8180 false;8181}8182// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods8183jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {8184 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {8185 // margin is only for outerHeight, outerWidth8186 jQuery.fn[ funcName ] = function( margin, value ) {8187 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),8188 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );8189 return jQuery.access( this, function( elem, type, value ) {8190 var doc;8191 if ( jQuery.isWindow( elem ) ) {8192 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there8193 // isn't a whole lot we can do. See pull request at this URL for discussion:8194 // https://github.com/jquery/jquery/pull/7648195 return elem.document.documentElement[ "client" + name ];8196 }8197 // Get document width or height8198 if ( elem.nodeType === 9 ) {8199 doc = elem.documentElement;8200 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest8201 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.8202 return Math.max(8203 elem.body[ "scroll" + name ], doc[ "scroll" + name ],8204 elem.body[ "offset" + name ], doc[ "offset" + name ],8205 doc[ "client" + name ]8206 );8207 }8208 return value === undefined ?8209 // Get width or height on the element, requesting but not forcing parseFloat8210 jQuery.css( elem, type, extra ) :8211 // Set width or height on the element8212 jQuery.style( elem, type, value, extra );8213 }, type, chainable ? margin : undefined, chainable, null );8214 };8215 });8216});8217// Limit scope pollution from any deprecated API8218// (function() {8219// The number of elements contained in the matched element set8220jQuery.fn.size = function() {8221 return this.length;8222};8223jQuery.fn.andSelf = jQuery.fn.addBack;8224// })();8225if ( typeof module === "object" && module && typeof module.exports === "object" ) {8226 // Expose jQuery as module.exports in loaders that implement the Node8227 // module pattern (including browserify). Do not create the global, since8228 // the user will be storing it themselves locally, and globals are frowned8229 // upon in the Node module world.8230 module.exports = jQuery;8231} else {8232 // Otherwise expose jQuery to the global object as usual8233 window.jQuery = window.$ = jQuery;8234 // Register as a named AMD module, since jQuery can be concatenated with other8235 // files that may use define, but not via a proper concatenation script that8236 // understands anonymous AMD modules. A named AMD is safest and most robust8237 // way to register. Lowercase jquery is used because AMD module names are8238 // derived from file names, and jQuery is normally delivered in a lowercase8239 // file name. Do this after creating the global so that if an AMD module wants8240 // to call noConflict to hide this version of jQuery, it will work.8241 if ( typeof define === "function" && define.amd ) {8242 define( "jquery", [], function () { return jQuery; } );8243 }8244}...

Full Screen

Full Screen

jquery-ui.custom.min.js

Source:jquery-ui.custom.min.js Github

copy

Full Screen

1/*! jQuery UI - v1.10.3 - 2013-05-032* http://jqueryui.com3* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */4(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);5/*! jQuery UI - v1.10.3 - 2013-05-036* http://jqueryui.com7* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */8(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery);9/*! jQuery UI - v1.10.3 - 2013-05-0310* http://jqueryui.com11* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */12(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);13/*! jQuery UI - v1.10.3 - 2013-05-0314* http://jqueryui.com15* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */16(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-e(document).scrollTop()<s.scrollSensitivity?n=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(n=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-e(document).scrollLeft()<s.scrollSensitivity?n=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(n=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),s=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(t,i){var s,n,a,o,r,h,l,u,c,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,b=i.offset.top,y=b+p.helperProportions.height;for(c=p.snapElements.length-1;c>=0;c--)r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>y||b>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+s.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex)}})})(jQuery);17/*! jQuery UI - v1.10.3 - 2013-05-0318* http://jqueryui.com19* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */...

Full Screen

Full Screen

app.diff.js

Source:app.diff.js Github

copy

Full Screen

1(function app_diff(diff, $) {2// takes an array of strings and returns an object where each string of the array3// is a key of the object and the value is the number of occurences of the string in the array4function array_count(list) {5 var obj = {};6 var list = list.sort();7 for(var i=0; i<list.length; ) {8 for(var j=i+1; j<list.length; j++) {9 if(list[i] !== list[j]) break;10 }11 obj[list[i]] = (j-i);12 i=j;13 }14 return obj;15}16/**17 * contents is an array of content18 * content is a hash of pairs code-qty19 * @memberOf diff20 */21diff.compute_simple = function compute_simple(contents, meta_contents) {22 var customizations = [];23 var ensembles = [];24 for(var decknum=0; decknum<contents.length; decknum++) {25 var choices = {};26 var cards = [];27 $.each(contents[decknum], function (code, qty) {28 for(var copynum=0; copynum<qty; copynum++) {29 cards.push(code);30 }31 });32 Object.keys(meta_contents[decknum] || {}).forEach(function(key) {33 var val = meta_contents[decknum][key];34 if (key.indexOf('cus_') === 0) {35 var entries = val ? val.split(',') : [];36 var r = [];37 for(var i=0; i<entries.length; i++) {38 var entry = entries[i];39 var parts = entry.split('|');40 var index = parseInt(parts[0], 10);41 var xp = parseInt(parts[1], 10);42 var choice = parts.length > 2 ? parts[2] : undefined;43 r.push({44 "index": index,45 "xp": xp,46 "choice": choice,47 "raw": entry,48 });49 }50 if (r.length) {51 choices[key.substring(4)] = r;52 }53 }54 });55 ensembles.push(cards);56 customizations.push(choices);57 }58 var meta_additions={};59 var meta_removals={};60 var new_customizations = {};61 Object.keys(customizations[0]).concat(Object.keys(customizations[1])).forEach(function(code) {62 var choices = customizations[0][code] || [];63 var previous = customizations[1][code] || [];64 var new_choices = [];65 var additions = [];66 var removals = [];67 // Check for additions68 for(var i=0; i<choices.length; i++) {69 var choice = choices[i];70 var found = false;71 var p = null;72 for (var j=0; j<previous.length; j++) {73 if (choice.raw === previous[j].raw) {74 found = true;75 break;76 }77 if (choice.index == previous[j].index) {78 // Found a matching index, so we can't have an exact match.79 p = previous[j];80 break;81 }82 }83 if (!found) {84 // Something changed85 new_choices.push({86 "index": choice.index,87 "xp_delta": choice.xp - ((p && p.xp) || 0)88 });89 additions.push(choice.raw);90 }91 }92 // Check for removals.93 for (var j=0; j<previous.length; j++) {94 var found = false;95 for (var i=0; i<choices.length; i++) {96 if (choices[i].raw === previous[j].raw) {97 found = true;98 break;99 }100 }101 if (!found) {102 removals.push(previous[j].raw);103 }104 }105 if (new_choices.length) {106 new_customizations[code] = new_choices;107 }108 if (additions.length) {109 meta_additions[code] = additions;110 }111 if (removals.length) {112 meta_removals[code] = removals;113 }114 });115 var conjunction = [];116 for(var i=0; i<ensembles[0].length; i++) {117 var code = ensembles[0][i];118 var indexes = [ i ];119 for(var j=1; j<ensembles.length; j++) {120 var index = ensembles[j].indexOf(code);121 if(index > -1) indexes.push(index);122 else break;123 }124 if(indexes.length === ensembles.length) {125 conjunction.push(code);126 for(var j=0; j<indexes.length; j++) {127 ensembles[j].splice(indexes[j], 1);128 }129 i--;130 }131 }132 var listings = [];133 for(var i=0; i<ensembles.length; i++) {134 listings[i] = array_count(ensembles[i]);135 }136 // Add customization changes to the variations.137 listings[2] = meta_additions;138 listings[3] = meta_removals;139 var intersect = array_count(conjunction);140 return [listings, intersect, new_customizations];141};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2 {3 {4 {5 equals: {6 }7 }8 {9 is: {10 }11 }12 }13 }14];15mb.create({ imposters: imposters }).then(function (server) {16 console.log("Mountebank server running on port " + server.port);17});18var request = require('request');19});20{ [Error: connect ECONNREFUSED

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var imposter = {3 {4 { equals: { method: 'GET', path: '/test' } }5 { is: { body: 'Hello from mountebank!' } }6 }7};8mb.create(imposter).then(function () {9 console.log('Imposter created');10});11var mb = require('mountebank');12var imposter = {13 {14 { equals: { method: 'GET', path: '/test' } }15 { is: { body: 'Hello from mountebank!' } }16 }17};18mb.create(imposter).then(function () {19 console.log('Imposter created');20});21var mb = require('mountebank');22var imposter = {23 {24 { equals: { method: 'GET', path: '/test' } }25 { is: { body: 'Hello from mountebank!' } }26 }27};28mb.create(imposter).then(function () {29 console.log('Imposter created');30});31var mb = require('mountebank');32var imposter = {33 {34 { equals: { method: 'GET', path: '/test' } }35 { is: { body: 'Hello from mountebank!' } }36 }37};38mb.create(imposter).then(function () {39 console.log('Imposter created');40});

Full Screen

Using AI Code Generation

copy

Full Screen

1const mb = require('mountebank');2const imposter = mb.create({3 {4 {5 equals: {6 }7 }8 {9 is: {10 headers: {11 },12 }13 }14 }15});16const mb = require('mountebank');17const imposter = mb.create({18 {19 {20 equals: {21 }22 }23 {24 is: {25 headers: {26 },27 }28 }29 }30});31const mb = require('mountebank');32const imposter = mb.create({33 {34 {35 equals: {36 }37 }38 {39 is: {40 headers: {41 },42 }43 }44 }45});46const mb = require('mountebank');47const imposter = mb.create({48 {49 {50 equals: {51 }52 }53 {54 is: {55 headers: {56 },57 }58 }

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert'),2 mb = require('mountebank');3mb.start().then(function () {4 return mb.post('/imposters', {5 stubs: [{6 responses: [{7 is: { body: 'Hello world!' }8 }]9 }]10 });11}).then(function (response) {12 return mb.get('/imposters/3000');13}).then(function (response) {14 assert.deepEqual(response.body, {15 stubs: [{16 responses: [{17 is: { body: 'Hello world!' }18 }]19 }]20 });21}).then(function () {22 return mb.stop();23});24var assert = require('assert'),25 mb = require('mountebank');26mb.start().then(function () {27 return mb.post('/imposters', {28 stubs: [{29 responses: [{30 is: { body: 'Hello world!' }31 }]32 }]33 });34}).then(function (response) {35 return mb.get('/imposters/3000');36}).then(function (response) {37 assert.deepEqual(response.body, {38 stubs: [{39 responses: [{40 is: { body: 'Hello world!' }41 }]42 }]43 });44}).then(function () {45 return mb.stop();46});47var assert = require('assert'),48 mb = require('mountebank');49mb.start().then(function () {50 return mb.post('/imposters', {51 stubs: [{52 responses: [{53 is: { body: 'Hello world!' }54 }]55 }]56 });57}).then(function (response) {58 return mb.get('/imposters/3000');59}).then(function (response) {60 assert.deepEqual(response.body, {61 stubs: [{62 responses: [{63 is: { body: 'Hello world!' }64 }]65 }]66 });67}).then(function () {68 return mb.stop();

Full Screen

Using AI Code Generation

copy

Full Screen

1const mb = require('mountebank');2const port = 2525;3const imposterPort = 3000;4const protocol = 'http';5 {6 {7 {8 equals: {9 }10 }11 {12 is: {13 headers: {14 },15 }16 }17 }18 }19];20mb.create({ port: port, pidfile: 'mb.pid', logfile: 'mb.log' })21 .then(() => mb.post('/imposters', imposters))22 .then(() => mb.get('/imposters'))23 .then(response => console.log(JSON.stringify(response.body)))24 .then(() => mb.del('/imposters'))25 .then(() => mb.delete());26const mb = require('mountebank');27const port = 2525;28const imposterPort = 3000;29const protocol = 'http';30 {31 {32 {33 equals: {34 }35 }36 {37 is: {38 headers: {39 },40 }41 }42 }43 }44];45mb.create({ port: port, pidfile: 'mb.pid', logfile: 'mb.log' })46 .then(() => mb.post('/imposters', imposters))47 .then(() => mb.get('/imposters'))48 .then(response => console.log(JSON.stringify(response.body)))49 .then(() => mb.del('/imposters'))50 .then(() => mb.delete());51const mb = require('mountebank');52const port = 2525;53const imposterPort = 3000;

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var assert = require('assert');3mb.create({4}, function (error, imposter) {5 assert.ok(!error);6 console.log('imposter created');7 imposter.post('/api/v1/abc', {8 headers: {9 },10 body: {11 }12 }, function (error, response) {13 assert.ok(!error);14 console.log('stubbed');15 });16});17var mb = require('mountebank');18var assert = require('assert');19mb.create({20}, function (error, imposter) {21 assert.ok(!error);22 console.log('imposter created');23 imposter.post('/api/v1/xyz', {24 headers: {25 },26 body: {27 }28 }, function (error, response) {29 assert.ok(!error);30 console.log('stubbed');31 });32});33var mb = require('mountebank');34var assert = require('assert');35mb.create({36}, function (error, imposter) {37 assert.ok(!error);38 console.log('imposter created');39 imposter.post('/api/v1/pqr', {40 headers: {41 },42 body: {

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var fs = require('fs');3var util = require('util');4var request = require('request');5var Q = require('q');6var assert = require('assert');

Full Screen

Using AI Code Generation

copy

Full Screen

1const mb = require('mountebank');2const port = 2525;3const host = 'localhost';4const protocol = 'http';5const service = 'localhost';6const servicePort = 3000;7const servicePath = '/api/v1';8 {9 predicates: [{ equals: { method: 'GET', path: '/api/v1/healthcheck' } }],10 responses: [{ is: { statusCode: 200 } }]11 }12];13mb.create({ port, host, protocol, service, servicePort, servicePath, stubs })14 .then(mb => {15 console.log('Mountebank server started on port ' + port);16 })17 .catch(error => {18 console.error('Error creating mountebank server', error);19 });20const mb = require('mountebank');21const port = 2525;22const host = 'localhost';23const protocol = 'http';24const service = 'localhost';25const servicePort = 3000;26const servicePath = '/api/v1';27 {28 predicates: [{ equals: { method: 'GET', path: '/api/v1/healthcheck' } }],29 responses: [{ is: { statusCode: 200 } }]30 }31];32mb.create({ port, host, protocol, service, servicePort, servicePath, stubs })33 .then(mb => {34 console.log('Mountebank server started on port ' + port);35 })36 .catch(error => {37 console.error('Error creating mountebank server', error);38 });39const mb = require('mountebank');40const port = 2525;41const host = 'localhost';42const protocol = 'http';43const service = 'localhost';44const servicePort = 3000;45const servicePath = '/api/v1';46 {47 predicates: [{ equals: { method: 'GET', path: '/api/v1/healthcheck' } }],48 responses: [{ is: { statusCode: 200 } }]49 }50];51mb.create({ port, host, protocol, service, servicePort, servicePath

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run mountebank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful