2012-06-25 14:02:28 +00:00
|
|
|
// Limit scope pollution from any deprecated API
|
|
|
|
(function() {
|
|
|
|
|
2012-10-16 18:36:47 +00:00
|
|
|
var matched, browser, eventAdd, eventRemove,
|
|
|
|
oldToggle = jQuery.fn.toggle,
|
|
|
|
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
|
|
|
hoverHack = function( events ) {
|
|
|
|
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
|
|
|
};
|
2012-06-25 14:02:28 +00:00
|
|
|
|
|
|
|
// Use of jQuery.browser is frowned upon.
|
|
|
|
// More details: http://api.jquery.com/jQuery.browser
|
|
|
|
// jQuery.uaMatch maintained for back-compat
|
|
|
|
jQuery.uaMatch = function( ua ) {
|
|
|
|
ua = ua.toLowerCase();
|
|
|
|
|
|
|
|
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
|
|
|
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
2012-07-23 02:23:32 +00:00
|
|
|
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
2012-06-25 14:02:28 +00:00
|
|
|
/(msie) ([\w.]+)/.exec( ua ) ||
|
2012-07-23 02:23:32 +00:00
|
|
|
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
2012-06-25 14:02:28 +00:00
|
|
|
[];
|
|
|
|
|
|
|
|
return {
|
|
|
|
browser: match[ 1 ] || "",
|
|
|
|
version: match[ 2 ] || "0"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
matched = jQuery.uaMatch( navigator.userAgent );
|
|
|
|
browser = {};
|
|
|
|
|
|
|
|
if ( matched.browser ) {
|
|
|
|
browser[ matched.browser ] = true;
|
|
|
|
browser.version = matched.version;
|
|
|
|
}
|
|
|
|
|
2012-08-21 03:09:46 +00:00
|
|
|
// Chrome is Webkit, but Webkit is also Safari.
|
|
|
|
if ( browser.chrome ) {
|
|
|
|
browser.webkit = true;
|
|
|
|
} else if ( browser.webkit ) {
|
2012-06-25 14:02:28 +00:00
|
|
|
browser.safari = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
jQuery.browser = browser;
|
|
|
|
|
2012-06-29 16:37:33 +00:00
|
|
|
jQuery.sub = function() {
|
|
|
|
function jQuerySub( selector, context ) {
|
|
|
|
return new jQuerySub.fn.init( selector, context );
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
|
|
|
};
|
|
|
|
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
|
|
|
var rootjQuerySub = jQuerySub(document);
|
|
|
|
return jQuerySub;
|
|
|
|
};
|
2012-08-21 03:09:46 +00:00
|
|
|
|
2012-10-16 04:15:22 +00:00
|
|
|
jQuery.fn.toggle = function( fn, fn2 ) {
|
|
|
|
|
|
|
|
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
|
|
|
return oldToggle.apply( this, arguments );
|
|
|
|
}
|
|
|
|
|
2012-10-15 21:20:33 +00:00
|
|
|
// Save reference to arguments for access in closure
|
|
|
|
var args = arguments,
|
2012-10-16 18:36:47 +00:00
|
|
|
guid = fn.guid || jQuery.guid++,
|
|
|
|
i = 0,
|
|
|
|
toggler = function( event ) {
|
|
|
|
// Figure out which function to execute
|
|
|
|
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
|
|
|
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
2012-10-15 21:20:33 +00:00
|
|
|
|
2012-10-16 18:36:47 +00:00
|
|
|
// Make sure that clicks stop
|
|
|
|
event.preventDefault();
|
2012-10-15 21:20:33 +00:00
|
|
|
|
2012-10-16 18:36:47 +00:00
|
|
|
// and execute the function
|
|
|
|
return args[ lastToggle ].apply( this, arguments ) || false;
|
|
|
|
};
|
2012-10-15 21:20:33 +00:00
|
|
|
|
|
|
|
// link all the functions, so any of them can unbind this click handler
|
|
|
|
toggler.guid = guid;
|
|
|
|
while ( i < args.length ) {
|
|
|
|
args[ i++ ].guid = guid;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.click( toggler );
|
|
|
|
};
|
|
|
|
|
2012-10-16 18:36:47 +00:00
|
|
|
|
|
|
|
// Support for 'hover' type
|
|
|
|
eventAdd = jQuery.event.add;
|
|
|
|
|
|
|
|
// Duck punch jQuery.event.add, and jquery.event.remove
|
|
|
|
// Signatures:
|
|
|
|
// jQuery.event = {
|
|
|
|
// add: function( elem, types, handler, data, selector ) {
|
|
|
|
// remove: function( elem, types, handler, selector, mappedTypes ) {
|
|
|
|
jQuery.event.add = function( elem, types, handler, data, selector ){
|
|
|
|
if ( types ) {
|
|
|
|
types = hoverHack( types );
|
|
|
|
}
|
|
|
|
eventAdd.call( this, elem, types, handler, data, selector );
|
|
|
|
};
|
|
|
|
|
|
|
|
eventRemove = jQuery.event.remove;
|
|
|
|
|
|
|
|
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
|
|
|
if ( types ) {
|
|
|
|
types = hoverHack( types );
|
|
|
|
}
|
|
|
|
eventRemove.call( this, elem, types, handler, selector, mappedTypes );
|
|
|
|
};
|
|
|
|
|
|
|
|
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
|
|
|
|
jQuery.attrFn = {};
|
|
|
|
|
2012-06-25 14:02:28 +00:00
|
|
|
})();
|