2017-05-13 13:25:33 +02:00
|
|
|
define( [
|
2014-05-12 20:08:19 +02:00
|
|
|
"./core",
|
2019-03-29 22:00:08 +01:00
|
|
|
"./core/camelCase",
|
2017-05-13 13:25:33 +02:00
|
|
|
"./var/document",
|
2019-03-29 22:00:08 +01:00
|
|
|
"./var/isFunction",
|
2017-05-13 13:25:33 +02:00
|
|
|
"./var/rcssNum",
|
|
|
|
"./var/rnothtmlwhite",
|
2014-05-12 20:08:19 +02:00
|
|
|
"./css/var/cssExpand",
|
2017-05-13 13:25:33 +02:00
|
|
|
"./css/var/isHiddenWithinTree",
|
|
|
|
"./css/adjustCSS",
|
|
|
|
"./data/var/dataPriv",
|
|
|
|
"./css/showHide",
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
"./core/init",
|
|
|
|
"./queue",
|
|
|
|
"./deferred",
|
2017-05-13 13:25:33 +02:00
|
|
|
"./traversing",
|
|
|
|
"./manipulation",
|
|
|
|
"./css",
|
|
|
|
"./effects/Tween"
|
2019-03-29 22:00:08 +01:00
|
|
|
], function( jQuery, camelCase, document, isFunction, rcssNum, rnothtmlwhite, cssExpand,
|
2022-08-02 15:24:19 +02:00
|
|
|
isHiddenWithinTree, adjustCSS, dataPriv, showHide ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
"use strict";
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
var
|
2017-05-13 13:25:33 +02:00
|
|
|
fxNow, inProgress,
|
2014-05-12 20:08:19 +02:00
|
|
|
rfxtypes = /^(?:toggle|show|hide)$/,
|
2017-05-13 13:25:33 +02:00
|
|
|
rrun = /queueHooks$/;
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
function schedule() {
|
|
|
|
if ( inProgress ) {
|
|
|
|
if ( document.hidden === false && window.requestAnimationFrame ) {
|
|
|
|
window.requestAnimationFrame( schedule );
|
|
|
|
} else {
|
|
|
|
window.setTimeout( schedule, jQuery.fx.interval );
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
jQuery.fx.tick();
|
|
|
|
}
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
// Animations created synchronously will run synchronously
|
|
|
|
function createFxNow() {
|
2017-05-13 13:25:33 +02:00
|
|
|
window.setTimeout( function() {
|
2014-05-12 20:08:19 +02:00
|
|
|
fxNow = undefined;
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2019-03-29 22:00:08 +01:00
|
|
|
return ( fxNow = Date.now() );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Generate parameters to create a standard animation
|
|
|
|
function genFx( type, includeWidth ) {
|
|
|
|
var which,
|
|
|
|
i = 0,
|
|
|
|
attrs = { height: type };
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// If we include width, step value is 1 to do all cssExpand values,
|
|
|
|
// otherwise step value is 2 to skip over Left and Right
|
2014-05-12 20:08:19 +02:00
|
|
|
includeWidth = includeWidth ? 1 : 0;
|
2017-05-13 13:25:33 +02:00
|
|
|
for ( ; i < 4; i += 2 - includeWidth ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
which = cssExpand[ i ];
|
|
|
|
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( includeWidth ) {
|
|
|
|
attrs.opacity = attrs.width = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
return attrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
function createTween( value, prop, animation ) {
|
|
|
|
var tween,
|
2017-05-13 13:25:33 +02:00
|
|
|
collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
|
2014-05-12 20:08:19 +02:00
|
|
|
index = 0,
|
|
|
|
length = collection.length;
|
|
|
|
for ( ; index < length; index++ ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// We're done with this property
|
2014-05-12 20:08:19 +02:00
|
|
|
return tween;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function defaultPrefilter( elem, props, opts ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
|
|
|
|
isBox = "width" in props || "height" in props,
|
2014-05-12 20:08:19 +02:00
|
|
|
anim = this,
|
|
|
|
orig = {},
|
|
|
|
style = elem.style,
|
2017-05-13 13:25:33 +02:00
|
|
|
hidden = elem.nodeType && isHiddenWithinTree( elem ),
|
|
|
|
dataShow = dataPriv.get( elem, "fxshow" );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Queue-skipping animations hijack the fx hooks
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( !opts.queue ) {
|
|
|
|
hooks = jQuery._queueHooks( elem, "fx" );
|
|
|
|
if ( hooks.unqueued == null ) {
|
|
|
|
hooks.unqueued = 0;
|
|
|
|
oldfire = hooks.empty.fire;
|
|
|
|
hooks.empty.fire = function() {
|
|
|
|
if ( !hooks.unqueued ) {
|
|
|
|
oldfire();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
hooks.unqueued++;
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
anim.always( function() {
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Ensure the complete handler is called before this completes
|
2017-05-13 13:25:33 +02:00
|
|
|
anim.always( function() {
|
2014-05-12 20:08:19 +02:00
|
|
|
hooks.unqueued--;
|
|
|
|
if ( !jQuery.queue( elem, "fx" ).length ) {
|
|
|
|
hooks.empty.fire();
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Detect show/hide animations
|
|
|
|
for ( prop in props ) {
|
|
|
|
value = props[ prop ];
|
|
|
|
if ( rfxtypes.test( value ) ) {
|
|
|
|
delete props[ prop ];
|
|
|
|
toggle = toggle || value === "toggle";
|
|
|
|
if ( value === ( hidden ? "hide" : "show" ) ) {
|
|
|
|
|
|
|
|
// Pretend to be hidden if this is a "show" and
|
|
|
|
// there is still data from a stopped show/hide
|
|
|
|
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
|
|
|
|
hidden = true;
|
|
|
|
|
|
|
|
// Ignore all other no-op show/hide data
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bail out if this is a no-op like .hide().hide()
|
|
|
|
propTween = !jQuery.isEmptyObject( props );
|
|
|
|
if ( !propTween && jQuery.isEmptyObject( orig ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Restrict "overflow" and "display" styles during box animations
|
|
|
|
if ( isBox && elem.nodeType === 1 ) {
|
|
|
|
|
2019-03-29 22:00:08 +01:00
|
|
|
// Support: IE <=9 - 11, Edge 12 - 15
|
2017-05-13 13:25:33 +02:00
|
|
|
// Record all 3 overflow attributes because IE does not infer the shorthand
|
2019-03-29 22:00:08 +01:00
|
|
|
// from identically-valued overflowX and overflowY and Edge just mirrors
|
|
|
|
// the overflowX value there.
|
2014-05-12 20:08:19 +02:00
|
|
|
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Identify a display type, preferring old show/hide data over the CSS cascade
|
|
|
|
restoreDisplay = dataShow && dataShow.display;
|
|
|
|
if ( restoreDisplay == null ) {
|
|
|
|
restoreDisplay = dataPriv.get( elem, "display" );
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
display = jQuery.css( elem, "display" );
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( display === "none" ) {
|
|
|
|
if ( restoreDisplay ) {
|
|
|
|
display = restoreDisplay;
|
|
|
|
} else {
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Get nonempty value(s) by temporarily forcing visibility
|
|
|
|
showHide( [ elem ], true );
|
|
|
|
restoreDisplay = elem.style.display || restoreDisplay;
|
|
|
|
display = jQuery.css( elem, "display" );
|
|
|
|
showHide( [ elem ] );
|
|
|
|
}
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Animate inline elements as inline-block
|
|
|
|
if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
|
|
|
|
if ( jQuery.css( elem, "float" ) === "none" ) {
|
|
|
|
|
|
|
|
// Restore the original display value at the end of pure show/hide animations
|
|
|
|
if ( !propTween ) {
|
|
|
|
anim.done( function() {
|
|
|
|
style.display = restoreDisplay;
|
|
|
|
} );
|
|
|
|
if ( restoreDisplay == null ) {
|
|
|
|
display = style.display;
|
|
|
|
restoreDisplay = display === "none" ? "" : display;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
style.display = "inline-block";
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( opts.overflow ) {
|
|
|
|
style.overflow = "hidden";
|
2017-05-13 13:25:33 +02:00
|
|
|
anim.always( function() {
|
2014-05-12 20:08:19 +02:00
|
|
|
style.overflow = opts.overflow[ 0 ];
|
|
|
|
style.overflowX = opts.overflow[ 1 ];
|
|
|
|
style.overflowY = opts.overflow[ 2 ];
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Implement show/hide animations
|
|
|
|
propTween = false;
|
|
|
|
for ( prop in orig ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// General show/hide setup for this element animation
|
|
|
|
if ( !propTween ) {
|
|
|
|
if ( dataShow ) {
|
|
|
|
if ( "hidden" in dataShow ) {
|
|
|
|
hidden = dataShow.hidden;
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} else {
|
|
|
|
dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
|
|
|
|
if ( toggle ) {
|
|
|
|
dataShow.hidden = !hidden;
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Show elements before animating them
|
|
|
|
if ( hidden ) {
|
|
|
|
showHide( [ elem ], true );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
/* eslint-disable no-loop-func */
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
anim.done( function() {
|
|
|
|
|
2022-08-02 15:24:19 +02:00
|
|
|
/* eslint-enable no-loop-func */
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
// The final step of a "hide" animation is actually hiding the element
|
|
|
|
if ( !hidden ) {
|
|
|
|
showHide( [ elem ] );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
dataPriv.remove( elem, "fxshow" );
|
|
|
|
for ( prop in orig ) {
|
|
|
|
jQuery.style( elem, prop, orig[ prop ] );
|
|
|
|
}
|
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Per-property setup
|
|
|
|
propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
|
|
|
|
if ( !( prop in dataShow ) ) {
|
|
|
|
dataShow[ prop ] = propTween.start;
|
|
|
|
if ( hidden ) {
|
|
|
|
propTween.end = propTween.start;
|
|
|
|
propTween.start = 0;
|
|
|
|
}
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function propFilter( props, specialEasing ) {
|
|
|
|
var index, name, easing, value, hooks;
|
|
|
|
|
|
|
|
// camelCase, specialEasing and expand cssHook pass
|
|
|
|
for ( index in props ) {
|
2019-03-29 22:00:08 +01:00
|
|
|
name = camelCase( index );
|
2014-05-12 20:08:19 +02:00
|
|
|
easing = specialEasing[ name ];
|
|
|
|
value = props[ index ];
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( Array.isArray( value ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
easing = value[ 1 ];
|
|
|
|
value = props[ index ] = value[ 0 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( index !== name ) {
|
|
|
|
props[ name ] = value;
|
|
|
|
delete props[ index ];
|
|
|
|
}
|
|
|
|
|
|
|
|
hooks = jQuery.cssHooks[ name ];
|
|
|
|
if ( hooks && "expand" in hooks ) {
|
|
|
|
value = hooks.expand( value );
|
|
|
|
delete props[ name ];
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Not quite $.extend, this won't overwrite existing keys.
|
|
|
|
// Reusing 'index' because we have the correct "name"
|
2014-05-12 20:08:19 +02:00
|
|
|
for ( index in value ) {
|
|
|
|
if ( !( index in props ) ) {
|
|
|
|
props[ index ] = value[ index ];
|
|
|
|
specialEasing[ index ] = easing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
specialEasing[ name ] = easing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Animation( elem, properties, options ) {
|
|
|
|
var result,
|
|
|
|
stopped,
|
|
|
|
index = 0,
|
2017-05-13 13:25:33 +02:00
|
|
|
length = Animation.prefilters.length,
|
2014-05-12 20:08:19 +02:00
|
|
|
deferred = jQuery.Deferred().always( function() {
|
2017-05-13 13:25:33 +02:00
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Don't match elem in the :animated selector
|
2014-05-12 20:08:19 +02:00
|
|
|
delete tick.elem;
|
2017-05-13 13:25:33 +02:00
|
|
|
} ),
|
2014-05-12 20:08:19 +02:00
|
|
|
tick = function() {
|
|
|
|
if ( stopped ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var currentTime = fxNow || createFxNow(),
|
|
|
|
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
// Support: Android 2.3 only
|
2016-05-16 13:33:49 +02:00
|
|
|
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
|
2014-05-12 20:08:19 +02:00
|
|
|
temp = remaining / animation.duration || 0,
|
|
|
|
percent = 1 - temp,
|
|
|
|
index = 0,
|
|
|
|
length = animation.tweens.length;
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
for ( ; index < length; index++ ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
animation.tweens[ index ].run( percent );
|
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
deferred.notifyWith( elem, [ animation, percent, remaining ] );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// If there's more to do, yield
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( percent < 1 && length ) {
|
|
|
|
return remaining;
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
// If this was an empty animation, synthesize a final progress notification
|
|
|
|
if ( !length ) {
|
|
|
|
deferred.notifyWith( elem, [ animation, 1, 0 ] );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resolve the animation and report its conclusion
|
|
|
|
deferred.resolveWith( elem, [ animation ] );
|
|
|
|
return false;
|
2014-05-12 20:08:19 +02:00
|
|
|
},
|
2017-05-13 13:25:33 +02:00
|
|
|
animation = deferred.promise( {
|
2014-05-12 20:08:19 +02:00
|
|
|
elem: elem,
|
|
|
|
props: jQuery.extend( {}, properties ),
|
2017-05-13 13:25:33 +02:00
|
|
|
opts: jQuery.extend( true, {
|
|
|
|
specialEasing: {},
|
|
|
|
easing: jQuery.easing._default
|
|
|
|
}, options ),
|
2014-05-12 20:08:19 +02:00
|
|
|
originalProperties: properties,
|
|
|
|
originalOptions: options,
|
|
|
|
startTime: fxNow || createFxNow(),
|
|
|
|
duration: options.duration,
|
|
|
|
tweens: [],
|
|
|
|
createTween: function( prop, end ) {
|
|
|
|
var tween = jQuery.Tween( elem, animation.opts, prop, end,
|
2022-08-02 15:24:19 +02:00
|
|
|
animation.opts.specialEasing[ prop ] || animation.opts.easing );
|
2014-05-12 20:08:19 +02:00
|
|
|
animation.tweens.push( tween );
|
|
|
|
return tween;
|
|
|
|
},
|
|
|
|
stop: function( gotoEnd ) {
|
|
|
|
var index = 0,
|
2017-05-13 13:25:33 +02:00
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// If we are going to the end, we want to run all the tweens
|
2014-05-12 20:08:19 +02:00
|
|
|
// otherwise we skip this part
|
|
|
|
length = gotoEnd ? animation.tweens.length : 0;
|
|
|
|
if ( stopped ) {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
stopped = true;
|
2017-05-13 13:25:33 +02:00
|
|
|
for ( ; index < length; index++ ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
animation.tweens[ index ].run( 1 );
|
|
|
|
}
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Resolve when we played the last frame; otherwise, reject
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( gotoEnd ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
deferred.notifyWith( elem, [ animation, 1, 0 ] );
|
2014-05-12 20:08:19 +02:00
|
|
|
deferred.resolveWith( elem, [ animation, gotoEnd ] );
|
|
|
|
} else {
|
|
|
|
deferred.rejectWith( elem, [ animation, gotoEnd ] );
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} ),
|
2014-05-12 20:08:19 +02:00
|
|
|
props = animation.props;
|
|
|
|
|
|
|
|
propFilter( props, animation.opts.specialEasing );
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
for ( ; index < length; index++ ) {
|
|
|
|
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( result ) {
|
2019-03-29 22:00:08 +01:00
|
|
|
if ( isFunction( result.stop ) ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
|
2019-03-29 22:00:08 +01:00
|
|
|
result.stop.bind( result );
|
2017-05-13 13:25:33 +02:00
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jQuery.map( props, createTween, animation );
|
|
|
|
|
2019-03-29 22:00:08 +01:00
|
|
|
if ( isFunction( animation.opts.start ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
animation.opts.start.call( elem, animation );
|
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Attach callbacks from options
|
|
|
|
animation
|
|
|
|
.progress( animation.opts.progress )
|
|
|
|
.done( animation.opts.done, animation.opts.complete )
|
|
|
|
.fail( animation.opts.fail )
|
|
|
|
.always( animation.opts.always );
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
jQuery.fx.timer(
|
|
|
|
jQuery.extend( tick, {
|
|
|
|
elem: elem,
|
|
|
|
anim: animation,
|
|
|
|
queue: animation.opts.queue
|
2017-05-13 13:25:33 +02:00
|
|
|
} )
|
2014-05-12 20:08:19 +02:00
|
|
|
);
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
return animation;
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jQuery.Animation = jQuery.extend( Animation, {
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
tweeners: {
|
|
|
|
"*": [ function( prop, value ) {
|
|
|
|
var tween = this.createTween( prop, value );
|
|
|
|
adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
|
|
|
|
return tween;
|
|
|
|
} ]
|
|
|
|
},
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
tweener: function( props, callback ) {
|
2019-03-29 22:00:08 +01:00
|
|
|
if ( isFunction( props ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
callback = props;
|
|
|
|
props = [ "*" ];
|
|
|
|
} else {
|
2017-05-13 13:25:33 +02:00
|
|
|
props = props.match( rnothtmlwhite );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var prop,
|
|
|
|
index = 0,
|
|
|
|
length = props.length;
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
for ( ; index < length; index++ ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
prop = props[ index ];
|
2017-05-13 13:25:33 +02:00
|
|
|
Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
|
|
|
|
Animation.tweeners[ prop ].unshift( callback );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
prefilters: [ defaultPrefilter ],
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
prefilter: function( callback, prepend ) {
|
|
|
|
if ( prepend ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
Animation.prefilters.unshift( callback );
|
2014-05-12 20:08:19 +02:00
|
|
|
} else {
|
2017-05-13 13:25:33 +02:00
|
|
|
Animation.prefilters.push( callback );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
jQuery.speed = function( speed, easing, fn ) {
|
|
|
|
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
|
|
|
|
complete: fn || !fn && easing ||
|
2019-03-29 22:00:08 +01:00
|
|
|
isFunction( speed ) && speed,
|
2014-05-12 20:08:19 +02:00
|
|
|
duration: speed,
|
2019-03-29 22:00:08 +01:00
|
|
|
easing: fn && easing || easing && !isFunction( easing ) && easing
|
2014-05-12 20:08:19 +02:00
|
|
|
};
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
// Go to the end state if fx are off
|
|
|
|
if ( jQuery.fx.off ) {
|
|
|
|
opt.duration = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if ( typeof opt.duration !== "number" ) {
|
|
|
|
if ( opt.duration in jQuery.fx.speeds ) {
|
|
|
|
opt.duration = jQuery.fx.speeds[ opt.duration ];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
opt.duration = jQuery.fx.speeds._default;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Normalize opt.queue - true/undefined/null -> "fx"
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( opt.queue == null || opt.queue === true ) {
|
|
|
|
opt.queue = "fx";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Queueing
|
|
|
|
opt.old = opt.complete;
|
|
|
|
|
|
|
|
opt.complete = function() {
|
2019-03-29 22:00:08 +01:00
|
|
|
if ( isFunction( opt.old ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
opt.old.call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( opt.queue ) {
|
|
|
|
jQuery.dequeue( this, opt.queue );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return opt;
|
|
|
|
};
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
jQuery.fn.extend( {
|
2014-05-12 20:08:19 +02:00
|
|
|
fadeTo: function( speed, to, easing, callback ) {
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Show any hidden elements after setting opacity to 0
|
2017-05-13 13:25:33 +02:00
|
|
|
return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Animate to the value specified
|
2017-05-13 13:25:33 +02:00
|
|
|
.end().animate( { opacity: to }, speed, easing, callback );
|
2014-05-12 20:08:19 +02:00
|
|
|
},
|
|
|
|
animate: function( prop, speed, easing, callback ) {
|
|
|
|
var empty = jQuery.isEmptyObject( prop ),
|
|
|
|
optall = jQuery.speed( speed, easing, callback ),
|
|
|
|
doAnimation = function() {
|
2017-05-13 13:25:33 +02:00
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
// Operate on a copy of prop so per-property easing won't be lost
|
|
|
|
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
|
|
|
|
|
|
|
|
// Empty animations, or finishing resolves immediately
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( empty || dataPriv.get( this, "finish" ) ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
anim.stop( true );
|
|
|
|
}
|
|
|
|
};
|
2022-08-02 15:24:19 +02:00
|
|
|
|
|
|
|
doAnimation.finish = doAnimation;
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
return empty || optall.queue === false ?
|
|
|
|
this.each( doAnimation ) :
|
|
|
|
this.queue( optall.queue, doAnimation );
|
|
|
|
},
|
|
|
|
stop: function( type, clearQueue, gotoEnd ) {
|
|
|
|
var stopQueue = function( hooks ) {
|
|
|
|
var stop = hooks.stop;
|
|
|
|
delete hooks.stop;
|
|
|
|
stop( gotoEnd );
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( typeof type !== "string" ) {
|
|
|
|
gotoEnd = clearQueue;
|
|
|
|
clearQueue = type;
|
|
|
|
type = undefined;
|
|
|
|
}
|
2022-08-02 15:24:19 +02:00
|
|
|
if ( clearQueue ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
this.queue( type || "fx", [] );
|
|
|
|
}
|
|
|
|
|
2017-05-13 13:25:33 +02:00
|
|
|
return this.each( function() {
|
2014-05-12 20:08:19 +02:00
|
|
|
var dequeue = true,
|
|
|
|
index = type != null && type + "queueHooks",
|
|
|
|
timers = jQuery.timers,
|
2017-05-13 13:25:33 +02:00
|
|
|
data = dataPriv.get( this );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
if ( index ) {
|
|
|
|
if ( data[ index ] && data[ index ].stop ) {
|
|
|
|
stopQueue( data[ index ] );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for ( index in data ) {
|
|
|
|
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
|
|
|
|
stopQueue( data[ index ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( index = timers.length; index--; ) {
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( timers[ index ].elem === this &&
|
|
|
|
( type == null || timers[ index ].queue === type ) ) {
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
timers[ index ].anim.stop( gotoEnd );
|
|
|
|
dequeue = false;
|
|
|
|
timers.splice( index, 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Start the next in the queue if the last step wasn't forced.
|
|
|
|
// Timers currently will call their complete callbacks, which
|
|
|
|
// will dequeue but only if they were gotoEnd.
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( dequeue || !gotoEnd ) {
|
|
|
|
jQuery.dequeue( this, type );
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
},
|
|
|
|
finish: function( type ) {
|
|
|
|
if ( type !== false ) {
|
|
|
|
type = type || "fx";
|
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
return this.each( function() {
|
2014-05-12 20:08:19 +02:00
|
|
|
var index,
|
2017-05-13 13:25:33 +02:00
|
|
|
data = dataPriv.get( this ),
|
2014-05-12 20:08:19 +02:00
|
|
|
queue = data[ type + "queue" ],
|
|
|
|
hooks = data[ type + "queueHooks" ],
|
|
|
|
timers = jQuery.timers,
|
|
|
|
length = queue ? queue.length : 0;
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Enable finishing flag on private data
|
2014-05-12 20:08:19 +02:00
|
|
|
data.finish = true;
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Empty the queue first
|
2014-05-12 20:08:19 +02:00
|
|
|
jQuery.queue( this, type, [] );
|
|
|
|
|
|
|
|
if ( hooks && hooks.stop ) {
|
|
|
|
hooks.stop.call( this, true );
|
|
|
|
}
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Look for any active animations, and finish them
|
2014-05-12 20:08:19 +02:00
|
|
|
for ( index = timers.length; index--; ) {
|
|
|
|
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
|
|
|
|
timers[ index ].anim.stop( true );
|
|
|
|
timers.splice( index, 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Look for any animations in the old queue and finish them
|
2014-05-12 20:08:19 +02:00
|
|
|
for ( index = 0; index < length; index++ ) {
|
|
|
|
if ( queue[ index ] && queue[ index ].finish ) {
|
|
|
|
queue[ index ].finish.call( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-16 13:33:49 +02:00
|
|
|
// Turn off finishing flag
|
2014-05-12 20:08:19 +02:00
|
|
|
delete data.finish;
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2022-08-02 15:24:19 +02:00
|
|
|
jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
|
2014-05-12 20:08:19 +02:00
|
|
|
var cssFn = jQuery.fn[ name ];
|
|
|
|
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
|
|
|
return speed == null || typeof speed === "boolean" ?
|
|
|
|
cssFn.apply( this, arguments ) :
|
|
|
|
this.animate( genFx( name, true ), speed, easing, callback );
|
|
|
|
};
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
// Generate shortcuts for custom animations
|
2017-05-13 13:25:33 +02:00
|
|
|
jQuery.each( {
|
|
|
|
slideDown: genFx( "show" ),
|
|
|
|
slideUp: genFx( "hide" ),
|
|
|
|
slideToggle: genFx( "toggle" ),
|
2014-05-12 20:08:19 +02:00
|
|
|
fadeIn: { opacity: "show" },
|
|
|
|
fadeOut: { opacity: "hide" },
|
|
|
|
fadeToggle: { opacity: "toggle" }
|
|
|
|
}, function( name, props ) {
|
|
|
|
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
|
|
|
return this.animate( props, speed, easing, callback );
|
|
|
|
};
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
jQuery.timers = [];
|
|
|
|
jQuery.fx.tick = function() {
|
|
|
|
var timer,
|
|
|
|
i = 0,
|
|
|
|
timers = jQuery.timers;
|
|
|
|
|
2019-03-29 22:00:08 +01:00
|
|
|
fxNow = Date.now();
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
for ( ; i < timers.length; i++ ) {
|
|
|
|
timer = timers[ i ];
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
// Run the timer and safely remove it when done (allowing for external removal)
|
2014-05-12 20:08:19 +02:00
|
|
|
if ( !timer() && timers[ i ] === timer ) {
|
|
|
|
timers.splice( i--, 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !timers.length ) {
|
|
|
|
jQuery.fx.stop();
|
|
|
|
}
|
|
|
|
fxNow = undefined;
|
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fx.timer = function( timer ) {
|
|
|
|
jQuery.timers.push( timer );
|
2017-05-13 13:25:33 +02:00
|
|
|
jQuery.fx.start();
|
2014-05-12 20:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fx.interval = 13;
|
|
|
|
jQuery.fx.start = function() {
|
2017-05-13 13:25:33 +02:00
|
|
|
if ( inProgress ) {
|
|
|
|
return;
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
2017-05-13 13:25:33 +02:00
|
|
|
|
|
|
|
inProgress = true;
|
|
|
|
schedule();
|
2014-05-12 20:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fx.stop = function() {
|
2017-05-13 13:25:33 +02:00
|
|
|
inProgress = null;
|
2014-05-12 20:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.fx.speeds = {
|
|
|
|
slow: 600,
|
|
|
|
fast: 200,
|
2017-05-13 13:25:33 +02:00
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
// Default speed
|
|
|
|
_default: 400
|
|
|
|
};
|
|
|
|
|
|
|
|
return jQuery;
|
2017-05-13 13:25:33 +02:00
|
|
|
} );
|