2012-06-16 01:01:44 +00:00
|
|
|
var
|
|
|
|
// Use the correct document accordingly with window argument (sandbox)
|
|
|
|
document = window.document,
|
2012-06-04 16:48:18 +00:00
|
|
|
location = window.location,
|
2012-06-16 01:01:44 +00:00
|
|
|
navigator = window.navigator,
|
|
|
|
|
|
|
|
// Map over jQuery in case of overwrite
|
|
|
|
_jQuery = window.jQuery,
|
|
|
|
|
|
|
|
// Map over the $ in case of overwrite
|
|
|
|
_$ = window.$,
|
2010-03-23 16:12:16 +00:00
|
|
|
|
2012-06-04 16:48:18 +00:00
|
|
|
// Save a reference to some core methods
|
2012-06-16 01:01:44 +00:00
|
|
|
core_push = Array.prototype.push,
|
|
|
|
core_slice = Array.prototype.slice,
|
|
|
|
core_indexOf = Array.prototype.indexOf,
|
|
|
|
core_toString = Object.prototype.toString,
|
|
|
|
core_hasOwn = Object.prototype.hasOwnProperty,
|
|
|
|
core_trim = String.prototype.trim,
|
2012-06-04 16:48:18 +00:00
|
|
|
|
|
|
|
// Define a local copy of jQuery
|
|
|
|
jQuery = function( selector, context ) {
|
2009-05-20 21:12:08 +00:00
|
|
|
// The jQuery object is actually just the init constructor 'enhanced'
|
2010-10-10 00:32:54 +00:00
|
|
|
return new jQuery.fn.init( selector, context, rootjQuery );
|
2009-05-20 21:12:08 +00:00
|
|
|
},
|
2009-03-31 17:35:20 +00:00
|
|
|
|
|
|
|
// A central reference to the root jQuery(document)
|
|
|
|
rootjQuery,
|
|
|
|
|
2012-06-16 01:01:44 +00:00
|
|
|
// The deferred used on DOM ready
|
|
|
|
readyList,
|
2009-03-31 17:35:20 +00:00
|
|
|
|
2012-06-16 01:01:44 +00:00
|
|
|
// For matching the engine and version of the browser
|
|
|
|
browserMatch,
|
2009-07-19 19:47:30 +00:00
|
|
|
|
2012-06-16 01:01:44 +00:00
|
|
|
// Used for detecting and trimming whitespace
|
|
|
|
core_rnotwhite = /\S/,
|
|
|
|
core_rspace = /\s+/,
|
2012-06-21 19:57:12 +00:00
|
|
|
|
|
|
|
// IE doesn't match non-breaking spaces with \s
|
|
|
|
rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
|
2009-07-19 19:47:30 +00:00
|
|
|
|
2012-06-18 22:43:50 +00:00
|
|
|
// A simple way to check for HTML strings
|
2012-06-20 20:19:06 +00:00
|
|
|
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
2012-06-20 20:22:36 +00:00
|
|
|
rhtmlString = /^(?:[^#<]*(<[\w\W]+>)[^>]*$)/,
|
2012-06-16 01:01:44 +00:00
|
|
|
|
2009-09-07 18:58:01 +00:00
|
|
|
// Match a standalone tag
|
2009-11-30 18:42:19 +00:00
|
|
|
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
2009-09-07 18:58:01 +00:00
|
|
|
|
2010-09-22 13:16:28 +00:00
|
|
|
// JSON RegExp
|
|
|
|
rvalidchars = /^[\],:{}\s]*$/,
|
|
|
|
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
2012-06-16 01:01:44 +00:00
|
|
|
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
|
|
|
|
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
2010-09-22 13:16:28 +00:00
|
|
|
|
|
|
|
// Useragent RegExp
|
|
|
|
rmsie = /(msie) ([\w.]+)/,
|
2012-06-16 01:01:44 +00:00
|
|
|
rwebkit = /(webkit)[ \/]([\w.]+)/,
|
2010-09-22 13:16:28 +00:00
|
|
|
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
2012-06-16 01:01:44 +00:00
|
|
|
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
|
2010-09-22 13:16:28 +00:00
|
|
|
|
2011-05-25 19:10:49 +00:00
|
|
|
// Matches dashed string for camelizing
|
2011-08-17 21:30:31 +00:00
|
|
|
rmsPrefix = /^-ms-/,
|
2012-06-16 01:01:44 +00:00
|
|
|
rdashAlpha = /-([\da-z])/gi,
|
2011-05-25 19:10:49 +00:00
|
|
|
|
|
|
|
// Used by jQuery.camelCase as callback to replace()
|
|
|
|
fcamelCase = function( all, letter ) {
|
2011-08-05 14:17:24 +00:00
|
|
|
return ( letter + "" ).toUpperCase();
|
2011-05-25 19:10:49 +00:00
|
|
|
},
|
|
|
|
|
2009-03-31 17:35:20 +00:00
|
|
|
// Keep a UserAgent string for use with jQuery.browser
|
2010-01-05 22:01:20 +00:00
|
|
|
userAgent = navigator.userAgent,
|
|
|
|
|
2012-05-04 17:31:35 +00:00
|
|
|
// The ready event handler and self cleanup method
|
2012-05-04 13:57:32 +00:00
|
|
|
DOMContentLoaded = function() {
|
|
|
|
if ( document.addEventListener ) {
|
|
|
|
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
2012-05-04 17:31:35 +00:00
|
|
|
} else {
|
|
|
|
// we're here because readyState !== "loading" in oldIE
|
|
|
|
// which is good enough for us to call the dom ready!
|
2012-05-04 13:57:32 +00:00
|
|
|
document.detachEvent( "onreadystatechange", DOMContentLoaded );
|
|
|
|
}
|
2012-05-04 17:31:35 +00:00
|
|
|
jQuery.ready();
|
2012-05-04 13:57:32 +00:00
|
|
|
},
|
2009-12-16 21:45:00 +00:00
|
|
|
|
2010-08-27 23:14:59 +00:00
|
|
|
// [[Class]] -> type pairs
|
2010-12-30 16:06:53 +00:00
|
|
|
class2type = {};
|
2009-03-31 17:35:20 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
jQuery.fn = jQuery.prototype = {
|
2010-10-10 00:32:54 +00:00
|
|
|
constructor: jQuery,
|
|
|
|
init: function( selector, context, rootjQuery ) {
|
2009-12-17 19:17:05 +00:00
|
|
|
var match, elem, ret, doc;
|
2009-03-31 17:35:20 +00:00
|
|
|
|
2012-06-18 22:43:50 +00:00
|
|
|
// Handle $(""), $(null), $(undefined), $(false), or $("#") for location.hash
|
|
|
|
if ( !selector || selector === "#" ) {
|
2009-07-27 20:48:42 +00:00
|
|
|
return this;
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Handle $(DOMElement)
|
|
|
|
if ( selector.nodeType ) {
|
2009-07-17 17:33:44 +00:00
|
|
|
this.context = this[0] = selector;
|
2009-11-11 18:42:50 +00:00
|
|
|
this.length = 1;
|
2008-01-14 22:30:48 +00:00
|
|
|
return this;
|
2008-05-06 22:36:30 +00:00
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Handle HTML strings
|
2008-11-17 16:32:05 +00:00
|
|
|
if ( typeof selector === "string" ) {
|
2011-05-02 17:31:23 +00:00
|
|
|
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
|
2011-05-02 17:14:13 +00:00
|
|
|
// Assume that strings that start and end with <> are HTML and skip the regex check
|
2011-01-19 23:37:31 +00:00
|
|
|
match = [ null, selector, null ];
|
2011-05-02 17:14:13 +00:00
|
|
|
|
2011-01-19 23:37:31 +00:00
|
|
|
} else {
|
2012-06-18 22:43:50 +00:00
|
|
|
match = rhtmlString.exec( selector );
|
2011-01-19 23:37:31 +00:00
|
|
|
}
|
2011-01-20 16:58:44 +00:00
|
|
|
|
2012-06-18 22:43:50 +00:00
|
|
|
// HANDLE: $(html) -> $(array)
|
|
|
|
if ( match && match[1] ) {
|
|
|
|
context = context instanceof jQuery ? context[0] : context;
|
|
|
|
doc = ( context && context.nodeType ? context.ownerDocument || context : document );
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2012-06-21 19:28:57 +00:00
|
|
|
// scripts is true for back-compat
|
|
|
|
selector = jQuery.parseHTML( match[1], doc, true );
|
|
|
|
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
|
|
|
|
this.attr.call( selector, context, true );
|
2011-01-20 16:58:44 +00:00
|
|
|
}
|
2009-09-08 04:26:47 +00:00
|
|
|
|
2012-06-18 22:43:50 +00:00
|
|
|
return jQuery.merge( this, selector );
|
|
|
|
|
2009-02-25 14:23:25 +00:00
|
|
|
// HANDLE: $(expr, $(...))
|
|
|
|
} else if ( !context || context.jquery ) {
|
2011-10-27 19:25:30 +00:00
|
|
|
return ( context || rootjQuery ).find( selector );
|
2009-02-25 04:57:00 +00:00
|
|
|
|
2009-02-25 14:23:25 +00:00
|
|
|
// HANDLE: $(expr, context)
|
2009-03-05 13:36:12 +00:00
|
|
|
// (which is just equivalent to: $(context).find(expr)
|
2009-02-25 04:57:00 +00:00
|
|
|
} else {
|
2010-10-10 00:32:54 +00:00
|
|
|
return this.constructor( context ).find( selector );
|
2009-02-25 04:57:00 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// HANDLE: $(function)
|
|
|
|
// Shortcut for document ready
|
2009-02-25 04:57:00 +00:00
|
|
|
} else if ( jQuery.isFunction( selector ) ) {
|
2009-02-25 14:23:25 +00:00
|
|
|
return rootjQuery.ready( selector );
|
2009-02-25 04:57:00 +00:00
|
|
|
}
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2011-10-27 19:25:30 +00:00
|
|
|
if ( selector.selector !== undefined ) {
|
2009-01-08 21:41:58 +00:00
|
|
|
this.selector = selector.selector;
|
|
|
|
this.context = selector.context;
|
|
|
|
}
|
|
|
|
|
2010-01-28 22:17:51 +00:00
|
|
|
return jQuery.makeArray( selector, this );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-12-19 04:37:10 +00:00
|
|
|
// Start with an empty selector
|
|
|
|
selector: "",
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// The current version of jQuery being used
|
|
|
|
jquery: "@VERSION",
|
|
|
|
|
2009-07-17 01:47:26 +00:00
|
|
|
// The default length of a jQuery object is 0
|
|
|
|
length: 0,
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// The number of elements contained in the matched element set
|
|
|
|
size: function() {
|
|
|
|
return this.length;
|
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2009-12-22 00:58:13 +00:00
|
|
|
toArray: function() {
|
2012-06-16 01:01:44 +00:00
|
|
|
return core_slice.call( this );
|
2009-07-23 13:22:55 +00:00
|
|
|
},
|
2009-07-16 07:31:32 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Get the Nth element in the matched element set OR
|
|
|
|
// Get the whole matched element set as a clean array
|
|
|
|
get: function( num ) {
|
2009-03-31 17:35:20 +00:00
|
|
|
return num == null ?
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Return a 'clean' array
|
2009-07-16 07:31:41 +00:00
|
|
|
this.toArray() :
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Return just the object
|
2010-11-19 11:28:13 +00:00
|
|
|
( num < 0 ? this[ this.length + num ] : this[ num ] );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Take an array of elements and push it onto the stack
|
|
|
|
// (returning the new matched element set)
|
2008-12-19 04:37:10 +00:00
|
|
|
pushStack: function( elems, name, selector ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
// Build a new jQuery matched element set
|
2010-10-10 00:32:54 +00:00
|
|
|
var ret = this.constructor();
|
2010-02-13 06:45:09 +00:00
|
|
|
|
|
|
|
if ( jQuery.isArray( elems ) ) {
|
2012-06-16 01:01:44 +00:00
|
|
|
core_push.apply( ret, elems );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2010-02-13 06:45:09 +00:00
|
|
|
} else {
|
|
|
|
jQuery.merge( ret, elems );
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Add the old object onto the stack (as a reference)
|
|
|
|
ret.prevObject = this;
|
|
|
|
|
2008-12-19 04:37:10 +00:00
|
|
|
ret.context = this.context;
|
|
|
|
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( name === "find" ) {
|
2011-10-27 19:25:30 +00:00
|
|
|
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
|
2009-03-31 17:35:20 +00:00
|
|
|
} else if ( name ) {
|
2008-12-19 04:37:10 +00:00
|
|
|
ret.selector = this.selector + "." + name + "(" + selector + ")";
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-12-19 04:37:10 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Return the newly-formed element set
|
|
|
|
return ret;
|
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Execute a callback for every element in the matched set.
|
|
|
|
// (You can seed the arguments with an array of args, but this is
|
|
|
|
// only used internally.)
|
|
|
|
each: function( callback, args ) {
|
|
|
|
return jQuery.each( this, callback, args );
|
|
|
|
},
|
2011-01-05 21:41:23 +00:00
|
|
|
|
2011-01-23 04:01:36 +00:00
|
|
|
ready: function( fn ) {
|
|
|
|
// Add the callback
|
2012-05-05 23:05:03 +00:00
|
|
|
jQuery.ready.promise().done( fn );
|
2011-01-23 04:01:36 +00:00
|
|
|
|
|
|
|
return this;
|
2009-12-08 00:34:55 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
eq: function( i ) {
|
2011-10-30 17:13:26 +00:00
|
|
|
i = +i;
|
2009-12-10 17:25:25 +00:00
|
|
|
return i === -1 ?
|
|
|
|
this.slice( i ) :
|
2011-10-30 17:13:26 +00:00
|
|
|
this.slice( i, i + 1 );
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
first: function() {
|
|
|
|
return this.eq( 0 );
|
|
|
|
},
|
|
|
|
|
|
|
|
last: function() {
|
|
|
|
return this.eq( -1 );
|
|
|
|
},
|
|
|
|
|
|
|
|
slice: function() {
|
2012-06-16 01:01:44 +00:00
|
|
|
return this.pushStack( core_slice.apply( this, arguments ),
|
|
|
|
"slice", core_slice.call(arguments).join(",") );
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
map: function( callback ) {
|
2009-12-22 00:58:13 +00:00
|
|
|
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
2009-12-10 17:25:25 +00:00
|
|
|
return callback.call( elem, i, elem );
|
|
|
|
}));
|
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-10 17:25:25 +00:00
|
|
|
end: function() {
|
2010-10-10 00:32:54 +00:00
|
|
|
return this.prevObject || this.constructor(null);
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-03-17 20:39:29 +00:00
|
|
|
// For internal use only.
|
|
|
|
// Behaves like an Array's method, not like a jQuery method.
|
2012-06-16 01:01:44 +00:00
|
|
|
push: core_push,
|
2009-03-17 20:39:29 +00:00
|
|
|
sort: [].sort,
|
2009-03-18 21:15:38 +00:00
|
|
|
splice: [].splice
|
2008-01-14 22:30:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Give the init function the jQuery prototype for later instantiation
|
2008-04-29 23:34:50 +00:00
|
|
|
jQuery.fn.init.prototype = jQuery.fn;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
jQuery.extend = jQuery.fn.extend = function() {
|
2011-02-15 21:03:23 +00:00
|
|
|
var options, name, src, copy, copyIsArray, clone,
|
2010-11-09 16:09:07 +00:00
|
|
|
target = arguments[0] || {},
|
|
|
|
i = 1,
|
|
|
|
length = arguments.length,
|
|
|
|
deep = false;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Handle a deep copy situation
|
2008-11-17 16:32:05 +00:00
|
|
|
if ( typeof target === "boolean" ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
deep = target;
|
|
|
|
target = arguments[1] || {};
|
|
|
|
// skip the boolean and the target
|
|
|
|
i = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle case when target is a string or something (possible in deep copy)
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
target = {};
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// extend jQuery itself if only one argument is passed
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( length === i ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
target = this;
|
2008-04-30 00:09:55 +00:00
|
|
|
--i;
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( ; i < length; i++ ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
// Only deal with non-null/undefined values
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( (options = arguments[ i ]) != null ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
// Extend the base object
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( name in options ) {
|
|
|
|
src = target[ name ];
|
|
|
|
copy = options[ name ];
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Prevent never-ending loop
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( target === copy ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
continue;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2010-01-30 18:50:49 +00:00
|
|
|
// Recurse if we're merging plain objects or arrays
|
|
|
|
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
|
|
|
if ( copyIsArray ) {
|
|
|
|
copyIsArray = false;
|
|
|
|
clone = src && jQuery.isArray(src) ? src : [];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
clone = src && jQuery.isPlainObject(src) ? src : {};
|
|
|
|
}
|
2009-07-16 07:32:03 +00:00
|
|
|
|
|
|
|
// Never move original objects, clone them
|
|
|
|
target[ name ] = jQuery.extend( deep, clone, copy );
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Don't bring in undefined values
|
2009-03-31 17:35:20 +00:00
|
|
|
} else if ( copy !== undefined ) {
|
2008-04-30 00:09:55 +00:00
|
|
|
target[ name ] = copy;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Return the modified object
|
|
|
|
return target;
|
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.extend({
|
|
|
|
noConflict: function( deep ) {
|
2010-11-22 04:12:12 +00:00
|
|
|
if ( window.$ === jQuery ) {
|
|
|
|
window.$ = _$;
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2010-10-19 05:29:20 +00:00
|
|
|
if ( deep && window.jQuery === jQuery ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
window.jQuery = _jQuery;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
return jQuery;
|
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-08 00:34:55 +00:00
|
|
|
// Is the DOM ready to be used? Set to true once it occurs.
|
|
|
|
isReady: false,
|
2010-09-20 18:53:29 +00:00
|
|
|
|
|
|
|
// A counter to track how many items to wait for before
|
|
|
|
// the ready event fires. See #6781
|
|
|
|
readyWait: 1,
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-02-03 02:57:44 +00:00
|
|
|
// Hold (or release) the ready event
|
|
|
|
holdReady: function( hold ) {
|
|
|
|
if ( hold ) {
|
|
|
|
jQuery.readyWait++;
|
|
|
|
} else {
|
|
|
|
jQuery.ready( true );
|
2010-09-20 18:53:29 +00:00
|
|
|
}
|
2011-02-03 02:57:44 +00:00
|
|
|
},
|
2010-09-20 18:53:29 +00:00
|
|
|
|
2011-02-03 02:57:44 +00:00
|
|
|
// Handle when the DOM is ready
|
|
|
|
ready: function( wait ) {
|
2012-04-23 19:43:26 +00:00
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
// Abort if there are pending holds or we're already ready
|
|
|
|
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
|
|
|
return;
|
|
|
|
}
|
2009-12-08 00:34:55 +00:00
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
|
|
|
if ( !document.body ) {
|
|
|
|
return setTimeout( jQuery.ready, 1 );
|
|
|
|
}
|
2009-12-08 00:34:55 +00:00
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
// Remember that the DOM is ready
|
|
|
|
jQuery.isReady = true;
|
2010-09-20 18:53:29 +00:00
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
// If a normal DOM Ready event fired, decrement, and wait if need be
|
|
|
|
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
2011-01-05 21:41:23 +00:00
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
// If there are functions bound, to execute
|
|
|
|
readyList.resolveWith( document, [ jQuery ] );
|
|
|
|
|
|
|
|
// Trigger any bound ready events
|
|
|
|
if ( jQuery.fn.trigger ) {
|
|
|
|
jQuery( document ).trigger("ready").off("ready");
|
2009-12-08 00:34:55 +00:00
|
|
|
}
|
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2008-11-17 16:32:05 +00:00
|
|
|
// See test/unit/core.js for details concerning isFunction.
|
2008-10-18 22:22:08 +00:00
|
|
|
// Since version 1.3, DOM methods and functions like alert
|
2008-07-23 16:18:05 +00:00
|
|
|
// aren't supported. They return false on IE (#2968).
|
2008-11-17 16:32:05 +00:00
|
|
|
isFunction: function( obj ) {
|
2010-08-25 16:57:34 +00:00
|
|
|
return jQuery.type(obj) === "function";
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-11-17 16:32:05 +00:00
|
|
|
|
2010-08-27 17:15:48 +00:00
|
|
|
isArray: Array.isArray || function( obj ) {
|
2010-08-25 16:57:34 +00:00
|
|
|
return jQuery.type(obj) === "array";
|
|
|
|
},
|
|
|
|
|
2010-09-22 20:41:51 +00:00
|
|
|
isWindow: function( obj ) {
|
2011-12-06 21:17:09 +00:00
|
|
|
return obj != null && obj == obj.window;
|
2010-09-22 20:41:51 +00:00
|
|
|
},
|
|
|
|
|
2011-10-12 01:04:22 +00:00
|
|
|
isNumeric: function( obj ) {
|
2011-11-07 16:25:51 +00:00
|
|
|
return !isNaN( parseFloat(obj) ) && isFinite( obj );
|
2010-09-27 15:51:01 +00:00
|
|
|
},
|
|
|
|
|
2010-08-25 16:57:34 +00:00
|
|
|
type: function( obj ) {
|
2010-08-27 14:03:30 +00:00
|
|
|
return obj == null ?
|
|
|
|
String( obj ) :
|
2012-06-16 01:01:44 +00:00
|
|
|
class2type[ core_toString.call(obj) ] || "object";
|
2008-10-29 02:01:22 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2009-12-06 22:11:51 +00:00
|
|
|
isPlainObject: function( obj ) {
|
2009-12-18 16:34:20 +00:00
|
|
|
// Must be an Object.
|
|
|
|
// Because of IE, we also have to check the presence of the constructor property.
|
2009-12-19 00:36:35 +00:00
|
|
|
// Make sure that DOM nodes and window objects don't pass through, as well
|
2010-09-22 20:41:51 +00:00
|
|
|
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
2009-11-08 23:26:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-07-25 21:06:38 +00:00
|
|
|
try {
|
|
|
|
// Not own constructor property must be Object
|
|
|
|
if ( obj.constructor &&
|
2012-06-16 01:01:44 +00:00
|
|
|
!core_hasOwn.call(obj, "constructor") &&
|
|
|
|
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
2011-07-25 21:06:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} catch ( e ) {
|
|
|
|
// IE8,9 Will throw exceptions on certain host objects #9897
|
2009-11-12 04:50:40 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-18 16:34:20 +00:00
|
|
|
// Own properties are enumerated firstly, so to speed up,
|
|
|
|
// if last one is own, then all properties are own.
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-11-08 23:26:01 +00:00
|
|
|
var key;
|
|
|
|
for ( key in obj ) {}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2012-06-16 01:01:44 +00:00
|
|
|
return key === undefined || core_hasOwn.call( obj, key );
|
2009-07-16 07:32:03 +00:00
|
|
|
},
|
|
|
|
|
2009-07-16 07:32:31 +00:00
|
|
|
isEmptyObject: function( obj ) {
|
2009-07-19 19:55:21 +00:00
|
|
|
for ( var name in obj ) {
|
2009-07-16 15:16:44 +00:00
|
|
|
return false;
|
2009-07-19 19:55:21 +00:00
|
|
|
}
|
2009-07-16 15:16:44 +00:00
|
|
|
return true;
|
2009-07-16 07:32:31 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2010-01-23 21:48:47 +00:00
|
|
|
error: function( msg ) {
|
2011-11-07 16:40:39 +00:00
|
|
|
throw new Error( msg );
|
2010-01-23 21:48:47 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2012-06-21 19:28:57 +00:00
|
|
|
// data: string of html
|
|
|
|
// context (optional): If specified, the fragment will be created in this context, defaults to document
|
|
|
|
// scripts (optional): If true, will include scripts passed in the html string
|
|
|
|
parseHTML: function( data, context, scripts ) {
|
|
|
|
var parsed;
|
|
|
|
if ( !data || typeof data !== "string" ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if ( typeof context === "boolean" ) {
|
|
|
|
scripts = context;
|
|
|
|
context = 0;
|
|
|
|
}
|
|
|
|
context = context || document;
|
|
|
|
|
|
|
|
// Single tag
|
|
|
|
if ( (parsed = rsingleTag.exec( data )) ) {
|
|
|
|
return [ context.createElement( parsed[1] ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
|
|
|
|
return jQuery.merge( [],
|
|
|
|
(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
|
|
|
|
},
|
|
|
|
|
2010-01-23 21:51:51 +00:00
|
|
|
parseJSON: function( data ) {
|
2012-06-21 19:28:57 +00:00
|
|
|
if ( !data || typeof data !== "string") {
|
2010-01-23 22:08:26 +00:00
|
|
|
return null;
|
|
|
|
}
|
2010-02-13 07:14:23 +00:00
|
|
|
|
|
|
|
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
|
|
|
data = jQuery.trim( data );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-04-05 08:43:14 +00:00
|
|
|
// Attempt to parse using the native JSON parser first
|
|
|
|
if ( window.JSON && window.JSON.parse ) {
|
|
|
|
return window.JSON.parse( data );
|
|
|
|
}
|
|
|
|
|
2010-01-23 21:51:51 +00:00
|
|
|
// Make sure the incoming data is actual JSON
|
|
|
|
// Logic borrowed from http://json.org/json2.js
|
2011-04-05 08:43:14 +00:00
|
|
|
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
|
|
|
|
.replace( rvalidtokens, "]" )
|
|
|
|
.replace( rvalidbraces, "")) ) {
|
|
|
|
|
2011-10-27 19:25:30 +00:00
|
|
|
return ( new Function( "return " + data ) )();
|
2010-01-23 21:51:51 +00:00
|
|
|
|
|
|
|
}
|
2011-04-05 14:20:58 +00:00
|
|
|
jQuery.error( "Invalid JSON: " + data );
|
2010-01-23 21:51:51 +00:00
|
|
|
},
|
2011-01-05 21:41:23 +00:00
|
|
|
|
2010-12-24 17:02:00 +00:00
|
|
|
// Cross-browser xml parsing
|
2011-07-23 01:26:36 +00:00
|
|
|
parseXML: function( data ) {
|
2012-06-21 19:28:57 +00:00
|
|
|
var xml, tmp;
|
|
|
|
if ( !data || typeof data !== "string" ) {
|
2012-03-07 16:37:14 +00:00
|
|
|
return null;
|
|
|
|
}
|
2011-07-23 01:26:36 +00:00
|
|
|
try {
|
|
|
|
if ( window.DOMParser ) { // Standard
|
|
|
|
tmp = new DOMParser();
|
|
|
|
xml = tmp.parseFromString( data , "text/xml" );
|
|
|
|
} else { // IE
|
|
|
|
xml = new ActiveXObject( "Microsoft.XMLDOM" );
|
|
|
|
xml.async = "false";
|
|
|
|
xml.loadXML( data );
|
|
|
|
}
|
|
|
|
} catch( e ) {
|
|
|
|
xml = undefined;
|
2010-12-24 17:02:00 +00:00
|
|
|
}
|
2011-07-23 01:26:36 +00:00
|
|
|
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
|
2010-12-24 17:02:00 +00:00
|
|
|
jQuery.error( "Invalid XML: " + data );
|
|
|
|
}
|
|
|
|
return xml;
|
|
|
|
},
|
2009-07-16 07:32:31 +00:00
|
|
|
|
2009-12-31 14:50:49 +00:00
|
|
|
noop: function() {},
|
|
|
|
|
2011-04-07 04:47:15 +00:00
|
|
|
// Evaluates a script in a global context
|
|
|
|
// Workarounds based on findings by Jim Driscoll
|
|
|
|
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
2008-01-14 22:30:48 +00:00
|
|
|
globalEval: function( data ) {
|
2012-06-16 01:01:44 +00:00
|
|
|
if ( data && core_rnotwhite.test( data ) ) {
|
2011-04-07 04:47:15 +00:00
|
|
|
// We use execScript on Internet Explorer
|
|
|
|
// We use an anonymous function so that context is window
|
|
|
|
// rather than jQuery in Firefox
|
|
|
|
( window.execScript || function( data ) {
|
|
|
|
window[ "eval" ].call( window, data );
|
|
|
|
} )( data );
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2011-08-17 21:30:31 +00:00
|
|
|
// Convert dashed to camelCase; used by the css and data modules
|
|
|
|
// Microsoft forgot to hump their vendor prefix (#9572)
|
2011-05-25 19:10:49 +00:00
|
|
|
camelCase: function( string ) {
|
2011-08-17 21:30:31 +00:00
|
|
|
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
2011-05-25 19:10:49 +00:00
|
|
|
},
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
nodeName: function( elem, name ) {
|
2009-03-31 17:35:20 +00:00
|
|
|
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// args is for internal usage only
|
|
|
|
each: function( object, callback, args ) {
|
2009-07-16 07:31:32 +00:00
|
|
|
var name, i = 0,
|
2009-06-20 15:51:19 +00:00
|
|
|
length = object.length,
|
2011-02-07 00:34:57 +00:00
|
|
|
isObj = length === undefined || jQuery.isFunction( object );
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
if ( args ) {
|
2009-06-20 15:51:19 +00:00
|
|
|
if ( isObj ) {
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( name in object ) {
|
|
|
|
if ( callback.apply( object[ name ], args ) === false ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
break;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for ( ; i < length; ) {
|
|
|
|
if ( callback.apply( object[ i++ ], args ) === false ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
break;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// A special, fast, case for the most common use of each
|
|
|
|
} else {
|
2009-06-20 15:51:19 +00:00
|
|
|
if ( isObj ) {
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( name in object ) {
|
|
|
|
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
break;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2011-03-30 17:17:48 +00:00
|
|
|
for ( ; i < length; ) {
|
2011-03-30 17:26:20 +00:00
|
|
|
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
|
2011-03-30 17:17:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return object;
|
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2010-03-09 14:14:27 +00:00
|
|
|
// Use native String.trim function wherever possible
|
2012-06-16 01:01:44 +00:00
|
|
|
trim: core_trim ?
|
2010-03-09 14:14:27 +00:00
|
|
|
function( text ) {
|
|
|
|
return text == null ?
|
|
|
|
"" :
|
2012-06-16 01:01:44 +00:00
|
|
|
core_trim.call( text );
|
2010-03-09 14:14:27 +00:00
|
|
|
} :
|
|
|
|
|
|
|
|
// Otherwise use our own trimming functionality
|
|
|
|
function( text ) {
|
|
|
|
return text == null ?
|
|
|
|
"" :
|
2012-06-21 19:57:12 +00:00
|
|
|
text.toString().replace( rtrim, "" );
|
2010-03-09 14:14:27 +00:00
|
|
|
},
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-11-18 02:26:42 +00:00
|
|
|
// results is for internal usage only
|
|
|
|
makeArray: function( array, results ) {
|
|
|
|
var ret = results || [];
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( array != null ) {
|
2008-08-12 19:34:30 +00:00
|
|
|
// The window, strings (and functions) also have 'length'
|
2010-08-23 19:38:55 +00:00
|
|
|
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
|
2011-02-07 00:34:57 +00:00
|
|
|
var type = jQuery.type( array );
|
2010-08-25 16:27:30 +00:00
|
|
|
|
2010-09-22 20:41:51 +00:00
|
|
|
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
|
2012-06-16 01:01:44 +00:00
|
|
|
core_push.call( ret, array );
|
2009-03-31 17:35:20 +00:00
|
|
|
} else {
|
2009-11-18 02:26:42 +00:00
|
|
|
jQuery.merge( ret, array );
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-04-25 03:48:07 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2011-05-28 16:00:28 +00:00
|
|
|
inArray: function( elem, array, i ) {
|
|
|
|
var len;
|
2011-04-10 18:31:31 +00:00
|
|
|
|
2011-05-28 16:00:28 +00:00
|
|
|
if ( array ) {
|
2012-06-16 01:01:44 +00:00
|
|
|
if ( core_indexOf ) {
|
|
|
|
return core_indexOf.call( array, elem, i );
|
2011-05-28 16:00:28 +00:00
|
|
|
}
|
2009-11-11 20:15:58 +00:00
|
|
|
|
2011-05-28 16:00:28 +00:00
|
|
|
len = array.length;
|
2011-09-13 01:46:16 +00:00
|
|
|
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
|
2011-05-28 16:00:28 +00:00
|
|
|
|
|
|
|
for ( ; i < len; i++ ) {
|
2011-09-15 20:26:35 +00:00
|
|
|
// Skip accessing in sparse arrays
|
|
|
|
if ( i in array && array[ i ] === elem ) {
|
2011-05-28 16:00:28 +00:00
|
|
|
return i;
|
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
},
|
|
|
|
|
|
|
|
merge: function( first, second ) {
|
2010-11-09 16:09:07 +00:00
|
|
|
var i = first.length,
|
|
|
|
j = 0;
|
2009-05-02 19:22:55 +00:00
|
|
|
|
2009-12-10 05:43:20 +00:00
|
|
|
if ( typeof second.length === "number" ) {
|
|
|
|
for ( var l = second.length; j < l; j++ ) {
|
|
|
|
first[ i++ ] = second[ j ];
|
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-10 05:43:20 +00:00
|
|
|
} else {
|
|
|
|
while ( second[j] !== undefined ) {
|
|
|
|
first[ i++ ] = second[ j++ ];
|
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-12-10 05:43:20 +00:00
|
|
|
first.length = i;
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
return first;
|
|
|
|
},
|
|
|
|
|
|
|
|
grep: function( elems, callback, inv ) {
|
2010-03-02 02:24:49 +00:00
|
|
|
var ret = [], retVal;
|
|
|
|
inv = !!inv;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Go through the array, only saving the items
|
|
|
|
// that pass the validator function
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
2010-03-02 02:24:49 +00:00
|
|
|
retVal = !!callback( elems[ i ], i );
|
|
|
|
if ( inv !== retVal ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
ret.push( elems[ i ] );
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2009-12-04 17:28:47 +00:00
|
|
|
// arg is for internal usage only
|
|
|
|
map: function( elems, callback, arg ) {
|
2011-04-05 15:33:14 +00:00
|
|
|
var value, key, ret = [],
|
2011-04-05 06:59:54 +00:00
|
|
|
i = 0,
|
2011-03-21 19:24:53 +00:00
|
|
|
length = elems.length,
|
2011-04-05 06:59:54 +00:00
|
|
|
// jquery objects are treated as arrays
|
2011-05-02 17:25:53 +00:00
|
|
|
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Go through the array, translating each of the items to their
|
2011-03-21 19:12:31 +00:00
|
|
|
if ( isArray ) {
|
|
|
|
for ( ; i < length; i++ ) {
|
|
|
|
value = callback( elems[ i ], i, arg );
|
|
|
|
|
2011-02-27 18:47:35 +00:00
|
|
|
if ( value != null ) {
|
|
|
|
ret[ ret.length ] = value;
|
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2011-04-22 01:51:23 +00:00
|
|
|
// Go through every key on the object,
|
2011-04-05 06:59:54 +00:00
|
|
|
} else {
|
2011-03-21 15:39:53 +00:00
|
|
|
for ( key in elems ) {
|
2011-03-21 19:12:31 +00:00
|
|
|
value = callback( elems[ key ], key, arg );
|
|
|
|
|
|
|
|
if ( value != null ) {
|
|
|
|
ret[ ret.length ] = value;
|
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
2010-11-27 22:15:33 +00:00
|
|
|
// Flatten any nested arrays
|
2008-05-06 14:54:53 +00:00
|
|
|
return ret.concat.apply( [], ret );
|
2009-03-31 17:35:20 +00:00
|
|
|
},
|
|
|
|
|
2009-12-31 20:06:45 +00:00
|
|
|
// A global GUID counter for objects
|
|
|
|
guid: 1,
|
|
|
|
|
2010-12-15 02:53:04 +00:00
|
|
|
// Bind a function to a context, optionally partially applying any
|
|
|
|
// arguments.
|
|
|
|
proxy: function( fn, context ) {
|
2011-01-21 15:33:50 +00:00
|
|
|
if ( typeof context === "string" ) {
|
2011-04-17 21:11:40 +00:00
|
|
|
var tmp = fn[ context ];
|
|
|
|
context = fn;
|
|
|
|
fn = tmp;
|
2009-12-31 20:06:45 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 02:53:04 +00:00
|
|
|
// Quick check to determine if target is callable, in the spec
|
|
|
|
// this throws a TypeError, but we will just return undefined.
|
2011-04-17 21:11:40 +00:00
|
|
|
if ( !jQuery.isFunction( fn ) ) {
|
2010-12-15 02:53:04 +00:00
|
|
|
return undefined;
|
2009-12-31 20:17:52 +00:00
|
|
|
}
|
2009-12-31 20:06:45 +00:00
|
|
|
|
2011-04-17 21:11:40 +00:00
|
|
|
// Simulated bind
|
2012-06-16 01:01:44 +00:00
|
|
|
var args = core_slice.call( arguments, 2 ),
|
2011-04-17 21:11:40 +00:00
|
|
|
proxy = function() {
|
2012-06-16 01:01:44 +00:00
|
|
|
return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
|
2011-04-17 21:11:40 +00:00
|
|
|
};
|
2009-12-31 20:06:45 +00:00
|
|
|
|
|
|
|
// Set the guid of unique handler to the same of original handler, so it can be removed
|
2010-12-15 02:53:04 +00:00
|
|
|
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
|
2009-12-31 20:06:45 +00:00
|
|
|
|
|
|
|
return proxy;
|
|
|
|
},
|
|
|
|
|
2012-04-17 01:57:41 +00:00
|
|
|
// Multifunctional method to get and set values of a collection
|
2011-06-14 20:01:50 +00:00
|
|
|
// The value/s can optionally be executed if it's a function
|
2011-12-06 20:25:38 +00:00
|
|
|
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
|
|
|
|
var exec,
|
|
|
|
bulk = key == null,
|
|
|
|
i = 0,
|
|
|
|
length = elems.length;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-12-06 20:25:38 +00:00
|
|
|
// Sets many values
|
|
|
|
if ( key && typeof key === "object" ) {
|
|
|
|
for ( i in key ) {
|
|
|
|
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
|
2010-03-23 16:12:16 +00:00
|
|
|
}
|
2011-12-06 20:25:38 +00:00
|
|
|
chainable = 1;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-12-06 20:25:38 +00:00
|
|
|
// Sets one value
|
|
|
|
} else if ( value !== undefined ) {
|
2010-03-23 16:12:16 +00:00
|
|
|
// Optionally, function values get executed if exec is true
|
2011-12-06 20:25:38 +00:00
|
|
|
exec = pass === undefined && jQuery.isFunction( value );
|
|
|
|
|
|
|
|
if ( bulk ) {
|
|
|
|
// Bulk operations only iterate when executing function values
|
|
|
|
if ( exec ) {
|
|
|
|
exec = fn;
|
|
|
|
fn = function( elem, key, value ) {
|
|
|
|
return exec.call( jQuery( elem ), value );
|
|
|
|
};
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-12-06 20:25:38 +00:00
|
|
|
// Otherwise they run against the entire set
|
|
|
|
} else {
|
|
|
|
fn.call( elems, value );
|
|
|
|
fn = null;
|
|
|
|
}
|
2010-03-23 16:12:16 +00:00
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-12-06 20:25:38 +00:00
|
|
|
if ( fn ) {
|
|
|
|
for (; i < length; i++ ) {
|
|
|
|
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
chainable = 1;
|
2010-03-23 16:12:16 +00:00
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-12-06 20:25:38 +00:00
|
|
|
return chainable ?
|
|
|
|
elems :
|
|
|
|
|
|
|
|
// Gets
|
|
|
|
bulk ?
|
|
|
|
fn.call( elems ) :
|
|
|
|
length ? fn( elems[0], key ) : emptyGet;
|
2010-03-23 16:12:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
now: function() {
|
2011-10-27 19:25:30 +00:00
|
|
|
return ( new Date() ).getTime();
|
2010-03-23 16:12:16 +00:00
|
|
|
},
|
2011-01-05 21:41:23 +00:00
|
|
|
|
2009-12-09 06:52:32 +00:00
|
|
|
// Use of jQuery.browser is frowned upon.
|
2009-12-09 23:07:16 +00:00
|
|
|
// More details: http://docs.jquery.com/Utilities/jQuery.browser
|
2010-01-05 22:01:20 +00:00
|
|
|
uaMatch: function( ua ) {
|
|
|
|
ua = ua.toLowerCase();
|
|
|
|
|
2011-08-26 14:10:35 +00:00
|
|
|
var match = rwebkit.exec( ua ) ||
|
2010-09-22 13:16:28 +00:00
|
|
|
ropera.exec( ua ) ||
|
|
|
|
rmsie.exec( ua ) ||
|
|
|
|
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
|
2010-03-01 17:44:56 +00:00
|
|
|
[];
|
2010-01-05 22:01:20 +00:00
|
|
|
|
2010-01-23 17:13:46 +00:00
|
|
|
return { browser: match[1] || "", version: match[2] || "0" };
|
2010-01-05 22:01:20 +00:00
|
|
|
},
|
|
|
|
|
2011-01-31 13:21:42 +00:00
|
|
|
sub: function() {
|
2011-02-07 00:34:57 +00:00
|
|
|
function jQuerySub( selector, context ) {
|
|
|
|
return new jQuerySub.fn.init( selector, context );
|
2010-10-10 00:32:54 +00:00
|
|
|
}
|
2011-02-07 00:34:57 +00:00
|
|
|
jQuery.extend( true, jQuerySub, this );
|
|
|
|
jQuerySub.superclass = this;
|
|
|
|
jQuerySub.fn = jQuerySub.prototype = this();
|
|
|
|
jQuerySub.fn.constructor = jQuerySub;
|
|
|
|
jQuerySub.sub = this.sub;
|
|
|
|
jQuerySub.fn.init = function init( selector, context ) {
|
|
|
|
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
|
|
|
context = jQuerySub( context );
|
2010-10-10 00:32:54 +00:00
|
|
|
}
|
2011-01-27 18:35:06 +00:00
|
|
|
|
2011-02-07 00:34:57 +00:00
|
|
|
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
2010-10-10 00:32:54 +00:00
|
|
|
};
|
2011-02-07 00:34:57 +00:00
|
|
|
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
|
|
|
var rootjQuerySub = jQuerySub(document);
|
|
|
|
return jQuerySub;
|
2010-10-10 00:32:54 +00:00
|
|
|
},
|
|
|
|
|
2010-01-05 22:01:20 +00:00
|
|
|
browser: {}
|
2008-01-14 22:30:48 +00:00
|
|
|
});
|
|
|
|
|
2012-05-05 23:05:03 +00:00
|
|
|
jQuery.ready.promise = function( object ) {
|
|
|
|
if ( !readyList ) {
|
|
|
|
|
|
|
|
readyList = jQuery.Deferred();
|
|
|
|
|
|
|
|
// Catch cases where $(document).ready() is called after the
|
|
|
|
// browser event has already occurred.
|
|
|
|
if ( document.readyState !== "loading" ) {
|
|
|
|
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
|
|
|
setTimeout( jQuery.ready, 1 );
|
|
|
|
|
|
|
|
// Mozilla, Opera and webkit nightlies currently support this event
|
|
|
|
} else if ( document.addEventListener ) {
|
|
|
|
// Use the handy event callback
|
|
|
|
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
|
|
|
|
|
|
|
// A fallback to window.onload, that will always work
|
|
|
|
window.addEventListener( "load", jQuery.ready, false );
|
|
|
|
|
|
|
|
// If IE event model is used
|
2012-05-07 17:14:00 +00:00
|
|
|
} else {
|
2012-05-05 23:05:03 +00:00
|
|
|
// ensure firing before onload,
|
|
|
|
// maybe late but safe also for iframes
|
|
|
|
document.attachEvent( "onreadystatechange", DOMContentLoaded );
|
|
|
|
|
|
|
|
// A fallback to window.onload, that will always work
|
|
|
|
window.attachEvent( "onload", jQuery.ready );
|
|
|
|
|
|
|
|
// If IE and not a frame
|
|
|
|
// continually check to see if the document is ready
|
2012-06-21 17:40:59 +00:00
|
|
|
var top = false;
|
2012-05-05 23:05:03 +00:00
|
|
|
|
|
|
|
try {
|
2012-06-21 17:40:59 +00:00
|
|
|
top = window.frameElement == null && document.documentElement;
|
2012-05-05 23:05:03 +00:00
|
|
|
} catch(e) {}
|
|
|
|
|
2012-06-21 17:40:59 +00:00
|
|
|
if ( top && top.doScroll ) {
|
|
|
|
(function doScrollCheck() {
|
|
|
|
if ( !jQuery.isReady ) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Use the trick by Diego Perini
|
|
|
|
// http://javascript.nwbox.com/IEContentLoaded/
|
|
|
|
top.doScroll("left");
|
|
|
|
} catch(e) {
|
|
|
|
return setTimeout( doScrollCheck, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// and execute any waiting functions
|
|
|
|
jQuery.ready();
|
|
|
|
}
|
|
|
|
})();
|
2012-05-05 23:05:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return readyList.promise( object );
|
|
|
|
};
|
|
|
|
|
2010-08-27 23:14:59 +00:00
|
|
|
// Populate the class2type map
|
|
|
|
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
|
|
|
|
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
|
|
|
});
|
|
|
|
|
2010-01-05 22:01:20 +00:00
|
|
|
browserMatch = jQuery.uaMatch( userAgent );
|
|
|
|
if ( browserMatch.browser ) {
|
|
|
|
jQuery.browser[ browserMatch.browser ] = true;
|
|
|
|
jQuery.browser.version = browserMatch.version;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deprecated, use jQuery.browser.webkit instead
|
|
|
|
if ( jQuery.browser.webkit ) {
|
|
|
|
jQuery.browser.safari = true;
|
|
|
|
}
|
2009-12-09 06:52:32 +00:00
|
|
|
|
2009-02-25 14:23:25 +00:00
|
|
|
// All jQuery objects should point back to these
|
2009-03-31 17:35:20 +00:00
|
|
|
rootjQuery = jQuery(document);
|